ScummVM API documentation
action.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MADS_ACTION_H
23 #define MADS_ACTION_H
24 
25 #include "common/serializer.h"
26 #include "common/str.h"
27 
28 namespace MADS {
29 
30 enum TriggerMode {
31  SEQUENCE_TRIGGER_NONE = -1,
32  SEQUENCE_TRIGGER_PARSER = 0, // Triggers parser
33  SEQUENCE_TRIGGER_DAEMON = 1, // Triggers step/daemon code
34  SEQUENCE_TRIGGER_PREPARE = 2 // Triggers preparser
35 };
36 
37 enum InterAwaiting {
38  AWAITING_NONE = 0,
39  AWAITING_COMMAND = 1, // Initial state: waiting for a command verb
40  AWAITING_THIS = 2, // Waiting for object
41  AWAITING_THAT = 3, // Waiting for a second object
42  AWAITING_RIGHT_MOUSE = 4 // Waiting for mouse button release
43 };
44 
45 enum {
46  VERB_NONE = 0,
47  VERB_LOOK = 3,
48  VERB_TAKE = 4,
49  VERB_PUSH = 5,
50  VERB_OPEN = 6,
51  VERB_PUT = 7,
52  VERB_TALKTO = 8,
53  VERB_GIVE = 9,
54  VERB_PULL = 10,
55  VERB_CLOSE = 11,
56  VERB_THROW = 12,
57  VERB_WALKTO = 13
58 };
59 
60 enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT, VERB_INIT };
61 
62 enum PrepType {
63  PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN,
64  PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = 0xff
65 };
66 
67 enum ScrCategory {
68  CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3,
69  CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7,
70  CAT_12 = 12
71 };
72 
73 class MADSEngine;
74 
75 struct ActionDetails {
76  int _verbId;
77  int _objectNameId;
78  int _indirectObjectId;
79 
84 };
85 
87  bool _commandError;
88  int _commandSource;
89  int _command;
90  int _mainObject;
91  int _secondObject;
92  int _mainObjectSource;
93  int _secondObjectSource;
94  int _articleNumber;
95  int _lookFlag;
96 
101 };
102 
103 class MADSAction {
104 private:
105  MADSEngine *_vm;
106  Common::String _statusText;
107 
108  void appendVocab(int vocabId, bool capitalize = false);
109 
110  void startWalkingDirectly(int walkType);
111 public:
112  ActionDetails _action, _activeAction;
113  int _articleNumber;
114  bool _lookFlag;
115  int _selectedRow;
116  bool _textChanged;
117  int _selectedAction;
118  int _statusTextIndex;
119  int _hotspotId;
120  ActionSavedFields _savedFields;
121  Common::String _sentence;
122 
123  VerbType _verbType;
124  PrepType _prepType;
125  ScrCategory _commandSource;
126  ScrCategory _mainObjectSource;
127  int _secondObject;
128  ScrCategory _secondObjectSource;
129  ScrCategory _recentCommandSource;
130  bool _pointEstablished;
131  int _recentCommand;
132  InterAwaiting _interAwaiting;
133  bool _inProgress;
134  int _pickedWord;
135 
136 public:
137  MADSAction(MADSEngine *vm);
138 
139  void clear();
140  void set();
141  const Common::String &statusText() const { return _statusText; }
142  void refresh();
143 
149  void startAction();
150 
151  void checkAction();
152  bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0);
153  bool isObject(int objectNameId);
154  bool isTarget(int objectNameId);
155 
160  void checkActionAtMousePos();
161 
165  void leftClick();
166 
171 };
172 
173 } // End of namespace MADS
174 
175 #endif /* MADS_ACTION_H */
Definition: str.h:59
Definition: action.h:103
Definition: serializer.h:79
Definition: action.h:75
Definition: mads.h:87
void synchronize(Common::Serializer &s)
Definition: action.h:86
Definition: action.h:28