Merge pull request #248 from swekka/d_a_obj_F302_light

d_a_obj_F302_light OK
This commit is contained in:
robojumper
2025-09-16 21:45:42 +02:00
committed by GitHub
5 changed files with 167 additions and 29 deletions
@@ -8,17 +8,17 @@ __dt__28sFState_c<15dAcOF302Light_c>Fv = .text:0x000001F0; // type:function size
__dt__31sFStateFct_c<15dAcOF302Light_c>Fv = .text:0x00000250; // type:function size:0x6C
__dt__84sStateMgr_c<15dAcOF302Light_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000002C0; // type:function size:0xA0
__dt__54sFStateMgr_c<15dAcOF302Light_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000360; // type:function size:0xA4
fn_620_410 = .text:0x00000410; // type:function size:0x64
fn_620_480 = .text:0x00000480; // type:function size:0xFC
fn_620_580 = .text:0x00000580; // type:function size:0x140
__ct__Q23m3d11anmMatClr_cFv = .text:0x00000410; // type:function size:0x64
createHeap__15dAcOF302Light_cFv = .text:0x00000480; // type:function size:0xFC
actorCreate__15dAcOF302Light_cFv = .text:0x00000580; // type:function size:0x140
changeState__84sStateMgr_c<15dAcOF302Light_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000006C0; // type:function size:0x10
fn_620_6D0 = .text:0x000006D0; // type:function size:0x8
fn_620_6E0 = .text:0x000006E0; // type:function size:0x8
fn_620_6F0 = .text:0x000006F0; // type:function size:0x74
actorPostCreate__15dAcOF302Light_cFv = .text:0x000006D0; // type:function size:0x8
doDelete__15dAcOF302Light_cFv = .text:0x000006E0; // type:function size:0x8
actorExecute__15dAcOF302Light_cFv = .text:0x000006F0; // type:function size:0x74
executeState__84sStateMgr_c<15dAcOF302Light_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000770; // type:function size:0x10
fn_620_780 = .text:0x00000780; // type:function size:0x128
actorExecuteInEvent__15dAcOF302Light_cFv = .text:0x00000780; // type:function size:0x128
getStateID__84sStateMgr_c<15dAcOF302Light_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x000008B0; // type:function size:0x10
fn_620_8C0 = .text:0x000008C0; // type:function size:0x28
draw__15dAcOF302Light_cFv = .text:0x000008C0; // type:function size:0x28
initializeState_Wait__15dAcOF302Light_cFv = .text:0x000008F0; // type:function size:0x54
executeState_Wait__15dAcOF302Light_cFv = .text:0x00000950; // type:function size:0x4
finalizeState_Wait__15dAcOF302Light_cFv = .text:0x00000960; // type:function size:0x4
@@ -46,19 +46,19 @@ isSameName__30sFStateID_c<15dAcOF302Light_c>CFPCc = .text:0x00000FE0; // type:fu
_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_620_rodata_0 = .rodata:0x00000000; // type:object size:0x10 data:float
lbl_620_rodata_10 = .rodata:0x00000010; // type:object size:0x10 align:4 data:float
lbl_620_rodata_0 = .rodata:0x00000000; // type:object size:0x10 scope:local data:float
lbl_620_rodata_10 = .rodata:0x00000010; // type:object size:0x10 scope:local align:4 data:float
g_profile_OBJ_F302_LIGHT = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_620_data_10 = .data:0x00000010; // type:object size:0x10
lbl_620_data_20 = .data:0x00000020; // type:object size:0x34
lbl_620_data_54 = .data:0x00000054; // type:object size:0x24
lbl_620_data_78 = .data:0x00000078; // type:object size:0x80
lbl_620_data_F8 = .data:0x000000F8; // type:object size:0x30
lbl_620_data_128 = .data:0x00000128; // type:object size:0x30
lbl_620_data_158 = .data:0x00000158; // type:object size:0x18
lbl_620_data_170 = .data:0x00000170; // type:object size:0xA4
lbl_620_data_214 = .data:0x00000214; // type:object size:0x34
lbl_620_data_10 = .data:0x00000010; // type:object size:0x10 scope:local
lbl_620_data_20 = .data:0x00000020; // type:object size:0x34 scope:local
lbl_620_data_54 = .data:0x00000054; // type:object size:0x24 scope:local
__vt__15dAcOF302Light_c = .data:0x00000078; // type:object size:0x80
__vt__54sFStateMgr_c<15dAcOF302Light_c,20sStateMethodUsr_FI_c> = .data:0x000000F8; // type:object size:0x30
__vt__84sStateMgr_c<15dAcOF302Light_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x00000128; // type:object size:0x30
lbl_620_data_158 = .data:0x00000158; // type:object size:0x18 scope:local
lbl_620_data_170 = .data:0x00000170; // type:object size:0xA4 scope:local
__vt__30sFStateID_c<15dAcOF302Light_c> = .data:0x00000214; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_620_bss_8 = .bss:0x00000008; // type:object size:0x10 data:4byte
lbl_620_bss_18 = .bss:0x00000018; // type:object size:0x40 data:4byte
lbl_620_bss_58 = .bss:0x00000058; // type:object size:0x30 data:4byte
lbl_620_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local data:4byte
lbl_620_bss_18 = .bss:0x00000018; // type:object size:0x40 scope:local data:4byte
lbl_620_bss_58 = .bss:0x00000058; // type:object size:0x30 scope:local data:4byte
+1 -1
View File
@@ -2463,7 +2463,7 @@ config.libs = [
NonMatching, "d_a_obj_electric_light", "REL/d/a/obj/d_a_obj_electric_light.cpp"
),
Rel(NonMatching, "d_a_obj_evil_field", "REL/d/a/obj/d_a_obj_evil_field.cpp"),
Rel(NonMatching, "d_a_obj_F302_light", "REL/d/a/obj/d_a_obj_F302_light.cpp"),
Rel(Matching, "d_a_obj_F302_light", "REL/d/a/obj/d_a_obj_F302_light.cpp"),
Rel(Matching, "d_a_obj_F400_gate_leaf", "REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp"),
Rel(Matching, "d_a_obj_F400_gate_seal", "REL/d/a/obj/d_a_obj_F400_gate_seal.cpp"),
Rel(NonMatching, "d_a_obj_farmland", "REL/d/a/obj/d_a_obj_farmland.cpp"),
+24 -2
View File
@@ -1,20 +1,42 @@
#ifndef D_A_OBJ_F302_LIGHT_H
#define D_A_OBJ_F302_LIGHT_H
#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "m/m3d/m_anmmatclr.h"
#include "m/m3d/m_smdl.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
#include "toBeSorted/actor_event.h"
#include "toBeSorted/time_area_mgr.h"
class dAcOF302Light_c : public dAcObjBase_c {
public:
dAcOF302Light_c() : mStateMgr(*this, sStateID::null) {}
dAcOF302Light_c() : mEvent(*this, nullptr), mStateMgr(*this, sStateID::null) {}
virtual ~dAcOF302Light_c() {}
virtual bool createHeap() override;
virtual int actorCreate() override;
virtual int actorPostCreate() override;
virtual int doDelete() override;
virtual int actorExecute() override;
virtual int actorExecuteInEvent() override;
virtual int draw() override;
STATE_FUNC_DECLARE(dAcOF302Light_c, Wait);
STATE_FUNC_DECLARE(dAcOF302Light_c, SwitchOn);
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcOF302Light_c);
/* 0x330 */ ActorEventRelated mEvent;
/* 0x380 */ nw4r::g3d::ResFile mResFile;
/* 0x384 */ m3d::smdl_c mMdl;
/* 0x3A0 */ STATE_MGR_DECLARE(dAcOF302Light_c);
/* 0x3DC */ m3d::anmMatClr_c mAnmMatClr[2];
/* 0x434 */ TimeAreaStruct mTimeArea;
/* 0x440 */ u8 field_0x440;
static const char *sResAnmClrNames[2];
};
#endif
+1 -1
View File
@@ -56,7 +56,7 @@ struct TimeAreaStruct {
// -1 SE_TIMESLIP_TIMESLIP_REV
// 0 No change ?
// 1 SE_TIMESLIP_TIMESLIP
int check(int, const mVec3_c &, u32, f32, f32);
int check(int roomId, const mVec3_c &position, u32, f32, f32);
};
class dTimeAreaMgr_c {
+119 -3
View File
@@ -1,13 +1,129 @@
#include "d/a/obj/d_a_obj_F302_light.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/flag/sceneflag_manager.h"
#include "f/f_base.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resanmclr.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
#include "toBeSorted/arc_managers/current_stage_arc_manager.h"
#include "toBeSorted/time_area_mgr.h"
SPECIAL_ACTOR_PROFILE(OBJ_F302_LIGHT, dAcOF302Light_c, fProfile::OBJ_F302_LIGHT, 0x1B2, 0, 3);
STATE_DEFINE(dAcOF302Light_c, Wait);
STATE_DEFINE(dAcOF302Light_c, SwitchOn);
void dAcOF302Light_c::initializeState_Wait() {}
const char *dAcOF302Light_c::sResAnmClrNames[2] = {
"Teniobj_0_APR",
"Teniobj_0_LP",
};
bool dAcOF302Light_c::createHeap() {
void *data = CurrentStageArcManager::GetInstance()->getData("g3d/stage.brres");
mResFile = nw4r::g3d::ResFile(data);
nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("Teniobj_0");
TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120));
for (s32 i = 0; i < 2; i++) {
nw4r::g3d::ResAnmClr resAnmClr = mResFile.GetResAnmClr(sResAnmClrNames[i]);
TRY_CREATE(mAnmMatClr[i].create(mdl, resAnmClr, &heap_allocator, nullptr, 1));
mAnmMatClr[i].setRate(0.f, 0);
}
return true;
}
int dAcOF302Light_c::actorCreate() {
field_0x440 = getFromParams(0, 0xFF);
CREATE_ALLOCATOR(dAcOF302Light_c);
forwardAccel = 0.f;
forwardMaxSpeed = -40.f;
updateMatrix();
mMdl.setLocalMtx(mWorldMtx);
if (field_0x440 < 0xFF && !SceneflagManager::sInstance->checkBoolFlag(roomid, field_0x440)) {
mStateMgr.changeState(StateID_Wait);
} else {
mStateMgr.changeState(StateID_SwitchOn);
}
boundingBox.Set(mVec3_c(-660.f, -40.f, -660.f), mVec3_c(660.f, 0.f, 660.f));
return SUCCEEDED;
}
int dAcOF302Light_c::actorPostCreate() {
return SUCCEEDED;
}
int dAcOF302Light_c::doDelete() {
return SUCCEEDED;
}
int dAcOF302Light_c::actorExecute() {
mStateMgr.executeState();
for (s32 i = 0; i < 2; i++) {
mAnmMatClr[i].play();
}
return SUCCEEDED;
}
int dAcOF302Light_c::actorExecuteInEvent() {
switch (mEvent.getCurrentEventCommand()) {
case 'act0': {
mEvent.advanceNext();
break;
}
case 'act1': {
mAnmMatClr[0].setRate(1.f, 0);
if (mAnmMatClr[0].isStop(0)) {
if (mStateMgr.isState(StateID_Wait)) {
mStateMgr.changeState(StateID_SwitchOn);
}
mEvent.advanceNext();
}
}
}
mStateMgr.executeState();
for (s32 i = 0; i < 2; i++) {
mAnmMatClr[i].play();
}
return SUCCEEDED;
}
int dAcOF302Light_c::draw() {
drawModelType1(&mMdl);
return SUCCEEDED;
}
void dAcOF302Light_c::initializeState_Wait() {
mMdl.setAnm(mAnmMatClr[0]);
mAnmMatClr[0].setRate(0.f, 0);
}
void dAcOF302Light_c::executeState_Wait() {}
void dAcOF302Light_c::finalizeState_Wait() {}
void dAcOF302Light_c::initializeState_SwitchOn() {}
void dAcOF302Light_c::executeState_SwitchOn() {}
void dAcOF302Light_c::initializeState_SwitchOn() {
mMdl.setAnm(mAnmMatClr[1]);
mTimeArea.check(roomid, position, 0, 30.f, 0.1f);
if (dTimeAreaMgr_c::GetInstance()->fn_800B9B60(roomid, position)) {
mAnmMatClr[1].setRate(1.f, 0);
mAnmMatClr[1].setFrame(40.f, 0);
} else {
mAnmMatClr[1].setRate(0.f, 0);
}
}
void dAcOF302Light_c::executeState_SwitchOn() {
mTimeArea.check(roomid, position, 0, 30.f, 0.1f);
if (dTimeAreaMgr_c::GetInstance()->fn_800B9B60(roomid, position)) {
mAnmMatClr[1].setRate(1.f, 0);
} else {
if (mAnmMatClr[1].getFrame(0) == 0.f) {
mAnmMatClr[1].setRate(0.f, 0);
}
}
}
void dAcOF302Light_c::finalizeState_SwitchOn() {}