diff options
author | Andrew Kurushin | 2006-01-13 20:20:01 +0000 |
---|---|---|
committer | Andrew Kurushin | 2006-01-13 20:20:01 +0000 |
commit | 3a7a7b329189f660fb79b88f7120a9ad2790d38e (patch) | |
tree | 4343b3264abd9a2ca07984672b2303f3db6989c4 | |
parent | 641caf7e73814d054e63aa8bddb99139551c5f0b (diff) | |
download | scummvm-rg350-3a7a7b329189f660fb79b88f7120a9ad2790d38e.tar.gz scummvm-rg350-3a7a7b329189f660fb79b88f7120a9ad2790d38e.tar.bz2 scummvm-rg350-3a7a7b329189f660fb79b88f7120a9ad2790d38e.zip |
implement IHNM verb mapper
svn-id: r20003
-rw-r--r-- | saga/actor.cpp | 6 | ||||
-rw-r--r-- | saga/game.cpp | 32 | ||||
-rw-r--r-- | saga/input.cpp | 1 | ||||
-rw-r--r-- | saga/interface.cpp | 29 | ||||
-rw-r--r-- | saga/interface.h | 4 | ||||
-rw-r--r-- | saga/saga.cpp | 23 | ||||
-rw-r--r-- | saga/scene.cpp | 4 | ||||
-rw-r--r-- | saga/script.cpp | 209 | ||||
-rw-r--r-- | saga/script.h | 73 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 4 |
10 files changed, 240 insertions, 145 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index 1b3ea07cff..fc8a79e927 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -650,7 +650,7 @@ void Actor::stepZoneAction(ActorData *actor, const HitZone *hitZone, bool exit, event.time = 0; event.param = _vm->_scene->getScriptModuleNumber(); // module number event.param2 = hitZone->getScriptNumber(); // script entry point number - event.param3 = kVerbEnter; // Action + event.param3 = _vm->_script->getVerbType(kVerbEnter); // Action event.param4 = ID_NOTHING; // Object event.param5 = ID_NOTHING; // With Object event.param6 = ID_PROTAG; // Actor @@ -1972,7 +1972,7 @@ bool Actor::actorEndWalk(uint16 actorId, bool recurse) { if (actor == _protagonist) { _vm->_script->wakeUpActorThread(kWaitTypeWalk, actor); - if (_vm->_script->_pendingVerb == kVerbWalkTo) { + if (_vm->_script->_pendingVerb == _vm->_script->getVerbType(kVerbWalkTo)) { actor->_location.toScreenPointUV(testPoint); hitZoneIndex = _vm->_scene->_actionMap->hitTest(testPoint); if (hitZoneIndex != -1) { @@ -1981,7 +1981,7 @@ bool Actor::actorEndWalk(uint16 actorId, bool recurse) { } else { _vm->_script->setNoPendingVerb(); } - } else if (_vm->_script->_pendingVerb != kVerbNone) { + } else if (_vm->_script->_pendingVerb != _vm->_script->getVerbType(kVerbNone)) { _vm->_script->doVerb(); } } else { diff --git a/saga/game.cpp b/saga/game.cpp index a7165113b3..edb1eecc92 100644 --- a/saga/game.cpp +++ b/saga/game.cpp @@ -53,14 +53,14 @@ static int detectGame(const FSList &fslist, bool mode = false, int start = -1); // ITE section static PanelButton ITE_MainPanelButtons[] = { - {kPanelButtonVerb, 52,4, 57,10, kVerbWalkTo,'w',0, 0,1,0}, - {kPanelButtonVerb, 52,15, 57,10, kVerbLookAt,'l',0, 2,3,0}, - {kPanelButtonVerb, 52,26, 57,10, kVerbPickUp,'p',0, 4,5,0}, - {kPanelButtonVerb, 52,37, 57,10, kVerbTalkTo,'t',0, 0,1,0}, - {kPanelButtonVerb, 110,4, 56,10, kVerbOpen,'o',0, 6,7,0}, - {kPanelButtonVerb, 110,15, 56,10, kVerbClose,'c',0, 8,9,0}, - {kPanelButtonVerb, 110,26, 56,10, kVerbUse,'u',0, 10,11,0}, - {kPanelButtonVerb, 110,37, 56,10, kVerbGive,'g',0, 12,13,0}, + {kPanelButtonVerb, 52,4, 57,10, kVerbITEWalkTo,'w',0, 0,1,0}, + {kPanelButtonVerb, 52,15, 57,10, kVerbITELookAt,'l',0, 2,3,0}, + {kPanelButtonVerb, 52,26, 57,10, kVerbITEPickUp,'p',0, 4,5,0}, + {kPanelButtonVerb, 52,37, 57,10, kVerbITETalkTo,'t',0, 0,1,0}, + {kPanelButtonVerb, 110,4, 56,10, kVerbITEOpen,'o',0, 6,7,0}, + {kPanelButtonVerb, 110,15, 56,10, kVerbITEClose,'c',0, 8,9,0}, + {kPanelButtonVerb, 110,26, 56,10, kVerbITEUse,'u',0, 10,11,0}, + {kPanelButtonVerb, 110,37, 56,10, kVerbITEGive,'g',0, 12,13,0}, {kPanelButtonArrow, 306,6, 8,5, -1,'U',0, 0,4,2}, {kPanelButtonArrow, 306,41, 8,5, 1,'D',0, 1,5,3}, @@ -533,14 +533,14 @@ static GamePatchDescription ITELinPatch_Files[] = { // IHNM section static PanelButton IHNM_MainPanelButtons[] = { - {kPanelButtonVerb, 106,12, 114,30, kVerbWalkTo,'w',0, 0,1,0}, - {kPanelButtonVerb, 106,44, 114,30, kVerbLookAt,'l',0, 2,3,0}, - {kPanelButtonVerb, 106,76, 114,30, kVerbTake,'k',0, 4,5,0}, - {kPanelButtonVerb, 106,108, 114,30, kVerbUse,'u',0, 6,7,0}, - {kPanelButtonVerb, 223,12, 114,30, kVerbTalkTo,'t',0, 8,9,0}, - {kPanelButtonVerb, 223,44, 114,30, kVerbSwallow,'s',0, 10,11,0}, - {kPanelButtonVerb, 223,76, 114,30, kVerbGive,'g',0, 12,13,0}, - {kPanelButtonVerb, 223,108, 114,30, kVerbPush,'p',0, 14,15,0}, + {kPanelButtonVerb, 106,12, 114,30, kVerbIHNMWalk,'w',0, 0,1,0}, + {kPanelButtonVerb, 106,44, 114,30, kVerbIHNMLookAt,'l',0, 2,3,0}, + {kPanelButtonVerb, 106,76, 114,30, kVerbIHNMTake,'k',0, 4,5,0}, + {kPanelButtonVerb, 106,108, 114,30, kVerbIHNMUse,'u',0, 6,7,0}, + {kPanelButtonVerb, 223,12, 114,30, kVerbIHNMTalkTo,'t',0, 8,9,0}, + {kPanelButtonVerb, 223,44, 114,30, kVerbIHNMSwallow,'s',0, 10,11,0}, + {kPanelButtonVerb, 223,76, 114,30, kVerbIHNMGive,'g',0, 12,13,0}, + {kPanelButtonVerb, 223,108, 114,30, kVerbIHNMPush,'p',0, 14,15,0}, {kPanelButtonArrow, 606,22, 20,25, -1,'[',0, 0,0,0}, //TODO: arrow Sprite Numbers {kPanelButtonArrow, 606,108, 20,25, 1,']',0, 0,0,0}, diff --git a/saga/input.cpp b/saga/input.cpp index 0da4c112c9..cb2b6fa2c5 100644 --- a/saga/input.cpp +++ b/saga/input.cpp @@ -97,6 +97,7 @@ int SagaEngine::processInput() { _render->toggleFlag(RF_ACTOR_PATH_TEST); break; case 288: // F7 + //_actor->frameTest(); break; case 289: // F8 break; diff --git a/saga/interface.cpp b/saga/interface.cpp index c28edc19c7..65d2f14de7 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -50,7 +50,7 @@ namespace Saga { -static int verbTypeToTextStringsIdLUT[2][kVerbTypesMax] = { +static int verbTypeToTextStringsIdLUT[2][kVerbTypeIdsMax] = { {-1, kTextPickUp, kTextLookAt, @@ -65,11 +65,16 @@ static int verbTypeToTextStringsIdLUT[2][kVerbTypesMax] = { -1, -1, -1, - -1, - -1, - -1, - -1}, - {-1, -1, 2, 1, 5, -1, -1, 7, 4, -1, -1, -1, -1, -1, -1, 3, 6, 8} + -1}, + {-1, + 3, //TODO:check + 2, + 1, + 5, + 6, //TODO:check + 8, //TODO:check + 7, + 4} }; Interface::Interface(SagaEngine *vm) : _vm(vm) { @@ -86,7 +91,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { _mainPanel.buttons = _vm->getDisplayInfo().mainPanelButtons; _mainPanel.buttonsCount = _vm->getDisplayInfo().mainPanelButtonsCount; - for (i = 0; i < kVerbTypesMax; i++) { + for (i = 0; i < kVerbTypeIdsMax; i++) { _verbTypeToPanelButton[i] = NULL; } @@ -632,7 +637,7 @@ void Interface::draw() { _mainPanel.getRect(rect); backBuffer->blit(rect, _mainPanel.image); - for (i = 0; i < kVerbTypesMax; i++) { + for (i = 0; i < kVerbTypeIdsMax; i++) { if (_verbTypeToPanelButton[i] != NULL) { drawVerbPanel(backBuffer, _verbTypeToPanelButton[i]); } @@ -681,6 +686,7 @@ void Interface::draw() { void Interface::calcOptionSaveSlider() { int totalFiles = _vm->getSaveFilesCount(); int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible; + if (_optionSaveFileSlider == NULL) return; //TODO:REMOVE int height = _optionSaveFileSlider->height; int sliderHeight; int pos; @@ -750,7 +756,8 @@ void Interface::drawOption() { Rect rect2; PanelButton *panelButton; Point textPoint; - + if (_optionSaveFileSlider == NULL) return;//TODO:REMOVE + backBuffer = _vm->_gfx->getBackBuffer(); _optionPanel.getRect(rect); @@ -1186,6 +1193,7 @@ void Interface::handleOptionUpdate(const Point& mousePoint) { bool releasedButton; if (_vm->mouseButtonPressed()) { + if (_optionSaveFileSlider != NULL) //TODO:REMOVE if (_optionSaveFileSlider->state > 0) { _optionPanel.calcPanelButtonRect(_optionSaveFileSlider, rect); @@ -1314,7 +1322,7 @@ void Interface::handleChapterSelectionClick(const Point& mousePoint) { event.time = 0; event.param = _vm->_scene->getScriptModuleNumber(); event.param2 = script; - event.param3 = kVerbUse; // Action + event.param3 = _vm->_script->getVerbType(kVerbUse); // Action event.param4 = obj; // Object event.param5 = 0; // With Object event.param6 = obj; // Actor @@ -1782,6 +1790,7 @@ void Interface::drawInventory(Surface *backBuffer) { void Interface::setVerbState(int verb, int state) { PanelButton * panelButton = getPanelButtonByVerbType(verb); + if (panelButton == NULL) return; if (state == 2) { state = (_mainPanel.currentButton == panelButton) ? 1 : 0; } diff --git a/saga/interface.h b/saga/interface.h index 5df9ddd036..67c860ae29 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -358,7 +358,7 @@ public: private: void converseDisplayTextLines(Surface *ds); PanelButton *getPanelButtonByVerbType(int verb) { - if ((verb < 0) || (verb >= kVerbTypesMax)) { + if ((verb < 0) || (verb >= kVerbTypeIdsMax)) { error("Interface::getPanelButtonByVerbType wrong verb"); } return _verbTypeToPanelButton[verb]; @@ -393,7 +393,7 @@ private: PanelButton *_converseUpButton; PanelButton *_converseDownButton; SpriteList _scenePortraits; - PanelButton *_verbTypeToPanelButton[kVerbTypesMax]; + PanelButton *_verbTypeToPanelButton[kVerbTypeIdsMax]; InterfacePanel _optionPanel; PanelButton * _optionSaveFileSlider; PanelButton * _optionSaveFilePanel; diff --git a/saga/saga.cpp b/saga/saga.cpp index 9783dc1592..accb384fa3 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -260,7 +260,7 @@ int SagaEngine::init(GameDetector &detector) { } _interface->converseInit(); - _script->setVerb(kVerbWalkTo); + _script->setVerb(_script->getVerbType(kVerbWalkTo)); _music->setVolume(-1, 1); @@ -417,27 +417,26 @@ const char *SagaEngine::getTextString(int textStringId) { void SagaEngine::getExcuseInfo(int verb, const char *&textString, int &soundResourceId) { textString = NULL; - switch (verb) { - case kVerbPickUp: + + if (verb == _script->getVerbType(kVerbPickUp)) { textString = getTextString(kTextICantPickup); soundResourceId = RID_BOAR_VOICE_007; - break; - case kVerbLookAt: + } else + if (verb == _script->getVerbType(kVerbLookAt)) { textString = getTextString(kTextNothingSpecial); soundResourceId = RID_BOAR_VOICE_006; - break; - case kVerbOpen: + } + if (verb == _script->getVerbType(kVerbOpen)) { textString = getTextString(kTextNoPlaceToOpen); soundResourceId = RID_BOAR_VOICE_000; - break; - case kVerbClose: + } + if (verb == _script->getVerbType(kVerbClose)) { textString = getTextString(kTextNoOpening); soundResourceId = RID_BOAR_VOICE_002; - break; - case kVerbUse: + } + if (verb == _script->getVerbType(kVerbUse)) { textString = getTextString(kTextDontKnow); soundResourceId = RID_BOAR_VOICE_005; - break; } } diff --git a/saga/scene.cpp b/saga/scene.cpp index 52a4145fef..e66bcaf618 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -620,7 +620,7 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { _inGame = true; - _vm->_script->setVerb(kVerbWalkTo); + _vm->_script->setVerb(_vm->_script->getVerbType(kVerbWalkTo)); if (loadSceneParams->sceneDescriptor == -2) { return; @@ -859,7 +859,7 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { event.time = 0; event.param = _sceneDescription.scriptModuleNumber; event.param2 = _sceneDescription.sceneScriptEntrypointNumber; - event.param3 = kVerbEnter; // Action + event.param3 = _vm->_script->getVerbType(kVerbEnter); // Action event.param4 = _sceneNumber; // Object event.param5 = loadSceneParams->actorsEntrance; // With Object event.param6 = 0; // Actor diff --git a/saga/script.cpp b/saga/script.cpp index 6ae09c9a7b..604668a5ab 100644 --- a/saga/script.cpp +++ b/saga/script.cpp @@ -40,6 +40,8 @@ namespace Saga { + + // Initializes the scripting module. // Loads script resource look-up table, initializes script data system Script::Script(SagaEngine *vm) : _vm(vm) { @@ -58,11 +60,11 @@ Script::Script(SagaEngine *vm) : _vm(vm) { _firstObjectSet = false; _secondObjectNeeded = false; - _pendingVerb = kVerbNone; - _currentVerb = kVerbNone; - _stickyVerb = kVerbWalkTo; - _leftButtonVerb = kVerbNone; - _rightButtonVerb = kVerbNone; + _pendingVerb = getVerbType(kVerbNone); + _currentVerb = getVerbType(kVerbNone); + _stickyVerb = getVerbType(kVerbWalkTo); + _leftButtonVerb = getVerbType(kVerbNone); + _rightButtonVerb = getVerbType(kVerbNone); _pointerObject = ID_NOTHING; _staticSize = 0; @@ -279,7 +281,7 @@ void Script::showVerb(int statusColor) { const char *object2Name; char statusString[STATUS_TEXT_LEN]; - if (_leftButtonVerb == kVerbNone) { + if (_leftButtonVerb == getVerbType(kVerbNone)) { _vm->_interface->setStatusText(""); return; } @@ -306,11 +308,11 @@ void Script::showVerb(int statusColor) { object2Name = ""; } - if (_leftButtonVerb == kVerbGive) { + if (_leftButtonVerb == getVerbType(kVerbGive)) { snprintf(statusString, STATUS_TEXT_LEN, _vm->getTextString(kTextGiveTo), object1Name, object2Name); _vm->_interface->setStatusText(statusString, statusColor); } else { - if (_leftButtonVerb == kVerbUse) { + if (_leftButtonVerb == getVerbType(kVerbUse)) { snprintf(statusString, STATUS_TEXT_LEN, _vm->getTextString(kTextUseWidth), object1Name, object2Name); _vm->_interface->setStatusText(statusString, statusColor); } else { @@ -320,6 +322,70 @@ void Script::showVerb(int statusColor) { } } +int Script::getVerbType(VerbTypes verbType) { + if (_vm->getGameType() == GType_ITE) { + switch (verbType) { + case kVerbNone: + return kVerbITENone; + case kVerbWalkTo: + return kVerbITEWalkTo; + case kVerbGive: + return kVerbITEGive; + case kVerbUse: + return kVerbITEUse; + case kVerbEnter: + return kVerbITEEnter; + case kVerbLookAt: + return kVerbITELookAt; + case kVerbPickUp: + return kVerbITEPickUp; + case kVerbOpen: + return kVerbITEOpen; + case kVerbClose: + return kVerbITEClose; + case kVerbTalkTo: + return kVerbITETalkTo; + case kVerbWalkOnly: + return kVerbITEWalkOnly; + case kVerbLookOnly: + return kVerbITELookOnly; + case kVerbOptions: + return kVerbITEOptions; + } + } + else { + switch (verbType) { + case kVerbNone: + return kVerbIHNMNone; + case kVerbWalkTo: + return kVerbIHNMWalk; + case kVerbGive: + return kVerbIHNMGive; + case kVerbUse: + return kVerbIHNMUse; + case kVerbEnter: + return kVerbIHNMEnter; + case kVerbLookAt: + return kVerbIHNMLookAt; + case kVerbPickUp: + return kVerbIHNMTake; + case kVerbOpen: + return -2; + case kVerbClose: + return -2; + case kVerbTalkTo: + return kVerbIHNMTalkTo; + case kVerbWalkOnly: + return kVerbIHNMWalkOnly; + case kVerbLookOnly: + return kVerbIHNMLookOnly; + case kVerbOptions: + return kVerbIHNMOptions; + } + } + error("Script::getVerbType() unknown verb type %d", verbType); +} + void Script::setVerb(int verb) { _pendingObject[0] = ID_NOTHING; _currentObject[0] = ID_NOTHING; @@ -343,10 +409,10 @@ void Script::setLeftButtonVerb(int verb) { _currentVerb = _leftButtonVerb = verb; if ((_currentVerb != oldVerb) && (_vm->_interface->getMode() == kPanelMain)){ - if (oldVerb > kVerbNone) + if (oldVerb > getVerbType(kVerbNone)) _vm->_interface->setVerbState(oldVerb, 2); - if (_currentVerb > kVerbNone) + if (_currentVerb > getVerbType(kVerbNone)) _vm->_interface->setVerbState(_currentVerb, 2); } } @@ -357,10 +423,10 @@ void Script::setRightButtonVerb(int verb) { _rightButtonVerb = verb; if ((_rightButtonVerb != oldVerb) && (_vm->_interface->getMode() == kPanelMain)){ - if (oldVerb > kVerbNone) + if (oldVerb > getVerbType(kVerbNone)) _vm->_interface->setVerbState(oldVerb, 2); - if (_rightButtonVerb > kVerbNone) + if (_rightButtonVerb > getVerbType(kVerbNone)) _vm->_interface->setVerbState(_rightButtonVerb, 2); } } @@ -376,7 +442,7 @@ void Script::doVerb() { objectType = objectTypeId(_pendingObject[0]); - if (_pendingVerb == kVerbGive) { + if (_pendingVerb == getVerbType(kVerbGive)) { scriptEntrypointNumber = _vm->_actor->getObjectScriptEntrypointNumber(_pendingObject[1]); if (_vm->_actor->getObjectFlags(_pendingObject[1]) & (kFollower|kProtagonist|kExtended)) { scriptModuleNumber = 0; @@ -384,7 +450,7 @@ void Script::doVerb() { scriptModuleNumber = _vm->_scene->getScriptModuleNumber(); } } else { - if (_pendingVerb == kVerbUse) { + if (_pendingVerb == getVerbType(kVerbUse)) { if ((objectTypeId(_pendingObject[1]) > kGameObjectNone) && (objectType < objectTypeId(_pendingObject[1]))) { SWAP(_pendingObject[0], _pendingObject[1]); objectType = objectTypeId(_pendingObject[0]); @@ -436,11 +502,11 @@ void Script::doVerb() { } } - if ((_currentVerb == kVerbWalkTo) || (_currentVerb == kVerbLookAt)) { + if ((_currentVerb == getVerbType(kVerbWalkTo)) || (_currentVerb == getVerbType(kVerbLookAt))) { _stickyVerb = _currentVerb; } - _pendingVerb = kVerbNone; + _pendingVerb = getVerbType(kVerbNone); _currentObject[0] = _currentObject[1] = ID_NOTHING; setLeftButtonVerb(_stickyVerb); @@ -458,7 +524,7 @@ void Script::hitObject(bool leftButton) { int verb; verb = leftButton ? _leftButtonVerb : _rightButtonVerb; - if (verb > kVerbNone) { + if (verb > getVerbType(kVerbNone)) { if (_firstObjectSet) { if (_secondObjectNeeded) { _pendingObject[0] = _currentObject[0]; @@ -466,7 +532,7 @@ void Script::hitObject(bool leftButton) { _pendingVerb = verb; _leftButtonVerb = verb; - if (_pendingVerb > kVerbNone) + if (_pendingVerb > getVerbType(kVerbNone)) showVerb(kITEColorBrightWhite); else showVerb(); @@ -476,10 +542,10 @@ void Script::hitObject(bool leftButton) { return; } } else { - if (verb == kVerbGive) { + if (verb == getVerbType(kVerbGive)) { _secondObjectNeeded = true; } else { - if (verb == kVerbUse) { + if (verb == getVerbType(kVerbUse)) { if (_currentObjectFlags[0] & kObjUseWith) { _secondObjectNeeded = true; @@ -500,7 +566,7 @@ void Script::hitObject(bool leftButton) { } _leftButtonVerb = verb; - if (_pendingVerb > kVerbNone) + if (_pendingVerb > getVerbType(kVerbNone)) showVerb(kITEColorBrightWhite); else showVerb(); @@ -521,8 +587,8 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { (_vm->_actor->_protagonist->_currentAction != kActionWalkToPoint)) { return; } - if (_pendingVerb > kVerbNone) { - setLeftButtonVerb(kVerbWalkTo); + if (_pendingVerb > getVerbType(kVerbNone)) { + setLeftButtonVerb(getVerbType(kVerbWalkTo)); } if (_pointerObject != ID_NOTHING) { @@ -530,7 +596,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { } else { _pendingObject[0] = ID_NOTHING; _pendingObject[1] = ID_NOTHING; - _pendingVerb = kVerbWalkTo; + _pendingVerb = getVerbType(kVerbWalkTo); } @@ -547,7 +613,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { if (objectTypeId(_pendingObject[0]) == kGameObjectHitZone) { hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[0])); } else { - if ((_pendingVerb == kVerbUse) && (objectTypeId(_pendingObject[1]) == kGameObjectHitZone)) { + if ((_pendingVerb == getVerbType(kVerbUse)) && (objectTypeId(_pendingObject[1]) == kGameObjectHitZone)) { hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[1])); } } @@ -577,27 +643,25 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { } } - switch (_pendingVerb) { - case kVerbWalkTo: - case kVerbPickUp: - case kVerbOpen: - case kVerbClose: - case kVerbUse: - _vm->_actor->actorWalkTo(ID_PROTAG, pickLocation); - break; - - case kVerbLookAt: - if (objectTypeId(_pendingObject[0]) != kGameObjectActor ) { + if ((_pendingVerb == getVerbType(kVerbWalkTo)) || + (_pendingVerb == getVerbType(kVerbPickUp)) || + (_pendingVerb == getVerbType(kVerbOpen)) || + (_pendingVerb == getVerbType(kVerbClose)) || + (_pendingVerb == getVerbType(kVerbUse))) { _vm->_actor->actorWalkTo(ID_PROTAG, pickLocation); + } else { + if (_pendingVerb == getVerbType(kVerbLookAt)) { + if (objectTypeId(_pendingObject[0]) != kGameObjectActor ) { + _vm->_actor->actorWalkTo(ID_PROTAG, pickLocation); + } else { + doVerb(); + } } else { - doVerb(); + if ((_pendingVerb == getVerbType(kVerbTalkTo)) || + (_pendingVerb == getVerbType(kVerbGive))) { + doVerb(); + } } - break; - - case kVerbTalkTo: - case kVerbGive: - doVerb(); - break; } } @@ -617,7 +681,7 @@ void Script::whichObject(const Point& mousePoint) { objectId = ID_NOTHING; objectFlags = 0; _leftButtonVerb = _currentVerb; - newRightButtonVerb = kVerbNone; + newRightButtonVerb = getVerbType(kVerbNone); if (_vm->_actor->_protagonist->_currentAction != kActionWalkDir) { if (_vm->_scene->getHeight() >= mousePoint.y) { @@ -627,9 +691,9 @@ void Script::whichObject(const Point& mousePoint) { if (objectTypeId(newObjectId) == kGameObjectObject) { objectId = newObjectId; objectFlags = 0; - newRightButtonVerb = kVerbLookAt; + newRightButtonVerb = getVerbType(kVerbLookAt); - if ((_currentVerb == kVerbTalkTo) || ((_currentVerb == kVerbGive) && _firstObjectSet)) { + if ((_currentVerb == getVerbType(kVerbTalkTo)) || ((_currentVerb == getVerbType(kVerbGive)) && _firstObjectSet)) { objectId = ID_NOTHING; newObjectId = ID_NOTHING; } @@ -637,13 +701,13 @@ void Script::whichObject(const Point& mousePoint) { actor = _vm->_actor->getActor(newObjectId); objectId = newObjectId; objectFlags = kObjUseWith; - newRightButtonVerb = kVerbTalkTo; + newRightButtonVerb = getVerbType(kVerbTalkTo); - if ((_currentVerb == kVerbPickUp) || - (_currentVerb == kVerbOpen) || - (_currentVerb == kVerbClose) || - ((_currentVerb == kVerbGive) && !_firstObjectSet) || - ((_currentVerb == kVerbUse) && !(actor->_flags & kFollower))) { + if ((_currentVerb == getVerbType(kVerbPickUp)) || + (_currentVerb == getVerbType(kVerbOpen)) || + (_currentVerb == getVerbType(kVerbClose)) || + ((_currentVerb == getVerbType(kVerbGive)) && !_firstObjectSet) || + ((_currentVerb == getVerbType(kVerbUse)) && !(actor->_flags & kFollower))) { objectId = ID_NOTHING; newObjectId = ID_NOTHING; } @@ -668,38 +732,41 @@ void Script::whichObject(const Point& mousePoint) { objectFlags = 0; newRightButtonVerb = hitZone->getRightButtonVerb() & 0x7f; - if (newRightButtonVerb == kVerbWalkOnly) { - if (_firstObjectSet) { - objectId = ID_NOTHING; - } else { - newRightButtonVerb = _leftButtonVerb = kVerbWalkTo; - } - } else { - if (newRightButtonVerb == kVerbLookOnly) { + if (_vm->getGameType() == GType_ITE) { + + if (newRightButtonVerb == getVerbType(kVerbWalkOnly)) { if (_firstObjectSet) { objectId = ID_NOTHING; } else { - newRightButtonVerb = _leftButtonVerb = kVerbLookAt; + newRightButtonVerb = _leftButtonVerb = getVerbType(kVerbWalkTo); + } + } else { + if (newRightButtonVerb == getVerbType(kVerbLookOnly)) { + if (_firstObjectSet) { + objectId = ID_NOTHING; + } else { + newRightButtonVerb = _leftButtonVerb = getVerbType(kVerbLookAt); + } } } - } - if (newRightButtonVerb >= kVerbOptions) { - newRightButtonVerb = kVerbNone; + if (newRightButtonVerb >= getVerbType(kVerbOptions)) { + newRightButtonVerb = getVerbType(kVerbNone); + } } - if ((_currentVerb == kVerbTalkTo) || ((_currentVerb == kVerbGive) && _firstObjectSet)) { + if ((_currentVerb == getVerbType(kVerbTalkTo)) || ((_currentVerb == getVerbType(kVerbGive)) && _firstObjectSet)) { objectId = ID_NOTHING; newObjectId = ID_NOTHING; } - if ((_leftButtonVerb == kVerbUse) && (hitZone->getRightButtonVerb() & 0x80)) { + if ((_leftButtonVerb == getVerbType(kVerbUse)) && (hitZone->getRightButtonVerb() & 0x80)) { objectFlags = kObjUseWith; } } } } else { - if ((_currentVerb == kVerbTalkTo) || ((_currentVerb == kVerbGive) && _firstObjectSet)) { + if ((_currentVerb == getVerbType(kVerbTalkTo)) || ((_currentVerb == getVerbType(kVerbGive)) && _firstObjectSet)) { // no way } else { panelButton = _vm->_interface->inventoryHitTest(mousePoint); @@ -707,7 +774,7 @@ void Script::whichObject(const Point& mousePoint) { objectId = _vm->_interface->getInventoryContentByPanelButton(panelButton); if (objectId != 0) { obj = _vm->_actor->getObj(objectId); - newRightButtonVerb = kVerbLookAt; + newRightButtonVerb = getVerbType(kVerbLookAt); if (obj->_interactBits & kObjUseWith) { objectFlags = kObjUseWith; } @@ -715,8 +782,8 @@ void Script::whichObject(const Point& mousePoint) { } } - if ((_currentVerb == kVerbPickUp) || (_currentVerb == kVerbTalkTo) || (_currentVerb == kVerbWalkTo)) { - _leftButtonVerb = kVerbLookAt; + if ((_currentVerb == getVerbType(kVerbPickUp)) || (_currentVerb == getVerbType(kVerbTalkTo)) || (_currentVerb == getVerbType(kVerbWalkTo))) { + _leftButtonVerb = getVerbType(kVerbLookAt); } } } @@ -725,7 +792,7 @@ void Script::whichObject(const Point& mousePoint) { _pointerObject = objectId; _currentObject[_firstObjectSet ? 1 : 0] = objectId; _currentObjectFlags[_firstObjectSet ? 1 : 0] = objectFlags; - if (_pendingVerb == kVerbNone) { + if (_pendingVerb == getVerbType(kVerbNone)) { showVerb(); } } diff --git a/saga/script.h b/saga/script.h index c04dabeadf..eed0b13f24 100644 --- a/saga/script.h +++ b/saga/script.h @@ -55,30 +55,26 @@ enum AddressTypes { kAddressIndex = 7 // index from id*/ }; -enum VerbTypes { - kVerbNone = 0, - kVerbPickUp = 1, - kVerbLookAt = 2, - kVerbWalkTo = 3, - kVerbTalkTo = 4, - kVerbOpen = 5, - kVerbClose = 6, - kVerbGive = 7, - kVerbUse = 8, - kVerbOptions = 9, - kVerbEnter = 10, - kVerbLeave = 11, - kVerbBegin = 12, - kVerbWalkOnly = 13, - kVerbLookOnly = 14, - -//additional IHNM - kVerbTake = 15, - kVerbSwallow = 16, - kVerbPush = 17, -/* +enum VerbTypeIds { + kVerbITENone = 0, + kVerbITEPickUp = 1, + kVerbITELookAt = 2, + kVerbITEWalkTo = 3, + kVerbITETalkTo = 4, + kVerbITEOpen = 5, + kVerbITEClose = 6, + kVerbITEGive = 7, + kVerbITEUse = 8, + kVerbITEOptions = 9, + kVerbITEEnter = 10, + kVerbITELeave = 11, + kVerbITEBegin = 12, + kVerbITEWalkOnly = 13, + kVerbITELookOnly = 14, + + kVerbIHNMNone = 0, - kVerbIHNMWalkTo = 1, + kVerbIHNMWalk = 1, kVerbIHNMLookAt = 2, kVerbIHNMTake = 3, kVerbIHNMUse = 4, @@ -86,8 +82,30 @@ enum VerbTypes { kVerbIHNMSwallow = 6, kVerbIHNMGive = 7, kVerbIHNMPush = 8, -*/ - kVerbTypesMax = kVerbPush + 1 + kVerbIHNMOptions = 9, + kVerbIHNMEnter = 10, + kVerbIHNMLeave = 11, + kVerbIHNMBegin = 12, + kVerbIHNMWalkOnly = 13, + kVerbIHNMLookOnly = 14, + + kVerbTypeIdsMax = kVerbITELookOnly + 1 +}; + +enum VerbTypes { + kVerbNone, + kVerbWalkTo, + kVerbGive, + kVerbUse, + kVerbEnter, + kVerbLookAt, + kVerbPickUp, + kVerbOpen, + kVerbClose, + kVerbTalkTo, + kVerbWalkOnly, + kVerbLookOnly, + kVerbOptions }; #define STHREAD_TIMESLICE 8 @@ -379,15 +397,16 @@ public: void setRightButtonVerb(int verb); int getRightButtonVerb() const { return _rightButtonVerb; } void setNonPlayfieldVerb() { - setRightButtonVerb(kVerbNone); + setRightButtonVerb(getVerbType(kVerbNone)); _pointerObject = ID_NOTHING; _currentObject[_firstObjectSet ? 1 : 0] = ID_NOTHING; } void setNoPendingVerb() { - _pendingVerb = kVerbNone; + _pendingVerb = getVerbType(kVerbNone); _currentObject[0] = _currentObject[0] = ID_NOTHING; setPointerVerb(); } + int getVerbType(VerbTypes verbType); private: // When reading or writing data to the common buffer, we have to use a diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index fd76bfb46a..d670109f01 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -566,7 +566,7 @@ void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) { _vm->_scene->changeScene(sceneNumber, entrance, (sceneNumber == ITE_SCENE_ENDCREDIT1) ? kTransitionFade : kTransitionNoFade); //TODO: placard stuff - _pendingVerb = kVerbNone; + _pendingVerb = _vm->_script->getVerbType(kVerbNone); _currentObject[0] = _currentObject[1] = ID_NOTHING; showVerb(); } @@ -1108,7 +1108,7 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) { actor->_facingDirection = actor->_actionDirection = actorDirection; if (!actor->_frames) - _vm->_actor->loadActorResources(actor); + _vm->_actor->loadActorResources(actor); //? is not it already loaded ? if (frameType >= 0) { frameRange = _vm->_actor->getActorFrameRange(actorId, frameType); |