mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 23:01:42 +00:00
Moved stored flobjects to class ScummEngine_v70he
svn-id: r23924
This commit is contained in:
parent
f4759feeab
commit
fab33bf663
@ -129,6 +129,9 @@ protected:
|
||||
|
||||
bool _skipProcessActors;
|
||||
|
||||
int _numStoredFlObjects;
|
||||
ObjectData *_storedFlObjects;
|
||||
|
||||
public:
|
||||
ScummEngine_v70he(OSystem *syst, const DetectorResult &dr);
|
||||
~ScummEngine_v70he();
|
||||
@ -153,8 +156,15 @@ protected:
|
||||
virtual void readGlobalObjects();
|
||||
virtual void readIndexBlock(uint32 blocktype, uint32 itemsize);
|
||||
|
||||
virtual void clearRoomObjects();
|
||||
virtual void resetRoomObjects();
|
||||
|
||||
virtual int getActorFromPos(int x, int y);
|
||||
|
||||
virtual void loadFlObject(uint object, uint room);
|
||||
void storeFlObject(int slot);
|
||||
void restoreFlObjects();
|
||||
|
||||
int getStringCharWidth(byte chr);
|
||||
virtual int setupStringArray(int size);
|
||||
void appendSubstring(int dst, int src, int len2, int len);
|
||||
|
@ -489,8 +489,6 @@ void ScummEngine::clearRoomObjects() {
|
||||
_objs[i].obj_nr = 0;
|
||||
}
|
||||
} else {
|
||||
storeFlObject(-1);
|
||||
|
||||
for (i = 0; i < _numLocalObjects; i++) {
|
||||
if (_objs[i].obj_nr < 1) // Optimise codepath
|
||||
continue;
|
||||
@ -504,31 +502,48 @@ void ScummEngine::clearRoomObjects() {
|
||||
_res->nukeResource(rtFlObject, _objs[i].fl_object_index);
|
||||
_objs[i].obj_nr = 0;
|
||||
_objs[i].fl_object_index = 0;
|
||||
} else if (_game.heversion >= 70) {
|
||||
storeFlObject(i);
|
||||
_objs[i].obj_nr = 0;
|
||||
_objs[i].fl_object_index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScummEngine::storeFlObject(int slot) {
|
||||
if (slot == -1) {
|
||||
_numStoredFlObjects = 0;
|
||||
} else {
|
||||
memcpy(&_storedFlObjects[_numStoredFlObjects], &_objs[slot], sizeof(_objs[slot]));
|
||||
_numStoredFlObjects++;
|
||||
if (_numStoredFlObjects > 100)
|
||||
error("Too many flobjects saved on room transition.");
|
||||
}
|
||||
void ScummEngine_v70he::resetRoomObjects() {
|
||||
ScummEngine_v60he::resetRoomObjects();
|
||||
restoreFlObjects();
|
||||
}
|
||||
|
||||
void ScummEngine::restoreFlObjects() {
|
||||
if (!_numStoredFlObjects)
|
||||
return;
|
||||
void ScummEngine_v70he::clearRoomObjects() {
|
||||
_numStoredFlObjects = 0;
|
||||
|
||||
for (int i = 0; i < _numLocalObjects; i++) {
|
||||
if (_objs[i].obj_nr < 1) // Optimise codepath
|
||||
continue;
|
||||
|
||||
if (_objs[i].fl_object_index != 0) {
|
||||
if (!_res->isLocked(rtFlObject, _objs[i].fl_object_index)) {
|
||||
_res->nukeResource(rtFlObject, _objs[i].fl_object_index);
|
||||
} else {
|
||||
storeFlObject(i);
|
||||
}
|
||||
}
|
||||
_objs[i].fl_object_index = 0;
|
||||
_objs[i].obj_nr = 0;
|
||||
}
|
||||
|
||||
if (_currentRoom == 0)
|
||||
restoreFlObjects();
|
||||
}
|
||||
|
||||
|
||||
void ScummEngine_v70he::storeFlObject(int slot) {
|
||||
memcpy(&_storedFlObjects[_numStoredFlObjects], &_objs[slot], sizeof(_objs[slot]));
|
||||
_numStoredFlObjects++;
|
||||
if (_numStoredFlObjects > 100)
|
||||
error("Too many flobjects saved on room transition.");
|
||||
}
|
||||
|
||||
void ScummEngine_v70he::restoreFlObjects() {
|
||||
int i, slot;
|
||||
|
||||
for (i = 0; i < _numStoredFlObjects; i++) {
|
||||
@ -1736,9 +1751,19 @@ int ScummEngine::findFlObjectSlot() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ScummEngine_v70he::loadFlObject(uint object, uint room) {
|
||||
// Don't load an already stored object
|
||||
for (int i = 0; i < _numStoredFlObjects; i++) {
|
||||
if (_storedFlObjects[i].obj_nr == object)
|
||||
return;
|
||||
}
|
||||
|
||||
ScummEngine_v60he::loadFlObject(object, room);
|
||||
}
|
||||
|
||||
void ScummEngine::loadFlObject(uint object, uint room) {
|
||||
FindObjectInRoom foir;
|
||||
int i, slot, objslot;
|
||||
int slot, objslot;
|
||||
ObjectData *od;
|
||||
byte *flob;
|
||||
uint32 obcd_size, obim_size, flob_size;
|
||||
@ -1748,12 +1773,6 @@ void ScummEngine::loadFlObject(uint object, uint room) {
|
||||
if (getObjectIndex(object) != -1)
|
||||
return;
|
||||
|
||||
// Don't load an already stored object
|
||||
for (i = 0; i < _numStoredFlObjects; i++) {
|
||||
if (_storedFlObjects[i].obj_nr == object)
|
||||
return;
|
||||
}
|
||||
|
||||
// Locate the object in the room resource
|
||||
findObjectInRoom(&foir, foImageHeader | foCodeHeader, object, room);
|
||||
|
||||
|
@ -1288,9 +1288,6 @@ void ScummEngine::allocateArrays() {
|
||||
if (_game.heversion >= 60) {
|
||||
_arraySlot = (byte *)calloc(_numArray, 1);
|
||||
}
|
||||
if (_game.heversion >= 70) {
|
||||
_storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData));
|
||||
}
|
||||
|
||||
_res->allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKID_BE('AKOS') : MKID_BE('COST'),
|
||||
_numCostumes, "costume", 1);
|
||||
|
@ -139,7 +139,6 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
|
||||
if (_currentRoom == 0) {
|
||||
_ENCD_offs = _EXCD_offs = 0;
|
||||
_numObjectsInRoom = 0;
|
||||
restoreFlObjects();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,7 +148,6 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
|
||||
initBGBuffers(_roomHeight);
|
||||
|
||||
resetRoomObjects();
|
||||
restoreFlObjects();
|
||||
|
||||
if (VAR_ROOM_WIDTH != 0xFF && VAR_ROOM_HEIGHT != 0xFF) {
|
||||
VAR(VAR_ROOM_WIDTH) = _roomWidth;
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "scumm/he/intern_he.h"
|
||||
#include "scumm/he/logic_he.h"
|
||||
#include "scumm/he/sound_he.h"
|
||||
#include "scumm/object.h"
|
||||
#include "scumm/player_nes.h"
|
||||
#include "scumm/player_v1.h"
|
||||
#include "scumm/player_v2.h"
|
||||
@ -243,7 +244,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
|
||||
_musicEngine = NULL;
|
||||
_verbs = NULL;
|
||||
_objs = NULL;
|
||||
_storedFlObjects = NULL;
|
||||
_debugFlags = 0;
|
||||
_sound = NULL;
|
||||
memset(&vm, 0, sizeof(vm));
|
||||
@ -268,7 +268,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
|
||||
_numRoomVariables = 0;
|
||||
_numLocalObjects = 0;
|
||||
_numGlobalObjects = 0;
|
||||
_numStoredFlObjects = 0;
|
||||
_numArray = 0;
|
||||
_numVerbs = 0;
|
||||
_numFlObject = 0;
|
||||
@ -836,6 +835,9 @@ ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const DetectorResult &dr)
|
||||
|
||||
_skipProcessActors = 0;
|
||||
|
||||
_numStoredFlObjects = 0;
|
||||
_storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData));
|
||||
|
||||
VAR_NUM_SOUND_CHANNELS = 0xFF;
|
||||
VAR_WIZ_TCOLOR = 0xFF;
|
||||
}
|
||||
|
@ -432,7 +432,6 @@ public:
|
||||
|
||||
VerbSlot *_verbs;
|
||||
ObjectData *_objs;
|
||||
ObjectData *_storedFlObjects;
|
||||
ScummDebugger *_debugger;
|
||||
|
||||
// Core variables
|
||||
@ -582,7 +581,6 @@ protected:
|
||||
int _numNewNames, _numGlobalScripts;
|
||||
int _numRoomVariables;
|
||||
int _numPalettes, _numSprites, _numTalkies, _numUnk;
|
||||
int _numStoredFlObjects;
|
||||
int _HEHeapSize;
|
||||
public:
|
||||
int _numLocalScripts, _numImages, _numRooms, _numScripts, _numSounds; // Used by HE games
|
||||
@ -800,10 +798,7 @@ protected:
|
||||
virtual void setupRoomSubBlocks();
|
||||
virtual void resetRoomSubBlocks();
|
||||
|
||||
void storeFlObject(int slot);
|
||||
void restoreFlObjects();
|
||||
|
||||
void clearRoomObjects();
|
||||
virtual void clearRoomObjects();
|
||||
virtual void resetRoomObjects();
|
||||
virtual void resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
|
||||
|
||||
@ -838,7 +833,7 @@ public:
|
||||
|
||||
protected:
|
||||
void markObjectRectAsDirty(int obj);
|
||||
void loadFlObject(uint object, uint room);
|
||||
virtual void loadFlObject(uint object, uint room);
|
||||
void nukeFlObjects(int min, int max);
|
||||
int findFlObjectSlot();
|
||||
int findLocalObjectSlot();
|
||||
|
Loading…
x
Reference in New Issue
Block a user