d_a_obj_pinwheel OK

This commit is contained in:
swekka
2025-09-18 23:31:31 +02:00
parent f475873a90
commit 5d91704858
4 changed files with 192 additions and 32 deletions
@@ -8,19 +8,19 @@ __dt__27sFState_c<14dAcOpinwheel_c>Fv = .text:0x000001C0; // type:function size:
__dt__30sFStateFct_c<14dAcOpinwheel_c>Fv = .text:0x00000220; // type:function size:0x6C
__dt__83sStateMgr_c<14dAcOpinwheel_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000290; // type:function size:0xA0
__dt__53sFStateMgr_c<14dAcOpinwheel_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000330; // type:function size:0xA4
AcOpinwheel__initModels = .text:0x000003E0; // type:function size:0xE0
AcOpinwheel__init = .text:0x000004C0; // type:function size:0xFC
createHeap__14dAcOpinwheel_cFv = .text:0x000003E0; // type:function size:0xE0
create__14dAcOpinwheel_cFv = .text:0x000004C0; // type:function size:0xFC
changeState__83sStateMgr_c<14dAcOpinwheel_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000005C0; // type:function size:0x10
fn_375_5D0 = .text:0x000005D0; // type:function size:0x8
AcOpinwheel__update = .text:0x000005E0; // type:function size:0x6C
doDelete__14dAcOpinwheel_cFv = .text:0x000005D0; // type:function size:0x8
actorExecute__14dAcOpinwheel_cFv = .text:0x000005E0; // type:function size:0x6C
executeState__83sStateMgr_c<14dAcOpinwheel_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000650; // type:function size:0x10
AcOpinwheel__draw = .text:0x00000660; // type:function size:0x28
draw__14dAcOpinwheel_cFv = .text:0x00000660; // type:function size:0x28
initializeState_Wait__14dAcOpinwheel_cFv = .text:0x00000690; // type:function size:0xC
executeState_Wait__14dAcOpinwheel_cFv = .text:0x000006A0; // type:function size:0x50
finalizeState_Wait__14dAcOpinwheel_cFv = .text:0x000006F0; // type:function size:0x4
initializeState_Acceleration__14dAcOpinwheel_cFv = .text:0x00000700; // type:function size:0xC
executeState_Acceleration__14dAcOpinwheel_cFv = .text:0x00000710; // type:function size:0xC0
AcOpinwheel__decrement = .text:0x000007D0; // type:function size:0x1C
decrement__14dAcOpinwheel_cFPs = .text:0x000007D0; // type:function size:0x1C
finalizeState_Acceleration__14dAcOpinwheel_cFv = .text:0x000007F0; // type:function size:0x4
initializeState_RollMaxSpeed__14dAcOpinwheel_cFv = .text:0x00000800; // type:function size:0xC
executeState_RollMaxSpeed__14dAcOpinwheel_cFv = .text:0x00000810; // type:function size:0x88
@@ -28,7 +28,7 @@ finalizeState_RollMaxSpeed__14dAcOpinwheel_cFv = .text:0x000008A0; // type:funct
initializeState_Deceleration__14dAcOpinwheel_cFv = .text:0x000008B0; // type:function size:0xC
executeState_Deceleration__14dAcOpinwheel_cFv = .text:0x000008C0; // type:function size:0xC0
finalizeState_Deceleration__14dAcOpinwheel_cFv = .text:0x00000980; // type:function size:0x4
isBeingBlown = .text:0x00000990; // type:function size:0x6C
isBeingBlown__14dAcOpinwheel_cFv = .text:0x00000990; // type:function size:0x6C
__dt__14dAcOpinwheel_cFv = .text:0x00000A00; // type:function size:0xE4
getStateID__83sStateMgr_c<14dAcOpinwheel_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000AF0; // type:function size:0x10
build__30sFStateFct_c<14dAcOpinwheel_c>FRC12sStateIDIf_c = .text:0x00000B00; // type:function size:0x60
@@ -51,19 +51,19 @@ isSameName__29sFStateID_c<14dAcOpinwheel_c>CFPCc = .text:0x00001060; // type:fun
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
__destroy_global_chain_reference = .dtors:0x00000000; // type:object size:0x4 scope:global
lbl_375_rodata_0 = .rodata:0x00000000; // type:object size:0x14 data:float
lbl_375_rodata_0 = .rodata:0x00000000; // type:object size:0x14 scope:local data:float
g_profile_OBJ_PINWHEEL = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_375_data_10 = .data:0x00000010; // type:object size:0x60
lbl_375_data_70 = .data:0x00000070; // type:object size:0x20
AcOpinwheel__vtable = .data:0x00000090; // type:object size:0x80
lbl_375_data_110 = .data:0x00000110; // type:object size:0x30
lbl_375_data_140 = .data:0x00000140; // type:object size:0x30
lbl_375_data_170 = .data:0x00000170; // type:object size:0x18
lbl_375_data_188 = .data:0x00000188; // type:object size:0x140
lbl_375_data_2C8 = .data:0x000002C8; // type:object size:0x34
lbl_375_data_10 = .data:0x00000010; // type:object size:0x60 scope:local
lbl_375_data_70 = .data:0x00000070; // type:object size:0x20 scope:local
__vt__14dAcOpinwheel_c = .data:0x00000090; // type:object size:0x80
__vt__53sFStateMgr_c<14dAcOpinwheel_c,20sStateMethodUsr_FI_c> = .data:0x00000110; // type:object size:0x30
__vt__83sStateMgr_c<14dAcOpinwheel_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x00000140; // type:object size:0x30
lbl_375_data_170 = .data:0x00000170; // type:object size:0x18 scope:local
lbl_375_data_188 = .data:0x00000188; // type:object size:0x140 scope:local
__vt__29sFStateID_c<14dAcOpinwheel_c> = .data:0x000002C8; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_375_bss_8 = .bss:0x00000008; // type:object size:0x10 data:4byte
AcOpinwheel__STATE_WAIT = .bss:0x00000018; // type:object size:0x40 data:4byte
AcOpinwheel__STATE_ACCELERATION = .bss:0x00000058; // type:object size:0x40 data:4byte
AcOpinwheel__STATE_ROLL_MAX_SPEED = .bss:0x00000098; // type:object size:0x40 data:4byte
AcOpinwheel__STATE_DECELERATION = .bss:0x000000D8; // type:object size:0x30 data:4byte
lbl_375_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local data:4byte
AcOpinwheel__STATE_WAIT = .bss:0x00000018; // type:object size:0x40 scope:local data:4byte
AcOpinwheel__STATE_ACCELERATION = .bss:0x00000058; // type:object size:0x40 scope:local data:4byte
AcOpinwheel__STATE_ROLL_MAX_SPEED = .bss:0x00000098; // type:object size:0x40 scope:local data:4byte
AcOpinwheel__STATE_DECELERATION = .bss:0x000000D8; // type:object size:0x30 scope:local data:4byte
+1 -1
View File
@@ -2584,7 +2584,7 @@ config.libs = [
NonMatching, "d_a_obj_oct_grass_leaf", "REL/d/a/obj/d_a_obj_oct_grass_leaf.cpp"
),
Rel(NonMatching, "d_a_obj_paint", "REL/d/a/obj/d_a_obj_paint.cpp"),
Rel(NonMatching, "d_a_obj_pinwheel", "REL/d/a/obj/d_a_obj_pinwheel.cpp"),
Rel(Matching, "d_a_obj_pinwheel", "REL/d/a/obj/d_a_obj_pinwheel.cpp"),
Rel(NonMatching, "d_a_obj_pipe", "REL/d/a/obj/d_a_obj_pipe.cpp"),
Rel(NonMatching, "d_a_obj_piston", "REL/d/a/obj/d_a_obj_piston.cpp"),
Rel(NonMatching, "d_a_obj_pole_stony", "REL/d/a/obj/d_a_obj_pole_stony.cpp"),
+25 -1
View File
@@ -2,6 +2,10 @@
#define D_A_OBJ_PINWHEEL_H
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_w.h"
#include "d/col/cc/d_cc_d.h"
#include "m/m3d/m_smdl.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
@@ -10,13 +14,33 @@ public:
dAcOpinwheel_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dAcOpinwheel_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int doDelete() override;
virtual int actorExecute() override;
virtual int draw() override;
STATE_FUNC_DECLARE(dAcOpinwheel_c, Wait);
STATE_FUNC_DECLARE(dAcOpinwheel_c, Acceleration);
STATE_FUNC_DECLARE(dAcOpinwheel_c, RollMaxSpeed);
STATE_FUNC_DECLARE(dAcOpinwheel_c, Deceleration);
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcOpinwheel_c);
bool isBeingBlown();
static s16 decrement(s16 *value);
/* 0x330 */ nw4r::g3d::ResFile mResFile;
/* 0x334 */ m3d::smdl_c mMdl;
/* 0x350 */ dBgW mBgW;
/* 0x560 */ dCcD_Sph mSph;
/* 0x6B0 */ STATE_MGR_DECLARE(dAcOpinwheel_c);
/* 0x6EC */ s16 mStateTimer;
/* 0x6EE */ s16 mRotationSpeed;
/* 0x6F0 */ bool mBeingBlown;
static dCcD_SrcSph sSphSrc;
static const u32 unused;
};
#endif
+145 -9
View File
@@ -1,5 +1,16 @@
#include "d/a/obj/d_a_obj_pinwheel.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_s.h"
#include "d/col/cc/d_cc_d.h"
#include "d/col/cc/d_cc_s.h"
#include "d/d_stage.h"
#include "d/snd/d_snd_wzsound.h"
#include "f/f_base.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
SPECIAL_ACTOR_PROFILE(OBJ_PINWHEEL, dAcOpinwheel_c, fProfile::OBJ_PINWHEEL, 0x1DD, 0, 2);
STATE_DEFINE(dAcOpinwheel_c, Wait);
@@ -7,15 +18,140 @@ STATE_DEFINE(dAcOpinwheel_c, Acceleration);
STATE_DEFINE(dAcOpinwheel_c, RollMaxSpeed);
STATE_DEFINE(dAcOpinwheel_c, Deceleration);
void dAcOpinwheel_c::initializeState_Wait() {}
void dAcOpinwheel_c::executeState_Wait() {}
dCcD_SrcSph dAcOpinwheel_c::sSphSrc = {
/* mObjInf */
{/* mObjAt */ {0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0},
/* mObjTg */
{~(AT_TYPE_BUGNET | AT_TYPE_BEETLE | AT_TYPE_0x80000 | AT_TYPE_0x8000 | AT_TYPE_WIND), 0x111, {0, 6, 0x8}, 8, 0},
/* mObjCo */ {0xE9}},
/* mSphInf */
{50.f},
};
const u32 dAcOpinwheel_c::unused = 0x1E1388;
bool dAcOpinwheel_c::createHeap() {
void *data = getOarcResFile("Pinwheel");
mResFile = nw4r::g3d::ResFile(data);
dStage_c::bindStageResToFile(&mResFile);
dStage_c::bindSkyCmnToResFile(&mResFile);
nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("Pinwheel");
TRY_CREATE(mMdl.create(mdl, &mAllocator, 0x120, 1, nullptr));
void *dzb = getOarcFile("Pinwheel", "dzb/Pinwheel.dzb");
void *plc = getOarcFile("Pinwheel", "dat/Pinwheel.plc");
updateMatrix();
return !mBgW.Set((cBgD_t *)dzb, (PLC *)plc, cBgW::MOVE_BG_e, &mWorldMtx, &mScale);
}
int dAcOpinwheel_c::create() {
CREATE_ALLOCATOR(dAcOpinwheel_c);
dBgS::GetInstance()->Regist(&mBgW, this);
mStts.SetRank(0xD);
mSph.Set(sSphSrc);
mSph.SetStts(mStts);
mStateMgr.changeState(StateID_Wait);
mMdl.setPriorityDraw(0x1C, 9);
mBoundingBox.Set(mVec3_c(-75.f, -75.f, -10.f), mVec3_c(75.f, 75.f, 50.f));
return SUCCEEDED;
}
int dAcOpinwheel_c::doDelete() {
return SUCCEEDED;
}
int dAcOpinwheel_c::actorExecute() {
mStateMgr.executeState();
mSph.SetC(mPosition);
dCcS::GetInstance()->Set(&mSph);
updateMatrix();
mMdl.setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
int dAcOpinwheel_c::draw() {
drawModelType1(&mMdl);
return SUCCEEDED;
}
void dAcOpinwheel_c::initializeState_Wait() {
mRotationSpeed = 0;
}
void dAcOpinwheel_c::executeState_Wait() {
if (isBeingBlown()) {
mStateMgr.changeState(StateID_Acceleration);
}
}
void dAcOpinwheel_c::finalizeState_Wait() {}
void dAcOpinwheel_c::initializeState_Acceleration() {}
void dAcOpinwheel_c::executeState_Acceleration() {}
void dAcOpinwheel_c::initializeState_Acceleration() {
mStateTimer = 0x1E;
}
void dAcOpinwheel_c::executeState_Acceleration() {
holdSound(SE_Pinwhel_ROLL_LV);
mRotationSpeed += 0xA6;
mRotation.z += mRotationSpeed;
if (decrement(&mStateTimer) == 0) {
mStateMgr.changeState(StateID_RollMaxSpeed);
} else if (!isBeingBlown()) {
u16 stateTimer = 0x1E - mStateTimer;
mStateMgr.changeState(StateID_Deceleration);
mStateTimer = stateTimer;
}
}
s16 dAcOpinwheel_c::decrement(s16 *value) {
if (*value != 0) {
(*value)--;
}
return *value;
}
void dAcOpinwheel_c::finalizeState_Acceleration() {}
void dAcOpinwheel_c::initializeState_RollMaxSpeed() {}
void dAcOpinwheel_c::executeState_RollMaxSpeed() {}
void dAcOpinwheel_c::finalizeState_RollMaxSpeed() {}
void dAcOpinwheel_c::initializeState_Deceleration() {}
void dAcOpinwheel_c::executeState_Deceleration() {}
void dAcOpinwheel_c::initializeState_RollMaxSpeed() {
mBeingBlown = true;
}
void dAcOpinwheel_c::executeState_RollMaxSpeed() {
holdSound(SE_Pinwhel_ROLL_LV);
mRotation.z += mRotationSpeed;
if (!isBeingBlown()) {
if (decrement(&mStateTimer) == 0) {
mStateMgr.changeState(StateID_Deceleration);
}
} else {
mStateTimer = 2;
}
}
void dAcOpinwheel_c::finalizeState_RollMaxSpeed() {
mBeingBlown = false;
}
void dAcOpinwheel_c::initializeState_Deceleration() {
mStateTimer = 0x1E;
}
void dAcOpinwheel_c::executeState_Deceleration() {
holdSound(SE_Pinwhel_ROLL_LV);
mRotationSpeed -= 0xA6;
mRotation.z += mRotationSpeed;
if (decrement(&mStateTimer) == 0) {
mStateMgr.changeState(StateID_Wait);
} else if (isBeingBlown()) {
u16 stateTimer = 0x1E - mStateTimer;
mStateMgr.changeState(StateID_Acceleration);
mStateTimer = stateTimer;
}
}
void dAcOpinwheel_c::finalizeState_Deceleration() {}
bool dAcOpinwheel_c::isBeingBlown() {
return mSph.ChkTgHit() && mSph.ChkTgAtHitType(AT_TYPE_BELLOWS);
}