Skip to content

Commit 60748d0

Browse files
authored
b_dr equivalent, update dtk-template (#2327)
* d_a_tag_allmato almost done * d_a_swhit0 done * some SSystem cleanup * treesh done * swball done, some other rel cleanup * b_dr equivalent * update dtk-template * rename j3dframectrl mode enum
1 parent 34c5d82 commit 60748d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+5286
-3882
lines changed

configure.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@
155155
# Tool versions
156156
config.binutils_tag = "2.42-1"
157157
config.compilers_tag = "20240706"
158-
config.dtk_tag = "v1.2.0"
159-
config.objdiff_tag = "v2.3.4"
158+
config.dtk_tag = "v1.3.0"
159+
config.objdiff_tag = "v2.7.1"
160160
config.sjiswrap_tag = "v1.2.0"
161161
config.wibo_tag = "0.6.11"
162162

@@ -183,6 +183,10 @@
183183
# Use for any additional files that should cause a re-configure when modified
184184
config.reconfig_deps = []
185185

186+
# Optional numeric ID for decomp.me preset
187+
# Can be overridden in libraries or objects
188+
config.scratch_preset_id = 69 # Twilight Princess (DOL)
189+
186190
# Base flags, common to most GC/Wii games.
187191
# Generally leave untouched, with overrides added below.
188192
cflags_base = [
@@ -352,7 +356,7 @@ def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
352356

353357
# Helper function for actor RELs
354358
def ActorRel(status: bool, rel_name: str, extra_cflags: List[str]=[]) -> Dict[str, Any]:
355-
return Rel(rel_name, [Object(status, f"d/actor/{rel_name}.cpp", extra_cflags=extra_cflags)])
359+
return Rel(rel_name, [Object(status, f"d/actor/{rel_name}.cpp", extra_cflags=extra_cflags, scratch_preset_id=70)])
356360

357361

358362
# Helper function for JSystem libraries
@@ -1572,7 +1576,7 @@ def MatchingFor(*versions):
15721576
ActorRel(NonMatching, "d_a_L7op_demo_dr"),
15731577
ActorRel(MatchingFor("GZ2E01"), "d_a_b_bh"),
15741578
ActorRel(NonMatching, "d_a_b_bq"),
1575-
ActorRel(NonMatching, "d_a_b_dr"),
1579+
ActorRel(Equivalent, "d_a_b_dr"), # weak func order
15761580
ActorRel(Equivalent, "d_a_b_dre"), # weak func order
15771581
ActorRel(NonMatching, "d_a_b_ds"),
15781582
ActorRel(NonMatching, "d_a_b_gg"),
@@ -2245,6 +2249,21 @@ def emit_build_rule(asset):
22452249
for asset in module.get("extract", []):
22462250
emit_build_rule(asset)
22472251

2252+
# Optional callback to adjust link order. This can be used to add, remove, or reorder objects.
2253+
# This is called once per module, with the module ID and the current link order.
2254+
#
2255+
# For example, this adds "dummy.c" to the end of the DOL link order if configured with --non-matching.
2256+
# "dummy.c" *must* be configured as a Matching (or Equivalent) object in order to be linked.
2257+
def link_order_callback(module_id: int, objects: List[str]) -> List[str]:
2258+
# Don't modify the link order for matching builds
2259+
if not config.non_matching:
2260+
return objects
2261+
if module_id == 0: # DOL
2262+
return objects + ["dummy.c"]
2263+
return objects
2264+
2265+
# Uncomment to enable the link order callback.
2266+
# config.link_order_callback = link_order_callback
22482267

22492268
# Optional extra categories for progress tracking
22502269
config.progress_categories = [

include/JSystem/J3DGraphAnimator/J3DAnimation.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -896,11 +896,11 @@ class J3DAnmVisibilityFull : public J3DAnmBase {
896896
class J3DFrameCtrl {
897897
public:
898898
enum Attribute_e {
899-
LOOP_ONCE_e,
900-
LOOP_ONCE_RESET_e,
901-
LOOP_REPEAT_e,
902-
LOOP_MIRROR_ONCE_e,
903-
LOOP_MIRROR_REPEAT_e,
899+
EMode_NONE,
900+
EMode_RESET,
901+
EMode_LOOP,
902+
EMode_REVERSE,
903+
EMode_LOOP_REVERSE,
904904
};
905905

906906
J3DFrameCtrl() { this->init(0); }

include/d/actor/d_a_b_dr.h

Lines changed: 88 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "d/d_cc_d.h"
77
#include "d/d_msg_flow.h"
88
#include "d/d_bg_s_acch.h"
9+
#include "m_Do/m_Do_hostIO.h"
910

1011
/**
1112
* @ingroup actors-enemies
@@ -17,9 +18,9 @@
1718
*/
1819
class daB_DR_c : public fopEn_enemy_c {
1920
public:
20-
/* 805BAF80 */ void ctrlJoint(J3DJoint*, J3DModel*);
21-
/* 805BB120 */ void JointCallBack(J3DJoint*, int);
22-
/* 805BB16C */ void draw();
21+
/* 805BAF80 */ int ctrlJoint(J3DJoint*, J3DModel*);
22+
/* 805BB120 */ static int JointCallBack(J3DJoint*, int);
23+
/* 805BB16C */ int draw();
2324
/* 805BB408 */ void setBck(int, u8, f32, f32);
2425
/* 805BB4B4 */ void setActionMode(int, int);
2526
/* 805BB4CC */ void mGlider_WindPosSet();
@@ -37,25 +38,25 @@ class daB_DR_c : public fopEn_enemy_c {
3738
/* 805BCBF4 */ void mCountClr();
3839
/* 805BCC18 */ void mAllClr();
3940
/* 805BCC4C */ void mHeadAngleSet();
40-
/* 805BCD7C */ void flapMove(bool);
41-
/* 805BCEA4 */ void revolutionMove();
42-
/* 805BD05C */ void mPlayerHighCheck();
43-
/* 805BD15C */ void mBgFallGroundCheck();
41+
/* 805BCD7C */ bool flapMove(bool);
42+
/* 805BCEA4 */ bool revolutionMove();
43+
/* 805BD05C */ bool mPlayerHighCheck();
44+
/* 805BD15C */ bool mBgFallGroundCheck();
4445
/* 805BD3E4 */ void normalHoverMove();
4546
/* 805BD5FC */ void executeWait();
4647
/* 805BD98C */ void executeFlyWait();
4748
/* 805BDBC4 */ void executeTailHit();
4849
/* 805BE9B4 */ void executeWeekHit();
4950
/* 805BF4C8 */ void mBreathSet();
50-
/* 805BF768 */ void mBreathHighSet(bool);
51-
/* 805BFA6C */ void mFeintBreath();
51+
/* 805BF768 */ bool mBreathHighSet(bool);
52+
/* 805BFA6C */ bool mFeintBreath();
5253
/* 805BFD88 */ void executeBreathAttack();
5354
/* 805C062C */ void executeWindAttack();
54-
/* 805C0CAC */ void mGliderMoveSub(f32);
55+
/* 805C0CAC */ bool mGliderMoveSub(f32);
5556
/* 805C0EF8 */ void executeGliderAttack();
5657
/* 805C1E0C */ void executePillarSearch();
5758
/* 805C24BC */ void executePillarWait();
58-
/* 805C2BE8 */ void startDemoCheck();
59+
/* 805C2BE8 */ bool startDemoCheck();
5960
/* 805C2CD0 */ void executeDamageDemo();
6061
/* 805C3558 */ void executeMiddleDemo();
6162
/* 805C36A4 */ void executeDead();
@@ -69,38 +70,38 @@ class daB_DR_c : public fopEn_enemy_c {
6970
/* 805C46E0 */ void cc_set();
7071
/* 805C4E14 */ void down_cc_set();
7172
/* 805C4FB4 */ void demo_skip(int);
72-
/* 805C50BC */ void DemoSkipCallBack(void*, int);
73-
/* 805C50F0 */ void execute();
74-
/* 805C55B0 */ void _delete();
75-
/* 805C56A4 */ void CreateHeap();
76-
/* 805C5974 */ void create();
73+
/* 805C50BC */ static int DemoSkipCallBack(void*, int);
74+
/* 805C50F0 */ int execute();
75+
/* 805C55B0 */ int _delete();
76+
/* 805C56A4 */ int CreateHeap();
77+
/* 805C5974 */ int create();
7778
/* 805C62B0 */ daB_DR_c();
7879

7980
MtxP getMtx() { return mpModelMorf->getModel()->getAnmMtx(15); }
8081

8182
void onTarget() { mTarget = true; }
82-
bool isBack() { return mPrm0; }
83+
bool isBack() { return arg0; }
8384

8485
private:
8586
/* 0x05AC */ request_of_phase_process_class mPhase;
8687
/* 0x05B4 */ mDoExt_McaMorfSO* mpModelMorf;
8788
/* 0x05B8 */ J3DModel* mpPartModel;
8889
/* 0x05BC */ mDoExt_brkAnm* mpCoreBrk;
89-
/* 0x05C0 */ Z2CreatureEnemy field_0x5c0;
90-
/* 0x0664 */ Z2CreatureEnemy field_0x664;
91-
/* 0x0708 */ int mAction;
92-
/* 0x070C */ int mMode;
93-
/* 0x0710 */ int mAnmID;
90+
/* 0x05C0 */ Z2CreatureEnemy mSound;
91+
/* 0x0664 */ Z2CreatureEnemy mSound2;
92+
/* 0x0708 */ int mActionMode;
93+
/* 0x070C */ int mMoveMode;
94+
/* 0x0710 */ int mAnm;
9495
/* 0x0714 */ u8 field_0x714[0x0718 - 0x0714];
9596
/* 0x0718 */ int field_0x718;
96-
/* 0x071C */ u8 field_0x71C[0x0720 - 0x071C];
97-
/* 0x0720 */ f32 field_0x720;
97+
/* 0x071C */ u32 mShadowKey;
98+
/* 0x0720 */ f32 mTargetHeight;
9899
/* 0x0724 */ f32 field_0x724;
99100
/* 0x0728 */ f32 field_0x728;
100101
/* 0x072C */ f32 field_0x72c;
101-
/* 0x0730 */ u8 field_0x730[0x0734 - 0x0730];
102+
/* 0x0730 */ f32 field_0x730;
102103
/* 0x0734 */ f32 field_0x734;
103-
/* 0x0738 */ u8 field_0x738[0x073C - 0x0738];
104+
/* 0x0738 */ f32 field_0x738;
104105
/* 0x073C */ f32 field_0x73c;
105106
/* 0x0740 */ f32 field_0x740;
106107
/* 0x0744 */ f32 field_0x744;
@@ -111,44 +112,41 @@ class daB_DR_c : public fopEn_enemy_c {
111112
/* 0x0752 */ s16 field_0x752;
112113
/* 0x0754 */ s16 field_0x754;
113114
/* 0x0756 */ s16 field_0x756;
114-
/* 0x0758 */ s16 field_0x758;
115-
/* 0x075A */ s16 field_0x75a;
116-
/* 0x075C */ u8 field_0x75C[0x0760 - 0x075C];
115+
/* 0x0758 */ csXyz mHeadAngle;
117116
/* 0x0760 */ cXyz field_0x760;
118-
/* 0x076C */ cXyz field_0x76c;
117+
/* 0x076C */ cXyz mBoot_c_trance;
119118
/* 0x0778 */ cXyz field_0x778;
120119
/* 0x0784 */ cXyz field_0x784;
121120
/* 0x0790 */ cXyz field_0x790;
122-
/* 0x079C */ cXyz field_0x79c;
121+
/* 0x079C */ cXyz mGlider_WindPos;
123122
/* 0x07A8 */ cXyz field_0x7a8;
124123
/* 0x07B4 */ cXyz field_0x7b4;
125124
/* 0x07C0 */ int mTimer[4];
126125
/* 0x07D0 */ u8 field_0x7d0;
127126
/* 0x07D1 */ u8 field_0x7d1;
128-
/* 0x07D2 */ u8 field_0x7d2;
127+
/* 0x07D2 */ u8 mBreakPartsNo;
129128
/* 0x07D3 */ u8 field_0x7d3;
130129
/* 0x07D4 */ u8 field_0x7d4;
131-
/* 0x07D5 */ u8 field_0x7D5[0x07D6 - 0x07D5];
130+
/* 0x07D5 */ u8 field_0x7d5;
132131
/* 0x07D6 */ u8 field_0x7d6;
133132
/* 0x07D7 */ u8 field_0x7d7;
134-
/* 0x07D8 */ u8 field_0x7D8[0x07D9 - 0x07D8];
133+
/* 0x07D8 */ u8 field_0x7d8;
135134
/* 0x07D9 */ u8 mTarget;
136-
/* 0x07DA */ u8 field_0x7DA[0x07DB - 0x07DA];
135+
/* 0x07DA */ u8 field_0x7da;
137136
/* 0x07DB */ u8 field_0x7db;
138-
/* 0x07DC */ u8 field_0x7DC[0x07E0 - 0x07DC];
137+
/* 0x07DC */ u8 field_0x7dc;
139138
/* 0x07E0 */ int field_0x7e0;
140-
/* 0x07E4 */ u8 field_0x7e4[4];
139+
/* 0x07E4 */ u8 mCount[4];
141140
/* 0x07E8 */ u8 field_0x7e8;
142-
/* 0x07E9 */ u8 field_0x7E9[0x07EA - 0x07E9];
143-
/* 0x07EA */ u8 mPrm0;
144-
/* 0x07EB */ u8 field_0x7eb;
145-
/* 0x07EC */ u8 mPrm1;
146-
/* 0x07ED */ u8 mPrm2;
147-
/* 0x07EE */ u8 mPrm3;
148-
/* 0x07EF */ u8 field_0x7EF[0x07F0 - 0x07EF];
141+
/* 0x07E9 */ u8 field_0x7e9;
142+
/* 0x07EA */ u8 arg0;
143+
/* 0x07EB */ u8 mPartNo;
144+
/* 0x07EC */ u8 bitSw;
145+
/* 0x07ED */ u8 bitSw2;
146+
/* 0x07EE */ u8 bitSw3;
149147
/* 0x07F0 */ dBgS_AcchCir mAcchCir;
150148
/* 0x0830 */ dBgS_ObjAcch mAcch;
151-
/* 0x0A08 */ dCcD_Stts field_0xa08;
149+
/* 0x0A08 */ dCcD_Stts mColliderStts;
152150
/* 0x0A44 */ dCcD_Cyl mWeekCc;
153151
/* 0x0B80 */ dCcD_Sph mFootAtCc[2];
154152
/* 0x0DF0 */ dCcD_Sph field_0xdf0;
@@ -162,14 +160,16 @@ class daB_DR_c : public fopEn_enemy_c {
162160
/* 0x2174 */ dCcD_Cyl mDownCc[5];
163161
/* 0x27A0 */ u8 field_0x27A0[0x27A8 - 0x27A0];
164162
/* 0x27A8 */ Z2CreatureEnemy* field_0x27a8;
165-
/* 0x27AC */ u8 field_0x27AC[0x27C4 - 0x27AC];
166-
/* 0x27C4 */ cXyz field_0x27c4;
167-
/* 0x27D0 */ cXyz field_0x27d0;
163+
/* 0x27AC */ u8 field_0x27AC[0x27BE - 0x27AC];
164+
/* 0x27BE */ u8 field_0x27be;
165+
/* 0x27BF */ u8 field_0x27bf[0x27C4 - 0x27BF];
166+
/* 0x27C4 */ cXyz mDemoCamEye;
167+
/* 0x27D0 */ cXyz mDemoCamCenter;
168168
/* 0x27DC */ u32 field_0x27dc[4];
169169
/* 0x27EC */ u32 field_0x27ec[4];
170170
/* 0x27FC */ u32 field_0x27fc[4];
171171
/* 0x280C */ u32 field_0x280c;
172-
/* 0x2810 */ u8 field_0x2810[0x2814 - 0x2810];
172+
/* 0x2810 */ u8 mInitHIO;
173173
/* 0x2814 */ dMsgFlow_c mMsgFlow;
174174
};
175175

@@ -179,7 +179,45 @@ STATIC_ASSERT(sizeof(daB_DR_c) == 0x2860);
179179
class daB_DR_HIO_c {
180180
public:
181181
/* 805BAE6C */ daB_DR_HIO_c();
182-
/* 805C6B94 */ ~daB_DR_HIO_c();
182+
/* 805C6B94 */ virtual ~daB_DR_HIO_c() {}
183+
184+
/* 0x04 */ s8 field_0x4;
185+
/* 0x08 */ f32 model_size;
186+
/* 0x0C */ f32 fall_accel;
187+
/* 0x10 */ f32 fall_accel_max;
188+
/* 0x14 */ f32 wind_large_attack_lockon_range;
189+
/* 0x18 */ f32 unk_0x18;
190+
/* 0x1C */ f32 wind_small_attack_power;
191+
/* 0x20 */ f32 wind_attack_power;
192+
/* 0x24 */ f32 glide_wind_power;
193+
/* 0x28 */ f32 breath_attack_threshold;
194+
/* 0x2C */ f32 unk_0x2c;
195+
/* 0x30 */ f32 breath_move_speed_max;
196+
/* 0x34 */ f32 breath_move_speed_min;
197+
/* 0x38 */ s16 tail_hit_chance_time;
198+
/* 0x3A */ s16 center_wind_time;
199+
/* 0x3C */ s16 breath_continue_time;
200+
/* 0x3E */ s16 breath_continue_no_armor_time;
201+
/* 0x40 */ s16 breath_feint1_time;
202+
/* 0x42 */ s16 breath_feint2_time;
203+
/* 0x44 */ s16 breath_feint3_time;
204+
/* 0x46 */ s16 no_attack_time;
205+
/* 0x48 */ s16 unk_0x48;
206+
/* 0x4A */ s16 no_attack_no_armor_time;
207+
/* 0x4C */ s16 unk_0x4c;
208+
/* 0x4E */ s16 back_hit_chance_time;
209+
/* 0x50 */ s16 after_breath_chance_time;
210+
/* 0x52 */ s16 neck_search_speed;
211+
/* 0x54 */ s16 neck_search2_speed;
212+
/* 0x56 */ s16 neck_search_speed_max;
213+
/* 0x58 */ s16 body_search_speed;
214+
/* 0x5A */ s16 body_search2_speed;
215+
/* 0x5C */ s16 body_search_speed_max;
216+
/* 0x5E */ s16 body_search_feint_speed_max;
217+
/* 0x60 */ s16 feint_angle;
218+
/* 0x62 */ s16 unk_0x62;
219+
/* 0x64 */ u8 display_range;
220+
/* 0x65 */ u8 breath_feint2_OFF;
183221
};
184222

185223
#endif /* D_A_B_DR_H */

include/d/actor/d_a_player.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,7 @@ class daPy_py_c : public fopAc_ac_c {
932932
u32 getCutAtFlg() const { return checkNoResetFlg0(FLG0_UNK_40); }
933933
u32 checkBoarSingleBattleFirst() const { return checkNoResetFlg2(FLG2_BOAR_SINGLE_BATTLE); }
934934
u32 checkBoarSingleBattleSecond() const { return checkNoResetFlg2(FLG2_UNK_1000000); }
935+
u32 getFootOnGround() const { return checkResetFlg1(daPy_RFLG1(RFLG1_UNK_10 | RFLG1_UNK_20)); }
935936

936937
void offWolfEnemyHangBite() { offNoResetFlg2(FLG2_WOLF_ENEMY_HANG_BITE); }
937938
bool onWolfEnemyHangBite(fopAc_ac_c* param_0) { return onWolfEnemyBiteAll(param_0, FLG2_WOLF_ENEMY_HANG_BITE); }
@@ -1073,6 +1074,8 @@ class daPy_py_c : public fopAc_ac_c {
10731074
static int getLastSceneDamage() { return (dComIfGs_getLastSceneMode() >> 4) & 0x7F; }
10741075
static u8 getLastSceneSwordAtUpTime() { return (dComIfGs_getLastSceneMode() >> 11) & 0xFF; }
10751076

1077+
static BOOL checkNormalSwordEquip() { return dComIfGs_getSelectEquipSword() == fpcNm_ITEM_SWORD; }
1078+
10761079
inline static u32 i_getLastSceneMode();
10771080
inline static u32 getLastSceneMode();
10781081
inline static bool checkWoodSwordEquip() {

0 commit comments

Comments
 (0)