diff options
| author | Gregory Montoir | 2003-11-15 15:44:50 +0000 |
|---|---|---|
| committer | Gregory Montoir | 2003-11-15 15:44:50 +0000 |
| commit | 308b5de8a67295418f3d870fb69083e60cc2b3f5 (patch) | |
| tree | 9aaa087eb8d9b190684d7ee303a484103e678454 /queen | |
| parent | aaa5631a9963b02a96d5f82187465433c6b2dd13 (diff) | |
| download | scummvm-rg350-308b5de8a67295418f3d870fb69083e60cc2b3f5.tar.gz scummvm-rg350-308b5de8a67295418f3d870fb69083e60cc2b3f5.tar.bz2 scummvm-rg350-308b5de8a67295418f3d870fb69083e60cc2b3f5.zip | |
fix some bugs :
- right-clicking on inventory item doesn't execute default action
- unapplied room light level when Joe enters a room
- updated comment in roomDisplay on palette fading problem
- during dialogue, invalid mouse-overs (added enum for joeWalk flag too)
preparing Journal stuff :
- add a (almost useless) useJournal method to Logic
- removed useless code in Graphics, as it should (and could) be easily re-written in a more OO way
svn-id: r11299
Diffstat (limited to 'queen')
| -rw-r--r-- | queen/command.cpp | 37 | ||||
| -rw-r--r-- | queen/defs.h | 8 | ||||
| -rw-r--r-- | queen/display.cpp | 6 | ||||
| -rw-r--r-- | queen/display.h | 2 | ||||
| -rw-r--r-- | queen/graphics.cpp | 59 | ||||
| -rw-r--r-- | queen/graphics.h | 4 | ||||
| -rw-r--r-- | queen/logic.cpp | 34 | ||||
| -rw-r--r-- | queen/logic.h | 8 | ||||
| -rw-r--r-- | queen/talk.cpp | 9 | ||||
| -rw-r--r-- | queen/walk.cpp | 4 |
10 files changed, 71 insertions, 100 deletions
diff --git a/queen/command.cpp b/queen/command.cpp index 969cd652e0..ce169bd505 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -373,9 +373,7 @@ void Command::executeCurrentAction(bool walk) { // l.419-452 execute.c switch (com->specialSection) { case 1: - // XXX l.428-438 - warning("Command::executeCurrentAction() - Journal unimplemented"); - // XXX if(DEMO) SPEAK("This is a demo, so I can't load or save games*14", "JOE", ""); + _logic->useJournal(); return; case 2: _logic->joeUseDress(true); @@ -443,8 +441,7 @@ void Command::updatePlayer() { if (!_input->keyVerb().isNone()) { if (_input->keyVerb().isJournal()) { - // XXX queen.c l.348-365 - warning("Command::updatePlayer() - Journal not yet implemented"); + _logic->useJournal(); } else if (!_input->keyVerb().isSkipText()) { _curCmd.verb = _input->keyVerb(); @@ -597,7 +594,7 @@ void Command::grabCurrentSelection() { // select without a command, do a WALK _logic->newRoom(0); // cancel makeJoeWalkTo, that should be equivalent to cr10 fix clear(true); - _logic->joeWalk(2); + _logic->joeWalk(JWM_EXECUTE); } } @@ -639,7 +636,7 @@ void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) if (_parse) { _curCmd.verb = Verb(VERB_NONE); - _logic->joeWalk(2); // set JOEWALK flag to perform EXECUTE_ACTION procedure + _logic->joeWalk(JWM_EXECUTE); _selCmd.action = _curCmd.action; _curCmd.action = Verb(VERB_NONE); } @@ -686,10 +683,10 @@ void Command::grabSelectedItem() { _curCmd.verb = Verb(VERB_NONE); } else { - if (_logic->joeWalk() == 1) { + if (_logic->joeWalk() == JWM_MOVE) { _cmdText.clear(); _curCmd.commandLevel = 1; - _logic->joeWalk(0); + _logic->joeWalk(JWM_NORMAL); _curCmd.action = Verb(VERB_NONE); lookCurrentIcon(); } @@ -713,12 +710,15 @@ void Command::grabSelectedItem() { else { _curCmd.verb = findDefault(item, true); } - if (!_curCmd.verb.isNone()) { + if (_curCmd.verb.isNone()) { // No match made, so command not yet completed. Redefine as LOOK AT - _curCmd.verb = Verb(VERB_LOOK_AT); + _curCmd.action = Verb(VERB_LOOK_AT); _cmdText.setVerb(Verb(VERB_LOOK_AT)); } - _curCmd.action = _curCmd.verb; + else { + _curCmd.action = _curCmd.verb; + } + _curCmd.verb = Verb(VERB_NONE); } } @@ -740,7 +740,7 @@ void Command::grabSelectedNoun() { // selected a turned off object, so just walk _curCmd.noun = 0; clear(true); - _logic->joeWalk(2); + _logic->joeWalk(JWM_EXECUTE); return; } @@ -787,8 +787,7 @@ void Command::grabSelectedNoun() { else { _curCmd.verb = findDefault(objNum, false); } - - if (_curCmd.verb.value() == VERB_NONE) { + if (_curCmd.verb.isNone()) { _curCmd.action = Verb(VERB_WALK_TO); _cmdText.setVerb(Verb(VERB_WALK_TO)); } @@ -824,8 +823,8 @@ void Command::grabSelectedVerb() { } else { _selCmd.defaultVerb = Verb(VERB_NONE); - if (_logic->joeWalk() == 1 && !_curCmd.verb.isNone()) { - _logic->joeWalk(0); + if (_logic->joeWalk() == JWM_MOVE && !_curCmd.verb.isNone()) { + _logic->joeWalk(JWM_NORMAL); } _curCmd.commandLevel = 1; _curCmd.oldVerb = Verb(VERB_NONE); @@ -1510,7 +1509,7 @@ void Command::lookCurrentRoom() { _curCmd.noun = _logic->findObjectUnderCursor(_input->mousePosX(), _input->mousePosY()); - if (_logic->joeWalk() == 1) { + if (_logic->joeWalk() == JWM_MOVE) { return; } @@ -1589,7 +1588,7 @@ void Command::lookCurrentRoom() { void Command::lookCurrentIcon() { _curCmd.verb = _logic->findVerbUnderCursor(_input->mousePosX(), _input->mousePosY()); - if (_curCmd.verb != _curCmd.oldVerb && _logic->joeWalk() != 1) { + if (_curCmd.verb != _curCmd.oldVerb && _logic->joeWalk() != JWM_MOVE) { if (_curCmd.action.isNone()) { _cmdText.clear(); diff --git a/queen/defs.h b/queen/defs.h index ad41c4f541..6b35f12390 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -283,6 +283,14 @@ enum StateUse { }; +enum JoeWalkMode { + JWM_NORMAL = 0, + JWM_MOVE = 1, + JWM_EXECUTE = 2, + JWM_SPEAK = 3 +}; + + } // End of namespace Queen #endif diff --git a/queen/display.cpp b/queen/display.cpp index c5fe3a9525..71df588c60 100644 --- a/queen/display.cpp +++ b/queen/display.cpp @@ -256,12 +256,14 @@ void Display::palSetJoe(JoePalette pal) { } -void Display::palFadeIn(int start, int end, uint16 roomNum) { +void Display::palFadeIn(int start, int end, uint16 roomNum, bool dynalum, int16 dynaX, int16 dynaY) { debug(9, "Display::palFadeIn(%d, %d)", start, end); memcpy(_pals.screen, _pals.room, 256 * 3); if (roomNum < 90 || (roomNum > 94 && roomNum < 114)) { - // XXX dynalum(); + if (dynalum) { + dynalumUpdate(dynaX, dynaY); + } int n = end - start + 1; uint8 tempPal[256 * 3]; int i; diff --git a/queen/display.h b/queen/display.h index 7ca97bc5e6..a6aebe7920 100644 --- a/queen/display.h +++ b/queen/display.h @@ -73,7 +73,7 @@ public: void palConvert(uint8 *outPal, const uint8 *inPal, int start, int end); void palSet(const uint8 *pal, int start, int end, bool updateScreen = false); void palSetJoe(JoePalette pal); // changejoepal - void palFadeIn(int start, int end, uint16 roomNum); + void palFadeIn(int start, int end, uint16 roomNum, bool dynalum, int16 dynaX, int16 dynaY); void palFadeOut(int start, int end, uint16 roomNum); void palFadePanel(); void palScroll(int start, int end); diff --git a/queen/graphics.cpp b/queen/graphics.cpp index 42a744cfe9..19b57aacde 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -765,65 +765,6 @@ void Graphics::loadPanel() { } -void Graphics::useJournal(GameConfig *cfg) { - - bobClearAll(); - loadBackdrop("journal.pcx", 160); - _display->palFadeOut(0, 255, 160); - - // load and unpack journal frames - frameEraseAll(false); - bankLoad("journal.BBK", 8); - int i; - for(i = 1; i <= 20; ++i) { - bankUnpack(i, FRAMES_JOURNAL + i, 8); - // set hot spots to zero - _frames[FRAMES_JOURNAL + i].xhotspot = 0; - _frames[FRAMES_JOURNAL + i].yhotspot = 0; - } - // adjust info box hot spot to put it on top always - _frames[FRAMES_JOURNAL + 20].yhotspot = 200; - bankErase(8); - - // XXX setup zones - - journalBobPreDraw(cfg); - _display->palFadeIn(0, 255, 160); - - // XXX l.1191-1509 -} - - -void Graphics::journalBobSetup(uint32 bobnum, uint16 x, uint16 y, uint16 frameNum) -{ - BobSlot *pbs = &_bobs[bobnum]; - pbs->active = true; - pbs->x = x; - pbs->y = y; - pbs->frameNum = FRAMES_JOURNAL + frameNum; - pbs->box.y2 = GAME_SCREEN_HEIGHT - 1; -} - - -void Graphics::journalBobPreDraw(GameConfig *cfg) { - - journalBobSetup(1, 32, 8, 1); // Review entry - journalBobSetup(2, 32, 56, 2); // Make entry - journalBobSetup(3, 32, 104, 1); // Close book - journalBobSetup(4, 32, 152, 3); // Give up - journalBobSetup(5, 136 + cfg->talkSpeed * 4 - 4, 164, 18); // Text speed - journalBobSetup(6, 221, 155, 16); // SFX on/off - _bobs[6].active = cfg->sfxToggle; - journalBobSetup(7, 136 + cfg->musicVolume * 130 / 100 - 4, 177, 19); // Music volume - journalBobSetup(10, 158, 155, 16); // Voice on/off - _bobs[10].active = cfg->speechToggle; - journalBobSetup(11, 125, 167, 16); // Text on/off - _bobs[11].active = cfg->textToggle; - journalBobSetup(12, 125, 181, 16); // Music on/off - _bobs[12].active = cfg->musicToggle; -} - - void Graphics::initCarBamScene() { bobClear(5); diff --git a/queen/graphics.h b/queen/graphics.h index 09762e2e6d..3d18228160 100644 --- a/queen/graphics.h +++ b/queen/graphics.h @@ -183,10 +183,6 @@ public: void loadBackdrop(const char *name, uint16 room); void loadPanel(); - void useJournal(GameConfig *cfg); - void journalBobSetup(uint32 bobnum, uint16 x, uint16 y, uint16 frame); - void journalBobPreDraw(GameConfig *cfg); - void cameraBob(int bobNum) { _cameraBob = bobNum; } int cameraBob() const { return _cameraBob; } diff --git a/queen/logic.cpp b/queen/logic.cpp index e9bf01dc19..8977eae350 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -663,7 +663,7 @@ void Logic::joeY(uint16 y) { _joe.y = y; } -void Logic::joeWalk(uint16 walking) { +void Logic::joeWalk(JoeWalkMode walking) { _joe.walk = walking; } @@ -1221,15 +1221,19 @@ void Logic::roomDisplay(const char* room, RoomDisplayMode mode, uint16 scale, in if (mode != RDM_FADE_NOJOE) { pod = joeSetupInRoom(mode != RDM_FADE_JOE_XY, scale); } - // FIXME: commented for now, to avoid color glitches when - // switching rooms during cutaway + // FIXME: for now, always display room even if mode tells us + // to not do so. This is necessary as actual Cutaway code + // doesn't do any of the needed palFadeIn() calls. The only + // noticeable problem is the initial display of the pinnacle + // room which is faded 2 times. // if (mode != RDM_NOFADE_JOE) { update(); + BobSlot *joe = _graphics->bob(0); if (_currentRoom >= 114) { - _display->palFadeIn(0, 255, _currentRoom); + _display->palFadeIn(0, 255, _currentRoom, joe->active, joe->x, joe->y); } else { - _display->palFadeIn(0, 223, _currentRoom); + _display->palFadeIn(0, 223, _currentRoom, joe->active, joe->x, joe->y); } // } if (pod != NULL) { @@ -2261,7 +2265,7 @@ void Logic::handlePinnacleRoom() { joe->animating = piton->animating = false; update(); - _display->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE); + _display->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE, joe->active, joe->x, joe->y); _entryObj = 0; uint16 prevObj = 0; @@ -2537,5 +2541,23 @@ void Logic::sceneStop() { zoneSetupPanel(); } + +void Logic::useJournal() { + + warning("Journal unimplemented"); + if (_resource->isDemo()) { + Talk::speak("This is a demo, so I can't load or save games*14", NULL, "", _graphics, _input, this, _resource, _sound); + } + else { + // FIXME: add Journal code, suggestion : + // (execute.c l.428-437 & queen.c l.350-365) + // save some vars + // Journal j(this, _graphics...); + // j.run(); + // restore vars + } +} + + } // End of namespace Queen diff --git a/queen/logic.h b/queen/logic.h index ab5dda3e7d..e183efabbe 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -172,14 +172,14 @@ public: uint16 joeFacing() { return _joe.facing; } uint16 joeX() { return _joe.x; } uint16 joeY() { return _joe.y; } - uint16 joeWalk() { return _joe.walk; } + JoeWalkMode joeWalk() { return _joe.walk; } uint16 joeScale() { return _joe.scale; } uint16 joePrevFacing() { return _joe.prevFacing; } void joeFacing(uint16 dir); void joeX(uint16 x); void joeY(uint16 y); - void joeWalk(uint16 walking); + void joeWalk(JoeWalkMode walking); void joeScale(uint16 scale); void joePrevFacing(uint16 dir); @@ -304,6 +304,8 @@ public: void update(); + void useJournal(); + bool gameSave(uint16 slot, const char *desc); bool gameLoad(uint16 slot); @@ -409,7 +411,7 @@ protected: struct { uint16 x, y; uint16 facing, prevFacing; - uint16 walk; + JoeWalkMode walk; uint16 scale; } _joe; diff --git a/queen/talk.cpp b/queen/talk.cpp index 692b5f1c17..f56ae1fe64 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -355,7 +355,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { } _talkHead = false; - _logic->joeWalk(0); + _logic->joeWalk(JWM_NORMAL); } void Talk::disableSentence(int oldLevel, int selectedSentence) { @@ -603,6 +603,8 @@ bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePref Person joe_person; ActorData joe_actor; + _logic->joeWalk(JWM_SPEAK); + if (!person) { // Fill in values for use by speakSegment() etc. memset(&joe_person, 0, sizeof(Person)); @@ -865,7 +867,7 @@ void Talk::defaultAnimation( else _logic->update(); - if (_logic->joeWalk() == 3) { + if (_logic->joeWalk() == JWM_SPEAK) { if (_input->talkQuit()) break; @@ -876,8 +878,7 @@ void Talk::defaultAnimation( break; _logic->checkPlayer(); - - if (_logic->joeWalk() == 2) + if (_logic->joeWalk() == JWM_EXECUTE) // Selected a command, so exit break; } diff --git a/queen/walk.cpp b/queen/walk.cpp index 56fc5cb869..36da69c4ee 100644 --- a/queen/walk.cpp +++ b/queen/walk.cpp @@ -142,7 +142,7 @@ bool Walk::animateJoe() { pbs->speed = 1; } _logic->checkPlayer(); - if (_logic->joeWalk() == 2) { // XXX || cutQuit + if (_logic->joeWalk() == JWM_EXECUTE) { // XXX || cutQuit // we are about to do something else, so stop walking interrupted = true; pbs->moving = false; @@ -299,7 +299,7 @@ int16 Walk::joeMove(int direction, int16 endx, int16 endy, bool inCutaway) { uint16 oldx = _graphics->bob(0)->x; uint16 oldy = _graphics->bob(0)->y; - _logic->joeWalk(1); + _logic->joeWalk(JWM_MOVE); uint16 oldPos = _logic->zoneInArea(ZONE_ROOM, oldx, oldy); uint16 newPos = _logic->zoneInArea(ZONE_ROOM, endx, endy); |
