mirror of
https://github.com/zeldaret/tww.git
synced 2026-09-01 09:23:08 -04:00
d_attention 100% (#701)
* Add helper functions for d_attention
* Copy and adapt code from TP
* Move for better matching layout
* Clean up includes for d_attention.cpp
* Give dAttention_c::nextAttention a return
* Use enums in dAttention_c::getActionBtnB and slight reformat
* Change return types for comparison code to match
I don't love this
* Implement dAttList_c::calcWeight
* Implement dAttention_c::sortList
* Implement dAttDraw_c::draw
* Implement dAttDraw_c::setAnm
* Implement dAttention_c::chaseAttention
* Implement judgement related functions
* Implement dAttention_c::Run and runDrawProc
* Implement dAttention_c::Draw
Actually finish Draw
* Looks like dAttention_c::stockAttention had an unused return value
* Give d_Attention_c::mLockOnState an enum
* Rename field_0x02c to mDrawAttnPos based on TP
* Add comments for fields of d_attention
* Give d_attention's flags an enum (although without names)
* Undo type change for dAttention_c::{chk,set,clr}Flag
Co-Authored-By: LagoLunatic <LagoLunatic@users.noreply.github.com>
* Do not spell the `this` pointer
Co-Authored-By: LagoLunatic <LagoLunatic@users.noreply.github.com>
* Deal with resource enums and inlines
* Move PLAYER_STATUS_FLAG_MAGIC_JUDGEMENT to daPy__PlayerStatus0 enum
* Use inlines and macros
* Add mDoCPd_L_LOCK_BUTTON inline, debug maps claim it exists
Nothing else uses it
* Update TODO comments
* Debug maps claim runXyCheckCB was used but it only makes sense if modified
* Use dComIfGp_getPlayer instead of directly indexing the array
* Locate a few more inlines
* Do not cast to AttentionFlags enum type
* Update configure script
---------
Co-authored-by: LagoLunatic <LagoLunatic@users.noreply.github.com>
This commit is contained in:
+71
-31
@@ -41,16 +41,16 @@ public:
|
||||
fopAc_ac_c* convPId(fpc_ProcID);
|
||||
void init();
|
||||
void proc();
|
||||
void request(fopAc_ac_c*, u8, f32, f32, f32, s16, int);
|
||||
bool request(fopAc_ac_c*, u8, f32, f32, f32, s16, int);
|
||||
|
||||
fopAc_ac_c* getCatghTarget() { return convPId(mCatghTargetID); }
|
||||
u8 getChangeItem() { return mChangeItem; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ fpc_ProcID field_0x0;
|
||||
/* 0x00 */ fpc_ProcID mRequestActorID;
|
||||
/* 0x04 */ int field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ u8 field_0xc;
|
||||
/* 0x08 */ f32 mDistance;
|
||||
/* 0x0C */ u8 mCatchItemNo;
|
||||
/* 0x0D */ u8 field_0xd;
|
||||
/* 0x0E */ u8 field_0xe;
|
||||
/* 0x0F */ u8 field_0xf;
|
||||
@@ -60,14 +60,14 @@ private:
|
||||
|
||||
class dAttParam_c {
|
||||
public:
|
||||
/* 0x00 */ u16 field_0x00;
|
||||
/* 0x00 */ u16 mFlags;
|
||||
/* 0x02 */ u8 field_0x02[0x04 - 0x02];
|
||||
/* 0x04 */ f32 field_0x04;
|
||||
/* 0x08 */ f32 field_0x08;
|
||||
/* 0x0C */ f32 field_0x0c;
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
/* 0x14 */ f32 field_0x14;
|
||||
/* 0x18 */ f32 field_0x18;
|
||||
/* 0x10 */ f32 mDangerBGMDistance;
|
||||
/* 0x14 */ f32 mBGMDistMargin;
|
||||
/* 0x18 */ f32 mSWModeDisable;
|
||||
|
||||
public:
|
||||
dAttParam_c() {}
|
||||
@@ -83,15 +83,15 @@ public:
|
||||
fopAc_ac_c* convPId(fpc_ProcID);
|
||||
void init();
|
||||
void proc();
|
||||
void request(fopAc_ac_c*, f32, f32, f32, s16, int);
|
||||
void requestF(fopAc_ac_c*, s16, int);
|
||||
bool request(fopAc_ac_c*, f32, f32, f32, s16, int);
|
||||
bool requestF(fopAc_ac_c*, s16, int);
|
||||
|
||||
fpc_ProcID getLookTarget() { return mLookTargetID; }
|
||||
|
||||
private:
|
||||
/* 0x0 */ fpc_ProcID field_0x0;
|
||||
/* 0x4 */ u32 field_0x4;
|
||||
/* 0x8 */ f32 field_0x8;
|
||||
/* 0x0 */ fpc_ProcID mRequestActorID;
|
||||
/* 0x4 */ s32 field_0x4;
|
||||
/* 0x8 */ f32 mDistance;
|
||||
/* 0xC */ fpc_ProcID mLookTargetID;
|
||||
}; // Size: 0x10
|
||||
|
||||
@@ -115,7 +115,46 @@ public:
|
||||
|
||||
class daPy_lk_c;
|
||||
|
||||
enum AttentionFlags {
|
||||
AttnFlag_00000001 = 0x00000001,
|
||||
AttnFlag_00000002 = 0x00000002,
|
||||
AttnFlag_00000004 = 0x00000004,
|
||||
AttnFlag_00000008 = 0x00000008,
|
||||
AttnFlag_00000010 = 0x00000010,
|
||||
AttnFlag_00000020 = 0x00000020,
|
||||
AttnFlag_00000040 = 0x00000040,
|
||||
AttnFlag_00000080 = 0x00000080,
|
||||
AttnFlag_00000100 = 0x00000100,
|
||||
AttnFlag_00000200 = 0x00000200,
|
||||
AttnFlag_00000400 = 0x00000400,
|
||||
AttnFlag_00000800 = 0x00000800,
|
||||
AttnFlag_00001000 = 0x00001000,
|
||||
AttnFlag_00002000 = 0x00002000,
|
||||
AttnFlag_00004000 = 0x00004000,
|
||||
AttnFlag_00008000 = 0x00008000,
|
||||
AttnFlag_00010000 = 0x00010000,
|
||||
AttnFlag_00020000 = 0x00020000,
|
||||
AttnFlag_00040000 = 0x00040000,
|
||||
AttnFlag_00080000 = 0x00080000,
|
||||
AttnFlag_00100000 = 0x00100000,
|
||||
AttnFlag_00200000 = 0x00200000,
|
||||
AttnFlag_00400000 = 0x00400000,
|
||||
AttnFlag_00800000 = 0x00800000,
|
||||
AttnFlag_01000000 = 0x01000000,
|
||||
AttnFlag_02000000 = 0x02000000,
|
||||
AttnFlag_04000000 = 0x04000000,
|
||||
AttnFlag_08000000 = 0x08000000,
|
||||
AttnFlag_10000000 = 0x10000000,
|
||||
AttnFlag_20000000 = 0x20000000,
|
||||
AttnFlag_40000000 = 0x40000000,
|
||||
AttnFlag_80000000 = 0x80000000,
|
||||
};
|
||||
class dAttention_c {
|
||||
enum LockState {
|
||||
LockState_NONE = 0,
|
||||
LockState_LOCK = 1,
|
||||
LockState_RELEASE = 2,
|
||||
};
|
||||
public:
|
||||
dAttention_c() {}
|
||||
|
||||
@@ -129,7 +168,7 @@ public:
|
||||
dAttList_c* getActionBtnX();
|
||||
dAttList_c* getActionBtnY();
|
||||
dAttList_c* getActionBtnZ();
|
||||
u32 chkAttMask(u32, u32);
|
||||
s32 chkAttMask(u32, u32);
|
||||
f32 calcWeight(int, fopAc_ac_c*, f32, s16, s16, u32*);
|
||||
void setLList(fopAc_ac_c*, f32, f32, u32);
|
||||
void setAList(fopAc_ac_c*, f32, f32, u32);
|
||||
@@ -137,10 +176,10 @@ public:
|
||||
s32 makeList();
|
||||
int SelectAttention(fopAc_ac_c*);
|
||||
void sortList();
|
||||
void stockAttention(u32);
|
||||
void nextAttention(u32);
|
||||
fopAc_ac_c *stockAttention(u32);
|
||||
fopAc_ac_c *nextAttention(u32);
|
||||
s32 freeAttention();
|
||||
void chaseAttention();
|
||||
bool chaseAttention();
|
||||
f32 EnemyDistance(fopAc_ac_c*);
|
||||
void runSoundProc();
|
||||
void runDrawProc();
|
||||
@@ -148,13 +187,13 @@ public:
|
||||
void runDebugDisp();
|
||||
void judgementButton();
|
||||
void judgementTriggerProc();
|
||||
void judgementLostCheck();
|
||||
int judgementLostCheck();
|
||||
void judgementStatusSw(u32);
|
||||
void judgementStatusHd(u32);
|
||||
void Run(u32);
|
||||
bool Run(u32 interactMask);
|
||||
void Draw();
|
||||
fopAc_ac_c* LockonTarget(s32);
|
||||
void LockonReleaseDistanse();
|
||||
f32 LockonReleaseDistanse();
|
||||
fpc_ProcID LockonTargetPId(s32);
|
||||
fopAc_ac_c* ActionTarget(s32);
|
||||
bool LockonTruth();
|
||||
@@ -169,12 +208,12 @@ public:
|
||||
bool chkFlag(u32 flag) { return (mFlags & flag) ? true : false; }
|
||||
void setFlag(u32 flag) { mFlags |= flag; }
|
||||
void clrFlag(u32 flag) { mFlags &= ~flag; }
|
||||
bool Lockon() { return LockonTruth() || chkFlag(0x20000000); } // regswap
|
||||
bool Lockon() { return LockonTruth() || chkFlag(AttnFlag_20000000); } // regswap
|
||||
void offAleart() {
|
||||
setFlag(0x80000000);
|
||||
setFlag(AttnFlag_80000000);
|
||||
}
|
||||
void revivalAleart() {
|
||||
clrFlag(0x80000000);
|
||||
clrFlag(AttnFlag_80000000);
|
||||
}
|
||||
|
||||
void CatchRequest(fopAc_ac_c* param_0, u8 param_1, f32 param_2, f32 param_3,
|
||||
@@ -194,10 +233,12 @@ public:
|
||||
|
||||
static s32 loc_type_num;
|
||||
static u32 act_type_num;
|
||||
static struct LocTbl {
|
||||
struct LocTbl {
|
||||
s16 mType;
|
||||
u16 mMask;
|
||||
} loc_type_tbl[3];
|
||||
};
|
||||
static LocTbl loc_type_tbl[3];
|
||||
static LocTbl act_type_tbl[5];
|
||||
static struct DistTbl {
|
||||
f32 mDistXZMax;
|
||||
f32 mDistXZMaxRelease;
|
||||
@@ -222,19 +263,18 @@ public:
|
||||
/* 0x008 */ dAttDraw_CallBack_c mCallBack;
|
||||
/* 0x00C */ int mPlayerNo;
|
||||
/* 0x010 */ u32 mFlagMask;
|
||||
/* 0x014 */ u8 field_0x014[0x018 - 0x014];
|
||||
/* 0x014 */ u8 field_0x014[0x018 - 0x014]; // seemingly unused but removing this yields a smaller structure
|
||||
/* 0x018 */ u8 mLockOnState;
|
||||
/* 0x019 */ u8 field_0x019;
|
||||
/* 0x019 */ u8 field_0x019; // data copied from mLockState, looks to be same as TP's dAttention_c::field_0x32a
|
||||
/* 0x01A */ u8 field_0x01a;
|
||||
/* 0x01B */ u8 field_0x01b;
|
||||
/* 0x01C */ s16 field_0x01c;
|
||||
/* 0x01E */ u8 field_0x01E[0x020 - 0x01E];
|
||||
/* 0x020 */ u32 mFlags;
|
||||
/* 0x024 */ JKRSolidHeap* heap;
|
||||
/* 0x028 */ s8 field_0x028;
|
||||
/* 0x02C */ cXyz field_0x02c;
|
||||
/* 0x028 */ s8 field_0x028; // looks to be same as TP's dAttention_c::field_0x328
|
||||
/* 0x02C */ cXyz mDrawAttnPos;
|
||||
/* 0x038 */ dAttDraw_c draw[2];
|
||||
/* 0x050 */ u32 field_0x050;
|
||||
/* 0x050 */ u32 mlockedOnPId;
|
||||
/* 0x054 */ dAttList_c mLockOnList[8];
|
||||
/* 0x0D4 */ int mLockOnNum;
|
||||
/* 0x0D8 */ int mLockOnOffs;
|
||||
|
||||
@@ -66,6 +66,14 @@ enum daPy__PlayerStatus0 {
|
||||
daPyStts0_UNK20000000_e = 0x20000000,
|
||||
daPyStts0_SPIN_ATTACK_e = 0x40000000,
|
||||
daPyStts0_UNK80000000_e = 0x80000000,
|
||||
|
||||
// This is some combination of flags which is seemingly related to "judgement", used in dAttention_c
|
||||
daPyStts0_UNK37a02371_e = daPyStts0_UNK1_e | daPyStts0_UNK10_e | daPyStts0_UNK20_e
|
||||
| daPyStts0_UNK40_e | daPyStts0_UNK100_e | daPyStts0_UNK200_e
|
||||
| daPyStts0_UNK2000_e| daPyStts0_TELESCOPE_LOOK_e
|
||||
| daPyStts0_UNK800000_e | daPyStts0_UNK1000000_e
|
||||
| daPyStts0_UNK2000000_e | daPyStts0_UNK4000000_e
|
||||
| daPyStts0_UNK10000000_e | daPyStts0_UNK20000000_e
|
||||
};
|
||||
|
||||
enum daPy__PlayerStatus1 {
|
||||
@@ -3855,7 +3863,7 @@ inline fopAc_ac_c* dComIfGp_att_getCatghTarget() {
|
||||
}
|
||||
|
||||
inline void dComIfGp_att_ChangeOwner() {
|
||||
dComIfGp_getAttention().setFlag(0x80);
|
||||
dComIfGp_getAttention().setFlag(AttnFlag_00000080);
|
||||
}
|
||||
|
||||
inline fopAc_ac_c* dComIfGp_att_getLookTarget() {
|
||||
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
void setXyCheckCB(CallbackFunc cb) { mpCheckCB = cb; }
|
||||
s16 runXyCheckCB(void* ac, int i_itemBtn) {
|
||||
if (mpCheckCB == NULL)
|
||||
return -1;
|
||||
return 1;
|
||||
return mpCheckCB(ac, i_itemBtn);
|
||||
}
|
||||
void setPhotoEventCB(CallbackFunc cb) { mpPhotoCB = cb; }
|
||||
|
||||
@@ -36,4 +36,8 @@ extern interface_of_controller_pad g_mDoCPd_cpadInfo[4];
|
||||
int mDoCPd_Create();
|
||||
int mDoCPd_Read();
|
||||
|
||||
inline bool mDoCPd_L_LOCK_BUTTON(unsigned long i_playerNo) {
|
||||
return g_mDoCPd_cpadInfo[i_playerNo].mHoldLockL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user