d_a_obj_appear_bridge mostly matching (#36)

* d_a_obj_appear_bridge - weak function order issue

* Mark as nonmatching for now

* Name unk IScnObjCallback funcs

---------

Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com>
This commit is contained in:
robojumper 2024-09-28 02:32:48 +02:00 committed by GitHub
parent 1039b3b239
commit 392145bf3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 286 additions and 72 deletions

View File

@ -17,3 +17,6 @@ REL/global_destructor_chain.c:
REL/d/a/obj/d_a_obj_appear_bridge.cpp:
.text start:0x000000F0 end:0x000012D8
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x00000034
.data start:0x00000000 end:0x000002B0
.bss start:0x00000008 end:0x000000D0

View File

@ -3,71 +3,72 @@ _epilog = .text:0x00000030; // type:function size:0x2C scope:global
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
__register_global_object = .text:0x00000070; // type:function size:0x1C scope:global
__destroy_global_chain = .text:0x00000090; // type:function size:0x54 scope:global
fn_407_F0 = .text:0x000000F0; // type:function size:0x140
fn_407_230 = .text:0x00000230; // type:function size:0x58
fn_407_290 = .text:0x00000290; // type:function size:0x6C
fn_407_300 = .text:0x00000300; // type:function size:0xA0
fn_407_3A0 = .text:0x000003A0; // type:function size:0xA4
fn_407_450 = .text:0x00000450; // type:function size:0x40
fn_407_490 = .text:0x00000490; // type:function size:0x174
fn_407_610 = .text:0x00000610; // type:function size:0x194
fn_407_7B0 = .text:0x000007B0; // type:function size:0x10
fn_407_7C0 = .text:0x000007C0; // type:function size:0x8
fn_407_7D0 = .text:0x000007D0; // type:function size:0x30
fn_407_800 = .text:0x00000800; // type:function size:0x10
fn_407_810 = .text:0x00000810; // type:function size:0x28
fn_407_840 = .text:0x00000840; // type:function size:0x34
fn_407_880 = .text:0x00000880; // type:function size:0x6C
fn_407_8F0 = .text:0x000008F0; // type:function size:0x7C
fn_407_970 = .text:0x00000970; // type:function size:0x70
fn_407_9E0 = .text:0x000009E0; // type:function size:0xCC
fn_407_AB0 = .text:0x00000AB0; // type:function size:0x4
fn_407_AC0 = .text:0x00000AC0; // type:function size:0x54
fn_407_B20 = .text:0x00000B20; // type:function size:0xF4
fn_407_C20 = .text:0x00000C20; // type:function size:0x4
fn_407_C30 = .text:0x00000C30; // type:function size:0xFC
fn_407_D30 = .text:0x00000D30; // type:function size:0x10
fn_407_D40 = .text:0x00000D40; // type:function size:0x4
fn_407_D50 = .text:0x00000D50; // type:function size:0x4
fn_407_D60 = .text:0x00000D60; // type:function size:0x4
fn_407_D70 = .text:0x00000D70; // type:function size:0x4
fn_407_D80 = .text:0x00000D80; // type:function size:0x4
fn_407_D90 = .text:0x00000D90; // type:function size:0x60
fn_407_DF0 = .text:0x00000DF0; // type:function size:0xC
fn_407_E00 = .text:0x00000E00; // type:function size:0x1C
fn_407_E20 = .text:0x00000E20; // type:function size:0x1C
fn_407_E40 = .text:0x00000E40; // type:function size:0x1C
fn_407_E60 = .text:0x00000E60; // type:function size:0x10
fn_407_E70 = .text:0x00000E70; // type:function size:0x10
fn_407_E80 = .text:0x00000E80; // type:function size:0x10
fn_407_E90 = .text:0x00000E90; // type:function size:0x10
fn_407_EA0 = .text:0x00000EA0; // type:function size:0x10
fn_407_EB0 = .text:0x00000EB0; // type:function size:0x10
fn_407_EC0 = .text:0x00000EC0; // type:function size:0x30
fn_407_EF0 = .text:0x00000EF0; // type:function size:0x30
fn_407_F20 = .text:0x00000F20; // type:function size:0x30
fn_407_F50 = .text:0x00000F50; // type:function size:0x2A0
fn_407_11F0 = .text:0x000011F0; // type:function size:0x58
fn_407_1250 = .text:0x00001250; // type:function size:0x88
dAcOappearBridge_c_classInit__Fv = .text:0x000000F0; // type:function size:0x140
__dt__31sFState_c<18dAcOappearBridge_c>Fv = .text:0x00000230; // type:function size:0x58
__dt__34sFStateFct_c<18dAcOappearBridge_c>Fv = .text:0x00000290; // type:function size:0x6C
__dt__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000300; // type:function size:0xA0
__dt__57sFStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c>Fv = .text:0x000003A0; // type:function size:0xA4
__dt__Q34nw4r3g3d15IScnObjCallbackFv = .text:0x00000450; // type:function size:0x40
createHeap__18dAcOappearBridge_cFv = .text:0x00000490; // type:function size:0x174
create__18dAcOappearBridge_cFv = .text:0x00000610; // type:function size:0x194
changeState__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000007B0; // type:function size:0x10
doDelete__18dAcOappearBridge_cFv = .text:0x000007C0; // type:function size:0x8
actorExecute__18dAcOappearBridge_cFv = .text:0x000007D0; // type:function size:0x30
executeState__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000800; // type:function size:0x10
draw__18dAcOappearBridge_cFv = .text:0x00000810; // type:function size:0x28
initializeState_Wait__18dAcOappearBridge_cFv = .text:0x00000840; // type:function size:0x34
executeState_Wait__18dAcOappearBridge_cFv = .text:0x00000880; // type:function size:0x6C
finalizeState_Wait__18dAcOappearBridge_cFv = .text:0x000008F0; // type:function size:0x7C
initializeState_Appear__18dAcOappearBridge_cFv = .text:0x00000970; // type:function size:0x70
executeState_Appear__18dAcOappearBridge_cFv = .text:0x000009E0; // type:function size:0xCC
finalizeState_Appear__18dAcOappearBridge_cFv = .text:0x00000AB0; // type:function size:0x4
initializeState_Disappear__18dAcOappearBridge_cFv = .text:0x00000AC0; // type:function size:0x54
executeState_Disappear__18dAcOappearBridge_cFv = .text:0x00000B20; // type:function size:0xF4
finalizeState_Disappear__18dAcOappearBridge_cFv = .text:0x00000C20; // type:function size:0x4
__dt__18dAcOappearBridge_cFv = .text:0x00000C30; // type:function size:0xFC
getStateID__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000D30; // type:function size:0x10
ExecCallback_DRAW_XLU__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x00000D40; // type:function size:0x4
ExecCallback_DRAW_OPA__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x00000D50; // type:function size:0x4
ExecCallback_CALC_MAT__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x00000D60; // type:function size:0x4
ExecCallback_CALC_WORLD__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x00000D70; // type:function size:0x4
ExecCallback_CALC_VIEW__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x00000D80; // type:function size:0x4
build__34sFStateFct_c<18dAcOappearBridge_c>FRC12sStateIDIf_c = .text:0x00000D90; // type:function size:0x60
dispose__34sFStateFct_c<18dAcOappearBridge_c>FRP10sStateIf_c = .text:0x00000DF0; // type:function size:0xC
initialize__31sFState_c<18dAcOappearBridge_c>Fv = .text:0x00000E00; // type:function size:0x1C
execute__31sFState_c<18dAcOappearBridge_c>Fv = .text:0x00000E20; // type:function size:0x1C
finalize__31sFState_c<18dAcOappearBridge_c>Fv = .text:0x00000E40; // type:function size:0x1C
initializeState__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000E60; // type:function size:0x10
finalizeState__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000E70; // type:function size:0x10
refreshState__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000E80; // type:function size:0x10
getState__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000E90; // type:function size:0x10
getNewStateID__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000EA0; // type:function size:0x10
getOldStateID__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000EB0; // type:function size:0x10
finalizeState__33sFStateID_c<18dAcOappearBridge_c>CFR18dAcOappearBridge_c = .text:0x00000EC0; // type:function size:0x30
executeState__33sFStateID_c<18dAcOappearBridge_c>CFR18dAcOappearBridge_c = .text:0x00000EF0; // type:function size:0x30
initializeState__33sFStateID_c<18dAcOappearBridge_c>CFR18dAcOappearBridge_c = .text:0x00000F20; // type:function size:0x30
__sinit_\d_a_obj_appear_bridge_cpp = .text:0x00000F50; // type:function size:0x2A0 scope:local
__dt__33sFStateID_c<18dAcOappearBridge_c>Fv = .text:0x000011F0; // type:function size:0x58
isSameName__33sFStateID_c<18dAcOappearBridge_c>CFPCc = .text:0x00001250; // type:function size:0x88
_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_407_rodata_0 = .rodata:0x00000000; // type:object size:0x20 data:float
lbl_407_rodata_20 = .rodata:0x00000020; // type:object size:0x4 data:float
lbl_407_rodata_24 = .rodata:0x00000024; // type:object size:0x4 data:float
lbl_407_rodata_28 = .rodata:0x00000028; // type:object size:0xC data:float
lbl_407_data_0 = .data:0x00000000; // type:object size:0x48 data:4byte
lbl_407_data_48 = .data:0x00000048; // type:object size:0x20 data:string
lbl_407_data_68 = .data:0x00000068; // type:object size:0x4 data:4byte
lbl_407_data_6C = .data:0x0000006C; // type:object size:0x4 data:4byte
lbl_407_data_70 = .data:0x00000070; // type:object size:0x80
lbl_407_data_F0 = .data:0x000000F0; // type:object size:0x30
lbl_407_data_120 = .data:0x00000120; // type:object size:0x30
lbl_407_data_150 = .data:0x00000150; // type:object size:0x18
lbl_407_data_168 = .data:0x00000168; // type:object size:0x114
lbl_407_data_27C = .data:0x0000027C; // type:object size:0x34
lbl_407_rodata_0 = .rodata:0x00000000; // type:object size:0x20 scope:local data:float
lbl_407_rodata_20 = .rodata:0x00000020; // type:object size:0x4 scope:local data:float
lbl_407_rodata_24 = .rodata:0x00000024; // type:object size:0x4 scope:local data:float
lbl_407_rodata_28 = .rodata:0x00000028; // type:object size:0xC scope:local data:float
g_profile_OBJ_APPEAR_BRIDGE = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_407_data_48 = .data:0x00000048; // type:object size:0x20 scope:local data:string
FLAGS_1 = .data:0x00000068; // type:object size:0x4 data:4byte
FLAGS_2 = .data:0x0000006C; // type:object size:0x4 data:4byte
__vt__18dAcOappearBridge_c = .data:0x00000070; // type:object size:0x80
__vt__57sFStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c> = .data:0x000000F0; // type:object size:0x30
__vt__87sStateMgr_c<18dAcOappearBridge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x00000120; // type:object size:0x30
__vt__34sFStateFct_c<18dAcOappearBridge_c> = .data:0x00000150; // type:object size:0x14
__vt__31sFState_c<18dAcOappearBridge_c> = .data:0x00000168; // type:object size:0x18
__vt__Q34nw4r3g3d15IScnObjCallback = .data:0x00000180; // type:object size:0x20
__vt__33sFStateID_c<18dAcOappearBridge_c> = .data:0x0000027C; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_407_bss_8 = .bss:0x00000008; // type:object size:0x18 data:4byte
lbl_407_bss_20 = .bss:0x00000020; // type:object size:0x40 data:4byte
lbl_407_bss_60 = .bss:0x00000060; // type:object size:0x40 data:4byte
lbl_407_bss_A0 = .bss:0x000000A0; // type:object size:0x30 data:4byte
lbl_407_bss_8 = .bss:0x00000008; // type:object size:0x18 scope:local data:4byte
StateID_Wait__18dAcOappearBridge_c = .bss:0x00000020; // type:object size:0x30 data:4byte
StateID_Appear__18dAcOappearBridge_c = .bss:0x00000060; // type:object size:0x30 data:4byte
StateID_Disappear__18dAcOappearBridge_c = .bss:0x000000A0; // type:object size:0x30 data:4byte

View File

@ -630,7 +630,7 @@ fn_80019D70 = .text:0x80019D70; // type:function size:0x58
fn_80019DD0 = .text:0x80019DD0; // type:function size:0x5C
fn_80019E30 = .text:0x80019E30; // type:function size:0x44
fn_80019E80 = .text:0x80019E80; // type:function size:0x3A8
fn_8001A230 = .text:0x8001A230; // type:function size:0x50
attach__14dScnCallback_cFRQ23m3d9scnLeaf_c = .text:0x8001A230; // type:function size:0x50
fn_8001A280 = .text:0x8001A280; // type:function size:0x144
fn_8001A3D0 = .text:0x8001A3D0; // type:function size:0x140
fn_8001A510 = .text:0x8001A510; // type:function size:0x4
@ -3599,7 +3599,7 @@ fn_800A0B90 = .text:0x800A0B90; // type:function size:0x10
fn_800A0BA0 = .text:0x800A0BA0; // type:function size:0x94
__ct__5EventFPcUlUlPvPv = .text:0x800A0C40; // type:function size:0xEC
fn_800A0D30 = .text:0x800A0D30; // type:function size:0xEC
fn_800A0E20 = .text:0x800A0E20; // type:function size:0x208
__ct__5EventFUllUlPvPv = .text:0x800A0E20; // type:function size:0x208
fn_800A1030 = .text:0x800A1030; // type:function size:0x208
__dt__5EventFv = .text:0x800A1240; // type:function size:0x40
fn_800A1280 = .text:0x800A1280; // type:function size:0x2E4
@ -3723,7 +3723,7 @@ fn_800A99D0 = .text:0x800A99D0; // type:function size:0xE0
fn_800A9AB0 = .text:0x800A9AB0; // type:function size:0x50
fn_800A9B00 = .text:0x800A9B00; // type:function size:0xC4
fn_800A9BD0 = .text:0x800A9BD0; // type:function size:0x78
fn_800A9C50 = .text:0x800A9C50; // type:function size:0xD4
checkPosInArea__FllRC7mVec3_cPPv = .text:0x800A9C50; // type:function size:0xD4
fn_800A9D30 = .text:0x800A9D30; // type:function size:0x60
fn_800A9D90 = .text:0x800A9D90; // type:function size:0x90
fn_800A9E20 = .text:0x800A9E20; // type:function size:0x12C
@ -19097,7 +19097,7 @@ fn_80339CF0 = .text:0x80339CF0; // type:function size:0x68
fn_80339D60 = .text:0x80339D60; // type:function size:0x78
fn_80339DE0 = .text:0x80339DE0; // type:function size:0x58
fn_80339E40 = .text:0x80339E40; // type:function size:0x100
fn_80339F40 = .text:0x80339F40; // type:function size:0xEC
destroyActorBgCollision__21CollisionCheckContextFR14ActorCollision = .text:0x80339F40; // type:function size:0xEC
fn_8033A030 = .text:0x8033A030; // type:function size:0x88
fn_8033A0C0 = .text:0x8033A0C0; // type:function size:0x74
fn_8033A140 = .text:0x8033A140; // type:function size:0xA0
@ -29880,7 +29880,7 @@ lbl_80500A20 = .data:0x80500A20; // type:object size:0x50
lbl_80500A70 = .data:0x80500A70; // type:object size:0x2C
lbl_80500A9C = .data:0x80500A9C; // type:object size:0xC
lbl_80500AA8 = .data:0x80500AA8; // type:object size:0x10 data:string
lbl_80500AB8 = .data:0x80500AB8; // type:object size:0x20
__vt__14dScnCallback_c = .data:0x80500AB8; // type:object size:0x20
lbl_80500AD8 = .data:0x80500AD8; // type:object size:0x44
lbl_80500B1C = .data:0x80500B1C; // type:object size:0x2C
lbl_80500B48 = .data:0x80500B48; // type:object size:0xC

View File

@ -954,6 +954,7 @@ config.libs = [
Rel(NonMatching, "d_a_nusi_npc", "REL/d/a/d_a_nusi_npc.cpp"),
Rel(NonMatching, "d_a_obj_amber", "REL/d/a/obj/d_a_obj_amber.cpp"),
Rel(NonMatching, "d_a_obj_ancient_jewels", "REL/d/a/obj/d_a_obj_ancient_jewels.cpp"),
# matching except for IScnObjCallback weak function order issue
Rel(NonMatching, "d_a_obj_appear_bridge", "REL/d/a/obj/d_a_obj_appear_bridge.cpp"),
Rel(NonMatching, "d_a_obj_arrow_switch", "REL/d/a/obj/d_a_obj_arrow_switch.cpp"),
Rel(NonMatching, "d_a_obj_asura_pillar", "REL/d/a/obj/d_a_obj_asura_pillar.cpp"),

View File

@ -70,9 +70,9 @@ public:
/* 0x84 */ ObjInfo *obj_info;
/* 0x88 */ TList<SoundInfo, 0xC> sound_list;
/* 0x94 */ SoundSource *sound_source;
/* 0x9C */ mVec3_c *obj_pos;
/* 0x9c */ mVec3_c pos_copy;
/* 0xa8 */ u32 params2;
/* 0x98 */ mVec3_c *obj_pos;
/* 0x9C */ mVec3_c pos_copy;
/* 0xA8 */ u32 params2;
/* 0xAC */ mAng3_c rot_copy;
/* 0xB2 */ u16 obj_id; // enemydefeat flag / id on obj-map
/* 0xB4 */ s8 room_id_copy;

View File

@ -0,0 +1,50 @@
#ifndef D_A_OBJ_APPEAR_BRIDGE_H
#define D_A_OBJ_APPEAR_BRIDGE_H
#include <d/a/obj/d_a_obj_base.h>
#include <m/m3d/m_anmmatclr.h>
#include <m/m3d/m_anmtexsrt.h>
#include <m/m3d/m_smdl.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
#include <toBeSorted/actor_collision.h>
#include <toBeSorted/actor_event.h>
#include <toBeSorted/stage_render_stuff.h>
class dAcOappearBridge_c : public dAcObjBase_c {
public:
dAcOappearBridge_c() : mStateMgr(*this, sStateID::null), mActorEvent(*this, nullptr), mSceneCallback(this) {}
virtual ~dAcOappearBridge_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
STATE_FUNC_DECLARE(dAcOappearBridge_c, Wait);
STATE_FUNC_DECLARE(dAcOappearBridge_c, Appear);
STATE_FUNC_DECLARE(dAcOappearBridge_c, Disappear);
private:
static const f32 sMovementRate;
nw4r::g3d::ResFile mResFile;
m3d::smdl_c mModel;
m3d::anmTexSrt_c mSrtAnm;
m3d::anmMatClr_c mClrAnm;
ActorCollision mCollision;
STATE_MGR_DECLARE(dAcOappearBridge_c);
ActorEventRelated mActorEvent;
// TODO the weak IScnObjCallback functions are in the wrong order.
// The vtable order is dtor, World, Mat, View, Opa, Xlu
// and the emitted order is dtor, Xlu, Opa, View, Mat, World
// but the order in the binary is dtor, Xlu, Opa, Mat, World, View
dScnCallback_c mSceneCallback;
/* 0x650 */ mVec3_c mSoundPosition;
/* 0x65C */ f32 field_0x65C;
/* 0x660 */ u8 mAreaIdx;
/* 0x661 */ u8 mEventId;
};
#endif

View File

@ -144,6 +144,8 @@ struct IScnObjCallback {
virtual void ExecCallback_CALC_WORLD(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0xC
virtual void ExecCallback_CALC_MAT(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x10
virtual void ExecCallback_CALC_VIEW(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x14
virtual void ExecCallback_DRAW_OPA(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x18
virtual void ExecCallback_DRAW_XLU(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x1C
};
// Is there a better way of resolving this dependency?

View File

@ -32,6 +32,7 @@ public:
static CollisionCheckContext* get();
void registerActorBgCollision(ActorCollision&, dAcObjBase_c*);
void destroyActorBgCollision(ActorCollision&);
};
#endif

View File

@ -0,0 +1,10 @@
#ifndef AREA_UTILS_H
#define AREA_UTILS_H
#include <m/m_vec.h>
/* 800a9b00 */ bool checkPosInArea(void **AREA, const mVec3_c& pos);
/* 800a9bd0 */ void *getAreaForIndexInRoom(s32 areaIndex, s32 roomId);
/* 800a9c50 */ bool *checkPosInArea(s32 areaIndex, s32 roomId, const mVec3_c& pos, void **AREA);
#endif

View File

@ -17,6 +17,7 @@ public:
public:
/** 0x800A0C40 */
Event(char *eventName, u32 unk, u32 eventFlags, void *callback1, void *callback2);
Event(u32 eventId, s32 roomId, u32 eventFlags, void *callback1, void *callback2);
/** 0x800A1240 */
virtual ~Event();
};

View File

@ -0,0 +1,19 @@
#ifndef D_STAGE_RENDER_STUFF_H
#define D_STAGE_RENDER_STUFF_H
#include <d/a/obj/d_a_obj_base.h>
#include <nw4r/g3d/g3d_scnobj.h>
#include <m/m3d/m_scnleaf.h>
class dScnCallback_c : public nw4r::g3d::IScnObjCallback {
public:
dScnCallback_c(dAcObjBase_c *arg): mpActor(arg) {}
/* vt 0x10 */ virtual void ExecCallback_CALC_MAT(nw4r::g3d::ScnObj::Timing, nw4r::g3d::ScnObj *, u32, void *) override;
/* 0x04 */ dAcObjBase_c *mpActor;
/* 0x08 */ UNKWORD field_0x08;
/* 8001a230 */ void attach(m3d::scnLeaf_c&);
};
#endif

View File

@ -0,0 +1,126 @@
#include <d/a/d_a_player.h>
#include <d/a/obj/d_a_obj_appear_bridge.h>
#include <toBeSorted/area_utils.h>
SPECIAL_ACTOR_PROFILE(OBJ_APPEAR_BRIDGE, dAcOappearBridge_c, fProfile::OBJ_APPEAR_BRIDGE, 0x01FC, 0, 6);
static mVec3_c positionOffset(-1600.0f, 550.0f, 0.0f);
const f32 dAcOappearBridge_c::sMovementRate = 4.0f;
STATE_DEFINE(dAcOappearBridge_c, Wait);
STATE_DEFINE(dAcOappearBridge_c, Appear);
STATE_DEFINE(dAcOappearBridge_c, Disappear);
bool dAcOappearBridge_c::createHeap() {
mResFile = getOarcResFile("TongueStage");
RoomManager::bindStageResToFile(&mResFile);
nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("TongueStage");
TRY_CREATE(mModel.create(mdl, &heap_allocator, 0x128));
nw4r::g3d::ResAnmTexSrt srt = mResFile.GetResAnmTexSrt("TongueStage");
TRY_CREATE(mSrtAnm.create(mdl, srt, &heap_allocator, nullptr, 1));
nw4r::g3d::ResAnmClr clr = mResFile.GetResAnmClr("TongueStage");
TRY_CREATE(mClrAnm.create(mdl, clr, &heap_allocator, nullptr, 1));
void *dzb = getOarcFile("TongueStage", "dzb/TongueStage.dzb");
void *plc = getOarcFile("TongueStage", "dat/TongueStage.plc");
updateMatrix();
mModel.setLocalMtx(worldMatrix);
TRY_CREATE(mCollision.create(dzb, plc, true, worldMatrix, scale) == nullptr);
mCollision.init();
return true;
}
int dAcOappearBridge_c::create() {
CREATE_ALLOCATOR(dAcOappearBridge_c);
CollisionCheckContext::get()->registerActorBgCollision(mCollision, this);
mAreaIdx = params & 0xFF;
mEventId = (params >> 8) & 0xFF;
mSoundPosition = position + positionOffset;
obj_pos = &mSoundPosition;
mSceneCallback.attach(mModel);
mModel.setAnm(mSrtAnm);
mModel.setAnm(mClrAnm);
field_0x65C = mSrtAnm.getFrameMax(0) - 1.0f;
mStateMgr.changeState(StateID_Wait);
mModel.setPriorityDraw(0x1C, 0x9);
setBoundingBox(mVec3_c(-3000.0f, -200.0f, -600.0f), mVec3_c(50.0f, 800.0f, 600.0f));
return SUCCEEDED;
}
int dAcOappearBridge_c::doDelete() {
return SUCCEEDED;
}
int dAcOappearBridge_c::actorExecute() {
mStateMgr.executeState();
return SUCCEEDED;
}
int dAcOappearBridge_c::draw() {
drawModelType1(&mModel);
return SUCCEEDED;
}
void dAcOappearBridge_c::initializeState_Wait() {
CollisionCheckContext::get()->destroyActorBgCollision(mCollision);
}
void dAcOappearBridge_c::executeState_Wait() {
if (checkPosInArea(mAreaIdx, roomid, dAcPy_c::LINK->position, nullptr)) {
mStateMgr.changeState(StateID_Appear);
}
}
// this works but I don't like it
volatile u32 FLAGS_1 = 0x00000001;
u32 FLAGS_2 = 0x00100001;
void dAcOappearBridge_c::finalizeState_Wait() {
if (mEventId != 0xFF) {
u32 f1 = FLAGS_1;
u32 f2 = FLAGS_2;
Event ev = Event(mEventId, roomid, f2 & ~f1, nullptr, nullptr);
mActorEvent.scheduleEvent(ev, 0);
}
}
void dAcOappearBridge_c::initializeState_Appear() {
mSrtAnm.setRate(sMovementRate, 0);
mClrAnm.setRate(sMovementRate, 0);
CollisionCheckContext::get()->registerActorBgCollision(mCollision, this);
playSound(0xAA4);
}
void dAcOappearBridge_c::executeState_Appear() {
mClrAnm.isStop(0); // ?
if (field_0x65C == mSrtAnm.getFrame(0)) {
mSrtAnm.setRate(0.0f, 0);
}
mSrtAnm.play();
mClrAnm.play();
if (!checkPosInArea(mAreaIdx, roomid, dAcPy_c::LINK->position, nullptr)) {
mStateMgr.changeState(StateID_Disappear);
}
}
void dAcOappearBridge_c::finalizeState_Appear() {}
void dAcOappearBridge_c::initializeState_Disappear() {
mSrtAnm.setRate(-sMovementRate, 0);
mClrAnm.setRate(-sMovementRate, 0);
}
void dAcOappearBridge_c::executeState_Disappear() {
if (mSrtAnm.getFrame(0) == 0.0f) {
mSrtAnm.setRate(0.0f, 0);
}
mSrtAnm.play();
mClrAnm.play();
if (checkPosInArea(mAreaIdx, roomid, dAcPy_c::LINK->position, nullptr)) {
mStateMgr.changeState(StateID_Appear);
} else {
if (mClrAnm.isStop(0)) {
mStateMgr.changeState(StateID_Wait);
}
}
}
void dAcOappearBridge_c::finalizeState_Disappear() {}