diff options
author | Eugene Sandulenko | 2010-05-19 12:17:59 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-05-19 12:17:59 +0000 |
commit | 2be9bb3d5fc90962cd672aaa99a3d1eea2898c82 (patch) | |
tree | c79e8fe523ddd7a301a642ce628595de887803be /engines | |
parent | 209798474bcca17347458b6116aa44af4d544c80 (diff) | |
download | scummvm-rg350-2be9bb3d5fc90962cd672aaa99a3d1eea2898c82.tar.gz scummvm-rg350-2be9bb3d5fc90962cd672aaa99a3d1eea2898c82.tar.bz2 scummvm-rg350-2be9bb3d5fc90962cd672aaa99a3d1eea2898c82.zip |
Implement FR #2841494: FW: Pause doesn't work
svn-id: r49095
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/gfx.cpp | 26 | ||||
-rw-r--r-- | engines/cine/gfx.h | 4 | ||||
-rw-r--r-- | engines/cine/saveload.cpp | 4 | ||||
-rw-r--r-- | engines/cine/various.cpp | 33 | ||||
-rw-r--r-- | engines/cine/various.h | 1 |
5 files changed, 50 insertions, 18 deletions
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index b266b84647..a4220e6e35 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -259,6 +259,17 @@ void FWRenderer::drawCommand() { } } +void FWRenderer::drawString(const char *string, byte param) { + int width; + + width = getStringWidth(string) + 10; + width = width > 300 ? 300 : width; + + drawMessage(string, (320 - width) / 2, 80, width, 4); + + blit(); +} + /** * Draw message in a box * @param str Message to draw @@ -456,6 +467,21 @@ int FWRenderer::drawChar(char character, int x, int y) { return x; } +int FWRenderer::getStringWidth(const char *str) { + const char *p = str; + int width = 0; + + while (*p) { + if (*p == ' ') + width += 5; + else + width += g_cine->_textHandler.fontParamTable[(unsigned char)*p].characterWidth; + p++; + } + + return width; +} + /** * Draw Line * @param x Line end coordinate diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h index beb347a746..56ba6885f4 100644 --- a/engines/cine/gfx.h +++ b/engines/cine/gfx.h @@ -162,6 +162,7 @@ protected: void drawOverlays(); void blit(); + public: uint16 _messageBg; ///< Message box background color uint16 _cmdY; ///< Player command string position on screen @@ -207,6 +208,9 @@ public: virtual void fadeToBlack(); void showCollisionPage(bool state); + + void drawString(const char *string, byte param); + int getStringWidth(const char *str); }; /** diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp index 2bb9f634f5..c76bed3f8e 100644 --- a/engines/cine/saveload.cpp +++ b/engines/cine/saveload.cpp @@ -774,7 +774,7 @@ bool CineEngine::makeLoad(char *saveName) { Common::SharedPtr<Common::InSaveFile> saveFile(g_saveFileMan->openForLoading(saveName)); if (!saveFile) { - drawString(otherMessages[0], 0); + renderer->drawString(otherMessages[0], 0); waitPlayerInput(); // restoreScreen(); checkDataDisk(-1); @@ -971,7 +971,7 @@ void CineEngine::makeSave(char *saveFileName) { setMouseCursor(MOUSE_CURSOR_DISK); if (!fHandle) { - drawString(otherMessages[1], 0); + renderer->drawString(otherMessages[1], 0); waitPlayerInput(); // restoreScreen(); checkDataDisk(-1); diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index be34d8c5d7..6e4637e0ca 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -55,10 +55,13 @@ uint16 var5; int16 buildObjectListCommand(int16 param); int16 canUseOnObject = 0; -void drawString(const char *string, byte param) { -} - void waitPlayerInput() { + uint16 button; + + do { + manageEvents(); + getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16); + } while (!button && !g_cine->shouldQuit()); } void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4) { @@ -362,13 +365,13 @@ void CineEngine::makeSystemMenu() { systemCommand = makeMenuChoice(systemMenu, numEntry, mouseX, mouseY, 140); switch (systemCommand) { - case 0: + case 0: // Pause { - drawString(otherMessages[2], 0); + renderer->drawString(otherMessages[2], 0); waitPlayerInput(); break; } - case 1: + case 1: // Restart Game { getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY); if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) { @@ -376,7 +379,7 @@ void CineEngine::makeSystemMenu() { } break; } - case 2: + case 2: // Quit { getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY); if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) { @@ -405,27 +408,27 @@ void CineEngine::makeSystemMenu() { char loadString[256]; sprintf(loadString, otherMessages[3], currentSaveName[selectedSave]); - drawString(loadString, 0); + renderer->drawString(loadString, 0); makeLoad(saveNameBuffer); } else { - drawString(otherMessages[4], 0); + renderer->drawString(otherMessages[4], 0); waitPlayerInput(); checkDataDisk(-1); } } else { - drawString(otherMessages[4], 0); + renderer->drawString(otherMessages[4], 0); waitPlayerInput(); checkDataDisk(-1); } } else { - drawString(otherMessages[5], 0); + renderer->drawString(otherMessages[5], 0); waitPlayerInput(); checkDataDisk(-1); } break; } - case 5: + case 5: // Save game { loadSaveDirectory(); selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180); @@ -458,13 +461,13 @@ void CineEngine::makeSystemMenu() { delete fHandle; sprintf(saveString, otherMessages[3], currentSaveName[selectedSave]); - drawString(saveString, 0); + renderer->drawString(saveString, 0); makeSave(saveFileName); checkDataDisk(-1); } else { - drawString(otherMessages[4], 0); + renderer->drawString(otherMessages[4], 0); waitPlayerInput(); checkDataDisk(-1); } @@ -849,7 +852,7 @@ uint16 executePlayerInput() { canUseOnObject = 0; if (isInPause) { - drawString(otherMessages[2], 0); + renderer->drawString(otherMessages[2], 0); waitPlayerInput(); isInPause = 0; } diff --git a/engines/cine/various.h b/engines/cine/various.h index daa73759f8..d07fc73b13 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -41,7 +41,6 @@ void initLanguage(Common::Language lang); int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X, uint16 Y, uint16 width, bool recheckValue = false); void makeCommandLine(); void makeActionMenu(); -void drawString(const char *string, byte param); void waitPlayerInput(); void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4); |