From deb4261b6ab3bc2afd6c174dc9f224432ef748d8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Dec 2017 16:31:27 -0500 Subject: XEEN: Fix rendering of game screen on startup --- engines/xeen/window.cpp | 8 ++++++-- engines/xeen/window.h | 5 +++++ engines/xeen/worldofxeen/worldofxeen_menu.cpp | 8 ++++++++ engines/xeen/worldofxeen/worldofxeen_menu.h | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) (limited to 'engines/xeen') diff --git a/engines/xeen/window.cpp b/engines/xeen/window.cpp index ef3fedeec2..78e8df32e0 100644 --- a/engines/xeen/window.cpp +++ b/engines/xeen/window.cpp @@ -136,7 +136,7 @@ void Window::setBounds(const Common::Rect &r) { void Window::open() { Screen &screen = *g_vm->_screen; - if (!_enabled) { + if (!_enabled && !isFullScreen()) { // Save a copy of the area under the window _savedArea.create(_bounds.width(), _bounds.height()); _savedArea.copyRectToSurface(screen, 0, 0, _bounds); @@ -163,7 +163,7 @@ void Window::open() { void Window::close() { Screen &screen = *g_vm->_screen; - if (_enabled) { + if (_enabled && !isFullScreen()) { // Update the window update(); @@ -258,4 +258,8 @@ void Window::drawList(DrawStruct *items, int count) { } } +bool Window::isFullScreen() const { + return _bounds.width() == SCREEN_WIDTH && _bounds.height() == SCREEN_HEIGHT; +} + } // End of namespace Xeen diff --git a/engines/xeen/window.h b/engines/xeen/window.h index 0594a9946d..2389065300 100644 --- a/engines/xeen/window.h +++ b/engines/xeen/window.h @@ -86,6 +86,11 @@ private: int _border; int _xLo, _xHi; int _ycL, _ycH; +private: + /** + * Returns true if the window is covering the entire screen + */ + bool isFullScreen() const; public: bool _enabled; public: diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp index 54cde36d46..b58bf64dc0 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp @@ -95,14 +95,17 @@ void WorldOfXeenMenu::execute() { if (key == 27) { // Hide the options menu + closeWindow(); break; } else if (key == 'C' || key == 'V') { // Show credits + closeWindow(); CreditsScreen::show(_vm); break; } else if (key == 'S') { // Start new game WOX_VM._pendingAction = WOX_PLAY_GAME; + closeWindow(); return; } } @@ -213,6 +216,11 @@ void WorldOptionsMenu::openWindow() { windows[GAME_WINDOW].open(); } +void WorldOptionsMenu::closeWindow() { + Windows &windows = *_vm->_windows; + windows[GAME_WINDOW].close(); +} + void WorldOptionsMenu::showContents(SpriteResource &title1, bool waitFlag) { EventsManager &events = *_vm->_events; Screen &screen = *_vm->_screen; diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.h b/engines/xeen/worldofxeen/worldofxeen_menu.h index 49553dd10f..39d309c751 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.h +++ b/engines/xeen/worldofxeen/worldofxeen_menu.h @@ -45,7 +45,15 @@ protected: virtual void setupButtons(SpriteResource *buttons); + /** + * Opens the menu window + */ virtual void openWindow() {} + + /** + * Closes the menu window + */ + virtual void closeWindow() {} public: virtual ~WorldOfXeenMenu() {} @@ -82,8 +90,16 @@ protected: virtual void setupButtons(SpriteResource *buttons); + /** + * Opens the menu window + */ virtual void openWindow(); + /** + * Closes the menu window + */ + virtual void closeWindow(); + virtual void showContents(SpriteResource &title1, bool mode); public: WorldOptionsMenu(XeenEngine *vm) : DarkSideOptionsMenu(vm), _bgFrame(0) {} -- cgit v1.2.3