ILLUSIONS: Rename ProgInfo -> SceneInfo
This commit is contained in:
parent
61a0b5badb
commit
8b48f2f63f
4 changed files with 57 additions and 57 deletions
|
@ -504,13 +504,13 @@ uint32 IllusionsEngine_BBDOU::newTempThreadId() {
|
|||
}
|
||||
|
||||
bool IllusionsEngine_BBDOU::enterScene(uint32 sceneId, uint32 threadId) {
|
||||
ProgInfo *progInfo = _scriptResource->getProgInfo(sceneId & 0xFFFF);
|
||||
if (!progInfo) {
|
||||
SceneInfo *sceneInfo = _scriptResource->getSceneInfo(sceneId & 0xFFFF);
|
||||
if (!sceneInfo) {
|
||||
dumpActiveScenes(_globalSceneId, threadId);
|
||||
sceneId = _theSceneId;
|
||||
}
|
||||
_activeScenes.push(sceneId);
|
||||
return progInfo != 0;
|
||||
return sceneInfo != 0;
|
||||
}
|
||||
|
||||
void IllusionsEngine_BBDOU::exitScene(uint32 threadId) {
|
||||
|
@ -563,9 +563,9 @@ void IllusionsEngine_BBDOU::setSceneIdThreadId(uint32 theSceneId, uint32 theThre
|
|||
}
|
||||
|
||||
bool IllusionsEngine_BBDOU::findTriggerCause(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &codeOffs) {
|
||||
ProgInfo *progInfo = _scriptResource->getProgInfo(sceneId & 0xFFFF);
|
||||
if (progInfo)
|
||||
return progInfo->findTriggerCause(verbId, objectId2, objectId, codeOffs);
|
||||
SceneInfo *sceneInfo = _scriptResource->getSceneInfo(sceneId & 0xFFFF);
|
||||
if (sceneInfo)
|
||||
return sceneInfo->findTriggerCause(verbId, objectId2, objectId, codeOffs);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -717,13 +717,13 @@ void IllusionsEngine_Duckman::popActiveScene() {
|
|||
}
|
||||
|
||||
bool IllusionsEngine_Duckman::loadScene(uint32 sceneId) {
|
||||
ProgInfo *progInfo = _scriptResource->getProgInfo(sceneId & 0xFFFF);
|
||||
if (!progInfo)
|
||||
SceneInfo *sceneInfo = _scriptResource->getSceneInfo(sceneId & 0xFFFF);
|
||||
if (!sceneInfo)
|
||||
return false;
|
||||
pushActiveScene(sceneId);
|
||||
uint resourcesCount;
|
||||
uint32 *resources;
|
||||
progInfo->getResources(resourcesCount, resources);
|
||||
sceneInfo->getResources(resourcesCount, resources);
|
||||
for (uint i = 0; i < resourcesCount; ++i)
|
||||
_resSys->loadResource(resources[i], sceneId, 0);
|
||||
return true;
|
||||
|
@ -789,9 +789,9 @@ void IllusionsEngine_Duckman::setSceneIdThreadId(uint32 theSceneId, uint32 theTh
|
|||
}
|
||||
|
||||
bool IllusionsEngine_Duckman::findTriggerCause(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &codeOffs) {
|
||||
ProgInfo *progInfo = _scriptResource->getProgInfo(sceneId & 0xFFFF);
|
||||
if (progInfo)
|
||||
return progInfo->findTriggerCause(verbId, objectId2, objectId, codeOffs);
|
||||
SceneInfo *sceneInfo = _scriptResource->getSceneInfo(sceneId & 0xFFFF);
|
||||
if (sceneInfo)
|
||||
return sceneInfo->findTriggerCause(verbId, objectId2, objectId, codeOffs);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -993,15 +993,15 @@ void IllusionsEngine_Duckman::playSoundEffect(int index) {
|
|||
}
|
||||
|
||||
bool IllusionsEngine_Duckman::getTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &outThreadId) {
|
||||
ProgInfo *progInfo = _scriptResource->getProgInfo(getCurrentScene() & 0xFFFF);
|
||||
SceneInfo *sceneInfo = _scriptResource->getSceneInfo(getCurrentScene() & 0xFFFF);
|
||||
bool found =
|
||||
progInfo->findTriggerCause(verbId, objectId2, objectId, outThreadId) ||
|
||||
progInfo->findTriggerCause(verbId, objectId2, 0x40001, outThreadId);
|
||||
sceneInfo->findTriggerCause(verbId, objectId2, objectId, outThreadId) ||
|
||||
sceneInfo->findTriggerCause(verbId, objectId2, 0x40001, outThreadId);
|
||||
if (!found) {
|
||||
progInfo = _scriptResource->getProgInfo(3);
|
||||
sceneInfo = _scriptResource->getSceneInfo(3);
|
||||
found =
|
||||
progInfo->findTriggerCause(verbId, objectId2, objectId, outThreadId) ||
|
||||
progInfo->findTriggerCause(verbId, objectId2, 0x40001, outThreadId);
|
||||
sceneInfo->findTriggerCause(verbId, objectId2, objectId, outThreadId) ||
|
||||
sceneInfo->findTriggerCause(verbId, objectId2, 0x40001, outThreadId);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
|
|
@ -164,19 +164,19 @@ bool TriggerObject::findTriggerCause(uint32 verbId, uint32 objectId2, uint32 &co
|
|||
return false;
|
||||
}
|
||||
|
||||
void TriggerObject::fixupProgInfosDuckman() {
|
||||
void TriggerObject::fixupSceneInfosDuckman() {
|
||||
for (uint i = 0; i < _causesCount; ++i)
|
||||
_causes[i]._verbId &= 0xFFFF;
|
||||
}
|
||||
|
||||
// ProgInfo
|
||||
// SceneInfo
|
||||
|
||||
ProgInfo::ProgInfo()
|
||||
SceneInfo::SceneInfo()
|
||||
: _triggerObjectsCount(0), _triggerObjects(0),
|
||||
_resourcesCount(0), _resources(0) {
|
||||
}
|
||||
|
||||
ProgInfo::~ProgInfo() {
|
||||
SceneInfo::~SceneInfo() {
|
||||
delete[] _triggerObjects;
|
||||
delete[] _resources;
|
||||
}
|
||||
|
@ -192,14 +192,14 @@ char *debugW2I(byte *wstr) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
void ProgInfo::load(byte *dataStart, Common::SeekableReadStream &stream) {
|
||||
void SceneInfo::load(byte *dataStart, Common::SeekableReadStream &stream) {
|
||||
_id = stream.readUint16LE();
|
||||
_unk = stream.readUint16LE();
|
||||
_name = dataStart + stream.pos();
|
||||
stream.skip(128);
|
||||
_triggerObjectsCount = stream.readUint16LE();
|
||||
_resourcesCount = stream.readUint16LE();
|
||||
debug(2, "\nProgInfo::load() _id: %d; _unk: %d; _name: [%s]",
|
||||
debug(2, "\nSceneInfo::load() _id: %d; _unk: %d; _name: [%s]",
|
||||
_id, _unk, debugW2I(_name));
|
||||
uint32 triggerObjectsListOffs = stream.readUint32LE();
|
||||
if (_resourcesCount > 0) {
|
||||
|
@ -218,28 +218,28 @@ void ProgInfo::load(byte *dataStart, Common::SeekableReadStream &stream) {
|
|||
}
|
||||
}
|
||||
|
||||
bool ProgInfo::findTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &codeOffs) {
|
||||
bool SceneInfo::findTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &codeOffs) {
|
||||
TriggerObject *triggerObject = findTriggerObject(objectId);
|
||||
if (triggerObject)
|
||||
return triggerObject->findTriggerCause(verbId, objectId2, codeOffs);
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProgInfo::getResources(uint &resourcesCount, uint32 *&resources) {
|
||||
void SceneInfo::getResources(uint &resourcesCount, uint32 *&resources) {
|
||||
resourcesCount = _resourcesCount;
|
||||
resources = _resources;
|
||||
}
|
||||
|
||||
TriggerObject *ProgInfo::findTriggerObject(uint32 objectId) {
|
||||
TriggerObject *SceneInfo::findTriggerObject(uint32 objectId) {
|
||||
for (uint i = 0; i < _triggerObjectsCount; ++i)
|
||||
if (_triggerObjects[i]._objectId == objectId)
|
||||
return &_triggerObjects[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ProgInfo::fixupProgInfosDuckman() {
|
||||
void SceneInfo::fixupSceneInfosDuckman() {
|
||||
for (uint i = 0; i < _triggerObjectsCount; ++i)
|
||||
_triggerObjects[i].fixupProgInfosDuckman();
|
||||
_triggerObjects[i].fixupSceneInfosDuckman();
|
||||
}
|
||||
|
||||
// ScriptResource
|
||||
|
@ -259,15 +259,15 @@ void ScriptResource::load(Resource *resource) {
|
|||
|
||||
Common::MemoryReadStream stream(_data, _dataSize, DisposeAfterUse::NO);
|
||||
|
||||
uint32 objectMapOffs, progInfosOffs;
|
||||
uint32 objectMapOffs, sceneInfosOffs;
|
||||
_objectMapCount = 0;
|
||||
|
||||
if (resource->_gameId == kGameIdBBDOU) {
|
||||
progInfosOffs = 0x18;
|
||||
sceneInfosOffs = 0x18;
|
||||
} else if (resource->_gameId == kGameIdDuckman) {
|
||||
for (uint i = 0; i < 27; ++i)
|
||||
_soundIds[i] = stream.readUint32LE();
|
||||
progInfosOffs = 0x8C;
|
||||
sceneInfosOffs = 0x8C;
|
||||
}
|
||||
|
||||
stream.skip(4); // Skip unused
|
||||
|
@ -278,7 +278,7 @@ void ScriptResource::load(Resource *resource) {
|
|||
if (resource->_gameId == kGameIdDuckman)
|
||||
_objectMapCount = stream.readUint16LE();
|
||||
_codeCount = stream.readUint16LE();
|
||||
_progInfosCount = stream.readUint16LE();
|
||||
_sceneInfosCount = stream.readUint16LE();
|
||||
if (resource->_gameId == kGameIdDuckman)
|
||||
stream.readUint16LE();//Unused?
|
||||
|
||||
|
@ -289,8 +289,8 @@ void ScriptResource::load(Resource *resource) {
|
|||
objectMapOffs = stream.readUint32LE();
|
||||
uint32 codeTblOffs = stream.readUint32LE();
|
||||
|
||||
debug(2, "ScriptResource::load() propertiesCount: %d; blockCountersCount: %d; _codeCount: %d; _progInfosCount: %d; _objectMapCount: %d",
|
||||
propertiesCount, blockCountersCount, _codeCount, _progInfosCount, _objectMapCount);
|
||||
debug(2, "ScriptResource::load() propertiesCount: %d; blockCountersCount: %d; _codeCount: %d; _sceneInfosCount: %d; _objectMapCount: %d",
|
||||
propertiesCount, blockCountersCount, _codeCount, _sceneInfosCount, _objectMapCount);
|
||||
debug(2, "ScriptResource::load() propertiesOffs: %08X; blockCountersOffs: %08X; codeTblOffs: %08X; objectMapOffs: %08X",
|
||||
propertiesOffs, blockCountersOffs, codeTblOffs, objectMapOffs);
|
||||
// Init properties
|
||||
|
@ -304,12 +304,12 @@ void ScriptResource::load(Resource *resource) {
|
|||
for (uint i = 0; i < _codeCount; ++i)
|
||||
_codeOffsets[i] = stream.readUint32LE();
|
||||
|
||||
_progInfos = new ProgInfo[_progInfosCount];
|
||||
for (uint i = 0; i < _progInfosCount; ++i) {
|
||||
stream.seek(progInfosOffs + i * 4);
|
||||
uint32 progInfoOffs = stream.readUint32LE();
|
||||
stream.seek(progInfoOffs);
|
||||
_progInfos[i].load(_data, stream);
|
||||
_sceneInfos = new SceneInfo[_sceneInfosCount];
|
||||
for (uint i = 0; i < _sceneInfosCount; ++i) {
|
||||
stream.seek(sceneInfosOffs + i * 4);
|
||||
uint32 sceneInfoOffs = stream.readUint32LE();
|
||||
stream.seek(sceneInfoOffs);
|
||||
_sceneInfos[i].load(_data, stream);
|
||||
}
|
||||
|
||||
if (_objectMapCount > 0) {
|
||||
|
@ -330,7 +330,7 @@ void ScriptResource::load(Resource *resource) {
|
|||
}
|
||||
|
||||
if (resource->_gameId == kGameIdDuckman)
|
||||
fixupProgInfosDuckman();
|
||||
fixupSceneInfosDuckman();
|
||||
|
||||
}
|
||||
|
||||
|
@ -342,9 +342,9 @@ byte *ScriptResource::getCode(uint32 codeOffs) {
|
|||
return _data + codeOffs;
|
||||
}
|
||||
|
||||
ProgInfo *ScriptResource::getProgInfo(uint32 index) {
|
||||
if (index > 0 && index <= _progInfosCount)
|
||||
return &_progInfos[index - 1];
|
||||
SceneInfo *ScriptResource::getSceneInfo(uint32 index) {
|
||||
if (index > 0 && index <= _sceneInfosCount)
|
||||
return &_sceneInfos[index - 1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -352,9 +352,9 @@ uint32 ScriptResource::getObjectActorTypeId(uint32 objectId) {
|
|||
return _objectMap[(objectId & 0xFFFF) - 1];
|
||||
}
|
||||
|
||||
void ScriptResource::fixupProgInfosDuckman() {
|
||||
for (uint i = 0; i < _progInfosCount; ++i)
|
||||
_progInfos[i].fixupProgInfosDuckman();
|
||||
void ScriptResource::fixupSceneInfosDuckman() {
|
||||
for (uint i = 0; i < _sceneInfosCount; ++i)
|
||||
_sceneInfos[i].fixupSceneInfosDuckman();
|
||||
}
|
||||
|
||||
// ScriptInstance
|
||||
|
|
|
@ -79,21 +79,21 @@ public:
|
|||
~TriggerObject();
|
||||
void load(byte *dataStart, Common::SeekableReadStream &stream);
|
||||
bool findTriggerCause(uint32 verbId, uint32 objectId2, uint32 &codeOffs);
|
||||
void fixupProgInfosDuckman();
|
||||
void fixupSceneInfosDuckman();
|
||||
public:
|
||||
uint32 _objectId;
|
||||
uint _causesCount;
|
||||
TriggerCause *_causes;
|
||||
};
|
||||
|
||||
class ProgInfo {
|
||||
class SceneInfo {
|
||||
public:
|
||||
ProgInfo();
|
||||
~ProgInfo();
|
||||
SceneInfo();
|
||||
~SceneInfo();
|
||||
void load(byte *dataStart, Common::SeekableReadStream &stream);
|
||||
bool findTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &codeOffs);
|
||||
void getResources(uint &resourcesCount, uint32 *&resources);
|
||||
void fixupProgInfosDuckman();
|
||||
void fixupSceneInfosDuckman();
|
||||
protected:
|
||||
uint16 _id;
|
||||
uint16 _unk;
|
||||
|
@ -112,7 +112,7 @@ public:
|
|||
void load(Resource *resource);
|
||||
byte *getThreadCode(uint32 threadId);
|
||||
byte *getCode(uint32 codeOffs);
|
||||
ProgInfo *getProgInfo(uint32 index);
|
||||
SceneInfo *getSceneInfo(uint32 index);
|
||||
uint32 getObjectActorTypeId(uint32 objectId);
|
||||
uint32 getMainActorObjectId() const { return _mainActorObjectId; }
|
||||
public:
|
||||
|
@ -122,14 +122,14 @@ public:
|
|||
BlockCounters _blockCounters;
|
||||
uint _codeCount;
|
||||
uint32 *_codeOffsets;
|
||||
uint _progInfosCount;
|
||||
ProgInfo *_progInfos;
|
||||
uint _sceneInfosCount;
|
||||
SceneInfo *_sceneInfos;
|
||||
// Duckman specific
|
||||
uint32 _soundIds[27];
|
||||
uint _objectMapCount;
|
||||
uint32 *_objectMap;
|
||||
uint32 _mainActorObjectId;
|
||||
void fixupProgInfosDuckman();
|
||||
void fixupSceneInfosDuckman();
|
||||
};
|
||||
|
||||
class ScriptInstance : public ResourceInstance {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue