Skip to content

Commit

Permalink
Attempt d_a_obj_tower_hand_D101 (#96)
Browse files Browse the repository at this point in the history
* Attempt d_a_obj_tower_hand_D101

* dAcOTowerHandD101_c probably equivalent

* just two funcs, couldnt really do much to the rest

---------

Co-authored-by: elijah-thomas774 <[email protected]>
  • Loading branch information
robojumper and elijah-thomas774 authored Nov 9, 2024
1 parent 74db770 commit a3472ab
Show file tree
Hide file tree
Showing 16 changed files with 1,039 additions and 136 deletions.
4 changes: 3 additions & 1 deletion .clangd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# https://clangd.llvm.org/config
CompileFlags:
Add: [
"-Wno-c++11-compat-deprecated-writable-strings"
"-Wno-c++11-compat-deprecated-writable-strings",
"-Wno-trigraphs",
"-fno-trigraphs"
]
3 changes: 3 additions & 0 deletions config/SOUE01/rels/d_a_obj_tower_hand_D101NP/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_tower_hand_D101.cpp:
.text start:0x000000F0 end:0x00003028
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x000000FC
.data start:0x00000000 end:0x0000038C
.bss start:0x00000008 end:0x00000198
197 changes: 98 additions & 99 deletions config/SOUE01/rels/d_a_obj_tower_hand_D101NP/symbols.txt

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ fn_80026F50 = .text:0x80026F50; // type:function size:0xD8
fn_80027030 = .text:0x80027030; // type:function size:0xD8
fn_80027110 = .text:0x80027110; // type:function size:0xC8
fn_800271E0 = .text:0x800271E0; // type:function size:0x44
fn_80027230 = .text:0x80027230; // type:function size:0x78
setMtx__13EffectsStructFRC6mMtx_c = .text:0x80027230; // type:function size:0x78
fn_800272B0 = .text:0x800272B0; // type:function size:0x70
fn_80027320 = .text:0x80027320; // type:function size:0x40
fn_80027360 = .text:0x80027360; // type:function size:0x40
Expand All @@ -920,7 +920,7 @@ fn_800274D0 = .text:0x800274D0; // type:function size:0x40
fn_80027510 = .text:0x80027510; // type:function size:0x4C
fn_80027560 = .text:0x80027560; // type:function size:0x5C
__ct__13EffectsStructFv = .text:0x800275C0; // type:function size:0x44
__ct__13EffectsStructFP9dAcBase_c = .text:0x80027610; // type:function size:0x44
__ct__13EffectsStructFP7dBase_c = .text:0x80027610; // type:function size:0x44
__dt__13EffectsStructFv = .text:0x80027660; // type:function size:0x78
remove__13EffectsStructFb = .text:0x800276E0; // type:function size:0x84
fn_80027770 = .text:0x80027770; // type:function size:0xE8
Expand Down Expand Up @@ -1121,7 +1121,7 @@ restorePosRotFromCopy__12dAcObjBase_cFv = .text:0x8002E5C0; // type:function siz
create__12dAcObjBase_cFQ28fProfile14PROFILE_NAME_eUlUlP7mVec3_cP7mAng3_cP7mVec3_cUl = .text:0x8002E630; // type:function size:0x98
create__12dAcObjBase_cFPcUlUlP7mVec3_cP7mAng3_cP7mVec3_cUlUsSc = .text:0x8002E6D0; // type:function size:0xA0
ActorObjectBase__findObject = .text:0x8002E770; // type:function size:0x7C
getNextActorInList = .text:0x8002E7F0; // type:function size:0x58
getNextObject__12dAcObjBase_cFP9fLiMgBa_cP12dAcObjBase_c = .text:0x8002E7F0; // type:function size:0x58
isLinkPointer = .text:0x8002E850; // type:function size:0x14
ActorObjectBase__calcVelocity = .text:0x8002E870; // type:function size:0x68
calcVelocity__12dAcObjBase_cFv = .text:0x8002E8E0; // type:function size:0xB8
Expand Down Expand Up @@ -2452,7 +2452,7 @@ isSpinAttackingVertically = .text:0x8005B850; // type:function size:0x20
fn_8005B870 = .text:0x8005B870; // type:function size:0x28
fn_8005B8A0 = .text:0x8005B8A0; // type:function size:0xC0
ActorLink__setPosYRot = .text:0x8005B960; // type:function size:0x44
fn_8005B9B0 = .text:0x8005B9B0; // type:function size:0x98
setTransform__7dAcPy_cFRC6mMtx_ciii = .text:0x8005B9B0; // type:function size:0x98
fn_8005BA50 = .text:0x8005BA50; // type:function size:0x30
fn_8005BA80 = .text:0x8005BA80; // type:function size:0x8
fn_8005BA90 = .text:0x8005BA90; // type:function size:0x8
Expand Down Expand Up @@ -3523,7 +3523,7 @@ ActorEventRelated__cutEnd = .text:0x8009CEB0; // type:function size:0x30
ActorEventRelated__getCurrentStepIndex = .text:0x8009CEE0; // type:function size:0x30
getCurrentEventCommand__17ActorEventRelatedCFv = .text:0x8009CF10; // type:function size:0x84
ActorEventRelated__getSomeEventRelatedNumber = .text:0x8009CFA0; // type:function size:0x80
ActorEventRelated__isAdvance = .text:0x8009D020; // type:function size:0x34
isAdvance__17ActorEventRelatedFv = .text:0x8009D020; // type:function size:0x34
advanceNext__17ActorEventRelatedFv = .text:0x8009D060; // type:function size:0x50
ActorEventRelated__getSingleIntData2 = .text:0x8009D0B0; // type:function size:0x8C
ActorEventRelated__getSingleIntData = .text:0x8009D140; // type:function size:0x8C
Expand Down Expand Up @@ -13452,10 +13452,10 @@ AcItem__stateWaitTurnOffLeave = .text:0x80250630; // type:function size:0x4
AcItem__stateWaitSacredDewGetEffectEnter = .text:0x80250640; // type:function size:0x64
AcItem__stateWaitSacredDewGetEffectUpdate = .text:0x802506B0; // type:function size:0x80
AcItem__stateWaitSacredDewGetEffectLeave = .text:0x80250730; // type:function size:0x4
getItemFromBWheelItem = .text:0x80250740; // type:function size:0xEC
fn_80250830 = .text:0x80250830; // type:function size:0x40
getItemFromBWheelItem__9dAcItem_cFv = .text:0x80250740; // type:function size:0xEC
setItemPosition__9dAcItem_cFRC7mVec3_c = .text:0x80250830; // type:function size:0x40
fn_80250870 = .text:0x80250870; // type:function size:0x38
AcItem__isStateWait = .text:0x802508B0; // type:function size:0x50
isStateWait__9dAcItem_cFv = .text:0x802508B0; // type:function size:0x50
AcItem__setCarriedAndTransitionToGetState = .text:0x80250900; // type:function size:0x50
AcItem__isGreenRupee = .text:0x80250950; // type:function size:0x10
AcItem__isBlueRupee = .text:0x80250960; // type:function size:0x10
Expand Down Expand Up @@ -17846,7 +17846,7 @@ YrotM__6mMtx_cFRC4mAng = .text:0x802F1880; // type:function size:0x4C
mMtx__ZrotS = .text:0x802F18D0; // type:function size:0xBC
ZrotM__6mMtx_cFRC4mAng = .text:0x802F1990; // type:function size:0x4C
ZXYrotS__6mMtx_cFRC4mAngRC4mAngRC4mAng = .text:0x802F19E0; // type:function size:0x60
mMtx__ZXYrotM = .text:0x802F1A40; // type:function size:0x60
ZXYrotM__6mMtx_cFRC4mAngRC4mAngRC4mAng = .text:0x802F1A40; // type:function size:0x60
mMtx__XYZrotS = .text:0x802F1AA0; // type:function size:0x60
mMtx__ZYXrotM = .text:0x802F1B00; // type:function size:0x60
toRot__6mMtx_cCFR7mAng3_c = .text:0x802F1B60; // type:function size:0xDC
Expand Down Expand Up @@ -39924,7 +39924,7 @@ GROOSENATOR_REF = .sbss:0x80575360; // type:object size:0x4 data:4byte
lbl_80575364 = .sbss:0x80575364; // type:object size:0x4 data:4byte
lbl_80575368 = .sbss:0x80575368; // type:object size:0x8 data:4byte
sInstance__16AttentionManager = .sbss:0x80575370; // type:object size:0x8 data:4byte
EVENT_RELATED = .sbss:0x80575378; // type:object size:0x4 data:4byte
sInstance__12EventManager = .sbss:0x80575378; // type:object size:0x4 data:4byte
lbl_8057537C = .sbss:0x8057537C; // type:object size:0xC data:byte
lbl_80575388 = .sbss:0x80575388; // type:object size:0x8 data:byte
lbl_80575390 = .sbss:0x80575390; // type:object size:0x4 data:4byte
Expand Down Expand Up @@ -40217,7 +40217,7 @@ lbl_805758B6 = .sbss:0x805758B6; // type:object size:0x1 data:byte
lbl_805758B7 = .sbss:0x805758B7; // type:object size:0x1 data:byte
lbl_805758B8 = .sbss:0x805758B8; // type:object size:0x4 data:float
lbl_805758BC = .sbss:0x805758BC; // type:object size:0x4 data:float
ITEM_ACTOR_LIST = .sbss:0x805758C0; // type:object size:0x8 data:4byte
sItemList__9dAcItem_c = .sbss:0x805758C0; // type:object size:0x8 data:4byte
lbl_805758C8 = .sbss:0x805758C8; // type:object size:0x8 data:4byte
NUMBER_OF_ITEMS = .sbss:0x805758D0; // type:object size:0x4 data:4byte
lbl_805758D4 = .sbss:0x805758D4; // type:object size:0x1 data:byte
Expand Down
2 changes: 1 addition & 1 deletion include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ typedef volatile f32 vf32;
typedef volatile f64 vf64;

// Necesary for CW
#if __cplusplus < 201103L && !defined(_WIN32)
#if __MWERKS__
#define override
#define noexcept
#define nullptr NULL
Expand Down
3 changes: 3 additions & 0 deletions include/d/a/d_a_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class dAcRef_c : dAcRefBase_c {
const T *get() const {
return static_cast<const T *>(p_owner);
}
BOOL isLinked() const {
return get() != nullptr;
}
};

// Ghidra: ActorBase
Expand Down
12 changes: 8 additions & 4 deletions include/d/a/d_a_player.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "d/a/d_a_base.h"
#include "d/a/obj/d_a_obj_base.h"
#include "m/m_mtx.h"

class dAcPy_c : public dAcObjBase_c {
// See Below for some info
Expand Down Expand Up @@ -47,11 +49,13 @@ class dAcPy_c : public dAcObjBase_c {
dAcPy_c();
virtual ~dAcPy_c();

/* vt 0x080 */ virtual void IfCurrentActionToActor();
/* vt 0x084 */ virtual void vt_0x084();
/* vt 0x088 */ virtual void set0x439F();
void setTransform(const mMtx_c &mtx, UNKWORD, UNKWORD, UNKWORD);

/* vt 0x080 */ virtual UNKWORD IfCurrentActionToActor(dAcBase_c *ac, UNKWORD);
/* vt 0x084 */ virtual void vt_0x084(dAcBase_c *ac, UNKWORD);
/* vt 0x088 */ virtual void set0x439F(dAcBase_c *ac, UNKWORD);
/* vt 0x08C */ virtual void set0x43DE();
/* vt 0x090 */ virtual void vt_0x090();
/* vt 0x090 */ virtual f32 vt_0x090();
/* vt 0x094 */ virtual void relatedToUsingItem0x11();
/* vt 0x098 */ virtual void setPosRot();
/* vt 0x09C */ virtual void isLiftingObject();
Expand Down
2 changes: 1 addition & 1 deletion include/d/a/obj/d_a_obj_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class dAcObjBase_c : public dAcBase_c {
);
/* 8002e770 */ static dAcObjBase_c *
findObject(fProfile::PROFILE_NAME_e actorId, fLiNdBa_c *refList, dAcObjBase_c *parent);
/* 8002e7f0 */ static dAcObjBase_c *getNextObject(fLiNdBa_c *ref, dAcObjBase_c *parent);
/* 8002e7f0 */ static dAcObjBase_c *getNextObject(fLiMgBa_c *ref, dAcObjBase_c *parent);
/* 8002e850 */ bool isPlayer();
/* 8002e870 */ void calcVelocity(mVec3_c &pos, f32 speed);
/* 8002e8e0 */ void calcVelocity();
Expand Down
6 changes: 6 additions & 0 deletions include/d/a/obj/d_a_obj_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define D_A_ITEM_BASE_H

#include "d/a/obj/d_a_obj_base.h"
#include "m/m_vec.h"

// Ghidra: AcItem
// Size: 0xd68
Expand All @@ -14,6 +15,11 @@ class dAcItem_c : public dAcObjBase_c {
static void spawnDrop(u16 item, u32 room, const mVec3_c &pos, const mAng3_c &rot);

static u32 checkFlag(u32 flag);
void setItemPosition(const mVec3_c &);
void getItemFromBWheelItem();
bool isStateWait();

static fLiMgBa_c sItemList;
};

#endif
101 changes: 99 additions & 2 deletions include/d/a/obj/d_a_obj_tower_hand_D101.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
#ifndef D_A_OBJ_TOWER_HAND_D101_H
#define D_A_OBJ_TOWER_HAND_D101_H

#include "common.h"
#include "d/a/d_a_base.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/a/obj/d_a_obj_item.h"
#include "d/col/bg/d_bg_w.h"
#include "m/m3d/m_anmmdl.h"
#include "m/m_angle.h"
#include "m/m_mtx.h"
#include "m/m_vec.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
#include "toBeSorted/actor_event.h"
#include "toBeSorted/effects_struct.h"

class dAcOTowerHandD101_c : public dAcObjBase_c {
public:
dAcOTowerHandD101_c() : mStateMgr(*this, sStateID::null) {}
dAcOTowerHandD101_c() : mStateMgr(*this, sStateID::null), mEffects(this), mEvent(*this, nullptr), mFlags(0) {}
virtual ~dAcOTowerHandD101_c() {}

STATE_FUNC_DECLARE(dAcOTowerHandD101_c, RemainOpen);
Expand All @@ -16,8 +26,95 @@ class dAcOTowerHandD101_c : public dAcObjBase_c {
STATE_FUNC_DECLARE(dAcOTowerHandD101_c, Open);
STATE_FUNC_DECLARE(dAcOTowerHandD101_c, Hold);

virtual bool createHeap() override;
virtual int actorCreate() override;
virtual int actorPostCreate() override;
virtual int actorExecute() override;
virtual int actorExecuteInEvent() override;

virtual int draw() override;

private:
/* 0x??? */ STATE_MGR_DECLARE(dAcOTowerHandD101_c);
int getDirection() const;
int getHoldFlag() const;
int getSceneFlag() const;
u32 getEventId() const;

inline bool getItem(dAcItem_c *&outItem, bool &outIsWait);
inline bool getItem(dAcItem_c *&outItem);

static bool isValidDirectionParam(int param);
static bool getScale(int direction, mVec3_c &outScale);
bool getNodeMtx(const char *nodeName, mMtx_c &outMtx) const;
bool getLoc1Mtx(mMtx_c &outMtx) const;
bool getLoc2Mtx(mMtx_c &outMtx) const;

static const mVec3_c &getBoundingLower();
static const mVec3_c &getBoundingUpper();

static bool isValidBgWIndex(int index);
bool getBgW(int index, dBgW *&outBgW);
bool getBgWMtx(int index, mMtx_c *&outMtx);

static f32 getFrame1();
static f32 getFrame2();

void doSomethingHold(f32 flag);

void getItemPos(mVec3_c &vec) const;
ActorEventRelated &getEventStuff();
void doEvent();

static f32 getDist1();
static f32 getDist2();
static f32 getDist3();

static f32 getDist1Sq();
static f32 getDist1PlusDist2();
static f32 getDist1PlusDist2Sq();
static f32 getDist3Sq();
static f32 getCloseRate();
static f32 getOpenRate();

bool checkFlag(bool &result) const;
void setSceneFlag(int flag) const;
void unsetSceneFlag(int flag) const;
bool checkSceneFlag1(int flag, bool &result) const;

void setHoldFlag();
void unsetHoldFlag();

static void eventCallback(void *self);

static void
transformMtx(const mVec3_c &localTranslation, const mAng3_c &rotation, const mVec3_c &offset, mVec3_c &result);
static f32 f32Sq(f32 val);

static f32 getItemOffsetX();
static f32 getItemOffsetY();
static f32 getItemOffsetZ();
static mVec3_c getItemOffset();
void calcItemPosition(const mVec3_c &offset, mVec3_c &outPosition) const;

static f32 getLinkOffsetX();
static f32 getLinkOffsetY();
static f32 getLinkOffsetZ();
static void getLinkOffsetNormal(mVec3_c &out);
static void getLinkOffsetMirror(mVec3_c &out);
void getLinkOffset(mVec3_c &out) const;

/* 0x330 */ m3d::mdlAnmChr mMdl;
/* 0x398 */ EffectsStruct mEffects;
/* 0x3CC */ dBgW mBgWs[3];
/* 0x9FC */ STATE_MGR_DECLARE(dAcOTowerHandD101_c);
/* 0xA38 */ ActorEventRelated mEvent;
/* 0xA88 */ mMtx_c mLoc1Mtx;
/* 0xAB8 */ mMtx_c mLoc2Mtx;
/* 0xAE8 */ dAcRef_c<dAcItem_c> mHeldItem;
/* 0xAF4 */ f32 field_0xAF4;
/* 0xAF8 */ u8 field_0xAF8[0xB04 - 0xAF8];
/* 0xB04 */ u32 mFlags;
/* 0xB08 */ u16 field_0xB08;
};

#endif
8 changes: 8 additions & 0 deletions include/m/m3d/m_anmmdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ class mdlAnmChr {
return mMdl;
}

inline const mdl_c &getModel() const {
return mMdl;
}

inline anmChr_c &getAnm() {
return mAnm;
}

inline const anmChr_c &getAnm() const {
return mAnm;
}

private:
nw4r::g3d::ResFile mMdlFile;
nw4r::g3d::ResFile mAnmFile;
Expand Down
4 changes: 2 additions & 2 deletions include/m/m_mtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ class mMtx_c : public EGG::Matrix34f {
void rot(int, int); // does some werrd operation to rotate the matrix
bool quatRelated();

void trans(const mVec3_c &v) {
void transS(const mVec3_c &v) {
PSMTXTrans(*this, v.x, v.y, v.z);
}
void trans(f32 x, f32 y, f32 z) {
void transS(f32 x, f32 y, f32 z) {
PSMTXTrans(*this, x, y, z);
}
mVec3_c multVec(const mVec3_c &v) const {
Expand Down
1 change: 1 addition & 0 deletions include/toBeSorted/actor_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ActorEventRelated {
void scheduleEvent(Event &, u32);
u32 getCurrentEventCommand() const;
void advanceNext();
bool isAdvance();

private:
u8 field_0x00[0x50 - 0x00];
Expand Down
11 changes: 10 additions & 1 deletion include/toBeSorted/effects_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

#include "common.h"
#include "d/d_base.h"
#include "m/m_mtx.h"
#include "m/m_vec.h"

class EffectsStruct {
private:
u8 field_0x00[0x1C - 0x00];
s32 field_0x00;
u8 field_0x04[0x1C - 0x04];

public:
// vt at 0x1C
Expand All @@ -19,6 +22,12 @@ class EffectsStruct {
}

void remove(bool);
void fn_80029929(u16 effect, mVec3_c *pos, void *, void *, void *, void *);
void setMtx(const mMtx_c&);

bool checkField0x00() const {
return field_0x00 != 0;
}

private:
u8 field_0x20[0x28 - 0x20];
Expand Down
Loading

0 comments on commit a3472ab

Please sign in to comment.