From 38463e61619fe1e4d2b6c59313d99c40482d7411 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 22 Oct 2010 02:08:26 +0000 Subject: KYRA: A little refactoring (name change). svn-id: r53695 --- engines/kyra/kyra_hof.cpp | 26 +++++++++++++------------- engines/kyra/kyra_mr.cpp | 22 +++++++++++----------- engines/kyra/kyra_v2.h | 3 ++- engines/kyra/scene_hof.cpp | 12 ++++++------ engines/kyra/scene_mr.cpp | 14 +++++++------- engines/kyra/script_v2.cpp | 2 +- 6 files changed, 40 insertions(+), 39 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 0fafaa15ce..8159fc0347 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -507,7 +507,7 @@ void KyraEngine_HoF::runLoop() { update(); if (inputFlag == 198 || inputFlag == 199) { - _unk3 = _mouseState; + _savedMouseState = _mouseState; handleInput(_mouseX, _mouseY); } @@ -528,7 +528,7 @@ void KyraEngine_HoF::handleInput(int x, int y) { if (!_screen->isMouseVisible()) return; - if (_unk3 == -2) { + if (_savedMouseState == -2) { snd_playSoundEffect(13); return; } @@ -537,8 +537,8 @@ void KyraEngine_HoF::handleInput(int x, int y) { if (x <= 6 || x >= 312 || y <= 6 || y >= 135) { bool exitOk = false; - assert(_unk3 + 6 >= 0); - switch (_unk3 + 6) { + assert(_savedMouseState + 6 >= 0); + switch (_savedMouseState + 6) { case 0: if (_sceneExit1 != 0xFFFF) exitOk = true; @@ -569,7 +569,7 @@ void KyraEngine_HoF::handleInput(int x, int y) { } } - if (checkCharCollision(x, y) && _unk3 >= -1) { + if (checkCharCollision(x, y) && _savedMouseState >= -1) { runSceneScript2(); return; } else if (pickUpItem(x, y)) { @@ -609,7 +609,7 @@ void KyraEngine_HoF::handleInput(int x, int y) { dropItem(0, _itemInHand, x, y, 1); } else { - if (_unk3 == -2 || y > 135) + if (_savedMouseState == -2 || y > 135) return; if (!_unk5) { @@ -1169,25 +1169,25 @@ int KyraEngine_HoF::inputSceneChange(int x, int y, int unk1, int unk2) { _pathfinderFlag = 15; if (!_unkHandleSceneChangeFlag) { - if (_unk3 == -3) { + if (_savedMouseState == -3) { if (_sceneList[curScene].exit4 != 0xFFFF) { x = 4; y = _sceneEnterY4; _pathfinderFlag = 7; } - } else if (_unk3 == -5) { + } else if (_savedMouseState == -5) { if (_sceneList[curScene].exit2 != 0xFFFF) { x = 316; y = _sceneEnterY2; _pathfinderFlag = 7; } - } else if (_unk3 == -6) { + } else if (_savedMouseState == -6) { if (_sceneList[curScene].exit1 != 0xFFFF) { x = _sceneEnterX1; y = _sceneEnterY1 - 2; _pathfinderFlag = 14; } - } else if (_unk3 == -4) { + } else if (_savedMouseState == -4) { if (_sceneList[curScene].exit3 != 0xFFFF) { x = _sceneEnterX3; y = 147; @@ -1200,13 +1200,13 @@ int KyraEngine_HoF::inputSceneChange(int x, int y, int unk1, int unk2) { int vocH = _flags.isTalkie ? 131 : -1; if (_pathfinderFlag) { - if (findItem(curScene, 13) >= 0 && _unk3 <= -3) { + if (findItem(curScene, 13) >= 0 && _savedMouseState <= -3) { strId = 252; } else if (_itemInHand == 72) { strId = 257; - } else if (findItem(curScene, 72) >= 0 && _unk3 <= -3) { + } else if (findItem(curScene, 72) >= 0 && _savedMouseState <= -3) { strId = 256; - } else if (getInventoryItemSlot(72) != -1 && _unk3 <= -3) { + } else if (getInventoryItemSlot(72) != -1 && _savedMouseState <= -3) { strId = 257; } } diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index c224a76385..d24ecff83d 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -100,7 +100,7 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi _unkSceneScreenFlag1 = false; _noScriptEnter = true; _itemInHand = _mouseState = -1; - _unk3 = -1; + _savedMouseState = -1; _unk4 = 0; _loadingState = false; _noStartupChat = false; @@ -966,7 +966,7 @@ void KyraEngine_MR::runLoop() { _timer->update(); if (inputFlag == 198 || inputFlag == 199) { - _unk3 = _mouseState; + _savedMouseState = _mouseState; Common::Point mouse = getMousePos(); handleInput(mouse.x, mouse.y); } @@ -988,7 +988,7 @@ void KyraEngine_MR::handleInput(int x, int y) { if (!_screen->isMouseVisible()) return; - if (_unk3 == -3) { + if (_savedMouseState == -3) { snd_playSoundEffect(0x0D, 0x80); return; } @@ -997,7 +997,7 @@ void KyraEngine_MR::handleInput(int x, int y) { int skip = 0; - if (checkCharCollision(x, y) && _unk3 >= -1 && runSceneScript2()) { + if (checkCharCollision(x, y) && _savedMouseState >= -1 && runSceneScript2()) { return; } else if (_itemInHand != 27 && pickUpItem(x, y, 1)) { return; @@ -1023,7 +1023,7 @@ void KyraEngine_MR::handleInput(int x, int y) { if (checkCharCollision(x, y)) { if (runSceneScript2()) return; - } else if (_itemInHand >= 0 && _unk3 >= 0) { + } else if (_itemInHand >= 0 && _savedMouseState >= 0) { if (_itemInHand == 27) { makeCharFacingMouse(); } else if (y <= 187) { @@ -1033,10 +1033,10 @@ void KyraEngine_MR::handleInput(int x, int y) { dropItem(0, _itemInHand, x, y, 1); } return; - } else if (_unk3 == -3) { + } else if (_savedMouseState == -3) { return; } else { - if (y > 187 && _unk3 > -4) + if (y > 187 && _savedMouseState > -4) return; if (_unk5) { _unk5 = 0; @@ -1052,25 +1052,25 @@ int KyraEngine_MR::inputSceneChange(int x, int y, int unk1, int unk2) { _pathfinderFlag = 15; if (!_unkHandleSceneChangeFlag) { - if (_unk3 == -4) { + if (_savedMouseState == -4) { if (_sceneList[curScene].exit4 != 0xFFFF) { x = 4; y = _sceneEnterY4; _pathfinderFlag = 7; } - } else if (_unk3 == -6) { + } else if (_savedMouseState == -6) { if (_sceneList[curScene].exit2 != 0xFFFF) { x = 316; y = _sceneEnterY2; _pathfinderFlag = 7; } - } else if (_unk3 == -7) { + } else if (_savedMouseState == -7) { if (_sceneList[curScene].exit1 != 0xFFFF) { x = _sceneEnterX1; y = _sceneEnterY1 - 2; _pathfinderFlag = 14; } - } else if (_unk3 == -5) { + } else if (_savedMouseState == -5) { if (_sceneList[curScene].exit3 != 0xFFFF) { x = _sceneEnterX3; y = 191; diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 6414040344..697a4aa88c 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -301,6 +301,7 @@ protected: int _itemListSize; int _itemInHand; + int _savedMouseState; int findFreeItem(); int countAllItems(); @@ -360,7 +361,7 @@ protected: virtual void randomSceneChat() = 0; // unknown - int _unk3, _unk4, _unk5; + int _unk4, _unk5; bool _unkSceneScreenFlag1; bool _unkHandleSceneChangeFlag; diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp index 4559554d77..79827361a3 100644 --- a/engines/kyra/scene_hof.cpp +++ b/engines/kyra/scene_hof.cpp @@ -241,7 +241,7 @@ void KyraEngine_HoF::enterNewSceneUnk1(int facing, int unk1, int unk2) { } void KyraEngine_HoF::enterNewSceneUnk2(int unk1) { - _unk3 = -1; + _savedMouseState = -1; if (_flags.isTalkie) { if (_mainCharX == -1 && _mainCharY == -1 && _mainCharacter.sceneId != 61 && @@ -265,7 +265,7 @@ void KyraEngine_HoF::enterNewSceneUnk2(int unk1) { } _unk4 = 0; - _unk3 = -1; + _savedMouseState = -1; } int KyraEngine_HoF::trySceneChange(int *moveTable, int unk1, int updateChar) { @@ -339,16 +339,16 @@ int KyraEngine_HoF::checkSceneChange() { int facing = 0; int process = 0; - if (_screen->getLayer(charX, charY) == 1 && _unk3 == -6) { + if (_screen->getLayer(charX, charY) == 1 && _savedMouseState == -6) { facing = 0; process = 1; - } else if (charX >= 316 && _unk3 == -5) { + } else if (charX >= 316 && _savedMouseState == -5) { facing = 2; process = 1; - } else if (charY >= 142 && _unk3 == -4) { + } else if (charY >= 142 && _savedMouseState == -4) { facing = 4; process = 1; - } else if (charX <= 4 && _unk3 == -3) { + } else if (charX <= 4 && _savedMouseState == -3) { facing = 6; process = 1; } diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index bd0a1fe544..95243e9d5c 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -287,7 +287,7 @@ void KyraEngine_MR::enterNewSceneUnk1(int facing, int unk1, int unk2) { } void KyraEngine_MR::enterNewSceneUnk2(int unk1) { - _unk3 = -1; + _savedMouseState = -1; if (_mainCharX == -1 && _mainCharY == -1 && !unk1) { _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; updateCharacterAnim(0); @@ -300,7 +300,7 @@ void KyraEngine_MR::enterNewSceneUnk2(int unk1) { } _unk4 = 0; - _unk3 = -1; + _savedMouseState = -1; } void KyraEngine_MR::unloadScene() { @@ -696,16 +696,16 @@ int KyraEngine_MR::checkSceneChange() { int facing = 0; int process = 0; - if (_screen->getLayer(charX, charY) == 1 && _unk3 == -7) { + if (_screen->getLayer(charX, charY) == 1 && _savedMouseState == -7) { facing = 0; process = 1; - } else if (charX >= 316 && _unk3 == -6) { + } else if (charX >= 316 && _savedMouseState == -6) { facing = 2; process = 1; - } else if (charY >= 186 && _unk3 == -5) { + } else if (charY >= 186 && _savedMouseState == -5) { facing = 4; process = 1; - } else if (charX <= 4 && _unk3 == -4) { + } else if (charX <= 4 && _savedMouseState == -4) { facing = 6; process = 1; } @@ -742,7 +742,7 @@ int KyraEngine_MR::checkSceneChange() { return 1; } int KyraEngine_MR::runSceneScript1(int x, int y) { - if (y > 187 && _unk3 > -4) + if (y > 187 && _savedMouseState > -4) return 0; if (_deathHandler >= 0) return 0; diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index 01f058c383..17e882398e 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -69,7 +69,7 @@ int KyraEngine_v2::o2_trySceneChange(EMCState *script) { if (success) { _emc->init(script, script->dataPtr); _unk4 = 0; - _unk3 = -1; + _savedMouseState = -1; _unk5 = 1; return 0; } else { -- cgit v1.2.3