diff --git a/engines/dragons/cursor.cpp b/engines/dragons/cursor.cpp index 462dd52c255..1012402bca9 100644 --- a/engines/dragons/cursor.cpp +++ b/engines/dragons/cursor.cpp @@ -270,7 +270,7 @@ int16 Cursor::updateIniFromScene() { } if (_sequenceID != 0) { _iniUnderCursor = cursorOverIni; - _data_80072890 = _data_80072890_orig; + _data_80072890 = data_80072890_orig; _data_800728b0_cursor_seqID = data_800728b0_cursor_seqID_orig; return _iniUnderCursor; } @@ -282,7 +282,7 @@ int16 Cursor::updateIniFromScene() { // local_44 = local_44 + local_48; if (executeScript(scriptOpCall, 0)) { _iniUnderCursor = cursorOverIni; - _data_80072890 = _data_80072890_orig; + _data_80072890 = data_80072890_orig; _data_800728b0_cursor_seqID = data_800728b0_cursor_seqID_orig; return _iniUnderCursor; } diff --git a/engines/dragons/cutscene.cpp b/engines/dragons/cutscene.cpp index 43d84f423f7..a6d1cce96dd 100644 --- a/engines/dragons/cutscene.cpp +++ b/engines/dragons/cutscene.cpp @@ -403,8 +403,7 @@ void CutScene::fun_8003d388() { if ((_actor_80063514 & 0x200) != 0) { if ((_actor_80063514 & 0x800) == 0) { sequenceId = 2; - } - else { + } else { sequenceId = 4; } _actor_800830d4 = _vm->_actorManager->loadActor(0xaa, sequenceId, 0xf4, 199, 1); diff --git a/engines/dragons/dragonini.h b/engines/dragons/dragonini.h index 3ba1d90716a..5beb8986c65 100644 --- a/engines/dragons/dragonini.h +++ b/engines/dragons/dragonini.h @@ -41,27 +41,26 @@ enum IniFlags { }; -struct DragonINI - { - uint16 id; - int16 iptIndex_maybe; - int16 field_2; - int16 actorResourceId; - uint16 sequenceId; - int16 field_8; - Actor *actor; - uint16 sceneId; - int16 field_e; - int16 field_10; - int16 field_12; - uint16 field_14; - int16 x; - int16 y; - uint16 field_1a_flags_maybe; - int16 field_1c; - int16 field_1e; - int16 field_20_actor_field_14; - }; +struct DragonINI { + uint16 id; + int16 iptIndex_maybe; + int16 field_2; + int16 actorResourceId; + uint16 sequenceId; + int16 field_8; + Actor *actor; + uint16 sceneId; + int16 field_e; + int16 field_10; + int16 field_12; + uint16 field_14; + int16 x; + int16 y; + uint16 field_1a_flags_maybe; + int16 field_1c; + int16 field_1e; + int16 field_20_actor_field_14; +}; class DragonINIResource { private: @@ -69,6 +68,7 @@ private: DragonINI *_dragonINI; uint16 _count; DragonINI *_flickerINI; + public: DragonINIResource(BigfileArchive *bigfileArchive); void reset(); diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp index e80a79e0257..bfec818c31d 100644 --- a/engines/dragons/dragons.cpp +++ b/engines/dragons/dragons.cpp @@ -116,75 +116,75 @@ void DragonsEngine::updateEvents() { while (_eventMan->pollEvent(event)) { // _input->processEvent(event); switch (event.type) { - case Common::EVENT_QUIT: - quitGame(); - break; - case Common::EVENT_MOUSEMOVE: - _cursor->updatePosition(event.mouse.x, event.mouse.y); - break; - case Common::EVENT_LBUTTONUP: - _leftMouseButtonUp = true; - _leftMouseButtonDown = false; - break; - case Common::EVENT_LBUTTONDOWN: - _leftMouseButtonDown = true; - break; - case Common::EVENT_RBUTTONUP: - _rightMouseButtonUp = true; - break; - case Common::EVENT_KEYUP: - if (event.kbd.keycode == Common::KEYCODE_i) { - _iKeyUp = true; - } else if (event.kbd.keycode == Common::KEYCODE_DOWN) { - _downKeyUp = true; - } else if (event.kbd.keycode == Common::KEYCODE_UP) { - _upKeyUp = true; - } else if (event.kbd.keycode == Common::KEYCODE_RETURN || - event.kbd.keycode == Common::KEYCODE_KP_ENTER) { - _enterKeyUp = true; - } else if (event.kbd.keycode == Common::KEYCODE_LEFT) { - _leftKeyUp = true; - _leftKeyDown = false; - } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) { - _rightKeyUp = true; - _rightKeyDown = false; - } else if (event.kbd.keycode == Common::KEYCODE_w) { - _wKeyDown = false; - } else if (event.kbd.keycode == Common::KEYCODE_a) { - _aKeyDown = false; - } else if (event.kbd.keycode == Common::KEYCODE_s) { - _sKeyDown = false; - } else if (event.kbd.keycode == Common::KEYCODE_d) { - _dKeyDown = false; - } else if (event.kbd.keycode == Common::KEYCODE_o) { - _oKeyDown = false; - } else if (event.kbd.keycode == Common::KEYCODE_p) { - _pKeyDown = false; - } - break; - case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == Common::KEYCODE_LEFT) { - _leftKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) { - _rightKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_w) { - _wKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_a) { - _aKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_s) { - _sKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_d) { - _dKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_o) { - _oKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_p) { - _pKeyDown = true; - } else if (event.kbd.keycode == Common::KEYCODE_TAB) { - _debugMode = !_debugMode; - } - break; - default: - break; + case Common::EVENT_QUIT: + quitGame(); + break; + case Common::EVENT_MOUSEMOVE: + _cursor->updatePosition(event.mouse.x, event.mouse.y); + break; + case Common::EVENT_LBUTTONUP: + _leftMouseButtonUp = true; + _leftMouseButtonDown = false; + break; + case Common::EVENT_LBUTTONDOWN: + _leftMouseButtonDown = true; + break; + case Common::EVENT_RBUTTONUP: + _rightMouseButtonUp = true; + break; + case Common::EVENT_KEYUP: + if (event.kbd.keycode == Common::KEYCODE_i) { + _iKeyUp = true; + } else if (event.kbd.keycode == Common::KEYCODE_DOWN) { + _downKeyUp = true; + } else if (event.kbd.keycode == Common::KEYCODE_UP) { + _upKeyUp = true; + } else if (event.kbd.keycode == Common::KEYCODE_RETURN || + event.kbd.keycode == Common::KEYCODE_KP_ENTER) { + _enterKeyUp = true; + } else if (event.kbd.keycode == Common::KEYCODE_LEFT) { + _leftKeyUp = true; + _leftKeyDown = false; + } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) { + _rightKeyUp = true; + _rightKeyDown = false; + } else if (event.kbd.keycode == Common::KEYCODE_w) { + _wKeyDown = false; + } else if (event.kbd.keycode == Common::KEYCODE_a) { + _aKeyDown = false; + } else if (event.kbd.keycode == Common::KEYCODE_s) { + _sKeyDown = false; + } else if (event.kbd.keycode == Common::KEYCODE_d) { + _dKeyDown = false; + } else if (event.kbd.keycode == Common::KEYCODE_o) { + _oKeyDown = false; + } else if (event.kbd.keycode == Common::KEYCODE_p) { + _pKeyDown = false; + } + break; + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_LEFT) { + _leftKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_RIGHT) { + _rightKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_w) { + _wKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_a) { + _aKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_s) { + _sKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_d) { + _dKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_o) { + _oKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_p) { + _pKeyDown = true; + } else if (event.kbd.keycode == Common::KEYCODE_TAB) { + _debugMode = !_debugMode; + } + break; + default: + break; } } } @@ -237,7 +237,7 @@ Common::Error DragonsEngine::run() { } uint16 DragonsEngine::ipt_img_file_related() { - DragonINI *flicker = _dragonINIResource->getFlickerRecord(); + DragonINI *flicker = _dragonINIResource->getFlickerRecord(); assert(flicker); int16 tileX = flicker->actor->_x_pos / 32; @@ -290,8 +290,7 @@ void DragonsEngine::gameLoop() { pDVar8->field_20_actor_field_14 = 2; if (getINI(0xc2)->field_1e == 1) { sequenceId = 0x30; - } - else { + } else { sequenceId = 2; } pDVar8->actor->updateSequence(sequenceId); @@ -322,8 +321,7 @@ void DragonsEngine::gameLoop() { _counter = 0; } } - } - else { + } else { LAB_80026d34: uVar3 = 0; } @@ -331,8 +329,7 @@ void DragonsEngine::gameLoop() { if (_cursor->updateINIUnderCursor() == 0 || (!(_cursor->_iniUnderCursor & 0x8000) && (getINI(_cursor->_iniUnderCursor - 1)->field_1a_flags_maybe & 0x4000) != 0)) { //TODO check this. This logic looks a bit strange. _cursor->_cursorActivationSeqOffset = 0; - } - else { + } else { _cursor->_cursorActivationSeqOffset = 5; } @@ -384,8 +381,7 @@ void DragonsEngine::gameLoop() { } performAction(); - if ((getCurrentSceneId() == 0x1d) && (getINI(0x178)->field_12 != 0)) //cave of dilemma - { + if ((getCurrentSceneId() == 0x1d) && (getINI(0x178)->field_12 != 0)) { //cave of dilemma clearFlags(ENGINE_FLAG_8); } else { setFlags(ENGINE_FLAG_8); @@ -402,24 +398,22 @@ void DragonsEngine::gameLoop() { sequenceId = _dragonVAR->getVar(7); uVar7 = _inventory->_old_showing_value; _inventory->_old_showing_value = _inventory->getType(); - joined_r0x800271d0: + joined_r0x800271d0: _inventory->setType(_inventory->_old_showing_value); if (sequenceId == 1) { LAB_800279f4: _inventory->_old_showing_value = uVar7; _inventory->inventoryMissing(); actorId = uVar3; - } - else { + } else { _counter = 0; _inventory->setType(1); _inventory->openInventory(); - joined_r0x80027a38: + joined_r0x80027a38: if (_cursor->_iniItemInHand == 0) { _cursor->_sequenceID = 1; actorId = uVar3; - } - else { + } else { _cursor->_sequenceID = 5; actorId = uVar3; } @@ -439,8 +433,7 @@ void DragonsEngine::gameLoop() { _inventory->_old_showing_value = _inventory->getType(); goto joined_r0x800271d0; } - } - else { + } else { if (_inventory->addItem(_cursor->_iniItemInHand)) { _cursor->_sequenceID = 1; waitForFrames(1); @@ -450,20 +443,19 @@ void DragonsEngine::gameLoop() { continue; } } - } - else { + } else { if (_cursor->_iniUnderCursor != 0x8001) goto LAB_80027ab4; if (_inventory->getSequenceId() == 0) goto LAB_80027294; } if ((_cursor->_iniUnderCursor == 0x8001) && (_inventory->getSequenceId() == 1)) { _inventory->setType(2); _inventory->_old_showing_value = uVar6; - FUN_80038890(); + fun_80038890(); actorId = uVar3; continue; } } - LAB_80027ab4: + LAB_80027ab4: _counter = 0; _cursor->_data_80072890 = _cursor->_iniUnderCursor; if (_cursor->_sequenceID < 5) { @@ -472,8 +464,7 @@ void DragonsEngine::gameLoop() { if (_bit_flags_8006fbd8 != 0) { clearFlags(ENGINE_FLAG_8); } - } - else { + } else { _cursor->_data_800728b0_cursor_seqID = _cursor->_sequenceID; walkFlickerToObject(); if (_bit_flags_8006fbd8 != 0) { @@ -484,23 +475,24 @@ void DragonsEngine::gameLoop() { } } } - } - else { + } else { if (_inventory->getType() == 2) { uVar6 = _inventory->getType(); if (checkForInventoryButtonRelease() && isInputEnabled()) { uVar7 = _inventory->_old_showing_value; - if (_dragonVAR->getVar(7) == 1) goto LAB_800279f4; + if (_dragonVAR->getVar(7) == 1) + goto LAB_800279f4; _counter = 0; _inventory->setType(1); _inventory->_old_showing_value = uVar6; _inventory->openInventory(); goto joined_r0x80027a38; } - if (checkForActionButtonRelease() && isFlagSet(ENGINE_FLAG_8)) goto LAB_80027ab4; + if (checkForActionButtonRelease() && isFlagSet(ENGINE_FLAG_8)) + goto LAB_80027ab4; } } - LAB_80027b58: + LAB_80027b58: runINIScripts(); actorId = uVar3; continue; @@ -523,15 +515,14 @@ void DragonsEngine::gameLoop() { _inventory->closeInventory(); _inventory->setType(0); if (_inventory->_old_showing_value == 2) { - FUN_80038994(); + fun_80038994(); } - } - else { + } else { if (_cursor->_iniUnderCursor != 0x8002) goto LAB_8002790c; _inventory->closeInventory(); _inventory->setType(2); if (_inventory->_old_showing_value != 2) { - FUN_80038890(); + fun_80038890(); } } _inventory->_old_showing_value = uVar6; @@ -572,15 +563,15 @@ void DragonsEngine::gameLoop() { } continue; } - if (_cursor->_iniItemInHand == 0) goto LAB_80027b58; + if (_cursor->_iniItemInHand == 0) + goto LAB_80027b58; //drop item back into inventory if (_inventory->addItemIfPositionIsEmpty(_cursor->_iniItemInHand, _cursor->_x, _cursor->_y)) { Actor *invActor = _inventory->getInventoryItemActor(_cursor->_iniItemInHand); invActor->_flags = 0; invActor->_priorityLayer = 0; invActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; - invActor->updateSequence( - getINI(_cursor->_iniItemInHand - 1)->field_8 * 2 + 10); + invActor->updateSequence(getINI(_cursor->_iniItemInHand - 1)->field_8 * 2 + 10); _cursor->_iniItemInHand = 0; invActor->setFlag(ACTOR_FLAG_40); invActor->setFlag(ACTOR_FLAG_80); @@ -592,7 +583,7 @@ void DragonsEngine::gameLoop() { } } } - LAB_8002790c: +LAB_8002790c: if ((_cursor->_iniItemInHand == 0) || (((uint16)(_cursor->_x - 10U) < 300 && ((uint16)(_cursor->_y - 10U) < 0xb4)))) goto LAB_80027b58; @@ -718,9 +709,9 @@ void DragonsEngine::updateActorSequences() { } if (actor->_flags & ACTOR_FLAG_40 && - !(actor->_flags & ACTOR_FLAG_4) && - !(actor->_flags & ACTOR_FLAG_400) && - (actor->_sequenceTimer == 0 || actor->_flags & ACTOR_FLAG_1)) { + !(actor->_flags & ACTOR_FLAG_4) && + !(actor->_flags & ACTOR_FLAG_400) && + (actor->_sequenceTimer == 0 || actor->_flags & ACTOR_FLAG_1)) { debug(5, "Actor[%d] execute sequenceOp", actorId); if (actor->_flags & ACTOR_FLAG_1) { @@ -864,8 +855,7 @@ void DragonsEngine::engineFlag0x20UpdateFunction() { // actors[(uint)uVar5]._sequenceID = 8; // actors[(uint)uVar5]._priorityLayer_maybe = 0; // } - } - else { + } else { if (flickerINI->sceneId == currentSceneId) { if ((flickerINI == NULL) || flickerINI->actor->isFlagSet(ACTOR_FLAG_10)) { if ((flickerINI->sceneId == currentSceneId) @@ -937,8 +927,7 @@ void DragonsEngine::engineFlag0x20UpdateFunction() { // actors[(uint)uVar5]._sequenceID = 8; // actors[(uint)uVar5]._priorityLayer_maybe = 0; // } - } - else { + } else { if (flickerINI->sceneId == currentSceneId) { if (flickerINI->actor->isFlagSet(ACTOR_FLAG_10)) { if (_inventory->isActorSet()) { @@ -950,9 +939,9 @@ void DragonsEngine::engineFlag0x20UpdateFunction() { _bit_flags_8006fbd8 = _bit_flags_8006fbd8 | 2; } if (flickerINI->actor->isFlagClear(ACTOR_FLAG_2000) - && flickerINI->actor->isFlagSet(ACTOR_FLAG_4) - && flickerINI->actor->_sequenceID2 != -1 - && flickerINI->actor->_sequenceID2 != flickerINI->actor->_sequenceID) { + && flickerINI->actor->isFlagSet(ACTOR_FLAG_4) + && flickerINI->actor->_sequenceID2 != -1 + && flickerINI->actor->_sequenceID2 != flickerINI->actor->_sequenceID) { flickerINI->actor->updateSequence(flickerINI->actor->_sequenceID2); } } @@ -1094,8 +1083,7 @@ void DragonsEngine::performAction() { if (((uVar4 & 0xffff) == 0) && ((uVar6 & 0xfffd) == 0)) { _talk->flickerRandomDefaultResponse(); } - } - else { + } else { _scriptOpcodes->_data_80071f5c--; } _flags |= uVar1 & ENGINE_FLAG_8; @@ -1134,12 +1122,11 @@ bool DragonsEngine::checkForActionButtonRelease() { return _leftMouseButtonUp || _enterKeyUp; } -void DragonsEngine::FUN_80038890() { - error("FUN_80038890"); //TODO +void DragonsEngine::fun_80038890() { + error("fun_80038890"); //TODO } -void DragonsEngine::walkFlickerToObject() -{ +void DragonsEngine::walkFlickerToObject() { uint16 targetX; uint16 targetY; uint uVar7; @@ -1152,7 +1139,7 @@ void DragonsEngine::walkFlickerToObject() if (_cursor->_data_80072890 != 0) { if (!(READ_LE_UINT16(_dragonOBD->getFromOpt(_cursor->_data_80072890 - 1) + 4) & 8) - && (_inventory->getType() == 0) && !isFlagSet(ENGINE_FLAG_200000)) { + && (_inventory->getType() == 0) && !isFlagSet(ENGINE_FLAG_200000)) { targetINI = getINI(_cursor->_data_80072890 - 1); if ((targetINI->field_1a_flags_maybe & 1) == 0) { if (targetINI->actorResourceId == -1) { @@ -1161,8 +1148,7 @@ void DragonsEngine::walkFlickerToObject() Img *img = _dragonImg->getImg(targetINI->field_2); targetX = img->field_a; targetY = img->field_c; - } - else { + } else { targetX = targetINI->actor->_x_pos; targetY = targetINI->actor->_y_pos; } @@ -1198,8 +1184,7 @@ void DragonsEngine::walkFlickerToObject() (int)((uVar7 + (uint)_scene->_camera.x) * 0x10000) >> 0x10, (int)((uVar8 + (uint)_scene->_camera.y) * 0x10000) >> 0x10,0); } - } - else { + } else { if (_cursor->_data_80072890 != 0) { _bit_flags_8006fbd8 = 3; return; @@ -1209,8 +1194,8 @@ void DragonsEngine::walkFlickerToObject() return; } -void DragonsEngine::FUN_80038994() { - error("FUN_80038994"); //TODO +void DragonsEngine::fun_80038994() { + error("fun_80038994"); //TODO } void DragonsEngine::reset_screen_maybe() { @@ -1253,7 +1238,7 @@ void DragonsEngine::loadScene(uint16 sceneId) { _screen->loadPalette(4, _cursor->getPalette()); _screen->updatePaletteTransparency(4, 1, 0xff, true); - // TODO FUN_80017010_update_actor_texture_maybe(); + // TODO fun_80017010_update_actor_texture_maybe(); if (sceneId > 2) { _dragonVAR->setVar(1, 1); } @@ -1300,7 +1285,7 @@ void DragonsEngine::reset() { void DragonsEngine::runSceneUpdaterFunction() { if ((isFlagSet(ENGINE_FLAG_20) && (_run_func_ptr_unk_countdown_timer == 0)) && - (_run_func_ptr_unk_countdown_timer = 1, _sceneUpdateFunction != NULL)) { + (_run_func_ptr_unk_countdown_timer = 1, _sceneUpdateFunction != NULL)) { _sceneUpdateFunction(); } } @@ -1314,11 +1299,10 @@ void DragonsEngine::setVsyncUpdateFunction(void (*newUpdateFunction)()) { } void DragonsEngine::seedRandom(int32 seed) { - _randomState = seed * -0x2b0e2b0f; + _randomState = seed * -0x2b0e2b0f; } -uint32 DragonsEngine::shuffleRandState() -{ +uint32 DragonsEngine::shuffleRandState() { uint32 returnBit; returnBit = _randomState & 1; @@ -1415,8 +1399,7 @@ void DragonsEngine::updatePaletteCycling() { } palette[(uint16)_paletteCyclingTbl[loopIndex].startOffset] = uVar11; _paletteCyclingTbl[loopIndex].updateCounter = _paletteCyclingTbl[loopIndex].updateInterval; - } - else { + } else { if (uVar8 < uVar14) { uint16 uVar11 = palette[uVar14]; uint16 uVar15 = uVar8; @@ -1432,8 +1415,7 @@ void DragonsEngine::updatePaletteCycling() { _paletteCyclingTbl[loopIndex].updateInterval; } } - } - else { + } else { _paletteCyclingTbl[loopIndex].updateCounter = _paletteCyclingTbl[loopIndex].updateCounter + -1; } } diff --git a/engines/dragons/dragons.h b/engines/dragons/dragons.h index e841ce598cd..07393a8acb9 100644 --- a/engines/dragons/dragons.h +++ b/engines/dragons/dragons.h @@ -152,6 +152,7 @@ public: Screen *_screen; uint16 _sceneId1; //TODO wire this up. I think it might be where to restore save game from? + private: BigfileArchive *_bigfileArchive; DragonFLG *_dragonFLG; @@ -295,17 +296,17 @@ private: bool isInputEnabled(); bool checkForInventoryButtonRelease(); - void FUN_80038890(); + void fun_80038890(); void walkFlickerToObject(); - void FUN_80038994(); + void fun_80038994(); void seedRandom(int32 seed); uint32 shuffleRandState(); - void FUN_8002931c(); + void fun_8002931c(); void initializeSound(); - void SomeInitSound_FUN_8003f64c(); + void SomeInitSound_fun_8003f64c(); }; DragonsEngine *getEngine(); diff --git a/engines/dragons/dragonvar.cpp b/engines/dragons/dragonvar.cpp index c5bf58b92c9..9cb18a87e00 100644 --- a/engines/dragons/dragonvar.cpp +++ b/engines/dragons/dragonvar.cpp @@ -29,7 +29,7 @@ DragonVAR::DragonVAR(BigfileArchive *bigfileArchive): _bigfileArchive(bigfileArc } DragonVAR::~DragonVAR() { - delete _data; + delete _data; } uint16 DragonVAR::getVar(uint16 offset) { diff --git a/engines/dragons/dragonvar.h b/engines/dragons/dragonvar.h index 5ad7ff28aeb..df0e2556319 100644 --- a/engines/dragons/dragonvar.h +++ b/engines/dragons/dragonvar.h @@ -32,6 +32,7 @@ class DragonVAR { private: byte *_data; BigfileArchive *_bigfileArchive; + public: virtual ~DragonVAR(); diff --git a/engines/dragons/font.cpp b/engines/dragons/font.cpp index 4f56db6129b..418caf904d9 100644 --- a/engines/dragons/font.cpp +++ b/engines/dragons/font.cpp @@ -115,7 +115,6 @@ void FontManager::addText(int16 x, int16 y, uint16 *text, uint16 length, uint8 f screenTextEntry->surface = _fonts[fontType]->render(text, length); _screenTexts.push_back(screenTextEntry); - } void FontManager::draw() { diff --git a/engines/dragons/font.h b/engines/dragons/font.h index db90dc7b930..0c801a9ca5b 100644 --- a/engines/dragons/font.h +++ b/engines/dragons/font.h @@ -39,11 +39,13 @@ private: uint16 *_map; byte *_pixels; uint32 _numChars; + public: Font(Common::SeekableReadStream &stream, uint32 mapSize, uint32 pixelOffset, uint32 pixelSize); ~Font(); Graphics::Surface *render(uint16 *text, uint16 length); void renderToSurface(Graphics::Surface *surface, int16 x, int16 y, uint16 *text, uint16 length); + private: uint16 mapChar(uint16 in); }; @@ -56,6 +58,7 @@ struct ScreenTextEntry { class FontManager { public: Font *_fonts[3]; + private: uint16 _dat_80086f48_fontColor_flag; DragonsEngine *_vm; @@ -70,6 +73,7 @@ public: void draw(); void clearText(); void updatePalette(); + private: Font *loadFont(uint16 index, Common::SeekableReadStream &stream); void loadPalettes(); diff --git a/engines/dragons/inventory.cpp b/engines/dragons/inventory.cpp index e0e6a75e724..53bff1191fd 100644 --- a/engines/dragons/inventory.cpp +++ b/engines/dragons/inventory.cpp @@ -34,32 +34,32 @@ namespace Dragons { static const Common::Point positionTable[4] = { - Common::Point(2,0), - Common::Point(0xce,0), - Common::Point(2,0x9e), - Common::Point(0xce,0x9e) + Common::Point(2,0), + Common::Point(0xce,0), + Common::Point(2,0x9e), + Common::Point(0xce,0x9e) }; static const int16 bagBounceTable[4] = { - -5, -0xa, -5, 0 + -5, -0xa, -5, 0 }; static const int16 invXPosTable[41] = { - 0x0080, 0x00a0, 0x00c0, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, - 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, - 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, - 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, - 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, - 0x0100 + 0x0080, 0x00a0, 0x00c0, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, + 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, + 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, + 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, + 0x0100, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0, + 0x0100 }; static const int16 invYPosTable[41] = { - 0x0028, 0x0028, 0x0028, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, - 0x0040, 0x0058, 0x0058, 0x0058, 0x0058, 0x0058, 0x0058, 0x0058, - 0x0058, 0x0070, 0x0070, 0x0070, 0x0070, 0x0070, 0x0070, 0x0070, - 0x0070, 0x0088, 0x0088, 0x0088, 0x0088, 0x0088, 0x0088, 0x0088, - 0x0088, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, - 0x00a0 + 0x0028, 0x0028, 0x0028, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, + 0x0040, 0x0058, 0x0058, 0x0058, 0x0058, 0x0058, 0x0058, 0x0058, + 0x0058, 0x0070, 0x0070, 0x0070, 0x0070, 0x0070, 0x0070, 0x0070, + 0x0070, 0x0088, 0x0088, 0x0088, 0x0088, 0x0088, 0x0088, 0x0088, + 0x0088, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, + 0x00a0 }; Inventory::Inventory(DragonsEngine *vm) : _vm(vm) { @@ -233,12 +233,10 @@ void Inventory::closeInventory() { if (!_vm->isFlagSet(ENGINE_FLAG_400000)) { _sequenceId = 0; - } - else { + } else { if (_old_showing_value == 2) { _sequenceId = 3; - } - else { + } else { _sequenceId = 1; } } @@ -262,7 +260,7 @@ uint16 Inventory::getIniAtPosition(int16 x, int16 y) { if (_inventoryItemTbl[i]) { Actor *item = _vm->_actorManager->getActor(i + ACTOR_INVENTORY_OFFSET); if (item->_x_pos - 0x10 <= x && x < item->_x_pos + 0x10 - && item->_y_pos - 0xc <= y && y < item->_y_pos + 0xc) { + && item->_y_pos - 0xc <= y && y < item->_y_pos + 0xc) { return _inventoryItemTbl[i]; } } @@ -319,8 +317,7 @@ void Inventory::closeInventionBook() { if (((((uVar2 == 0x23) || (uVar2 == 0x2d)) || (uVar2 == 0x2e)) || ((uVar2 == 0x31 || (uVar2 == 0x32)))) || (uVar2 == 0x28)) { LAB_80038b9c: if ((uint)_vm->_scene->getSceneId() == 0x27) goto LAB_80038bb8; - } - else { + } else { if (uVar2 != 0x27) { if (((uVar2 != 0x1c) && (uVar2 != 0x1d)) && (uVar1 = uVar2 | 0x8000, uVar2 != 0x21)) goto LAB_80038be8; goto LAB_80038b9c; @@ -329,7 +326,7 @@ void Inventory::closeInventionBook() { _vm->getINI(0x206)->sceneId = 0; } uVar1 = (uint)_vm->_scene->getSceneId(); - LAB_80038be8: +LAB_80038be8: _vm->_scene->loadScene(uVar1,0x1e); _vm->setSceneUpdateFunction(_inventionBookPrevSceneUpdateFunc); return; @@ -378,9 +375,9 @@ bool Inventory::addItemIfPositionIsEmpty(uint16 iniId, uint16 x, uint16 y) { for (int i = 0; i < DRAGONS_MAX_INVENTORY_ITEMS; i++) { Actor *actor = _vm->_actorManager->getActor(i + ACTOR_INVENTORY_OFFSET); if ((((actor->_x_pos - 0x10 <= x) && - (x < actor->_x_pos + 0x10)) && - (actor->_y_pos - 0xc <= y)) && - (y < actor->_y_pos + 0xc)) { + (x < actor->_x_pos + 0x10)) && + (actor->_y_pos - 0xc <= y)) && + (y < actor->_y_pos + 0xc)) { _inventoryItemTbl[i] = iniId; return true; } @@ -413,8 +410,7 @@ void Inventory::inventoryMissing() { _vm->clearFlags(ENGINE_FLAG_8); if (counter == 0) { textIndex = 0x114FA; //Hey! My bag is missing! - } - else { + } else { textIndex = 0x11538; //The Chancellor snaked my bag! } counter = counter + 1; diff --git a/engines/dragons/inventory.h b/engines/dragons/inventory.h index 89d3140935f..60d215bfcf6 100644 --- a/engines/dragons/inventory.h +++ b/engines/dragons/inventory.h @@ -55,6 +55,7 @@ private: Common::Point _inventionBookPrevFlickerINIPosition; uint16 _inventoryItemTbl[DRAGONS_MAX_INVENTORY_ITEMS]; + public: Inventory(DragonsEngine *vm); diff --git a/engines/dragons/minigame1.cpp b/engines/dragons/minigame1.cpp index aa9df0c5065..e2d44656187 100644 --- a/engines/dragons/minigame1.cpp +++ b/engines/dragons/minigame1.cpp @@ -38,11 +38,11 @@ void Minigame1::run() { //TODO this might change for different game versions. const uint32 dialogIdTbl[17] = { - 0x21312,0x2134C,0x21386,0x213C0, - 0x213E2,0x21428,0x2146C,0x214B4, - 0x214E4,0x21514,0x21540,0x21590, - 0x215E2,0x2164E,0x216AA,0x216D2, - 0x217D8 + 0x21312, 0x2134C, 0x21386, 0x213C0, + 0x213E2, 0x21428, 0x2146C, 0x214B4, + 0x214E4, 0x21514, 0x21540, 0x21590, + 0x215E2, 0x2164E, 0x216AA, 0x216D2, + 0x217D8 }; /* WARNING: Could not reconcile some variable overlaps */ /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ @@ -144,7 +144,7 @@ void Minigame1::run() { local_c0[20] = dialogIdTbl[10]; local_c0[21] = 0x32; - memcpy(local_118,local_c0,0x58); + memcpy(local_118, local_c0, 0x58); local_c0[0] = dialogIdTbl[11]; local_c0[1] = 0x3c; @@ -184,19 +184,19 @@ void Minigame1::run() { local_252 = 0; flickerXPos = flickerActor->_x_pos; local_25c = 0; - pusherActor = _vm->_actorManager->loadActor(0x26,1, flickerXPos, + pusherActor = _vm->_actorManager->loadActor(0x26, 1, flickerXPos, (int)(((uint)(uint16)flickerActor->_y_pos + 5) * 0x10000) >> 0x10); // if (pusherActorId == -1) { -// ProbablyShowASCIIMessage(s_couldn't_alloc_pusher_8008e954,2,4,0,0xffffffff); +// ProbablyShowASCIIMessage(s_couldn't_alloc_pusher_8008e954, 2, 4, 0, 0xffffffff); // } pusherActor->_flags = pusherActor->_flags | 0x380; pusherActor->_x_pos = flickerActor->_x_pos + -0xe; pusherActor->_y_pos = flickerActor->_y_pos + 7; pusherActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; pusherActor->_priorityLayer = 6; - wheelsActor = _vm->_actorManager->loadActor(7,0x11,0,0); + wheelsActor = _vm->_actorManager->loadActor(7, 0x11, 0, 0); // if (wheelsActorId == -1) { -// ProbablyShowASCIIMessage(s_couldn't_alloc_wheels_8008e96c,2,4,0,0xffffffff); +// ProbablyShowASCIIMessage(s_couldn't_alloc_wheels_8008e96c, 2, 4, 0, 0xffffffff); // } wheelsActor->_flags = wheelsActor->_flags | 0x380; wheelsActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; @@ -205,18 +205,18 @@ void Minigame1::run() { wheelsActor->_priorityLayer = 5; wheelsActor->updateSequence(0x11); local_242 = 0; - catActor = _vm->_actorManager->loadActor(7,9,0,0); + catActor = _vm->_actorManager->loadActor(7, 9, 0, 0); // if (catActorId == -1) { -// ProbablyShowASCIIMessage(s_couldn't_alloc-cat_8008e984,2,4,0,0xffffffff); +// ProbablyShowASCIIMessage(s_couldn't_alloc-cat_8008e984, 2, 4, 0, 0xffffffff); // } catActor->_flags = catActor->_flags | 0x380; catActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; catActor->_priorityLayer = 0; i = 0; while (i < 3) { - targetActorIdTbl[(uint)i + 1] = _vm->_actorManager->loadActor(8,1,0,0,0); + targetActorIdTbl[(uint)i + 1] = _vm->_actorManager->loadActor(8, 1, 0, 0, 0); // if (targetActorIdTbl[(uint)i + 1] == -1) { -// ProbablyShowASCIIMessage(s_couldn't_alloc_target!_8008e998,2,4,0,0xffffffff); +// ProbablyShowASCIIMessage(s_couldn't_alloc_target!_8008e998, 2, 4, 0, 0xffffffff); // } targetActorIdTbl[(uint)i + 1]->_flags = targetActorIdTbl[(uint)i + 1]->_flags | 0x380; targetActorIdTbl[(uint)i + 1]->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; @@ -224,14 +224,12 @@ void Minigame1::run() { //TODO FUN_80017010_update_actor_texture_maybe(1); i = i + 1; } - i = 0; - while (i < 8) { - local_188[(uint)i] = 0; - i = i + 1; + for (i = 0; i < 8; i++) { + local_188[i] = 0; } - dustSpriteActor = _vm->_actorManager->loadActor(8,8,100,100,0); + dustSpriteActor = _vm->_actorManager->loadActor(8, 8, 100, 100, 0); // if (dustSpriteActorId == 0xffff) { -// ProbablyShowASCIIMessage(s_couldn't_alloc_dust_sprite!_8008e9b0,2,5,0,0xffffffff); +// ProbablyShowASCIIMessage(s_couldn't_alloc_dust_sprite!_8008e9b0, 2, 5, 0, 0xffffffff); // } dustSpriteActor->_flags = dustSpriteActor->_flags | 0x380; dustSpriteActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; @@ -269,410 +267,379 @@ void Minigame1::run() { local_21e = local_21e + -1; } switch (gameState) { - case 0: - break; - case 1: //cat in the catapult ready to fire. - if (local_252 == 0) { - if (local_246 != 8) { - local_246 = 0; - } -// iVar6 = IsButtonBeingPressed((uint)DAT_800728ac,0); - if (!_vm->isActionButtonPressed()) { - if (local_25c == 0) { - if ((((flickerActor->_sequenceID != 0) && - (flickerActor->_sequenceID != 5)) && - (flickerActor->_sequenceID != 6)) || - ((flickerActor->_flags & 4) != 0)) { - flickerActor->updateSequence(0); - } + case 0: + break; + case 1: //cat in the catapult ready to fire. + if (local_252 == 0) { + if (local_246 != 8) { + local_246 = 0; + } +// iVar6 = IsButtonBeingPressed((uint)DAT_800728ac, 0); + if (!_vm->isActionButtonPressed()) { + if (local_25c == 0) { + if ((((flickerActor->_sequenceID != 0) && + (flickerActor->_sequenceID != 5)) && + (flickerActor->_sequenceID != 6)) || + ((flickerActor->_flags & 4) != 0)) { + flickerActor->updateSequence(0); } - else { - local_246 = 1; - bVar3 = false; - pusherActor->updateSequence(1); - gameState = 2; - if (local_25c < 0x14) { - local_25a = 1; - } - else { - if (local_25c < 0x2d) { - local_25a = 2; - } - else { - if (local_25c < 0x169) { - local_25a = 3; - } + } else { + local_246 = 1; + bVar3 = false; + pusherActor->updateSequence(1); + gameState = 2; + if (local_25c < 0x14) { + local_25a = 1; + } else { + if (local_25c < 0x2d) { + local_25a = 2; + } else { + if (local_25c < 0x169) { + local_25a = 3; } } } - local_25c = 0; } - else { - pusherActor->_x_pos = flickerActor->_x_pos + -0xe; - pusherActor->_y_pos = flickerActor->_y_pos + 7; - if (local_25c < 0x168) { - local_25c = local_25c + 1; - if (local_25c < 0x14) { - if (((pusherActor->_sequenceID != 4) && + local_25c = 0; + } else { + pusherActor->_x_pos = flickerActor->_x_pos + -0xe; + pusherActor->_y_pos = flickerActor->_y_pos + 7; + if (local_25c < 0x168) { + local_25c = local_25c + 1; + if (local_25c < 0x14) { + if (((pusherActor->_sequenceID != 4) && + (pusherActor->_sequenceID != 2)) && + (pusherActor->_sequenceID != 3)) { + pusherActor->updateSequence(4); + } + if (flickerActor->_sequenceID != 1) { + flickerActor->updateSequence(1); + _vm->playOrStopSound(2); + } + } else { + if (local_25c < 0x2d) { + if (((pusherActor->_sequenceID != 5) && (pusherActor->_sequenceID != 2)) && (pusherActor->_sequenceID != 3)) { - pusherActor->updateSequence(4); + pusherActor->updateSequence(5); } - if (flickerActor->_sequenceID != 1) { - flickerActor->updateSequence(1); - _vm->playOrStopSound(2); + if (flickerActor->_sequenceID != 2) { + flickerActor->updateSequence(2); + _vm->playOrStopSound(3); } - } - else { - if (local_25c < 0x2d) { - if (((pusherActor->_sequenceID != 5) && + } else { + if (local_25c < 0x169) { + if (((pusherActor->_sequenceID != 6) && (pusherActor->_sequenceID != 2)) && (pusherActor->_sequenceID != 3)) { - pusherActor->updateSequence(5); + pusherActor->updateSequence(6); } - if (flickerActor->_sequenceID != 2) { - flickerActor->updateSequence(2); - _vm->playOrStopSound(3); - } - } - else { - if (local_25c < 0x169) { - if (((pusherActor->_sequenceID != 6) && - (pusherActor->_sequenceID != 2)) && - (pusherActor->_sequenceID != 3)) { - pusherActor->updateSequence(6); - } - if (flickerActor->_sequenceID != 3) { - flickerActor->updateSequence(3); - _vm->playOrStopSound(4); - } + if (flickerActor->_sequenceID != 3) { + flickerActor->updateSequence(3); + _vm->playOrStopSound(4); } } } } - else { - if (pusherActor->_sequenceID != 6) { - pusherActor->updateSequence(6); - } - if (flickerActor->_sequenceID != 3) { - flickerActor->updateSequence(3); - } + } else { + if (pusherActor->_sequenceID != 6) { + pusherActor->updateSequence(6); + } + if (flickerActor->_sequenceID != 3) { + flickerActor->updateSequence(3); } } } - break; - case 2: // initial release of cat. - if (flickerActor->_sequenceID == 7) { - if ((flickerActor->_flags & 4) != 0) { - i = 1; - while ((i < 8 && ((((int)(uint)flickerXPos < (int)((uint)auStack352[(uint)i * 3] - 6) || - ((uint)auStack352[(uint)i * 3 + 1] + 6 < (uint)flickerXPos)) || - (local_25a != auStack352[(uint)i * 3 + 2]))))) { - i = i + 1; - } - local_23c = 0; - if ((i != 8) && - ((flickerXPos < auStack352[(uint)i * 3] || (auStack352[(uint)i * 3] < flickerXPos)))) - { - local_23c = (short)((int)(((uint)auStack352[(uint)i * 3] + 8) * 0x80) / 0x2a) - - (short)((int)((uint)flickerXPos << 7) / 0x2a); - } - local_240 = flickerXPos << 7; - catActor->_x_pos = flickerXPos & 0x1ff; - local_23e = 0x2d00; - local_23a = (local_25a + 3) * 0x80; - catActor->_y_pos = 0x5a; - catFieldE_scaleMaybe = 0x100; - catActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; - catActor->updateSequence(0xc); - _vm->playOrStopSound(5); - catActor->_priorityLayer = 3; - flickerActor->updateSequence(8); - gameState = 3; - } - } - else { - flickerActor->updateSequence(7); - _vm->playOrStopSound(1); - } - break; - case 3: // cat flying through the air - local_240 = local_240 + local_23c; - if ((uint)local_25a * 2 + 0xb4 < (uint)catFieldE_scaleMaybe) { - local_23e = local_23e - local_23a; - local_23a = local_23a - local_130[((uint)local_25a - 1) * 3]; - if (local_23a < 0) { - local_23a = 0; - } - } - else { - if ((int)(uint)catFieldE_scaleMaybe < (int)((uint)local_25a * -4 + 0xba)) { - local_23e = local_23e + local_23a; - local_23a = local_23a + local_130[((uint)local_25a - 1) * 3 + 2]; - } - else { - local_23a = 0; - } - } - catActor->_x_pos = local_240 >> 7; - catActor->_y_pos = local_23e >> 7; - catFieldE_scaleMaybe = catFieldE_scaleMaybe - 3; - catActor->_scale = catFieldE_scaleMaybe; - if (catFieldE_scaleMaybe == 0x7f) { - i = 0; - while ((i < 8 && (((local_240 >> 7 < auStack352[(uint)i * 3] || - (auStack352[(uint)i * 3 + 1] < local_240 >> 7)) || - (local_25a != auStack352[(uint)i * 3 + 2]))))) { + } + break; + case 2: // initial release of cat. + if (flickerActor->_sequenceID == 7) { + if ((flickerActor->_flags & 4) != 0) { + i = 1; + while ((i < 8 && ((((int)(uint)flickerXPos < (int)((uint)auStack352[(uint)i * 3] - 6) || + ((uint)auStack352[(uint)i * 3 + 1] + 6 < (uint)flickerXPos)) || + (local_25a != auStack352[(uint)i * 3 + 2]))))) { i = i + 1; } - if ((i != 8) && (local_188[(uint)i] != 0)) { - uVar1->_field_c = 2; - local_21e = 0x3c; - if (local_250 != 0) { - _vm->_talk->FUN_8001a7c4_clearDialogBoxMaybe(); - local_250 = 0; - } - hitCounter = hitCounter + 1; - catActor->updateSequence(0xd); - if ((i == 0) && (9 < hitCounter)) { - local_22c = 0x16; - local_252 = 2; - catActor->updateSequence(0xd); - gameState = 4; - } - else { - catActor->updateSequence(0xd); - _vm->playOrStopSound(6); - gameState = 8; - local_234 = 0; - } - if (local_252 == 0) { //successful hit maybe? - _vm->_talk->loadText(local_118[((uint)hitCounter - 1) * 2], auStack1008, 200); - _vm->_talk->displayDialogAroundPoint(auStack1008, (int)(short)(flickerXPos >> 3),0xc,0,0, - local_118[((uint)hitCounter - 1) * 2]); - local_250 = *(short *)(local_118 + ((uint)hitCounter - 1) * 2 + 1); - } - targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->_priorityLayer = 3; - if (i == 0) { - targetActorIdTbl[(uint)local_188[0]]->updateSequence(7); - } - else { - targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->_y_pos -= 3; - targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->updateSequence(6); - } - auStack378[(uint)(uint16)local_188[(uint)i] - 1] = 0; - local_188[(uint)i] = 0; - break; + local_23c = 0; + if ((i != 8) && ((flickerXPos < auStack352[(uint)i * 3] || (auStack352[(uint)i * 3] < flickerXPos)))) { + local_23c = (short)((int)(((uint)auStack352[(uint)i * 3] + 8) * 0x80) / 0x2a) - + (short)((int)((uint)flickerXPos << 7) / 0x2a); } - if ((i == 8) && - ((((local_25a == 1 && (local_240 >> 7 < 0x10e)) || - ((local_25a == 2 && - ((((0x7f < local_240 >> 7 && (local_240 >> 7 < 0xad)) || - ((0x30 < local_240 >> 7 && (local_240 >> 7 < 0x4a)))) || - ((0xf8 < local_240 >> 7 && (local_240 >> 7 < 0x10f)))))))) || - ((local_25a == 3 && - (((0x3c < local_240 >> 7 && (local_240 >> 7 < 0x46)) || - ((0x101 < local_240 >> 7 && (local_240 >> 7 < 0x10a)))))))))) { - dustSpriteActor->_x_pos = catActor->_x_pos; - dustSpriteActor->_y_pos = catActor->_y_pos + 2; - dustSpriteActor->updateSequence(8); - catActor->_priorityLayer = 4; - dustSpriteActor->_priorityLayer = 3; + local_240 = flickerXPos << 7; + catActor->_x_pos = flickerXPos & 0x1ff; + local_23e = 0x2d00; + local_23a = (local_25a + 3) * 0x80; + catActor->_y_pos = 0x5a; + catFieldE_scaleMaybe = 0x100; + catActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; + catActor->updateSequence(0xc); + _vm->playOrStopSound(5); + catActor->_priorityLayer = 3; + flickerActor->updateSequence(8); + gameState = 3; + } + } else { + flickerActor->updateSequence(7); + _vm->playOrStopSound(1); + } + break; + case 3: // cat flying through the air + local_240 = local_240 + local_23c; + if ((uint)local_25a * 2 + 0xb4 < (uint)catFieldE_scaleMaybe) { + local_23e = local_23e - local_23a; + local_23a = local_23a - local_130[((uint)local_25a - 1) * 3]; + if (local_23a < 0) { + local_23a = 0; + } + } else { + if ((int)(uint)catFieldE_scaleMaybe < (int)((uint)local_25a * -4 + 0xba)) { + local_23e = local_23e + local_23a; + local_23a = local_23a + local_130[((uint)local_25a - 1) * 3 + 2]; + } else { + local_23a = 0; + } + } + catActor->_x_pos = local_240 >> 7; + catActor->_y_pos = local_23e >> 7; + catFieldE_scaleMaybe = catFieldE_scaleMaybe - 3; + catActor->_scale = catFieldE_scaleMaybe; + if (catFieldE_scaleMaybe == 0x7f) { + i = 0; + while ((i < 8 && (((local_240 >> 7 < auStack352[(uint)i * 3] || + (auStack352[(uint)i * 3 + 1] < local_240 >> 7)) || + (local_25a != auStack352[(uint)i * 3 + 2]))))) { + i = i + 1; + } + if ((i != 8) && (local_188[(uint)i] != 0)) { + uVar1->_field_c = 2; + local_21e = 0x3c; + if (local_250 != 0) { + _vm->_talk->FUN_8001a7c4_clearDialogBoxMaybe(); + local_250 = 0; + } + hitCounter = hitCounter + 1; + catActor->updateSequence(0xd); + if ((i == 0) && (9 < hitCounter)) { + local_22c = 0x16; + local_252 = 2; catActor->updateSequence(0xd); gameState = 4; + } else { + catActor->updateSequence(0xd); _vm->playOrStopSound(6); + gameState = 8; + local_234 = 0; } - } - if (catFieldE_scaleMaybe < 0x7f) { - catActor->_priorityLayer = 2; - } - if ((0xc < catFieldE_scaleMaybe) && (catFieldE_scaleMaybe < 0x41)) { - catActor->_priorityLayer = 0; - } - if ((short)catFieldE_scaleMaybe < 2) { - local_23e = 0x3700; - local_23a = 0x100; - local_240 = 0x4a80; - catFieldE_scaleMaybe = 0x30; - catActor->_y_pos = 0x6e; - catActor->_x_pos = 0x95; - catActor->_scale = 0x30; - catActor->updateSequence(0xb); - gameState = 5; - } - break; - case 4: // cat sliding down wall. - if (((catActor->_flags & 4) != 0) && - ((dustSpriteActor->_flags & 4) != 0)) { - if (catActor->_sequenceID == 0xe) { - if (local_23e < 0x4300) { - local_23e = local_23e + local_23a; - local_23a = local_23a + 0x18; - catActor->_y_pos = local_23e >> 7; - } - else { - catActor->updateSequence(0xf); - _vm->playOrStopSound(7); - gameState = 6; - } + if (local_252 == 0) { //successful hit maybe? + _vm->_talk->loadText(local_118[((uint)hitCounter - 1) * 2], auStack1008, 200); + _vm->_talk->displayDialogAroundPoint(auStack1008, (int)(short)(flickerXPos >> 3), 0xc, 0, 0, + local_118[((uint)hitCounter - 1) * 2]); + local_250 = *(short *)(local_118 + ((uint)hitCounter - 1) * 2 + 1); } - else { - dustSpriteActor->_priorityLayer = 0; - catActor->_priorityLayer = 3; - catActor->updateSequence(0xe); - _vm->playOrStopSound(8); - local_23a = 0x40; + targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->_priorityLayer = 3; + if (i == 0) { + targetActorIdTbl[(uint)local_188[0]]->updateSequence(7); + } else { + targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->_y_pos -= 3; + targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->updateSequence(6); } + auStack378[(uint)(uint16)local_188[(uint)i] - 1] = 0; + local_188[(uint)i] = 0; + break; } - break; - case 5: // cat behind portcullis - if (local_23e >> 7 < 0x86) { - local_23e = local_23e + local_23a; - catFieldE_scaleMaybe = catFieldE_scaleMaybe + 8; - catActor->_y_pos = local_23e >> 7; - catActor->_scale = catFieldE_scaleMaybe; + if ((i == 8) && + ((((local_25a == 1 && (local_240 >> 7 < 0x10e)) || + ((local_25a == 2 && + ((((0x7f < local_240 >> 7 && (local_240 >> 7 < 0xad)) || + ((0x30 < local_240 >> 7 && (local_240 >> 7 < 0x4a)))) || + ((0xf8 < local_240 >> 7 && (local_240 >> 7 < 0x10f)))))))) || + ((local_25a == 3 && + (((0x3c < local_240 >> 7 && (local_240 >> 7 < 0x46)) || + ((0x101 < local_240 >> 7 && (local_240 >> 7 < 0x10a)))))))))) { + dustSpriteActor->_x_pos = catActor->_x_pos; + dustSpriteActor->_y_pos = catActor->_y_pos + 2; + dustSpriteActor->updateSequence(8); + catActor->_priorityLayer = 4; + dustSpriteActor->_priorityLayer = 3; + catActor->updateSequence(0xd); + gameState = 4; + _vm->playOrStopSound(6); } - else { - gameState = 6; - catActor->_sequenceID = 0x10; - catActor->_flags = catActor->_flags | 4; - } - break; - case 6: // cat run across field - catActor->_priorityLayer = 3; - if (local_252 == 0) { - if (catActor->_sequenceID == 0xf) { - if ((catActor->_flags & 4) != 0) { - catActor->updateSequence(0x10); - } - } - else { - if (catActor->_sequenceID == 0x10) { - if ((catActor->_flags & 4) != 0) { - catFieldE_scaleMaybe = 0x80; - local_23e = 0x4300; - local_23a = 0x100; - catActor->_y_pos = 0x86; - catActor->_scale = 0x80; - catActor->updateSequence(0xb); - if (flickerXPos < local_240 >> 7) { - sVar2 = flickerXPos + 0x32; - } - else { - sVar2 = flickerXPos - 0x32; - } - local_16e = sVar2 * 0x80; - local_23c = (short)(((int)(((uint)local_16e - (uint)local_240) * 0x10000) >> 0x10) / - 0x1c); - } - } - else { - if (local_23e < 0x5f00) { - if (local_238 == 0) { - local_23e = local_23e + local_23a; - local_240 = local_240 + local_23c; - catFieldE_scaleMaybe = catFieldE_scaleMaybe + 6; - if (0x100 < catFieldE_scaleMaybe) { - catFieldE_scaleMaybe = 0x100; - } - catActor->_scale = catFieldE_scaleMaybe; - catActor->_y_pos = local_23e >> 7; - catActor->_x_pos = local_240 >> 7; - local_238 = 1; - } - else { - local_238 = local_238 + -1; - } - } - else { - if ((int)(uint)(local_240 >> 7) < (int)((uint)flickerXPos - 0x32)) { - if (catActor->_sequenceID != 9) { - catActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; - catActor->updateSequence(9); - } - local_240 = local_240 + 0x180; - catActor->_x_pos = local_240 >> 7; - } - else { - if ((uint)flickerXPos + 0x32 < (uint)(local_240 >> 7)) { - if (catActor->_sequenceID != 10) { - catActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; - catActor->updateSequence(10); - } - local_240 = local_240 - 0x180; - catActor->_x_pos = local_240 >> 7; - } - else { - gameState = 7; - } - } - } - } - } - } - break; - case 7: // cat jumping into catapult - if (catActor->_priorityLayer == 0) { - gameState = 1; - } - else { - catActor->_priorityLayer = 0; - if (local_240 >> 7 < flickerXPos) { - flickerActor->updateSequence(5); - } - else { - flickerActor->updateSequence(6); - } - } - break; - case 8: // cat hit target. - if (local_234 == 1) { - if (local_23a < 1) { - local_234 = 2; - } - else { - local_23a--; - catActor->_y_pos = catActor->_y_pos + 2; - } - } - else { - if (local_234 < 2) { - if ((local_234 == 0) && ((catActor->_flags & 4) != 0)) { - local_234 = 3; - local_232 = 0; - } - } - else { - if (local_234 == 2) { - local_23e = 0x4100; - local_240 = 0x4a80; - catActor->_y_pos = 0x82; - catActor->_x_pos = 0x95; - catActor->_priorityLayer = 3; - catActor->_scale = 0x80; - catActor->updateSequence(0x10); - gameState = 6; - } - else { - if (local_234 == 3) { - if (local_232 == 0) { - catActor->_priorityLayer = 2; - local_23a = 8; - local_234 = 1; - } - else { - local_232 = local_232 + -1; - } - } - } - } - } - break; - default: - //ProbablyShowASCIIMessage(s_undefined_state!_8008e9cc,2,3,0,0xffffffff); - gameState = 1; + } + if (catFieldE_scaleMaybe < 0x7f) { + catActor->_priorityLayer = 2; + } + if ((0xc < catFieldE_scaleMaybe) && (catFieldE_scaleMaybe < 0x41)) { catActor->_priorityLayer = 0; - flickerActor->updateSequence(0); + } + if ((short)catFieldE_scaleMaybe < 2) { + local_23e = 0x3700; + local_23a = 0x100; + local_240 = 0x4a80; + catFieldE_scaleMaybe = 0x30; + catActor->_y_pos = 0x6e; + catActor->_x_pos = 0x95; + catActor->_scale = 0x30; + catActor->updateSequence(0xb); + gameState = 5; + } + break; + case 4: // cat sliding down wall. + if (((catActor->_flags & 4) != 0) && + ((dustSpriteActor->_flags & 4) != 0)) { + if (catActor->_sequenceID == 0xe) { + if (local_23e < 0x4300) { + local_23e = local_23e + local_23a; + local_23a = local_23a + 0x18; + catActor->_y_pos = local_23e >> 7; + } else { + catActor->updateSequence(0xf); + _vm->playOrStopSound(7); + gameState = 6; + } + } else { + dustSpriteActor->_priorityLayer = 0; + catActor->_priorityLayer = 3; + catActor->updateSequence(0xe); + _vm->playOrStopSound(8); + local_23a = 0x40; + } + } + break; + case 5: // cat behind portcullis + if (local_23e >> 7 < 0x86) { + local_23e = local_23e + local_23a; + catFieldE_scaleMaybe = catFieldE_scaleMaybe + 8; + catActor->_y_pos = local_23e >> 7; + catActor->_scale = catFieldE_scaleMaybe; + } else { + gameState = 6; + catActor->_sequenceID = 0x10; + catActor->_flags = catActor->_flags | 4; + } + break; + case 6: // cat run across field + catActor->_priorityLayer = 3; + if (local_252 == 0) { + if (catActor->_sequenceID == 0xf) { + if ((catActor->_flags & 4) != 0) { + catActor->updateSequence(0x10); + } + } else { + if (catActor->_sequenceID == 0x10) { + if ((catActor->_flags & 4) != 0) { + catFieldE_scaleMaybe = 0x80; + local_23e = 0x4300; + local_23a = 0x100; + catActor->_y_pos = 0x86; + catActor->_scale = 0x80; + catActor->updateSequence(0xb); + if (flickerXPos < local_240 >> 7) { + sVar2 = flickerXPos + 0x32; + } else { + sVar2 = flickerXPos - 0x32; + } + local_16e = sVar2 * 0x80; + local_23c = (short)(((int)(((uint)local_16e - (uint)local_240) * 0x10000) >> 0x10) / + 0x1c); + } + } else { + if (local_23e < 0x5f00) { + if (local_238 == 0) { + local_23e = local_23e + local_23a; + local_240 = local_240 + local_23c; + catFieldE_scaleMaybe = catFieldE_scaleMaybe + 6; + if (0x100 < catFieldE_scaleMaybe) { + catFieldE_scaleMaybe = 0x100; + } + catActor->_scale = catFieldE_scaleMaybe; + catActor->_y_pos = local_23e >> 7; + catActor->_x_pos = local_240 >> 7; + local_238 = 1; + } else { + local_238 = local_238 + -1; + } + } else { + if ((int)(uint)(local_240 >> 7) < (int)((uint)flickerXPos - 0x32)) { + if (catActor->_sequenceID != 9) { + catActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; + catActor->updateSequence(9); + } + local_240 = local_240 + 0x180; + catActor->_x_pos = local_240 >> 7; + } else { + if ((uint)flickerXPos + 0x32 < (uint)(local_240 >> 7)) { + if (catActor->_sequenceID != 10) { + catActor->_scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE; + catActor->updateSequence(10); + } + local_240 = local_240 - 0x180; + catActor->_x_pos = local_240 >> 7; + } else { + gameState = 7; + } + } + } + } + } + } + break; + case 7: // cat jumping into catapult + if (catActor->_priorityLayer == 0) { + gameState = 1; + } else { + catActor->_priorityLayer = 0; + if (local_240 >> 7 < flickerXPos) { + flickerActor->updateSequence(5); + } else { + flickerActor->updateSequence(6); + } + } + break; + case 8: // cat hit target. + if (local_234 == 1) { + if (local_23a < 1) { + local_234 = 2; + } else { + local_23a--; + catActor->_y_pos = catActor->_y_pos + 2; + } + } else { + if (local_234 < 2) { + if ((local_234 == 0) && ((catActor->_flags & 4) != 0)) { + local_234 = 3; + local_232 = 0; + } + } else { + if (local_234 == 2) { + local_23e = 0x4100; + local_240 = 0x4a80; + catActor->_y_pos = 0x82; + catActor->_x_pos = 0x95; + catActor->_priorityLayer = 3; + catActor->_scale = 0x80; + catActor->updateSequence(0x10); + gameState = 6; + } else { + if (local_234 == 3) { + if (local_232 == 0) { + catActor->_priorityLayer = 2; + local_23a = 8; + local_234 = 1; + } else { + local_232 = local_232 + -1; + } + } + } + } + } + break; + default: + //ProbablyShowASCIIMessage(s_undefined_state!_8008e9cc, 2, 3, 0, 0xffffffff); + gameState = 1; + catActor->_priorityLayer = 0; + flickerActor->updateSequence(0); } if ((local_252 == 0) && (gameState != 2)) { if (!_vm->isLeftKeyPressed() || (flickerXPos < 0x37)) { @@ -685,14 +652,12 @@ void Minigame1::run() { if (bVar3) { pusherActor->_x_pos = flickerActor->_x_pos + 2; pusherActor->_y_pos = flickerActor->_y_pos; - } - else { + } else { pusherActor->_x_pos = flickerActor->_x_pos - 0xe; pusherActor->_y_pos = flickerActor->_y_pos + 7; } } - } - else { + } else { bVar3 = true; local_246 = 8; if (pusherActor->_sequenceID != 2) { @@ -703,14 +668,12 @@ void Minigame1::run() { if (flickerXPos < 0x36) { flickerXPos = 0x36; } - } - else { + } else { flickerXPos = 0x108; } if (local_242 == 0) { local_242 = 0xb; - } - else { + } else { local_242 = local_242 - 1; } flickerActor->_x_pos = flickerXPos; @@ -722,8 +685,7 @@ void Minigame1::run() { pusherActor->_x_pos = flickerActor->_x_pos + 2; pusherActor->_y_pos = flickerActor->_y_pos; } - } - else { + } else { bVar3 = false; local_246 = (uint16)(gameState != 1); if (pusherActor->_sequenceID != 3) { @@ -734,8 +696,7 @@ void Minigame1::run() { if (flickerXPos < 0x36) { flickerXPos = 0x36; } - } - else { + } else { flickerXPos = 0x108; } local_242 = (short)((uint)local_242 + 1) + @@ -753,8 +714,7 @@ void Minigame1::run() { if ((local_22c == 0x14) && (hitCounter < 9)) { local_252 = 1; local_22c = 0x16; - } - else { + } else { if (auStack536[(uint)local_22c * 3 + 1] == 1) { i = 0; while ((i < 3 && (auStack378[(uint)i] != 0))) { @@ -762,33 +722,29 @@ void Minigame1::run() { } if (i == 3) { debug("too many targets"); -// ProbablyShowASCIIMessage(s_too_many_targets!_8008e9e0,2,4,0,0xffffffff); +// ProbablyShowASCIIMessage(s_too_many_targets!_8008e9e0, 2, 4, 0, 0xffffffff); } if (auStack536[(uint)local_22c * 3] == 0) { targetActorIdTbl[(uint)i + 1]->_x_pos = auStack352[(uint)auStack536[(uint)local_22c * 3] * 3] + 0xd; - } - else { + } else { targetActorIdTbl[(uint)i + 1]->_x_pos = auStack352[(uint)auStack536[(uint)local_22c * 3] * 3] + 8; } targetActorIdTbl[(uint)i + 1]->_y_pos = (4 - auStack352[(uint)auStack536[(uint)local_22c * 3] * 3 + 2]) * 0x20; targetActorIdTbl[(uint)i + 1]->_priorityLayer = 2; if (auStack536[(uint)local_22c * 3] == 0) { targetActorIdTbl[(uint)i + 1]->updateSequence(3); - } - else { + } else { targetActorIdTbl[(uint)i + 1]->updateSequence(0); } targetActorIdTbl[(uint)i + 1]->_priorityLayer = 2; local_188[(uint)auStack536[(uint)local_22c * 3]] = i + 1; auStack378[(uint)i] = auStack536[(uint)local_22c * 3] + 1; - } - else { + } else { if ((auStack536[(uint)local_22c * 3 + 1] == 2) && (i = auStack536[(uint)local_22c * 3], local_188[(uint)i] != 0)) { if (auStack536[(uint)local_22c * 3] == 0) { targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->updateSequence(5); - } - else { + } else { targetActorIdTbl[(uint)(uint16)local_188[(uint)i]]->updateSequence(2); } if (local_250 != 0) { @@ -800,22 +756,19 @@ void Minigame1::run() { uVar5 = _vm->getRand(2); local_168 = local_c0[(uint)uVar5 * 2 + 4]; local_16a = *(short *)(local_c0 + (uint)uVar5 * 2 + 5); - } - else { + } else { uVar5 = _vm->getRand(2); local_168 = local_c0[(uint)uVar5 * 2]; local_16a = *(short *)(local_c0 + (uint)uVar5 * 2 + 1); } - } - else { + } else { uVar5 = _vm->getRand(2); local_168 = local_c0[(uint)uVar5 * 2 + 4]; local_16a = *(short *)(local_c0 + (uint)uVar5 * 2 + 5); } - if ((local_252 == 0) || ((auStack536[(uint)local_22c * 3] == 0 && (local_254 == 0)))) - { + if ((local_252 == 0) || ((auStack536[(uint)local_22c * 3] == 0 && (local_254 == 0)))) { _vm->_talk->loadText(local_168, auStack1008, 200); - _vm->_talk->displayDialogAroundPoint(auStack1008,(int)(short)(flickerXPos >> 3),0xc,0,0,local_168); + _vm->_talk->displayDialogAroundPoint(auStack1008, (int)(short)(flickerXPos >> 3), 0xc, 0, 0, local_168); local_250 = local_16a; } if (local_254 < 2) { @@ -843,6 +796,7 @@ void Minigame1::run() { } local_22e = local_22e + 1; } while (local_252 == 0); + if (flickerActor->_x_pos < 0x118) { flickerActor->_x_pos = flickerActor->_x_pos + 2; if (pusherActor->_sequenceID != 2) { @@ -853,8 +807,7 @@ void Minigame1::run() { wheelsActor->_x_pos = wheelsActor->_x_pos + 2; if (local_242 == 0) { local_242 = 0xb; - } - else { + } else { local_242--; } if ((uint)wheelsActor->_sequenceID != (uint)local_242 / 3 + 0x11) { @@ -862,6 +815,7 @@ void Minigame1::run() { } goto LAB_8008fa78; } + if ((local_252 == 1) && ((gameState == 6 || (gameState == 1)))) { pusherActor->updateSequence(9); _vm->waitForFrames(0xf); @@ -872,6 +826,7 @@ void Minigame1::run() { _vm->getINI(DAT_80063a40 - 1)->actor->clearFlag(ACTOR_FLAG_100); break; } + if ((local_252 == 2) && (gameState == 6)) { _vm->getINI(DAT_80063a40 - 1)->field_14 = 2; if (local_250 != 0) { @@ -886,7 +841,7 @@ void Minigame1::run() { _vm->getINI(DAT_80063a40 - 1)->actor->clearFlag(ACTOR_FLAG_100); break; } - } while ( true ); + } while (true); //TODO callMaybeResetData(); flickerActor->updateSequence(0x15); diff --git a/engines/dragons/minigame2.cpp b/engines/dragons/minigame2.cpp index dc1b7bbba56..94bff0b2abe 100644 --- a/engines/dragons/minigame2.cpp +++ b/engines/dragons/minigame2.cpp @@ -36,7 +36,7 @@ namespace Dragons { Minigame2::Minigame2(DragonsEngine *vm) : _vm(vm), _dat_80093c70(false), _dat_80093c72(false), _dat_80093c74(0), _dat_80093ca8(false) {} static const uint16 unkArray[5] = { - 0xC, 0xA, 0x8, 0x6, 0x4 + 0xC, 0xA, 0x8, 0x6, 0x4 }; void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { @@ -287,8 +287,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { uVar14->clearFlag(ACTOR_FLAG_40); uVar15->clearFlag(ACTOR_FLAG_40); _vm->reset_screen_maybe(); - } - else { + } else { _vm->reset_screen_maybe(); _vm->_scene->setSceneId(0x17); flicker->sceneId = 0x17; @@ -322,27 +321,23 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { } if (_dat_80093ca4 == 0) { _dat_80093ca4 = _dat_80093cc8; - } - else { + } else { _dat_80093ca4 = _dat_80093ca4 - 1; } if (_dat_80093c90 == 0) { _dat_80093c90 = _dat_80093c98; - } - else { + } else { _dat_80093c90 = _dat_80093c90 - 1; } if (_dat_80093cc4 == 0) { _dat_80093cc4 = _dat_80093cc8; - } - else { + } else { _dat_80093cc4 = _dat_80093cc4 - 1; } if (local_27a == 0) { // TODO (&DAT_80083178)[(uint)uVar16 * 0xb] = (&DAT_80083178)[(uint)uVar16 * 0xb] & 0xfffe; - } - else { + } else { /* TODO (&DAT_8008316c)[(uint)uVar16 * 0xb] = local_27a + 0x27; (&DAT_80083168)[(uint)uVar16 * 0xb] = local_27a + 0x27; @@ -355,8 +350,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if (local_278 == 0) { //TODO (&DAT_80083178)[(uint)uVar17 * 0xb] = (&DAT_80083178)[(uint)uVar17 * 0xb] & 0xfffe; if ((local_27a != 0) || (local_258 != 0)) goto LAB_800907c4; - } - else { + } else { /*TODO (&DAT_8008316c)[(uint)uVar17 * 0xb] = local_278 + 0x27; (&DAT_80083168)[(uint)uVar17 * 0xb] = local_278 + 0x27; @@ -408,8 +402,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { } local_260 = 300; } - } - else { + } else { local_264 = 0; local_260 = 300; // playSoundFromTxtIndex(textIdTbl[local_262]); @@ -513,8 +506,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if ((!_vm->isLeftKeyPressed() && !_vm->isRightKeyPressed()) && (local_288 != 2)) { if (local_288 < 2) { local_288 = local_288 + 1; - } - else { + } else { local_288 = local_288 - 1; } } @@ -522,8 +514,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if (local_286 != 0) { local_286 = local_286 - 1; } - } - else { + } else { if (local_286 < 2) { local_286 = local_286 + 1; } @@ -532,15 +523,13 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if (local_286 == 2) { if (local_256 < 0x14) { local_256 = local_256 + 1; - } - else { + } else { local_256 = 0; } } if (local_256 < 0x14) { local_264 = local_264 + 1; - } - else { + } else { local_264 = 0; } if ((uVar12->_flags & 4) != 0) { @@ -553,8 +542,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if ((!fun_80093520() && !fun_80093248()) && (local_284 != 2)) { if (local_284 < 2) { local_284 = local_284 + 1; - } - else { + } else { local_284 = local_284 - 1; } } @@ -562,8 +550,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if (local_282 != 0) { local_282 = local_282 - 1; } - } - else { + } else { if (local_282 < 2) { local_282 = local_282 + 1; } @@ -572,15 +559,13 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if (((local_286 == 2) && (local_282 == 2)) && (local_288 == local_284)) { if ((_dat_80093cbc == 2) && (_dat_80093cc0 != 2)) { local_258 = 2; - } - else { + } else { if ((_dat_80093cbc == 2) || (_dat_80093cc0 != 2)) { local_288 = _dat_80093cb4; local_286 = _dat_80093cbc; local_284 = _dat_80093cb8; local_282 = _dat_80093cc0; - } - else { + } else { local_258 = 1; } } @@ -598,47 +583,39 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { uVar12->updateSequence((uint)(uint16)actorSequenceIdTbl[(uint)local_284 * 3 + (uint)local_282]); uVar13->updateSequence((uint)(uint16)actorSequenceIdTbl[(uint)_dat_80093cb8 * 3 + (uint)_dat_80093cc0]); } - } - else { + } else { if (local_258 == 1) { loungealotHeadActor->updateSequence(1); uVar8->updateSequence(1); if (local_288 == 2) { local_28 = 1; - } - else { + } else { if (local_288 < 3) { if (local_288 == 0) { local_28 = 0; - } - else { + } else { LAB_800926a4: local_28 = 2; } - } - else { + } else { if (local_288 != 4) goto LAB_800926a4; local_28 = 2; } } - } - else { + } else { loungealotHeadActor->updateSequence(3); loungealotRightArm->updateSequence(1); if (local_284 == 2) { local_28 = 4; - } - else { + } else { if (local_284 < 3) { if (local_284 == 0) { local_28 = 3; - } - else { + } else { LAB_80092754: local_28 = 4; } - } - else { + } else { if (local_284 != 4) goto LAB_80092754; local_28 = 5; } @@ -652,8 +629,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { _dat_80093c90 = 0x1e; } } - } - else { + } else { if (_dat_80093c94 == 2) { uVar12->_flags = uVar12->_flags | 0x1000; uVar13->_flags = uVar13->_flags | 0x1000; @@ -669,8 +645,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { } while (_vm->isFlagSet(ENGINE_FLAG_8000)); loungealotHeadActor->updateSequence(2); loungealotRightArm->updateSequence(3); - } - else { + } else { // playSoundFromTxtIndex(DAT_80063ad4); loungealotHeadActor->updateSequence(10); fun_80093aec_dialog(0x4718,0x14,1); @@ -694,8 +669,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if (local_278 != 0) { local_278 = local_278 - 1; } - } - else { + } else { local_272 = local_272 + -1; } @@ -708,16 +682,14 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { if (fun_80093990()) { if (param_1 == 1) { local_278 = local_278 + 4; - } - else { + } else { local_278 = local_278 + 6; } } if (fun_80093a30()) { if (param_1 == 1) { local_278 = local_278 + 4; - } - else { + } else { local_278 = local_278 + 6; } } @@ -737,8 +709,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { // playSoundFromTxtIndex(DAT_80063ad8); loungealotHeadActor->updateSequence(0xb); fun_80093aec_dialog(0x475E,0x14,1); - } - else { + } else { // playSoundFromTxtIndex(DAT_80063adc); loungealotHeadActor->updateSequence(0xc); fun_80093aec_dialog(0x4774,0x14,1); @@ -756,8 +727,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) { uVar13->updateSequence((uint)(uint16)actorSequenceIdTbl[(uint)_dat_80093cb8 * 3 + (uint)_dat_80093cc0]); _dat_80093c94 = 0; local_26c = 0x1e; - } - else { + } else { _dat_80093c94 = 2; } } @@ -791,15 +761,13 @@ bool Minigame2::fun_80093520() { _dat_80093c70 = true; _dat_80093cac = 0; uVar2 = false; - } - else { + } else { if (_dat_80093ca4 == 0) { _dat_80093cac = 0; if (_dat_80093cb8 == _dat_80093cb4) { if (_dat_80093cbc < _dat_80093cc0) { _dat_80093cac = (uint16)(_dat_80093cb8 < 4); - } - else { + } else { if (!_dat_80093cb0 && _vm->getRand(8) < 3) { if (_vm->getRand(8) < 3) { _dat_80093c72 = 1; @@ -815,8 +783,7 @@ bool Minigame2::fun_80093520() { _dat_80093cac = 1; } } - } - else { + } else { if ((_dat_80093cb8 < _dat_80093cb4) && (_dat_80093cb4 != 2)) { _dat_80093cac = 1; } @@ -824,18 +791,15 @@ bool Minigame2::fun_80093520() { } uVar2 = (uint)_dat_80093cac; } - } - else { + } else { _dat_80093cac = 1; uVar2 = true; } - } - else { + } else { _dat_80093cac = 0; uVar2 = false; } - } - else { + } else { uVar2 = _vm->isLeftKeyPressed(); } return uVar2; @@ -853,15 +817,13 @@ bool Minigame2::fun_80093248() { _dat_80093c72 = true; _dat_80093cb0 = false; uVar2 = false; - } - else { + } else { if (_dat_80093ca4 == 0) { _dat_80093cb0 = false; if (_dat_80093cb8 == _dat_80093cb4) { if (_dat_80093cbc < _dat_80093cc0) { _dat_80093cb0 = (bool)(_dat_80093cb8 != 0); - } - else { + } else { if ((_dat_80093cac == 0) && _vm->getRand(8) < 3) { if (_vm->getRand(8) < 3) { _dat_80093c70 = true; @@ -878,8 +840,7 @@ bool Minigame2::fun_80093248() { _dat_80093cb0 = true; } } - } - else { + } else { if ((_dat_80093cb4 < _dat_80093cb8) && (_dat_80093cb4 != 2)) { _dat_80093cb0 = true; } @@ -887,18 +848,15 @@ bool Minigame2::fun_80093248() { } uVar2 = _dat_80093cb0; } - } - else { + } else { _dat_80093cb0 = true; uVar2 = true; } - } - else { + } else { _dat_80093cb0 = false; uVar2 = false; } - } - else { + } else { uVar2 = _vm->isRightKeyPressed(); } return uVar2; @@ -912,8 +870,7 @@ bool Minigame2::fun_80093800() { _dat_80093ca8 = false; if ((_dat_80093cb8 == _dat_80093cb4) && (_dat_80093cc0 < _dat_80093cbc)) { _dat_80093ca8 = true; - } - else { + } else { if (_vm->getRand(8) < 3) { _dat_80093ca4 = _vm->getRand(10); _dat_80093ca4 = _dat_80093cc8 + _dat_80093ca4; @@ -922,8 +879,7 @@ bool Minigame2::fun_80093800() { } } uVar2 = _dat_80093ca8; - } - else { + } else { uVar2 = false; if (_vm->isSquareButtonPressed() || _vm->isCrossButtonPressed() || _vm->isCircleButtonPressed() || @@ -939,8 +895,7 @@ bool Minigame2::fun_80093a30() { if (_dat_80093ca0 == 0) { uVar1 = (uint) _dat_80093c90 == (uint) _dat_80093cc8 / 3; - } - else { + } else { uVar1 = _vm->isL1ButtonPressed(); // TODO || _vm->isL2ButtonPressed(); } return uVar1; @@ -951,8 +906,7 @@ bool Minigame2::fun_80093990() { if (_dat_80093ca0 == 0) { uVar1 = _dat_80093c90 == 0; - } - else { + } else { uVar1 = _vm->isR1ButtonPressed(); // TODO || _vm->isR2ButtonPressed(); } return uVar1; diff --git a/engines/dragons/minigame3.cpp b/engines/dragons/minigame3.cpp index e4827b7f5d8..545a9702abf 100644 --- a/engines/dragons/minigame3.cpp +++ b/engines/dragons/minigame3.cpp @@ -301,8 +301,7 @@ void Minigame3::run() { while ((int16)i < 4) { if (goodRabbitPositionTbl[(int16)i] == 0) { bunnyActorTbl[(int16)i]->updateSequence(1); - } - else { + } else { local_16 = i; } i = i + 1; @@ -363,13 +362,11 @@ void Minigame3::run() { bunnyActorTbl[local_1c]->_y_pos = bunnyPositionsTbl[bunnyInfo[local_1e].positionIdx].y; bunnyActorTbl[local_1a]->_y_pos = bunnyPositionsTbl[bunnyInfo[local_20].positionIdx].y; currentState = 5; - } - else { + } else { if (bunnyActorTbl[local_1a]->_sequenceID == 5) { bunnyActorTbl[local_1a]->updateSequence(6); bunnyActorTbl[local_1c]->updateSequence(0xd); - } - else { + } else { local_56 = local_56 - *(int16 *)&UnkStruct_ARRAY_800931a0[local_50].field_0x14; bunnyInfo[local_20].x = bunnyInfo[local_20].x + UnkStruct_ARRAY_800931a0[local_50].field_0x14 * -0x200; bunnyInfo[local_20].y = bunnyInfo[local_20].y - bunnyInfo[local_20].field_0xc; @@ -404,8 +401,7 @@ void Minigame3::run() { local_50 = _vm->getRand(4); if (local_50 < 2) { i = _vm->getRand(2); - } - else { + } else { i = 0; } bunnyInfo[(int16)i].positionIdx = (uint)UnkStruct_ARRAY_800931a0[local_50].position1; @@ -428,8 +424,7 @@ void Minigame3::run() { bunnyActorTbl[local_1c]->updateSequence(0xc); if (hopCounter == 0x1d) { _vm->playOrStopSound(2); - } - else { + } else { _vm->playOrStopSound((uint)local_1c2); local_1c2 = 1 - local_1c2; } @@ -453,8 +448,7 @@ void Minigame3::run() { local_5c = local_5c + 5; currentState = 3; local_58 = 0x3c; - } - else { + } else { currentState = 2; local_58 = 2; } @@ -474,8 +468,7 @@ void Minigame3::run() { tearActorTbl[(int16)i]->_y_pos = tearActorTbl[(int16)i]->_y_pos + ((uint16)local_208[(int)(int16)i + 8] >> 6); if (tearActorTbl[(int16)i]->_y_pos < (int16)tearInfo[local_208[(int16)i]].yRelated) { local_208[(int)(int16)i + 8] = local_208[(int)(int16)i + 8] + 8; - } - else { + } else { tearActorTbl[(int16)i]->_priorityLayer = 0; local_1e8 = local_1e8 & ~(1 << ((int)local_208[(int16)i] & 0x1fU)); local_208[(int16)i] = -1; @@ -487,8 +480,7 @@ void Minigame3::run() { if (((local_1e0 < local_1de) && (currentState != 6)) && (sVar2 = _vm->getRand(2), sVar2 == 0)) { if ((local_1e8 & 0x7fff) < local_1e8 >> 0xf) { local_14 = 0; - } - else { + } else { local_14 = 0xf; } do { @@ -521,15 +513,13 @@ void Minigame3::run() { local_e = 1; } } - } - else { + } else { if (local_1c6 == 0) { if (local_1c8 == 2) { local_1c6 = 3; local_1c8 = 1; updateBackgroundLayerOffset(2, 0x640, 0); - } - else { + } else { if (local_1c8 == 1) { local_1c8 = 0; local_1ba = 0; @@ -540,13 +530,11 @@ void Minigame3::run() { tearBlinkActorTbl2[1]->updateSequence(1); } } - } - else { + } else { local_1c6 = local_1c6 + -1; } } - } - else { + } else { if (local_1c6 == 0) { i = 0; while ((int16)i < 8) { @@ -566,13 +554,11 @@ void Minigame3::run() { updateBackgroundLayerOffset(2, 0x780, 0); tearBlinkActorTbl[0]->_y_pos = 0xcc; tearBlinkActorTbl[1]->_y_pos = 0xcc; - } - else { + } else { local_1c6 = local_1c6 + -1; } } - } - else { + } else { if (local_1c6 == 0) { if (local_1c8 == 1) { local_1c6 = 3; @@ -582,8 +568,7 @@ void Minigame3::run() { tearBlinkActorTbl2[1]->updateSequence(1); tearBlinkActorTbl2[0]->_priorityLayer = 4; tearBlinkActorTbl2[1]->_priorityLayer = 4; - } - else { + } else { if (local_1c8 == 2) { local_1c6 = 0x14; local_1c8 = 3; @@ -593,8 +578,7 @@ void Minigame3::run() { flags = (flags & 0xfffe) | 2; } } - } - else { + } else { local_1c6 = local_1c6 + -1; } } @@ -632,16 +616,14 @@ void Minigame3::run() { tmpValue = _vm->getRand(2); if ((tmpValue & 0xffff) == 0) { local_1be = 1; - } - else { + } else { local_1be = 0xffff; } local_1bc = _vm->getRand(3); local_1bc = local_1bc + 3; local_1ba = _vm->getRand(10); local_1ba = local_1ba + 10; - } - else { + } else { if (((local_1be < 0) && (-10 < local_1c0)) || ((0 < local_1be && (local_1c0 < 10)))) { local_1c0 = local_1c0 + local_1be; } @@ -659,8 +641,7 @@ void Minigame3::run() { updateBackgroundLayerOffset(1, (int) -local_1c0, (int) eyeBgYOffsetTbl[local_1c0 + 10]); updateBackgroundLayerOffset(0, (int) -local_1c0, (int) eyeBgYOffsetTbl[local_1c0 + 10]); } - } - else { + } else { local_1ba = local_1ba + -1; } } @@ -739,8 +720,7 @@ void Minigame3::run() { if (goodRabbitPositionTbl[local_224] == 1) { bunnyActorTbl[bunnyPositionTbl[local_224]]->updateSequence(2); _vm->_dragonINIResource->getRecord(0x178)->field_14 = 1; - } - else { + } else { bunnyActorTbl[bunnyPositionTbl[local_224]]->updateSequence(3); i = 0; while (((int16)i < 4 && (goodRabbitPositionTbl[(int16)i] != 1))) { diff --git a/engines/dragons/minigame4.cpp b/engines/dragons/minigame4.cpp index a01d6c31b1d..70300a2f291 100644 --- a/engines/dragons/minigame4.cpp +++ b/engines/dragons/minigame4.cpp @@ -84,8 +84,7 @@ void Minigame4::run() { //call_fade_related_1f(); if (_vm->_dragonINIResource->getRecord(0x1f5)->field_12 == 3) { actorTalk(_bruteActor,0x3321,0x4A84); - } - else { + } else { actorTalk(_bruteActor,0x3321,0x49A2); actorTalk(_flickerActor,0,0x4A56); } @@ -120,8 +119,7 @@ void Minigame4::actorTalk(Actor *actorId,uint16 param_2,uint32 textIndex) actorId->waitUntilFlag8SetThenSet1000AndWaitFor4(); if (actorId == _bruteActor) { _bruteActor->updateSequence(9); - } - else { + } else { _flickerActor->updateSequence(9); } @@ -129,8 +127,7 @@ void Minigame4::actorTalk(Actor *actorId,uint16 param_2,uint32 textIndex) actorId->waitUntilFlag8SetThenSet1000AndWaitFor4(); if (actorId == _bruteActor) { _bruteActor->updateSequence(0); - } - else { + } else { _flickerActor->updateSequence(0); } } @@ -306,8 +303,7 @@ uint16 Minigame4::fun_8009009c(uint16 unk) { if (unk == 0) { _bruteActor->updateSequence(8); _flickerActor->updateSequence(7); - } - else { + } else { _bruteActor->updateSequence(7); _flickerActor->updateSequence(8); } diff --git a/engines/dragons/minigame5.cpp b/engines/dragons/minigame5.cpp index 58cbce647a5..d4a5a350bd1 100644 --- a/engines/dragons/minigame5.cpp +++ b/engines/dragons/minigame5.cpp @@ -184,20 +184,17 @@ void Minigame5::run() { ((flickerActor->_flags & 4) != 0)) { flickerActor->updateSequence(0x19); } - } - else { + } else { local_66 = 1; local_50 = 0; pusherActor->updateSequence(1); currentState = 2; if (local_74 < 0x14) { local_72 = 1; - } - else { + } else { if (local_74 < 0x2d) { local_72 = 2; - } - else { + } else { if (local_74 < 0x169) { local_72 = 3; } @@ -205,8 +202,7 @@ void Minigame5::run() { } } local_74 = 0; - } - else { + } else { pusherActor->_x_pos = flickerActor->_x_pos + -0xe; pusherActor->_y_pos = flickerActor->_y_pos + 7; if (local_74 < 0x168) { @@ -221,8 +217,7 @@ void Minigame5::run() { flickerActor->updateSequence(0x1a); _vm->playOrStopSound(2); } - } - else { + } else { if (local_74 < 0x2d) { if (((pusherActor->_sequenceID != 5) && (pusherActor->_sequenceID != 2)) && @@ -233,8 +228,7 @@ void Minigame5::run() { flickerActor->updateSequence(0x1e); _vm->playOrStopSound(3); } - } - else { + } else { if (local_74 < 0x169) { if (((pusherActor->_sequenceID != 6) && (pusherActor->_sequenceID != 2)) && @@ -248,8 +242,7 @@ void Minigame5::run() { } } } - } - else { + } else { if (pusherActor->_sequenceID != 6) { pusherActor->updateSequence(6); } @@ -265,8 +258,7 @@ void Minigame5::run() { if ((((int)(uint)local_850 < (int)((local_30[0]) - 6)) || ((uint)local_30[1] + 6 < (uint)local_850)) || (local_72 != local_30[2])) { local_42 = 8; - } - else { + } else { local_42 = 0; } local_5c = 0; @@ -286,8 +278,7 @@ void Minigame5::run() { flickerActor->updateSequence(8); currentState = 3; } - } - else { + } else { flickerActor->updateSequence(0x1b); _vm->playOrStopSound(1); } @@ -300,13 +291,11 @@ void Minigame5::run() { if (local_5a < 0) { local_5a = 0; } - } - else { + } else { if ((int)(uint)bombScale < (int)((uint)local_72 * -4 + 0xba)) { local_5e = local_5e + local_5a; local_5a = local_5a + local_28[((uint)local_72 - 1) * 3 + 2]; - } - else { + } else { local_5a = 0; } } @@ -318,8 +307,7 @@ void Minigame5::run() { if (((local_60 >> 7 < local_30[0]) || (local_30[1] < local_60 >> 7)) || (local_72 != local_30[2])) { local_42 = 8; - } - else { + } else { local_42 = 0; } if (local_42 == 8) { @@ -338,8 +326,7 @@ void Minigame5::run() { dustActor->updateSequence(9); currentState = 4; } - } - else { + } else { local_4e->_field_c = 2; local_4c = 0x3c; bombActor->_priorityLayer = 0; @@ -364,8 +351,7 @@ void Minigame5::run() { _vm->_talk->loadText(DAT_8006393c,auStack2120, 1000); _vm->_talk->displayDialogAroundPoint(auStack2120,(int)(short)(local_850 >> 3),0xc,0,1,DAT_8006393c); _dat_800633e6 = 1; - } - else { + } else { _vm->_talk->loadText(DAT_80063938, auStack2120, 1000); _vm->_talk->displayDialogAroundPoint(auStack2120,(int)(short)(local_850 >> 3),0xc,0,1, DAT_80063938); } @@ -415,14 +401,12 @@ void Minigame5::run() { if (local_50 == 0) { pusherActor->_x_pos = flickerActor->_x_pos + -0xe; pusherActor->_y_pos = flickerActor->_y_pos + 7; - } - else { + } else { pusherActor->_x_pos = flickerActor->_x_pos + 2; pusherActor->_y_pos = flickerActor->_y_pos; } } - } - else { + } else { local_50 = 1; local_66 = 8; if (pusherActor->_sequenceID != 2) { @@ -433,14 +417,12 @@ void Minigame5::run() { if (local_850 < 0x36) { local_850 = 0x36; } - } - else { + } else { local_850 = 0x108; } if (local_62 == 0) { local_62 = 0xb; - } - else { + } else { local_62 = local_62 - 1; } flickerActor->_x_pos = local_850; @@ -451,8 +433,7 @@ void Minigame5::run() { pusherActor->_x_pos = flickerActor->_x_pos + 2; pusherActor->_y_pos = flickerActor->_y_pos; } - } - else { + } else { local_50 = 0; local_66 = (uint16)(currentState != 1); if (pusherActor->_sequenceID != 3) { @@ -463,8 +444,7 @@ void Minigame5::run() { if (local_850 < 0x36) { local_850 = 0x36; } - } - else { + } else { local_850 = 0x108; } local_62 = (short)((uint)local_62 + 1) + @@ -489,8 +469,7 @@ void Minigame5::run() { wheelsActor->_x_pos = wheelsActor->_x_pos + 2; if (local_62 == 0) { local_62 = 0xb; - } - else { + } else { local_62 = local_62 - 1; } if ((uint)wheelsActor->_sequenceID != (uint)local_62 / 3 + 0x11) { @@ -516,8 +495,7 @@ void Minigame5::run() { local_44 = pusherActor->_y_pos; pusherActor->reset_maybe(); // EnableVSyncEvent(); - } - else { + } else { // DisableVSyncEvent(); dustActor->reset_maybe(); bombActor->reset_maybe(); @@ -530,8 +508,7 @@ void Minigame5::run() { local_78->actor->_x_pos = local_46; local_78->actor->setFlag(ACTOR_FLAG_100); local_78->actor->_priorityLayer = 5; - } - else { + } else { local_78->actor->clearFlag(ACTOR_FLAG_100); local_78->actor->_priorityLayer = 2; } diff --git a/engines/dragons/scriptopcodes.cpp b/engines/dragons/scriptopcodes.cpp index 6e72cb63e5c..ee9a5ce8ea5 100644 --- a/engines/dragons/scriptopcodes.cpp +++ b/engines/dragons/scriptopcodes.cpp @@ -735,8 +735,7 @@ void ScriptOpcodes::opUnk10(ScriptOpCall &scriptOpCall) { secondIni->y = newYPos1; secondIni->actor->_y_pos = newYPos1; } - } - else { + } else { int16 newYPos2 = firstIni->actor->_y_pos + firstIni->field_1e; firstIni->y = newYPos2; secondIni->actor->_y_pos = newYPos2; @@ -754,8 +753,7 @@ void ScriptOpcodes::opUnk10(ScriptOpCall &scriptOpCall) { } if ((field8 & 0x8000) == 0) { someBooleanFlag = (uint)field8 << 0x10; - } - else { + } else { someBooleanFlag = ((uint)field8 & 0x7fff) << 7; } if (field6 != -1) { @@ -780,8 +778,7 @@ void ScriptOpcodes::opUnk10(ScriptOpCall &scriptOpCall) { if (_vm->_dragonINIResource->isFlicker(secondIni)) { someBooleanFlag = 0; } - } - else { + } else { newXPosAgain = firstIni->actor->_x_pos + firstIni->field_1c; newYPosAgain = firstIni->actor->_y_pos + firstIni->field_1e; if (_vm->_dragonINIResource->isFlicker(secondIni)) { @@ -878,8 +875,7 @@ void ScriptOpcodes::opCodeActorTalk(ScriptOpCall &scriptOpCall) { READ_LE_INT16(_vm->_dragonOBD->getFromOpt(iniId) + 6), 1, ini->actor, startSequenceId, endSequenceId, textIndex); - } - else { + } else { _vm->_talk->FUN_8003239c(dialog, (int)(((uint)ini->actor->_x_pos - (uint)_vm->_scene->_camera.x) * 0x10000) >> 0x13, (int)(((ini->actor->_y_pos - ini->actor->_frame->yOffset) - (uint)_vm->_scene->_camera.y) * 0x10000) >> 0x13, @@ -1222,8 +1218,7 @@ void ScriptOpcodes::opCode_Unk7(ScriptOpCall &scriptOpCall) { _vm->_cursor->_data_800728b0_cursor_seqID = 0; _vm->_cursor->_sequenceID = 0; _vm->_cursor->_iniItemInHand = 0; - } - else { + } else { if (_vm->_inventory->clearItem(ini->id + 1)) { if (_vm->_inventory->getType() == 1) { ini->actor->clearFlag(ACTOR_FLAG_40); diff --git a/engines/dragons/specialopcodes.cpp b/engines/dragons/specialopcodes.cpp index a2a86304e63..1bf4f3081d6 100644 --- a/engines/dragons/specialopcodes.cpp +++ b/engines/dragons/specialopcodes.cpp @@ -270,8 +270,7 @@ void SpecialOpcodes::spcCastleGardenLogic() { sceneUpdater.sequenceIDTbl[3][0] = 1; sceneUpdater.iniIDTbl[3][0] = 0x145; sceneUpdater.iniIDTbl[4][0] = 0x144; - } - else { + } else { sceneUpdater.sequenceIDTbl[0][0] = -1; sceneUpdater.sequenceIDTbl[1][0] = -1; sceneUpdater.sequenceIDTbl[2][0] = -1; @@ -463,8 +462,7 @@ void SpecialOpcodes::spcWalkOnStilts() { while (flickerOnStilts->isFlagSet(ACTOR_FLAG_10)) { if (flickerOnStilts->_frame->field_c == 0) { isInWater = false; - } - else { + } else { if (!isInWater && flickerOnStilts->_y_pos >= 0x6a && flickerOnStilts->_y_pos < 0x96) { isInWater = true; waterRipples->_x_pos = flickerOnStilts->_x_pos - flickerOnStilts->_frame->field_e; @@ -1243,8 +1241,7 @@ void SpecialOpcodes::pizzaMakerStopWorking() { actorf5->_x_pos = 0xff9c; actorf5->_y_pos = 100; actorf4->updateSequence(3); - } - else { + } else { if (actorf4->_sequenceID == 2) { _vm->waitForFrames(0x78); actorf5->updateSequence(8); @@ -1252,8 +1249,7 @@ void SpecialOpcodes::pizzaMakerStopWorking() { actorf5->_x_pos = 0xff9c; actorf5->_y_pos = 100; actorf4->updateSequence(3); - } - else { + } else { if (actorf4->_sequenceID != 3) { return; } @@ -1351,8 +1347,7 @@ void pizzaUpdateFunction() { } } } - } - else { + } else { counter--; } } @@ -1404,8 +1399,7 @@ void castleBuildingBlackDragon2UpdateFunction() { ini->actor->updateSequence(0xb); ini->field_10 = 0x68; ini->field_12 = 1; - } - else if (ini->field_12 == 1) { + } else if (ini->field_12 == 1) { ini->actor->updateSequence(4); ini->field_10 = vm->getRand(0xb4); ini->field_12 = 0; @@ -1422,8 +1416,7 @@ void shakeScreenUpdateFunction() { shakeDirection = shakeDirection ^ 1u; int16 shakeValue = shakeDirection != 0 ? 1 : -1; vm->_screen->setScreenShakeOffset(shakeValue, shakeValue); - } - else { + } else { counter--; } vm->_scriptOpcodes->_specialOpCodes->setSpecialOpCounter(counter); @@ -1466,8 +1459,7 @@ void castleFogUpdateFunction() { } vm->_scene->setLayerOffset(2, Common::Point(castleFogXOffset, 0)); specialOpCounter = 6; - } - else { + } else { specialOpCounter--; } vm->_scriptOpcodes->_specialOpCodes->setSpecialOpCounter(specialOpCounter); @@ -1493,8 +1485,7 @@ void menInMinesSceneUpdateFunction() { vm->_scriptOpcodes->_specialOpCodes->setSpecialOpCounter(vm->getRand(5) * 0x3c + 0x708); vm->_talk->playDialogAudioDontWait(sceneUpdateFuncDialogTbl[vm->getRand(4)]); sequenceId = 2; - } - else { + } else { if (vm->_data_800633fc == 0) { return; } @@ -1717,8 +1708,7 @@ void flameEscapeSceneUpdateFunction() { vm->_talk->playDialogAudioDontWait(dialogTbl[vm->getRand(6)]); specialOpCounter = 0; DAT_800634c0 = 1; - } - else { + } else { if (DAT_800634c0 == 1) { flame->updateSequence(0x10); specialOpCounter = (vm->getRand(0x14) + 10) * 0x3c; @@ -1727,8 +1717,7 @@ void flameEscapeSceneUpdateFunction() { } } vm->_scriptOpcodes->_specialOpCodes->setSpecialOpCounter(specialOpCounter); - } - else { + } else { if ((vm->_data_800633fc != 0) && flame->_sequenceID != 0x10) { flame->updateSequence(0x10); } @@ -1760,8 +1749,7 @@ void caveOfDilemmaUpdateFunction() { oldManActor->_y_pos = oldManActor->_y_pos + yOffset; cloudChairActor->_y_pos = cloudChairActor->_y_pos + yOffset; counter = 10; - } - else { + } else { counter--; } } diff --git a/engines/dragons/talk.cpp b/engines/dragons/talk.cpp index 21e3bf81ffb..3579533dc7b 100644 --- a/engines/dragons/talk.cpp +++ b/engines/dragons/talk.cpp @@ -272,8 +272,8 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u // iVar6 = (int)(short)iVar8; // goto LAB_800328f8; // } -// } - else { +// } else + { LAB_800328f8: if (-1 < iVar8) { if (currentLine[iVar8] == 0x20) { @@ -290,8 +290,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u // *(undefined2 *)(((iVar8 << 0x10) >> 0xf) + (int)currentLine) = 0; // iVar8 = iVar6; // } while (-1 < iVar6 * 0x10000); - } - else { + } else { currentLine[iVar8 + 1] = 0; } } @@ -347,8 +346,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u sVar20 = (short)uVar11 >> 1; if ((short)x < 0x14) { _dat_8008e7e8_dialogBox_x1 = (x - sVar20) + 1; - } - else { + } else { _dat_8008e7e8_dialogBox_x1 = x - sVar20; } _dat_8008e848_dialogBox_x2 = (uVar11 + _dat_8008e7e8_dialogBox_x1) - 1; @@ -364,8 +362,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u dialogTextLinePtr = asStack2592 + unaff_s4 * 0x29; uVar9 = strlenUTF16(dialogTextLinePtr); uVar9 = ((uint)x - ((int)((uint)_dat_800726ec_tfont_field0 * (uVar9 & 0xffff) + 1) >> 1)) + 1; - } - else { + } else { dialogTextLinePtr = asStack2592 + unaff_s4 * 0x29; uVar9 = strlenUTF16(dialogTextLinePtr); uVar9 = (uint)x - ((int)((uint)_dat_800726ec_tfont_field0 * (uVar9 & 0xffff) + 1) >> 1); @@ -445,8 +442,7 @@ uint32 Talk::displayDialogAroundINI(uint32 iniId, uint16 *dialogText, uint32 tex if (local_v1_184->field_e == 0) { y = (uint)(uint16)local_v1_184->y; x = local_v1_184->field_a; - } - else { + } else { x = local_v1_184->field_a; y = (uint)(uint16)local_v1_184->y << 3; } @@ -456,8 +452,7 @@ uint32 Talk::displayDialogAroundINI(uint32 iniId, uint16 *dialogText, uint32 tex ((y - _vm->_scene->_camera.y) * 0x10000) >> 0x13, READ_LE_UINT16(_vm->_dragonOBD->getFromOpt(ini->id) + 6) ,1,textIndex); - } - else { + } else { displayDialogAroundActor (ini->actor, READ_LE_UINT16(_vm->_dragonOBD->getFromOpt(ini->id) + 6), @@ -614,8 +609,7 @@ bool Talk::talkToActor(ScriptOpCall &scriptOpCall) { if (loadText(selectedDialogText->textIndex1, local_800, 1000)) { if (selectedDialogText->field_26c == -1) { displayDialogAroundINI(_vm->_cursor->_iniUnderCursor, local_800, selectedDialogText->textIndex1); - } - else { + } else { iniId = _vm->_cursor->_iniUnderCursor; //dragon_ini_index_under_active_cursor; if (selectedDialogText->iniId != 0) { iniId = selectedDialogText->iniId; @@ -804,8 +798,7 @@ TalkDialogEntry *Talk::displayTalkDialogMenu(Common::Array dia y = y + 1; } while ((uVar7 & 0xffff) < (uVar4 & 0xffff)); } - } - else { + } else { uVar7 = 0; if (uVar6 < (uVar4 & 0xffff)) { do { @@ -881,15 +874,13 @@ void Talk::talkFromIni(uint32 iniId, uint32 textIndex) { if (!_vm->isFlagSet(ENGINE_FLAG_2000000)) { if (_vm->getCurrentSceneId() == 0x32) { _vm->getINI(0x2b1)->actor->updateSequence(2); - } - else { + } else { actor->setFlag(ACTOR_FLAG_2000); if (actor->_sequenceID2 != -1) { actor->updateSequence(actor->_sequenceID2 + 0x10); } } - } - else { + } else { if (actor->_sequenceID == 5) { actor->updateSequence(0x10); } @@ -915,8 +906,7 @@ void Talk::talkFromIni(uint32 iniId, uint32 textIndex) { } _vm->getINI(0x2b1)->actor->updateSequence(1); - } - else { + } else { if (actor->_sequenceID != 0x10) { return; } @@ -1096,8 +1086,7 @@ uint32 Talk::FUN_80031c28(uint16 *srcText, uint16 *destText, uint32 cutLength, u uVar1 = uVar3; LAB_80031d3c: uVar3 = uVar1; - } - else { + } else { if (((((chr != 0x20) && (chr != 0x2e)) && (chr != 0x3f)) && ((chr != 0x21 && (uVar1 = uVar3, chr != 0x2d)))) || ((uVar1 = uVar3, srcText[(srcCurIndex & 0xffff) + 1] == 0 ||