2014-03-02 19:29:54 -05: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.
|
2015-05-09 15:56:27 +02:00
|
|
|
*
|
2014-03-02 19:29:54 -05:00
|
|
|
* 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.
|
2015-05-09 15:56:27 +02:00
|
|
|
*
|
2014-03-02 19:29:54 -05:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MADS_ACTION_H
|
|
|
|
#define MADS_ACTION_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
2014-04-22 23:00:41 -04:00
|
|
|
#include "common/serializer.h"
|
2014-03-02 20:06:21 -05:00
|
|
|
#include "common/str.h"
|
2014-03-02 19:29:54 -05:00
|
|
|
|
|
|
|
namespace MADS {
|
|
|
|
|
2014-05-08 11:43:23 +03:00
|
|
|
enum TriggerMode {
|
2016-01-11 06:54:11 +01:00
|
|
|
SEQUENCE_TRIGGER_NONE = -1,
|
2014-04-15 23:51:41 -04:00
|
|
|
SEQUENCE_TRIGGER_PARSER = 0, // Triggers parser
|
|
|
|
SEQUENCE_TRIGGER_DAEMON = 1, // Triggers step/daemon code
|
|
|
|
SEQUENCE_TRIGGER_PREPARE = 2 // Triggers preparser
|
2014-03-29 11:18:07 -04:00
|
|
|
};
|
2014-03-02 19:29:54 -05:00
|
|
|
|
2014-03-27 22:38:28 -04:00
|
|
|
enum InterAwaiting {
|
|
|
|
AWAITING_NONE = 0,
|
|
|
|
AWAITING_COMMAND = 1, // Initial state: waiting for a command verb
|
|
|
|
AWAITING_THIS = 2, // Waiting for object
|
|
|
|
AWAITING_THAT = 3, // Waiting for a second object
|
|
|
|
AWAITING_RIGHT_MOUSE = 4 // Waiting for mouse button release
|
|
|
|
};
|
|
|
|
|
2014-03-02 19:29:54 -05:00
|
|
|
enum {
|
|
|
|
VERB_NONE = 0,
|
|
|
|
VERB_LOOK = 3,
|
|
|
|
VERB_TAKE = 4,
|
|
|
|
VERB_PUSH = 5,
|
|
|
|
VERB_OPEN = 6,
|
|
|
|
VERB_PUT = 7,
|
|
|
|
VERB_TALKTO = 8,
|
|
|
|
VERB_GIVE = 9,
|
|
|
|
VERB_PULL = 10,
|
|
|
|
VERB_CLOSE = 11,
|
|
|
|
VERB_THROW = 12,
|
|
|
|
VERB_WALKTO = 13
|
|
|
|
};
|
|
|
|
|
2014-05-27 00:01:59 +02:00
|
|
|
enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT, VERB_INIT };
|
2014-04-08 23:01:46 -04:00
|
|
|
|
|
|
|
enum PrepType {
|
2014-05-08 11:43:23 +03:00
|
|
|
PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN,
|
2014-04-30 21:28:49 -04:00
|
|
|
PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = 0xff
|
2014-04-08 23:01:46 -04:00
|
|
|
};
|
2014-03-19 23:33:18 -04:00
|
|
|
|
2014-04-08 23:25:11 -04:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2014-03-02 20:06:21 -05:00
|
|
|
class MADSEngine;
|
2014-03-02 19:29:54 -05:00
|
|
|
|
|
|
|
struct ActionDetails {
|
2014-03-03 00:42:41 -05:00
|
|
|
int _verbId;
|
|
|
|
int _objectNameId;
|
|
|
|
int _indirectObjectId;
|
2014-04-22 23:00:41 -04:00
|
|
|
|
2014-05-01 22:36:36 -04:00
|
|
|
/**
|
|
|
|
* Synchronize the action details
|
|
|
|
*/
|
2014-04-22 23:00:41 -04:00
|
|
|
void synchronize(Common::Serializer &s);
|
2014-03-02 19:29:54 -05:00
|
|
|
};
|
|
|
|
|
2014-03-23 17:31:33 -04:00
|
|
|
struct ActionSavedFields {
|
2014-04-03 22:02:12 -04:00
|
|
|
bool _commandError;
|
|
|
|
int _commandSource;
|
|
|
|
int _command;
|
|
|
|
int _mainObject;
|
|
|
|
int _secondObject;
|
|
|
|
int _mainObjectSource;
|
|
|
|
int _secondObjectSource;
|
2014-03-23 17:31:33 -04:00
|
|
|
int _articleNumber;
|
|
|
|
int _lookFlag;
|
2014-05-01 22:36:36 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Synchronize the saved action details
|
|
|
|
*/
|
|
|
|
void synchronize(Common::Serializer &s);
|
2014-03-02 19:29:54 -05:00
|
|
|
};
|
|
|
|
|
2014-03-02 20:06:21 -05:00
|
|
|
class MADSAction {
|
2014-03-02 19:29:54 -05:00
|
|
|
private:
|
2014-03-02 20:06:21 -05:00
|
|
|
MADSEngine *_vm;
|
|
|
|
Common::String _statusText;
|
2014-03-02 19:29:54 -05:00
|
|
|
|
2014-05-19 20:53:40 +02:00
|
|
|
void appendVocab(int vocabId, bool capitalize = false);
|
2014-03-23 17:31:33 -04:00
|
|
|
|
2014-04-05 21:30:42 -04:00
|
|
|
void startWalkingDirectly(int walkType);
|
2014-03-02 19:29:54 -05:00
|
|
|
public:
|
|
|
|
ActionDetails _action, _activeAction;
|
|
|
|
int _articleNumber;
|
|
|
|
bool _lookFlag;
|
|
|
|
int _selectedRow;
|
|
|
|
bool _textChanged;
|
|
|
|
int _selectedAction;
|
|
|
|
int _statusTextIndex;
|
|
|
|
int _hotspotId;
|
2014-03-23 18:48:00 -04:00
|
|
|
ActionSavedFields _savedFields;
|
2014-03-30 21:10:07 -04:00
|
|
|
Common::String _sentence;
|
2014-03-02 19:29:54 -05:00
|
|
|
|
2014-04-08 23:25:11 -04:00
|
|
|
VerbType _verbType;
|
|
|
|
PrepType _prepType;
|
|
|
|
ScrCategory _commandSource;
|
|
|
|
ScrCategory _mainObjectSource;
|
2014-05-01 22:36:36 -04:00
|
|
|
int _secondObject;
|
2014-04-08 23:25:11 -04:00
|
|
|
ScrCategory _secondObjectSource;
|
|
|
|
ScrCategory _recentCommandSource;
|
2014-04-05 21:01:41 -04:00
|
|
|
bool _pointEstablished;
|
2014-05-01 22:36:36 -04:00
|
|
|
int _recentCommand;
|
2014-03-27 22:38:28 -04:00
|
|
|
InterAwaiting _interAwaiting;
|
2014-03-02 19:29:54 -05:00
|
|
|
bool _inProgress;
|
2014-04-02 22:27:11 -04:00
|
|
|
int _pickedWord;
|
2014-03-02 19:29:54 -05:00
|
|
|
|
|
|
|
public:
|
2014-03-02 20:06:21 -05:00
|
|
|
MADSAction(MADSEngine *vm);
|
2014-03-02 19:29:54 -05:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
void set();
|
2014-03-02 20:06:21 -05:00
|
|
|
const Common::String &statusText() const { return _statusText; }
|
2014-03-02 19:29:54 -05:00
|
|
|
void refresh();
|
2014-04-03 22:02:12 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2014-03-02 19:29:54 -05:00
|
|
|
void startAction();
|
2014-04-03 22:02:12 -04:00
|
|
|
|
2014-03-02 19:29:54 -05:00
|
|
|
void checkAction();
|
|
|
|
bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0);
|
2014-05-04 03:52:13 +03:00
|
|
|
bool isObject(int objectNameId);
|
|
|
|
bool isTarget(int objectNameId);
|
|
|
|
|
2014-04-02 22:27:11 -04:00
|
|
|
/**
|
|
|
|
* Check the result of the current action on the sentence
|
|
|
|
* with the provision that the action is not yet complete.
|
|
|
|
*/
|
2014-03-02 23:09:17 -05:00
|
|
|
void checkActionAtMousePos();
|
2014-03-19 23:33:18 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute a click within the scene
|
|
|
|
*/
|
|
|
|
void leftClick();
|
2014-05-01 22:36:36 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Synchronize the saved action details
|
|
|
|
*/
|
|
|
|
void synchronize(Common::Serializer &s);
|
2014-03-02 19:29:54 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace MADS
|
|
|
|
|
|
|
|
#endif /* MADS_ACTION_H */
|