diff options
author | Kari Salminen | 2008-08-07 19:04:19 +0000 |
---|---|---|
committer | Kari Salminen | 2008-08-07 19:04:19 +0000 |
commit | b8bfd5d04f0436b685ea36a845439e20bb756766 (patch) | |
tree | 4d5d512ec1c30515fdb615308a622ffee5248a8e | |
parent | a30ecc96a070f46fe15f5e1114bc73fdc26b6f2c (diff) | |
download | scummvm-rg350-b8bfd5d04f0436b685ea36a845439e20bb756766.tar.gz scummvm-rg350-b8bfd5d04f0436b685ea36a845439e20bb756766.tar.bz2 scummvm-rg350-b8bfd5d04f0436b685ea36a845439e20bb756766.zip |
Fix for popup boxes sometimes blocking animation when they shouldn't in Operation Stealth:
- Made waitForPlayerClick updating more like in the original.
- Moved removeMessages to after the frame drawing in main loop hoping to be more like the original.
- Added an additional test to Operation Stealth's implementation of overlay type 2 drawing.
- Added an additional parameter incrementing and testing to Operation Stealth's removeMessages.
Hopefully this won't cause any regressions in Future Wars!
svn-id: r33686
-rw-r--r-- | engines/cine/gfx.cpp | 15 | ||||
-rw-r--r-- | engines/cine/main_loop.cpp | 7 | ||||
-rw-r--r-- | engines/cine/various.cpp | 17 |
3 files changed, 34 insertions, 5 deletions
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index 9632c1c005..3d0ad278b9 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -422,6 +422,7 @@ void FWRenderer::renderOverlay(const Common::List<overlay>::iterator &it) { _messageLen += messageTable[it->objIdx].size(); drawMessage(messageTable[it->objIdx].c_str(), it->x, it->y, it->width, it->color); + waitForPlayerClick = 1; break; // action failure message @@ -433,6 +434,7 @@ void FWRenderer::renderOverlay(const Common::List<overlay>::iterator &it) { width = width > 300 ? 300 : width; drawMessage(failureMessages[idx], (320 - width) / 2, 80, width, 4); + waitForPlayerClick = 1; break; // bitmap @@ -1046,6 +1048,19 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) { delete[] mask; break; + // game message + case 2: + if (it->objIdx >= messageTable.size()) { + return; + } + + _messageLen += messageTable[it->objIdx].size(); + drawMessage(messageTable[it->objIdx].c_str(), it->x, it->y, it->width, it->color); + if (it->color >= 0) { // This test isn't in Future Wars's implementation + waitForPlayerClick = 1; + } + break; + // bitmap case 4: if (objectTable[it->objIdx].frame >= 0) { diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 9be2184f91..80a8905465 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -311,6 +311,11 @@ void CineEngine::mainLoop(int bootScriptIdx) { renderer->drawFrame(); } + // NOTE: In the original Future Wars and Operation Stealth messages + // were removed when running the drawOverlays function which is + // currently called from the renderer's drawFrame function. + removeMessages(); + if (waitForPlayerClick) { playerAction = false; @@ -340,8 +345,6 @@ void CineEngine::mainLoop(int bootScriptIdx) { } while (mouseButton != 0); waitForPlayerClick = 0; - - removeMessages(); } if (checkForPendingDataLoadSwitch) { diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index ecff8b263b..371f1bcbee 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -141,7 +141,6 @@ void addPlayerCommandMessage(int16 cmd) { tmp.type = 3; overlayList.push_back(tmp); - waitForPlayerClick = 1; } int16 getRelEntryForObject(uint16 param1, uint16 param2, SelectedObjStruct *pSelectedObject) { @@ -2002,9 +2001,22 @@ void drawSprite(Common::List<overlay>::iterator it, const byte *spritePtr, const void removeMessages() { Common::List<overlay>::iterator it; + bool remove; for (it = overlayList.begin(); it != overlayList.end(); ) { - if (it->type == 2 || it->type == 3) { + if (g_cine->getGameType() == Cine::GType_OS) { + // NOTE: These are really removeOverlay calls that have been deferred. + // In Operation Stealth's disassembly elements are removed from the + // overlay list right in the drawOverlays function (And actually in + // some other places too) and that's where incrementing a the overlay's + // last parameter by one if it's negative and testing it for positivity + // comes from too. + remove = it->type == 3 || (it->type == 2 && (it->color >= 0 || ++it->color >= 0)); + } else { // Future Wars + remove = it->type == 2 || it->type == 3; + } + + if (remove) { it = overlayList.erase(it); } else { ++it; @@ -2087,7 +2099,6 @@ void addMessage(byte param1, int16 param2, int16 param3, int16 param4, int16 par tmp.color = param5; overlayList.push_back(tmp); - waitForPlayerClick = 1; } Common::List<SeqListElement> seqList; |