SAGA2: Fix object access in scripts
This commit is contained in:
parent
f35039acb0
commit
c9a43228b9
6 changed files with 196 additions and 183 deletions
|
@ -151,7 +151,7 @@ uint16 *builtinVTableAddress(int16 btype, uint8 *addr, CallTable **callTab) {
|
|||
break;
|
||||
|
||||
case builtinTypeTAG:
|
||||
aItem = (ActiveItem *)addr;
|
||||
aItem = ((ActiveItemData *)addr)->aItem;
|
||||
script = aItem->_data.scriptClassID;
|
||||
*callTab = &tagCFuncs;
|
||||
|
||||
|
@ -161,7 +161,7 @@ uint16 *builtinVTableAddress(int16 btype, uint8 *addr, CallTable **callTab) {
|
|||
break;
|
||||
|
||||
case builtinTypeMission:
|
||||
aMission = (ActiveMission *)addr;
|
||||
aMission = ((ActiveMissionData *)addr)->aMission;
|
||||
script = aMission->getScript();
|
||||
*callTab = &missionCFuncs;
|
||||
|
||||
|
@ -849,7 +849,7 @@ bool Thread::interpret(void) {
|
|||
error("Invalid member function number");
|
||||
|
||||
// Set up thread-specific vars
|
||||
thisObject = ((ObjectData *)addr)->obj;
|
||||
thisObject = addr;
|
||||
argCount = n;
|
||||
threadArgs.invokedObject = offset;
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ ActiveMission *ActiveMission::newMission(ObjectID genID, uint16 script) {
|
|||
|
||||
memset(ms->_data.missionVars, 0, ARRAYSIZE(ms->_data.missionVars));
|
||||
|
||||
ms->_data.aMission = ms;
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
@ -192,6 +194,8 @@ void ActiveMission::read(Common::InSaveFile *in) {
|
|||
_data.numObjectIDs = in->readUint16LE();
|
||||
_data.numKnowledgeIDs = in->readUint16LE();
|
||||
|
||||
_data.aMission = this;
|
||||
|
||||
debugC(4, kDebugSaveload, "... numObjectIDs = %d", _data.numObjectIDs);
|
||||
debugC(4, kDebugSaveload, "... numKnowledgeIDs = %d", _data.numKnowledgeIDs);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ struct KnowledgeID {
|
|||
uint16 kID;
|
||||
};
|
||||
|
||||
class ActiveMission;
|
||||
|
||||
#include "common/pack-start.h"
|
||||
|
||||
// Mission flags
|
||||
|
@ -63,6 +65,8 @@ struct ActiveMissionData {
|
|||
KnowledgeID missionKnowledgeList[32];
|
||||
uint16 numObjectIDs,
|
||||
numKnowledgeIDs;
|
||||
|
||||
ActiveMission *aMission; // ActiveMission this ActiveMissionData belongs to
|
||||
} PACKED_STRUCT;
|
||||
|
||||
#include "common/pack-end.h"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1287,6 +1287,7 @@ ActiveItem::ActiveItem(ActiveItemList *parent, int ind, Common::SeekableReadStre
|
|||
_data.instance.targetV = stream->readUint16LE();
|
||||
_data.instance.targetZ = stream->readByte();
|
||||
_data.instance.worldNum = stream->readByte();
|
||||
_data.aItem = this;
|
||||
}
|
||||
|
||||
ActiveItemList::ActiveItemList(WorldMapData *parent, int count, Common::SeekableReadStream *stream) {
|
||||
|
|
|
@ -346,6 +346,8 @@ extern byte **stateArray;
|
|||
|
||||
class ActiveItemList;
|
||||
|
||||
class ActiveItem;
|
||||
|
||||
#include "common/pack-start.h"
|
||||
|
||||
struct ActiveItemData {
|
||||
|
@ -379,6 +381,8 @@ struct ActiveItemData {
|
|||
worldNum; // Add 0xf000 to get world Object ID
|
||||
} instance;
|
||||
};
|
||||
|
||||
ActiveItem *aItem; // active item this ActiveItemData is a part of
|
||||
} PACKED_STRUCT;
|
||||
|
||||
#include "common/pack-end.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue