From bd39b6baae4418ed85d2a7598be322ffdea461e0 Mon Sep 17 00:00:00 2001 From: Eric Fry Date: Tue, 11 Feb 2020 10:21:09 +1100 Subject: [PATCH] DRAGONS: Removed goto from game loop. renamed counter to flickerIdleCounter --- engines/dragons/dragons.cpp | 36 ++++++++++++++++++------------------ engines/dragons/dragons.h | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp index f045064dc88..a58a9b22caf 100644 --- a/engines/dragons/dragons.cpp +++ b/engines/dragons/dragons.cpp @@ -267,7 +267,7 @@ void DragonsEngine::gameLoop() { _cursor->_cursorActivationSeqOffset = 0; _bit_flags_8006fbd8 = 0; - _counter = 0; + _flickerIdleCounter = 0; setFlags(ENGINE_FLAG_8); actorId = 0; @@ -283,8 +283,8 @@ void DragonsEngine::gameLoop() { _sceneId1 = getCurrentSceneId(); } - _counter++; - if (_counter >= 0x4af) { + _flickerIdleCounter++; + if (_flickerIdleCounter >= 0x4af) { pDVar8 = _dragonINIResource->getFlickerRecord(); if (pDVar8->actor->_resourceID == 0xe) { pDVar8->actor->_direction = 2; @@ -295,13 +295,13 @@ void DragonsEngine::gameLoop() { sequenceId = 2; } pDVar8->actor->updateSequence(sequenceId); - _counter = 0; + _flickerIdleCounter = 0; setFlags(ENGINE_FLAG_80000000); } } if (isFlagSet(ENGINE_FLAG_80000000) && _dragonINIResource->getFlickerRecord()->actor->isFlagSet(ACTOR_FLAG_4)) { - _counter = 0; + _flickerIdleCounter = 0; clearFlags(ENGINE_FLAG_80000000); } if (_bit_flags_8006fbd8 == 0) { @@ -310,8 +310,9 @@ void DragonsEngine::gameLoop() { if (_dragonINIResource->getFlickerRecord()->sceneId == getCurrentSceneId()) { uVar3 = ipt_img_file_related(); actorId_00 = uVar3 & 0xffff; - if (actorId_00 == 0) goto LAB_80026d34; - if (actorId_00 != (actorId & 0xffff)) { + if (actorId_00 == 0) { + uVar3 = 0; + } else if (actorId_00 != (actorId & 0xffff)) { byte *obd = _dragonOBD->getFromOpt(actorId_00 - 1); ScriptOpCall scriptOpCall(obd + 8, READ_LE_UINT32(obd)); @@ -319,11 +320,10 @@ void DragonsEngine::gameLoop() { scriptOpCall._codeEnd = scriptOpCall._code + 4 + READ_LE_UINT16(scriptOpCall._code + 2); scriptOpCall._code += 4; _scriptOpcodes->runScript(scriptOpCall); - _counter = 0; + _flickerIdleCounter = 0; } } } else { - LAB_80026d34: uVar3 = 0; } @@ -336,7 +336,7 @@ void DragonsEngine::gameLoop() { if (_rightMouseButtonUp && isInputEnabled()) { _cursor->selectPreviousCursor(); - _counter = 0; + _flickerIdleCounter = 0; actorId = uVar3; continue; } @@ -363,7 +363,7 @@ void DragonsEngine::gameLoop() { // uVar6 = 3; // if (_cursor->_sequenceID == 2) goto LAB_80026fb0; // } -// _counter = 0; +// _flickerIdleCounter = 0; // actorId = uVar3; // continue; // } @@ -387,7 +387,7 @@ void DragonsEngine::gameLoop() { } else { setFlags(ENGINE_FLAG_8); } - _counter = 0; + _flickerIdleCounter = 0; actorId = uVar3; continue; } @@ -407,7 +407,7 @@ void DragonsEngine::gameLoop() { _inventory->inventoryMissing(); actorId = uVar3; } else { - _counter = 0; + _flickerIdleCounter = 0; _inventory->setType(1); _inventory->openInventory(); joined_r0x80027a38: @@ -423,7 +423,7 @@ void DragonsEngine::gameLoop() { } uVar6 = _inventory->getType(); if (checkForActionButtonRelease() && isFlagSet(ENGINE_FLAG_8)) { - _counter = 0; + _flickerIdleCounter = 0; if ((_cursor->_iniUnderCursor & 0x8000) != 0) { if (_cursor->_iniUnderCursor == 0x8002) { LAB_80027294: @@ -457,7 +457,7 @@ void DragonsEngine::gameLoop() { } } LAB_80027ab4: - _counter = 0; + _flickerIdleCounter = 0; _cursor->_data_80072890 = _cursor->_iniUnderCursor; if (_cursor->_sequenceID < 5) { _cursor->_data_800728b0_cursor_seqID = _cursor->_sequenceID; @@ -483,7 +483,7 @@ void DragonsEngine::gameLoop() { uVar7 = _inventory->_old_showing_value; if (_dragonVAR->getVar(7) == 1) goto LAB_800279f4; - _counter = 0; + _flickerIdleCounter = 0; _inventory->setType(1); _inventory->_old_showing_value = uVar6; _inventory->openInventory(); @@ -499,7 +499,7 @@ void DragonsEngine::gameLoop() { continue; } if (checkForInventoryButtonRelease()) { - _counter = 0; + _flickerIdleCounter = 0; LAB_80027970: _inventory->closeInventory(); uVar6 = _inventory->_old_showing_value; @@ -510,7 +510,7 @@ void DragonsEngine::gameLoop() { } uVar6 = _inventory->getType(); if (checkForActionButtonRelease() && isFlagSet(ENGINE_FLAG_8)) { - _counter = 0; + _flickerIdleCounter = 0; if ((_cursor->_iniUnderCursor & 0x8000) != 0) { if (_cursor->_iniUnderCursor == 0x8001) { _inventory->closeInventory(); diff --git a/engines/dragons/dragons.h b/engines/dragons/dragons.h index 2dff40b9825..de1112d0434 100644 --- a/engines/dragons/dragons.h +++ b/engines/dragons/dragons.h @@ -164,7 +164,7 @@ private: uint32 _flags; uint32 _unkFlags1; Common::Point _cursorPosition; - uint32 _counter; + uint32 _flickerIdleCounter; uint32 _bit_flags_8006fbd8; //unk