diff options
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/drascula.cpp | 64 | ||||
-rw-r--r-- | engines/drascula/drascula.h | 4 | ||||
-rw-r--r-- | engines/drascula/graphics.cpp | 28 | ||||
-rw-r--r-- | engines/drascula/interface.cpp | 8 | ||||
-rw-r--r-- | engines/drascula/objects.cpp | 10 | ||||
-rw-r--r-- | engines/drascula/rooms.cpp | 10 | ||||
-rw-r--r-- | engines/drascula/saveload.cpp | 2 |
7 files changed, 71 insertions, 55 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index b39df842f4..a3c56be1f4 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -186,24 +186,40 @@ Common::Error DrasculaEngine::run() { memset(VGA, 0, 64000); takeObject = 0; - menuBar = 0; menuScreen = 0; hasName = 0; + _menuBar = false; + _menuScreen = false; + _hasName = false; frame_y = 0; - curX = -1; characterMoved = 0; trackProtagonist = 3; num_frame = 0; hare_se_ve = 1; + curX = -1; + characterMoved = 0; + trackProtagonist = 3; + num_frame = 0; + hare_se_ve = 1; checkFlags = 1; doBreak = 0; walkToObject = 0; - stepX = STEP_X; stepY = STEP_Y; - curHeight = CHARACTER_HEIGHT; curWidth = CHARACTER_WIDTH; feetHeight = FEET_HEIGHT; - talkHeight = TALK_HEIGHT; talkWidth = TALK_WIDTH; + + stepX = STEP_X; + stepY = STEP_Y; + + curHeight = CHARACTER_HEIGHT; + curWidth = CHARACTER_WIDTH; + feetHeight = FEET_HEIGHT; + + talkHeight = TALK_HEIGHT; + talkWidth = TALK_WIDTH; + hasAnswer = 0; savedTime = 0; breakOut = 0; - vonBraunX = 120; trackVonBraun = 1; vonBraunHasMoved = 0; + vonBraunX = 120; + trackVonBraun = 1; + vonBraunHasMoved = 0; framesWithoutAction = 0; term_int = 0; musicStopped = 0; selectionMade = 0; - UsingMem = 0; + _useMemForArj = false; globalSpeed = 0; curExcuseLook = 0; curExcuseAction = 0; @@ -467,14 +483,14 @@ bool DrasculaEngine::runCurrentChapter() { updateEvents(); #endif - if (menuScreen == 0 && takeObject == 1) + if (!_menuScreen && takeObject == 1) checkObjects(); #ifdef _WIN32_WCE if (rightMouseButton) - if (menuScreen) { + if (_menuScreen) { #else - if (rightMouseButton == 1 && menuScreen == 1) { + if (rightMouseButton == 1 && _menuScreen) { #endif delay(100); if (currentChapter == 2) @@ -482,7 +498,7 @@ bool DrasculaEngine::runCurrentChapter() { else loadPic(99, backSurface); setPalette((byte *)&gamePalette); - menuScreen = 0; + _menuScreen = false; #ifndef _WIN32_WCE // FIXME: This call here is in hope that it will catch the rightmouseup event so the // next if block won't be executed. This too is not a good coding practice. I've recoded it @@ -498,7 +514,7 @@ bool DrasculaEngine::runCurrentChapter() { // Do not show the inventory screen in chapter 5, if the right mouse button is clicked // while the plug (object 16) is held // Fixes bug #2059621 - "DRASCULA: Plug bug" - if (rightMouseButton == 1 && menuScreen == 0 && + if (rightMouseButton == 1 && !_menuScreen && !(currentChapter == 5 && pickedObject == 16)) { #endif delay(100); @@ -513,14 +529,14 @@ bool DrasculaEngine::runCurrentChapter() { loadPic("iconsp.alg", backSurface); else loadPic("icons.alg", backSurface); - menuScreen = 1; + _menuScreen = true; #ifndef _WIN32_WCE updateEvents(); #endif selectVerb(kVerbNone); } - if (leftMouseButton == 1 && menuBar == 1) { + if (leftMouseButton == 1 && _menuBar) { delay(100); selectVerbFromBar(); } else if (leftMouseButton == 1 && takeObject == 0) { @@ -532,20 +548,20 @@ bool DrasculaEngine::runCurrentChapter() { return true; } - menuBar = (mouseY < 24 && menuScreen == 0) ? 1 : 0; + _menuBar = (mouseY < 24 && !_menuScreen) ? true : false; Common::KeyCode key = getScan(); - if (key == Common::KEYCODE_F1 && menuScreen == 0) { + if (key == Common::KEYCODE_F1 && !_menuScreen) { selectVerb(kVerbLook); - } else if (key == Common::KEYCODE_F2 && menuScreen == 0) { + } else if (key == Common::KEYCODE_F2 && !_menuScreen) { selectVerb(kVerbPick); - } else if (key == Common::KEYCODE_F3 && menuScreen == 0) { + } else if (key == Common::KEYCODE_F3 && !_menuScreen) { selectVerb(kVerbOpen); - } else if (key == Common::KEYCODE_F4 && menuScreen == 0) { + } else if (key == Common::KEYCODE_F4 && !_menuScreen) { selectVerb(kVerbClose); - } else if (key == Common::KEYCODE_F5 && menuScreen == 0) { + } else if (key == Common::KEYCODE_F5 && !_menuScreen) { selectVerb(kVerbTalk); - } else if (key == Common::KEYCODE_F6 && menuScreen == 0) { + } else if (key == Common::KEYCODE_F6 && !_menuScreen) { selectVerb(kVerbMove); } else if (key == Common::KEYCODE_F9) { volumeControls(); @@ -629,7 +645,7 @@ void DrasculaEngine::getStringFromLine(char *buf, int len, char* result) { bool DrasculaEngine::verify1() { int l; - if (menuScreen == 1) + if (_menuScreen) removeObject(); else { for (l = 0; l < numRoomObjs; l++) { @@ -672,11 +688,11 @@ bool DrasculaEngine::verify1() { bool DrasculaEngine::verify2() { int l; - if (menuScreen == 1) { + if (_menuScreen) { if (pickupObject()) return true; } else { - if (!strcmp(textName, "hacker") && hasName == 1) { + if (!strcmp(textName, "hacker") && _hasName) { if (checkAction(50)) return true; } else { diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 85761a6b1e..b06a2c9d4b 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -381,7 +381,7 @@ public: int x1[40], y1[40], x2[40], y2[40]; int takeObject, pickedObject; bool _subtitlesDisabled; - int menuBar, menuScreen, hasName; + bool _menuBar, _menuScreen, _hasName; char textName[20]; int curExcuseLook; int curExcuseAction; @@ -538,7 +538,7 @@ public: byte *TryInMem(); int playFrameSSN(); - int UsingMem; + bool _useMemForArj; byte CHUNK; byte CMP, dacSSN[768]; int FrameSSN; diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index d97f95c5ef..76a551c980 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -73,16 +73,16 @@ void DrasculaEngine::moveCursor() { moveCharacters(); updateRefresh(); - if (!strcmp(textName, "hacker") && hasName == 1) { - if (_color != kColorRed && menuScreen == 0) + if (!strcmp(textName, "hacker") && _hasName) { + if (_color != kColorRed && !_menuScreen) color_abc(kColorRed); - } else if (menuScreen == 0 && _color != kColorLightGreen) + } else if (!_menuScreen && _color != kColorLightGreen) color_abc(kColorLightGreen); - if (hasName == 1 && menuScreen == 0) + if (_hasName && !_menuScreen) centerText(textName, mouseX, mouseY); - if (menuScreen == 1) + if (_menuScreen) showMenu(); - else if (menuBar == 1) + else if (_menuBar) clearMenu(); } @@ -449,7 +449,7 @@ void DrasculaEngine::playFLI(const char *filefli, int vel) { // Open file globalSpeed = 1000 / vel; FrameSSN = 0; - UsingMem = 0; + _useMemForArj = false; _arj.open(filefli); mSession = TryInMem(); LastFrame = _system->getMillis(); @@ -459,7 +459,7 @@ void DrasculaEngine::playFLI(const char *filefli, int vel) { term_int = 1; } - if (UsingMem) + if (_useMemForArj) free(memPtr); else _arj.close(); @@ -470,7 +470,7 @@ int DrasculaEngine::playFrameSSN() { uint32 length; byte *BufferSSN; - if (!UsingMem) + if (!_useMemForArj) CHUNK = _arj.readByte(); else { memcpy(&CHUNK, mSession, 1); @@ -479,7 +479,7 @@ int DrasculaEngine::playFrameSSN() { switch (CHUNK) { case kFrameSetPal: - if (!UsingMem) { + if (!_useMemForArj) { for (int i = 0; i < 256; i++) { dacSSN[i * 3 + 0] = _arj.readByte(); dacSSN[i * 3 + 1] = _arj.readByte(); @@ -495,7 +495,7 @@ int DrasculaEngine::playFrameSSN() { waitFrameSSN(); break; case kFrameInit: - if (!UsingMem) { + if (!_useMemForArj) { CMP = _arj.readByte(); length = _arj.readUint32LE(); } else { @@ -506,7 +506,7 @@ int DrasculaEngine::playFrameSSN() { } if (CMP == kFrameCmpRle) { BufferSSN = (byte *)malloc(length); - if (!UsingMem) { + if (!_useMemForArj) { _arj.read(BufferSSN, length); } else { memcpy(BufferSSN, mSession, length); @@ -525,7 +525,7 @@ int DrasculaEngine::playFrameSSN() { } else { if (CMP == kFrameCmpOff) { BufferSSN = (byte *)malloc(length); - if (!UsingMem) { + if (!_useMemForArj) { _arj.read(BufferSSN, length); } else { memcpy(BufferSSN, mSession, length); @@ -565,7 +565,7 @@ byte *DrasculaEngine::TryInMem() { if (memPtr == NULL) return NULL; _arj.read(memPtr, length); - UsingMem = 1; + _useMemForArj = true; _arj.close(); return memPtr; diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp index 1e148aff9b..5f09542e8c 100644 --- a/engines/drascula/interface.cpp +++ b/engines/drascula/interface.cpp @@ -65,7 +65,7 @@ void DrasculaEngine::selectVerbFromBar() { } void DrasculaEngine::selectVerb(int verb) { - int c = (menuScreen == 1) ? 0 : 171; + int c = _menuScreen ? 0 : 171; if (currentChapter == 5) { if (takeObject == 1 && pickedObject != 16) @@ -84,7 +84,7 @@ void DrasculaEngine::selectVerb(int verb) { pickedObject = verb; } else { takeObject = 0; - hasName = 0; + _hasName = false; } } @@ -203,14 +203,14 @@ bool DrasculaEngine::checkMenuFlags() { } void DrasculaEngine::showMap() { - hasName = 0; + _hasName = false; for (int l = 0; l < numRoomObjs; l++) { if (mouseX > x1[l] && mouseY > y1[l] && mouseX < x2[l] && mouseY < y2[l] && visible[l] == 1) { strcpy(textName, objName[l]); - hasName = 1; + _hasName = true; } } } diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp index 4d1fcd67c0..b7b5185bab 100644 --- a/engines/drascula/objects.cpp +++ b/engines/drascula/objects.cpp @@ -45,10 +45,10 @@ void DrasculaEngine::pickObject(int object) { void DrasculaEngine::chooseObject(int object) { if (currentChapter == 5) { - if (takeObject == 1 && menuScreen == 0 && pickedObject != 16) + if (takeObject == 1 && !_menuScreen && pickedObject != 16) addObject(pickedObject); } else { - if (takeObject == 1 && menuScreen == 0) + if (takeObject == 1 && !_menuScreen) addObject(pickedObject); } for (int i = 0; i < OBJHEIGHT; i++) @@ -115,7 +115,7 @@ void DrasculaEngine::checkObjects() { && mouseX < x2[l] && mouseY < y2[l] && visible[l] == 1 && isDoor[l] == 0) { strcpy(textName, objName[l]); - hasName = 1; + _hasName = true; veo = 1; } } @@ -124,13 +124,13 @@ void DrasculaEngine::checkObjects() { && mouseX < curX + curWidth - 2 && mouseY < curY + curHeight - 2) { if (currentChapter == 2 || veo == 0) { strcpy(textName, "hacker"); - hasName = 1; + _hasName = true; veo = 1; } } if (veo == 0) - hasName = 0; + _hasName = false; } void DrasculaEngine::removeObject() { diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 18b859f064..8284112c1e 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -1502,11 +1502,11 @@ bool DrasculaEngine::checkAction(int fl) { hasAnswer = 1; - if (menuScreen == 1 && roomParse(200, fl)) { + if (_menuScreen && roomParse(200, fl)) { ; - } else if (menuScreen != 1 && roomParse(201, fl)) { + } else if (!_menuScreen && roomParse(201, fl)) { ; - } else if (menuScreen == 1) { + } else if (_menuScreen) { if (currentChapter == 1) { hasAnswer = 0; } else if (currentChapter == 2) { @@ -1607,7 +1607,7 @@ bool DrasculaEngine::checkAction(int fl) { room(roomNumber, fl); } - if (hasAnswer == 0 && (hasName == 1 || menuScreen == 1)) + if (hasAnswer == 0 && (_hasName || _menuScreen)) room(0, -1); showCursor(); @@ -1646,7 +1646,7 @@ void DrasculaEngine::enterRoom(int roomIndex) { char buffer[256]; int palLevel = 0; - hasName = 0; + _hasName = false; strcpy(currentData, fileName); diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index 937f4d388a..9745bb93fc 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -190,7 +190,7 @@ bool DrasculaEngine::loadGame(const char *gameName) { Common::InSaveFile *sav; previousMusic = roomMusic; - menuScreen = 0; + _menuScreen = false; if (currentChapter != 1) clearRoom(); |