CRUISE: Remove some useless variables, use a boolean for a variable

This commit is contained in:
Strangerke 2014-06-10 07:20:10 +02:00
parent 638814d3c4
commit 51184eab9d
8 changed files with 19 additions and 25 deletions

View file

@ -1157,7 +1157,7 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, 0, 0); createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, 0, 0);
} }
userWait = 1; userWait = true;
autoOvl = ovlIdx; autoOvl = ovlIdx;
autoMsg = pHeader->id; autoMsg = pHeader->id;
@ -1186,7 +1186,7 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
pTrack->flag = 1; pTrack->flag = 1;
autoTrack = true; autoTrack = true;
userWait = 0; userWait = false;
userEnabled = 0; userEnabled = 0;
freezeCell(&cellHead, ovlIdx, pHeader->id, 5, -1, 0, 9998); 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); createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, 0, 0);
} }
userWait = 1; userWait = true;
autoOvl = ovlIdx; autoOvl = ovlIdx;
autoMsg = pHeader->id; autoMsg = pHeader->id;
@ -1334,7 +1334,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) {
pTrack->flag = 1; pTrack->flag = 1;
autoTrack = true; autoTrack = true;
userWait = 0; userWait = false;
userEnabled = 0; userEnabled = 0;
freezeCell(&cellHead, ovlIdx, pHeader->id, 5, -1, 0, 9998); freezeCell(&cellHead, ovlIdx, pHeader->id, 5, -1, 0, 9998);
} }
@ -1455,7 +1455,7 @@ int CruiseEngine::processInput() {
if (userWait) { if (userWait) {
// Check for left mouse button click or Space to end user waiting // Check for left mouse button click or Space to end user waiting
if ((keyboardCode == Common::KEYCODE_SPACE) || (button == CRS_MB_LEFT)) if ((keyboardCode == Common::KEYCODE_SPACE) || (button == CRS_MB_LEFT))
userWait = 0; userWait = false;
keyboardCode = Common::KEYCODE_INVALID; keyboardCode = Common::KEYCODE_INVALID;
return 0; return 0;
@ -1772,9 +1772,7 @@ void CruiseEngine::mainLoop() {
currentActiveMenu = -1; currentActiveMenu = -1;
autoMsg = -1; autoMsg = -1;
linkedRelation = 0; linkedRelation = 0;
main21 = 0; userWait = false;
main22 = 0;
userWait = 0;
autoTrack = false; autoTrack = false;
initAllData(); initAllData();
@ -1857,7 +1855,7 @@ void CruiseEngine::mainLoop() {
// readKeyboard(); // readKeyboard();
bool isUserWait = userWait != 0; bool isUserWait = userWait;
// WORKAROUND: This prevents hotspots responding during // WORKAROUND: This prevents hotspots responding during
// delays i.e. Menu opening if you click fast on another // delays i.e. Menu opening if you click fast on another
// hotspot after trying to open a locked door, which // hotspot after trying to open a locked door, which
@ -1938,7 +1936,7 @@ void CruiseEngine::mainLoop() {
mainDraw(userWait); mainDraw(userWait);
flipScreen(); flipScreen();
if (userWait == 1) { if (userWait) {
// Waiting for press - original wait loop has been integrated into the // Waiting for press - original wait loop has been integrated into the
// main event loop // main event loop
continue; continue;
@ -1953,7 +1951,7 @@ void CruiseEngine::mainLoop() {
char* pText = getText(autoMsg, autoOvl); char* pText = getText(autoMsg, autoOvl);
if (strlen(pText)) if (strlen(pText))
userWait = 1; userWait = true;
} }
changeScriptParamInList(-1, -1, &relHead, 9998, 0); changeScriptParamInList(-1, -1, &relHead, 9998, 0);

View file

@ -1832,7 +1832,7 @@ int16 Op_ThemeReset() {
} }
int16 Op_UserWait() { int16 Op_UserWait() {
userWait = 1; userWait = true;
if (currentScriptPtr->type == scriptType_PROC) { if (currentScriptPtr->type == scriptType_PROC) {
changeScriptParamInList(currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber, &procHead, -1, 9999); changeScriptParamInList(currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber, &procHead, -1, 9999);
} else if (currentScriptPtr->type == scriptType_REL) { } else if (currentScriptPtr->type == scriptType_REL) {

View file

@ -1377,7 +1377,7 @@ int getValueFromObjectQuerry(objectParamsQuery *params, int idx) {
return 0; return 0;
} }
void mainDraw(int16 param) { void mainDraw(bool waitFl) {
uint8 *bgPtr; uint8 *bgPtr;
cellStruct *currentObjPtr; cellStruct *currentObjPtr;
int16 currentObjIdx; int16 currentObjIdx;
@ -1461,7 +1461,7 @@ void mainDraw(int16 param) {
} }
// automatic animation process // automatic animation process
if (currentObjPtr->animStep && !param) { if (currentObjPtr->animStep && !waitFl) {
if (currentObjPtr->animCounter <= 0) { if (currentObjPtr->animCounter <= 0) {
bool change = true; bool change = true;

View file

@ -33,7 +33,7 @@ extern int m_color;
int upscaleValue(int value, int scale); int upscaleValue(int value, int scale);
void pixel(int x, int y, char color); void pixel(int x, int y, char color);
void mainDraw(int16 param); void mainDraw(bool waitFl);
void flipScreen(); void flipScreen();
void buildPolyModel(int X, int Y, int scale, char *ptr2, char *destBuffer, char *dataPtr); 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); void drawSprite(int width, int height, cellStruct *currentObjPtr, const uint8 *dataIn, int ys, int xs, uint8 *output, const uint8 *dataBuf);

View file

@ -160,7 +160,7 @@ int processMenu(menuStruct *pMenu) {
int si; int si;
currentActiveMenu = 0; currentActiveMenu = 0;
mainDraw(1); mainDraw(true);
flipScreen(); flipScreen();
di = 0; di = 0;
@ -179,7 +179,7 @@ int processMenu(menuStruct *pMenu) {
di = 1; di = 1;
} }
mainDraw(1); mainDraw(true);
flipScreen(); flipScreen();
manageEvents(); manageEvents();
@ -190,7 +190,7 @@ int processMenu(menuStruct *pMenu) {
currentActiveMenu = -1; currentActiveMenu = -1;
mainDraw(1); mainDraw(true);
flipScreen(); flipScreen();
if (mouseButton & 1) { if (mouseButton & 1) {

View file

@ -947,7 +947,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
// to finish // to finish
changeCursor(CURSOR_NORMAL); changeCursor(CURSOR_NORMAL);
mainDraw(1); mainDraw(true);
flipScreen(); flipScreen();
return Common::kNoError; return Common::kNoError;

View file

@ -53,9 +53,7 @@ char nextOverlay[38];
int16 currentActiveMenu; int16 currentActiveMenu;
int16 autoMsg; int16 autoMsg;
menuElementSubStruct* linkedRelation; menuElementSubStruct* linkedRelation;
int16 main21; bool userWait;
int16 main22;
int16 userWait;
int16 autoTrack; int16 autoTrack;
int16 currentDiskNumber = 1; int16 currentDiskNumber = 1;

View file

@ -156,9 +156,7 @@ extern char nextOverlay[38];
extern int16 currentActiveMenu; extern int16 currentActiveMenu;
extern int16 autoMsg; extern int16 autoMsg;
extern menuElementSubStruct* linkedRelation; extern menuElementSubStruct* linkedRelation;
extern int16 main21; extern bool userWait;
extern int16 main22;
extern int16 userWait;
extern int16 autoTrack; extern int16 autoTrack;
extern int16 currentDiskNumber; extern int16 currentDiskNumber;