aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Hamm2007-12-25 21:03:20 +0000
committerVincent Hamm2007-12-25 21:03:20 +0000
commit1b62e2758c198f92956815fc66b979f4673c3cbe (patch)
treefd24c4295e4b52751aed04993af261fc7ee1c173
parentb2ab69f455978a4dffc4fcb8cd6148edbb886327 (diff)
downloadscummvm-rg350-1b62e2758c198f92956815fc66b979f4673c3cbe.tar.gz
scummvm-rg350-1b62e2758c198f92956815fc66b979f4673c3cbe.tar.bz2
scummvm-rg350-1b62e2758c198f92956815fc66b979f4673c3cbe.zip
Fix input
Fix timming svn-id: r29990
-rw-r--r--engines/cruise/cruise_main.cpp31
-rw-r--r--engines/cruise/function.cpp2
-rw-r--r--engines/cruise/gfxModule.cpp14
-rw-r--r--engines/cruise/mainDraw.cpp17
4 files changed, 43 insertions, 21 deletions
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 4f7f11fd2e..457ac5a9e1 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1593,12 +1593,6 @@ int currentMouseX = 0;
int currentMouseY = 0;
int currentMouseButton = 0;
-void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) {
- *pMouseX = currentMouseX;
- *pMouseY = currentMouseY;
- *pMouseButton = currentMouseButton;
-}
-
bool bFastMode = false;
void manageEvents() {
@@ -1730,11 +1724,13 @@ void manageEvents() {
* mouseRight = 0;
* }
*/
- g_system->updateScreen();
+}
- if (!bFastMode) {
- g_system->delayMillis(40);
- }
+void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) {
+ manageEvents();
+ *pMouseX = currentMouseX;
+ *pMouseY = currentMouseY;
+ *pMouseButton = currentMouseButton;
}
void mainLoop(void) {
@@ -1849,8 +1845,15 @@ void mainLoop(void) {
}
if (userWait) {
- int16 button = 0;
- while (!button) {
+ int16 mouseX;
+ int16 mouseY;
+ int16 mouseButton;
+
+ do {
+ getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
+ }while(mouseButton);
+
+ while (!mouseButton) {
manageScripts(&relHead);
manageScripts(&procHead);
@@ -1865,7 +1868,9 @@ void mainLoop(void) {
int16 mouseVar;
int16 mouseX;
int16 mouseY;
- getMouseStatus(&mouseVar, &mouseX, &button, &mouseY);
+ getMouseStatus(&mouseVar, &mouseX, &mouseButton, &mouseY);
+
+ flip();
}
changeScriptParamInList(-1, -1, &procHead, 9999, 0);
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index e8322d1edd..963dce6996 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -619,7 +619,7 @@ int16 Op_GetMouseButton(void) {
getMouseStatus(&dummy, &mouseX, &mouseButton, &mouseY);
- if (mouseButton & 4)
+ if (mouseButton)
return 1;
return 0;
}
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 8460b2a6b7..ffc2462fd1 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -221,6 +221,10 @@ void gfxModuleData_flipScreen(void) {
flip();
}
+extern bool bFastMode;
+
+static uint32 lastTick;
+
void flip() {
int i;
byte paletteRGBA[256 * 4];
@@ -242,6 +246,16 @@ void flip() {
g_system->copyRectToScreen(globalScreen, 320, 0, 0, 320, 200);
g_system->updateScreen();
+ uint32 currentTick = g_system->getMillis();
+
+ if (!bFastMode) {
+ uint32 speed = 50;
+ if(lastTick + speed > currentTick) {
+ g_system->delayMillis(lastTick + speed - currentTick);
+ }
+ }
+
+ lastTick = g_system->getMillis();
}
} // End of namespace Cruise
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index 35785ae52a..9a6ed700f6 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -1145,7 +1145,7 @@ void mainDrawPolygons(int fileIndex, cellStruct *plWork, int X, int scale, int Y
buildPolyModel(newX, newY, newScale, (char*)polygonMask, destBuffer, newFrame);
}
-void drawMessage(gfxEntryStruct *pGfxPtr, int globalX, int globalY, int idx, int newColor, uint8 *ouputPtr) {
+void drawMessage(gfxEntryStruct *pGfxPtr, int globalX, int globalY, int width, int newColor, uint8 *ouputPtr) {
// this is used for font only
if (pGfxPtr) {
@@ -1157,11 +1157,15 @@ void drawMessage(gfxEntryStruct *pGfxPtr, int globalX, int globalY, int idx, int
int y;
uint8 *ptr = pGfxPtr->imagePtr;
int height = pGfxPtr->height;
- int width = pGfxPtr->width;
- if (globalY < 0) {
+ if (width>310)
+ width = 310;
+ if(width+globalX>319)
+ globalX = 319 - width;
+ if(globalY < 0)
globalY = 0;
- }
+ if(globalX < 0)
+ globalX = 0;
if (globalY + pGfxPtr->height >= 198) {
globalY = 198 - pGfxPtr->height;
@@ -1175,12 +1179,11 @@ void drawMessage(gfxEntryStruct *pGfxPtr, int globalX, int globalY, int idx, int
for (i = 0; i < height; i++) {
output = initialOuput + 320 * i;
- for (j = 0; j < width; j++) {
+ for (j = 0; j < pGfxPtr->width; j++) {
uint8 color = *(ptr++);
if (color) {
- if ((x >= 0) && (x < 320) && (y >= 0)
- && (y < 200)) {
+ if ((x >= 0) && (x < 320) && (y >= 0) && (y < 200)) {
if (color == 1) {
*output = (uint8) 0;
} else {