From 51184eab9d24567fed0e3064aa445be0bf21a9d8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 10 Jun 2014 07:20:10 +0200 Subject: CRUISE: Remove some useless variables, use a boolean for a variable --- engines/cruise/cruise_main.cpp | 20 +++++++++----------- engines/cruise/function.cpp | 2 +- engines/cruise/mainDraw.cpp | 4 ++-- engines/cruise/mainDraw.h | 2 +- engines/cruise/menu.cpp | 6 +++--- engines/cruise/saveload.cpp | 2 +- engines/cruise/vars.cpp | 4 +--- engines/cruise/vars.h | 4 +--- 8 files changed, 19 insertions(+), 25 deletions(-) (limited to 'engines') diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index cab3e41dd4..2de8d273f7 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1157,7 +1157,7 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, 0, 0); } - userWait = 1; + userWait = true; autoOvl = ovlIdx; autoMsg = pHeader->id; @@ -1186,7 +1186,7 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { pTrack->flag = 1; autoTrack = true; - userWait = 0; + userWait = false; userEnabled = 0; freezeCell(&cellHead, ovlIdx, pHeader->id, 5, -1, 0, 9998); } @@ -1303,7 +1303,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) { createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, 0, 0); } - userWait = 1; + userWait = true; autoOvl = ovlIdx; autoMsg = pHeader->id; @@ -1334,7 +1334,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) { pTrack->flag = 1; autoTrack = true; - userWait = 0; + userWait = false; userEnabled = 0; freezeCell(&cellHead, ovlIdx, pHeader->id, 5, -1, 0, 9998); } @@ -1455,7 +1455,7 @@ int CruiseEngine::processInput() { if (userWait) { // Check for left mouse button click or Space to end user waiting if ((keyboardCode == Common::KEYCODE_SPACE) || (button == CRS_MB_LEFT)) - userWait = 0; + userWait = false; keyboardCode = Common::KEYCODE_INVALID; return 0; @@ -1772,9 +1772,7 @@ void CruiseEngine::mainLoop() { currentActiveMenu = -1; autoMsg = -1; linkedRelation = 0; - main21 = 0; - main22 = 0; - userWait = 0; + userWait = false; autoTrack = false; initAllData(); @@ -1857,7 +1855,7 @@ void CruiseEngine::mainLoop() { // readKeyboard(); - bool isUserWait = userWait != 0; + bool isUserWait = userWait; // WORKAROUND: This prevents hotspots responding during // delays i.e. Menu opening if you click fast on another // hotspot after trying to open a locked door, which @@ -1938,7 +1936,7 @@ void CruiseEngine::mainLoop() { mainDraw(userWait); flipScreen(); - if (userWait == 1) { + if (userWait) { // Waiting for press - original wait loop has been integrated into the // main event loop continue; @@ -1953,7 +1951,7 @@ void CruiseEngine::mainLoop() { char* pText = getText(autoMsg, autoOvl); if (strlen(pText)) - userWait = 1; + userWait = true; } changeScriptParamInList(-1, -1, &relHead, 9998, 0); diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index c530074969..3f794c4e70 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -1832,7 +1832,7 @@ int16 Op_ThemeReset() { } int16 Op_UserWait() { - userWait = 1; + userWait = true; if (currentScriptPtr->type == scriptType_PROC) { changeScriptParamInList(currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber, &procHead, -1, 9999); } else if (currentScriptPtr->type == scriptType_REL) { diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp index 98e7e66aa6..5777b846b4 100644 --- a/engines/cruise/mainDraw.cpp +++ b/engines/cruise/mainDraw.cpp @@ -1377,7 +1377,7 @@ int getValueFromObjectQuerry(objectParamsQuery *params, int idx) { return 0; } -void mainDraw(int16 param) { +void mainDraw(bool waitFl) { uint8 *bgPtr; cellStruct *currentObjPtr; int16 currentObjIdx; @@ -1461,7 +1461,7 @@ void mainDraw(int16 param) { } // automatic animation process - if (currentObjPtr->animStep && !param) { + if (currentObjPtr->animStep && !waitFl) { if (currentObjPtr->animCounter <= 0) { bool change = true; diff --git a/engines/cruise/mainDraw.h b/engines/cruise/mainDraw.h index bb71b9759b..1af403fca5 100644 --- a/engines/cruise/mainDraw.h +++ b/engines/cruise/mainDraw.h @@ -33,7 +33,7 @@ extern int m_color; int upscaleValue(int value, int scale); void pixel(int x, int y, char color); -void mainDraw(int16 param); +void mainDraw(bool waitFl); void flipScreen(); void buildPolyModel(int X, int Y, int scale, char *ptr2, char *destBuffer, char *dataPtr); void drawSprite(int width, int height, cellStruct *currentObjPtr, const uint8 *dataIn, int ys, int xs, uint8 *output, const uint8 *dataBuf); diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp index c72192fc1b..cf0b872646 100644 --- a/engines/cruise/menu.cpp +++ b/engines/cruise/menu.cpp @@ -160,7 +160,7 @@ int processMenu(menuStruct *pMenu) { int si; currentActiveMenu = 0; - mainDraw(1); + mainDraw(true); flipScreen(); di = 0; @@ -179,7 +179,7 @@ int processMenu(menuStruct *pMenu) { di = 1; } - mainDraw(1); + mainDraw(true); flipScreen(); manageEvents(); @@ -190,7 +190,7 @@ int processMenu(menuStruct *pMenu) { currentActiveMenu = -1; - mainDraw(1); + mainDraw(true); flipScreen(); if (mouseButton & 1) { diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp index 8e64faa14c..a62648df08 100644 --- a/engines/cruise/saveload.cpp +++ b/engines/cruise/saveload.cpp @@ -947,7 +947,7 @@ Common::Error loadSavegameData(int saveGameIdx) { // to finish changeCursor(CURSOR_NORMAL); - mainDraw(1); + mainDraw(true); flipScreen(); return Common::kNoError; diff --git a/engines/cruise/vars.cpp b/engines/cruise/vars.cpp index 9a59c8a714..e9b68968ef 100644 --- a/engines/cruise/vars.cpp +++ b/engines/cruise/vars.cpp @@ -53,9 +53,7 @@ char nextOverlay[38]; int16 currentActiveMenu; int16 autoMsg; menuElementSubStruct* linkedRelation; -int16 main21; -int16 main22; -int16 userWait; +bool userWait; int16 autoTrack; int16 currentDiskNumber = 1; diff --git a/engines/cruise/vars.h b/engines/cruise/vars.h index fe3f7d6303..e7c687d5fb 100644 --- a/engines/cruise/vars.h +++ b/engines/cruise/vars.h @@ -156,9 +156,7 @@ extern char nextOverlay[38]; extern int16 currentActiveMenu; extern int16 autoMsg; extern menuElementSubStruct* linkedRelation; -extern int16 main21; -extern int16 main22; -extern int16 userWait; +extern bool userWait; extern int16 autoTrack; extern int16 currentDiskNumber; -- cgit v1.2.3