diff options
-rw-r--r-- | queen/defs.h | 18 | ||||
-rw-r--r-- | queen/logic.cpp | 56 | ||||
-rw-r--r-- | queen/logic.h | 39 | ||||
-rw-r--r-- | queen/xref.txt | 24 |
4 files changed, 78 insertions, 59 deletions
diff --git a/queen/defs.h b/queen/defs.h index 38d4a54c53..b7564ef77a 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -81,24 +81,6 @@ enum { }; -enum { - PANEL_AREA_OPEN = 1, - PANEL_AREA_CLOSE = 2, - PANEL_AREA_MOVE = 3, - PANEL_AREA_GIVE = 4, - PANEL_AREA_LOOKAT = 5, - PANEL_AREA_PICKUP = 6, - PANEL_AREA_TALKTO = 7, - PANEL_AREA_USE = 8, - PANEL_AREA_INV_UP = 9, - PANEL_AREA_INV_DOWN = 10, - PANEL_AREA_INV_1 = 11, - PANEL_AREA_INV_2 = 12, - PANEL_AREA_INV_3 = 13, - PANEL_AREA_INV_4 = 14 -}; - - enum Language { ENGLISH = 'E', FRENCH = 'F', diff --git a/queen/logic.cpp b/queen/logic.cpp index 8dc219ff76..38fe57326b 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -31,6 +31,24 @@ namespace Queen { +const Verb Logic::PANEL_VERBS[] = { + VERB_NONE, + VERB_OPEN, + VERB_CLOSE, + VERB_MOVE, + VERB_GIVE, + VERB_LOOK_AT, + VERB_PICK_UP, + VERB_TALK_TO, + VERB_USE, + VERB_SCROLL_UP, + VERB_SCROLL_DOWN, + VERB_DIGIT_1, // inventory item 1 + VERB_DIGIT_2, // inventory item 2 + VERB_DIGIT_3, // inventory item 3 + VERB_DIGIT_4, // inventory item 4 +}; + Direction State::findDirection(uint16 state) { // queen.c l.4014-4021 @@ -146,7 +164,8 @@ void State::alterDefaultVerb(uint16 *objState, Verb v) { Logic::Logic(Resource *resource, Graphics *graphics, Display *theDisplay, Input *input, Sound *sound) : _resource(resource), _graphics(graphics), _display(theDisplay), - _input(input), _sound(sound), _talkSpeed(DEFAULT_TALK_SPEED) { + _input(input), _sound(sound) { + _settings.talkSpeed = DEFAULT_TALK_SPEED; _jas = _resource->loadFile("QUEEN.JAS", 20); _joe.x = _joe.y = 0; _joe.scale = 100; @@ -339,6 +358,7 @@ void Logic::initialise() { } /* + // FIXME: move to Input class ? switch (_resource->getLanguage()) { case ENGLISH: _keyLanguage = _keyCommands[KEYS_ENGLISH]; @@ -403,11 +423,11 @@ void Logic::initialise() { for (i = 1; i <= _numAFile; i++) _aFile[i] = _resource->getJAS2Line(); - _textToggle = true; + _settings.textToggle = true; if (_resource->isFloppy()) - _speechToggle = false; + _settings.speechToggle = false; else - _speechToggle = true; + _settings.speechToggle = true; _graphics->loadPanel(); _graphics->bobSetupControl(); @@ -729,14 +749,14 @@ void Logic::zoneSet(uint16 screen, uint16 zone, const Box& box) { } -uint16 Logic::zoneIn(uint16 screen, uint16 x, uint16 y) { +uint16 Logic::zoneIn(uint16 screen, uint16 x, uint16 y) const { int i; if (screen == ZONE_PANEL) { y -= ROOM_ZONE_HEIGHT; } for(i = 1; i < MAX_ZONES_NUMBER; ++i) { - ZoneSlot *pzs = &_zones[screen][i]; + const ZoneSlot *pzs = &_zones[screen][i]; if (pzs->valid && pzs->box.contains(x, y)) { return i; } @@ -745,7 +765,8 @@ uint16 Logic::zoneIn(uint16 screen, uint16 x, uint16 y) { } -uint16 Logic::zoneInArea(uint16 screen, uint16 x, uint16 y) { +uint16 Logic::zoneInArea(uint16 screen, uint16 x, uint16 y) const { + uint16 zone = zoneIn(screen, x, y); if (zone <= _objMax[_currentRoom]) { zone = 0; @@ -795,23 +816,22 @@ void Logic::zoneSetup() { void Logic::zoneSetupPanel() { - int i; - // verbs + int i; for (i = 0; i <= 7; ++i) { int x = i * 20; zoneSet(ZONE_PANEL, i + 1, x, 10, x + 19, 49); } // inventory scrolls - zoneSet(ZONE_PANEL, PANEL_AREA_INV_UP, 160, 10, 179, 29); - zoneSet(ZONE_PANEL, PANEL_AREA_INV_DOWN, 160, 30, 179, 49); + zoneSet(ZONE_PANEL, 9, 160, 10, 179, 29); + zoneSet(ZONE_PANEL, 10, 160, 30, 179, 49); // inventory items - zoneSet(ZONE_PANEL, PANEL_AREA_INV_1, 180, 10, 213, 49); - zoneSet(ZONE_PANEL, PANEL_AREA_INV_2, 214, 10, 249, 49); - zoneSet(ZONE_PANEL, PANEL_AREA_INV_3, 250, 10, 284, 49); - zoneSet(ZONE_PANEL, PANEL_AREA_INV_4, 285, 10, 320, 49); + zoneSet(ZONE_PANEL, 11, 180, 10, 213, 49); + zoneSet(ZONE_PANEL, 12, 214, 10, 249, 49); + zoneSet(ZONE_PANEL, 13, 250, 10, 284, 49); + zoneSet(ZONE_PANEL, 14, 285, 10, 320, 49); } @@ -1900,6 +1920,12 @@ const char* Logic::objectOrItemName(int16 obj) const { } +Verb Logic::findVerb(int16 cursorx, int16 cursory) const { + + return PANEL_VERBS[zoneIn(ZONE_PANEL, cursorx, cursory)]; +} + + void Logic::update() { _graphics->update(_currentRoom); _input->delay(); diff --git a/queen/logic.h b/queen/logic.h index c907f56233..813ca7f46c 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -49,6 +49,15 @@ struct Command_ { uint16 noun, noun2; }; +struct GameSettings { + int musicVolume; + bool musicToggle; + bool sfxToggle; + bool textToggle; + bool speechToggle; + int talkSpeed; +}; + struct State { //! FIND_STATE(state, "DIR"); @@ -96,10 +105,10 @@ public: uint16 newRoom() const { return _newRoom; } void newRoom(uint16 room) { _newRoom = room; } - ObjectData* objectData(int index); + ObjectData *objectData(int index); uint16 roomData(int room); uint16 objMax(int room); - GraphicData* graphicData(int index); + GraphicData *graphicData(int index); uint16 findBob(uint16 obj); uint16 findFrame(uint16 obj); @@ -135,12 +144,13 @@ public: uint16 numFrames() { return _numFrames; } + int talkSpeed() const { return _settings.talkSpeed; } Language language() { return _resource->getLanguage(); } void zoneSet(uint16 screen, uint16 zone, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void zoneSet(uint16 screen, uint16 zone, const Box& box); - uint16 zoneIn(uint16 screen, uint16 x, uint16 y); - uint16 zoneInArea(uint16 screen, uint16 x, uint16 y); + uint16 zoneIn(uint16 screen, uint16 x, uint16 y) const; + uint16 zoneInArea(uint16 screen, uint16 x, uint16 y) const; void zoneClearAll(uint16 screen); void zoneSetup(); void zoneSetupPanel(); @@ -165,10 +175,6 @@ public: void animErase(uint16 bobNum); void animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible); // FIND_GRAPHIC_ANIMS - Walk *walk() { return _walk; } - - int talkSpeed() { return _talkSpeed; } - void joeSetupFromBanks(const char *animBank, const char *standBank); //! SETUP_JOE(), loads the various bobs needed to animate Joe @@ -202,14 +208,20 @@ public: const char* objectOrItemName(int16 obj) const; + //! return selected verb in panel + Verb findVerb(int16 cursorx, int16 cursory) const; + + Walk *walk() { return _walk; } Display *display() { return _display; } void update(); protected: - bool _textToggle; - bool _speechToggle; - + + GameSettings _settings; + + void initialise(); + uint8 *_jas; uint16 _numRooms; uint16 _currentRoom; @@ -305,9 +317,8 @@ protected: Sound *_sound; Walk *_walk; - int _talkSpeed; // TALKSPD - - void initialise(); + //! Verbs (in order) available in panel + static const Verb PANEL_VERBS[]; friend class Command; // TEMP }; diff --git a/queen/xref.txt b/queen/xref.txt index 9c861f60ea..804869b760 100644 --- a/queen/xref.txt +++ b/queen/xref.txt @@ -14,7 +14,7 @@ unpack() Graphics::bankUnpack COMMAND ======= -ALTER_DEFAULT() +ALTER_DEFAULT() Command::alterDefault CLEAR_COMMAND() Command::clear EXECUTE_ACTION() Command::executeCurrentAction FIND_DEFAULT() Command::findDefault @@ -23,10 +23,10 @@ P1_SET_CONDITIONS() Command::setConditions P2_SET_AREAS() Command::setAreas P3_SET_OBJECTS() Command::setObjects P4_SET_ITEMS() Command::setItems -SELECT() -SELECT_ITEM() -SELECT_NOUN() -SELECT_VERB() +SELECT() Command::grabCurrentSelection +SELECT_ITEM() Command::grabSelectedItem +SELECT_NOUN() Command::grabSelectedNoun +SELECT_VERB() Command::grabSelectedVerb - ACTION,ACTION2 Command::_action* CLEVEL Command::_commandLevel @@ -90,12 +90,12 @@ GAME SETTINGS ============= - config_request -MUSICTOGGLE -SFXTOGGLE -TALKSPD Logic::_talkSpeed -TEXTTOGGLE +MUSICTOGGLE GameSettings::musicToggle +SFXTOGGLE GameSettings::sfxToggle +TALKSPD GameSettings::talkSpeed +TEXTTOGGLE GameSettings::textToggle VersionStr Logic::language (add more functions if needed) -VOICETOGGLE +VOICETOGGLE GameSettings::speechToggle GRAPHICS @@ -195,7 +195,7 @@ FIND_BOB() Logic::findBob FIND_FRAME() Logic::findFrame FIND_GRAPHIC() Logic::graphicData FIND_SCALE() Logic::findScale -FIND_VERB() +FIND_VERB() Logic::findVerb LOOK() LOOK_ICON() LOOK_ITEM() @@ -300,7 +300,7 @@ SCREEN ====== changejoepal() Display::palSetJoe check_colors() Display::palCustomColors -dynalum() Display::dynalumUpdate +dynalum() Dynalum::update fadein() Display::palFadeIn fadeout() Display::palFadeOut flashspecial() Display::palCustomFlash |