Skip to content

Commit

Permalink
d_a_obj_smoke
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Jun 25, 2024
1 parent f2fe70b commit b6bd727
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 82 deletions.
3 changes: 3 additions & 0 deletions config/SOUE01/rels/d_a_obj_smokeNP/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ REL/global_destructor_chain.c:
REL/d/a/obj/d_a_obj_smoke.cpp:
.text start:0x000000F0 end:0x00000B88
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x00000018
.data start:0x00000000 end:0x000001CC
.bss start:0x00000008 end:0x00000048
100 changes: 50 additions & 50 deletions config/SOUE01/rels/d_a_obj_smokeNP/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,57 @@ _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_373_F0 = .text:0x000000F0; // type:function size:0xEC
fn_373_1E0 = .text:0x000001E0; // type:function size:0x58
fn_373_240 = .text:0x00000240; // type:function size:0x6C
fn_373_2B0 = .text:0x000002B0; // type:function size:0xA0
fn_373_350 = .text:0x00000350; // type:function size:0xA4
fn_373_400 = .text:0x00000400; // type:function size:0xF4
fn_373_500 = .text:0x00000500; // type:function size:0xE8
fn_373_5F0 = .text:0x000005F0; // type:function size:0x10
fn_373_600 = .text:0x00000600; // type:function size:0x8
fn_373_610 = .text:0x00000610; // type:function size:0x54
fn_373_670 = .text:0x00000670; // type:function size:0x10
fn_373_680 = .text:0x00000680; // type:function size:0x28
fn_373_6B0 = .text:0x000006B0; // type:function size:0x4
fn_373_6C0 = .text:0x000006C0; // type:function size:0x4
fn_373_6D0 = .text:0x000006D0; // type:function size:0x4
fn_373_6E0 = .text:0x000006E0; // type:function size:0xD8
fn_373_7C0 = .text:0x000007C0; // type:function size:0x10
fn_373_7D0 = .text:0x000007D0; // type:function size:0x60
fn_373_830 = .text:0x00000830; // type:function size:0xC
fn_373_840 = .text:0x00000840; // type:function size:0x1C
fn_373_860 = .text:0x00000860; // type:function size:0x1C
fn_373_880 = .text:0x00000880; // type:function size:0x1C
fn_373_8A0 = .text:0x000008A0; // type:function size:0x10
fn_373_8B0 = .text:0x000008B0; // type:function size:0x10
fn_373_8C0 = .text:0x000008C0; // type:function size:0x10
fn_373_8D0 = .text:0x000008D0; // type:function size:0x10
fn_373_8E0 = .text:0x000008E0; // type:function size:0x10
fn_373_8F0 = .text:0x000008F0; // type:function size:0x10
fn_373_900 = .text:0x00000900; // type:function size:0x30
fn_373_930 = .text:0x00000930; // type:function size:0x30
fn_373_960 = .text:0x00000960; // type:function size:0x30
fn_373_990 = .text:0x00000990; // type:function size:0x10C
fn_373_AA0 = .text:0x00000AA0; // type:function size:0x58
fn_373_B00 = .text:0x00000B00; // type:function size:0x88
dAcOsmoke_c_classInit__Fv = .text:0x000000F0; // type:function size:0xEC
__dt__24sFState_c<11dAcOsmoke_c>Fv = .text:0x000001E0; // type:function size:0x58
__dt__27sFStateFct_c<11dAcOsmoke_c>Fv = .text:0x00000240; // type:function size:0x6C
__dt__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000002B0; // type:function size:0xA0
__dt__50sFStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000350; // type:function size:0xA4
createHeap__11dAcOsmoke_cFv = .text:0x00000400; // type:function size:0xF4
create__11dAcOsmoke_cFv = .text:0x00000500; // type:function size:0xE8
changeState__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000005F0; // type:function size:0x10
doDelete__11dAcOsmoke_cFv = .text:0x00000600; // type:function size:0x8
actorExecute__11dAcOsmoke_cFv = .text:0x00000610; // type:function size:0x54
executeState__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000670; // type:function size:0x10
draw__11dAcOsmoke_cFv = .text:0x00000680; // type:function size:0x28
initializeState_Wait__11dAcOsmoke_cFv = .text:0x000006B0; // type:function size:0x4
executeState_Wait__11dAcOsmoke_cFv = .text:0x000006C0; // type:function size:0x4
finalizeState_Wait__11dAcOsmoke_cFv = .text:0x000006D0; // type:function size:0x4
__dt__11dAcOsmoke_cFv = .text:0x000006E0; // type:function size:0xD8
getStateID__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x000007C0; // type:function size:0x10
build__27sFStateFct_c<11dAcOsmoke_c>FRC12sStateIDIf_c = .text:0x000007D0; // type:function size:0x60
dispose__27sFStateFct_c<11dAcOsmoke_c>FRP10sStateIf_c = .text:0x00000830; // type:function size:0xC
initialize__24sFState_c<11dAcOsmoke_c>Fv = .text:0x00000840; // type:function size:0x1C
execute__24sFState_c<11dAcOsmoke_c>Fv = .text:0x00000860; // type:function size:0x1C
finalize__24sFState_c<11dAcOsmoke_c>Fv = .text:0x00000880; // type:function size:0x1C
initializeState__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000008A0; // type:function size:0x10
finalizeState__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000008B0; // type:function size:0x10
refreshState__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000008C0; // type:function size:0x10
getState__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x000008D0; // type:function size:0x10
getNewStateID__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x000008E0; // type:function size:0x10
getOldStateID__80sStateMgr_c<11dAcOsmoke_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x000008F0; // type:function size:0x10
finalizeState__26sFStateID_c<11dAcOsmoke_c>CFR11dAcOsmoke_c = .text:0x00000900; // type:function size:0x30
executeState__26sFStateID_c<11dAcOsmoke_c>CFR11dAcOsmoke_c = .text:0x00000930; // type:function size:0x30
initializeState__26sFStateID_c<11dAcOsmoke_c>CFR11dAcOsmoke_c = .text:0x00000960; // type:function size:0x30
__sinit_\d_a_obj_smoke_cpp = .text:0x00000990; // type:function size:0x10C scope:local
__dt__26sFStateID_c<11dAcOsmoke_c>Fv = .text:0x00000AA0; // type:function size:0x58
isSameName__26sFStateID_c<11dAcOsmoke_c>CFPCc = .text:0x00000B00; // 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_373_rodata_0 = .rodata:0x00000000; // type:object size:0x8
lbl_373_rodata_8 = .rodata:0x00000008; // type:object size:0x8
lbl_373_rodata_10 = .rodata:0x00000010; // type:object size:0x4 data:float
lbl_373_rodata_14 = .rodata:0x00000014; // type:object size:0x4 data:float
lbl_373_data_0 = .data:0x00000000; // type:object size:0xC data:4byte
lbl_373_data_C = .data:0x0000000C; // type:object size:0xC
lbl_373_data_18 = .data:0x00000018; // type:object size:0x10
lbl_373_data_28 = .data:0x00000028; // type:object size:0x20
lbl_373_data_48 = .data:0x00000048; // type:object size:0x80
lbl_373_data_C8 = .data:0x000000C8; // type:object size:0x30
lbl_373_data_F8 = .data:0x000000F8; // type:object size:0x30
lbl_373_data_128 = .data:0x00000128; // type:object size:0x18
lbl_373_data_140 = .data:0x00000140; // type:object size:0x58
lbl_373_data_198 = .data:0x00000198; // type:object size:0x34
lbl_373_rodata_0 = .rodata:0x00000000; // type:object size:0x8 scope:local
lbl_373_rodata_8 = .rodata:0x00000008; // type:object size:0x8 scope:local
lbl_373_rodata_10 = .rodata:0x00000010; // type:object size:0x4 scope:local data:float
lbl_373_rodata_14 = .rodata:0x00000014; // type:object size:0x4 scope:local data:float
lbl_373_data_0 = .data:0x00000000; // type:object size:0xC scope:local data:4byte
lbl_373_data_C = .data:0x0000000C; // type:object size:0xC scope:local
g_profile_OBJ_SMOKE = .data:0x00000018; // type:object size:0x10
lbl_373_data_28 = .data:0x00000028; // type:object size:0x20 scope:local
lbl_373_data_48 = .data:0x00000048; // type:object size:0x80 scope:local
lbl_373_data_C8 = .data:0x000000C8; // type:object size:0x30 scope:local
lbl_373_data_F8 = .data:0x000000F8; // type:object size:0x30 scope:local
lbl_373_data_128 = .data:0x00000128; // type:object size:0x18 scope:local
lbl_373_data_140 = .data:0x00000140; // type:object size:0x58 scope:local
lbl_373_data_198 = .data:0x00000198; // type:object size:0x34 scope:local
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_373_bss_8 = .bss:0x00000008; // type:object size:0x10
lbl_373_bss_18 = .bss:0x00000018; // type:object size:0x30 data:4byte
lbl_373_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local
StateID_Wait__11dAcOsmoke_c = .bss:0x00000018; // type:object size:0x30 data:4byte
6 changes: 3 additions & 3 deletions config/SOUE01/rels/d_t_sound_areaNP/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ checkAlg3__10dTgSndAr_cFRC7mVec3_c = .text:0x00000540; // type:function size:0x1
__dt__10dTgSndAr_cFv = .text:0x00000690; // type:function size:0x70
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
lbl_497_rodata_0 = .rodata:0x00000000; // type:object size:0x18 data:float
lbl_497_rodata_18 = .rodata:0x00000018; // type:object size:0x10 data:float
lbl_497_rodata_28 = .rodata:0x00000028; // type:object size:0x4 data:float
lbl_497_rodata_0 = .rodata:0x00000000; // type:object size:0x18 scope:local data:float
lbl_497_rodata_18 = .rodata:0x00000018; // type:object size:0x10 scope:local data:float
lbl_497_rodata_28 = .rodata:0x00000028; // type:object size:0x4 scope:local data:float
g_profile_TAG_SOUND_AREA = .data:0x00000000; // type:object size:0x10
__vt__10dTgSndAr_c = .data:0x00000010; // type:object size:0x74
2 changes: 1 addition & 1 deletion config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ FUN_8002ddd0__9dAcBase_cFv = .text:0x8002DDD0; // type:function size:0x54
FUN_8002de30__9dAcBase_cFv = .text:0x8002DE30; // type:function size:0x4
fn_8002DE40 = .text:0x8002DE40; // type:function size:0x14
fn_8002DE60 = .text:0x8002DE60; // type:function size:0x14
getOarcResFile__12dAcObjBase_cFPc = .text:0x8002DE80; // type:function size:0xC
getOarcResFile__12dAcObjBase_cFPCc = .text:0x8002DE80; // type:function size:0xC
fn_8002DE90 = .text:0x8002DE90; // type:function size:0xC
fn_8002DEA0 = .text:0x8002DEA0; // type:function size:0xC
fn_8002DEB0 = .text:0x8002DEB0; // type:function size:0x14
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Rel(NonMatching, "d_a_obj_skull", "REL/d/a/obj/d_a_obj_skull.cpp"),
Rel(NonMatching, "d_a_obj_slice_log", "REL/d/a/obj/d_a_obj_slice_log.cpp"),
Rel(NonMatching, "d_a_obj_slice_log_parts", "REL/d/a/obj/d_a_obj_slice_log_parts.cpp"),
Rel(NonMatching, "d_a_obj_smoke", "REL/d/a/obj/d_a_obj_smoke.cpp"),
Rel(Matching, "d_a_obj_smoke", "REL/d/a/obj/d_a_obj_smoke.cpp"),
Rel(NonMatching, "d_a_obj_soil", "REL/d/a/obj/d_a_obj_soil.cpp"),
Rel(NonMatching, "d_a_obj_spider_line", "REL/d/a/obj/d_a_obj_spider_line.cpp"),
Rel(NonMatching, "d_a_obj_spike", "REL/d/a/obj/d_a_obj_spike.cpp"),
Expand Down
17 changes: 10 additions & 7 deletions include/d/a/obj/d_a_obj_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class dAcObjBase_c : public dAcBase_c {

public:
// could be their own thing?
/* 8002de40 */ static void *getOarcFile(char *oarcName, char *fileName);
/* 8002de60 */ static void *getOarcSubEntry(char *oarcName, char *fileName);
/* 8002de80 */ static nw4r::g3d::ResFile getOarcResFile(char *oarcName);
/* 8002de90 */ static void *getOarcModelFile(char *oarcName);
/* 8002dea0 */ static void *getOarcZev(char *oarcName);
/* 8002deb0 */ static void *getOarcDZB(char *dzbName);
/* 8002ded0 */ static void *getOarcPLC(char *plcName);
/* 8002de40 */ static void *getOarcFile(const char *oarcName, const char *fileName);
/* 8002de60 */ static void *getOarcSubEntry(const char *oarcName, const char *fileName);
/* 8002de80 */ static nw4r::g3d::ResFile getOarcResFile(const char *oarcName);
/* 8002de90 */ static void *getOarcModelFile(const char *oarcName);
/* 8002dea0 */ static void *getOarcZev(const char *oarcName);
/* 8002deb0 */ static void *getOarcDZB(const char *dzbName);
/* 8002ded0 */ static void *getOarcPLC(const char *plcName);

public:
/* 8002def0 */ dAcObjBase_c();
Expand Down Expand Up @@ -125,4 +125,7 @@ class dAcObjBase_c : public dAcBase_c {
}
};

// Actors' createHeap functions often have patterns that can be matched with this macro
#define TRY_CREATE(thing) do { bool result = (thing); if (!result) return result; } while (0);

#endif
30 changes: 30 additions & 0 deletions include/d/a/obj/d_a_obj_smoke.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef D_A_OBJ_SMOKE_H
#define D_A_OBJ_SMOKE_H

#include <d/a/obj/d_a_obj_base.h>
#include <m/m3d/m_anmtexsrt.h>
#include <m/m3d/m_smdl.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>

class dAcOsmoke_c : public dAcObjBase_c {
public:
dAcOsmoke_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dAcOsmoke_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;

STATE_FUNC_DECLARE(dAcOsmoke_c, Wait);

private:
nw4r::g3d::ResFile mBrres;
m3d::smdl_c mModel;
m3d::anmTexSrt_c mTexAnm;
STATE_MGR_DECLARE(dAcOsmoke_c);
u8 mType;
};

#endif
8 changes: 1 addition & 7 deletions src/REL/d/a/obj/d_a_obj_mole_soil.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <d/a/obj/d_a_obj_mole_soil.h>
#include <toBeSorted/arc_managers/current_stage_arc_manager.h>
#include <toBeSorted/spawn_struct.h>

SPECIAL_ACTOR_PROFILE(OBJ_MOLE_SOIL, dAcOmoleSoil_c, fProfile::OBJ_MOLE_SOIL, 0x008B, 0, 6);

Expand All @@ -18,11 +16,7 @@ bool dAcOmoleSoil_c::createHeap() {
}
mBrres = file;
nw4r::g3d::ResMdl mdl = mBrres.GetResMdl("MogumaMud");
// This whole code is a bit weird again
bool success1 = mModel.create(mdl, &heap_allocator, 0x120, 1, nullptr);
if (!success1) {
return success1;
}
TRY_CREATE(mModel.create(mdl, &heap_allocator, 0x120, 1, nullptr));
mModel.setPriorityDraw(0x1c, 9);
return true;
}
Expand Down
8 changes: 2 additions & 6 deletions src/REL/d/a/obj/d_a_obj_ring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ bool dAcOring_c::createHeap() {
nw4r::g3d::ResFile f = getOarcResFile("PRing");
nw4r::g3d::ResMdl mdl = f.GetResMdl("PeehatRing");
// This matches but in a really weird way. Maybe an inline function?
bool success = mModel.create(mdl, &heap_allocator, 0x20, 1, nullptr);
bool rc = true;
if (success == false) {
rc = success;
}
return rc;
TRY_CREATE(mModel.create(mdl, &heap_allocator, 0x20, 1, nullptr));
return true;
}

int dAcOring_c::create() {
Expand Down
60 changes: 60 additions & 0 deletions src/REL/d/a/obj/d_a_obj_smoke.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include <d/a/obj/d_a_obj_smoke.h>

static const char *const sSmokeNames1[] = {
"SmokeF200",
"SmokeF202",
};

static const char *const sSmokeNames2[] = {
"SmokeF200",
"SmokeF202",
};

SPECIAL_ACTOR_PROFILE(OBJ_SMOKE, dAcOsmoke_c, fProfile::OBJ_SMOKE, 0x01DB, 0, 4);

STATE_DEFINE(dAcOsmoke_c, Wait);

bool dAcOsmoke_c::createHeap() {
mType = params & 3;
mBrres = getOarcResFile(sSmokeNames1[mType]);
nw4r::g3d::ResMdl mdl = mBrres.GetResMdl(sSmokeNames2[mType]);
TRY_CREATE(mModel.create(mdl, &heap_allocator, 0x324));
nw4r::g3d::ResAnmTexSrt srt = mBrres.GetResAnmTexSrt(sSmokeNames1[mType]);
TRY_CREATE(mTexAnm.create(mdl, srt, &heap_allocator, nullptr, 1));
return true;
}

int dAcOsmoke_c::create() {
if (!initAllocatorWork1Heap(-1, "dAcOsmoke_c::m_allocator", 0x20)) {
return 2;
}

mModel.setAnm(mTexAnm);
updateMatrix();
mModel.setLocalMtx(worldMatrix);
mStateMgr.changeState(StateID_Wait);
mModel.setPriorityDraw(0x1C, 9);
setBoundingBox(mVec3_c(-0.0f, -0.0f, -0.0f), mVec3_c(0.0f, 0.0f, 0.0f));
return 1;
}

int dAcOsmoke_c::doDelete() {
return 1;
}

int dAcOsmoke_c::actorExecute() {
mStateMgr.executeState();
mTexAnm.play();
return 1;
}

int dAcOsmoke_c::draw() {
drawModelType1(&mModel);
return 1;
}

void dAcOsmoke_c::initializeState_Wait() {}

void dAcOsmoke_c::executeState_Wait() {}

void dAcOsmoke_c::finalizeState_Wait() {}
10 changes: 3 additions & 7 deletions src/REL/d/a/obj/d_a_obj_sun_light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ bool dAcOsunLight_c::createHeap() {
fn_801B42D0(&mBrres);
fn_801B4320(&mBrres);
nw4r::g3d::ResMdl mdl = mBrres.GetResMdl("StageF000Light");
// This whole code is a bit weird again
bool success1 = mModel.create(mdl, &heap_allocator, 0x120);
if (!success1) {
return success1;
}
TRY_CREATE(mModel.create(mdl, &heap_allocator, 0x120));
nw4r::g3d::ResAnmTexSrt srt = mBrres.GetResAnmTexSrt("StageF000Light");
bool success2 = mTexAnm.create(mdl, srt, &heap_allocator, nullptr, 1);
return success2 ? true : success2;
TRY_CREATE(mTexAnm.create(mdl, srt, &heap_allocator, nullptr, 1));
return true;
}

int dAcOsunLight_c::create() {
Expand Down

0 comments on commit b6bd727

Please sign in to comment.