diff options
author | Paul Gilbert | 2014-03-23 18:48:00 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-03-23 18:48:00 -0400 |
commit | 7f4dbf7d48b6db8d82d33b569c22f104fc153dd3 (patch) | |
tree | fcc7ec3bd57d6b3fb66154cdb3b2735a8ebddd69 | |
parent | a3952509a91b15ccc959e0dbddd12e1678e3814e (diff) | |
download | scummvm-rg350-7f4dbf7d48b6db8d82d33b569c22f104fc153dd3.tar.gz scummvm-rg350-7f4dbf7d48b6db8d82d33b569c22f104fc153dd3.tar.bz2 scummvm-rg350-7f4dbf7d48b6db8d82d33b569c22f104fc153dd3.zip |
MADS: Implemented more action handling methods
-rw-r--r-- | engines/mads/action.cpp | 57 | ||||
-rw-r--r-- | engines/mads/action.h | 4 | ||||
-rw-r--r-- | engines/mads/game.h | 5 | ||||
-rw-r--r-- | engines/mads/nebular/game_nebular.cpp | 4 | ||||
-rw-r--r-- | engines/mads/nebular/game_nebular.h | 3 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes1.cpp | 2 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 54 |
7 files changed, 93 insertions, 36 deletions
diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index d52adbf0de..0c20fec918 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -36,8 +36,15 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _statusTextIndex = -1; _selectedAction = 0; _inProgress = false; - _savedSelectedRow = false; - _savedLookFlag = false; + + _savedFields._actionMode = ABORTMODE_0; + _savedFields._actionMode2 = ABORTMODE_0; + _savedFields._selectedRow = -1; + _savedFields._hotspotId = 0; + _savedFields._v86F3A = 0; + _savedFields._v86F42 = 0; + _savedFields._articleNumber = 0; + _savedFields._lookFlag = false; } void MADSAction::clear() { @@ -293,37 +300,34 @@ void MADSAction::startAction() { else if (_v86F42 == 4) hotspotId = _savedFields._v86F3A; - if (hotspotId >= hotspots.size()) { + if (hotspotId >= (int)hotspots.size()) { DynamicHotspot &hs = dynHotspots[hotspotId - hotspots.size()]; if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { - if (_v86F4A && ((hs._feetPos.x == -3) || (_savedFields._selectedRow < 0))) { - _startWalkFlag = true; - - - scene._destPos = scene._customDest; - } - } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || - (hs._cursor < 2))) { + checkCustomDest(hs._feetPos.x); + } else if (hs._feetPos.x == 0) { + scene._destFacing = hs._facing; + } else if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { _startWalkFlag = true; - scene._destPos.x = hs._feetPos.x; - scene._destPos.y = hs._feetPos.y; + scene._destPos = hs._feetPos; } + scene._destFacing = hs._facing; hotspotId = -1; } } - if (hotspotId >= 0) { + if (hotspotId >= 0 && hotspotId < (int)hotspots.size()) { Hotspot &hs = hotspots[hotspotId]; - if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { - if (_v86F4A && ((hs._feetPos.x == -3) || (_savedFields._selectedRow < 0))) { + + if (hs._feetPos.x == -1 || hs._feetPos.x != -3) { + checkCustomDest(hs._feetPos.x); + } else if (hs._feetPos.x >= 0) { + if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { _startWalkFlag = true; - scene._destPos = scene._customDest; + scene._destPos = hs._feetPos; } - } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || (hs._cursor < 2))) { - _startWalkFlag = true; - scene._destPos = hs._feetPos; } + scene._destFacing = hs._facing; } @@ -331,21 +335,18 @@ void MADSAction::startAction() { } void MADSAction::checkAction() { - /* - if (isAction(kVerbLookAt) || isAction(kVerbThrow)) + if (isAction(VERB_LOOK) || isAction(VERB_THROW)) _startWalkFlag = 0; - */ } bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { - /* - if (_activeAction.verbId != verbId) + if (_activeAction._verbId != verbId) return false; - if ((objectNameId != 0) && (_activeAction.objectNameId != objectNameId)) + if ((objectNameId != 0) && (_activeAction._objectNameId != objectNameId)) return false; - if ((indirectObjectId != 0) && (_activeAction.indirectObjectId != indirectObjectId)) + if ((indirectObjectId != 0) && (_activeAction._indirectObjectId != indirectObjectId)) return false; - */ + return true; } diff --git a/engines/mads/action.h b/engines/mads/action.h index b32720f4a0..802dfb0576 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -72,7 +72,6 @@ private: MADSEngine *_vm; Common::String _statusText; Common::String _dialogTitle; - ActionSavedFields _savedFields; void appendVocab(int vocabId, bool capitalise = false); @@ -92,8 +91,7 @@ public: int _statusTextIndex; int _hotspotId; bool _walkFlag; - bool _savedSelectedRow; - bool _savedLookFlag; + ActionSavedFields _savedFields; // Unknown fields int16 _v86F3A; diff --git a/engines/mads/game.h b/engines/mads/game.h index 32491ce0d0..bf81c23d81 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -143,6 +143,11 @@ public: uint32 getQuotesSize() { return _quotes.size(); } const Common::String &getQuote(uint32 index) { return _quotes[index - 1]; } + /** + * Standard object handling across the game + */ + virtual void doObjectAction() = 0; + // DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs void clearQuotes() {} void loadQuoteRange(int startNum, int endNum) {} diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index e5c344b738..76ea1f55de 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -194,6 +194,10 @@ void GameNebular::checkShowDialog() { } } +void GameNebular::doObjectAction() { + warning("TODO: GameNebular::doObjectAction"); +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 685e5c7cd6..98ecb0a41e 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -61,10 +61,11 @@ protected: virtual void setSectionHandler(); virtual void checkShowDialog(); - public: Globals _globals; StoryMode _storyMode; + + virtual void doObjectAction(); }; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index d6287de993..652ee99d38 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -257,7 +257,7 @@ void Scene103::preActions() { } void Scene103::actions() { - if (_action._savedLookFlag) { + if (_action._savedFields._lookFlag) { Dialog::show(10322); } else if (_action.isAction(395, 110, 0)) { switch (_vm->_game->_abortTimers) { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index cfdfa87c61..565ef47395 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -302,7 +302,7 @@ void Scene::doFrame() { _action.startAction(); if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; - _action._savedSelectedRow = false; + _action._savedFields._selectedRow = false; } flag = true; @@ -470,11 +470,59 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { } void Scene::doPreactions() { - warning("TODO: Scene::doPreactions"); + if (_vm->_game->_screenObjects._v832EC == 0 || _vm->_game->_screenObjects._v832EC == 2) { + _vm->_game->_abortTimersMode2 = ABORTMODE_2; + _action.checkAction(); + _sceneLogic->preActions(); + + if (_vm->_game->_abortTimersMode == ABORTMODE_2) + _vm->_game->_abortTimers = 0; + } } void Scene::doAction() { - warning("TODO: Scene::doAction"); + int flag = 0; + + _vm->_game->_abortTimersMode2 = ABORTMODE_0; + if ((_action._inProgress || _vm->_game->_abortTimers) && !_action._v8453A) { + _sceneLogic->actions(); + _action._inProgress = true; + flag = -1; + } + + if (_vm->_game->_screenObjects._v832EC == 1) { + _action._inProgress = false; + } else { + if ((_action._inProgress || _vm->_game->_abortTimers) || + (!flag && _action._v8453A == flag)) { + _vm->_game->_sectionHandler->sectionPtr2(); + _action._inProgress = true; + flag = -1; + } + + if ((_action._inProgress || _vm->_game->_abortTimers) && (!flag || _action._v8453A == flag)) { + _vm->_game->doObjectAction(); + } + + if (!_action._savedFields._lookFlag) { + if (!_action._inProgress) { + _action._v8453A = -1; + _sceneLogic->postActions(); + } + + if (!_action._inProgress) { + _action._v8453A = -1; + warning("TODO: PtrUnk4"); + } + + if (_action._inProgress) + warning("TODO: sub_1D9DE"); + } + } + + _action._inProgress = false; + if (_vm->_game->_abortTimersMode == ABORTMODE_0) + _vm->_game->_abortTimers = 0; } void Scene::checkStartWalk() { |