From e144e9810f7aad29575b98faad9fcc64a82d785d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Apr 2014 23:25:11 -0400 Subject: MADS: Dropped old ActionMode enums in favour of ScrCategory --- engines/mads/action.cpp | 48 +++++++++++++++++++++++----------------------- engines/mads/action.h | 22 +++++++++++---------- engines/mads/screen.h | 7 +------ engines/mads/staticres.cpp | 1 - engines/mads/staticres.h | 1 - 5 files changed, 37 insertions(+), 42 deletions(-) (limited to 'engines') diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 8cbc404652..b646ca5f2b 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -47,10 +47,10 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { void MADSAction::clear() { _interAwaiting = AWAITING_COMMAND; - _commandSource = ACTIONMODE_NONE; - _mainObjectSource = ACTIONMODE2_0; - _secondObjectSource = 0; - _recentCommandSource = 0; + _commandSource = CAT_NONE; + _mainObjectSource = CAT_NONE; + _secondObjectSource = CAT_NONE; + _recentCommandSource = CAT_NONE; _articleNumber = 0; _lookFlag = false; _pointEstablished = 0; @@ -94,7 +94,7 @@ void MADSAction::set() { _action._objectNameId = -1; _action._indirectObjectId = -1; - if (_commandSource == ACTIONMODE_TALK) { + if (_commandSource == CAT_TALK_ENTRY) { // Handle showing the conversation selection. Rex at least doesn't actually seem to use this if (_selectedRow >= 0) { Common::String desc = userInterface._talkStrings[userInterface._talkIds[_selectedRow]]; @@ -105,7 +105,7 @@ void MADSAction::set() { // Two 'look' actions in succession, so the action becomes 'Look around' _statusText = kLookAroundStr; } else { - if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0) + if ((_commandSource == CAT_INV_VOCAB) && (_selectedRow >= 0) && (_verbType == VERB_THAT) && (_prepType == PREP_NONE)) { // Use/to action int invIndex = userInterface._selectedInvIndex; @@ -122,7 +122,7 @@ void MADSAction::set() { } else { // Handling for if an action has been selected if (_selectedRow >= 0) { - if (_commandSource == ACTIONMODE_VERB) { + if (_commandSource == CAT_COMMAND) { // Standard verb action _action._verbId = scene._verbList[_selectedRow]._id; } else { @@ -137,7 +137,7 @@ void MADSAction::set() { if (_action._verbId == VERB_LOOK) { // Add in the word 'add' - _statusText += kAtStr; + _statusText += kArticleList[PREP_AT]; _statusText += " "; } } @@ -173,7 +173,7 @@ void MADSAction::set() { } } - if ((_mainObjectSource == ACTIONMODE2_2) || (_mainObjectSource == ACTIONMODE2_5)) { + if ((_mainObjectSource == CAT_INV_LIST) || (_mainObjectSource == CAT_INV_ANIM)) { // Get name from given inventory object InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); _action._objectNameId = invObject._descId; @@ -290,14 +290,14 @@ void MADSAction::startAction() { _activeAction = _action; _sentence = _statusText; - if ((_mainObjectSource == ACTIONMODE2_4) && (_secondObjectSource == 4)) + if ((_mainObjectSource == CAT_HOTSPOT) && (_secondObjectSource == 4)) _savedFields._commandError = true; player._needToWalk = false; int hotspotId = -1; if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._inputMode != kInputConversation)) { - if (_savedFields._mainObjectSource == ACTIONMODE2_4) + if (_savedFields._mainObjectSource == CAT_HOTSPOT) hotspotId = _savedFields._mainObject; else if (_secondObjectSource == 4) hotspotId = _savedFields._secondObject; @@ -308,7 +308,7 @@ void MADSAction::startAction() { startWalkingDirectly(hs._feetPos.x); } else if (hs._feetPos.x == 0) { player._prepareWalkFacing = hs._facing; - } else if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { + } else if (_savedFields._commandSource == CAT_NONE || hs._cursor >= CURSOR_WAIT) { player._needToWalk = true; player._prepareWalkPos = hs._feetPos; } @@ -324,7 +324,7 @@ void MADSAction::startAction() { if (hs._feetPos.x == -1 || hs._feetPos.x == -3) { startWalkingDirectly(hs._feetPos.x); } else if (hs._feetPos.x >= 0) { - if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { + if (_savedFields._commandSource == CAT_NONE || hs._cursor < CURSOR_WAIT) { player._needToWalk = true; player._prepareWalkPos = hs._feetPos; } @@ -378,20 +378,20 @@ void MADSAction::checkActionAtMousePos() { case CAT_INV_ANIM: if (_interAwaiting != AWAITING_THAT) { if (userInterface._selectedActionIndex >= 0) { - _commandSource = ACTIONMODE_VERB; + _commandSource = CAT_COMMAND; _selectedRow = userInterface._selectedActionIndex; _verbType = scene._verbList[_selectedRow]._verbType; _prepType = scene._verbList[_selectedRow]._prepType; _interAwaiting = AWAITING_THIS; } else if (userInterface._selectedItemVocabIdx >= 0) { - _commandSource = ACTIONMODE_OBJECT; + _commandSource = CAT_INV_VOCAB; _selectedRow = userInterface._selectedItemVocabIdx; int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; _verbType = invObject._vocabList[_selectedRow - 1]._verbType; _prepType = invObject._vocabList[_selectedRow - 1]._prepType; - _mainObjectSource = ACTIONMODE2_2; + _mainObjectSource = CAT_INV_LIST; _hotspotId = userInterface._selectedInvIndex; _articleNumber = _prepType; @@ -411,7 +411,7 @@ void MADSAction::checkActionAtMousePos() { _articleNumber = 0; switch (userInterface._category) { case CAT_COMMAND: - _commandSource = ACTIONMODE_VERB; + _commandSource = CAT_COMMAND; _selectedRow = _pickedWord; if (_selectedRow >= 0) { _verbType = scene._verbList[_selectedRow]._verbType; @@ -420,11 +420,11 @@ void MADSAction::checkActionAtMousePos() { break; case CAT_INV_VOCAB: - _commandSource = ACTIONMODE_OBJECT; + _commandSource = CAT_INV_VOCAB; _selectedRow = _pickedWord; if (_selectedRow < 0) { _hotspotId = -1; - _mainObjectSource = ACTIONMODE2_0; + _mainObjectSource = CAT_NONE; } else { int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; @@ -432,7 +432,7 @@ void MADSAction::checkActionAtMousePos() { _verbType = invObject._vocabList[_selectedRow - 2]._verbType; _prepType = invObject._vocabList[_selectedRow - 2]._prepType; _hotspotId = userInterface._selectedInvIndex; - _mainObjectSource = ACTIONMODE2_2; + _mainObjectSource = CAT_INV_LIST; if (_verbType == VERB_THAT) _articleNumber = _prepType; @@ -441,13 +441,13 @@ void MADSAction::checkActionAtMousePos() { case CAT_HOTSPOT: _selectedRow = -1; - _commandSource = ACTIONMODE_NONE; - _mainObjectSource = ACTIONMODE2_4; + _commandSource = CAT_NONE; + _mainObjectSource = CAT_HOTSPOT; _hotspotId = _pickedWord; break; case CAT_TALK_ENTRY: - _commandSource = ACTIONMODE_TALK; + _commandSource = CAT_TALK_ENTRY; _selectedRow = _pickedWord; break; @@ -556,7 +556,7 @@ void MADSAction::leftClick() { case CAT_HOTSPOT: _recentCommand = -1; - _recentCommandSource = 0; + _recentCommandSource = CAT_NONE; if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; diff --git a/engines/mads/action.h b/engines/mads/action.h index 3b238c997f..6b3f1ca3c2 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -28,9 +28,6 @@ namespace MADS { -enum { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = 3, ACTIONMODE_TALK = 6 }; -enum { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; - enum TriggerMode { KERNEL_TRIGGER_PARSER = 0, // Triggers parser KERNEL_TRIGGER_DAEMON = 1, // Triggers step/daemon code @@ -67,6 +64,12 @@ enum PrepType { PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = -1 }; +enum ScrCategory { + CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, + CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, + CAT_12 = 12 +}; + class MADSEngine; struct ActionDetails { @@ -97,10 +100,6 @@ private: void startWalkingDirectly(int walkType); public: ActionDetails _action, _activeAction; - VerbType _verbType; - PrepType _prepType; - int _commandSource; - int _mainObjectSource; int _articleNumber; bool _lookFlag; int _selectedRow; @@ -111,10 +110,13 @@ public: ActionSavedFields _savedFields; Common::String _sentence; - // Unknown fields + VerbType _verbType; + PrepType _prepType; + ScrCategory _commandSource; + ScrCategory _mainObjectSource; int16 _secondObject; - int16 _secondObjectSource; - int16 _recentCommandSource; + ScrCategory _secondObjectSource; + ScrCategory _recentCommandSource; bool _pointEstablished; int16 _recentCommand; InterAwaiting _interAwaiting; diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 57b53df895..11b81346f1 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -26,18 +26,13 @@ #include "common/scummsys.h" #include "common/array.h" #include "mads/msurface.h" +#include "mads/action.h" namespace MADS { #define MADS_SCREEN_WIDTH 320 #define MADS_SCREEN_HEIGHT 200 -enum ScrCategory { - CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, - CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, - CAT_12 = 12 -}; - enum Layer { LAYER_GUI = 19 }; diff --git a/engines/mads/staticres.cpp b/engines/mads/staticres.cpp index 92d2740e2f..396e5a13d2 100644 --- a/engines/mads/staticres.cpp +++ b/engines/mads/staticres.cpp @@ -35,7 +35,6 @@ const char *const kCheatingEnabledDesc[3] = { nullptr }; -const char *const kAtStr = "at"; const char *const kLookAroundStr = "Look around"; const char *const kToStr = "to "; const char *const kUseStr = "Use "; diff --git a/engines/mads/staticres.h b/engines/mads/staticres.h index b4132c8319..0680455028 100644 --- a/engines/mads/staticres.h +++ b/engines/mads/staticres.h @@ -29,7 +29,6 @@ extern const char *const kArticleList[9]; extern const char *const kCheatingEnabledDesc[3]; -extern const char *const kAtStr; extern const char *const kLookAroundStr; extern const char *const kToStr; extern const char *const kUseStr; -- cgit v1.2.3