diff options
author | Paul Gilbert | 2014-03-23 17:31:33 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-03-23 17:31:33 -0400 |
commit | a3952509a91b15ccc959e0dbddd12e1678e3814e (patch) | |
tree | dbec1fd195f9ac6f9a490cdcc55f36f01e0cdaa5 | |
parent | a22318959989caf91916ba792f80103afe71092a (diff) | |
download | scummvm-rg350-a3952509a91b15ccc959e0dbddd12e1678e3814e.tar.gz scummvm-rg350-a3952509a91b15ccc959e0dbddd12e1678e3814e.tar.bz2 scummvm-rg350-a3952509a91b15ccc959e0dbddd12e1678e3814e.zip |
MADS: In progress work on action starting
-rw-r--r-- | engines/mads/action.cpp | 87 | ||||
-rw-r--r-- | engines/mads/action.h | 21 |
2 files changed, 63 insertions, 45 deletions
diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 52be8eabba..d52adbf0de 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -69,6 +69,15 @@ void MADSAction::appendVocab(int vocabId, bool capitalise) { _statusText += " "; } +void MADSAction::checkCustomDest(int v) { + Scene &scene = _vm->_game->_scene; + + if (_v86F4A && (v == -3 || _savedFields._selectedRow < 0)) { + _startWalkFlag = true; + scene._destPos = scene._customDest; + } +} + void MADSAction::set() { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; @@ -249,72 +258,76 @@ void MADSAction::refresh() { } void MADSAction::startAction() { - /* - _madsVm->_player.moveComplete(); + Game &game = *_vm->_game; + Scene &scene = _vm->_game->_scene; + DynamicHotspots &dynHotspots = scene._dynamicHotspots; + Hotspots &hotspots = scene._hotspots; + + game._player.moveComplete(); _inProgress = true; _v8453A = ABORTMODE_0; - _savedFields.selectedRow = _selectedRow; - _savedFields.articleNumber = _articleNumber; - _savedFields.actionMode = _actionMode; - _savedFields.actionMode2 = _actionMode2; - _savedFields.lookFlag = _lookFlag; - int savedHotspotId = _hotspotId; - int savedV86F3A = _v86F3A; - int savedV86F42 = _v86F42; + _savedFields._selectedRow = _selectedRow; + _savedFields._hotspotId = _hotspotId; + _savedFields._v86F3A = _v86F3A; + _savedFields._articleNumber = _articleNumber; + _savedFields._actionMode = _actionMode; + _savedFields._actionMode2 = _actionMode2; + _savedFields._v86F42 = _v86F42; + _savedFields._lookFlag = _lookFlag; + _activeAction = _action; // Copy the action to be active _activeAction = _action; - strcpy(_dialogTitle, _statusText); + _dialogTitle = _statusText; - if ((_savedFields.actionMode2 == ACTMODE2_4) && (savedV86F42 == 0)) - _v8453A = ABORTMODE_1; + if ((_actionMode2 == ACTIONMODE2_4) && (_v86F42 == 0)) + _v8453A = -1; _startWalkFlag = false; int hotspotId = -1; - HotSpotList &dynHotspots = *_madsVm->scene()->getSceneResources().dynamicHotspots; - HotSpotList &hotspots = *_madsVm->scene()->getSceneResources().hotspots; - if (!_savedFields.lookFlag && (_madsVm->scene()->_screenObjects._v832EC != 1)) { - if (_savedFields.actionMode2 == ACTMODE2_4) - hotspotId = savedHotspotId; - else if (savedV86F42 == 4) - hotspotId = savedV86F3A; + if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._v832EC != 1)) { + if (_savedFields._actionMode2 == ACTIONMODE2_4) + hotspotId = _savedFields._hotspotId; + else if (_v86F42 == 4) + hotspotId = _savedFields._v86F3A; if (hotspotId >= hotspots.size()) { - HotSpot &hs = dynHotspots[hotspotId - hotspots.size()]; - if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) { - if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) { + 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; - _madsVm->scene()->_destPos = _madsVm->scene()->_customDest; + + + scene._destPos = scene._customDest; } - } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) { + } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || + (hs._cursor < 2))) { _startWalkFlag = true; - _madsVm->scene()->_destPos.x = hs.getFeetX(); - _madsVm->scene()->_destPos.y = hs.getFeetY(); + scene._destPos.x = hs._feetPos.x; + scene._destPos.y = hs._feetPos.y; } - _madsVm->scene()->_destFacing = hs.getFacing(); + scene._destFacing = hs._facing; hotspotId = -1; } } if (hotspotId >= 0) { - HotSpot &hs = hotspots[hotspotId]; - if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) { - if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) { + Hotspot &hs = hotspots[hotspotId]; + if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { + if (_v86F4A && ((hs._feetPos.x == -3) || (_savedFields._selectedRow < 0))) { _startWalkFlag = true; - _madsVm->scene()->_destPos = _madsVm->scene()->_customDest; + scene._destPos = scene._customDest; } - } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) { + } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || (hs._cursor < 2))) { _startWalkFlag = true; - _madsVm->scene()->_destPos.x = hs.getFeetX(); - _madsVm->scene()->_destPos.y = hs.getFeetY(); + scene._destPos = hs._feetPos; } - _madsVm->scene()->_destFacing = hs.getFacing(); + scene._destFacing = hs._facing; } _walkFlag = _startWalkFlag; - */ } void MADSAction::checkAction() { diff --git a/engines/mads/action.h b/engines/mads/action.h index 04d9c3607a..b32720f4a0 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -56,12 +56,15 @@ struct ActionDetails { int _indirectObjectId; }; -struct MADSActionSavedFields { - int articleNumber; - int actionMode; - int actionMode2; - bool lookFlag; - int selectedRow; +struct ActionSavedFields { + int _actionMode; + int _selectedRow; + int _hotspotId; + int _v86F3A; + int _actionMode2; + int _v86F42; + int _articleNumber; + int _lookFlag; }; class MADSAction { @@ -69,8 +72,11 @@ private: MADSEngine *_vm; Common::String _statusText; Common::String _dialogTitle; + ActionSavedFields _savedFields; void appendVocab(int vocabId, bool capitalise = false); + + void checkCustomDest(int v); public: ActionDetails _action, _activeAction; int _currentAction; @@ -85,7 +91,6 @@ public: bool _startWalkFlag; int _statusTextIndex; int _hotspotId; - MADSActionSavedFields _savedFields; bool _walkFlag; bool _savedSelectedRow; bool _savedLookFlag; @@ -98,7 +103,7 @@ public: int16 _v86F4C; int _v83338; bool _inProgress; - AbortTimerMode _v8453A; + int _v8453A; public: MADSAction(MADSEngine *vm); |