[Scummvm-cvs-logs] CVS: scummvm/queen command.cpp,1.38,1.39 command.h,1.11,1.12 cutaway.cpp,1.90,1.91 defs.h,1.37,1.38 input.h,1.11,1.12 logic.cpp,1.131,1.132 logic.h,1.87,1.88 state.cpp,1.1,1.2 state.h,1.2,1.3 structs.h,1.26,1.27 talk.cpp,1.59,1.60 verb.h,1.7,NONE
Gregory Montoir
cyx at users.sourceforge.net
Fri Dec 12 02:34:01 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: residual Makefile,1.7,1.8 bits.h,1.6,1.7
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush insane.cpp,1.8,1.9 insane.h,1.5,1.6 smush_player.cpp,1.69,1.70
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv22220/queen
Modified Files:
command.cpp command.h cutaway.cpp defs.h input.h logic.cpp
logic.h state.cpp state.h structs.h talk.cpp
Removed Files:
verb.h
Log Message:
get rid of Verb class
Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- command.cpp 11 Dec 2003 22:16:34 -0000 1.38
+++ command.cpp 12 Dec 2003 10:33:34 -0000 1.39
@@ -48,14 +48,14 @@
}
-void CmdText::displayTemp(uint8 color, bool locked, const Verb& v, const char *name) {
+void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) {
char temp[MAX_COMMAND_LEN];
if (locked) {
- sprintf(temp, "%s%s", _vm->logic()->joeResponse(39), v.name());
+ sprintf(temp, "%s%s", _vm->logic()->joeResponse(39), _vm->logic()->verbName(v));
}
else {
- strcpy(temp, v.name());
+ strcpy(temp, _vm->logic()->verbName(v));
}
if (name != NULL) {
strcat(temp, " ");
@@ -75,16 +75,16 @@
}
-void CmdText::setVerb(const Verb& v) {
+void CmdText::setVerb(Verb v) {
- strcpy(_command, v.name());
+ strcpy(_command, _vm->logic()->verbName(v));
}
-void CmdText::addLinkWord(const Verb& v) {
+void CmdText::addLinkWord(Verb v) {
strcat(_command, " ");
- strcat(_command, v.name());
+ strcat(_command, _vm->logic()->verbName(v));
}
@@ -103,7 +103,7 @@
void CurrentCmdState::init() {
commandLevel = 1;
- oldVerb = verb = action = Verb(VERB_NONE);
+ oldVerb = verb = action = VERB_NONE;
oldNoun = noun = subject1 = subject2 = 0;
}
@@ -123,7 +123,7 @@
void SelectedCmdState::init() {
- action = defaultVerb = Verb(VERB_NONE);
+ action = defaultVerb = VERB_NONE;
noun = 0;
}
@@ -173,10 +173,10 @@
uint16 obj = _vm->logic()->currentRoomData() + _curCmd.noun;
_curCmd.verb = findDefault(obj, false);
- if (_curCmd.verb.isNone()) {
+ if (_curCmd.verb == VERB_NONE) {
// no match made, so command not yet completed, redefine as WALK_TO
- _cmdText.setVerb(Verb(VERB_WALK_TO));
- _selCmd.action = Verb(VERB_WALK_TO);
+ _cmdText.setVerb(VERB_WALK_TO);
+ _selCmd.action = VERB_WALK_TO;
}
else {
_cmdText.setVerb(_curCmd.verb);
@@ -254,7 +254,7 @@
}
}
- if (cond <= 0 && _selCmd.action.value() == VERB_LOOK_AT) {
+ if (cond <= 0 && _selCmd.action == VERB_LOOK_AT) {
look();
}
else {
@@ -275,22 +275,22 @@
lookCurrentRoom();
lookCurrentIcon();
- if (!_vm->input()->keyVerb().isNone()) {
+ if (_vm->input()->keyVerb() != VERB_NONE) {
- if (_vm->input()->keyVerb().isJournal()) {
+ if (_vm->input()->keyVerb() == VERB_USE_JOURNAL) {
_vm->input()->clearKeyVerb();
_vm->logic()->useJournal();
}
- else if (!_vm->input()->keyVerb().isSkipText()) {
+ else if (_vm->input()->keyVerb() != VERB_SKIP_TEXT) {
_curCmd.verb = _vm->input()->keyVerb();
- if (_curCmd.verb.isInventory()) {
+ if (isVerbInv(_curCmd.verb)) {
_curCmd.noun = _selCmd.noun = 0;
// Clear old noun and old verb in case we're pointing at an
// object (noun) or item (verb) and we want to use an item
// on it. This was the command will be redisplayed with the
// object/item that the cursor is currently on.
_curCmd.oldNoun = 0;
- _curCmd.oldVerb = Verb(VERB_NONE);
+ _curCmd.oldVerb = VERB_NONE;
grabSelectedItem();
}
else {
@@ -361,7 +361,7 @@
}
// Don't grab if action is TALK or WALK
- if (_selCmd.action.value() != VERB_TALK_TO && _selCmd.action.value() != VERB_WALK_TO) {
+ if (_selCmd.action != VERB_TALK_TO && _selCmd.action != VERB_WALK_TO) {
if (_curCmd.subject1 > 0) {
_vm->logic()->joeGrab(State::findGrab(_vm->logic()->objectData(_curCmd.subject1)->state));
}
@@ -427,7 +427,7 @@
}
// don't play music on an OPEN/CLOSE command - in case the command fails
- if (_selCmd.action.value() != VERB_OPEN && _selCmd.action.value() != VERB_CLOSE) {
+ if (_selCmd.action != VERB_OPEN && _selCmd.action != VERB_CLOSE) {
// only play song if it's a PLAY BEFORE type
if (com->song > 0) {
_vm->sound()->playSong(com->song);
@@ -455,7 +455,7 @@
// execute.c l.533-548
// FIXME: useless test, as .dog has already been played
- // if (_selCmd.action.value() == VERB_TALK_TO && cond > 0) {
+ // if (_selCmd.action == VERB_TALK_TO && cond > 0) {
// if (executeIfDialog(_vm->logic()->objectTextualDescription(cond))) {
// cleanupCurrentAction();
// return;
@@ -472,7 +472,7 @@
}
-int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, const Verb &v, bool mustWalk) {
+int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWalk) {
// Check to see if object is actually an exit to another
// room. If so, then set up new room
@@ -482,7 +482,7 @@
y = objData->y;
}
- if (v.value() == VERB_WALK_TO) {
+ if (v == VERB_WALK_TO) {
_vm->logic()->entryObj(objData->entryObj);
if (_vm->logic()->entryObj() != 0) {
_vm->logic()->newRoom(_vm->logic()->objectData(_vm->logic()->entryObj())->room);
@@ -535,16 +535,16 @@
_selPosX += _vm->display()->horizontalScroll();
- if (_curCmd.verb.isAction()) {
+ if (isVerbPanel(_curCmd.verb) || _curCmd.verb == VERB_WALK_TO || isVerbScrollInv(_curCmd.verb)) {
grabSelectedVerb();
}
- else if (_curCmd.verb.isInventory()) {
+ else if (isVerbInv(_curCmd.verb)) {
grabSelectedItem();
}
else if (_curCmd.noun > 0 && _curCmd.noun <= _vm->logic()->currentRoomObjMax()) {
grabSelectedNoun();
}
- else if (_selPosY < ROOM_ZONE_HEIGHT && _curCmd.verb.isNone()) {
+ else if (_selPosY < ROOM_ZONE_HEIGHT && _curCmd.verb == VERB_NONE) {
// select without a command, do a WALK
clear(true);
_vm->logic()->joeWalk(JWM_EXECUTE);
@@ -554,18 +554,18 @@
void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) {
- if (!_curCmd.action.isNone()) {
+ if (_curCmd.action != VERB_NONE) {
_cmdText.addObject(_vm->logic()->objectName(objName));
}
_curCmd.addObject(objNum);
// if first noun and it's a 2 level command then set up action word
- if (_curCmd.action.value() == VERB_USE && _curCmd.commandLevel == 1) {
+ if (_curCmd.action == VERB_USE && _curCmd.commandLevel == 1) {
if (State::findUse(objState) == STATE_USE_ON) {
// object supports 2 levels
_curCmd.commandLevel = 2;
- _cmdText.addLinkWord(Verb(VERB_PREP_WITH));
+ _cmdText.addLinkWord(VERB_PREP_WITH);
// command not fully constructed
_cmdText.display(INK_CMD_NORMAL);
_parse = false;
@@ -575,9 +575,9 @@
_parse = true;
}
}
- else if (_curCmd.action.value() == VERB_GIVE && _curCmd.commandLevel == 1) {
+ else if (_curCmd.action == VERB_GIVE && _curCmd.commandLevel == 1) {
_curCmd.commandLevel = 2;
- _cmdText.addLinkWord(Verb(VERB_PREP_TO));
+ _cmdText.addLinkWord(VERB_PREP_TO);
// command not fully constructed
_cmdText.display(INK_CMD_NORMAL);
_parse = false;
@@ -588,11 +588,11 @@
}
if (_parse) {
- _curCmd.verb = Verb(VERB_NONE);
+ _curCmd.verb = VERB_NONE;
//_vm->logic()->newRoom(0);
_vm->logic()->joeWalk(JWM_EXECUTE);
_selCmd.action = _curCmd.action;
- _curCmd.action = Verb(VERB_NONE);
+ _curCmd.action = VERB_NONE;
}
}
@@ -604,7 +604,7 @@
// Set PARSE to TRUE, default FALSE if command half complete
_parse = true;
- uint16 item = _vm->logic()->findInventoryItem(_curCmd.verb.inventoryItem());
+ uint16 item = _vm->logic()->findInventoryItem(_curCmd.verb - VERB_INV_FIRST);
if (item == 0 || _vm->logic()->itemData(item)->name == 0) {
return;
}
@@ -613,49 +613,49 @@
// the ITEMs default, otherwise keep constructing!
if (_mouseKey == Input::MOUSE_LBUTTON ||
- (!_vm->input()->keyVerb().isNone() && !_curCmd.verb.isNone())) {
- if (_curCmd.action.isNone()) {
- if (!_vm->input()->keyVerb().isNone()) {
+ (_vm->input()->keyVerb() != VERB_NONE && _curCmd.verb != VERB_NONE)) {
+ if (_curCmd.action == VERB_NONE) {
+ if (_vm->input()->keyVerb() != VERB_NONE) {
/* 2 - We've selected via the keyboard, no command is being */
/* constructed, so we shall find the item's default */
_curCmd.verb = findDefault(item, true);
- if (_curCmd.verb.isNone()) {
+ if (_curCmd.verb == VERB_NONE) {
// set to Look At
- _curCmd.verb = Verb(VERB_LOOK_AT);
- _cmdText.setVerb(Verb(VERB_LOOK_AT));
+ _curCmd.verb = VERB_LOOK_AT;
+ _cmdText.setVerb(VERB_LOOK_AT);
}
_curCmd.action = _curCmd.verb;
}
else {
// Action>0 ONLY if command has been constructed
// Left Mouse Button pressed just do Look At
- _curCmd.verb = Verb(VERB_LOOK_AT);
- _curCmd.action = Verb(VERB_LOOK_AT);
- _cmdText.setVerb(Verb(VERB_LOOK_AT));
+ _curCmd.verb = VERB_LOOK_AT;
+ _curCmd.action = VERB_LOOK_AT;
+ _cmdText.setVerb(VERB_LOOK_AT);
}
}
- _curCmd.verb = Verb(VERB_NONE);
+ _curCmd.verb = VERB_NONE;
}
else {
if (_vm->logic()->joeWalk() == JWM_MOVE) {
_cmdText.clear();
_curCmd.commandLevel = 1;
_vm->logic()->joeWalk(JWM_NORMAL);
- _curCmd.action = Verb(VERB_NONE);
+ _curCmd.action = VERB_NONE;
lookCurrentIcon();
}
- if (!_selCmd.defaultVerb.isNone()) {
+ if (_selCmd.defaultVerb != VERB_NONE) {
alterDefault(_selCmd.defaultVerb, true);
- _selCmd.defaultVerb = Verb(VERB_NONE);
+ _selCmd.defaultVerb = VERB_NONE;
clear(true);
return;
}
if (_cmdText.isEmpty()) {
- _curCmd.verb = Verb(VERB_LOOK_AT);
- _curCmd.action = Verb(VERB_LOOK_AT);
- _cmdText.setVerb(Verb(VERB_LOOK_AT));
+ _curCmd.verb = VERB_LOOK_AT;
+ _curCmd.action = VERB_LOOK_AT;
+ _cmdText.setVerb(VERB_LOOK_AT);
}
else {
if (_curCmd.commandLevel == 2 && _parse) {
@@ -664,15 +664,15 @@
else {
_curCmd.verb = findDefault(item, true);
}
- if (_curCmd.verb.isNone()) {
+ if (_curCmd.verb == VERB_NONE) {
// No match made, so command not yet completed. Redefine as LOOK AT
- _curCmd.action = Verb(VERB_LOOK_AT);
- _cmdText.setVerb(Verb(VERB_LOOK_AT));
+ _curCmd.action = VERB_LOOK_AT;
+ _cmdText.setVerb(VERB_LOOK_AT);
}
else {
_curCmd.action = _curCmd.verb;
}
- _curCmd.verb = Verb(VERB_NONE);
+ _curCmd.verb = VERB_NONE;
}
}
@@ -699,24 +699,24 @@
return;
}
- if (_curCmd.verb.isNone()) {
+ if (_curCmd.verb == VERB_NONE) {
if (_mouseKey == Input::MOUSE_LBUTTON) {
- if ((_curCmd.commandLevel != 2 && _curCmd.action.isNone()) ||
+ if ((_curCmd.commandLevel != 2 && _curCmd.action == VERB_NONE) ||
(_curCmd.commandLevel == 2 && _parse)) {
// action2 > 0 only if command has been constructed
// lmb pressed, just walk
- _curCmd.verb = Verb(VERB_WALK_TO);
- _curCmd.action = Verb(VERB_WALK_TO);
- _cmdText.setVerb(Verb(VERB_WALK_TO));
+ _curCmd.verb = VERB_WALK_TO;
+ _curCmd.action = VERB_WALK_TO;
+ _cmdText.setVerb(VERB_WALK_TO);
}
}
else if (_mouseKey == Input::MOUSE_RBUTTON) {
// rmb pressed, do default if one exists
- if (!_selCmd.defaultVerb.isNone()) {
+ if (_selCmd.defaultVerb != VERB_NONE) {
// change default of command
alterDefault(_selCmd.defaultVerb, false);
- _selCmd.defaultVerb = Verb(VERB_NONE);
+ _selCmd.defaultVerb = VERB_NONE;
clear(true);
return;
}
@@ -724,9 +724,9 @@
if (_cmdText.isEmpty()) {
// Ensures that Right Mkey will select correct default
_curCmd.verb = findDefault(objNum, false);
- if (!_curCmd.verb.isNone()) {
+ if (_curCmd.verb != VERB_NONE) {
// no match made, redefine as Walk To
- _selCmd.action = Verb(VERB_WALK_TO);
+ _selCmd.action = VERB_WALK_TO;
}
else {
_selCmd.action = _curCmd.verb;
@@ -735,21 +735,21 @@
_cmdText.addObject(_vm->logic()->objectName(_vm->logic()->objectData(objNum)->name));
}
else {
- _curCmd.verb = Verb(VERB_NONE);
- if ((_curCmd.commandLevel == 2 && !_parse) || !_curCmd.action.isNone()) {
+ _curCmd.verb = VERB_NONE;
+ if ((_curCmd.commandLevel == 2 && !_parse) || _curCmd.action != VERB_NONE) {
_curCmd.verb = _curCmd.action;
}
else {
_curCmd.verb = findDefault(objNum, false);
}
- if (_curCmd.verb.isNone()) {
- _curCmd.action = Verb(VERB_WALK_TO);
- _cmdText.setVerb(Verb(VERB_WALK_TO));
+ if (_curCmd.verb != VERB_NONE) {
+ _curCmd.action = VERB_WALK_TO;
+ _cmdText.setVerb(VERB_WALK_TO);
}
else {
_curCmd.action = _curCmd.verb;
}
- _curCmd.verb = Verb(VERB_NONE);
+ _curCmd.verb = VERB_NONE;
}
}
}
@@ -763,12 +763,12 @@
void Command::grabSelectedVerb() {
- if (_curCmd.verb.isScrollInventory()) {
+ if (isVerbScrollInv(_curCmd.verb)) {
// move through inventory (by four if right mouse button)
uint16 scroll = _mouseKey == Input::MOUSE_RBUTTON ? 4 : 1;
- _vm->logic()->inventoryScroll(scroll, _curCmd.verb.value() == VERB_SCROLL_UP);
+ _vm->logic()->inventoryScroll(scroll, _curCmd.verb == VERB_SCROLL_UP);
}
- else if (_curCmd.verb.isPanelCommand() || _curCmd.verb.value() == VERB_WALK_TO) {
+ else if (isVerbPanel(_curCmd.verb) || _curCmd.verb == VERB_WALK_TO) {
_curCmd.action = _curCmd.verb;
_curCmd.subject1 = 0;
_curCmd.subject2 = 0;
@@ -779,12 +779,12 @@
_cmdText.displayTemp(11, true, _curCmd.verb);
}
else {
- _selCmd.defaultVerb = Verb(VERB_NONE);
- if (_vm->logic()->joeWalk() == JWM_MOVE && !_curCmd.verb.isNone()) {
+ _selCmd.defaultVerb = VERB_NONE;
+ if (_vm->logic()->joeWalk() == JWM_MOVE && _curCmd.verb != VERB_NONE) {
_vm->logic()->joeWalk(JWM_NORMAL);
}
_curCmd.commandLevel = 1;
- _curCmd.oldVerb = Verb(VERB_NONE);
+ _curCmd.oldVerb = VERB_NONE;
_curCmd.oldNoun = 0;
_cmdText.setVerb(_curCmd.verb);
_cmdText.display(INK_CMD_NORMAL);
@@ -842,9 +842,9 @@
uint16 roomData = _vm->logic()->currentRoomData();
// select without a command or WALK TO ; do a WALK
- if ((_selCmd.action.value() == VERB_WALK_TO || _selCmd.action.isNone()) &&
+ if ((_selCmd.action == VERB_WALK_TO || _selCmd.action == VERB_NONE) &&
(_selCmd.noun > objMax || _selCmd.noun == 0)) {
- if (_selCmd.action.isNone()) {
+ if (_selCmd.action == VERB_NONE) {
_vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
}
_vm->walk()->moveJoe(0, _selPosX, _selPosY, false); // XXX inCutaway parameter
@@ -854,21 +854,21 @@
if (_curCmd.subject1 > 0 && _vm->logic()->objectData(_curCmd.subject1)->name <= 0) {
return true;
}
- if (// _selCmd.action.value() == VERB_GIVE && // can be TALK_TO !
+ if (// _selCmd.action == VERB_GIVE && // can be TALK_TO !
_curCmd.subject2 > 0 && _vm->logic()->objectData(_curCmd.subject2)->name <= 0) {
return true;
}
// check for USE command on exists
- if (_selCmd.action.value() == VERB_USE &&
+ if (_selCmd.action == VERB_USE &&
_curCmd.subject1 > 0 && _vm->logic()->objectData(_curCmd.subject1)->entryObj > 0) {
- _selCmd.action = Verb(VERB_WALK_TO);
+ _selCmd.action = VERB_WALK_TO;
}
if (_selCmd.noun > 0 && _selCmd.noun <= objMax) {
uint16 objNum = _vm->logic()->currentRoomData() + _selCmd.noun;
if (makeJoeWalkTo(_selPosX, _selPosY, objNum, _selCmd.action, walk) != 0) {
return true;
}
- if (_selCmd.action.value() == VERB_WALK_TO && _vm->logic()->objectData(roomData + _selCmd.noun)->entryObj < 0) {
+ if (_selCmd.action == VERB_WALK_TO && _vm->logic()->objectData(roomData + _selCmd.noun)->entryObj < 0) {
return true;
}
}
@@ -876,12 +876,12 @@
}
-void Command::executeStandardStuff(const Verb& action, int16 subj1, int16 subj2) {
+void Command::executeStandardStuff(Verb action, int16 subj1, int16 subj2) {
// l.158-272 execute.c
uint16 k;
- switch (action.value()) {
+ switch (action) {
case VERB_LOOK_AT:
look();
@@ -976,15 +976,15 @@
}
-void Command::changeObjectState(const Verb& action, int16 obj, int16 song, bool cutDone) {
+void Command::changeObjectState(Verb action, int16 obj, int16 song, bool cutDone) {
// l.456-533 execute.c
ObjectData *objData = _vm->logic()->objectData(obj);
- if (action.value() == VERB_OPEN && !cutDone) {
+ if (action == VERB_OPEN && !cutDone) {
if (State::findOn(objData->state) == STATE_ON_ON) {
State::alterOn(&objData->state, STATE_ON_OFF);
- State::alterDefaultVerb(&objData->state, Verb(VERB_NONE));
+ State::alterDefaultVerb(&objData->state, VERB_NONE);
// play music if it exists... (or SFX for open/close door)
if (song != 0) {
@@ -1002,11 +1002,11 @@
_vm->logic()->joeSpeak(9);
}
}
- else if (action.value() == VERB_CLOSE && !cutDone) {
+ else if (action == VERB_CLOSE && !cutDone) {
if (State::findOn(objData->state) == STATE_ON_OFF) {
State::alterOn(&objData->state, STATE_ON_ON);
- State::alterDefaultVerb(&objData->state, Verb(VERB_OPEN));
+ State::alterDefaultVerb(&objData->state, VERB_OPEN);
// play music if it exists... (or SFX for open/close door)
if (song != 0) {
@@ -1024,7 +1024,7 @@
_vm->logic()->joeSpeak(10);
}
}
- else if (action.value() == VERB_MOVE) {
+ else if (action == VERB_MOVE) {
State::alterOn(&objData->state, STATE_ON_OFF);
}
}
@@ -1034,7 +1034,7 @@
// l.595-597 execute.c
_vm->logic()->joeFace();
_curCmd.oldNoun = 0;
- _curCmd.oldVerb = Verb(VERB_NONE);
+ _curCmd.oldVerb = VERB_NONE;
}
@@ -1045,7 +1045,7 @@
}
-void Command::alterDefault(const Verb& def, bool itemType) {
+void Command::alterDefault(Verb def, bool itemType) {
uint16 *newDefaultState = 0;
const char *name = NULL;
@@ -1064,7 +1064,7 @@
name = _vm->logic()->objectTextualDescription(od->name);
}
else {
- uint16 item = _vm->logic()->findInventoryItem(_curCmd.verb.inventoryItem());
+ uint16 item = _vm->logic()->findInventoryItem(_curCmd.verb - VERB_INV_FIRST);
if (item == 0 || _vm->logic()->itemData(item)->name == 0) {
return;
}
@@ -1078,14 +1078,14 @@
_cmdText.clear();
}
else {
- _cmdText.setVerb(def.isNone() ? Verb(VERB_WALK_TO) : def);
+ _cmdText.setVerb(def == VERB_NONE ? VERB_WALK_TO : def);
}
_cmdText.displayTemp(INK_CMD_NORMAL, name);
_curCmd.oldNoun = _curCmd.noun;
}
-void Command::openOrCloseAssociatedObject(const Verb& action, int16 otherObj) {
+void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) {
CmdListData *cmdList = &_cmdList[1];
uint16 com = 0;
@@ -1125,17 +1125,17 @@
objData->image = cmdList->imageOrder;
}
- if (action.value() == VERB_OPEN) {
+ if (action == VERB_OPEN) {
if (State::findOn(objData->state) == STATE_ON_ON) {
State::alterOn(&objData->state, STATE_ON_OFF);
- State::alterDefaultVerb(&objData->state, Verb(VERB_NONE));
+ State::alterDefaultVerb(&objData->state, VERB_NONE);
objData->entryObj = ABS(objData->entryObj);
}
}
- else if (action.value() == VERB_CLOSE) {
+ else if (action == VERB_CLOSE) {
if (State::findOn(objData->state) == STATE_ON_OFF) {
State::alterOn(&objData->state, STATE_ON_ON);
- State::alterDefaultVerb(&objData->state, Verb(VERB_OPEN));
+ State::alterDefaultVerb(&objData->state, VERB_OPEN);
objData->entryObj = -ABS(objData->entryObj);
}
}
@@ -1430,17 +1430,17 @@
void Command::lookCurrentItem() {
- if (_curCmd.verb.isInventory()) {
- uint16 item = _vm->logic()->findInventoryItem(_curCmd.verb.inventoryItem());
+ if (isVerbInv(_curCmd.verb)) {
+ uint16 item = _vm->logic()->findInventoryItem(_curCmd.verb - VERB_INV_FIRST);
if (item != 0) {
ItemData *itemData = _vm->logic()->itemData(item);
const char *name = _vm->logic()->objectName(itemData->name);
- if (_curCmd.action.isNone()) {
+ if (_curCmd.action == VERB_NONE) {
Verb v = State::findDefaultVerb(itemData->state);
- _cmdText.setVerb(v.isNone() ? Verb(VERB_LOOK_AT) : v);
+ _cmdText.setVerb(v == VERB_NONE ? VERB_LOOK_AT : v);
}
- if (!_selCmd.defaultVerb.isNone()) {
+ if (_selCmd.defaultVerb != VERB_NONE) {
_cmdText.displayTemp(INK_CMD_LOCK, true, _selCmd.defaultVerb, name);
}
else {
@@ -1487,10 +1487,10 @@
if (_curCmd.noun > _vm->logic()->currentRoomObjMax() && aObjName <= 0) {
if (_curCmd.oldNoun != 0) {
- if (!_selCmd.defaultVerb.isNone()) {
+ if (_selCmd.defaultVerb != VERB_NONE) {
_cmdText.displayTemp(INK_CMD_LOCK, true, _selCmd.defaultVerb);
}
- else if (!_curCmd.action.isNone()) {
+ else if (_curCmd.action != VERB_NONE) {
_cmdText.display(INK_CMD_NORMAL);
}
_curCmd.oldNoun = 0;
@@ -1501,19 +1501,19 @@
if (i <= 0) {
_curCmd.oldNoun = _curCmd.noun;
_vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
- if (!_selCmd.defaultVerb.isNone()) {
+ if (_selCmd.defaultVerb != VERB_NONE) {
_cmdText.displayTemp(INK_CMD_LOCK, true, _selCmd.defaultVerb);
}
- else if (!_curCmd.action.isNone()) {
+ else if (_curCmd.action != VERB_NONE) {
_cmdText.display(INK_CMD_NORMAL);
}
return;
}
// if no command yet selected, then use DEFAULT command, if any
- if (_curCmd.action.isNone()) {
+ if (_curCmd.action == VERB_NONE) {
Verb v = State::findDefaultVerb(_vm->logic()->objectData(k + _curCmd.noun)->state);
- _cmdText.setVerb(v.isNone() ? Verb(VERB_WALK_TO) : v);
+ _cmdText.setVerb(v == VERB_NONE ? VERB_WALK_TO : v);
if (_curCmd.noun == 0) {
_cmdText.clear();
}
@@ -1522,7 +1522,7 @@
if (_curCmd.noun > 0) {
objName = _vm->logic()->objectName(i);
}
- if (!_selCmd.defaultVerb.isNone()) {
+ if (_selCmd.defaultVerb != VERB_NONE) {
_cmdText.displayTemp(INK_CMD_LOCK, true, _selCmd.defaultVerb, objName);
}
else {
@@ -1537,7 +1537,7 @@
_curCmd.verb = _vm->logic()->findVerbUnderCursor(_vm->input()->mousePosX(), _vm->input()->mousePosY());
if (_curCmd.verb != _curCmd.oldVerb && _vm->logic()->joeWalk() != JWM_MOVE) {
- if (_curCmd.action.isNone()) {
+ if (_curCmd.action == VERB_NONE) {
_cmdText.clear();
}
_vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
@@ -1549,15 +1549,14 @@
}
_curCmd.oldVerb = _curCmd.verb;
- if (_curCmd.verb.isPanelCommand() || _curCmd.verb.value() == VERB_WALK_TO) {
- if (_curCmd.verb.isNone()) {
- _cmdText.display(INK_CMD_NORMAL);
- }
- else {
- _cmdText.displayTemp(INK_CMD_NORMAL, false, _curCmd.verb);
- }
+ if (_curCmd.verb == VERB_NONE) {
+ _cmdText.display(INK_CMD_NORMAL);
+ }
+ else if (isVerbPanel(_curCmd.verb) || _curCmd.verb == VERB_WALK_TO) {
+ _cmdText.displayTemp(INK_CMD_NORMAL, false, _curCmd.verb);
}
}
}
+
} // End of namespace Queen
Index: command.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- command.h 11 Dec 2003 22:16:34 -0000 1.11
+++ command.h 12 Dec 2003 10:33:34 -0000 1.12
@@ -23,8 +23,8 @@
#define QUEENCOMMAND_H
#include "common/util.h"
+#include "queen/defs.h"
#include "queen/structs.h"
-#include "queen/verb.h"
namespace Queen {
@@ -34,10 +34,10 @@
void clear();
void display(uint8 color);
- void displayTemp(uint8 color, bool locked, const Verb& v, const char *name = NULL);
+ void displayTemp(uint8 color, bool locked, Verb v, const char *name = NULL);
void displayTemp(uint8 color, const char *name);
- void setVerb(const Verb& v);
- void addLinkWord(const Verb& v);
+ void setVerb(Verb v);
+ void addLinkWord(Verb v);
void addObject(const char *objName);
bool isEmpty() const;
@@ -105,7 +105,7 @@
int16 executeCommand(uint16 comId, int16 condResult);
- int16 makeJoeWalkTo(int16 x, int16 y, int16 objNum, const Verb &v, bool mustWalk);
+ int16 makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWalk);
void grabCurrentSelection();
void grabSelectedObject(int16 objNum, uint16 objState, uint16 objName);
@@ -117,18 +117,18 @@
bool executeIfDialog(const char *description);
bool handleDefaultCommand(bool walk);
- void executeStandardStuff(const Verb& action, int16 subj1, int16 subj2);
- void changeObjectState(const Verb& action, int16 obj, int16 song, bool cutDone);
+ void executeStandardStuff(Verb action, int16 subj1, int16 subj2);
+ void changeObjectState(Verb action, int16 obj, int16 song, bool cutDone);
void cleanupCurrentAction();
//! find default verb action for specified object
Verb findDefault(uint16 obj, bool itemType);
//! alter default verb action for specified object and update command display
- void alterDefault(const Verb& def, bool itemType);
+ void alterDefault(Verb def, bool itemType);
//! OPEN_CLOSE_OTHER(OBJECT_DATA[S][4])
- void openOrCloseAssociatedObject(const Verb& action, int16 obj);
+ void openOrCloseAssociatedObject(Verb action, int16 obj);
//! update gamestates - P1_SET_CONDITIONS
int16 setConditions(uint16 command, bool lastCmd);
@@ -151,7 +151,10 @@
void lookCurrentRoom();
void lookCurrentIcon();
-
+ bool isVerbPanel(Verb v) const { return v >= VERB_PANEL_COMMAND_FIRST && v <= VERB_PANEL_COMMAND_LAST; };
+ bool isVerbInv(Verb v) const { return v >= VERB_INV_FIRST && v <= VERB_INV_LAST; }
+ bool isVerbScrollInv(Verb v) const { return v == VERB_SCROLL_UP || v == VERB_SCROLL_DOWN; }
+
CmdListData *_cmdList;
uint16 _numCmdList;
Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- cutaway.cpp 11 Dec 2003 22:16:34 -0000 1.90
+++ cutaway.cpp 12 Dec 2003 10:33:34 -0000 1.91
@@ -1380,7 +1380,7 @@
if (_vm->input()->cutawayQuit())
return;
- if (_vm->input()->keyVerb().isSkipText()) {
+ if (_vm->input()->keyVerb() == VERB_SKIP_TEXT) {
_vm->input()->clearKeyVerb();
break;
}
Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- defs.h 11 Dec 2003 10:24:27 -0000 1.37
+++ defs.h 12 Dec 2003 10:33:34 -0000 1.38
@@ -275,6 +275,47 @@
};
+enum Verb {
+ 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
+};
+
+
} // End of namespace Queen
#endif
Index: input.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/input.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- input.h 1 Dec 2003 20:48:40 -0000 1.11
+++ input.h 12 Dec 2003 10:33:34 -0000 1.12
@@ -24,7 +24,6 @@
#include "common/util.h"
#include "queen/defs.h"
-#include "queen/verb.h"
namespace Queen {
@@ -57,7 +56,7 @@
int checkKeys();
//! use instead of KEYVERB=0
- void clearKeyVerb() { _keyVerb = Verb(VERB_NONE); }
+ void clearKeyVerb() { _keyVerb = VERB_NONE; }
void canQuit(bool cq) { _canQuit = cq; }
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- logic.cpp 11 Dec 2003 22:16:35 -0000 1.131
+++ logic.cpp 12 Dec 2003 10:33:34 -0000 1.132
@@ -41,7 +41,7 @@
namespace Queen {
-const VerbEnum Logic::PANEL_VERBS[] = {
+const Verb Logic::PANEL_VERBS[] = {
VERB_NONE,
VERB_OPEN,
VERB_CLOSE,
@@ -60,9 +60,6 @@
};
-char* Verb::_verbName[13];
-
-
Logic::Logic(QueenEngine *vm)
: _vm(vm) {
_joe.x = _joe.y = 0;
@@ -246,9 +243,9 @@
for (i = 1; i <= _numRooms; i++)
_roomName[i] = _vm->resource()->getJAS2Line();
- Verb::initName(0, NULL);
+ _verbName[0] = 0;
for (i = 1; i <= 12; i++)
- Verb::initName(i, _vm->resource()->getJAS2Line());
+ _verbName[i] = _vm->resource()->getJAS2Line();
_joeResponse[0] = 0;
for (i = 1; i <= JOE_RESPONSE_MAX; i++)
@@ -2195,7 +2192,7 @@
if (objData->name > 0) {
_entryObj = objData->entryObj;
char textCmd[CmdText::MAX_COMMAND_LEN];
- sprintf(textCmd, "%s %s", Verb(VERB_WALK_TO).name(), _objName[objData->name]);
+ sprintf(textCmd, "%s %s", verbName(VERB_WALK_TO), _objName[objData->name]);
_vm->graphics()->textCurrentColor(INK_PINNACLE_ROOM);
_vm->graphics()->textSetCentered(5, textCmd);
}
Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- logic.h 11 Dec 2003 22:16:35 -0000 1.87
+++ logic.h 12 Dec 2003 10:33:34 -0000 1.88
@@ -25,7 +25,6 @@
#include "common/util.h"
#include "queen/defs.h"
#include "queen/structs.h"
-#include "queen/verb.h"
namespace Queen {
@@ -126,6 +125,7 @@
void joePrevFacing(uint16 dir);
const char *joeResponse(int i) const { return _joeResponse[i]; }
+ const char *verbName(Verb v) const { return _verbName[v]; }
int16 gameState(int index);
void gameState(int index, int16 newValue);
@@ -370,6 +370,8 @@
//! Room name, prefix for data files (PCX, LUM...)
char **_roomName; //ROOM_NAMEstr
+ char *_verbName[13];
+
char *_joeResponse[JOE_RESPONSE_MAX + 1]; //JOE_RESPstr
//! Actor animation string
@@ -427,7 +429,7 @@
QueenEngine *_vm;
//! Verbs (in order) available in panel
- static const VerbEnum PANEL_VERBS[];
+ static const Verb PANEL_VERBS[];
};
Index: state.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/state.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- state.cpp 11 Dec 2003 10:03:35 -0000 1.1
+++ state.cpp 12 Dec 2003 10:33:34 -0000 1.2
@@ -26,7 +26,6 @@
Direction State::findDirection(uint16 state) {
- // queen.c l.4014-4021
static const Direction sd[] = {
DIR_BACK,
DIR_RIGHT,
@@ -43,14 +42,13 @@
StateGrab State::findGrab(uint16 state) {
- // queen.c l.4022-4029
- static const StateGrab gd[] = {
+ static const StateGrab sg[] = {
STATE_GRAB_NONE,
STATE_GRAB_DOWN,
STATE_GRAB_UP,
STATE_GRAB_MID
};
- return gd[state & 3];
+ return sg[state & 3];
}
@@ -60,37 +58,28 @@
Verb State::findDefaultVerb(uint16 state) {
- Verb v;
- switch((state >> 4) & 0xF) {
- case 1:
- v = Verb(VERB_OPEN);
- break;
- case 3:
- v = Verb(VERB_CLOSE);
- break;
- case 7:
- v = Verb(VERB_MOVE);
- break;
- case 8:
- v = Verb(VERB_GIVE);
- break;
- case 12:
- v = Verb(VERB_USE);
- break;
- case 14:
- v = Verb(VERB_PICK_UP);
- break;
- case 9:
- v = Verb(VERB_TALK_TO);
- break;
- case 6:
- v = Verb(VERB_LOOK_AT);
- break;
- default:
- v = Verb(VERB_NONE);
- break;
- }
- return v;
+ static const Verb sdv[] = {
+ VERB_NONE,
+ VERB_OPEN,
+ VERB_NONE,
+ VERB_CLOSE,
+
+ VERB_NONE,
+ VERB_NONE,
+ VERB_LOOK_AT,
+ VERB_MOVE,
+
+ VERB_GIVE,
+ VERB_TALK_TO,
+ VERB_NONE,
+ VERB_NONE,
+
+ VERB_USE,
+ VERB_NONE,
+ VERB_PICK_UP,
+ VERB_NONE
+ };
+ return sdv[(state >> 4) & 0xF];
}
@@ -113,7 +102,7 @@
void State::alterDefaultVerb(uint16 *objState, Verb v) {
uint16 val;
- switch (v.value()) {
+ switch (v) {
case VERB_OPEN:
val = 1;
break;
Index: state.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/state.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- state.h 11 Dec 2003 21:04:02 -0000 1.2
+++ state.h 12 Dec 2003 10:33:34 -0000 1.3
@@ -24,7 +24,6 @@
#include "common/util.h"
#include "queen/defs.h"
-#include "queen/verb.h"
namespace Queen {
Index: structs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/structs.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- structs.h 6 Dec 2003 13:15:17 -0000 1.26
+++ structs.h 12 Dec 2003 10:33:34 -0000 1.27
@@ -22,7 +22,7 @@
#ifndef QUEENSTRUCTS_H
#define QUEENSTRUCTS_H
-#include "queen/verb.h"
+#include "queen/defs.h"
namespace Queen {
@@ -411,7 +411,7 @@
int16 specialSection;
void readFrom(byte *&ptr) {
- verb = Verb((VerbEnum)READ_BE_UINT16(ptr)); ptr += 2;
+ verb = (Verb)READ_BE_UINT16(ptr); ptr += 2;
nounObj1 = (int16)READ_BE_UINT16(ptr); ptr += 2;
nounObj2 = (int16)READ_BE_UINT16(ptr); ptr += 2;
song = (int16)READ_BE_UINT16(ptr); ptr += 2;
Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- talk.cpp 11 Dec 2003 22:16:35 -0000 1.59
+++ talk.cpp 12 Dec 2003 10:33:34 -0000 1.60
@@ -871,7 +871,7 @@
}
// Skip through text more quickly
- if (_vm->input()->keyVerb().isSkipText()) {
+ if (_vm->input()->keyVerb() == VERB_SKIP_TEXT) {
_vm->input()->clearKeyVerb();
break;
}
@@ -1332,11 +1332,11 @@
int mouseButton = _vm->input()->mouseButton();
_vm->input()->clearMouseButton();
- if (_vm->input()->keyVerb().isDigit()) {
- for (i = 1; i <= 4; i++)
- {
- if (talkZone[i] == _vm->input()->keyVerb().digit())
- {
+ Verb v = _vm->input()->keyVerb();
+ if (v >= VERB_DIGIT_FIRST && v <= VERB_DIGIT_LAST) {
+ int n = v - VERB_DIGIT_FIRST + 1;
+ for (i = 1; i <= 4; i++) {
+ if (talkZone[i] == n) {
selectedSentence = i;
break;
}
--- verb.h DELETED ---
- Previous message: [Scummvm-cvs-logs] CVS: residual Makefile,1.7,1.8 bits.h,1.6,1.7
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/smush insane.cpp,1.8,1.9 insane.h,1.5,1.6 smush_player.cpp,1.69,1.70
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list