diff --git a/engines/stark/gfx/renderentry.cpp b/engines/stark/gfx/renderentry.cpp index f2110158da4..f38fa9a2f18 100644 --- a/engines/stark/gfx/renderentry.cpp +++ b/engines/stark/gfx/renderentry.cpp @@ -194,10 +194,16 @@ bool RenderEntry::intersectRay(const Math::Ray &ray) const { } VisualImageXMG *RenderEntry::getImage() const { + if (!_visual) { + return nullptr; + } return _visual->get(); } VisualText *RenderEntry::getText() const { + if (!_visual) { + return nullptr; + } return _visual->get(); } diff --git a/engines/stark/ui/cursor.cpp b/engines/stark/ui/cursor.cpp index e975fb29e18..663c7138c6c 100644 --- a/engines/stark/ui/cursor.cpp +++ b/engines/stark/ui/cursor.cpp @@ -76,6 +76,12 @@ void Cursor::setFading(bool fading) { _fading = fading; } +void Cursor::onScreenChanged() { + if (_mouseText) { + _mouseText->resetTexture(); + } +} + void Cursor::updateFadeLevel() { if (_fading) { if (_fadeLevelIncreasing) { diff --git a/engines/stark/ui/cursor.h b/engines/stark/ui/cursor.h index 02271659d4a..1d544107ac5 100644 --- a/engines/stark/ui/cursor.h +++ b/engines/stark/ui/cursor.h @@ -52,6 +52,9 @@ public: /** Make cycle the cursor's brightness */ void setFading(bool fading); + /** Update when the screen resolution has changed */ + void onScreenChanged(); + Common::Point getMousePosition(bool unscaled = false) const; enum CursorType { diff --git a/engines/stark/ui/world/gamescreen.cpp b/engines/stark/ui/world/gamescreen.cpp index a0dc12b0477..991919514f3 100644 --- a/engines/stark/ui/world/gamescreen.cpp +++ b/engines/stark/ui/world/gamescreen.cpp @@ -122,8 +122,10 @@ void GameScreen::dispatchEvent(WindowHandler handler) { } void GameScreen::onScreenChanged() { + _cursor->onScreenChanged(); _dialogPanel->onScreenChanged(); _topMenu->onScreenChanged(); + _gameWindow->onScreenChanged(); } void GameScreen::notifyInventoryItemEnabled(uint16 itemIndex) { diff --git a/engines/stark/ui/world/gamewindow.cpp b/engines/stark/ui/world/gamewindow.cpp index 82139d00e09..31eba32b184 100644 --- a/engines/stark/ui/world/gamewindow.cpp +++ b/engines/stark/ui/world/gamewindow.cpp @@ -41,6 +41,8 @@ #include "engines/stark/ui/world/actionmenu.h" #include "engines/stark/ui/world/inventorywindow.h" +#include "engines/stark/visual/text.h" + namespace Stark { GameWindow::GameWindow(Gfx::Driver *gfx, Cursor *cursor, ActionMenu *actionMenu, InventoryWindow *inventory) : @@ -238,4 +240,25 @@ void GameWindow::reset() { _objectRelativePosition.y = 0; } +void GameWindow::onScreenChanged() { + // May be called when resources have not been loaded + if (!StarkGlobal->getCurrent()) { + return; + } + + Resources::Location *location = StarkGlobal->getCurrent()->getLocation(); + _renderEntries = location->listRenderEntries(); + + VisualText *text = nullptr; + Gfx::RenderEntryArray::iterator element = _renderEntries.begin(); + while (element != _renderEntries.end()) { + text = (*element)->getText(); + if (text) { + text->resetTexture(); + } + + element++; + } +} + } // End of namespace Stark diff --git a/engines/stark/ui/world/gamewindow.h b/engines/stark/ui/world/gamewindow.h index d89d51c475c..19d7c24d567 100644 --- a/engines/stark/ui/world/gamewindow.h +++ b/engines/stark/ui/world/gamewindow.h @@ -45,6 +45,9 @@ public: /** Clear the location dependent state */ void reset(); + /** Update when the screen resolution has changed */ + void onScreenChanged(); + protected: void onMouseMove(const Common::Point &pos) override; void onClick(const Common::Point &pos) override;