2014-03-03 00:29:54 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
2014-03-03 01:06:21 +00:00
|
|
|
#include "mads/mads.h"
|
2014-03-03 00:29:54 +00:00
|
|
|
#include "mads/action.h"
|
2014-03-20 12:34:56 +00:00
|
|
|
#include "mads/inventory.h"
|
2014-05-02 02:36:36 +00:00
|
|
|
#include "mads/resources.h"
|
2014-03-03 00:29:54 +00:00
|
|
|
#include "mads/scene.h"
|
2014-03-20 12:34:56 +00:00
|
|
|
#include "mads/staticres.h"
|
2014-03-03 00:29:54 +00:00
|
|
|
|
|
|
|
namespace MADS {
|
|
|
|
|
2014-04-23 03:00:41 +00:00
|
|
|
void ActionDetails::synchronize(Common::Serializer &s) {
|
|
|
|
s.syncAsUint16LE(_verbId);
|
|
|
|
s.syncAsUint16LE(_objectNameId);
|
|
|
|
s.syncAsUint16LE(_indirectObjectId);
|
|
|
|
}
|
|
|
|
|
2014-05-02 02:36:36 +00:00
|
|
|
void ActionSavedFields::synchronize(Common::Serializer &s) {
|
|
|
|
s.syncAsByte(_commandError);
|
|
|
|
s.syncAsSint16LE(_commandSource);
|
|
|
|
s.syncAsSint16LE(_command);
|
|
|
|
s.syncAsSint16LE(_mainObject);
|
|
|
|
s.syncAsSint16LE(_secondObject);
|
|
|
|
s.syncAsSint16LE(_mainObjectSource);
|
|
|
|
s.syncAsSint16LE(_secondObjectSource);
|
|
|
|
s.syncAsSint16LE(_articleNumber);
|
|
|
|
s.syncAsSint16LE(_lookFlag);
|
|
|
|
}
|
|
|
|
|
2014-04-23 03:00:41 +00:00
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
|
2014-03-03 01:06:21 +00:00
|
|
|
MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) {
|
2014-03-03 00:29:54 +00:00
|
|
|
clear();
|
|
|
|
_statusTextIndex = -1;
|
|
|
|
_selectedAction = 0;
|
|
|
|
_inProgress = false;
|
2014-05-26 22:06:51 +00:00
|
|
|
_pickedWord = -1;
|
2014-03-23 22:48:00 +00:00
|
|
|
|
2014-06-04 01:33:08 +00:00
|
|
|
_savedFields._commandSource = CAT_NONE;
|
|
|
|
_savedFields._mainObjectSource = CAT_NONE;
|
2014-04-04 02:02:12 +00:00
|
|
|
_savedFields._command = -1;
|
|
|
|
_savedFields._mainObject = 0;
|
|
|
|
_savedFields._secondObject = 0;
|
2014-06-04 01:33:08 +00:00
|
|
|
_savedFields._secondObjectSource = CAT_NONE;
|
2014-05-04 12:34:10 +00:00
|
|
|
_savedFields._articleNumber = PREP_NONE;
|
2014-03-23 22:48:00 +00:00
|
|
|
_savedFields._lookFlag = false;
|
2014-05-26 22:01:59 +00:00
|
|
|
|
|
|
|
_activeAction._verbId = VERB_NONE;
|
|
|
|
_activeAction._objectNameId = -1;
|
|
|
|
_activeAction._indirectObjectId = -1;
|
|
|
|
_savedFields._commandError = false;
|
|
|
|
_verbType = VERB_INIT;
|
|
|
|
_prepType = PREP_NONE;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-03-03 01:06:21 +00:00
|
|
|
void MADSAction::clear() {
|
2014-03-28 02:38:28 +00:00
|
|
|
_interAwaiting = AWAITING_COMMAND;
|
2014-04-09 03:25:11 +00:00
|
|
|
_commandSource = CAT_NONE;
|
|
|
|
_mainObjectSource = CAT_NONE;
|
|
|
|
_secondObjectSource = CAT_NONE;
|
|
|
|
_recentCommandSource = CAT_NONE;
|
2014-03-03 00:29:54 +00:00
|
|
|
_articleNumber = 0;
|
|
|
|
_lookFlag = false;
|
2014-04-06 01:01:41 +00:00
|
|
|
_pointEstablished = 0;
|
2014-05-11 23:56:31 +00:00
|
|
|
_statusText.clear();
|
2014-03-03 00:29:54 +00:00
|
|
|
_selectedRow = -1;
|
|
|
|
_hotspotId = -1;
|
2014-04-04 02:02:12 +00:00
|
|
|
_secondObject = -1;
|
2014-04-03 02:27:11 +00:00
|
|
|
_recentCommand = -1;
|
2014-03-29 21:47:21 +00:00
|
|
|
_action._verbId = VERB_NONE;
|
2014-03-03 05:42:41 +00:00
|
|
|
_action._objectNameId = -1;
|
|
|
|
_action._indirectObjectId = -1;
|
2014-03-03 00:29:54 +00:00
|
|
|
_textChanged = true;
|
|
|
|
}
|
|
|
|
|
2014-05-19 18:53:40 +00:00
|
|
|
void MADSAction::appendVocab(int vocabId, bool capitalize) {
|
2014-03-20 12:34:56 +00:00
|
|
|
Common::String vocabStr = _vm->_game->_scene.getVocab(vocabId);
|
2014-05-19 18:53:40 +00:00
|
|
|
if (capitalize)
|
2014-03-20 12:34:56 +00:00
|
|
|
vocabStr.setChar(toupper(vocabStr[0]), 0);
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += vocabStr;
|
|
|
|
_statusText += " ";
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-04-06 01:01:41 +00:00
|
|
|
void MADSAction::startWalkingDirectly(int walkType) {
|
2014-03-23 21:31:33 +00:00
|
|
|
Scene &scene = _vm->_game->_scene;
|
2014-03-29 03:07:22 +00:00
|
|
|
Player &player = _vm->_game->_player;
|
2014-03-23 21:31:33 +00:00
|
|
|
|
2014-04-06 01:01:41 +00:00
|
|
|
if (_pointEstablished && (walkType == -3 || _savedFields._command < 0)) {
|
2014-03-29 17:38:52 +00:00
|
|
|
player._needToWalk = true;
|
2014-03-29 03:07:22 +00:00
|
|
|
player._prepareWalkPos = scene._customDest;
|
2014-03-23 21:31:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-03 01:06:21 +00:00
|
|
|
void MADSAction::set() {
|
2014-03-20 12:34:56 +00:00
|
|
|
Scene &scene = _vm->_game->_scene;
|
|
|
|
UserInterface &userInterface = scene._userInterface;
|
|
|
|
_statusText = "";
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-03-29 21:47:21 +00:00
|
|
|
_action._verbId = VERB_NONE;
|
2014-03-20 12:34:56 +00:00
|
|
|
_action._objectNameId = -1;
|
|
|
|
_action._indirectObjectId = -1;
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-04-09 03:25:11 +00:00
|
|
|
if (_commandSource == CAT_TALK_ENTRY) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Handle showing the conversation selection. Rex at least doesn't actually seem to use this
|
|
|
|
if (_selectedRow >= 0) {
|
2014-04-21 01:32:29 +00:00
|
|
|
_action._verbId = userInterface._talkIds[_selectedRow];
|
|
|
|
Common::String desc = userInterface._talkStrings[_selectedRow];
|
2014-03-20 12:34:56 +00:00
|
|
|
if (!desc.empty())
|
|
|
|
_statusText = desc;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
} else if (_lookFlag && (_selectedRow == 0)) {
|
|
|
|
// Two 'look' actions in succession, so the action becomes 'Look around'
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText = kLookAroundStr;
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
2014-05-19 18:53:40 +00:00
|
|
|
bool flag = false;
|
2014-05-08 08:43:23 +00:00
|
|
|
if ((_commandSource == CAT_INV_VOCAB) && (_selectedRow >= 0)
|
2014-04-09 03:01:46 +00:00
|
|
|
&& (_verbType == VERB_THAT) && (_prepType == PREP_NONE)) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Use/to action
|
2014-03-20 12:34:56 +00:00
|
|
|
int invIndex = userInterface._selectedInvIndex;
|
|
|
|
InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex);
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
_action._objectNameId = objEntry._descId;
|
|
|
|
_action._verbId = objEntry._vocabList[_selectedRow]._vocabId;
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-05-19 18:53:40 +00:00
|
|
|
// Set up the status text string
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText = kUseStr;
|
|
|
|
appendVocab(_action._objectNameId);
|
|
|
|
_statusText += kToStr;
|
|
|
|
appendVocab(_action._verbId);
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
|
|
|
// Handling for if an action has been selected
|
|
|
|
if (_selectedRow >= 0) {
|
2014-04-09 03:25:11 +00:00
|
|
|
if (_commandSource == CAT_COMMAND) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Standard verb action
|
2014-03-27 02:22:50 +00:00
|
|
|
_action._verbId = scene._verbList[_selectedRow]._id;
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
|
|
|
// Selected action on an inventory object
|
2014-03-20 12:34:56 +00:00
|
|
|
int invIndex = userInterface._selectedInvIndex;
|
|
|
|
InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex);
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-03-27 02:22:50 +00:00
|
|
|
_action._verbId = objEntry._vocabList[_selectedRow]._vocabId;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
appendVocab(_action._verbId, true);
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-03-27 02:22:50 +00:00
|
|
|
if (_action._verbId == VERB_LOOK) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Add in the word 'add'
|
2014-04-09 03:25:11 +00:00
|
|
|
_statusText += kArticleList[PREP_AT];
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += " ";
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-01 01:28:49 +00:00
|
|
|
// Add in any necessary article if necessary
|
2014-04-09 03:01:46 +00:00
|
|
|
if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_verbType == VERB_THAT)) {
|
2014-03-03 00:29:54 +00:00
|
|
|
flag = true;
|
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += kArticleList[_articleNumber];
|
|
|
|
_statusText += " ";
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-05-01 01:28:49 +00:00
|
|
|
// Handling for hotspot
|
2014-03-03 00:29:54 +00:00
|
|
|
if (_hotspotId >= 0) {
|
|
|
|
if (_selectedRow < 0) {
|
|
|
|
int verbId;
|
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
if (_hotspotId < (int)scene._hotspots.size()) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Get the verb Id from the hotspot
|
2014-03-20 12:34:56 +00:00
|
|
|
verbId = scene._hotspots[_hotspotId]._verbId;
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
|
|
|
// Get the verb Id from the scene object
|
2014-06-01 18:43:26 +00:00
|
|
|
verbId = scene._dynamicHotspots.get(_hotspotId - scene._hotspots.size())._verbId;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (verbId > 0) {
|
|
|
|
// Set the specified action
|
2014-03-27 02:22:50 +00:00
|
|
|
_action._verbId = verbId;
|
|
|
|
appendVocab(_action._verbId, true);
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
|
|
|
// Default to a standard 'walk to'
|
2014-03-27 02:22:50 +00:00
|
|
|
_action._verbId = VERB_WALKTO;
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += kWalkToStr;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-09 03:25:11 +00:00
|
|
|
if ((_mainObjectSource == CAT_INV_LIST) || (_mainObjectSource == CAT_INV_ANIM)) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Get name from given inventory object
|
2014-03-20 12:34:56 +00:00
|
|
|
InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId);
|
|
|
|
_action._objectNameId = invObject._descId;
|
|
|
|
} else if (_hotspotId < (int)scene._hotspots.size()) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Get name from scene hotspot
|
2014-03-20 12:34:56 +00:00
|
|
|
_action._objectNameId = scene._hotspots[_hotspotId]._vocabId;
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
|
|
|
// Get name from temporary scene hotspot
|
2014-06-01 18:43:26 +00:00
|
|
|
_action._objectNameId = scene._dynamicHotspots.get(_hotspotId - scene._hotspots.size())._descId;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
2014-03-20 12:34:56 +00:00
|
|
|
appendVocab(_action._objectNameId);
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-01 01:28:49 +00:00
|
|
|
if (_secondObject >= 0) {
|
|
|
|
if (_secondObjectSource == CAT_INV_LIST || _secondObjectSource == CAT_INV_ANIM) {
|
2014-05-01 01:43:16 +00:00
|
|
|
InventoryObject &invObject = _vm->_game->_objects.getItem(_secondObject);
|
2014-05-01 01:28:49 +00:00
|
|
|
_action._indirectObjectId = invObject._descId;
|
|
|
|
} else if (_secondObject < (int)scene._hotspots.size()) {
|
2014-05-01 01:43:16 +00:00
|
|
|
_action._indirectObjectId = scene._hotspots[_secondObject]._vocabId;
|
2014-05-01 01:28:49 +00:00
|
|
|
} else {
|
2014-06-01 18:43:26 +00:00
|
|
|
_action._indirectObjectId = scene._dynamicHotspots.get(_secondObject - scene._hotspots.size())._descId;
|
2014-05-01 01:28:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-03 00:29:54 +00:00
|
|
|
if ((_hotspotId >= 0) && (_articleNumber > 0) && !flag) {
|
2014-05-04 12:34:10 +00:00
|
|
|
if (_articleNumber == PREP_RELATIONAL) {
|
2014-04-04 02:02:12 +00:00
|
|
|
if (_secondObject >= 0) {
|
2014-03-03 00:29:54 +00:00
|
|
|
int articleNum = 0;
|
|
|
|
|
2014-04-04 02:02:12 +00:00
|
|
|
if ((_secondObjectSource == 2) || (_secondObjectSource == 5)) {
|
2014-06-01 22:21:29 +00:00
|
|
|
InventoryObject &invObject = _vm->_game->_objects.getItem(_secondObject);
|
2014-03-20 12:34:56 +00:00
|
|
|
articleNum = invObject._article;
|
2014-06-01 22:21:29 +00:00
|
|
|
} else if (_secondObject < (int)scene._hotspots.size()) {
|
|
|
|
articleNum = scene._hotspots[_secondObject]._articleNumber;
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
2014-06-01 22:21:29 +00:00
|
|
|
articleNum = scene._dynamicHotspots.get(_secondObject - scene._hotspots.size())._articleNumber;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += kArticleList[articleNum];
|
|
|
|
}
|
2014-06-02 00:37:21 +00:00
|
|
|
} else if ((_articleNumber != VERB_LOOK) || (_vm->getGameID() != GType_RexNebular) ||
|
|
|
|
(_action._indirectObjectId >= 0 && scene.getVocab(_action._indirectObjectId) != kFenceStr)) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Write out the article
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += kArticleList[_articleNumber];
|
2014-03-03 00:29:54 +00:00
|
|
|
} else {
|
|
|
|
// Special case for a 'fence' entry in Rex Nebular
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += kOverStr;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusText += " ";
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Append object description if necessary
|
2014-04-04 02:02:12 +00:00
|
|
|
if (_secondObject >= 0)
|
2014-03-20 12:34:56 +00:00
|
|
|
appendVocab(_action._indirectObjectId);
|
2014-03-03 00:29:54 +00:00
|
|
|
|
|
|
|
// Remove any trailing space character
|
2014-03-20 12:34:56 +00:00
|
|
|
if (_statusText.hasSuffix(" "))
|
|
|
|
_statusText.deleteLastChar();
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_textChanged = true;
|
|
|
|
}
|
|
|
|
|
2014-03-03 01:06:21 +00:00
|
|
|
void MADSAction::refresh() {
|
2014-03-20 12:34:56 +00:00
|
|
|
Scene &scene = _vm->_game->_scene;
|
|
|
|
|
2014-03-03 00:29:54 +00:00
|
|
|
// Exit immediately if nothing has changed
|
|
|
|
if (!_textChanged)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Remove any old copy of the status text
|
|
|
|
if (_statusTextIndex >= 0) {
|
2014-03-20 12:34:56 +00:00
|
|
|
scene._textDisplay.expire(_statusTextIndex);
|
2014-03-03 00:29:54 +00:00
|
|
|
_statusTextIndex = -1;
|
|
|
|
}
|
|
|
|
|
2014-03-20 12:34:56 +00:00
|
|
|
if (!_statusText.empty()) {
|
2014-05-08 08:43:23 +00:00
|
|
|
if ((_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) ||
|
2014-04-04 02:02:12 +00:00
|
|
|
(_vm->_game->_screenObjects._inputMode == kInputLimitedSentences)) {
|
2014-03-20 12:34:56 +00:00
|
|
|
Font *font = _vm->_font->getFont(FONT_MAIN);
|
2014-03-03 00:29:54 +00:00
|
|
|
int textSpacing = -1;
|
|
|
|
|
|
|
|
int strWidth = font->getWidth(_statusText);
|
2014-03-20 12:34:56 +00:00
|
|
|
if (strWidth > MADS_SCREEN_WIDTH) {
|
2014-03-03 00:29:54 +00:00
|
|
|
// Too large to fit, so fall back on interface font
|
2014-03-20 12:34:56 +00:00
|
|
|
font = _vm->_font->getFont(FONT_INTERFACE);
|
2014-03-03 00:29:54 +00:00
|
|
|
strWidth = font->getWidth(_statusText, 0);
|
|
|
|
textSpacing = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add a new text display entry to display the status text at the bottom of the screen area
|
2014-03-20 12:34:56 +00:00
|
|
|
_statusTextIndex = scene._textDisplay.add(160 - (strWidth / 2),
|
|
|
|
MADS_SCENE_HEIGHT + scene._posAdjust.y - 13, 3, textSpacing, _statusText, font);
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_textChanged = false;
|
|
|
|
}
|
|
|
|
|
2014-03-03 01:06:21 +00:00
|
|
|
void MADSAction::startAction() {
|
2014-03-23 21:31:33 +00:00
|
|
|
Game &game = *_vm->_game;
|
2014-03-29 03:07:22 +00:00
|
|
|
Player &player = game._player;
|
2014-03-23 21:31:33 +00:00
|
|
|
Scene &scene = _vm->_game->_scene;
|
|
|
|
DynamicHotspots &dynHotspots = scene._dynamicHotspots;
|
|
|
|
Hotspots &hotspots = scene._hotspots;
|
|
|
|
|
2014-03-29 03:07:22 +00:00
|
|
|
player.cancelCommand();
|
2014-03-03 00:29:54 +00:00
|
|
|
|
|
|
|
_inProgress = true;
|
2014-04-04 02:02:12 +00:00
|
|
|
_savedFields._commandError = false;
|
|
|
|
_savedFields._command = _selectedRow;
|
|
|
|
_savedFields._mainObject = _hotspotId;
|
|
|
|
_savedFields._secondObject = _secondObject;
|
2014-03-23 21:31:33 +00:00
|
|
|
_savedFields._articleNumber = _articleNumber;
|
2014-04-04 02:02:12 +00:00
|
|
|
_savedFields._commandSource = _commandSource;
|
|
|
|
_savedFields._mainObjectSource = _mainObjectSource;
|
|
|
|
_savedFields._secondObjectSource = _secondObjectSource;
|
2014-03-23 21:31:33 +00:00
|
|
|
_savedFields._lookFlag = _lookFlag;
|
|
|
|
_activeAction = _action;
|
2014-03-03 00:29:54 +00:00
|
|
|
|
|
|
|
// Copy the action to be active
|
|
|
|
_activeAction = _action;
|
2014-03-31 01:10:07 +00:00
|
|
|
_sentence = _statusText;
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-04-09 03:25:11 +00:00
|
|
|
if ((_mainObjectSource == CAT_HOTSPOT) && (_secondObjectSource == 4))
|
2014-04-04 02:02:12 +00:00
|
|
|
_savedFields._commandError = true;
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-03-29 03:07:22 +00:00
|
|
|
player._needToWalk = false;
|
2014-03-03 00:29:54 +00:00
|
|
|
int hotspotId = -1;
|
|
|
|
|
2014-04-04 02:02:12 +00:00
|
|
|
if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._inputMode != kInputConversation)) {
|
2014-04-09 03:25:11 +00:00
|
|
|
if (_savedFields._mainObjectSource == CAT_HOTSPOT)
|
2014-04-04 02:02:12 +00:00
|
|
|
hotspotId = _savedFields._mainObject;
|
|
|
|
else if (_secondObjectSource == 4)
|
|
|
|
hotspotId = _savedFields._secondObject;
|
2014-03-03 00:29:54 +00:00
|
|
|
|
2014-03-23 22:48:00 +00:00
|
|
|
if (hotspotId >= (int)hotspots.size()) {
|
2014-06-01 18:43:26 +00:00
|
|
|
DynamicHotspot &hs = dynHotspots.get(hotspotId - hotspots.size());
|
2014-03-23 21:31:33 +00:00
|
|
|
if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) {
|
2014-04-06 01:01:41 +00:00
|
|
|
startWalkingDirectly(hs._feetPos.x);
|
2014-06-02 03:30:41 +00:00
|
|
|
} else if (hs._feetPos.x < 0) {
|
2014-03-29 03:07:22 +00:00
|
|
|
player._prepareWalkFacing = hs._facing;
|
2014-05-26 15:29:03 +00:00
|
|
|
} else if (_savedFields._commandSource == CAT_NONE || hs._cursor < CURSOR_WAIT) {
|
2014-03-29 03:07:22 +00:00
|
|
|
player._needToWalk = true;
|
|
|
|
player._prepareWalkPos = hs._feetPos;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
2014-03-23 22:48:00 +00:00
|
|
|
|
2014-03-29 03:07:22 +00:00
|
|
|
player._prepareWalkFacing = hs._facing;
|
2014-03-03 00:29:54 +00:00
|
|
|
hotspotId = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-26 15:29:03 +00:00
|
|
|
if (hotspotId >= 0) {
|
2014-03-23 21:31:33 +00:00
|
|
|
Hotspot &hs = hotspots[hotspotId];
|
2014-03-23 22:48:00 +00:00
|
|
|
|
2014-04-05 16:43:50 +00:00
|
|
|
if (hs._feetPos.x == -1 || hs._feetPos.x == -3) {
|
2014-04-06 01:01:41 +00:00
|
|
|
startWalkingDirectly(hs._feetPos.x);
|
2014-03-23 22:48:00 +00:00
|
|
|
} else if (hs._feetPos.x >= 0) {
|
2014-04-09 03:25:11 +00:00
|
|
|
if (_savedFields._commandSource == CAT_NONE || hs._cursor < CURSOR_WAIT) {
|
2014-03-29 03:07:22 +00:00
|
|
|
player._needToWalk = true;
|
|
|
|
player._prepareWalkPos = hs._feetPos;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
2014-03-23 22:48:00 +00:00
|
|
|
|
2014-03-29 03:07:22 +00:00
|
|
|
player._prepareWalkFacing = hs._facing;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-03-29 03:07:22 +00:00
|
|
|
player._readyToWalk = player._needToWalk;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-03-03 01:06:21 +00:00
|
|
|
void MADSAction::checkAction() {
|
2014-03-23 22:48:00 +00:00
|
|
|
if (isAction(VERB_LOOK) || isAction(VERB_THROW))
|
2014-03-29 03:07:22 +00:00
|
|
|
_vm->_game->_player._needToWalk = false;
|
2014-03-03 00:29:54 +00:00
|
|
|
}
|
|
|
|
|
2014-03-03 01:06:21 +00:00
|
|
|
bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) {
|
2014-03-23 22:48:00 +00:00
|
|
|
if (_activeAction._verbId != verbId)
|
2014-03-03 00:29:54 +00:00
|
|
|
return false;
|
2014-03-23 22:48:00 +00:00
|
|
|
if ((objectNameId != 0) && (_activeAction._objectNameId != objectNameId))
|
2014-03-03 00:29:54 +00:00
|
|
|
return false;
|
2014-03-23 22:48:00 +00:00
|
|
|
if ((indirectObjectId != 0) && (_activeAction._indirectObjectId != indirectObjectId))
|
2014-03-03 00:29:54 +00:00
|
|
|
return false;
|
2014-03-23 22:48:00 +00:00
|
|
|
|
2014-03-03 00:29:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-05-04 00:52:13 +00:00
|
|
|
bool MADSAction::isObject(int objectNameId) {
|
|
|
|
return _activeAction._objectNameId == objectNameId;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MADSAction::isTarget(int objectNameId) {
|
|
|
|
return _activeAction._indirectObjectId == objectNameId;
|
|
|
|
}
|
|
|
|
|
2014-03-03 04:09:17 +00:00
|
|
|
void MADSAction::checkActionAtMousePos() {
|
2014-03-20 03:33:18 +00:00
|
|
|
Scene &scene = _vm->_game->_scene;
|
|
|
|
UserInterface &userInterface = scene._userInterface;
|
|
|
|
|
2014-03-28 02:38:28 +00:00
|
|
|
if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) &&
|
2014-04-03 02:27:11 +00:00
|
|
|
_interAwaiting != AWAITING_COMMAND && _pickedWord >= 0) {
|
|
|
|
if (_recentCommandSource == userInterface._category || _recentCommand != _pickedWord ||
|
|
|
|
(_interAwaiting != AWAITING_THIS && _interAwaiting != 3))
|
2014-03-20 03:33:18 +00:00
|
|
|
clear();
|
2014-03-28 02:38:28 +00:00
|
|
|
else if (_selectedRow != 0 || userInterface._category != CAT_COMMAND)
|
2014-03-20 03:33:18 +00:00
|
|
|
scene._lookFlag = false;
|
|
|
|
else
|
|
|
|
scene._lookFlag = true;
|
|
|
|
}
|
|
|
|
|
2014-04-05 18:27:33 +00:00
|
|
|
if (_vm->_events->_rightMousePressed && _vm->_events->_mouseButtons) {
|
2014-03-20 03:33:18 +00:00
|
|
|
switch (userInterface._category) {
|
2014-03-28 02:38:28 +00:00
|
|
|
case CAT_COMMAND:
|
2014-03-20 03:33:18 +00:00
|
|
|
case CAT_INV_VOCAB:
|
|
|
|
return;
|
|
|
|
|
|
|
|
case CAT_INV_LIST:
|
2014-04-04 00:38:18 +00:00
|
|
|
case CAT_HOTSPOT:
|
|
|
|
case CAT_INV_ANIM:
|
|
|
|
if (_interAwaiting != AWAITING_THAT) {
|
2014-03-20 03:33:18 +00:00
|
|
|
if (userInterface._selectedActionIndex >= 0) {
|
2014-04-09 03:25:11 +00:00
|
|
|
_commandSource = CAT_COMMAND;
|
2014-03-20 03:33:18 +00:00
|
|
|
_selectedRow = userInterface._selectedActionIndex;
|
2014-04-09 03:01:46 +00:00
|
|
|
_verbType = scene._verbList[_selectedRow]._verbType;
|
|
|
|
_prepType = scene._verbList[_selectedRow]._prepType;
|
2014-03-28 02:38:28 +00:00
|
|
|
_interAwaiting = AWAITING_THIS;
|
2014-03-20 03:33:18 +00:00
|
|
|
} else if (userInterface._selectedItemVocabIdx >= 0) {
|
2014-04-09 03:25:11 +00:00
|
|
|
_commandSource = CAT_INV_VOCAB;
|
2014-03-20 03:33:18 +00:00
|
|
|
_selectedRow = userInterface._selectedItemVocabIdx;
|
|
|
|
int objectId = _vm->_game->_objects._inventoryList[_selectedRow];
|
|
|
|
InventoryObject &invObject = _vm->_game->_objects[objectId];
|
|
|
|
|
2014-04-09 03:01:46 +00:00
|
|
|
_verbType = invObject._vocabList[_selectedRow - 1]._verbType;
|
|
|
|
_prepType = invObject._vocabList[_selectedRow - 1]._prepType;
|
2014-04-09 03:25:11 +00:00
|
|
|
_mainObjectSource = CAT_INV_LIST;
|
2014-03-20 03:33:18 +00:00
|
|
|
_hotspotId = userInterface._selectedInvIndex;
|
2014-04-09 03:01:46 +00:00
|
|
|
_articleNumber = _prepType;
|
2014-03-20 03:33:18 +00:00
|
|
|
|
2014-05-08 08:43:23 +00:00
|
|
|
if ((_verbType == VERB_THIS && _prepType == PREP_NONE) ||
|
2014-04-09 03:01:46 +00:00
|
|
|
(_verbType == VERB_THAT && _prepType != PREP_NONE))
|
2014-03-28 02:38:28 +00:00
|
|
|
_interAwaiting = AWAITING_RIGHT_MOUSE;
|
2014-03-20 03:33:18 +00:00
|
|
|
else
|
2014-03-28 02:38:28 +00:00
|
|
|
_interAwaiting = AWAITING_THAT;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2014-04-12 16:09:29 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-28 02:38:28 +00:00
|
|
|
switch (_interAwaiting) {
|
2014-04-04 00:38:18 +00:00
|
|
|
case AWAITING_COMMAND:
|
2014-03-20 03:33:18 +00:00
|
|
|
_articleNumber = 0;
|
|
|
|
switch (userInterface._category) {
|
2014-03-28 02:38:28 +00:00
|
|
|
case CAT_COMMAND:
|
2014-04-09 03:25:11 +00:00
|
|
|
_commandSource = CAT_COMMAND;
|
2014-04-03 02:27:11 +00:00
|
|
|
_selectedRow = _pickedWord;
|
2014-03-20 03:33:18 +00:00
|
|
|
if (_selectedRow >= 0) {
|
2014-04-09 03:01:46 +00:00
|
|
|
_verbType = scene._verbList[_selectedRow]._verbType;
|
|
|
|
_prepType = scene._verbList[_selectedRow]._prepType;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CAT_INV_VOCAB:
|
2014-04-09 03:25:11 +00:00
|
|
|
_commandSource = CAT_INV_VOCAB;
|
2014-04-03 02:27:11 +00:00
|
|
|
_selectedRow = _pickedWord;
|
2014-03-20 03:33:18 +00:00
|
|
|
if (_selectedRow < 0) {
|
|
|
|
_hotspotId = -1;
|
2014-04-09 03:25:11 +00:00
|
|
|
_mainObjectSource = CAT_NONE;
|
2014-03-20 03:33:18 +00:00
|
|
|
} else {
|
2014-04-09 03:37:16 +00:00
|
|
|
InventoryObject &invObject = _vm->_game->_objects.getItem(userInterface._selectedInvIndex);
|
2014-05-17 18:35:48 +00:00
|
|
|
_verbType = invObject._vocabList[_selectedRow]._verbType;
|
|
|
|
_prepType = invObject._vocabList[_selectedRow]._prepType;
|
2014-03-20 03:33:18 +00:00
|
|
|
_hotspotId = userInterface._selectedInvIndex;
|
2014-04-09 03:25:11 +00:00
|
|
|
_mainObjectSource = CAT_INV_LIST;
|
2014-03-20 03:33:18 +00:00
|
|
|
|
2014-04-09 03:01:46 +00:00
|
|
|
if (_verbType == VERB_THAT)
|
|
|
|
_articleNumber = _prepType;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CAT_HOTSPOT:
|
|
|
|
_selectedRow = -1;
|
2014-04-09 03:25:11 +00:00
|
|
|
_commandSource = CAT_NONE;
|
|
|
|
_mainObjectSource = CAT_HOTSPOT;
|
2014-04-03 02:27:11 +00:00
|
|
|
_hotspotId = _pickedWord;
|
2014-03-20 03:33:18 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CAT_TALK_ENTRY:
|
2014-04-09 03:25:11 +00:00
|
|
|
_commandSource = CAT_TALK_ENTRY;
|
2014-04-03 02:27:11 +00:00
|
|
|
_selectedRow = _pickedWord;
|
2014-03-20 03:33:18 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-04-04 00:38:18 +00:00
|
|
|
case AWAITING_THIS:
|
2014-03-20 03:33:18 +00:00
|
|
|
_articleNumber = 0;
|
|
|
|
switch (userInterface._category) {
|
|
|
|
case CAT_INV_LIST:
|
|
|
|
case CAT_HOTSPOT:
|
|
|
|
case CAT_INV_ANIM:
|
2014-04-04 02:02:12 +00:00
|
|
|
_mainObjectSource = userInterface._category;
|
2014-04-03 02:27:11 +00:00
|
|
|
_hotspotId = _pickedWord;
|
2014-03-20 03:33:18 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-04-04 00:38:18 +00:00
|
|
|
case AWAITING_THAT:
|
2014-03-20 03:33:18 +00:00
|
|
|
switch (userInterface._category) {
|
|
|
|
case CAT_INV_LIST:
|
|
|
|
case CAT_HOTSPOT:
|
|
|
|
case CAT_INV_ANIM:
|
2014-04-04 02:02:12 +00:00
|
|
|
_secondObjectSource = userInterface._category;
|
|
|
|
_secondObject = _pickedWord;
|
2014-03-20 03:33:18 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MADSAction::leftClick() {
|
|
|
|
Scene &scene = _vm->_game->_scene;
|
|
|
|
UserInterface &userInterface = scene._userInterface;
|
|
|
|
bool abortFlag = false;
|
|
|
|
|
2014-03-28 02:38:28 +00:00
|
|
|
if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) &&
|
2014-04-03 02:27:11 +00:00
|
|
|
_interAwaiting != 1 && _pickedWord >= 0 &&
|
|
|
|
_recentCommandSource == userInterface._category && _recentCommand == _pickedWord &&
|
2014-03-28 02:38:28 +00:00
|
|
|
(_interAwaiting == 2 || userInterface._category == CAT_INV_VOCAB)) {
|
2014-03-20 03:33:18 +00:00
|
|
|
abortFlag = true;
|
2014-03-28 02:38:28 +00:00
|
|
|
if (_selectedRow == 0 && userInterface._category == CAT_COMMAND) {
|
|
|
|
_selectedAction = CAT_COMMAND;
|
2014-03-20 03:33:18 +00:00
|
|
|
scene._lookFlag = true;
|
|
|
|
} else {
|
|
|
|
_selectedAction = CAT_NONE;
|
|
|
|
scene._lookFlag = false;
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-05 18:27:33 +00:00
|
|
|
if (abortFlag || (_vm->_events->_rightMousePressed && (userInterface._category == CAT_COMMAND ||
|
2014-03-20 03:33:18 +00:00
|
|
|
userInterface._category == CAT_INV_VOCAB)))
|
|
|
|
return;
|
|
|
|
|
2014-03-28 02:38:28 +00:00
|
|
|
switch (_interAwaiting) {
|
|
|
|
case AWAITING_COMMAND:
|
2014-03-20 03:33:18 +00:00
|
|
|
switch (userInterface._category) {
|
2014-03-28 02:38:28 +00:00
|
|
|
case CAT_COMMAND:
|
2014-03-20 03:33:18 +00:00
|
|
|
if (_selectedRow >= 0) {
|
2014-04-09 03:01:46 +00:00
|
|
|
if (_verbType == VERB_ONLY) {
|
2014-03-20 03:33:18 +00:00
|
|
|
_selectedAction = -1;
|
|
|
|
}
|
|
|
|
else {
|
2014-04-03 02:27:11 +00:00
|
|
|
_recentCommand = _selectedRow;
|
2014-04-04 02:02:12 +00:00
|
|
|
_recentCommandSource = _commandSource;
|
2014-03-28 02:38:28 +00:00
|
|
|
_interAwaiting = AWAITING_THIS;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CAT_INV_LIST:
|
2014-04-03 02:27:11 +00:00
|
|
|
if (_pickedWord >= 0) {
|
|
|
|
userInterface.selectObject(_pickedWord);
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CAT_INV_VOCAB:
|
|
|
|
if (_selectedRow >= 0) {
|
2014-04-09 03:01:46 +00:00
|
|
|
if (_verbType != VERB_THIS || _prepType != PREP_NONE) {
|
|
|
|
if (_verbType != VERB_THAT || _prepType == PREP_NONE) {
|
2014-03-28 02:38:28 +00:00
|
|
|
_interAwaiting = AWAITING_THAT;
|
2014-04-09 03:01:46 +00:00
|
|
|
_articleNumber = _prepType;
|
|
|
|
} else {
|
|
|
|
_articleNumber = _prepType;
|
2014-03-20 03:33:18 +00:00
|
|
|
_selectedAction = -1;
|
|
|
|
}
|
2014-04-09 03:01:46 +00:00
|
|
|
} else {
|
2014-03-20 03:33:18 +00:00
|
|
|
_selectedAction = -1;
|
|
|
|
}
|
|
|
|
|
2014-04-03 02:27:11 +00:00
|
|
|
_recentCommand = _selectedRow;
|
2014-04-04 02:02:12 +00:00
|
|
|
_recentCommandSource = _commandSource;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CAT_HOTSPOT:
|
2014-04-03 02:27:11 +00:00
|
|
|
_recentCommand = -1;
|
2014-04-09 03:25:11 +00:00
|
|
|
_recentCommandSource = CAT_NONE;
|
2014-03-20 03:33:18 +00:00
|
|
|
|
2014-03-27 02:58:24 +00:00
|
|
|
if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) {
|
2014-03-20 03:33:18 +00:00
|
|
|
scene._customDest = _vm->_events->currentPos() + scene._posAdjust;
|
2014-03-27 02:58:24 +00:00
|
|
|
_selectedAction = -1;
|
2014-04-06 01:01:41 +00:00
|
|
|
_pointEstablished = true;
|
2014-03-27 02:58:24 +00:00
|
|
|
}
|
2014-03-20 03:33:18 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CAT_TALK_ENTRY:
|
|
|
|
if (_selectedRow >= 0)
|
|
|
|
_selectedAction = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-03-28 02:38:28 +00:00
|
|
|
case AWAITING_THIS:
|
2014-03-20 03:33:18 +00:00
|
|
|
switch (userInterface._category) {
|
|
|
|
case CAT_INV_LIST:
|
|
|
|
case CAT_HOTSPOT:
|
|
|
|
case CAT_INV_ANIM:
|
|
|
|
if (_hotspotId >= 0) {
|
2014-04-09 03:01:46 +00:00
|
|
|
if (_prepType) {
|
|
|
|
_articleNumber = _prepType;
|
2014-03-28 02:38:28 +00:00
|
|
|
_interAwaiting = AWAITING_THAT;
|
2014-04-15 23:28:29 +00:00
|
|
|
} else {
|
2014-03-20 03:33:18 +00:00
|
|
|
_selectedAction = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userInterface._category == CAT_HOTSPOT) {
|
|
|
|
scene._customDest = _vm->_events->mousePos() + scene._posAdjust;
|
2014-04-06 01:01:41 +00:00
|
|
|
_pointEstablished = true;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-03-28 02:38:28 +00:00
|
|
|
case AWAITING_THAT:
|
2014-03-20 03:33:18 +00:00
|
|
|
switch (userInterface._category) {
|
|
|
|
case CAT_INV_LIST:
|
|
|
|
case CAT_HOTSPOT:
|
|
|
|
case CAT_INV_ANIM:
|
2014-04-04 02:02:12 +00:00
|
|
|
if (_secondObject >= 0) {
|
2014-03-20 03:33:18 +00:00
|
|
|
_selectedAction = -1;
|
|
|
|
|
|
|
|
if (userInterface._category == CAT_HOTSPOT) {
|
2014-04-06 01:01:41 +00:00
|
|
|
if (!_pointEstablished) {
|
2014-03-20 03:33:18 +00:00
|
|
|
scene._customDest = _vm->_events->mousePos() + scene._posAdjust;
|
2014-04-06 01:01:41 +00:00
|
|
|
_pointEstablished = true;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2014-04-12 16:09:29 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2014-03-20 03:33:18 +00:00
|
|
|
}
|
2014-03-03 04:09:17 +00:00
|
|
|
}
|
|
|
|
|
2014-05-02 02:36:36 +00:00
|
|
|
void MADSAction::synchronize(Common::Serializer &s) {
|
|
|
|
_action.synchronize(s);
|
|
|
|
_activeAction.synchronize(s);
|
|
|
|
s.syncAsSint16LE(_articleNumber);
|
|
|
|
s.syncAsByte(_lookFlag);
|
|
|
|
s.syncAsByte(_textChanged);
|
|
|
|
s.syncAsSint16LE(_selectedRow);
|
|
|
|
s.syncAsSint16LE(_selectedAction);
|
|
|
|
s.syncAsSint16LE(_statusTextIndex);
|
|
|
|
s.syncAsSint16LE(_hotspotId);
|
|
|
|
_savedFields.synchronize(s);
|
2014-05-27 12:41:07 +00:00
|
|
|
|
|
|
|
// TODO: When saving in Rex Village Hut, _senetence size() doesn't match
|
|
|
|
// string length. Find out why not
|
|
|
|
_sentence = Common::String(_sentence.c_str());
|
2014-05-21 01:22:01 +00:00
|
|
|
s.syncString(_sentence);
|
2014-05-02 02:36:36 +00:00
|
|
|
|
|
|
|
s.syncAsSint16LE(_verbType);
|
|
|
|
s.syncAsSint16LE(_prepType);
|
|
|
|
s.syncAsSint16LE(_commandSource);
|
|
|
|
s.syncAsSint16LE(_mainObjectSource);
|
|
|
|
s.syncAsSint16LE(_secondObject);
|
|
|
|
s.syncAsSint16LE(_secondObjectSource);
|
|
|
|
s.syncAsSint16LE(_recentCommandSource);
|
|
|
|
s.syncAsSint16LE(_recentCommand);
|
|
|
|
s.syncAsSint16LE(_interAwaiting);
|
|
|
|
s.syncAsSint16LE(_pickedWord);
|
|
|
|
s.syncAsByte(_pointEstablished);
|
|
|
|
s.syncAsByte(_inProgress);
|
|
|
|
}
|
|
|
|
|
2014-03-03 00:29:54 +00:00
|
|
|
} // End of namespace MADS
|