From 9709236f8e073aa495910c2b6f488f4c6ec6fbd0 Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Sun, 18 Oct 2026 22:46:28 +0200 Subject: d_a_obj_D3_dummy OK --- src/REL/d/a/obj/d_a_obj_D3_dummy.cpp | 124 +++++++++++++++++++++++++++++++++++ src/d/col/bg/d_bg_w_base.cpp | 2 +- 2 files changed, 125 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp b/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp index fe42fcca..60c9a671 100644 --- a/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp +++ b/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp @@ -1,9 +1,133 @@ #include "d/a/obj/d_a_obj_D3_dummy.h" +#include "common.h" +#include "d/a/obj/d_a_obj_base.h" +#include "d/col/bg/d_bg_s.h" +#include "d/d_sc_game.h" +#include "d/flag/dungeonflag_manager.h" +#include "f/f_base.h" +#include "m/m_vec.h" + +const char *d3Stages[8] = { + "D003_0", "D003_1", "D003_2", "D003_3", "D003_4", "D003_5", "D003_6", "D003_7", +}; + SPECIAL_ACTOR_PROFILE(OBJ_D3_DUMMY, dAcOD3Dummy_c, fProfile::OBJ_D3_DUMMY, 0x15E, 0, 6); STATE_DEFINE(dAcOD3Dummy_c, Wait); +bool dAcOD3Dummy_c::createHeap() { + const char *oarcName = "D3MapDummy"; + const char *iconName = "dat/d3icon.bil"; + const char *names[8] = { + "00", "01", "02", "03", "04", "05", "06", "07", + }; + field_0x156C = fn_599_7A0(); + fn_599_810(); + + for (int i = 0; i < 8; i++) { + if (i == field_0x156C) { + continue; + } + void *dzb = getOarcDZB(oarcName, names[i]); + void *plc = getOarcPLC(oarcName, names[i]); + if (mBgWs[i].Set((cBgD_t *)dzb, (PLC *)plc, 1, &field_13B0[i], &mScale)) { + return false; + } + bool result = mBgWs[i].InitMapStuff(&mAllocator); + if (!result) { + return false; + } + mBgWs[i].Set0x2F(i); + } + + field_0x1574 = getOarcFile(oarcName, iconName); + if (field_0x1574 == nullptr) { + return false; + } + + return true; +} + +int dAcOD3Dummy_c::create() { + CREATE_ALLOCATOR_SIZE(dAcOD3Dummy_c, 0x40000); + if (DungeonflagManager::sInstance->getCounterOrFlag(2, 8)) { + fn_599_940(); + } + mAcceleration = 0.f; + mMaxSpeed = 0.f; + mStateMgr.changeState(StateID_Wait); + mBoundingBox.Set(mVec3_c(-0.f, -0.f, -0.f), mVec3_c(0.f, 0.f, 0.f)); + return SUCCEEDED; +} + +int dAcOD3Dummy_c::doDelete() { + return SUCCEEDED; +} + +int dAcOD3Dummy_c::actorExecute() { + if (DungeonflagManager::sInstance->getCounterOrFlag(2, 8)) { + fn_599_940(); + } + mStateMgr.executeState(); + if (field_0x1570) { + fn_599_810(); + for (int i = 0; i < 8; i++) { + if (i != field_0x156C) { + mBgWs[i].Move(); + } + } + } + field_0x1570 = 0; + return SUCCEEDED; +} + +int dAcOD3Dummy_c::draw() { + return SUCCEEDED; +} + void dAcOD3Dummy_c::initializeState_Wait() {} void dAcOD3Dummy_c::executeState_Wait() {} void dAcOD3Dummy_c::finalizeState_Wait() {} + +s32 dAcOD3Dummy_c::fn_599_7A0() { + for (int i = 0; i < 8; i++) { + if (dScGame_c::isCurrentStage(d3Stages[i])) { + return i; + } + } + return -1; +} + +// get spot for tile +extern "C" s32 fn_80195730(dAcOD3Dummy_c *, s32 tile); + +void dAcOD3Dummy_c::fn_599_810() { + s32 currentStageSpot = fn_80195730(this, field_0x156C); + + for (int i = 0; i < 8; i++) { + if (i == field_0x156C) { + continue; + } + s32 spot = fn_80195730(this, i); + if (spot < 0) { + continue; + } + mVec3_c vec( + (spot % 3 - currentStageSpot % 3) * 7000.f, mPosition.y, (spot / 3 - currentStageSpot / 3) * 7000.f + ); + field_13B0[i].transS(vec); + } +} + +void dAcOD3Dummy_c::fn_599_940() { + if (field_0x1578 == 0) { + for (int i = 0; i < 8; i++) { + if (i == field_0x156C) { + continue; + } + dBgS::GetInstance()->RegistBg(&mBgWs[i], this); + } + field_0x1578 = 1; + } +} diff --git a/src/d/col/bg/d_bg_w_base.cpp b/src/d/col/bg/d_bg_w_base.cpp index 4efd5109..4df8b850 100644 --- a/src/d/col/bg/d_bg_w_base.cpp +++ b/src/d/col/bg/d_bg_w_base.cpp @@ -98,6 +98,6 @@ bool dBgW_Base::ChkReady() const { return true; } -void dBgW_Base::Set0x2F(u8 val) { +void dBgW_Base::Set0x2F(s32 val) { field_0x2F = val; } -- cgit v1.2.3 From df5b90c22a33a8956d402534528fbd49e0daf39c Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Sun, 18 Oct 2026 23:13:42 +0200 Subject: d_a_obj_D3_dummy documented --- src/REL/d/a/obj/d_a_obj_D3_dummy.cpp | 57 +++++++++++++++---------------- src/REL/d/a/obj/d_a_obj_control_panel.cpp | 4 +-- 2 files changed, 30 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp b/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp index 60c9a671..fd854446 100644 --- a/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp +++ b/src/REL/d/a/obj/d_a_obj_D3_dummy.cpp @@ -22,27 +22,27 @@ bool dAcOD3Dummy_c::createHeap() { const char *names[8] = { "00", "01", "02", "03", "04", "05", "06", "07", }; - field_0x156C = fn_599_7A0(); - fn_599_810(); + mCurrentRoomTileId = getCurrentSkyKeepRoomTileId(); + updateTileMtx(); for (int i = 0; i < 8; i++) { - if (i == field_0x156C) { + if (i == mCurrentRoomTileId) { continue; } void *dzb = getOarcDZB(oarcName, names[i]); void *plc = getOarcPLC(oarcName, names[i]); - if (mBgWs[i].Set((cBgD_t *)dzb, (PLC *)plc, 1, &field_13B0[i], &mScale)) { + if (mTileBgWs[i].Set((cBgD_t *)dzb, (PLC *)plc, cBgW::MOVE_BG_e, &mTileMtx[i], &mScale)) { return false; } - bool result = mBgWs[i].InitMapStuff(&mAllocator); + bool result = mTileBgWs[i].InitMapStuff(&mAllocator); if (!result) { return false; } - mBgWs[i].Set0x2F(i); + mTileBgWs[i].Set0x2F(i); } - field_0x1574 = getOarcFile(oarcName, iconName); - if (field_0x1574 == nullptr) { + mIconData = getOarcFile(oarcName, iconName); + if (mIconData == nullptr) { return false; } @@ -51,8 +51,9 @@ bool dAcOD3Dummy_c::createHeap() { int dAcOD3Dummy_c::create() { CREATE_ALLOCATOR_SIZE(dAcOD3Dummy_c, 0x40000); + // check has map if (DungeonflagManager::sInstance->getCounterOrFlag(2, 8)) { - fn_599_940(); + registerBgs(); } mAcceleration = 0.f; mMaxSpeed = 0.f; @@ -66,19 +67,20 @@ int dAcOD3Dummy_c::doDelete() { } int dAcOD3Dummy_c::actorExecute() { + // check has map if (DungeonflagManager::sInstance->getCounterOrFlag(2, 8)) { - fn_599_940(); + registerBgs(); } mStateMgr.executeState(); - if (field_0x1570) { - fn_599_810(); + if (mUpdateTilePositions) { + updateTileMtx(); for (int i = 0; i < 8; i++) { - if (i != field_0x156C) { - mBgWs[i].Move(); + if (i != mCurrentRoomTileId) { + mTileBgWs[i].Move(); } } } - field_0x1570 = 0; + mUpdateTilePositions = false; return SUCCEEDED; } @@ -90,7 +92,7 @@ void dAcOD3Dummy_c::initializeState_Wait() {} void dAcOD3Dummy_c::executeState_Wait() {} void dAcOD3Dummy_c::finalizeState_Wait() {} -s32 dAcOD3Dummy_c::fn_599_7A0() { +s32 dAcOD3Dummy_c::getCurrentSkyKeepRoomTileId() { for (int i = 0; i < 8; i++) { if (dScGame_c::isCurrentStage(d3Stages[i])) { return i; @@ -99,35 +101,32 @@ s32 dAcOD3Dummy_c::fn_599_7A0() { return -1; } -// get spot for tile -extern "C" s32 fn_80195730(dAcOD3Dummy_c *, s32 tile); - -void dAcOD3Dummy_c::fn_599_810() { - s32 currentStageSpot = fn_80195730(this, field_0x156C); +void dAcOD3Dummy_c::updateTileMtx() { + s32 currentStageSpot = getSpotForTile(mCurrentRoomTileId); for (int i = 0; i < 8; i++) { - if (i == field_0x156C) { + if (i == mCurrentRoomTileId) { continue; } - s32 spot = fn_80195730(this, i); + s32 spot = getSpotForTile(i); if (spot < 0) { continue; } mVec3_c vec( (spot % 3 - currentStageSpot % 3) * 7000.f, mPosition.y, (spot / 3 - currentStageSpot / 3) * 7000.f ); - field_13B0[i].transS(vec); + mTileMtx[i].transS(vec); } } -void dAcOD3Dummy_c::fn_599_940() { - if (field_0x1578 == 0) { +void dAcOD3Dummy_c::registerBgs() { + if (!mHasBgsRegistered) { for (int i = 0; i < 8; i++) { - if (i == field_0x156C) { + if (i == mCurrentRoomTileId) { continue; } - dBgS::GetInstance()->RegistBg(&mBgWs[i], this); + dBgS::GetInstance()->RegistBg(&mTileBgWs[i], this); } - field_0x1578 = 1; + mHasBgsRegistered = true; } } diff --git a/src/REL/d/a/obj/d_a_obj_control_panel.cpp b/src/REL/d/a/obj/d_a_obj_control_panel.cpp index a6a0457d..5efd6752 100644 --- a/src/REL/d/a/obj/d_a_obj_control_panel.cpp +++ b/src/REL/d/a/obj/d_a_obj_control_panel.cpp @@ -263,7 +263,7 @@ void dAcOCtrlPnl_c::finishMove() { sIsInSkykeepPuzzle = false; savePuzzleState(); if (mD3DummyRef.isLinked()) { - mD3DummyRef.get()->setField_0x1570(1); + mD3DummyRef.get()->setUpdateTilePositionsSignal(1); } if (changed) { mStateMgr.changeState(StateID_EndEvent); @@ -479,7 +479,7 @@ void dAcOCtrlPnl_c::handleControl() { dAcOD3Dummy_c *dummy = mD3DummyRef.get(); if (dummy != nullptr) { savePuzzleState(); - dummy->setField_0x1570(1); + dummy->setUpdateTilePositionsSignal(1); } } allowInteraction = false; -- cgit v1.2.3