1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/* ScummVM - Scumm Interpreter
* Copyright (C) 2003 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#ifndef QUEENVERB_H
#define QUEENVERB_H
namespace Queen {
enum VerbEnum {
VERB_NONE = 0,
VERB_PANEL_COMMAND_FIRST = 1,
VERB_OPEN = 1,
VERB_CLOSE = 2,
VERB_MOVE = 3,
// no verb 4
VERB_GIVE = 5,
VERB_USE = 6,
VERB_PICK_UP = 7,
VERB_LOOK_AT = 9,
VERB_TALK_TO = 8,
VERB_PANEL_COMMAND_LAST = 9,
VERB_WALK_TO = 10,
VERB_SCROLL_UP = 11,
VERB_SCROLL_DOWN = 12,
VERB_DIGIT_FIRST = 13,
VERB_DIGIT_1 = 13,
VERB_DIGIT_2 = 14,
VERB_DIGIT_3 = 15,
VERB_DIGIT_4 = 16,
VERB_DIGIT_LAST = 16,
VERB_INV_FIRST = VERB_DIGIT_FIRST,
VERB_INV_1 = VERB_DIGIT_1,
VERB_INV_2 = VERB_DIGIT_2,
VERB_INV_3 = VERB_DIGIT_3,
VERB_INV_4 = VERB_DIGIT_4,
VERB_INV_LAST = VERB_DIGIT_LAST,
VERB_USE_JOURNAL = 20,
VERB_SKIP_TEXT = 101,
VERB_PREP_WITH = 11,
VERB_PREP_TO = 12
};
class Verb {
public:
Verb() {
_verb = VERB_NONE;
}
Verb(VerbEnum v) {
_verb = v;
}
//! _verb is open/close/move/give/look at/pick up/talk to
bool isPanelCommand() const {
return
_verb >= VERB_PANEL_COMMAND_FIRST &&
_verb <= VERB_PANEL_COMMAND_LAST;
}
bool isScrollInventory() const {
return
_verb == VERB_SCROLL_UP ||
_verb == VERB_SCROLL_DOWN;
}
bool isInventory() const {
return
_verb >= VERB_INV_FIRST &&
_verb <= VERB_INV_LAST;
}
bool isJournal() const {
return _verb == VERB_USE_JOURNAL;
}
bool isTwoLevelsCommand() const {
return
_verb == VERB_GIVE ||
_verb == VERB_USE;
}
bool isDigit() const {
return
_verb >= VERB_DIGIT_FIRST &&
_verb <= VERB_DIGIT_LAST;
}
int digit() const {
return (int)_verb - VERB_DIGIT_1 + 1;
}
bool isSkipText() const {
return _verb == VERB_SKIP_TEXT;
}
bool isAction() const {
return
isPanelCommand() ||
_verb == VERB_WALK_TO ||
isScrollInventory();
}
bool isNone() const {
return _verb == VERB_NONE;
}
int inventoryItem() const {
if (isInventory()) {
return _verb - VERB_INV_FIRST;
}
return -1;
}
VerbEnum value() const {
return _verb;
}
const char* name() const {
if (_verb > 0 && _verb < 13) {
return _verbName[_verb];
}
return NULL;
}
bool operator==(const Verb& other) const {
return _verb == other._verb;
}
bool operator!=(const Verb& other) const {
return _verb != other._verb;
}
static void initName(int i, char* name) {
_verbName[i] = name;
}
private:
VerbEnum _verb;
static char* _verbName[13];
};
} // End of namespace Queen
#endif
|