diff options
26 files changed, 112 insertions, 112 deletions
diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp index cf3416a572..bae77c71fc 100644 --- a/engines/illusions/actor.cpp +++ b/engines/illusions/actor.cpp @@ -212,7 +212,7 @@ Control::Control(IllusionsEngine *vm) _position.y = 0; _actorTypeId = 0; _actor = 0; - _tag = _vm->getCurrentScene(); + _sceneId = _vm->getCurrentScene(); } Control::~Control() { @@ -1188,10 +1188,10 @@ void Controls::destroyActiveControls() { } } -void Controls::destroyControlsByTag(uint32 tag) { +void Controls::destroyControlsBySceneId(uint32 sceneId) { ItemsIterator it = _controls.begin(); while (it != _controls.end()) { - if ((*it)->_tag == tag) { + if ((*it)->_sceneId == sceneId) { destroyControlInternal(*it); it = _controls.erase(it); } else @@ -1239,10 +1239,10 @@ void Controls::unpauseControls() { } } -void Controls::pauseControlsByTag(uint32 tag) { +void Controls::pauseControlsBySceneId(uint32 sceneId) { for (ItemsIterator it = _controls.begin(); it != _controls.end(); ++it) { Control *control = *it; - if (control->_tag == tag) { + if (control->_sceneId == sceneId) { ++control->_pauseCtr; if (control->_pauseCtr == 1) control->pause(); @@ -1250,10 +1250,10 @@ void Controls::pauseControlsByTag(uint32 tag) { } } -void Controls::unpauseControlsByTag(uint32 tag) { +void Controls::unpauseControlsBySceneId(uint32 sceneId) { for (ItemsIterator it = _controls.begin(); it != _controls.end(); ++it) { Control *control = *it; - if (control->_tag == tag) { + if (control->_sceneId == sceneId) { --control->_pauseCtr; if (control->_pauseCtr == 0) control->unpause(); diff --git a/engines/illusions/actor.h b/engines/illusions/actor.h index c4ae052b12..295a0b5c9a 100644 --- a/engines/illusions/actor.h +++ b/engines/illusions/actor.h @@ -207,7 +207,7 @@ public: int16 _priority; Actor *_actor; //field_6 dw - uint32 _tag; + uint32 _sceneId; uint32 _objectId; uint32 _actorTypeId; // TODO Move points into own struct @@ -233,13 +233,13 @@ public: void placeDialogItem(uint16 objectNum, uint32 actorTypeId, uint32 sequenceId, Common::Point placePt, int16 choiceJumpOffs); void destroyControls(); void destroyActiveControls(); - void destroyControlsByTag(uint32 tag); + void destroyControlsBySceneId(uint32 sceneId); void destroyDialogItems(); void threadIsDead(uint32 threadId); void pauseControls(); void unpauseControls(); - void pauseControlsByTag(uint32 tag); - void unpauseControlsByTag(uint32 tag); + void pauseControlsBySceneId(uint32 sceneId); + void unpauseControlsBySceneId(uint32 sceneId); bool getOverlappedObject(Control *control, Common::Point pt, Control **outOverlappedControl, int minPriority); bool getDialogItemAtPos(Control *control, Common::Point pt, Control **outOverlappedControl); bool getOverlappedWalkObject(Control *control, Common::Point pt, Control **outOverlappedControl); diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp index a7dadc487c..5257a48858 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.cpp +++ b/engines/illusions/bbdou/bbdou_specialcode.cpp @@ -73,7 +73,7 @@ void CauseThread_BBDOU::onTerminated() { RadarMicrophoneThread::RadarMicrophoneThread(IllusionsEngine_BBDOU *vm, uint32 threadId, uint32 callingThreadId, uint32 cursorObjectId) : Thread(vm, threadId, callingThreadId, 0), _cursorObjectId(cursorObjectId), _zonesCount(0) { - _tag = _vm->getCurrentScene(); + _sceneId = _vm->getCurrentScene(); } int RadarMicrophoneThread::onUpdate() { diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp index 98a4a24175..9c7e0192bb 100644 --- a/engines/illusions/bbdou/illusions_bbdou.cpp +++ b/engines/illusions/bbdou/illusions_bbdou.cpp @@ -260,8 +260,8 @@ void IllusionsEngine_BBDOU::initInput() { .addKey(Common::KEYCODE_DOWN); } -#define UPDATEFUNCTION(priority, tag, callback) \ - _updateFunctions->add(priority, tag, new Common::Functor1Mem<uint, int, IllusionsEngine_BBDOU> \ +#define UPDATEFUNCTION(priority, sceneId, callback) \ + _updateFunctions->add(priority, sceneId, new Common::Functor1Mem<uint, int, IllusionsEngine_BBDOU> \ (this, &IllusionsEngine_BBDOU::callback)); void IllusionsEngine_BBDOU::initUpdateFunctions() { @@ -516,30 +516,30 @@ bool IllusionsEngine_BBDOU::enterScene(uint32 sceneId, uint32 threadId) { void IllusionsEngine_BBDOU::exitScene(uint32 threadId) { uint32 sceneId = _activeScenes.getCurrentScene(); // TODO krnfileDump(sceneId); - // TODO UpdateFunctions_disableByTag__TODO_maybe(sceneId); - _threads->terminateThreadsByTag(sceneId, threadId); - _controls->destroyControlsByTag(sceneId); + // TODO UpdateFunctions_disableBySceneId__TODO_maybe(sceneId); + _threads->terminateThreadsBySceneId(sceneId, threadId); + _controls->destroyControlsBySceneId(sceneId); _triggerFunctions->removeBySceneId(sceneId); - _resSys->unloadResourcesByTag(sceneId); + _resSys->unloadResourcesBySceneId(sceneId); _activeScenes.pop(); } void IllusionsEngine_BBDOU::enterPause(uint32 threadId) { uint32 sceneId = _activeScenes.getCurrentScene(); _camera->pushCameraMode(); - _threads->suspendThreadsByTag(sceneId, threadId); - _controls->pauseControlsByTag(sceneId); - _actorInstances->pauseByTag(sceneId); - _backgroundInstances->pauseByTag(sceneId); + _threads->suspendThreadsBySceneId(sceneId, threadId); + _controls->pauseControlsBySceneId(sceneId); + _actorInstances->pauseBySceneId(sceneId); + _backgroundInstances->pauseBySceneId(sceneId); _activeScenes.pauseActiveScene(); } void IllusionsEngine_BBDOU::leavePause(uint32 threadId) { uint32 sceneId = _activeScenes.getCurrentScene(); - _backgroundInstances->unpauseByTag(sceneId); - _actorInstances->unpauseByTag(sceneId); - _controls->unpauseControlsByTag(sceneId); - _threads->notifyThreadsByTag(sceneId, threadId); + _backgroundInstances->unpauseBySceneId(sceneId); + _actorInstances->unpauseBySceneId(sceneId); + _controls->unpauseControlsBySceneId(sceneId); + _threads->notifyThreadsBySceneId(sceneId, threadId); _camera->popCameraMode(); _activeScenes.unpauseActiveScene(); } diff --git a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp index efdc289c9b..945892f82f 100644 --- a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp +++ b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp @@ -279,7 +279,7 @@ void ScriptOpcodes_BBDOU::opStartModalScene(ScriptThread *scriptThread, OpCall & // NOTE Skipped checking for stalled resources _vm->_input->discardAllEvents(); _vm->enterPause(opCall._callerThreadId); - _vm->_talkItems->pauseByTag(_vm->getCurrentScene()); + _vm->_talkItems->pauseBySceneId(_vm->getCurrentScene()); _vm->enterScene(sceneId, opCall._callerThreadId); _vm->startScriptThread(threadId, 0, scriptThread->_value8, scriptThread->_valueC, scriptThread->_value10); @@ -291,7 +291,7 @@ void ScriptOpcodes_BBDOU::opExitModalScene(ScriptThread *scriptThread, OpCall &o _vm->_input->discardAllEvents(); _vm->exitScene(opCall._callerThreadId); _vm->leavePause(opCall._callerThreadId); - _vm->_talkItems->unpauseByTag(_vm->getCurrentScene()); + _vm->_talkItems->unpauseBySceneId(_vm->getCurrentScene()); } void ScriptOpcodes_BBDOU::opEnterCloseUpScene(ScriptThread *scriptThread, OpCall &opCall) { diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp index 041e4372b9..3a6514fa96 100644 --- a/engines/illusions/duckman/illusions_duckman.cpp +++ b/engines/illusions/duckman/illusions_duckman.cpp @@ -233,8 +233,8 @@ void IllusionsEngine_Duckman::initInput() { .addKey(Common::KEYCODE_DOWN); } -#define UPDATEFUNCTION(priority, tag, callback) \ - _updateFunctions->add(priority, tag, new Common::Functor1Mem<uint, int, IllusionsEngine_Duckman> \ +#define UPDATEFUNCTION(priority, sceneId, callback) \ + _updateFunctions->add(priority, sceneId, new Common::Functor1Mem<uint, int, IllusionsEngine_Duckman> \ (this, &IllusionsEngine_Duckman::callback)); void IllusionsEngine_Duckman::initUpdateFunctions() { @@ -760,13 +760,13 @@ bool IllusionsEngine_Duckman::changeScene(uint32 sceneId, uint32 threadId, uint3 void IllusionsEngine_Duckman::enterPause(uint32 sceneId, uint32 threadId) { _threads->suspendThreads(threadId); _controls->pauseControls(); - _actorInstances->pauseByTag(sceneId); - _backgroundInstances->pauseByTag(sceneId); + _actorInstances->pauseBySceneId(sceneId); + _backgroundInstances->pauseBySceneId(sceneId); } void IllusionsEngine_Duckman::leavePause(uint32 sceneId, uint32 threadId) { - _backgroundInstances->unpauseByTag(sceneId); - _actorInstances->unpauseByTag(sceneId); + _backgroundInstances->unpauseBySceneId(sceneId); + _actorInstances->unpauseBySceneId(sceneId); _controls->unpauseControls(); _threads->notifyThreads(threadId); } @@ -776,11 +776,11 @@ void IllusionsEngine_Duckman::dumpActiveScenes(uint32 sceneId, uint32 threadId) } void IllusionsEngine_Duckman::dumpCurrSceneFiles(uint32 sceneId, uint32 threadId) { - // TODO UpdateFunctions_disableByTag(sceneId); + // TODO UpdateFunctions_disableBySceneId(sceneId); _threads->terminateActiveThreads(threadId); - _threads->terminateThreadsByTag(sceneId, threadId); + _threads->terminateThreadsBySceneId(sceneId, threadId); _controls->destroyActiveControls(); - _resSys->unloadResourcesByTag(sceneId); + _resSys->unloadResourcesBySceneId(sceneId); } void IllusionsEngine_Duckman::setSceneIdThreadId(uint32 theSceneId, uint32 theThreadId) { diff --git a/engines/illusions/duckman/scriptopcodes_duckman.cpp b/engines/illusions/duckman/scriptopcodes_duckman.cpp index 107d8983e7..09bf8c6716 100644 --- a/engines/illusions/duckman/scriptopcodes_duckman.cpp +++ b/engines/illusions/duckman/scriptopcodes_duckman.cpp @@ -294,7 +294,7 @@ void ScriptOpcodes_Duckman::opStartModalScene(ScriptThread *scriptThread, OpCall ARG_UINT32(threadId); _vm->_input->discardAllEvents(); _vm->enterPause(_vm->getCurrentScene(), opCall._callerThreadId); - _vm->_talkItems->pauseByTag(_vm->getCurrentScene()); + _vm->_talkItems->pauseBySceneId(_vm->getCurrentScene()); _vm->enterScene(sceneId, threadId); opCall._result = kTSSuspend; } @@ -308,7 +308,7 @@ void ScriptOpcodes_Duckman::opExitModalScene(ScriptThread *scriptThread, OpCall _vm->dumpCurrSceneFiles(_vm->getCurrentScene(), opCall._callerThreadId); _vm->exitScene(); _vm->leavePause(_vm->getCurrentScene(), opCall._callerThreadId); - _vm->_talkItems->unpauseByTag(_vm->getCurrentScene()); + _vm->_talkItems->unpauseBySceneId(_vm->getCurrentScene()); } } diff --git a/engines/illusions/gamresourcereader.cpp b/engines/illusions/gamresourcereader.cpp index 4b4f3e0ff0..18d16be0d6 100644 --- a/engines/illusions/gamresourcereader.cpp +++ b/engines/illusions/gamresourcereader.cpp @@ -21,7 +21,7 @@ */ #include "illusions/resourcesystem.h" -#include "illusions/resourcereader_gamarchive.h" +#include "illusions/gamresourcereader.h" #include "illusions/gamarchive.h" #include "illusions/illusions.h" #include "common/file.h" diff --git a/engines/illusions/resources/actorresource.cpp b/engines/illusions/resources/actorresource.cpp index b93cf0f83d..8c65626b0f 100644 --- a/engines/illusions/resources/actorresource.cpp +++ b/engines/illusions/resources/actorresource.cpp @@ -180,7 +180,7 @@ ActorInstance::ActorInstance(IllusionsEngine *vm) void ActorInstance::load(Resource *resource) { _actorResource = new ActorResource(); _actorResource->load(resource); - _tag = resource->_tag; + _sceneId = resource->_sceneId; _pauseCtr = 0; initActorTypes(); registerResources(); @@ -260,15 +260,15 @@ void ActorInstanceList::removeActorInstance(ActorInstance *actorInstance) { _items.remove(actorInstance); } -void ActorInstanceList::pauseByTag(uint32 tag) { +void ActorInstanceList::pauseBySceneId(uint32 sceneId) { for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) - if ((*it)->_tag == tag) + if ((*it)->_sceneId == sceneId) (*it)->pause(); } -void ActorInstanceList::unpauseByTag(uint32 tag) { +void ActorInstanceList::unpauseBySceneId(uint32 sceneId) { for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) - if ((*it)->_tag == tag) + if ((*it)->_sceneId == sceneId) (*it)->unpause(); } diff --git a/engines/illusions/resources/actorresource.h b/engines/illusions/resources/actorresource.h index b78e515f3f..c24213dba9 100644 --- a/engines/illusions/resources/actorresource.h +++ b/engines/illusions/resources/actorresource.h @@ -101,7 +101,7 @@ public: virtual void unpause(); public: IllusionsEngine *_vm; - uint32 _tag; + uint32 _sceneId; int _pauseCtr; ActorResource *_actorResource; protected: @@ -116,8 +116,8 @@ public: ~ActorInstanceList(); ActorInstance *createActorInstance(Resource *resource); void removeActorInstance(ActorInstance *actorInstance); - void pauseByTag(uint32 tag); - void unpauseByTag(uint32 tag); + void pauseBySceneId(uint32 sceneId); + void unpauseBySceneId(uint32 sceneId); FramesList *findSequenceFrames(Sequence *sequence); ActorInstance *findActorByResource(ActorResource *actorResource); bool findNamedPoint(uint32 namedPointId, Common::Point &pt); diff --git a/engines/illusions/resources/backgroundresource.cpp b/engines/illusions/resources/backgroundresource.cpp index e50f46b240..d18d46bf2f 100644 --- a/engines/illusions/resources/backgroundresource.cpp +++ b/engines/illusions/resources/backgroundresource.cpp @@ -368,7 +368,7 @@ bool BackgroundResource::findNamedPoint(uint32 namedPointId, Common::Point &pt) // BackgroundInstance BackgroundInstance::BackgroundInstance(IllusionsEngine *vm) - : _vm(vm), _tag(0), _pauseCtr(0), _bgRes(0), _savedPalette(0) { + : _vm(vm), _sceneId(0), _pauseCtr(0), _bgRes(0), _savedPalette(0) { } void BackgroundInstance::load(Resource *resource) { @@ -378,7 +378,7 @@ void BackgroundInstance::load(Resource *resource) { backgroundResource->load(resource->_data, resource->_dataSize); _bgRes = backgroundResource; - _tag = resource->_tag; + _sceneId = resource->_sceneId; initSurface(); // Insert background objects @@ -549,15 +549,15 @@ void BackgroundInstanceList::removeBackgroundInstance(BackgroundInstance *backgr _items.remove(backgroundInstance); } -void BackgroundInstanceList::pauseByTag(uint32 tag) { +void BackgroundInstanceList::pauseBySceneId(uint32 sceneId) { for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) - if ((*it)->_tag == tag) + if ((*it)->_sceneId == sceneId) (*it)->pause(); } -void BackgroundInstanceList::unpauseByTag(uint32 tag) { +void BackgroundInstanceList::unpauseBySceneId(uint32 sceneId) { for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) - if ((*it)->_tag == tag) + if ((*it)->_sceneId == sceneId) (*it)->unpause(); } diff --git a/engines/illusions/resources/backgroundresource.h b/engines/illusions/resources/backgroundresource.h index d118c3d6d0..d0c0c76233 100644 --- a/engines/illusions/resources/backgroundresource.h +++ b/engines/illusions/resources/backgroundresource.h @@ -190,7 +190,7 @@ public: virtual void unpause(); public: IllusionsEngine *_vm; - uint32 _tag; + uint32 _sceneId; int _pauseCtr; BackgroundResource *_bgRes; Common::Point _panPoints[kMaxBackgroundItemSurfaces]; @@ -212,8 +212,8 @@ public: ~BackgroundInstanceList(); BackgroundInstance *createBackgroundInstance(Resource *resource); void removeBackgroundInstance(BackgroundInstance *backgroundInstance); - void pauseByTag(uint32 tag); - void unpauseByTag(uint32 tag); + void pauseBySceneId(uint32 sceneId); + void unpauseBySceneId(uint32 sceneId); BackgroundInstance *findActiveBackgroundInstance(); BackgroundInstance *findBackgroundByResource(BackgroundResource *backgroundResource); BackgroundResource *getActiveBgResource(); diff --git a/engines/illusions/resources/talkresource.cpp b/engines/illusions/resources/talkresource.cpp index 9b03b37cc2..a75c3700f2 100644 --- a/engines/illusions/resources/talkresource.cpp +++ b/engines/illusions/resources/talkresource.cpp @@ -85,7 +85,7 @@ void TalkInstance::load(Resource *resource) { talkResource->load(resource->_data, resource->_dataSize); _talkRes = talkResource; _talkId = resource->_resId; - _tag = resource->_tag; + _sceneId = resource->_sceneId; registerResources(); } @@ -148,21 +148,21 @@ TalkInstance *TalkInstanceList::findTalkItem(uint32 talkId) { return 0; } -TalkInstance *TalkInstanceList::findTalkItemByTag(uint32 tag) { +TalkInstance *TalkInstanceList::findTalkItemBySceneId(uint32 sceneId) { for (ItemsIterator it = _items.begin(); it != _items.end(); ++it) - if ((*it)->_tag == tag) + if ((*it)->_sceneId == sceneId) return (*it); return 0; } -void TalkInstanceList::pauseByTag(uint32 tag) { - TalkInstance *talkInstance = findTalkItemByTag(tag); +void TalkInstanceList::pauseBySceneId(uint32 sceneId) { + TalkInstance *talkInstance = findTalkItemBySceneId(sceneId); if (talkInstance) talkInstance->pause(); } -void TalkInstanceList::unpauseByTag(uint32 tag) { - TalkInstance *talkInstance = findTalkItemByTag(tag); +void TalkInstanceList::unpauseBySceneId(uint32 sceneId) { + TalkInstance *talkInstance = findTalkItemBySceneId(sceneId); if (talkInstance) talkInstance->unpause(); } diff --git a/engines/illusions/resources/talkresource.h b/engines/illusions/resources/talkresource.h index a29e58ceb5..ea38aa7370 100644 --- a/engines/illusions/resources/talkresource.h +++ b/engines/illusions/resources/talkresource.h @@ -69,7 +69,7 @@ public: public: IllusionsEngine *_vm; uint32 _talkId; - uint32 _tag; + uint32 _sceneId; TalkResource *_talkRes; int _pauseCtr; void registerResources(); @@ -83,9 +83,9 @@ public: TalkInstance *createTalkInstance(Resource *resource); void removeTalkInstance(TalkInstance *talkInstance); TalkInstance *findTalkItem(uint32 talkId); - TalkInstance *findTalkItemByTag(uint32 tag); - void pauseByTag(uint32 tag); - void unpauseByTag(uint32 tag); + TalkInstance *findTalkItemBySceneId(uint32 sceneId); + void pauseBySceneId(uint32 sceneId); + void unpauseBySceneId(uint32 sceneId); //protected: public: typedef Common::List<TalkInstance*> Items; diff --git a/engines/illusions/resourcesystem.cpp b/engines/illusions/resourcesystem.cpp index 13e4da6aec..4f6644f49e 100644 --- a/engines/illusions/resourcesystem.cpp +++ b/engines/illusions/resourcesystem.cpp @@ -49,7 +49,7 @@ ResourceInstance::~ResourceInstance() { // Resource void Resource::loadData(BaseResourceReader *resReader) { - _data = resReader->readResource(_tag, _resId, _dataSize); + _data = resReader->readResource(_sceneId, _resId, _dataSize); } void Resource::unloadData() { @@ -74,14 +74,14 @@ void ResourceSystem::addResourceLoader(uint32 resTypeId, BaseResourceLoader *res _resourceLoaders[resTypeId] = resourceLoader; } -void ResourceSystem::loadResource(uint32 resId, uint32 tag, uint32 threadId) { - debug(1, "ResourceSystem::loadResource(%08X, %08X, %08X)", resId, tag, threadId); +void ResourceSystem::loadResource(uint32 resId, uint32 sceneId, uint32 threadId) { + debug(1, "ResourceSystem::loadResource(%08X, %08X, %08X)", resId, sceneId, threadId); BaseResourceLoader *resourceLoader = getResourceLoader(resId); Resource *resource = new Resource(); resource->_loaded = false; resource->_resId = resId; - resource->_tag = tag; + resource->_sceneId = sceneId; resource->_threadId = threadId; resource->_gameId = _vm->getGameId(); @@ -109,11 +109,11 @@ void ResourceSystem::unloadResourceById(uint32 resId) { unloadResource(resource); } -void ResourceSystem::unloadResourcesByTag(uint32 tag) { - ResourcesArrayIterator it = Common::find_if(_resources.begin(), _resources.end(), ResourceEqualByTag(tag)); +void ResourceSystem::unloadResourcesBySceneId(uint32 sceneId) { + ResourcesArrayIterator it = Common::find_if(_resources.begin(), _resources.end(), ResourceEqualBySceneId(sceneId)); while (it != _resources.end()) { unloadResource(*it); - it = Common::find_if(it, _resources.end(), ResourceEqualByTag(tag)); + it = Common::find_if(it, _resources.end(), ResourceEqualBySceneId(sceneId)); } } @@ -138,7 +138,7 @@ Resource *ResourceSystem::getResource(uint32 resId) { } void ResourceSystem::unloadResource(Resource *resource) { - debug(1, "Unloading %08X... (tag: %08X)", resource->_resId, resource->_tag); + debug(1, "Unloading %08X... (sceneId: %08X)", resource->_resId, resource->_sceneId); ResourcesArrayIterator it = Common::find_if(_resources.begin(), _resources.end(), ResourceEqualByValue(resource)); if (it != _resources.end()) _resources.remove_at(it - _resources.begin()); diff --git a/engines/illusions/resourcesystem.h b/engines/illusions/resourcesystem.h index a0c2c06f99..b761b9460a 100644 --- a/engines/illusions/resourcesystem.h +++ b/engines/illusions/resourcesystem.h @@ -52,14 +52,14 @@ public: struct Resource { bool _loaded; uint32 _resId; - uint32 _tag; + uint32 _sceneId; uint32 _threadId; byte *_data; uint32 _dataSize; int _gameId; Common::String _filename; ResourceInstance *_instance; - Resource() : _loaded(false), _resId(0), _tag(0), _threadId(0), _data(0), _dataSize(0), _instance(0) { + Resource() : _loaded(false), _resId(0), _sceneId(0), _threadId(0), _data(0), _dataSize(0), _instance(0) { } ~Resource() { if (_instance) @@ -93,9 +93,9 @@ public: void addResourceLoader(uint32 resTypeId, BaseResourceLoader *resourceLoader); // TODO Handle threadId in caller as well as pausing of timer - void loadResource(uint32 resId, uint32 tag, uint32 threadId); + void loadResource(uint32 resId, uint32 sceneId, uint32 threadId); void unloadResourceById(uint32 resId); - void unloadResourcesByTag(uint32 tag); + void unloadResourcesBySceneId(uint32 sceneId); void unloadSceneResources(uint32 sceneId1, uint32 sceneId2); protected: @@ -125,11 +125,11 @@ protected: } }; - struct ResourceEqualByTag : public Common::UnaryFunction<const Resource*, bool> { - uint32 _tag; - ResourceEqualByTag(uint32 tag) : _tag(tag) {} + struct ResourceEqualBySceneId : public Common::UnaryFunction<const Resource*, bool> { + uint32 _sceneId; + ResourceEqualBySceneId(uint32 sceneId) : _sceneId(sceneId) {} bool operator()(const Resource *resource) const { - return resource->_tag == _tag; + return resource->_sceneId == _sceneId; } }; @@ -137,7 +137,7 @@ protected: uint32 _sceneId1, _sceneId2; ResourceNotEqualByScenes(uint32 sceneId1, uint32 sceneId2) : _sceneId1(sceneId1), _sceneId2(sceneId2) {} bool operator()(const Resource *resource) const { - return resource->_tag != _sceneId1 && resource->_tag != _sceneId2; + return resource->_sceneId != _sceneId1 && resource->_sceneId != _sceneId2; } }; diff --git a/engines/illusions/thread.cpp b/engines/illusions/thread.cpp index 941706abfd..d12d11a81c 100644 --- a/engines/illusions/thread.cpp +++ b/engines/illusions/thread.cpp @@ -126,7 +126,7 @@ ThreadList::ThreadList(IllusionsEngine *vm) } void ThreadList::startThread(Thread *thread) { - // TODO tag has to be set by the Thread class + // TODO sceneId has to be set by the Thread class _threads.push_back(thread); } @@ -206,18 +206,18 @@ void ThreadList::terminateActiveThreads(uint32 threadId) { } } -void ThreadList::terminateThreadsByTag(uint32 tag, uint32 threadId) { +void ThreadList::terminateThreadsBySceneId(uint32 sceneId, uint32 threadId) { for (Iterator it = _threads.begin(); it != _threads.end(); ++it) { Thread *thread = *it; - if (thread->_tag == tag && thread->_threadId != threadId) + if (thread->_sceneId == sceneId && thread->_threadId != threadId) thread->terminate(); } } -void ThreadList::suspendThreadsByTag(uint32 tag, uint32 threadId) { +void ThreadList::suspendThreadsBySceneId(uint32 sceneId, uint32 threadId) { for (Iterator it = _threads.begin(); it != _threads.end(); ++it) { Thread *thread = *it; - if (thread->_tag == tag && thread->_threadId != threadId) + if (thread->_sceneId == sceneId && thread->_threadId != threadId) thread->suspend(); } } @@ -230,10 +230,10 @@ void ThreadList::notifyThreads(uint32 threadId) { } } -void ThreadList::notifyThreadsByTag(uint32 tag, uint32 threadId) { +void ThreadList::notifyThreadsBySceneId(uint32 sceneId, uint32 threadId) { for (Iterator it = _threads.begin(); it != _threads.end(); ++it) { Thread *thread = *it; - if (thread->_tag == tag && thread->_threadId != threadId) + if (thread->_sceneId == sceneId && thread->_threadId != threadId) thread->notify(); } } @@ -308,12 +308,12 @@ void ThreadList::killThread(uint32 threadId) { void ThreadList::setThreadSceneId(uint32 threadId, uint32 sceneId) { Thread *thread = findThread(threadId); if (thread) - thread->_tag = sceneId; + thread->_sceneId = sceneId; } uint32 ThreadList::getThreadSceneId(uint32 threadId) { Thread *thread = findThread(threadId); - return thread ? thread->_tag : 0; + return thread ? thread->_sceneId : 0; } bool ThreadList::isActiveThread(int msgNum) { diff --git a/engines/illusions/thread.h b/engines/illusions/thread.h index 996226dcf7..cde2a41907 100644 --- a/engines/illusions/thread.h +++ b/engines/illusions/thread.h @@ -72,7 +72,7 @@ public: uint _type; uint32 _threadId; uint32 _callingThreadId; - uint32 _tag; + uint32 _sceneId; uint _notifyFlags; }; @@ -88,10 +88,10 @@ public: void suspendTimerThreads(uint32 callingThreadId); void terminateThreads(uint32 threadId); void terminateActiveThreads(uint32 threadId); - void terminateThreadsByTag(uint32 tag, uint32 threadId); - void suspendThreadsByTag(uint32 tag, uint32 threadId); + void terminateThreadsBySceneId(uint32 sceneId, uint32 threadId); + void suspendThreadsBySceneId(uint32 sceneId, uint32 threadId); void notifyThreads(uint32 threadId); - void notifyThreadsByTag(uint32 tag, uint32 threadId); + void notifyThreadsBySceneId(uint32 sceneId, uint32 threadId); void pauseThreads(uint32 threadId); void suspendThreads(uint32 threadId); void resumeThreads(uint32 threadId); diff --git a/engines/illusions/threads/abortablethread.cpp b/engines/illusions/threads/abortablethread.cpp index b06debe014..acbc1adea2 100644 --- a/engines/illusions/threads/abortablethread.cpp +++ b/engines/illusions/threads/abortablethread.cpp @@ -34,7 +34,7 @@ AbortableThread::AbortableThread(IllusionsEngine *vm, uint32 threadId, uint32 ca : Thread(vm, threadId, callingThreadId, notifyFlags), _scriptThreadId(scriptThreadId), _scriptCodeIp(scriptCodeIp), _status(1) { _type = kTTAbortableThread; - _tag = _vm->getCurrentScene(); + _sceneId = _vm->getCurrentScene(); _vm->_input->discardEvent(kEventAbort); } diff --git a/engines/illusions/threads/causethread_duckman.cpp b/engines/illusions/threads/causethread_duckman.cpp index ee5fe75222..8fb836467a 100644 --- a/engines/illusions/threads/causethread_duckman.cpp +++ b/engines/illusions/threads/causethread_duckman.cpp @@ -33,19 +33,19 @@ CauseThread_Duckman::CauseThread_Duckman(IllusionsEngine_Duckman *vm, uint32 thr uint32 triggerThreadId) : Thread(vm, threadId, callingThreadId, notifyFlags), _vm(vm), _triggerThreadId(triggerThreadId), _flag(false) { _type = kTTCauseThread; - _tag = _vm->getCurrentScene(); + _sceneId = _vm->getCurrentScene(); } int CauseThread_Duckman::onUpdate() { if (_flag) { - if (_vm->getCurrentScene() == _tag) { + if (_vm->getCurrentScene() == _sceneId) { Control *cursorCursor = _vm->getObjectControl(0x40004); cursorCursor->appearActor(); _vm->_input->discardEvent(kEventLeftClick); } return kTSTerminate; } else { - _tag = _vm->getCurrentScene(); + _sceneId = _vm->getCurrentScene(); Control *cursorCursor = _vm->getObjectControl(0x40004); cursorCursor->disappearActor(); _vm->_input->discardEvent(kEventLeftClick); diff --git a/engines/illusions/threads/scriptthread.cpp b/engines/illusions/threads/scriptthread.cpp index f8bbae9cb4..8fe3cddbff 100644 --- a/engines/illusions/threads/scriptthread.cpp +++ b/engines/illusions/threads/scriptthread.cpp @@ -33,7 +33,7 @@ ScriptThread::ScriptThread(IllusionsEngine *vm, uint32 threadId, uint32 callingT : Thread(vm, threadId, callingThreadId, notifyFlags), _scriptCodeIp(scriptCodeIp), _value8(value8), _valueC(valueC), _value10(value10), _sequenceStalled(0) { _type = kTTScriptThread; - _tag = _vm->getCurrentScene(); + _sceneId = _vm->getCurrentScene(); } int ScriptThread::onUpdate() { diff --git a/engines/illusions/threads/talkthread.cpp b/engines/illusions/threads/talkthread.cpp index 7adf9e56bd..930b83c8fa 100644 --- a/engines/illusions/threads/talkthread.cpp +++ b/engines/illusions/threads/talkthread.cpp @@ -77,7 +77,7 @@ TalkThread::TalkThread(IllusionsEngine *vm, uint32 threadId, uint32 callingThrea if (callingThreadId) { Thread *callingThread = _vm->_threads->findThread(callingThreadId); if (callingThread) - _tag = callingThread->_tag; + _sceneId = callingThread->_sceneId; } //debug("New talk thread: %08X %08X", _threadId, _talkId); diff --git a/engines/illusions/threads/talkthread_duckman.cpp b/engines/illusions/threads/talkthread_duckman.cpp index 6d8224e990..9b7ca4eefd 100644 --- a/engines/illusions/threads/talkthread_duckman.cpp +++ b/engines/illusions/threads/talkthread_duckman.cpp @@ -60,7 +60,7 @@ TalkThread_Duckman::TalkThread_Duckman(IllusionsEngine_Duckman *vm, uint32 threa _textDuration = _durationMult; _defDurationMult = _vm->clipTextDuration(240); - _tag = _vm->getCurrentScene(); + _sceneId = _vm->getCurrentScene(); } diff --git a/engines/illusions/threads/timerthread.cpp b/engines/illusions/threads/timerthread.cpp index 5842098739..417d113210 100644 --- a/engines/illusions/threads/timerthread.cpp +++ b/engines/illusions/threads/timerthread.cpp @@ -39,7 +39,7 @@ TimerThread::TimerThread(IllusionsEngine *vm, uint32 threadId, uint32 callingThr if (callingThreadId) { Thread *callingThread = _vm->_threads->findThread(callingThreadId); if (callingThread) - _tag = callingThread->_tag; + _sceneId = callingThread->_sceneId; } } diff --git a/engines/illusions/updatefunctions.cpp b/engines/illusions/updatefunctions.cpp index 6e6cf52ae7..cfd2c44b96 100644 --- a/engines/illusions/updatefunctions.cpp +++ b/engines/illusions/updatefunctions.cpp @@ -38,10 +38,10 @@ UpdateFunctions::~UpdateFunctions() { delete *it; } -void UpdateFunctions::add(int priority, uint32 tag, UpdateFunctionCallback *callback) { +void UpdateFunctions::add(int priority, uint32 sceneId, UpdateFunctionCallback *callback) { UpdateFunction *updateFunction = new UpdateFunction(); updateFunction->_priority = priority; - updateFunction->_tag = tag; + updateFunction->_sceneId = sceneId; updateFunction->_callback = callback; UpdateFunctionListIterator insertionPos = Common::find_if(_updateFunctions.begin(), _updateFunctions.end(), FindInsertionPosition(priority)); @@ -73,7 +73,7 @@ void UpdateFunctions::update() { void UpdateFunctions::terminateByScene(uint32 sceneId) { UpdateFunctionListIterator it = _updateFunctions.begin(); while (it != _updateFunctions.end()) - if ((*it)->_tag == sceneId) + if ((*it)->_sceneId == sceneId) (*it)->terminate(); } diff --git a/engines/illusions/updatefunctions.h b/engines/illusions/updatefunctions.h index 877bbc117e..b89b2a81d7 100644 --- a/engines/illusions/updatefunctions.h +++ b/engines/illusions/updatefunctions.h @@ -38,10 +38,10 @@ typedef Common::Functor1<uint, int> UpdateFunctionCallback; class UpdateFunction { public: int _priority; - uint32 _tag; + uint32 _sceneId; uint _flags; UpdateFunctionCallback *_callback; - UpdateFunction() : _priority(0), _tag(0), _flags(0), _callback(0) {} + UpdateFunction() : _priority(0), _sceneId(0), _flags(0), _callback(0) {} ~UpdateFunction() { delete _callback; } void terminate() { _flags |= 1; } int run() { return (*_callback)(_flags); } @@ -51,7 +51,7 @@ class UpdateFunctions { public: UpdateFunctions(); ~UpdateFunctions(); - void add(int priority, uint32 tag, UpdateFunctionCallback *callback); + void add(int priority, uint32 sceneId, UpdateFunctionCallback *callback); void update(); void terminateByScene(uint32 sceneId); protected: |