[Scummvm-cvs-logs] SF.net SVN: scummvm:[49095] scummvm/trunk/engines/cine
sev at users.sourceforge.net
sev at users.sourceforge.net
Wed May 19 14:17:59 CEST 2010
Revision: 49095
http://scummvm.svn.sourceforge.net/scummvm/?rev=49095&view=rev
Author: sev
Date: 2010-05-19 12:17:59 +0000 (Wed, 19 May 2010)
Log Message:
-----------
Implement FR #2841494: FW: Pause doesn't work
Modified Paths:
--------------
scummvm/trunk/engines/cine/gfx.cpp
scummvm/trunk/engines/cine/gfx.h
scummvm/trunk/engines/cine/saveload.cpp
scummvm/trunk/engines/cine/various.cpp
scummvm/trunk/engines/cine/various.h
Modified: scummvm/trunk/engines/cine/gfx.cpp
===================================================================
--- scummvm/trunk/engines/cine/gfx.cpp 2010-05-19 09:39:11 UTC (rev 49094)
+++ scummvm/trunk/engines/cine/gfx.cpp 2010-05-19 12:17:59 UTC (rev 49095)
@@ -259,6 +259,17 @@
}
}
+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 @@
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
Modified: scummvm/trunk/engines/cine/gfx.h
===================================================================
--- scummvm/trunk/engines/cine/gfx.h 2010-05-19 09:39:11 UTC (rev 49094)
+++ scummvm/trunk/engines/cine/gfx.h 2010-05-19 12:17:59 UTC (rev 49095)
@@ -162,6 +162,7 @@
void drawOverlays();
void blit();
+
public:
uint16 _messageBg; ///< Message box background color
uint16 _cmdY; ///< Player command string position on screen
@@ -207,6 +208,9 @@
virtual void fadeToBlack();
void showCollisionPage(bool state);
+
+ void drawString(const char *string, byte param);
+ int getStringWidth(const char *str);
};
/**
Modified: scummvm/trunk/engines/cine/saveload.cpp
===================================================================
--- scummvm/trunk/engines/cine/saveload.cpp 2010-05-19 09:39:11 UTC (rev 49094)
+++ scummvm/trunk/engines/cine/saveload.cpp 2010-05-19 12:17:59 UTC (rev 49095)
@@ -774,7 +774,7 @@
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 @@
setMouseCursor(MOUSE_CURSOR_DISK);
if (!fHandle) {
- drawString(otherMessages[1], 0);
+ renderer->drawString(otherMessages[1], 0);
waitPlayerInput();
// restoreScreen();
checkDataDisk(-1);
Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp 2010-05-19 09:39:11 UTC (rev 49094)
+++ scummvm/trunk/engines/cine/various.cpp 2010-05-19 12:17:59 UTC (rev 49095)
@@ -55,10 +55,13 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
canUseOnObject = 0;
if (isInPause) {
- drawString(otherMessages[2], 0);
+ renderer->drawString(otherMessages[2], 0);
waitPlayerInput();
isInPause = 0;
}
Modified: scummvm/trunk/engines/cine/various.h
===================================================================
--- scummvm/trunk/engines/cine/various.h 2010-05-19 09:39:11 UTC (rev 49094)
+++ scummvm/trunk/engines/cine/various.h 2010-05-19 12:17:59 UTC (rev 49095)
@@ -41,7 +41,6 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list