diff options
author | Paul Gilbert | 2010-07-24 05:56:06 +0000 |
---|---|---|
committer | Paul Gilbert | 2010-07-24 05:56:06 +0000 |
commit | ec460ca2cabf426a6b3591d32a68872897c00ac3 (patch) | |
tree | c6795daeef0fd6d00000d01058042a006fd0b4bc /engines/m4/mads_scene.cpp | |
parent | cd66b7d11b4a1f3082b62d440e1b010a40be94b5 (diff) | |
download | scummvm-rg350-ec460ca2cabf426a6b3591d32a68872897c00ac3.tar.gz scummvm-rg350-ec460ca2cabf426a6b3591d32a68872897c00ac3.tar.bz2 scummvm-rg350-ec460ca2cabf426a6b3591d32a68872897c00ac3.zip |
M4: Implemented lots of support code for pre-action handling
svn-id: r51235
Diffstat (limited to 'engines/m4/mads_scene.cpp')
-rw-r--r-- | engines/m4/mads_scene.cpp | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp index c459a2a58a..1f43f73cc0 100644 --- a/engines/m4/mads_scene.cpp +++ b/engines/m4/mads_scene.cpp @@ -195,24 +195,21 @@ void MadsScene::loadSceneHotspots(int sceneNumber) { int hotspotCount = hotspotStream->readUint16LE(); delete hotspotStream; - _sceneResources.hotspotCount = hotspotCount; - hotspotStream = hotSpotData.getItemStream(1); // Clear current hotspot lists _sceneResources.hotspots->clear(); - - _sceneResources.hotspots->loadHotSpots(hotspotStream, _sceneResources.hotspotCount); + _sceneResources.hotspots->loadHotSpots(hotspotStream, hotspotCount); delete hotspotStream; } void MadsScene::leaveScene() { _sceneResources.hotspots->clear(); - _sceneResources.props->clear(); + _sceneResources.dynamicHotspots->clear(); delete _sceneResources.hotspots; - delete _sceneResources.props; + delete _sceneResources.dynamicHotspots; delete _walkSurface; if (_activeAnimation) { @@ -322,6 +319,21 @@ void MadsScene::updateState() { // _screenObjects.check(v, false); } + // Handle starting off any selected action + bool lookFlag = false; + if ((_action._selectedAction != 0) && _madsVm->_player._stepEnabled && + !_action._verbNounFlag && !_abortTimers && !_madsVm->_player._unk3) { + // Start the action + _action.startAction(); + + lookFlag = (_action._action.verbId == kVerbLookAt) || (_action._action.verbId == kVerbLook); + } + if (lookFlag || ((_abortTimers != 0) && (_abortTimersMode == ABORTMODE_2))) + doPreactions(); + + checkStartWalk(); + + // Update the player _madsVm->_player.update(); // Handle refreshing the mouse position display @@ -364,6 +376,25 @@ void MadsScene::updateState() { freeAnimation(); } +void MadsScene::checkStartWalk() { + if (_action._verbNounFlag && _action._walkFlag) { + _madsVm->_player.setDest(_destPos.x, _destPos.y, _destFacing); + _action._verbNounFlag = false; + } +} + +void MadsScene::doPreactions() { + if ((_screenObjects._v832EC == 0) || (_screenObjects._v832EC == 2)) { + _abortTimersMode2 = ABORTMODE_2; + _action.checkAction(); + + _sceneLogic.doPreactions(); + + if (_abortTimersMode == ABORTMODE_2) + _abortTimers = 0; + } +} + /** * Does extra work at cleaning up the animation, and then deletes it */ @@ -999,7 +1030,7 @@ bool MadsInterfaceView::onEvent(M4EventType eventType, int32 param1, int x, int act._flags1 = obj->vocabList[1].flags1; act._flags2 = obj->vocabList[1].flags2; - act._action.hotspotId = _selectedObject; + act._action.verbId = _selectedObject; act._articleNumber = act._flags2; } } |