aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2003-10-25 20:26:50 +0000
committerGregory Montoir2003-10-25 20:26:50 +0000
commit060300339e8324add5ba46f50c8ea1cf48a6813c (patch)
tree6fdbb0f995d13797232ca225c7fe7e335575c4e0 /queen
parent6929b9dd7bd412b4936abf3044f49120d0ca5c8c (diff)
downloadscummvm-rg350-060300339e8324add5ba46f50c8ea1cf48a6813c.tar.gz
scummvm-rg350-060300339e8324add5ba46f50c8ea1cf48a6813c.tar.bz2
scummvm-rg350-060300339e8324add5ba46f50c8ea1cf48a6813c.zip
add some methods to Logic for future Command class
svn-id: r10965
Diffstat (limited to 'queen')
-rw-r--r--queen/defs.h11
-rw-r--r--queen/logic.cpp35
-rw-r--r--queen/logic.h7
-rw-r--r--queen/xref.txt10
4 files changed, 57 insertions, 6 deletions
diff --git a/queen/defs.h b/queen/defs.h
index b7564ef77a..550dc7155d 100644
--- a/queen/defs.h
+++ b/queen/defs.h
@@ -116,7 +116,10 @@ enum Verb {
VERB_DIGIT_LAST = 16,
VERB_USE_JOURNAL = 20,
- VERB_SKIP_TEXT = 101
+ VERB_SKIP_TEXT = 101,
+
+ VERB_PREP_WITH = 11,
+ VERB_PREP_TO = 12
};
@@ -140,6 +143,12 @@ enum StateOn {
};
+enum StateUse {
+ STATE_USE,
+ STATE_USE_ON
+};
+
+
} // End of namespace Queen
#endif
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 38fe57326b..6a1f40364a 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -116,6 +116,11 @@ Verb State::findDefaultVerb(uint16 state) {
}
+StateUse State::findUse(uint16 state) {
+ return (state & (1 << 10)) ? STATE_USE : STATE_USE_ON;
+}
+
+
void State::alterOn(uint16 *objState, StateOn state) {
switch (state) {
case STATE_ON_ON:
@@ -1926,6 +1931,36 @@ Verb Logic::findVerb(int16 cursorx, int16 cursory) const {
}
+uint16 Logic::findObjectFromZone(uint16 zoneNum) {
+
+ // l.316-327 select.c
+ uint16 noun = zoneNum;
+ uint16 objectMax = _objMax[_currentRoom];
+ if (zoneNum > objectMax) {
+ // this is an area box, check for associated object
+ uint16 obj = _area[_currentRoom][zoneNum - objectMax].object;
+ if (obj != 0) {
+ // there is an object, get its number
+ noun = obj - _roomData[_currentRoom];
+ }
+ }
+ return noun;
+}
+
+
+const char *Logic::verbName(Verb v) const {
+
+ if (v != VERB_NONE && v < 13) {
+ return _verbName[v];
+ }
+ else {
+ error("Logic::verbName() - Invalid verb %d", v);
+ return NULL;
+ }
+}
+
+
+
void Logic::update() {
_graphics->update(_currentRoom);
_input->delay();
diff --git a/queen/logic.h b/queen/logic.h
index 813ca7f46c..9e8d4411a3 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -75,6 +75,8 @@ struct State {
//! FIND_STATE(state, "DEF");
static Verb findDefaultVerb(uint16 state);
+ static StateUse findUse(uint16 state);
+
//! ALTER_STATE(state, "ON");
static void alterOn(uint16 *objState, StateOn state);
@@ -121,6 +123,7 @@ public:
uint16 currentRoomAreaMax();
uint16 walkOffCount();
WalkOffData *walkOffData(int index);
+ uint16 currentRoomObjMax() const { return _objMax[_currentRoom]; }
uint16 joeFacing() { return _joe.facing; }
uint16 joeX() { return _joe.x; }
@@ -214,6 +217,10 @@ public:
Walk *walk() { return _walk; }
Display *display() { return _display; }
+ uint16 findObjectFromZone(uint16 zoneNum);
+
+ const char *verbName(Verb v) const;
+
void update();
protected:
diff --git a/queen/xref.txt b/queen/xref.txt
index 804869b760..28fc4cf170 100644
--- a/queen/xref.txt
+++ b/queen/xref.txt
@@ -31,13 +31,11 @@ SELECT_VERB() Command::grabSelectedVerb
ACTION,ACTION2 Command::_action*
CLEVEL Command::_commandLevel
COMMANDstr Command::_command
-DEFCOMM
-OLDVERB,VERB
-OLDNOUN,NOUN,NOUN2
+DEFCOMM Command::_defaultVerb
+OLDVERB,VERB Command::_*verb*
+OLDNOUN,NOUN,NOUN2 Command::_*old*
PARSE Command::_parse
SUBJ1,SUBJ2,SUBJECT Command::_subject*
-TEMPstr
-WORDstr
CREDIT SCRIPTING SYSTEM
@@ -487,3 +485,5 @@ Pstr // not needed, FIND_STATE result
OUTLINE // not needed, textSet() Graphics::parameter
FTOT // queen.c/SETUP_FURNITURE local var
OBJMAXv // == Logic::_objMax[Logic::_currentRoom]
+TEMPstr
+WORDstr