From 138ee6887a13c0903f4a176b01d7c6d03d43016c Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Tue, 14 Oct 2003 09:12:01 +0000 Subject: preliminary FIND_STATE implementation svn-id: r10794 --- queen/defs.h | 10 ++++++++++ queen/logic.cpp | 20 ++++++++++++++++++++ queen/logic.h | 3 ++- queen/walk.cpp | 16 ++++++++++++++-- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/queen/defs.h b/queen/defs.h index 61c7a8ac72..bedff877f5 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -89,6 +89,7 @@ enum { PANEL_AREA_INV_4 = 14 }; + enum Language { ENGLISH = 'E', FRENCH = 'F', @@ -96,6 +97,15 @@ enum Language { ITALIAN = 'I' }; + +enum StateDirection { + STATE_DIR_BACK = 0, + STATE_DIR_RIGHT = 1, + STATE_DIR_LEFT = 2, + STATE_DIR_FRONT = 3 +}; + + } // End of namespace Queen #endif diff --git a/queen/logic.cpp b/queen/logic.cpp index 588f826cf1..b14462dd62 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1340,6 +1340,26 @@ void Logic::animErase(uint16 bobNum) { } +StateDirection Logic::findStateDirection(uint16 state) { + // see queen.c l.4016-4023 + StateDirection sd = STATE_DIR_BACK; + switch ((state >> 2) & 3) { + case 0: + sd = STATE_DIR_BACK; + break; + case 1: + sd = STATE_DIR_RIGHT; + break; + case 2: + sd = STATE_DIR_LEFT; + break; + case 3: + sd = STATE_DIR_FRONT; + break; + } + return sd; +} + } // End of namespace Queen diff --git a/queen/logic.h b/queen/logic.h index bdee7fc32f..ac94858b9e 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -121,6 +121,8 @@ public: uint16 animCreate(uint16 curImage, const Person *person); // CREATE_ANIM void animErase(uint16 bobNum); + StateDirection findStateDirection(uint16 state); // == FIND_STATE(state, "DIR"); + protected: bool _textToggle; @@ -137,7 +139,6 @@ protected: uint16 _numItems; uint16 _numGraphics; - uint16 _numObjectBoxes; uint16 _numWalkOffs; uint16 _numObjDesc; uint16 _numCmdList; //COM_LIST_MAX diff --git a/queen/walk.cpp b/queen/walk.cpp index cc3b635f89..ba0cffe6e0 100644 --- a/queen/walk.cpp +++ b/queen/walk.cpp @@ -411,8 +411,20 @@ ObjectData *Walk::joeSetupInRoom(bool autoPosition, uint16 scale) { // TODO: cutawayJoeFacing // check to see which way Joe entered room - // TODO: JoeFacing with _objectData[entryObj].state - _logic->joeFacing(DIR_FRONT); + switch (_logic->findStateDirection(pod->state)) { + case STATE_DIR_FRONT: + _logic->joeFacing(DIR_FRONT); + break; + case STATE_DIR_BACK: + _logic->joeFacing(DIR_BACK); + break; + case STATE_DIR_LEFT: + _logic->joeFacing(DIR_LEFT); + break; + case STATE_DIR_RIGHT: + _logic->joeFacing(DIR_RIGHT); + break; + } _joePrevFacing = _logic->joeFacing(); BobSlot *pbs = _graphics->bob(0); -- cgit v1.2.3