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 namespace Nebular {
30 
31 enum TriggerMode {
32  SEQUENCE_TRIGGER_NONE = -1,
33  SEQUENCE_TRIGGER_PARSER = 0, // Triggers parser
34  SEQUENCE_TRIGGER_DAEMON = 1, // Triggers step/daemon code
35  SEQUENCE_TRIGGER_PREPARE = 2 // Triggers preparser
36 };
37 
38 enum InterAwaiting {
39  AWAITING_NONE = 0,
40  AWAITING_COMMAND = 1, // Initial state: waiting for a command verb
41  AWAITING_THIS = 2, // Waiting for object
42  AWAITING_THAT = 3, // Waiting for a second object
43  AWAITING_RIGHT_MOUSE = 4 // Waiting for mouse button release
44 };
45 
46 enum {
47  VERB_NONE = 0,
48  VERB_LOOK = 3,
49  VERB_TAKE = 4,
50  VERB_PUSH = 5,
51  VERB_OPEN = 6,
52  VERB_PUT = 7,
53  VERB_TALKTO = 8,
54  VERB_GIVE = 9,
55  VERB_PULL = 10,
56  VERB_CLOSE = 11,
57  VERB_THROW = 12,
58  VERB_WALKTO = 13
59 };
60 
61 enum VerbType {
62  VERB_ONLY, VERB_THIS, VERB_THAT, VERB_INIT
63 };
64 
65 enum PrepType {
66  PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN,
67  PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = 0xff
68 };
69 
70 enum ScrCategory {
71  CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3,
72  CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7,
73  CAT_12 = 12
74 };
75 
76 class RexNebularEngine;
77 
78 struct ActionDetails {
79  int _verbId;
80  int _objectNameId;
81  int _indirectObjectId;
82 
87 };
88 
90  bool _commandError;
91  int _commandSource;
92  int _command;
93  int _mainObject;
94  int _secondObject;
95  int _mainObjectSource;
96  int _secondObjectSource;
97  int _articleNumber;
98  int _lookFlag;
99 
104 };
105 
106 class MADSAction {
107 private:
108  RexNebularEngine *_vm;
109  Common::String _statusText;
110 
111  void appendVocab(int vocabId, bool capitalize = false);
112 
113  void startWalkingDirectly(int walkType);
114 public:
115  ActionDetails _action, _activeAction;
116  int _articleNumber;
117  bool _lookFlag;
118  int _selectedRow;
119  bool _textChanged;
120  int _selectedAction;
121  int _statusTextIndex;
122  int _hotspotId;
123  ActionSavedFields _savedFields;
124  Common::String _sentence;
125 
126  VerbType _verbType;
127  PrepType _prepType;
128  ScrCategory _commandSource;
129  ScrCategory _mainObjectSource;
130  int _secondObject;
131  ScrCategory _secondObjectSource;
132  ScrCategory _recentCommandSource;
133  bool _pointEstablished;
134  int _recentCommand;
135  InterAwaiting _interAwaiting;
136  bool _inProgress;
137  int _pickedWord;
138 
139 public:
141 
142  void clear();
143  void set();
144  const Common::String &statusText() const {
145  return _statusText;
146  }
147  void refresh();
148 
154  void startAction();
155 
156  void checkAction();
157  bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0);
158  bool isObject(int objectNameId);
159  bool isTarget(int objectNameId);
160 
165  void checkActionAtMousePos();
166 
170  void leftClick();
171 
176 };
177 
178 } // namespace Nebular
179 } // namespace MADS
180 
181 #endif
Definition: str.h:59
Definition: nebular.h:51
Definition: action.h:106
Definition: serializer.h:80
void synchronize(Common::Serializer &s)
Definition: sound_manager.h:38
Definition: action.h:89
Definition: action.h:78