From 26e9cbccfe08d314f900292221f48fff53120daf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2011 22:49:14 +1100 Subject: TSAGE: Changed walk_regions debugger command to work in scrolling screens --- engines/tsage/debugger.cpp | 12 +++++++++++- engines/tsage/debugger.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index ff3f6e3031..52a1a5f877 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -36,6 +36,7 @@ Debugger::Debugger(): GUI::Debugger() { DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene)); DCmd_Register("walk_regions", WRAP_METHOD(Debugger, Cmd_WalkRegions)); + DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); } static int strToInt(const char *s) { @@ -93,7 +94,8 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { LineSliceSet sliceSet = wr.getLineSlices(yp); for (uint idx = 0; idx < sliceSet.items.size(); ++idx) - destSurface.hLine(sliceSet.items[idx].xs, yp, sliceSet.items[idx].xe, colour); + destSurface.hLine(sliceSet.items[idx].xs - _globals->_sceneOffset.x, yp, + sliceSet.items[idx].xe - _globals->_sceneOffset.x, colour); } } @@ -106,4 +108,12 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { return false; } +/** + * Give a specified item to the player + */ +bool Debugger::Cmd_Item(int argc, const char **argv) { + _globals->_inventory._infoDisk._sceneNumber = 1; + return true; +} + } // End of namespace tSage diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h index 94f4babc62..ffd7c3263a 100644 --- a/engines/tsage/debugger.h +++ b/engines/tsage/debugger.h @@ -39,6 +39,7 @@ public: protected: bool Cmd_Scene(int argc, const char **argv); bool Cmd_WalkRegions(int argc, const char **argv); + bool Cmd_Item(int argc, const char **argv); }; } // End of namespace tSage -- cgit v1.2.3 From 2ea302077c53cc10f456ce9e3416320c37cdadc4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2011 22:57:24 +1100 Subject: TSAGE: Bugfixes for player movement in wide-screen scenes --- engines/tsage/core.cpp | 10 ++++++---- engines/tsage/scenes.cpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 07548224ed..7749e89580 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2160,8 +2160,8 @@ void SceneObject::updateScreen() { if (srcRect.isValidRect()) { Rect destRect = srcRect; - destRect.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y); destRect.translate(-sceneBounds.left, -sceneBounds.top); + srcRect.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y); _globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface, srcRect, destRect); } @@ -2194,8 +2194,10 @@ void SceneObjectList::draw() { } else { // If there is a scroll follower, check whether it has moved off-screen if (_globals->_scrollFollower) { - const Common::Point &objPos = _globals->_scrollFollower->_position; const Rect &scrollerRect = _globals->_sceneManager._scrollerRect; + Common::Point objPos( + _globals->_scrollFollower->_position.x - _globals->_sceneManager._scene->_sceneBounds.left, + _globals->_scrollFollower->_position.y - _globals->_sceneManager._scene->_sceneBounds.top); int loadCount = 0; if (objPos.x >= scrollerRect.right) { @@ -2568,8 +2570,8 @@ void Player::process(Event &event) { (_position != event.mousePos) && _globals->_sceneObjects->contains(this)) { PlayerMover *newMover = new PlayerMover(); - Common::Point destPos(event.mousePos.x - _globals->_sceneManager._scene->_sceneBounds.left, - event.mousePos.y - _globals->_sceneManager._scene->_sceneBounds.top); + Common::Point destPos(event.mousePos.x + _globals->_sceneManager._scene->_sceneBounds.left, + event.mousePos.y + _globals->_sceneManager._scene->_sceneBounds.top); addMover(newMover, &destPos, NULL); event.handled = true; diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index e0ef87f66b..cc5ccb333a 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -344,10 +344,10 @@ void Scene::refreshBackground(int xAmount, int yAmount) { int yHalfOffset = (_backgroundBounds.height() / 100) == 3 ? 0 : _sceneBounds.top / 100; // Set the limits and increment amounts - int yInc = (xAmount < 0) ? -1 : 1; + int xInc = (xAmount < 0) ? -1 : 1; int xSection = (xAmount < 0) ? 15 : 0; int xSectionEnd = (xAmount < 0) ? -1 : 16; - int xInc = (yAmount < 0) ? -1 : 1; + int yInc = (yAmount < 0) ? -1 : 1; int ySection = (yAmount < 0) ? 15 : 0; int ySectionEnd = (yAmount < 0) ? -1 : 16; bool changedFlag = false; -- cgit v1.2.3 From 9dad957454f2d4f7e8c7949e46d252346fbdd66b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Mar 2011 22:58:36 +1100 Subject: TSAGE: Corrected background scrolling on wide-screen scenes --- engines/tsage/globals.cpp | 4 ++-- engines/tsage/globals.h | 2 +- engines/tsage/graphics.cpp | 4 ++-- engines/tsage/scenes.cpp | 50 ++++++++++++++++++++++++---------------------- engines/tsage/scenes.h | 1 - 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 11e8af1ffc..2bf47a3ed7 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -63,7 +63,7 @@ Globals::Globals(): _sceneObjects = &_sceneObjectsInstance; _sceneObjects_queue.push_front(_sceneObjects); - _stru_4642E = Common::Point(-1, -1); + _prevSceneOffset = Common::Point(-1, -1); _sceneListeners.push_back(&_soundHandler); _sceneListeners.push_back(&_sequenceManager._soundHandler); } @@ -95,7 +95,7 @@ void Globals::synchronise(Serialiser &s) { s.syncAsByte(_flags[i]); s.syncAsSint16LE(_sceneOffset.x); s.syncAsSint16LE(_sceneOffset.y); - s.syncAsSint16LE(_stru_4642E.x); s.syncAsSint16LE(_stru_4642E.y); + s.syncAsSint16LE(_prevSceneOffset.x); s.syncAsSint16LE(_prevSceneOffset.y); SYNC_POINTER(_scrollFollower); s.syncAsSint32LE(_stripNum); } diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 243fb1eae9..c06c073691 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -65,7 +65,7 @@ public: Region _paneRegions[2]; int _paneRefreshFlag[2]; Common::Point _sceneOffset; - Common::Point _stru_4642E; + Common::Point _prevSceneOffset; SceneObject *_scrollFollower; SequenceManager _sequenceManager; Common::RandomSource _randomSource; diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 93bb7ea63f..93ac9f07d7 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -405,8 +405,8 @@ void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf int screenNum = _globals->_sceneManager._scene->_activeScreenNumber; Rect updateRect(0, 0, 160, 100); updateRect.translate(xHalf * 160, yHalf * 100); - int xHalfCount = (dest.w + 159) / 160; - int yHalfCount = (dest.h + 99) / 100; + int xHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.right + 159) / 160; + int yHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.bottom + 99) / 100; if (xSection < xHalfCount && ySection < yHalfCount) { int rlbNum = xSection * yHalfCount + ySection; diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index cc5ccb333a..fab5afff71 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -167,8 +167,8 @@ void SceneManager::setBackSurface() { _globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT); _globals->_sceneManager._scrollerRect = Rect(0, 30, SCREEN_WIDTH, SCREEN_HEIGHT - 30); } else { - // Double-size size creation - _globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH * 2, SCREEN_HEIGHT); + // Wide screen needs extra space to allow for scrolling + _globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH * 3 / 2, SCREEN_HEIGHT); _globals->_sceneManager._scrollerRect = Rect(80, 0, SCREEN_WIDTH - 80, SCREEN_HEIGHT); } } else { @@ -235,7 +235,7 @@ void Scene::synchronise(Serialiser &s) { _oldSceneBounds.synchronise(s); for (int i = 0; i < 256; ++i) - s.syncAsSint16LE(_enabledSections[i]); + s.syncAsUint16LE(_enabledSections[i]); for (int i = 0; i < 256; ++i) s.syncAsSint16LE(_zoomPercents[i]); } @@ -325,10 +325,10 @@ void Scene::loadBackground(int xAmount, int yAmount) { if ((_backgroundBounds.height() / 100) == 3) _globals->_sceneOffset.y = 0; - if ((_globals->_sceneOffset.x != _globals->_stru_4642E.y) || - (_globals->_sceneOffset.y != _globals->_stru_4642E.y)) { + if ((_globals->_sceneOffset.x != _globals->_prevSceneOffset.x) || + (_globals->_sceneOffset.y != _globals->_prevSceneOffset.y)) { // Change has happend, so refresh background - _globals->_stru_4642E = _globals->_sceneOffset; + _globals->_prevSceneOffset = _globals->_sceneOffset; refreshBackground(xAmount, yAmount); } } @@ -345,35 +345,43 @@ void Scene::refreshBackground(int xAmount, int yAmount) { // Set the limits and increment amounts int xInc = (xAmount < 0) ? -1 : 1; - int xSection = (xAmount < 0) ? 15 : 0; + int xSectionStart = (xAmount < 0) ? 15 : 0; int xSectionEnd = (xAmount < 0) ? -1 : 16; int yInc = (yAmount < 0) ? -1 : 1; - int ySection = (yAmount < 0) ? 15 : 0; + int ySectionStart = (yAmount < 0) ? 15 : 0; int ySectionEnd = (yAmount < 0) ? -1 : 16; bool changedFlag = false; - for (int yp = ySection; yp < ySectionEnd; yp += yInc) { - for (int xp = xSection; xp < xSectionEnd; xp += xInc) { + for (int yp = ySectionStart; yp != ySectionEnd; yp += yInc) { + for (int xp = xSectionStart; xp != xSectionEnd; xp += xInc) { if ((yp < yHalfOffset) || (yp >= (yHalfOffset + yHalfCount)) || (xp < xHalfOffset) || (xp >= (xHalfOffset + xHalfCount))) { // Flag section as enabled _enabledSections[xp * 16 + yp] = 0xffff; } else { - // Check if the section is enabled - if (_enabledSections[xp * 16 + yp] || ((xAmount == 0) && (yAmount == 0))) { + // Check if the section is already loaded +// if (_enabledSections[xp * 16 + yp] || ((xAmount == 0) && (yAmount == 0))) { Graphics::Surface s = _backSurface.lockSurface(); GfxSurface::loadScreenSection(s, xp - xHalfOffset, yp - yHalfOffset, xp, yp); _backSurface.unlockSurface(); changedFlag = true; - } else { +/* } else { int yv = _enabledSections[xp * 16 + yp] == ((xp - xHalfOffset) << 4) ? 0 : 1; if (yv != (yp - yHalfOffset)) { - int xSectionTemp = _enabledSections[xp * 16 + yp] >> 4; - int ySectionTemp = _enabledSections[xp * 16 + yp] & 0xffff; - - reuseSection(xp - xHalfOffset, yp - yHalfOffset, xSectionTemp, ySectionTemp); + // Copy an existing 160x100 screen section previously loaded + int xSectionSrc = xp - xHalfOffset; + int ySectionSrc = yp - yHalfOffset; + int xSectionDest = _enabledSections[xp * 16 + yp] >> 4; + int ySectionDest = _enabledSections[xp * 16 + yp] & 0xffff; + + Rect srcBounds(xSectionSrc * 160, ySectionSrc * 100, + (xSectionSrc + 1) * 160, (ySectionSrc + 1) * 100); + Rect destBounds(xSectionDest * 160, ySectionDest * 100, + (xSectionDest + 1) * 160, (ySectionDest + 1) * 100); + + _backSurface.copyFrom(_backSurface, srcBounds, destBounds); } - } + }*/ _enabledSections[xp * 16 + yp] = ((xp - xHalfOffset) << 4) && (yp - yHalfOffset); @@ -386,12 +394,6 @@ void Scene::refreshBackground(int xAmount, int yAmount) { } } -void Scene::reuseSection(int xHalf, int yHalf, int xSection, int ySection) { -// Rect rect1, rect2, rect3; - - // TODO: Figure out purpose -} - void Scene::signalListeners() { // TODO: Figure out method } diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 80030230e8..2295da0074 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -36,7 +36,6 @@ namespace tSage { class Scene: public StripCallback { private: - void reuseSection(int xHalf, int yHalf, int xSection, int ySection); void signalListeners(); public: int _field12; -- cgit v1.2.3 From 8246758e7eb8b43c13173f2ec1714a3ed622cb0c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 14:20:15 +1100 Subject: TSAGE: Implement original engine scene scrolling optimisations Wide screens are broken into 160x100 chunks. When scrolling, sections of the scene which have already been previously decoded for display can be reused, rather than re-decoding them from scratch --- engines/tsage/scenes.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index fab5afff71..a1dfe0b2ce 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -360,19 +360,20 @@ void Scene::refreshBackground(int xAmount, int yAmount) { _enabledSections[xp * 16 + yp] = 0xffff; } else { // Check if the section is already loaded -// if (_enabledSections[xp * 16 + yp] || ((xAmount == 0) && (yAmount == 0))) { + if ((_enabledSections[xp * 16 + yp] == 0xffff) || ((xAmount == 0) && (yAmount == 0))) { + // Chunk isn't loaded, so load it in Graphics::Surface s = _backSurface.lockSurface(); GfxSurface::loadScreenSection(s, xp - xHalfOffset, yp - yHalfOffset, xp, yp); _backSurface.unlockSurface(); changedFlag = true; -/* } else { - int yv = _enabledSections[xp * 16 + yp] == ((xp - xHalfOffset) << 4) ? 0 : 1; - if (yv != (yp - yHalfOffset)) { + } else { + int yv = (_enabledSections[xp * 16 + yp] == ((xp - xHalfOffset) << 4)) ? 0 : 1; + if (yv | (yp - yHalfOffset)) { // Copy an existing 160x100 screen section previously loaded - int xSectionSrc = xp - xHalfOffset; - int ySectionSrc = yp - yHalfOffset; - int xSectionDest = _enabledSections[xp * 16 + yp] >> 4; - int ySectionDest = _enabledSections[xp * 16 + yp] & 0xffff; + int xSectionDest = xp - xHalfOffset; + int ySectionDest = yp - yHalfOffset; + int xSectionSrc = _enabledSections[xp * 16 + yp] >> 4; + int ySectionSrc = _enabledSections[xp * 16 + yp] & 0xf; Rect srcBounds(xSectionSrc * 160, ySectionSrc * 100, (xSectionSrc + 1) * 160, (ySectionSrc + 1) * 100); @@ -381,10 +382,10 @@ void Scene::refreshBackground(int xAmount, int yAmount) { _backSurface.copyFrom(_backSurface, srcBounds, destBounds); } - }*/ + } _enabledSections[xp * 16 + yp] = - ((xp - xHalfOffset) << 4) && (yp - yHalfOffset); + ((xp - xHalfOffset) << 4) | (yp - yHalfOffset); } } } -- cgit v1.2.3 From 10836d20f6be451cdb62a8dcb98d2175c03d3947 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 14:58:30 +1100 Subject: TSAGE: Added command to show the priority regions of a scene --- engines/tsage/debugger.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- engines/tsage/debugger.h | 1 + 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index 52a1a5f877..84a04236da 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -36,6 +36,7 @@ Debugger::Debugger(): GUI::Debugger() { DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene)); DCmd_Register("walk_regions", WRAP_METHOD(Debugger, Cmd_WalkRegions)); + DCmd_Register("priority_regions", WRAP_METHOD(Debugger, Cmd_PriorityRegions)); DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); } @@ -76,7 +77,7 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) { */ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("USage: %s\n", argv[0]); + DebugPrintf("Usage: %s\n", argv[0]); return true; } @@ -108,6 +109,48 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { return false; } +/* + * This command draws the priority regions onto the screen + */ +bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { + if (argc != 1) { + DebugPrintf("Usage: %s\n", argv[0]); + return true; + } + + // Colour index to use for the first priority region + int colour = 16; + int count = 0; + + // Lock the background surface for access + Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface(); + + List::iterator i = _globals->_sceneManager._scene->_priorities.begin(); + + for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++colour, ++count) { + for (int y = 0; y < destSurface.h; ++y) { + byte *destP = (byte *)destSurface.getBasePtr(0, y); + + for (int x = 0; x < destSurface.w; ++x) { + if ((*i).contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x, + _globals->_sceneManager._scene->_sceneBounds.top + y))) + *destP = colour; + ++destP; + } + } + } + + // Release the surface + _globals->_sceneManager._scene->_backSurface.unlockSurface(); + + // Mark the scene as requiring a full redraw + _globals->_paneRefreshFlag[0] = 2; + + DebugPrintf("Total regions = %d\n", count); + + return false; +} + /** * Give a specified item to the player */ diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h index ffd7c3263a..348d2cb821 100644 --- a/engines/tsage/debugger.h +++ b/engines/tsage/debugger.h @@ -39,6 +39,7 @@ public: protected: bool Cmd_Scene(int argc, const char **argv); bool Cmd_WalkRegions(int argc, const char **argv); + bool Cmd_PriorityRegions(int argc, const char **argv); bool Cmd_Item(int argc, const char **argv); }; -- cgit v1.2.3 From 47be9eee49b1f8eae03fb5d2b834d3cf51b055a6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 14:59:26 +1100 Subject: TSAGE: Correctly handle priority regions when drawing in a wide scene --- engines/tsage/graphics.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 93ac9f07d7..2b323da07a 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -547,7 +547,9 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi int xp = destBounds.left; while (tempSrc < (pSrc + destBounds.width())) { - if (!priorityRegion || !priorityRegion->contains(Common::Point(xp, destBounds.top + y))) { + if (!priorityRegion || !priorityRegion->contains(Common::Point( + xp + _globals->_sceneManager._scene->_sceneBounds.left, + destBounds.top + y + _globals->_sceneManager._scene->_sceneBounds.top))) { if (*tempSrc != src._transColour) *tempDest = *tempSrc; } -- cgit v1.2.3 From f173b6862f1d98a60b67a454484ac34731007747 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 15:03:20 +1100 Subject: TSAGE: Replaced some values with proper constants --- engines/tsage/core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 7749e89580..503dd54103 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1732,9 +1732,9 @@ void SceneObject::setPriority(int priority) { void SceneObject::setPriority2(int priority) { if (priority == -1) { - _flags &= ~1; + _flags &= ~OBJFLAG_FIXED_PRIORITY; } else { - _flags |= 1; + _flags |= OBJFLAG_FIXED_PRIORITY; setPriority(priority); } } -- cgit v1.2.3 From 223ffde8ce9660bb2bcb02ccee6255130c6fec64 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 16:10:45 +1100 Subject: TSAGE: Bugfix to the sequence manager to treat parameters as signed integers --- engines/tsage/converse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index c253cc79c5..e8b640ea3d 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -101,7 +101,7 @@ void SequenceManager::signal() { if (idx > 34) continue; - uint v1, v2, v3; + int16 v1, v2, v3; switch (idx) { case 0: // Stop sequence -- cgit v1.2.3 From 93b5873836a534e62dd4d7fdf4ae1f6cf4af068d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 16:11:24 +1100 Subject: TSAGE: Added support to priority_regions to display a single specific priority region --- engines/tsage/debugger.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index 84a04236da..2c6c533125 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -113,10 +113,11 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { * This command draws the priority regions onto the screen */ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { - if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); - return true; - } + int regionNum = 0; + + // Check for an optional specific region to display + if (argc == 2) + regionNum = strToInt(argv[1]); // Colour index to use for the first priority region int colour = 16; @@ -126,18 +127,26 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface(); List::iterator i = _globals->_sceneManager._scene->_priorities.begin(); + Common::String regionsDesc; for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++colour, ++count) { - for (int y = 0; y < destSurface.h; ++y) { - byte *destP = (byte *)destSurface.getBasePtr(0, y); - - for (int x = 0; x < destSurface.w; ++x) { - if ((*i).contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x, - _globals->_sceneManager._scene->_sceneBounds.top + y))) - *destP = colour; - ++destP; + Region &r = *i; + + if ((regionNum == 0) || (regionNum == (count + 1))) { + for (int y = 0; y < destSurface.h; ++y) { + byte *destP = (byte *)destSurface.getBasePtr(0, y); + + for (int x = 0; x < destSurface.w; ++x) { + if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x, + _globals->_sceneManager._scene->_sceneBounds.top + y))) + *destP = colour; + ++destP; + } } } + + regionsDesc += Common::String::format("Region Priority = %d bounds=%d,%d,%d,%d\n", + r._regionId, r._bounds.left, r._bounds.top, r._bounds.right, r._bounds.bottom); } // Release the surface @@ -147,8 +156,9 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { _globals->_paneRefreshFlag[0] = 2; DebugPrintf("Total regions = %d\n", count); + DebugPrintf("%s", regionsDesc.c_str()); - return false; + return true; } /** -- cgit v1.2.3 From d5ecc4e7889327cd2e315ecd2e9cae4c5a17dbf4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 18:11:18 +1100 Subject: TSAGE: Completed Scene #2320 - Starcraft - Lander Bar --- engines/tsage/ringworld_scenes3.cpp | 234 +++++++++++++++++++++++++++++++++++- engines/tsage/ringworld_scenes3.h | 49 +++++++- 2 files changed, 276 insertions(+), 7 deletions(-) diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp index 6921de4918..6c793c83b4 100644 --- a/engines/tsage/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld_scenes3.cpp @@ -4991,7 +4991,7 @@ int Scene2310::findObject(int objIndex) { } /*-------------------------------------------------------------------------- - * Scene 2320 - Starcraft - Lander Bar + * Scene 2320 - Starcraft - Lander Bay * *--------------------------------------------------------------------------*/ @@ -5517,7 +5517,235 @@ void Scene2320::Action8::signal() { /*--------------------------------------------------------------------------*/ -Scene2320::Scene2320() { +void Scene2320::Hotspot5::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 13); + break; + case CURSOR_USE: + if (_globals->getFlag(70)) + SceneItem::display2(2320, 33); + else if (_globals->getFlag(13)) + SceneItem::display2(2320, 18); + else + scene->setAction(&scene->_action5); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene2320::Hotspot6::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 2); + break; + case CURSOR_USE: + _globals->_player.disableControl(); + scene->setAction(&scene->_action3); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene2320::Hotspot8::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 23); + break; + case CURSOR_USE: + scene->_sceneMode = 2336; + scene->setAction(&scene->_sequenceManager1, scene, 2336, &_globals->_player, this, NULL); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene2320::Hotspot10::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 26); + break; + case CURSOR_TALK: + _globals->_player.disableControl(); + scene->_sceneMode = 2329; + + if (_globals->getFlag(13)) { + scene->_stripManager.start(2337, scene); + } else if (_globals->getFlag(70)) { + scene->setAction(&scene->_action8); + } else if (_globals->getFlag(109)) { + scene->setAction(&scene->_sequenceManager1, scene, 2337, NULL); + } else if (!_state) { + ++_state; + scene->setAction(&scene->_sequenceManager1, scene, 2334, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 2335, NULL); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene2320::Hotspot11::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 25); + break; + case CURSOR_TALK: + _globals->_player.disableControl(); + scene->_sceneMode = 2329; + + if (_globals->getFlag(13)) { + _globals->_player.disableControl(); + scene->_sceneMode = 5000; + scene->_stripManager.start(2336, scene); + } else if (_globals->getFlag(70)) { + scene->setAction(&scene->_action8); + } else { + scene->_sceneMode = 2329; + + if (_globals->_inventory._ale._sceneNumber == 1) { + scene->setAction(&scene->_sequenceManager1, scene, 2329, NULL); + } else if (!_globals->getFlag(110)) { + _globals->setFlag(110); + scene->setAction(&scene->_sequenceManager1, scene, 2330, NULL); + } else if (_globals->_inventory._peg._sceneNumber != 1) { + scene->setAction(&scene->_sequenceManager1, scene, 2331, NULL); + } else if (!_state) { + ++_state; + scene->setAction(&scene->_sequenceManager1, scene, 2332, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 2333, NULL); + } + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene2320::Hotspot12::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 5); + break; + case CURSOR_USE: + if (_globals->getFlag(13)) + SceneItem::display2(2320, 24); + else { + _globals->_player.disableControl(); + scene->_sceneMode = 2322; + scene->setAction(&scene->_sequenceManager1, scene, 2322, &_globals->_player, NULL); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene2320::Hotspot14::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 17); + break; + case CURSOR_USE: + if (_globals->getFlag(24)) { + _globals->clearFlag(24); + _globals->_player.disableControl(); + + scene->_hotspot8.postInit(); + scene->_hotspot8.setVisage(2345); + scene->_hotspot8.setPosition(Common::Point(634, 65)); + scene->_hotspot8.flag100(); + + _globals->_sceneItems.push_front(&scene->_hotspot8); + _globals->_inventory._waldos._sceneNumber = 2320; + + scene->_hotspot9.postInit(); + scene->_hotspot9.setVisage(2345); + scene->_hotspot9._strip = 6; + scene->_hotspot9.setPosition(Common::Point(536, 103)); + scene->_hotspot9.setPriority2(200); + scene->_hotspot9.flag100(); + + scene->_hotspot16.postInit(); + scene->_hotspot16.setVisage(2345); + scene->_hotspot16.setStrip(8); + scene->_hotspot16.setPosition(Common::Point(536, 103)); + scene->_hotspot16.flag100(); + + scene->_sceneMode = 2324; + scene->setAction(&scene->_sequenceManager1, scene, 2324, &_globals->_player, &scene->_hotspot7, + &scene->_hotspot8, &scene->_hotspot9, &scene->_hotspot16, NULL); + } else if (_globals->getFlag(13)) { + SceneItem::display2(2320, 24); + } else if (!_globals->getFlag(76)) { + SceneItem::display2(2320, 28); + } else if (!_globals->_inventory._waldos._sceneNumber) { + SceneItem::display2(2320, 27); + } else { + SceneItem::display2(2320, 29); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene2320::Hotspot15::doAction(int action) { + Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(2320, 16); + break; + case CURSOR_USE: + if (_globals->getFlag(13)) + SceneItem::display2(2320, 24); + else + scene->setAction(&scene->_action4); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + + +/*--------------------------------------------------------------------------*/ + +Scene2320::Scene2320(): + _hotspot1(0, CURSOR_LOOK, 2320, 0, LIST_END), + _hotspot2(0, CURSOR_LOOK, 2320, 1, LIST_END), + _hotspot3(0, CURSOR_LOOK, 2320, 11, LIST_END), + _hotspot4(0, CURSOR_LOOK, 2320, 14, LIST_END), + _hotspot13(0, CURSOR_LOOK, 2320, 12, LIST_END) +{ } void Scene2320::postInit(SceneObjectList *OwnerList) { @@ -5746,7 +5974,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position); loadScene(2320); - _hotspot14._sceneRegionId = 0; + _hotspot14._sceneRegionId = 8; _hotspot1.setBounds(Rect(0, 0, 640, 200)); _hotspot2.setBounds(Rect(278, 0, 362, 61)); _hotspot3.setBounds(Rect(282, 62, 367, 98)); diff --git a/engines/tsage/ringworld_scenes3.h b/engines/tsage/ringworld_scenes3.h index 0f2923ded8..24b3ee3f22 100644 --- a/engines/tsage/ringworld_scenes3.h +++ b/engines/tsage/ringworld_scenes3.h @@ -809,6 +809,40 @@ class Scene2320: public Scene { public: virtual void signal(); }; + + /* Hotspots */ + class Hotspot5: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot6: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot8: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot10: public SceneObjectExt { + public: + virtual void doAction(int action); + }; + class Hotspot11: public SceneObjectExt { + public: + virtual void doAction(int action); + }; + class Hotspot12: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot14: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot15: public SceneObject { + public: + virtual void doAction(int action); + }; public: SoundHandler _soundHandler; SequenceManager _sequenceManager1, _sequenceManager2; @@ -824,10 +858,17 @@ public: SpeakerSText _speakerSText; SpeakerGameText _speakerGameText; SceneArea _area1, _area2, _area3, _area4; - SceneObject _hotspot1, _hotspot2, _hotspot3, _hotspot4, _hotspot5; - SceneObject _hotspot6, _hotspot7, _hotspot8, _hotspot9; - SceneObjectExt _hotspot10, _hotspot11; - SceneObject _hotspot12, _hotspot13, _hotspot14, _hotspot15; + DisplayHotspot _hotspot1, _hotspot2, _hotspot3, _hotspot4; + Hotspot5 _hotspot5; + Hotspot6 _hotspot6; + SceneObject _hotspot7, _hotspot9; + Hotspot8 _hotspot8; + Hotspot10 _hotspot10; + Hotspot11 _hotspot11; + Hotspot12 _hotspot12; + DisplayHotspot _hotspot13; + Hotspot14 _hotspot14; + Hotspot15 _hotspot15; SceneObject _hotspot16; SceneItem *_hotspotPtr; Action1 _action1; -- cgit v1.2.3 From ec7e7519112247470e3e539a43040022a6e12c6e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 21:07:04 +1100 Subject: TSAGE: Implemented Scene 2400 - Descending in Lander --- engines/tsage/core.cpp | 4 +++ engines/tsage/core.h | 1 + engines/tsage/ringworld_logic.cpp | 2 ++ engines/tsage/ringworld_scenes3.cpp | 59 +++++++++++++++++++++++++++++++++++++ engines/tsage/ringworld_scenes3.h | 14 +++++++++ engines/tsage/scenes.cpp | 2 +- 6 files changed, 81 insertions(+), 1 deletion(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 503dd54103..f06e7f532b 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1682,6 +1682,10 @@ void SceneObject::setZoom(int percent) { } } +void SceneObject::updateZoom() { + changeZoom(_percent); +} + void SceneObject::changeZoom(int percent) { if (percent == -1) _flags &= ~OBJFLAG_ZOOMED; diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 79731bf46a..d961f8bdd1 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -507,6 +507,7 @@ public: void setStrip(int frameNum); void setStrip2(int frameNum); void setZoom(int percent); + void updateZoom(); void changeZoom(int percent); void setFrame(int frameNum); void setFrame2(int frameNum); diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 5b86929772..2e451493ec 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -94,6 +94,8 @@ Scene *SceneFactory::createScene(int sceneNumber) { case 2310: return new Scene2310(); // Starcraft - Lander Bay case 2320: return new Scene2320(); + // Scene 2400 - Descending in Lander + case 2400: return new Scene2400(); /* Scene group 4 */ diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp index 6c793c83b4..a12a7c41f0 100644 --- a/engines/tsage/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld_scenes3.cpp @@ -6034,6 +6034,65 @@ void Scene2320::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 2400 - Descending in Lander + * + *--------------------------------------------------------------------------*/ + +void Scene2400::Action1::signal() { + switch (_actionIndex++) { + case 0: + setDelay(60); + break; + case 1: + ADD_MOVER(_globals->_player, 160, 71); + break; + case 2: + ADD_MOVER(_globals->_player, 160, 360); + break; + case 3: + _globals->_player._moveDiff = Common::Point(1, 1); + ADD_MOVER(_globals->_player, 140, 375); + break; + case 4: + ADD_MOVER(_globals->_player, 87, 338); + break; + case 5: + _globals->_player.flag100(); + setDelay(60); + break; + case 6: + _globals->_sceneManager.changeScene(4000); + break; + } +} +void Scene2400::Action1::dispatch() { + Action::dispatch(); + if ((_actionIndex == 4) && (_globals->_player._percent > 5)) + _globals->_player.changeZoom(_globals->_player._percent - 2); +} + +/*--------------------------------------------------------------------------*/ + +void Scene2400::postInit(SceneObjectList *OwnerList) { + loadScene(2400); + Scene::postInit(); + setZoomPercents(0, 100, 200, 100); + + _globals->_player.postInit(); + _globals->_player.setVisage(2410); + _globals->_player.setPosition(Common::Point(340, -10)); + _globals->_player.animate(ANIM_MODE_2, NULL); + _globals->_player.disableControl(); + + setAction(&_action1); + + _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y); + _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); + _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; + + _globals->_soundHandler.startSound(153); +} } // End of namespace tSage diff --git a/engines/tsage/ringworld_scenes3.h b/engines/tsage/ringworld_scenes3.h index 24b3ee3f22..420307ca99 100644 --- a/engines/tsage/ringworld_scenes3.h +++ b/engines/tsage/ringworld_scenes3.h @@ -886,6 +886,20 @@ public: virtual void signal(); }; +class Scene2400: public Scene { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + virtual void dispatch(); + }; +public: + Action1 _action1; + SceneObject _object; + + virtual void postInit(SceneObjectList *OwnerList = NULL); +}; + } // End of namespace tSage #endif diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index a1dfe0b2ce..40f29e661a 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -164,7 +164,7 @@ void SceneManager::setBackSurface() { if (size > 96000) { if (_globals->_sceneManager._scene->_backgroundBounds.width() <= SCREEN_WIDTH) { // Standard size creation - _globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT); + _globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT * 3 / 2); _globals->_sceneManager._scrollerRect = Rect(0, 30, SCREEN_WIDTH, SCREEN_HEIGHT - 30); } else { // Wide screen needs extra space to allow for scrolling -- cgit v1.2.3 From 88b909b26df5a5d40e8d5792e3d6b502740c332f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 22:16:29 +1100 Subject: TSAGE: Corrected bugs in Scene #1400 - Ringworld Wall --- engines/tsage/core.h | 11 ++++++++--- engines/tsage/ringworld_logic.cpp | 2 +- engines/tsage/ringworld_scenes2.cpp | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/engines/tsage/core.h b/engines/tsage/core.h index d961f8bdd1..d4c25b1668 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -652,8 +652,9 @@ private: void sortList(Common::Array &ObjList); List _objList; + bool _listAltered; public: - SceneObjectList() {} + SceneObjectList() { _listAltered = false; } virtual Common::String getClassName() { return "SceneObjectList"; } virtual void synchronise(Serialiser &s); @@ -665,7 +666,8 @@ public: typedef void (*EventHandlerFn)(EventHandler *fn); void recurse(EventHandlerFn Fn) { // Loop through each object - for (List::iterator i = _objList.begin(); i != _objList.end(); ) { + _listAltered = false; + for (List::iterator i = _objList.begin(); i != _objList.end() && !_listAltered; ) { SceneObject *o = *i; ++i; Fn(o); @@ -676,7 +678,10 @@ public: bool contains(SceneObject *sceneObj) { return _objList.contains(sceneObj); } void push_back(SceneObject *sceneObj) { _objList.push_back(sceneObj); } void push_front(SceneObject *sceneObj) { _objList.push_front(sceneObj); } - void remove(SceneObject *sceneObj) { _objList.remove(sceneObj); } + void remove(SceneObject *sceneObj) { + _objList.remove(sceneObj); + _listAltered = true; + } }; class ScenePriorities: public List { diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 2e451493ec..8c0002166d 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -64,7 +64,7 @@ Scene *SceneFactory::createScene(int sceneNumber) { case 1001: return new Scene1001(); // Unused case 1250: return new Scene1250(); - // + // Ringworld Wall case 1400: return new Scene1400(); // Ringworld Space-port case 1500: return new Scene1500(); diff --git a/engines/tsage/ringworld_scenes2.cpp b/engines/tsage/ringworld_scenes2.cpp index b10da21fc3..1d3d0508fc 100644 --- a/engines/tsage/ringworld_scenes2.cpp +++ b/engines/tsage/ringworld_scenes2.cpp @@ -655,7 +655,7 @@ void Scene1250::postInit(SceneObjectList *OwnerList) { } /*-------------------------------------------------------------------------- - * Scene 1400 - Arriving at Ringworld + * Scene 1400 - Ringworld Wall * *--------------------------------------------------------------------------*/ @@ -681,7 +681,9 @@ void Scene1400::Action1::signal() { Common::Point pt(160, 100); NpcMover *mover = new NpcMover(); _globals->_player.addMover(mover, &pt, this); + SceneItem::display(0, 0); + setDelay(360); break; } case 3: -- cgit v1.2.3 From eb1c1e7e6aa398a957a13929e463da2fbcb96eab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2011 22:46:19 +1100 Subject: TSAGE: Implemented Scene #3500 - Ringworld Scan --- engines/tsage/module.mk | 1 + engines/tsage/ringworld_logic.cpp | 3 ++ engines/tsage/ringworld_scenes4.cpp | 93 +++++++++++++++++++++++++++++++++++++ engines/tsage/ringworld_scenes4.h | 58 +++++++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 engines/tsage/ringworld_scenes4.cpp create mode 100644 engines/tsage/ringworld_scenes4.h diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 56265021d0..0b0528d1a5 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -14,6 +14,7 @@ MODULE_OBJS := \ ringworld_scenes1.o \ ringworld_scenes2.o \ ringworld_scenes3.o \ + ringworld_scenes4.o \ saveload.o \ scenes.o \ sound.o \ diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 8c0002166d..68f7d8323e 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -30,6 +30,7 @@ #include "tsage/ringworld_scenes1.h" #include "tsage/ringworld_scenes2.h" #include "tsage/ringworld_scenes3.h" +#include "tsage/ringworld_scenes4.h" namespace tSage { @@ -98,6 +99,8 @@ Scene *SceneFactory::createScene(int sceneNumber) { case 2400: return new Scene2400(); /* Scene group 4 */ + // Ringworld Scan + case 3500: return new Scene3500(); /* Scene group 5 */ diff --git a/engines/tsage/ringworld_scenes4.cpp b/engines/tsage/ringworld_scenes4.cpp new file mode 100644 index 0000000000..eadc86a32f --- /dev/null +++ b/engines/tsage/ringworld_scenes4.cpp @@ -0,0 +1,93 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "common/config-manager.h" +#include "tsage/ringworld_scenes4.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace tSage { + +/*-------------------------------------------------------------------------- + * Scene 3500 - Ringworld Scan + * + *--------------------------------------------------------------------------*/ + +void Scene3500::Action1::signal() { + Scene3500 *scene = (Scene3500 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(10); + break; + case 1: + scene->_stripManager.start(3500, this); + break; + case 2: + setDelay(3); + break; + case 3: + _globals->_sceneManager.changeScene(9999); + break; + } +} + +void Scene3500::Action2::signal() { + Scene3500 *scene = (Scene3500 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(10); + break; + case 1: + scene->_stripManager.start(3501, this); + break; + case 2: + setDelay(3); + break; + case 3: + _globals->_sceneManager.changeScene(2012); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene3500::postInit(SceneObjectList *OwnerList) { + loadScene((_globals->_stripNum == 3600) ? 3600 : 3500); + Scene::postInit(); + + _stripManager.addSpeaker(&_speakerQText); + _stripManager.addSpeaker(&_speakerMText); + _stripManager.addSpeaker(&_speakerSText); + + _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); + _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.top / 160) * 160; + + setAction((_globals->_stripNum == 3600) ? (Action *)&_action2 : (Action *)&_action1); +} + +} // End of namespace tSage diff --git a/engines/tsage/ringworld_scenes4.h b/engines/tsage/ringworld_scenes4.h new file mode 100644 index 0000000000..9795561216 --- /dev/null +++ b/engines/tsage/ringworld_scenes4.h @@ -0,0 +1,58 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://scummvm-misc.svn.sourceforge.net/svnroot/scummvm-misc/trunk/engines/tsage/scene_logic.h $ + * $Id: scene_logic.h 232 2011-02-12 11:56:38Z dreammaster $ + * + */ + +#ifndef TSAGE_RINGWORLD_SCENES4_H +#define TSAGE_RINGWORLD_SCENES4_H + +#include "common/scummsys.h" +#include "tsage/core.h" +#include "tsage/converse.h" +#include "tsage/ringworld_logic.h" + +namespace tSage { + +class Scene3500: public Scene { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; + class Action2: public Action { + public: + virtual void signal(); + }; +public: + SpeakerSText _speakerSText; + SpeakerMText _speakerMText; + SpeakerQText _speakerQText; + Action1 _action1; + Action2 _action2; + + virtual void postInit(SceneObjectList *OwnerList = NULL); +}; + +} // End of namespace tSage + +#endif -- cgit v1.2.3 From ae29b57edbca8738768043af1c88973ab6ab8f3b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Mar 2011 11:12:11 +1100 Subject: TSAGE: Initial implementation of Scene #3700 - Remote Viewer --- engines/tsage/ringworld_logic.cpp | 2 + engines/tsage/ringworld_scenes4.cpp | 121 ++++++++++++++++++++++++++++++++++++ engines/tsage/ringworld_scenes4.h | 33 ++++++++++ 3 files changed, 156 insertions(+) diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 68f7d8323e..f5b001eb2b 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -101,6 +101,8 @@ Scene *SceneFactory::createScene(int sceneNumber) { /* Scene group 4 */ // Ringworld Scan case 3500: return new Scene3500(); + // Remote Viewer + case 3700: return new Scene3700(); /* Scene group 5 */ diff --git a/engines/tsage/ringworld_scenes4.cpp b/engines/tsage/ringworld_scenes4.cpp index eadc86a32f..51840154eb 100644 --- a/engines/tsage/ringworld_scenes4.cpp +++ b/engines/tsage/ringworld_scenes4.cpp @@ -90,4 +90,125 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { setAction((_globals->_stripNum == 3600) ? (Action *)&_action2 : (Action *)&_action1); } +/*-------------------------------------------------------------------------- + * Scene 3700 - Remote Viewer + * + *--------------------------------------------------------------------------*/ + +Scene3700::Viewer::Viewer() { + _imgList[0] = surfaceFromRes(3705, 1, 1); + for (int idx = 1; idx <= 3; ++idx) + _imgList[idx] = surfaceFromRes(3705, 2, _globals->_randomSource.getRandomNumber(4) + 1); + + _field88 = 1; + _percent = 120; + _field94 = 50; + _field96 = 75; + _field98 = 114; +} + +void Scene3700::Viewer::reposition() { + _bounds = Rect(123, 40, 285, 123); +} + +void Scene3700::Viewer::draw() { + for (int idx = 0; idx < 4; ++idx) { + Rect destRect = _imgList[idx].getBounds(); + destRect.resize(_imgList[idx], (_position.x - _globals->_sceneOffset.x), + (_position.y - _globals->_sceneOffset.y - _yDiff), _percent); + + destRect.translate(-_globals->_sceneManager._scene->_sceneBounds.left, + -_globals->_sceneManager._scene->_sceneBounds.top); + + Region *priorityRegion = _globals->_sceneManager._scene->_priorities.find(1); + _globals->gfxManager().copyFrom(_imgList[idx], destRect, priorityRegion); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene3700::Action1::signal() { + Scene3700 *scene = (Scene3700 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(10); + break; + case 1: + scene->_stripManager.start(2162, this); + break; + case 2: + scene->_viewer._field88 = 0; + setDelay(90); + break; + case 3: + scene->_soundHandler.startSound(196); + scene->_viewer.flag100(); + + scene->_hotspot1.postInit(); + scene->_hotspot1.setVisage(3710); + scene->_hotspot1.setStrip(1); + scene->_hotspot1.setFrame(1); + scene->_hotspot1.setPosition(Common::Point(204, 120)); + + setDelay(90); + break; + case 4: + scene->_soundHandler.startSound(197); + scene->_hotspot1.flag100(); + + scene->_hotspot2.postInit(); + scene->_hotspot2.setVisage(3710); + scene->_hotspot2.setStrip(2); + scene->_hotspot2.setFrame(1); + scene->_hotspot2.setPosition(Common::Point(204, 120)); + + setDelay(30); + break; + case 5: + scene->_soundHandler.startSound(198); + scene->_hotspot2.flag100(); + scene->_hotspot1.unflag100(); + setDelay(90); + break; + case 6: + scene->_stripManager.start(2166, this); + break; + case 7: + setDelay(60); + break; + case 8: + scene->_hotspot1.remove(); + scene->_hotspot2.unflag100(); + _globals->setFlag(59); + setDelay(30); + break; + case 9: + _globals->_sceneManager.changeScene(2100); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene3700::postInit(tSage::SceneObjectList *OwnerList) { + Scene::postInit(); + loadScene(3700); + + _stripManager.addSpeaker(&_speakerSText); + _stripManager.addSpeaker(&_speakerMText); + _stripManager.addSpeaker(&_speakerMR); + _speakerSText.setTextPos(Common::Point(20, 15)); + _speakerMText.setTextPos(Common::Point(20, 15)); + + _viewer.postInit(); + _viewer.setVisage(3705); + _viewer.setStrip(1); + _viewer.setFrame(2); + _viewer.setPosition(Common::Point(195, 83)); + + setAction(&_action1); + _globals->_soundHandler.startSound(195); +} + } // End of namespace tSage diff --git a/engines/tsage/ringworld_scenes4.h b/engines/tsage/ringworld_scenes4.h index 9795561216..10d2cfe7db 100644 --- a/engines/tsage/ringworld_scenes4.h +++ b/engines/tsage/ringworld_scenes4.h @@ -53,6 +53,39 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); }; +class Scene3700: public Scene { + /* Custom classes */ + class Viewer: public SceneObject { + public: + GfxSurface _imgList[4]; + int _field88; + int _percent; + int _field94; + int _field96; + int _field98; + + Viewer(); + virtual void reposition(); + virtual void draw(); + }; + + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; +public: + Viewer _viewer; + Action _action1; + SceneObject _hotspot1, _hotspot2; + SpeakerSText _speakerSText; + SpeakerMText _speakerMText; + SpeakerMR _speakerMR; + SoundHandler _soundHandler; + + virtual void postInit(SceneObjectList *OwnerList = NULL); +}; + } // End of namespace tSage #endif -- cgit v1.2.3 From e2af308ad2c4b35d8325dbf8357d299dd9606fc0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Mar 2011 20:26:09 +1100 Subject: TSAGE: Added new speaker classes --- engines/tsage/ringworld_logic.cpp | 126 ++++++++++++++++++++++++++++++++++++++ engines/tsage/ringworld_logic.h | 44 +++++++++++++ 2 files changed, 170 insertions(+) diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index f5b001eb2b..4793f70c6c 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -31,6 +31,7 @@ #include "tsage/ringworld_scenes2.h" #include "tsage/ringworld_scenes3.h" #include "tsage/ringworld_scenes4.h" +#include "tsage/ringworld_scenes5.h" namespace tSage { @@ -105,6 +106,8 @@ Scene *SceneFactory::createScene(int sceneNumber) { case 3700: return new Scene3700(); /* Scene group 5 */ + // Village + case 4000: return new Scene4000(); /* Scene group 6 */ @@ -346,6 +349,26 @@ SpeakerHText::SpeakerHText() { /*--------------------------------------------------------------------------*/ +SpeakerPText::SpeakerPText() { + _speakerName = "PTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTRE; + _colour1 = 5; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCHFText::SpeakerCHFText() { + _speakerName = "SpeakerCHFText"; + _textWidth = 240; + _textMode = ALIGN_CENTRE; + _colour1 = 56; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + SpeakerQL::SpeakerQL(): AnimatedSpeaker() { _speakerName = "QL"; _newSceneNumber = 2610; @@ -599,4 +622,107 @@ void SpeakerML::setText(const Common::String &msg) { Speaker::setText(msg); } +/*--------------------------------------------------------------------------*/ + +SpeakerCHFL::SpeakerCHFL() { + _speakerName = "CHFL"; + _newSceneNumber = 4111; + _textPos = Common::Point(10, 40); + _colour1 = 56; +} + +void SpeakerCHFL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4113); + _object1.setStrip2(2); + _object1.setPriority2(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(205, 116)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4113); + _object2.setStrip2(1); + _object2.setPriority2(255); + _object2._frame = 1; + _object2.setPosition(Common::Point(202, 71)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCHFR::SpeakerCHFR() { + _speakerName = "CHFR"; + _newSceneNumber = 4110; + _textPos = Common::Point(160, 40); + _colour1 = 56; +} + +void SpeakerCHFR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4112); + _object1.setStrip2(2); + _object1.setPriority2(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(103, 116)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4112); + _object2.setStrip2(1); + _object2.setPriority2(255); + _object2._frame = 1; + _object2.setPosition(Common::Point(106, 71)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerPL::SpeakerPL() { + _speakerName = "PL"; + _newSceneNumber = 4060; + _textPos = Common::Point(160, 40); + _colour1 = 5; +} + +void SpeakerPL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4062); + _object1.setStrip2(2); + _object1.setPriority2(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(107, 117)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4062); + _object2.setStrip2(1); + _object2.setPriority2(200); + _object2._frame = 1; + _object2.setPosition(Common::Point(105, 62)); + _object2.setAction(&_speakerAction, NULL); + + _object3.postInit(&_objectList); + _object3.setVisage(4062); + _object3.setStrip2(3); + _object3.setPriority2(255); + _object3._frame = 1; + _object3.setPosition(Common::Point(105, 59)); + _object3.setAction(&_speakerAction2, NULL); + + Speaker::setText(msg); +} + +void SpeakerPL::removeText() { + _object3.remove(); + AnimatedSpeaker::removeText(); +} + } // End of namespace tSage diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h index fd48dec0b6..4ebf078da8 100644 --- a/engines/tsage/ringworld_logic.h +++ b/engines/tsage/ringworld_logic.h @@ -153,6 +153,20 @@ public: virtual Common::String getClassName() { return "SpeakerHText"; } }; +class SpeakerPText: public ScreenSpeaker { +public: + SpeakerPText(); + + virtual Common::String getClassName() { return "SpeakerPText"; } +}; + +class SpeakerCHFText: public ScreenSpeaker { +public: + SpeakerCHFText(); + + virtual Common::String getClassName() { return "SpeakerCHFText"; } +}; + class SpeakerQL: public AnimatedSpeaker { public: SpeakerQL(); @@ -219,6 +233,36 @@ public: virtual void setText(const Common::String &msg); }; +class SpeakerCHFL: public AnimatedSpeaker { +public: + SpeakerCHFL(); + + virtual Common::String getClassName() { return "SpeakerCHFL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerCHFR: public AnimatedSpeaker { +public: + SpeakerCHFR(); + + virtual Common::String getClassName() { return "SpeakerCHFR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerPL: public AnimatedSpeaker { +public: + SceneObject _object3; + SpeakerAction _speakerAction2; + + SpeakerPL(); + + virtual Common::String getClassName() { return "SpeakerPL"; } + virtual void setText(const Common::String &msg); + virtual void removeText(); +}; + + + } // End of namespace tSage #endif -- cgit v1.2.3