Files
tww/include/d/d_cc_mass_s.h
T
Mike Lester 64cc277d05 d_wood (bushes) matching (#682)
* d_wood (bushes) 73% matching

* d_wood::Unit_c::set_ground 100% match

Jasper pointed me to the fact that the complicated inv_sqrt function I wrote was indeed just std::sqrtf(), which unlocked the rest of the match

* Replace some bitshifts with multiplies based on PR feedback

* Remove all instances of "this->" from d_wood

* Add missing struct offset comment for mTevStr

* Cleaned up d_tree externs

* Use MTXIdentity instead of PSMTXIdentity

* Remove incorrect TODO rearding cCcD_ObjAtType enum

* Use the mDoAud_seStart inline function

* Remove unnecessary parenthesis

* Fix incorrect branching logic in d_wood::cc_hit_before_cut()

* d_wood data sections fixup

* Re-add "Nonmatching" comments to all nonmatching functions

* Formatting: reformat from 2 to 4 space indentation

This was a local system problem which slipped by me in a previous commit

* 100% match for d_wood::Anm_c::mode_norm()

Thanks Chippy! https://discord.com/channels/727908905392275526/873250400483024976/1298360716964790294

* Use cLib_*Bit() functions for flag checking and setting

Based on the inline functions from the .map

* d_wood: Use AnmID_e according to the .map file

* d_wood: add a couple AnmID_e related inlines from the .map

* d_wood: Name remaining unknowns related to animation

* d_wood: Match cc_hit_before_cut()

* d_wood: Match calc_cc() by using the dComIfGp_roomControl_getStayNo() inline

* d_wood: Match string table and search_anm() by using a constant in assert string

* d_wood: Match mode_to_norm()

Switching normAnim to a const* did most of the work

* d_wood: 100% match for L_attr and the .rodata section

* d_wood: Fill in .data section. Still some extra data from vtables

* d_wood: Match .sbss section

* d_wood: Match .sdata section

* d_wood: 98% match for Packet_c::draw()

The only error is that g_dTree_shadowTexCoord is still using a 32-bit load instead of 16. the only way I know of to fix that is to define the data in this compilation unit. But that can't be right

* d_wood: Various small formatting changes

- No one line function implementations
- Replaced instances of (SomeType*)0x0 (copy/pasted from Ghidra) with NULL
- Replaced a few instances of 0.0 with 0.0f
- Replaced one instance where a number was used instead of an enum value

* d_wood: More formatting fixes

- Removed unused variables from functions
- Removed unnecessary iVar1 loop variables (leftover Ghidra detritus)
- Fixed dtk function comments being wrapped by autoformatter. They now always appear on one line

* d_tree: 100% match of data which is used by d_wood

This moves g_dTree_shadowTexCoord into .sdata which allows d_wood::Packet_c::draw() to load its address with a single instruction. This  makes a 100% match for draw()

* d_wood: Removed unnecessary comment now that draw() matches

g_dTree_shadowTexCoord now lives in the d_tree .sdata section, so its instruction can be loaded with a single instruction. This makes a 100% match with draw().

* d_wood: 100% match for mode_cut()

* d_wood: Match mode_push_into()

Also renamed mWindDir to mForceDir as it represents both wind and an actor pushing from a vector

* d_wood: Match mode_push_back

* d_wood: Match __sinit_d_wood_cpp

The l_matDL display list is dynamically patched to reference the l_Txa_swood_bTEX texture at static initialization time. Is there a better way to represent this?

* d_wood: Fix incorrect constant in set_ground()

* d_wood: Simplify dummy data at the top of .data section

* d_wood: Mark as matching in configure.py

Had to move Packet_c destructor to get the functions in the right order. See discussion: https://discord.com/channels/727908905392275526/873250400483024976/1300680009458913280

* d_wood: Add `d/d_cc_d.h` include as some enums have moved

* d_wood: Clean up some types at the top

* Mark d_wood as non-matching for the Japanese version
2024-10-31 16:58:37 -04:00

109 lines
3.0 KiB
C++

#ifndef D_CC_D_CC_MASS_S_H
#define D_CC_D_CC_MASS_S_H
#include "SSystem/SComponent/c_cc_d.h"
#include "global.h"
typedef void (*dCcMassS_ObjCallback)(fopAc_ac_c*, cXyz*, u32);
class dCcMassS_Obj {
public:
/* 0x00 */ cCcD_Obj* mpObj;
/* 0x04 */ u8 mPriority;
/* 0x08 */ dCcMassS_ObjCallback mpCallback;
/* 0x0C */ cCcD_DivideInfo mDivideInfo;
/* 0x14 vtable */
public:
dCcMassS_Obj() {}
virtual ~dCcMassS_Obj() {}
cCcD_Obj* GetObj() const { return mpObj; }
u8 GetPriority() const { return mPriority; }
dCcMassS_ObjCallback GetAreaCheckFunc() const { return mpCallback; }
cCcD_DivideInfo* GetPDivideInfo() { return &mDivideInfo; }
void Clear() {
mpObj = NULL;
mPriority = 5;
mpCallback = NULL;
mDivideInfo.Set(0);
}
void Set(cCcD_Obj* p_obj, u8 priority, dCcMassS_ObjCallback callback) {
mpObj = p_obj;
mPriority = priority;
mpCallback = callback;
}
}; // Size = 0x18
STATIC_ASSERT(0x18 == sizeof(dCcMassS_Obj));
class dCcMassS_HitInf {
private:
/* 0x00 */ cCcD_Obj* mpArea;
/* 0x04 */ cCcD_Obj* mpAtObj;
/* 0x08 */ cCcD_Obj* mpCoObj;
/* 0x0C */ f32 mCoHitLen;
public:
virtual ~dCcMassS_HitInf() {}
void SetAreaHitObj(cCcD_Obj* obj) { mpArea = obj; }
void SetCoHitObj(cCcD_Obj* obj) { mpCoObj = obj; }
void SetAtHitObj(cCcD_Obj* obj) { mpAtObj = obj; }
void SetCoHitLen(f32 len) { mCoHitLen = len; }
cCcD_Obj* GetAtHitObj() const { return mpAtObj; }
cCcD_Obj* GetCoHitObj() const { return mpCoObj; }
f32 GetCoHitLen() const { return mCoHitLen; }
void ClearPointer() {
mpArea = NULL;
mpAtObj = NULL;
mpCoObj = NULL;
mCoHitLen = 0.0f;
}
};
class dCcMassS_Mng {
public:
/* 0x0000 */ cCcD_DivideArea mDivideArea;
/* 0x0040 */ s32 mMassObjCount;
/* 0x0044 */ dCcMassS_Obj mMassObjs[5];
/* 0x00BC */ s32 mMassAreaCount;
/* 0x00C0 */ dCcMassS_Obj mMassAreas[2];
/* 0x00F0 */ cCcD_CylAttr mCylAttr;
/* 0x0128 */ u8 field_0x128;
/* 0x0129 */ u8 mResultCamBit;
/* 0x012C */ u32 mFlag;
/* 0x0130 */ u32 mResultCam;
/* 0x0134 */ Vec mCamTopPos;
/* 0x0140 */ f32 mCamTopDist;
/* 0x0144 */ Vec mCamBottomPos;
/* 0x0150 */ f32 mCamBottomDist;
/* 0x0154 */ cCcD_CpsAttr mCpsAttr;
/* 0x0194 */ cCcD_DivideInfo mDivideInfo;
/* 0x019C vtable */
public:
dCcMassS_Mng();
virtual ~dCcMassS_Mng() {}
void Ct();
void SetAttr(f32 radius, f32 height, u8 param_2, u8 param_3) {
mCylAttr.SetR(radius);
mCylAttr.SetH(height);
field_0x128 = param_2;
mResultCamBit = param_3;
}
void Prepare();
u32 Chk(cXyz* p_xyz, fopAc_ac_c** p_actor, dCcMassS_HitInf* p_hitInf);
void Clear();
void Set(cCcD_Obj* p_obj, u8 priority);
void SetAreaChk(cCcD_Obj*, u8, void (*)(fopAc_ac_c*, cXyz*, u32));
void SetCam(cM3dGCps const& cps);
u32 GetResultCam() const;
void GetCamTopPos(Vec* p_out);
};
STATIC_ASSERT(sizeof(dCcMassS_Mng) == 0x1A0);
#endif /* D_CC_D_CC_MASS_S_H */