Skip to content

Commit

Permalink
Merge branch 'main' into main_dol_actors
Browse files Browse the repository at this point in the history
  • Loading branch information
elijah-thomas774 authored Sep 25, 2024
2 parents dbed083 + 2d05a82 commit cddc185
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 52 deletions.
3 changes: 3 additions & 0 deletions config/SOUE01/rels/d_a_obj_pool_cockNP/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_pool_cock.cpp:
.text start:0x000000F0 end:0x00000E08
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x00000020
.data start:0x00000000 end:0x000001D0
.bss start:0x00000008 end:0x00000048
100 changes: 50 additions & 50 deletions config/SOUE01/rels/d_a_obj_pool_cockNP/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_518_F0 = .text:0x000000F0; // type:function size:0xD8
fn_518_1D0 = .text:0x000001D0; // type:function size:0x58
fn_518_230 = .text:0x00000230; // type:function size:0x6C
fn_518_2A0 = .text:0x000002A0; // type:function size:0xA0
fn_518_340 = .text:0x00000340; // type:function size:0xA4
fn_518_3F0 = .text:0x000003F0; // type:function size:0xB4
fn_518_4B0 = .text:0x000004B0; // type:function size:0x140
fn_518_5F0 = .text:0x000005F0; // type:function size:0x10
fn_518_600 = .text:0x00000600; // type:function size:0x8
fn_518_610 = .text:0x00000610; // type:function size:0x8
fn_518_620 = .text:0x00000620; // type:function size:0x1EC
fn_518_810 = .text:0x00000810; // type:function size:0x10
fn_518_820 = .text:0x00000820; // type:function size:0x54
fn_518_880 = .text:0x00000880; // type:function size:0x4
fn_518_890 = .text:0x00000890; // type:function size:0xB4
fn_518_950 = .text:0x00000950; // type:function size:0x4
fn_518_960 = .text:0x00000960; // type:function size:0xD8
fn_518_A40 = .text:0x00000A40; // type:function size:0x10
fn_518_A50 = .text:0x00000A50; // type:function size:0x60
fn_518_AB0 = .text:0x00000AB0; // type:function size:0xC
fn_518_AC0 = .text:0x00000AC0; // type:function size:0x1C
fn_518_AE0 = .text:0x00000AE0; // type:function size:0x1C
fn_518_B00 = .text:0x00000B00; // type:function size:0x1C
fn_518_B20 = .text:0x00000B20; // type:function size:0x10
fn_518_B30 = .text:0x00000B30; // type:function size:0x10
fn_518_B40 = .text:0x00000B40; // type:function size:0x10
fn_518_B50 = .text:0x00000B50; // type:function size:0x10
fn_518_B60 = .text:0x00000B60; // type:function size:0x10
fn_518_B70 = .text:0x00000B70; // type:function size:0x10
fn_518_B80 = .text:0x00000B80; // type:function size:0x30
fn_518_BB0 = .text:0x00000BB0; // type:function size:0x30
fn_518_BE0 = .text:0x00000BE0; // type:function size:0x30
fn_518_C10 = .text:0x00000C10; // type:function size:0x10C
fn_518_D20 = .text:0x00000D20; // type:function size:0x58
fn_518_D80 = .text:0x00000D80; // type:function size:0x88
dAcOPoolCock_c_classInit__Fv = .text:0x000000F0; // type:function size:0xD8
__dt__27sFState_c<14dAcOPoolCock_c>Fv = .text:0x000001D0; // type:function size:0x58
__dt__30sFStateFct_c<14dAcOPoolCock_c>Fv = .text:0x00000230; // type:function size:0x6C
__dt__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000002A0; // type:function size:0xA0
__dt__53sFStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000340; // type:function size:0xA4
createHeap__14dAcOPoolCock_cFv = .text:0x000003F0; // type:function size:0xB4
actorCreate__14dAcOPoolCock_cFv = .text:0x000004B0; // type:function size:0x140
changeState__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000005F0; // type:function size:0x10
actorPostCreate__14dAcOPoolCock_cFv = .text:0x00000600; // type:function size:0x8
doDelete__14dAcOPoolCock_cFv = .text:0x00000610; // type:function size:0x8
actorExecute__14dAcOPoolCock_cFv = .text:0x00000620; // type:function size:0x1EC
executeState__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000810; // type:function size:0x10
draw__14dAcOPoolCock_cFv = .text:0x00000820; // type:function size:0x54
initializeState_Wait__14dAcOPoolCock_cFv = .text:0x00000880; // type:function size:0x4
executeState_Wait__14dAcOPoolCock_cFv = .text:0x00000890; // type:function size:0xB4
finalizeState_Wait__14dAcOPoolCock_cFv = .text:0x00000950; // type:function size:0x4
__dt__14dAcOPoolCock_cFv = .text:0x00000960; // type:function size:0xD8
getStateID__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000A40; // type:function size:0x10
build__30sFStateFct_c<14dAcOPoolCock_c>FRC12sStateIDIf_c = .text:0x00000A50; // type:function size:0x60
dispose__30sFStateFct_c<14dAcOPoolCock_c>FRP10sStateIf_c = .text:0x00000AB0; // type:function size:0xC
initialize__27sFState_c<14dAcOPoolCock_c>Fv = .text:0x00000AC0; // type:function size:0x1C
execute__27sFState_c<14dAcOPoolCock_c>Fv = .text:0x00000AE0; // type:function size:0x1C
finalize__27sFState_c<14dAcOPoolCock_c>Fv = .text:0x00000B00; // type:function size:0x1C
initializeState__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000B20; // type:function size:0x10
finalizeState__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000B30; // type:function size:0x10
refreshState__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000B40; // type:function size:0x10
getState__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000B50; // type:function size:0x10
getNewStateID__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000B60; // type:function size:0x10
getOldStateID__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000B70; // type:function size:0x10
finalizeState__29sFStateID_c<14dAcOPoolCock_c>CFR14dAcOPoolCock_c = .text:0x00000B80; // type:function size:0x30
executeState__29sFStateID_c<14dAcOPoolCock_c>CFR14dAcOPoolCock_c = .text:0x00000BB0; // type:function size:0x30
initializeState__29sFStateID_c<14dAcOPoolCock_c>CFR14dAcOPoolCock_c = .text:0x00000BE0; // type:function size:0x30
__sinit_\d_a_obj_pool_cock_cpp = .text:0x00000C10; // type:function size:0x10C scope:local
__dt__29sFStateID_c<14dAcOPoolCock_c>Fv = .text:0x00000D20; // type:function size:0x58
isSameName__29sFStateID_c<14dAcOPoolCock_c>CFPCc = .text:0x00000D80; // 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_518_rodata_0 = .rodata:0x00000000; // type:object size:0x8 data:float
lbl_518_rodata_8 = .rodata:0x00000008; // type:object size:0x14 data:float
lbl_518_rodata_1C = .rodata:0x0000001C; // type:object size:0x4 data:float
lbl_518_data_0 = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_518_data_10 = .data:0x00000010; // type:object size:0xC
lbl_518_data_1C = .data:0x0000001C; // type:object size:0x10
lbl_518_data_2C = .data:0x0000002C; // type:object size:0x1C data:string
lbl_518_data_48 = .data:0x00000048; // type:object size:0x80
lbl_518_data_C8 = .data:0x000000C8; // type:object size:0x30
lbl_518_data_F8 = .data:0x000000F8; // type:object size:0x30
lbl_518_data_128 = .data:0x00000128; // type:object size:0x18
lbl_518_data_140 = .data:0x00000140; // type:object size:0x5C
lbl_518_data_19C = .data:0x0000019C; // type:object size:0x34
lbl_518_rodata_0 = .rodata:0x00000000; // type:object size:0x8 scope:local data:float
lbl_518_rodata_8 = .rodata:0x00000008; // type:object size:0x14 scope:local data:float
lbl_518_rodata_1C = .rodata:0x0000001C; // type:object size:0x4 scope:local data:float
g_profile_OBJ_POOL_COCK = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_518_data_10 = .data:0x00000010; // type:object size:0xC scope:local
lbl_518_data_1C = .data:0x0000001C; // type:object size:0x10 scope:local
lbl_518_data_2C = .data:0x0000002C; // type:object size:0x1C scope:local data:string
__vt__14dAcOPoolCock_c = .data:0x00000048; // type:object size:0x80
__vt__53sFStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c> = .data:0x000000C8; // type:object size:0x30
__vt__83sStateMgr_c<14dAcOPoolCock_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x000000F8; // type:object size:0x30
__vt__30sFStateFct_c<14dAcOPoolCock_c> = .data:0x00000128; // type:object size:0x14
__vt__27sFState_c<14dAcOPoolCock_c> = .data:0x00000140; // type:object size:0x18
__vt__29sFStateID_c<14dAcOPoolCock_c> = .data:0x0000019C; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_518_bss_8 = .bss:0x00000008; // type:object size:0x10
lbl_518_bss_18 = .bss:0x00000018; // type:object size:0x30 data:4byte
lbl_518_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local
StateID_Wait__14dAcOPoolCock_c = .bss:0x00000018; // type:object size:0x30 data:4byte
2 changes: 1 addition & 1 deletion config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17872,7 +17872,7 @@ fn_802F2A80 = .text:0x802F2A80; // type:function size:0xF0
normalize__7mVec3_cFv = .text:0x802F2B70; // type:function size:0x78
fn_802F2BF0 = .text:0x802F2BF0; // type:function size:0x84
fn_802F2C80 = .text:0x802F2C80; // type:function size:0xA8
fn_802F2D30 = .text:0x802F2D30; // type:function size:0xAC
rotY__7mVec3_cFRC4mAng = .text:0x802F2D30; // type:function size:0xAC
fn_802F2DE0 = .text:0x802F2DE0; // type:function size:0xA8
fn_802F2E90 = .text:0x802F2E90; // type:function size:0x78
fn_802F2F10 = .text:0x802F2F10; // type:function size:0x38
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
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"),
Rel(NonMatching, "d_a_obj_pool_cock", "REL/d/a/obj/d_a_obj_pool_cock.cpp"),
Rel(Matching, "d_a_obj_pool_cock", "REL/d/a/obj/d_a_obj_pool_cock.cpp"),
Rel(NonMatching, "d_a_obj_pot_sal", "REL/d/a/obj/d_a_obj_pot_sal.cpp"),
Rel(NonMatching, "d_a_obj_propeller_lift", "REL/d/a/obj/d_a_obj_propeller_lift.cpp"),
Rel(NonMatching, "d_a_obj_propera", "REL/d/a/obj/d_a_obj_propera.cpp"),
Expand Down
33 changes: 33 additions & 0 deletions include/d/a/obj/d_a_obj_pool_cock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef D_A_OBJ_POOL_COCK_H
#define D_A_OBJ_POOL_COCK_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 dAcOPoolCock_c : public dAcObjBase_c {
public:
dAcOPoolCock_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dAcOPoolCock_c() {}
virtual bool createHeap() override;
virtual int actorCreate() override;
virtual int actorPostCreate() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;

STATE_FUNC_DECLARE(dAcOPoolCock_c, Wait);

private:
nw4r::g3d::ResFile mBrres;
m3d::smdl_c mModels[2];
STATE_MGR_DECLARE(dAcOPoolCock_c);
/* 0x3A8 */ mVec3_c mOpenDirection;
/* 0x3B4 */ f32 mOpenProgress;
/* 0x3B8 */ u8 mOpenSceneflag;
/* 0x3B9 */ bool mHasActivatedVortex;
};

#endif
9 changes: 9 additions & 0 deletions include/d/a/obj/d_a_obj_vortex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <common.h>

#include <d/a/obj/d_a_obj_base.h>

struct dAcObjVortex_c : public dAcObjBase_c {
// TODO
/* 0x330 */ u8 _[0x870 - 0x330];
/* 0x870 */ u8 field_0x870;
};
3 changes: 3 additions & 0 deletions include/m/m_vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "egg/math/eggVector.h"
#include "rvl/MTX.h"
#include "m/m_angle.h"
#include <common.h>

class mVec3_c : public EGG::Vector3f {
Expand Down Expand Up @@ -148,6 +149,8 @@ class mVec3_c : public EGG::Vector3f {
return PSVECMag(*this);
}

void rotY(const mAng &angle);

static mVec3_c Zero;
static mVec3_c Ex;
static mVec3_c Ey;
Expand Down
100 changes: 100 additions & 0 deletions src/REL/d/a/obj/d_a_obj_pool_cock.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#include <d/a/obj/d_a_obj_pool_cock.h>
#include <d/a/obj/d_a_obj_vortex.h>
#include <s/s_Math.h>
#include <toBeSorted/sceneflag_manager.h>

SPECIAL_ACTOR_PROFILE(OBJ_POOL_COCK, dAcOPoolCock_c, fProfile::OBJ_POOL_COCK, 0x024D, 0, 7);

STATE_DEFINE(dAcOPoolCock_c, Wait);

bool dAcOPoolCock_c::createHeap() {
mBrres = getOarcResFile("WaterD101");
RoomManager::bindStageResToFile(&mBrres);
nw4r::g3d::ResMdl mdl = mBrres.GetResMdl("PoolCockD101");
for (int i = 0; i < 2; i++) {
TRY_CREATE(mModels[i].create(mdl, &heap_allocator, 0x120));
}
return true;
}

int dAcOPoolCock_c::actorCreate() {
CREATE_ALLOCATOR(dAcOPoolCock_c);

forwardAccel = -0.0f;
forwardMaxSpeed = -40.0f;
mOpenSceneflag = params & 0xFF;
mOpenDirection = mVec3_c::Ez;
mOpenDirection.rotY(rotation.y);

if (mOpenSceneflag < 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mOpenSceneflag)) {
mOpenProgress = 400.0f;
}

mStateMgr.changeState(StateID_Wait);

setBoundingBox(mVec3_c(-300.0f, -100.0f, -300.0f), mVec3_c(300.0f, 100.0f, 300.0f));
return SUCCEEDED;
}

int dAcOPoolCock_c::actorPostCreate() {
return SUCCEEDED;
}

int dAcOPoolCock_c::doDelete() {
return SUCCEEDED;
}

int dAcOPoolCock_c::actorExecute() {
mStateMgr.executeState();
calcVelocity();
position += velocity;
position += posIncrements;
updateMatrix();
mMtx_c mdl1Transform;
mMtx_c mdl2Transform;
mdl1Transform = worldMatrix;
mdl2Transform = worldMatrix;

mMtx_c tmp1;
mMtx_c tmp2;

mVec3_c translation = mOpenDirection * mOpenProgress;
PSMTXTrans(tmp1, translation.x, translation.y, translation.z);
PSMTXConcat(mdl1Transform, tmp1, mdl1Transform);

mVec3_c translation2 = -translation;
PSMTXTrans(tmp2, translation2.x, translation2.y, translation2.z);
PSMTXConcat(mdl2Transform, tmp2, mdl2Transform);

mdl2Transform.YrotM(-0x8000);
mModels[0].setLocalMtx(mdl1Transform);
mModels[1].setLocalMtx(mdl2Transform);

return SUCCEEDED;
}

int dAcOPoolCock_c::draw() {
if (mOpenProgress < 400.0f) {
drawModelType1(&mModels[0]);
drawModelType1(&mModels[1]);
}
return SUCCEEDED;
}

void dAcOPoolCock_c::initializeState_Wait() {}

void dAcOPoolCock_c::executeState_Wait() {
if (mOpenSceneflag < 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mOpenSceneflag)) {
sLib::chase(&mOpenProgress, 400.0f, 5.0f);
if (!mHasActivatedVortex) {
dAcObjVortex_c *vortex = (dAcObjVortex_c *)fManager_c::searchBaseByProfName(fProfile::OBJ_VORTEX, nullptr);
if (vortex) {
vortex->actor_properties |= 0x4;
vortex->field_0x870 = 1;
}
mHasActivatedVortex = true;
}
}
}

void dAcOPoolCock_c::finalizeState_Wait() {}

0 comments on commit cddc185

Please sign in to comment.