From 730fd27a19315234166dfb1dec324d433b1ffef3 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Fri, 14 Nov 2003 14:35:52 +0000 Subject: rewitten fullscreen/panel switching code svn-id: r11296 --- queen/cutaway.cpp | 20 ++++++++++++++++---- queen/display.cpp | 30 +++++++++++------------------- queen/display.h | 5 +---- queen/logic.cpp | 14 +++++++------- queen/logic.h | 4 ++-- queen/talk.cpp | 9 ++------- 6 files changed, 39 insertions(+), 43 deletions(-) (limited to 'queen') diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index 9e1f820535..c19d8b72ce 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -1204,8 +1204,18 @@ void Cutaway::run(char *nextFilename) { _initialRoom = _temporaryRoom = _logic->currentRoom(); - if (_comPanel == 0 || _comPanel == 2) - _logic->sceneStart(false); + // FIXME: hack to hide the panel *before* displaying a talking head. + // This was not handled in the original game, but I think it is + // better like that. + if (_talkTo != 0) { + _comPanel = 2; + } + + _logic->display()->screenMode(_comPanel, true); + + if (_comPanel == 0 || _comPanel == 2) { + _logic->sceneStart(); + } byte *ptr = _objectData; @@ -1308,11 +1318,13 @@ void Cutaway::run(char *nextFilename) { talk(nextFilename); if (_comPanel == 0 || (_comPanel == 2 && !_anotherCutaway)) { - _logic->sceneStop(true); + _logic->sceneStop(); _comPanel = 0; } if (nextFilename[0] == '\0' && !_anotherCutaway) { + _logic->display()->fullscreen(false); + // Lines 2138-2182 in cutaway.c if (_finalRoom) { _logic->newRoom(0); @@ -1340,12 +1352,12 @@ void Cutaway::run(char *nextFilename) { // instead debug(0, "[Cutaway::run] Not calling SETUP_ROOM here, just setting newRoom to %i", _initialRoom); _logic->newRoom(_initialRoom); + _logic->display()->fullscreen(true); } } // XXX CUTJOEF=0; _comPanel = 0; - _logic->display()->fullscreen(false); // XXX some string animations int k = 0; diff --git a/queen/display.cpp b/queen/display.cpp index 045e40fc9e..c5fe3a9525 100644 --- a/queen/display.cpp +++ b/queen/display.cpp @@ -621,37 +621,29 @@ void Display::palCustomFlash() { void Display::screenMode(int comPanel, bool inCutaway) { + debug(0, "Display::screenMode(%d, %d)", comPanel, inCutaway); + + // FIXME: this is temporary, just to see if my theory is right + if (comPanel == 2 && !inCutaway) { + warning("Display::screenMode() - (comPanel == 2 && !inCutaway)"); + } + if (comPanel == 2 && inCutaway) { - if (_bdHeight == GAME_SCREEN_HEIGHT) { - _fullscreen = true; - _panel = false; - } - else { - _fullscreen = false; - _panel = true; - } + _fullscreen = (_bdHeight == GAME_SCREEN_HEIGHT); } - else { - _fullscreen = 0; - if (comPanel == 1) { - _panel = true; - } + else if (comPanel == 1) { + _fullscreen = false; } } void Display::prepareUpdate() { - if (_panel) { + if (!_fullscreen) { // draw the panel memcpy(_buffers[RB_SCREEN] + _bufPitch[RB_SCREEN] * ROOM_ZONE_HEIGHT, _buffers[RB_PANEL], PANEL_W * PANEL_H); } - else if (!_fullscreen) { - // clear the panel - memset(_buffers[RB_SCREEN] + _bufPitch[RB_SCREEN] * ROOM_ZONE_HEIGHT, - 0, PANEL_W * PANEL_H); - } // draw the backdrop bitmap int i; diff --git a/queen/display.h b/queen/display.h index de27997097..7ca97bc5e6 100644 --- a/queen/display.h +++ b/queen/display.h @@ -101,11 +101,9 @@ public: void horizontalScroll(int16 scroll); int16 horizontalScroll() const { return _horizontalScroll; } - void fullscreen(bool fs) { _fullscreen = fs; } + void fullscreen(bool fs) { debug(0, "Display::fullscreen(%d)", fs); _fullscreen = fs; } bool fullscreen() const { return _fullscreen; } - void panel(bool on) { _panel = on; } - void handleTimer(); void waitForTimer(); @@ -140,7 +138,6 @@ private: uint16 _bufPitch[3]; bool _fullscreen; - bool _panel; uint16 _horizontalScroll; uint16 _bdWidth, _bdHeight; diff --git a/queen/logic.cpp b/queen/logic.cpp index 614d3af050..14f0d6288c 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1835,7 +1835,9 @@ void Logic::dialogue(const char *dlgFile, int personInRoom, char *cutaway) { if (cutaway == NULL) { cutaway = cutawayFile; } + _display->fullscreen(true); Talk::talk(dlgFile, personInRoom, cutaway, _graphics, _input, this, _resource, _sound); + _display->fullscreen(false); } @@ -2507,21 +2509,20 @@ bool Logic::gameLoad(uint16 slot) { return true; } -void Logic::sceneStart(bool showMouseCursor) { +void Logic::sceneStart() { debug(0, "[Logic::sceneStart] _scene = %i", _scene); _scene++; - _display->mouseCursorShow(showMouseCursor); + _display->mouseCursorShow(false); - if (1 == _scene && _input->cutawayRunning()) { - _display->panel(true); + if (1 == _scene) { // && _input->cutawayRunning()) { // sceneStart is always called when cutaway is running _display->palFadePanel(); } update(); } -void Logic::sceneStop(bool showMouseCursor) { +void Logic::sceneStop() { debug(0, "[Logic::sceneStop] _scene = %i", _scene); _scene--; @@ -2529,8 +2530,7 @@ void Logic::sceneStop(bool showMouseCursor) { return; _display->palSetAllDirty(); - _display->panel(true); - _display->mouseCursorShow(showMouseCursor); + _display->mouseCursorShow(true); zoneSetupPanel(); } diff --git a/queen/logic.h b/queen/logic.h index 751641a435..ab5dda3e7d 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -288,10 +288,10 @@ public: void sceneReset() { _scene = 0; } //! Make a scene - void sceneStart(bool showMouseCursor); + void sceneStart(); //! Stop making a scene - void sceneStop(bool showMouseCursor); + void sceneStop(); //! Copy data from dummy object to object void objectCopy(int dummyObjectIndex, int objectIndex); diff --git a/queen/talk.cpp b/queen/talk.cpp index 646fe4946f..692b5f1c17 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -116,10 +116,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { // XXX SPEAK(JOE_RESPstr[k],"JOE",find_cd_desc(k)); // XXX return; // XXX } - // XXX panelflag=0; - - _wasFullscren = _logic->display()->fullscreen(); - _logic->display()->fullscreen(true); load(filename); @@ -353,7 +349,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { pbs->x = person.actor->x; pbs->y = person.actor->y; - _logic->display()->fullscreen(_wasFullscren); // Better kick start the persons anim sequence pbs->animating = true; pbs->animReset(); @@ -623,8 +618,8 @@ bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePref person = &joe_person; } - debug(0, "Sentence '%s' is said by person '%s' and voice files with prefix '%s' played", - sentence, person->name, voiceFilePrefix); + //debug(0, "Sentence '%s' is said by person '%s' and voice files with prefix '%s' played", + // sentence, person->name, voiceFilePrefix); if (sentence[0] == '\0') { goto exit; -- cgit v1.2.3