MADS: Renamings for saving fields in MADSAction::startAction

This commit is contained in:
Paul Gilbert 2014-04-03 22:02:12 -04:00
parent 83ac948923
commit d163ee088a
12 changed files with 125 additions and 105 deletions

View File

@ -35,28 +35,28 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) {
_selectedAction = 0;
_inProgress = false;
_savedFields._actionMode = KERNEL_TRIGGER_PARSER;
_savedFields._actionMode2 = KERNEL_TRIGGER_PARSER;
_savedFields._selectedRow = -1;
_savedFields._hotspotId = 0;
_savedFields._v86F3A = 0;
_savedFields._v86F42 = 0;
_savedFields._commandSource = 0;
_savedFields._mainObjectSource = 0;
_savedFields._command = -1;
_savedFields._mainObject = 0;
_savedFields._secondObject = 0;
_savedFields._secondObjectSource = 0;
_savedFields._articleNumber = 0;
_savedFields._lookFlag = false;
}
void MADSAction::clear() {
_interAwaiting = AWAITING_COMMAND;
_actionMode = ACTIONMODE_NONE;
_actionMode2 = ACTIONMODE2_0;
_v86F42 = 0;
_commandSource = ACTIONMODE_NONE;
_mainObjectSource = ACTIONMODE2_0;
_secondObjectSource = 0;
_recentCommandSource = 0;
_articleNumber = 0;
_lookFlag = false;
_v86F4A = 0;
_selectedRow = -1;
_hotspotId = -1;
_v86F3A = -1;
_secondObject = -1;
_recentCommand = -1;
_action._verbId = VERB_NONE;
_action._objectNameId = -1;
@ -78,7 +78,7 @@ void MADSAction::checkCustomDest(int v) {
Scene &scene = _vm->_game->_scene;
Player &player = _vm->_game->_player;
if (_v86F4A && (v == -3 || _savedFields._selectedRow < 0)) {
if (_v86F4A && (v == -3 || _savedFields._command < 0)) {
player._needToWalk = true;
player._prepareWalkPos = scene._customDest;
}
@ -94,7 +94,7 @@ void MADSAction::set() {
_action._objectNameId = -1;
_action._indirectObjectId = -1;
if (_actionMode == ACTIONMODE_TALK) {
if (_commandSource == ACTIONMODE_TALK) {
// 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 ((_actionMode == ACTIONMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) {
if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) {
// Use/to action
int invIndex = userInterface._selectedInvIndex;
InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex);
@ -121,7 +121,7 @@ void MADSAction::set() {
} else {
// Handling for if an action has been selected
if (_selectedRow >= 0) {
if (_actionMode == ACTIONMODE_VERB) {
if (_commandSource == ACTIONMODE_VERB) {
// Standard verb action
_action._verbId = scene._verbList[_selectedRow]._id;
} else {
@ -172,7 +172,7 @@ void MADSAction::set() {
}
}
if ((_actionMode2 == ACTIONMODE2_2) || (_actionMode2 == ACTIONMODE2_5)) {
if ((_mainObjectSource == ACTIONMODE2_2) || (_mainObjectSource == ACTIONMODE2_5)) {
// Get name from given inventory object
InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId);
_action._objectNameId = invObject._descId;
@ -189,13 +189,13 @@ void MADSAction::set() {
if ((_hotspotId >= 0) && (_articleNumber > 0) && !flag) {
if (_articleNumber == -1) {
if (_v86F3A >= 0) {
if (_secondObject >= 0) {
int articleNum = 0;
if ((_v86F42 == 2) || (_v86F42 == 5)) {
if ((_secondObjectSource == 2) || (_secondObjectSource == 5)) {
InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId);
articleNum = invObject._article;
} else if (_v86F3A < (int)scene._hotspots.size()) {
} else if (_secondObject < (int)scene._hotspots.size()) {
articleNum = scene._hotspots[_hotspotId]._articleNumber;
} else {
articleNum = scene._hotspots[_hotspotId - scene._hotspots.size()]._articleNumber;
@ -217,7 +217,7 @@ void MADSAction::set() {
}
// Append object description if necessary
if (_v86F3A >= 0)
if (_secondObject >= 0)
appendVocab(_action._indirectObjectId);
// Remove any trailing space character
@ -242,7 +242,8 @@ void MADSAction::refresh() {
}
if (!_statusText.empty()) {
if ((_vm->_game->_screenObjects._v832EC == 0) || (_vm->_game->_screenObjects._v832EC == 2)) {
if ((_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) ||
(_vm->_game->_screenObjects._inputMode == kInputLimitedSentences)) {
Font *font = _vm->_font->getFont(FONT_MAIN);
int textSpacing = -1;
@ -273,14 +274,14 @@ void MADSAction::startAction() {
player.cancelCommand();
_inProgress = true;
_v8453A = KERNEL_TRIGGER_PARSER;
_savedFields._selectedRow = _selectedRow;
_savedFields._hotspotId = _hotspotId;
_savedFields._v86F3A = _v86F3A;
_savedFields._commandError = false;
_savedFields._command = _selectedRow;
_savedFields._mainObject = _hotspotId;
_savedFields._secondObject = _secondObject;
_savedFields._articleNumber = _articleNumber;
_savedFields._actionMode = _actionMode;
_savedFields._actionMode2 = _actionMode2;
_savedFields._v86F42 = _v86F42;
_savedFields._commandSource = _commandSource;
_savedFields._mainObjectSource = _mainObjectSource;
_savedFields._secondObjectSource = _secondObjectSource;
_savedFields._lookFlag = _lookFlag;
_activeAction = _action;
@ -288,17 +289,17 @@ void MADSAction::startAction() {
_activeAction = _action;
_sentence = _statusText;
if ((_actionMode2 == ACTIONMODE2_4) && (_v86F42 == 0))
_v8453A = -1;
if ((_mainObjectSource == ACTIONMODE2_4) && (_secondObjectSource == 0))
_savedFields._commandError = true;
player._needToWalk = false;
int hotspotId = -1;
if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._v832EC != 1)) {
if (_savedFields._actionMode2 == ACTIONMODE2_4)
hotspotId = _savedFields._hotspotId;
else if (_v86F42 == 4)
hotspotId = _savedFields._v86F3A;
if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._inputMode != kInputConversation)) {
if (_savedFields._mainObjectSource == ACTIONMODE2_4)
hotspotId = _savedFields._mainObject;
else if (_secondObjectSource == 4)
hotspotId = _savedFields._secondObject;
if (hotspotId >= (int)hotspots.size()) {
DynamicHotspot &hs = dynHotspots[hotspotId - hotspots.size()];
@ -306,7 +307,7 @@ void MADSAction::startAction() {
checkCustomDest(hs._feetPos.x);
} else if (hs._feetPos.x == 0) {
player._prepareWalkFacing = hs._facing;
} else if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) {
} else if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) {
player._needToWalk = true;
player._prepareWalkPos = hs._feetPos;
}
@ -322,7 +323,7 @@ void MADSAction::startAction() {
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) {
if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) {
player._needToWalk = true;
player._prepareWalkPos = hs._feetPos;
}
@ -353,7 +354,6 @@ bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) {
void MADSAction::checkActionAtMousePos() {
Scene &scene = _vm->_game->_scene;
UserInterface &userInterface = scene._userInterface;
ScreenObjects &screenObjects = _vm->_game->_screenObjects;
if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) &&
_interAwaiting != AWAITING_COMMAND && _pickedWord >= 0) {
@ -377,20 +377,20 @@ void MADSAction::checkActionAtMousePos() {
case CAT_INV_ANIM:
if (_interAwaiting != AWAITING_THAT) {
if (userInterface._selectedActionIndex >= 0) {
_actionMode = ACTIONMODE_VERB;
_commandSource = ACTIONMODE_VERB;
_selectedRow = userInterface._selectedActionIndex;
_flags1 = scene._verbList[_selectedRow]._action1;
_flags2 = scene._verbList[_selectedRow]._action2;
_interAwaiting = AWAITING_THIS;
} else if (userInterface._selectedItemVocabIdx >= 0) {
_actionMode = ACTIONMODE_OBJECT;
_commandSource = ACTIONMODE_OBJECT;
_selectedRow = userInterface._selectedItemVocabIdx;
int objectId = _vm->_game->_objects._inventoryList[_selectedRow];
InventoryObject &invObject = _vm->_game->_objects[objectId];
_flags1 = invObject._vocabList[_selectedRow - 1]._actionFlags1;
_flags2 = invObject._vocabList[_selectedRow - 1]._actionFlags2;
_actionMode2 = ACTIONMODE2_2;
_mainObjectSource = ACTIONMODE2_2;
_hotspotId = userInterface._selectedInvIndex;
_articleNumber = _flags2;
@ -409,7 +409,7 @@ void MADSAction::checkActionAtMousePos() {
_articleNumber = 0;
switch (userInterface._category) {
case CAT_COMMAND:
_actionMode = ACTIONMODE_VERB;
_commandSource = ACTIONMODE_VERB;
_selectedRow = _pickedWord;
if (_selectedRow >= 0) {
_flags1 = scene._verbList[_selectedRow]._action1;
@ -418,11 +418,11 @@ void MADSAction::checkActionAtMousePos() {
break;
case CAT_INV_VOCAB:
_actionMode = ACTIONMODE_OBJECT;
_commandSource = ACTIONMODE_OBJECT;
_selectedRow = _pickedWord;
if (_selectedRow < 0) {
_hotspotId = -1;
_actionMode2 = ACTIONMODE2_0;
_mainObjectSource = ACTIONMODE2_0;
} else {
int objectId = _vm->_game->_objects._inventoryList[_selectedRow];
InventoryObject &invObject = _vm->_game->_objects[objectId];
@ -430,7 +430,7 @@ void MADSAction::checkActionAtMousePos() {
_flags1 = invObject._vocabList[_selectedRow - 2]._actionFlags1;
_flags2 = invObject._vocabList[_selectedRow - 2]._actionFlags2;
_hotspotId = userInterface._selectedInvIndex;
_actionMode2 = ACTIONMODE2_2;
_mainObjectSource = ACTIONMODE2_2;
if (_flags1 == 2)
_articleNumber = _flags2;
@ -439,13 +439,13 @@ void MADSAction::checkActionAtMousePos() {
case CAT_HOTSPOT:
_selectedRow = -1;
_actionMode = ACTIONMODE_NONE;
_actionMode2 = ACTIONMODE2_4;
_commandSource = ACTIONMODE_NONE;
_mainObjectSource = ACTIONMODE2_4;
_hotspotId = _pickedWord;
break;
case CAT_TALK_ENTRY:
_actionMode = ACTIONMODE_TALK;
_commandSource = ACTIONMODE_TALK;
_selectedRow = _pickedWord;
break;
@ -461,7 +461,7 @@ void MADSAction::checkActionAtMousePos() {
case CAT_HOTSPOT:
case CAT_INV_ANIM:
// TODO: We may not need a separate ActionMode2 enum
_actionMode2 = (ActionMode2)userInterface._category;
_mainObjectSource = userInterface._category;
_hotspotId = _pickedWord;
break;
default:
@ -474,8 +474,8 @@ void MADSAction::checkActionAtMousePos() {
case CAT_INV_LIST:
case CAT_HOTSPOT:
case CAT_INV_ANIM:
_v86F42 = userInterface._category;
_v86F3A = _pickedWord;
_secondObjectSource = userInterface._category;
_secondObject = _pickedWord;
break;
default:
break;
@ -490,7 +490,6 @@ void MADSAction::checkActionAtMousePos() {
void MADSAction::leftClick() {
Scene &scene = _vm->_game->_scene;
UserInterface &userInterface = scene._userInterface;
ScreenObjects &screenObjects = _vm->_game->_screenObjects;
bool abortFlag = false;
if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) &&
@ -522,7 +521,7 @@ void MADSAction::leftClick() {
}
else {
_recentCommand = _selectedRow;
_recentCommandSource = _actionMode;
_recentCommandSource = _commandSource;
_interAwaiting = AWAITING_THIS;
}
}
@ -551,7 +550,7 @@ void MADSAction::leftClick() {
}
_recentCommand = _selectedRow;
_recentCommandSource = _actionMode;
_recentCommandSource = _commandSource;
}
break;
@ -606,7 +605,7 @@ void MADSAction::leftClick() {
case CAT_INV_LIST:
case CAT_HOTSPOT:
case CAT_INV_ANIM:
if (_v86F3A >= 0) {
if (_secondObject >= 0) {
_selectedAction = -1;
if (userInterface._category == CAT_HOTSPOT) {

View File

@ -28,8 +28,9 @@
namespace MADS {
enum ActionMode { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = 3, ACTIONMODE_TALK = 6 };
enum ActionMode2 { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 };
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
@ -69,12 +70,13 @@ struct ActionDetails {
};
struct ActionSavedFields {
int _actionMode;
int _selectedRow;
int _hotspotId;
int _v86F3A;
int _actionMode2;
int _v86F42;
bool _commandError;
int _commandSource;
int _command;
int _mainObject;
int _secondObject;
int _mainObjectSource;
int _secondObjectSource;
int _articleNumber;
int _lookFlag;
};
@ -90,8 +92,8 @@ private:
public:
ActionDetails _action, _activeAction;
int8 _flags1, _flags2;
ActionMode _actionMode;
ActionMode2 _actionMode2;
int _commandSource;
int _mainObjectSource;
int _articleNumber;
bool _lookFlag;
int _selectedRow;
@ -103,14 +105,13 @@ public:
Common::String _sentence;
// Unknown fields
int16 _v86F3A;
int16 _v86F42;
int16 _secondObject;
int16 _secondObjectSource;
int16 _recentCommandSource;
bool _v86F4A;
int16 _recentCommand;
InterAwaiting _interAwaiting;
bool _inProgress;
int _v8453A;
int _pickedWord;
public:
@ -120,7 +121,14 @@ public:
void set();
const Common::String &statusText() const { return _statusText; }
void refresh();
/**
* Accepts the currently defined sentence from the ScreenObjects parser.
* Copies the data, and checks to see if the action requires the player
* to walk to the given hotspot.
*/
void startAction();
void checkAction();
bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0);

View File

@ -172,7 +172,7 @@ void Game::sectionLoop() {
// Reset the user interface
_screenObjects._v8333C = true;
_screenObjects._v832EC = 0;
_screenObjects._inputMode = kInputBuildingSentences;
_scene._userInterface._scrollerY = 0;
_player._loadsFirst = true;

View File

@ -131,9 +131,9 @@ void DynamicHotspots::refresh() {
DynamicHotspot &dh = (*this)[i];
if ((*this)[i]._active) {
switch (scrObjects._v832EC) {
case 0:
case 2:
switch (scrObjects._inputMode) {
case kInputBuildingSentences:
case kInputLimitedSentences:
scrObjects.add(dh._bounds, _vm->_game->_scene._layer, CAT_12, dh._descId);
scrObjects._v8333C = true;
break;

View File

@ -116,7 +116,8 @@ void InventoryObjects::addToInventory(int objectId) {
(*this)[objectId]._roomNumber = PLAYER_INVENTORY;
if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) {
if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE &&
_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) {
userInterface.categoryChanged();
userInterface.selectObject(userInterface._selectedInvIndex);
}
@ -137,7 +138,8 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) {
int selectedIndex = userInterface._selectedInvIndex;
bool noSelection = selectedIndex < 0;
if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC)
if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE &&
_vm->_game->_screenObjects._inputMode == kInputBuildingSentences)
userInterface.selectObject(-1);
// Remove the item from the inventory list
@ -158,7 +160,8 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) {
newIndex = 0;
}
if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) {
if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE &&
_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) {
userInterface.categoryChanged();
userInterface.selectObject(newIndex);
}

View File

@ -760,7 +760,7 @@ void Scene202::actions() {
}
_scene->_nextSceneId = 201;
} else if (action->isAction(VERB_TAKE, 0x2C)) {
if (action->_actionMode2 == 4) {
if (action->_mainObjectSource == 4) {
if (_game._trigger == 0) {
if (_game._objects.isInInventory(OBJ_BONES)) {
_vm->_dialogs->show(0x4EFB);
@ -952,7 +952,7 @@ void Scene202::actions() {
} else if (action->isAction(VERB_TAKE, 0x140)) {
_vm->_dialogs->show(0x4EF8);
} else if (action->isAction(VERB_LOOK, 0x2D)) {
if (action->_actionMode == 4)
if (action->_commandSource == 4)
_vm->_dialogs->show(0x4EF9);
else
return;

View File

@ -138,7 +138,7 @@ void Scene804::enter() {
Scene8xx::enter1();
if (_globals[kInSpace] && !_globals[kWindowFixed]) {
_scene->_userInterface.setup(2);
_scene->_userInterface.setup(kInputLimitedSentences);
_vm->_sound->command(19);
}
}

View File

@ -160,7 +160,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
_interfaceY = MADS_SCENE_HEIGHT;
_spritesCount = _sprites.size();
_userInterface.setup(_vm->_game->_screenObjects._v832EC);
_userInterface.setup(_vm->_game->_screenObjects._inputMode);
warning("TODO: showMouse");
@ -299,7 +299,7 @@ void Scene::doFrame() {
_action.startAction();
if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) {
_action._activeAction._verbId = VERB_LOOK;
_action._savedFields._selectedRow = false;
_action._savedFields._command = false;
}
flag = true;
@ -438,7 +438,8 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) {
}
void Scene::doPreactions() {
if (_vm->_game->_screenObjects._v832EC == 0 || _vm->_game->_screenObjects._v832EC == 2) {
if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences ||
_vm->_game->_screenObjects._inputMode == kInputLimitedSentences) {
_vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PREPARE;
_action.checkAction();
_sceneLogic->preActions();
@ -449,37 +450,38 @@ void Scene::doPreactions() {
}
void Scene::doAction() {
int flag = 0;
bool flag = false;
_vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PARSER;
if ((_action._inProgress || _vm->_game->_trigger) && !_action._v8453A) {
if ((_action._inProgress || _vm->_game->_trigger) && !_action._savedFields._commandError) {
_sceneLogic->actions();
_action._inProgress = true;
flag = -1;
flag = true;
}
if (_vm->_game->_screenObjects._v832EC == 1) {
if (_vm->_game->_screenObjects._inputMode == kInputConversation) {
_action._inProgress = false;
} else {
if ((_action._inProgress || _vm->_game->_trigger) ||
(!flag && _action._v8453A == flag)) {
(!flag && _action._savedFields._commandError == flag)) {
_vm->_game->_sectionHandler->sectionPtr2();
_action._inProgress = true;
flag = -1;
flag = true;
}
if ((_action._inProgress || _vm->_game->_trigger) && (!flag || _action._v8453A == flag)) {
if ((_action._inProgress || _vm->_game->_trigger) &&
(!flag || _action._savedFields._commandError == flag)) {
_vm->_game->doObjectAction();
}
if (!_action._savedFields._lookFlag) {
if (!_action._inProgress) {
_action._v8453A = -1;
_action._savedFields._commandError = true;
_sceneLogic->postActions();
}
if (!_action._inProgress) {
_action._v8453A = -1;
_action._savedFields._commandError = true;
warning("TODO: PtrUnk4");
}

View File

@ -253,7 +253,7 @@ ScreenObject::ScreenObject() {
ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) {
_objectY = -1;
_v8333C = false;
_v832EC = 0;
_inputMode = kInputBuildingSentences;
_v7FED6 = 0;
_v8332A = 0;
_category = CAT_NONE;
@ -285,7 +285,7 @@ void ScreenObjects::check(bool scanFlag) {
Scene &scene = _vm->_game->_scene;
UserInterface &userInterface = scene._userInterface;
if (!_vm->_events->_mouseButtons || _v832EC)
if (!_vm->_events->_mouseButtons || _inputMode != kInputBuildingSentences)
_vm->_events->_anyStroke = false;
if ((_vm->_events->_mouseMoved || _vm->_game->_scene._userInterface._scrollerY
@ -380,7 +380,7 @@ void ScreenObjects::checkScroller() {
UserInterface &userInterface = _vm->_game->_scene._userInterface;
Common::Array<int> &inventoryList = _vm->_game->_objects._inventoryList;
if (_v832EC)
if (_inputMode != kInputBuildingSentences)
return;
userInterface._scrollerY = 0;

View File

@ -55,6 +55,12 @@ enum ScreenTransition {
kVertTransition7, kCenterVertTransition
};
enum InputMode {
kInputBuildingSentences = 0, // Normal sentence building
kInputConversation = 1, // Conversation mode
kInputLimitedSentences = 2 // Use only scene hotspots
};
class SpriteSlot;
class TextDisplay;
class UISlot;
@ -148,7 +154,7 @@ private:
*/
void checkScroller();
public:
int _v832EC;
InputMode _inputMode;
int _v7FED6;
int _v8332A;
int _v8333C;

View File

@ -239,10 +239,10 @@ void UserInterface::load(const Common::String &resName) {
delete pixelsStream;
}
void UserInterface::setup(int id) {
void UserInterface::setup(InputMode inputMode) {
Scene &scene = _vm->_game->_scene;
if (_vm->_game->_screenObjects._v832EC != id) {
if (_vm->_game->_screenObjects._inputMode != inputMode) {
Common::String resName = _vm->_game->_aaName;
// Strip off any extension
@ -252,7 +252,7 @@ void UserInterface::setup(int id) {
}
// Add on suffix if necessary
if (id)
if (inputMode != kInputBuildingSentences)
resName += "A";
resName += ".INT";
@ -260,7 +260,7 @@ void UserInterface::setup(int id) {
load(resName);
_surface.copyTo(this);
}
_vm->_game->_screenObjects._v832EC = id;
_vm->_game->_screenObjects._inputMode = inputMode;
scene._userInterface._uiSlots.clear();
scene._userInterface._uiSlots.fullRefresh();
@ -279,7 +279,7 @@ void UserInterface::setup(int id) {
}
void UserInterface::drawTextElements() {
if (_vm->_game->_screenObjects._v832EC) {
if (_vm->_game->_screenObjects._inputMode) {
drawTalkList();
} else {
// Draw the actions
@ -408,7 +408,7 @@ void UserInterface::loadElements() {
Common::Rect bounds;
_vm->_game->_screenObjects.clear();
if (!_vm->_game->_screenObjects._v832EC) {
if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) {
// Set up screen objects for the inventory scroller
for (int idx = 1; idx <= 3; ++idx) {
getBounds(CAT_INV_SCROLLER, idx, bounds);
@ -450,7 +450,8 @@ void UserInterface::loadElements() {
CAT_INV_ANIM, 0);
}
if (!_vm->_game->_screenObjects._v832EC || _vm->_game->_screenObjects._v832EC == 2) {
if (!_vm->_game->_screenObjects._inputMode == kInputBuildingSentences ||
_vm->_game->_screenObjects._inputMode == kInputLimitedSentences) {
_categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1;
for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) {
Hotspot &hs = scene._hotspots[hotspotIdx];
@ -458,7 +459,7 @@ void UserInterface::loadElements() {
}
}
if (_vm->_game->_screenObjects._v832EC == 1) {
if (_vm->_game->_screenObjects._inputMode == kInputConversation) {
// setup areas for talk entries
_categoryIndexes[CAT_TALK_ENTRY - 1] = _vm->_game->_screenObjects.size() + 1;
for (int idx = 0; idx < 5; ++idx) {
@ -594,7 +595,7 @@ void UserInterface::noInventoryAnim() {
_invSpritesIndex = -1;
}
if (!_vm->_game->_screenObjects._v832EC)
if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences)
refresh();
}
@ -608,8 +609,9 @@ void UserInterface::refresh() {
void UserInterface::inventoryAnim() {
Scene &scene = _vm->_game->_scene;
if (_vm->_game->_screenObjects._v832EC == 1 || _vm->_game->_screenObjects._v832EC == 2
|| _invSpritesIndex < 0)
if (_vm->_game->_screenObjects._inputMode == kInputConversation ||
_vm->_game->_screenObjects._inputMode == kInputLimitedSentences ||
_invSpritesIndex < 0)
return;
// Move to the next frame number in the sequence, resetting if at the end

View File

@ -166,7 +166,7 @@ public:
/**
* Set up the interface
*/
void setup(int id);
void setup(InputMode inputMode);
void drawTextElements();