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);
}
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);

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

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

View file

@ -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;

View file

@ -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;