diff options
author | Paul Gilbert | 2013-10-24 22:42:46 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-10-24 22:42:46 -0400 |
commit | a59b4cbc9d1d308121250fa52eeafce8ef763ea9 (patch) | |
tree | 24aeab41cc976146c18362b8364699e445861106 /engines | |
parent | 514f93b57fff606be8ccb2151199a5c3703b50a6 (diff) | |
download | scummvm-rg350-a59b4cbc9d1d308121250fa52eeafce8ef763ea9.tar.gz scummvm-rg350-a59b4cbc9d1d308121250fa52eeafce8ef763ea9.tar.bz2 scummvm-rg350-a59b4cbc9d1d308121250fa52eeafce8ef763ea9.zip |
TSAGE: Add in R2R screen border to scenes showing the user interface
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/graphics.cpp | 24 | ||||
-rw-r--r-- | engines/tsage/graphics.h | 1 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 3 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 12 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.cpp | 12 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.cpp | 6 | ||||
-rw-r--r-- | engines/tsage/user_interface.cpp | 18 | ||||
-rw-r--r-- | engines/tsage/user_interface.h | 2 |
8 files changed, 54 insertions, 24 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 2395cc67ed..0e2d9ae705 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -591,20 +591,24 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi Graphics::Surface srcSurface = srcImage.lockSurface(); Graphics::Surface destSurface = lockSurface(); + // Get clipping area + Rect clipRect = !_clipRect.isEmpty() ? _clipRect : + Rect(0, 0, destSurface.w, destSurface.h); + // Adjust bounds to ensure destination will be on-screen int srcX = 0, srcY = 0; - if (destBounds.left < 0) { - srcX = -destBounds.left; - destBounds.left = 0; + if (destBounds.left < clipRect.left) { + srcX = clipRect.left - destBounds.left; + destBounds.left = clipRect.left; } - if (destBounds.top < 0) { - srcY = -destBounds.top; - destBounds.top = 0; + if (destBounds.top < clipRect.top) { + srcY = clipRect.top - destBounds.top; + destBounds.top = clipRect.top; } - if (destBounds.right > destSurface.w) - destBounds.right = destSurface.w; - if (destBounds.bottom > destSurface.h) - destBounds.bottom = destSurface.h; + if (destBounds.right > clipRect.right) + destBounds.right = clipRect.right; + if (destBounds.bottom > clipRect.bottom) + destBounds.bottom = clipRect.bottom; if (destBounds.isValidRect() && !((destBounds.right < 0) || (destBounds.bottom < 0) || (destBounds.left >= destSurface.w) || (destBounds.top >= destSurface.h))) { diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 7239a99a68..8d9c4d31b1 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -88,6 +88,7 @@ private: public: Common::Point _centroid; int _transColor; + Rect _clipRect; public: GfxSurface(); GfxSurface(const GfxSurface &s); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 8e5537f2d1..96a145a74a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -342,6 +342,9 @@ SceneExt::SceneExt(): Scene() { _savedCanWalk = false; _preventSaving = false; + // Reset screen clipping area + R2_GLOBALS._screenSurface._clipRect = Rect(); + // WORKAROUND: In the original, playing animations don't reset the global _animationCtr // counter as scene changes unless the playing animation explicitly finishes. For now, // to make inter-scene debugging easier, I'm explicitly resetting the _animationCtr diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 5e4b4e4191..9e6e7d5ce1 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1425,6 +1425,7 @@ Scene160::Scene160(): SceneExt() { void Scene160::postInit(SceneObjectList *OwnerList) { loadScene(4001); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); R2_GLOBALS._player._uiEnabled = false; @@ -2344,8 +2345,9 @@ Scene205::Scene205(): SceneExt() { void Scene205::postInit(SceneObjectList *OwnerList) { loadScene(4000); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player._uiEnabled = false; R2_GLOBALS._sound1.play(337); @@ -2606,11 +2608,11 @@ void Scene250::synchronize(Serializer &s) { void Scene250::postInit(SceneObjectList *OwnerList) { loadScene(250); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player.postInit(); - R2_GLOBALS._uiElements._active = false; R2_GLOBALS._player.setVisage(10); R2_GLOBALS._player.hide(); R2_GLOBALS._player.enableControl(); @@ -6954,11 +6956,11 @@ Scene825::Scene825(): SceneExt() { void Scene825::postInit(SceneObjectList *OwnerList) { loadScene(825); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player.postInit(); - R2_GLOBALS._uiElements._active = false; R2_GLOBALS._player._effect = 0; R2_GLOBALS._player.setVisage(10); R2_GLOBALS._player.hide(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 0932c70f04..ba2ee28fc3 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -479,9 +479,9 @@ void Scene1000::dispatch() { void Scene1010::postInit(SceneObjectList *OwnerList) { loadScene(1010); - SceneExt::postInit(); - R2_GLOBALS._interfaceY = 200; R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; setZoomPercents(100, 1, 160, 100); R2_GLOBALS._player.postInit(); @@ -540,14 +540,14 @@ void Scene1010::signal() { void Scene1020::postInit(SceneObjectList *OwnerList) { loadScene(1020); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); if (R2_GLOBALS._sceneManager._previousScene == 1010) _sceneBounds = Rect(160, 0, SCREEN_WIDTH + 160, 200); - R2_GLOBALS._interfaceY = 200; + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._v558B6.set(160, 0, 160, 161); - R2_GLOBALS._uiElements._active = false; R2_GLOBALS._player.postInit(); if (R2_GLOBALS._sceneManager._previousScene == 1010) { @@ -4307,12 +4307,12 @@ void Scene1337::postInit(SceneObjectList *OwnerList) { // In the original, may be found in subPostInit. // Without it, enableControl asserts loadScene(1330); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); // // Hide the user interface - R2_GLOBALS._uiElements._active = false; - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 5cca1ee483..7109486501 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1661,8 +1661,8 @@ void Scene3275::signal() { void Scene3350::postInit(SceneObjectList *OwnerList) { loadScene(3350); - SceneExt::postInit(); R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); R2_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._sound2.play(310); @@ -3622,7 +3622,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { loadScene(1050); R2_GLOBALS._uiElements._active = false; - R2_GLOBALS._interfaceY = 200; + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._v5589E.set(0, 0, 320, 200); R2_GLOBALS._sound1.play(305); @@ -4941,8 +4941,8 @@ void Scene3600::dispatch() { void Scene3700::postInit(SceneObjectList *OwnerList) { loadScene(3700); - SceneExt::postInit(); R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); R2_GLOBALS._interfaceY = SCREEN_HEIGHT; _stripManager.setColors(60, 255); diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp index 09cc2fd56d..5cfc845ceb 100644 --- a/engines/tsage/user_interface.cpp +++ b/engines/tsage/user_interface.cpp @@ -276,11 +276,29 @@ void UICollection::draw() { Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT), Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT)); + if (g_vm->getGameID() == GType_Ringworld2) + r2rDrawFrame(); + _clearScreen = 1; g_globals->_sceneManager._scene->_sceneBounds = savedBounds; } } +void UICollection::r2rDrawFrame() { + Visage visage; + visage.setVisage(2, 1); + GfxSurface vertLine = visage.getFrame(1); + GfxSurface horizLine = visage.getFrame(2); + + GLOBALS._screenSurface.copyFrom(horizLine, 0, 0); + GLOBALS._screenSurface.copyFrom(vertLine, 0, 3); + GLOBALS._screenSurface.copyFrom(vertLine, SCREEN_WIDTH - 4, 3); + + // Restrict drawing area to exclude the borders at the edge of the screen + R2_GLOBALS._screenSurface._clipRect = Rect(4, 4, SCREEN_WIDTH - 4, + SCREEN_HEIGHT - 4); +} + /*--------------------------------------------------------------------------*/ UIElements::UIElements(): UICollection() { diff --git a/engines/tsage/user_interface.h b/engines/tsage/user_interface.h index d06dccd9a4..60cefc0751 100644 --- a/engines/tsage/user_interface.h +++ b/engines/tsage/user_interface.h @@ -95,6 +95,8 @@ public: }; class UICollection: public EventHandler { +private: + void r2rDrawFrame(); protected: void erase(); public: |