diff options
author | Gregory Montoir | 2003-10-23 08:09:49 +0000 |
---|---|---|
committer | Gregory Montoir | 2003-10-23 08:09:49 +0000 |
commit | 2a42fe77bf82f3b58c50fb9bd60c872bd311ed3a (patch) | |
tree | 95f2aae352bb310c92e8fda16e3b7bfc391152ee /queen | |
parent | 472aee900c4aae989f8da96f4e07e9d648ef86c2 (diff) | |
download | scummvm-rg350-2a42fe77bf82f3b58c50fb9bd60c872bd311ed3a.tar.gz scummvm-rg350-2a42fe77bf82f3b58c50fb9bd60c872bd311ed3a.tar.bz2 scummvm-rg350-2a42fe77bf82f3b58c50fb9bd60c872bd311ed3a.zip |
minor changes for future Command class
svn-id: r10949
Diffstat (limited to 'queen')
-rw-r--r-- | queen/defs.h | 6 | ||||
-rw-r--r-- | queen/logic.cpp | 24 | ||||
-rw-r--r-- | queen/logic.h | 14 | ||||
-rw-r--r-- | queen/structs.h | 8 |
4 files changed, 39 insertions, 13 deletions
diff --git a/queen/defs.h b/queen/defs.h index a8864b2d9e..c81a8283d1 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -160,6 +160,12 @@ enum StateGrab { }; +enum StateOn { + STATE_ON_ON, + STATE_ON_OFF +}; + + } // End of namespace Queen #endif diff --git a/queen/logic.cpp b/queen/logic.cpp index 29f4d5ed54..aca33a595d 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1457,7 +1457,7 @@ void Logic::animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, b } -StateDirection Logic::findStateDirection(uint16 state) { +StateDirection Logic::findStateDirection(uint16 state) const { // FIXME: may be we should return a DIR_* constant instead // of a STATE_DIR_*. Some (all ?) calls to FIND_STATE(, "DIR") @@ -1473,11 +1473,11 @@ StateDirection Logic::findStateDirection(uint16 state) { return sd[(state >> 2) & 3]; } -StateTalk Logic::findStateTalk(uint16 state) { +StateTalk Logic::findStateTalk(uint16 state) const { return (state & (1 << 9)) ? STATE_TALK_TALK : STATE_TALK_MUTE; } -StateGrab Logic::findStateGrab(uint16 state) { +StateGrab Logic::findStateGrab(uint16 state) const { // queen.c l.4022-4029 static const StateGrab gd[] = { @@ -1489,6 +1489,22 @@ StateGrab Logic::findStateGrab(uint16 state) { return gd[state & 3]; } +StateOn Logic::findStateOn(uint16 state) const { + return (state & (1 << 8)) ? STATE_ON_ON : STATE_ON_OFF; +} + + +void Logic::alterStateOn(uint16 *objState, StateOn state) const { + switch (state) { + case STATE_ON_ON: + *objState |= (1 << 8); + break; + case STATE_ON_OFF: + *objState &= ~(1 << 8); + break; + } +} + void Logic::joeSetupFromBanks(const char *bank1, const char* bank2) { @@ -1644,7 +1660,7 @@ uint16 Logic::joeFace() { } -int16 Logic::joeWalkTo(int16 x, int16 y, const Command *cmd, bool mustWalk) { +int16 Logic::joeWalkTo(int16 x, int16 y, const Command_ *cmd, bool mustWalk) { // Check to see if object is actually an exit to another // room. If so, then set up new room diff --git a/queen/logic.h b/queen/logic.h index c731bc4a53..521671db0e 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -45,7 +45,7 @@ struct ZoneSlot { }; -struct Command { +struct Command_ { Verb action, action2; uint16 noun, noun2; }; @@ -142,9 +142,11 @@ public: void animErase(uint16 bobNum); void animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible); // FIND_GRAPHIC_ANIMS - StateDirection findStateDirection(uint16 state); // == FIND_STATE(state, "DIR"); - StateTalk findStateTalk (uint16 state); // == FIND_STATE(state, "TALK"); - StateGrab findStateGrab (uint16 state); // == FIND_STATE(state, "GRAB"); + StateDirection findStateDirection(uint16 state) const; // == FIND_STATE(state, "DIR"); + StateTalk findStateTalk (uint16 state) const; // == FIND_STATE(state, "TALK"); + StateGrab findStateGrab (uint16 state) const; // == FIND_STATE(state, "GRAB"); + StateOn findStateOn (uint16 state) const; // == FIND_STATE(state, "ON"); + void alterStateOn(uint16 *objState, StateOn state) const; // == ALTER_STATE(state, "ON"); Walk *walk() { return _walk; } @@ -162,7 +164,7 @@ public: uint16 joeFace(); //! WALK() - int16 joeWalkTo(int16 x, int16 y, const Command *cmd, bool mustWalk); + int16 joeWalkTo(int16 x, int16 y, const Command_ *cmd, bool mustWalk); //! GRAB_JOE() void joeGrab(uint16 state, uint16 speed); @@ -287,6 +289,8 @@ protected: int _talkSpeed; // TALKSPD void initialise(); + + friend class Command; // TEMP }; } // End of namespace Queen diff --git a/queen/structs.h b/queen/structs.h index dd55bf6405..6a0ff5c6db 100644 --- a/queen/structs.h +++ b/queen/structs.h @@ -155,7 +155,7 @@ struct ObjectData { //! room in which this object is available uint16 room; //! state of the object (grab direction, on/off, default command...) - int16 state; + uint16 state; //! entry in GraphicData (can be negative) /*! <table> @@ -198,7 +198,7 @@ struct ObjectData { description = READ_BE_UINT16(ptr); ptr += 2; entryObj = (int16)READ_BE_UINT16(ptr); ptr += 2; room = READ_BE_UINT16(ptr); ptr += 2; - state = (int16)READ_BE_UINT16(ptr); ptr += 2; + state = READ_BE_UINT16(ptr); ptr += 2; image = (int16)READ_BE_UINT16(ptr); ptr += 2; } }; @@ -253,7 +253,7 @@ struct ItemData { //! entry in OBJECT_DESCR uint16 description; //! state of the object - int16 state; + uint16 state; //! bank bobframe uint16 bobFrame; //! entry in OBJECT_DESCR (>0 if available) @@ -262,7 +262,7 @@ struct ItemData { void readFrom(byte *&ptr) { item = (int16)READ_BE_UINT16(ptr); ptr += 2; description = READ_BE_UINT16(ptr); ptr += 2; - state = (int16)READ_BE_UINT16(ptr); ptr += 2; + state = READ_BE_UINT16(ptr); ptr += 2; bobFrame = READ_BE_UINT16(ptr); ptr += 2; sfxDescription = (int16)READ_BE_UINT16(ptr); ptr += 2; } |