Skip to content

Commit 0e0bf56

Browse files
committed
Minor d_a_alink improvements
1 parent bfeb1c0 commit 0e0bf56

File tree

12 files changed

+232
-265
lines changed

12 files changed

+232
-265
lines changed

include/JSystem/J3DGraphBase/J3DTransform.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ struct J3DTransformInfo {
3333
asm {
3434
psq_l var_f31, 0x0(var_r31), 0, 0
3535
psq_st var_f31, 0x0(var_r30), 0, 0
36-
lfs var_f0, 0x8(var_r31)
37-
stfs var_f0, 0x8(var_r30)
36+
lfs var_f31, 0x8(var_r31)
37+
stfs var_f31, 0x8(var_r30)
3838
lwz var_r0, 0xc(var_r31)
3939
stw var_r0, 0xc(var_r30)
4040
lha var_r0, 0x10(var_r31)

include/d/actor/d_a_obj_crope.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ class daObjCrope_c : public fopAc_ac_c {
2929
void onOutFlg() { mOutFlg = true; }
3030
void setFrontJoint(int i_jointNo) { mFrontJoint = i_jointNo; }
3131
void setBackJoint(int i_jointNo) { mBackJoint = i_jointNo; }
32-
32+
3333
f32 getStartRate(const cXyz* param_0) {
34-
return field_0x714 ? field_0x724 * (param_0->x - getRopeStartPos()->x) :
35-
field_0x724 * (param_0->z - getRopeStartPos()->z);
34+
if (field_0x714) {
35+
return field_0x724 * (param_0->x - getRopeStartPos()->x);
36+
} else {
37+
return field_0x724 * (param_0->z - getRopeStartPos()->z);
38+
}
3639
}
3740

3841
void rideKeep() {

src/d/actor/d_a_alink.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4466,12 +4466,11 @@ BOOL daAlink_c::checkHorseStart(u32 pLastMode, int pStartMode) {
44664466
}
44674467

44684468
/* 800A551C-800A5CC8 09FE5C 07AC+00 1/1 0/0 0/0 .text setStartProcInit__9daAlink_cFv */
4469-
// small regalloc, equivalent
44704469
int daAlink_c::setStartProcInit() {
44714470
BOOL sp10 = 0;
44724471
int start_mode = getStartMode();
44734472
u32 last_mode = getLastSceneMode();
4474-
daHorse_c* horsep = dComIfGp_getHorseActor();
4473+
daHorse_c* horsep = (daHorse_c*)dComIfGp_getHorseActor();
44754474
BOOL horse_start = checkHorseStart(last_mode, start_mode);
44764475

44774476
setDamagePoint(getLastSceneDamage(), last_mode == 4, 0, 1);
@@ -6616,15 +6615,14 @@ void daAlink_c::setFrameCtrl(daPy_frameCtrl_c* i_ctrl, u8 i_attr, s16 i_start, s
66166615
i_ctrl->setFrameCtrl(i_attr, i_start, i_end, i_rate, i_frame);
66176616
}
66186617

6619-
/* 80453278-80453280 001878 0008+00 1/1 0/0 0/0 .sdata2 kandelaarAnm$62207 */
6620-
static const daAlink_BckData kandelaarAnm[2] = {
6621-
{0x026A, 0x0268}, // waits, waitk
6622-
{0x0266, 0x0264}, // waiths, waithk
6623-
};
6624-
66256618
/* 800AC450-800AC558 0A6D90 0108+00 23/23 0/0 0/0 .text
66266619
* getMainBckData__9daAlink_cCFQ29daAlink_c11daAlink_ANM */
66276620
const daAlink_BckData* daAlink_c::getMainBckData(daAlink_c::daAlink_ANM i_anmID) const {
6621+
static const daAlink_BckData kandelaarAnm[2] = {
6622+
{0x026A, 0x0268}, // waits, waitk
6623+
{0x0266, 0x0264}, // waiths, waithk
6624+
};
6625+
66286626
if (mEquipItem == fpcNm_ITEM_KANTERA) {
66296627
if (i_anmID == ANM_WAIT) {
66306628
return &kandelaarAnm[0];
@@ -11178,11 +11176,10 @@ void daAlink_c::orderPeep() {
1117811176
}
1117911177
}
1118011178

11181-
/* 804532B0-804532B4 0018B0 0004+00 1/1 0/0 0/0 .sdata2 itemTalkType$67468 */
11182-
static const u16 itemTalkType[2] = {6, 7};
11183-
1118411179
/* 800B7BF8-800B7D4C 0B2538 0154+00 13/13 0/0 0/0 .text orderTalk__9daAlink_cFi */
1118511180
int daAlink_c::orderTalk(int i_checkZTalk) {
11181+
static const u16 itemTalkType[2] = {6, 7};
11182+
1118611183
if (notTalk()) {
1118711184
return 0;
1118811185
}
@@ -18712,7 +18709,6 @@ bool daAlink_c::checkItemDraw() {
1871218709

1871318710
/* 800CB694-800CBA38 0C5FD4 03A4+00 0/0 0/0 1/1 .text initShadowScaleLight__9daAlink_cFv
1871418711
*/
18715-
// NONMATCHING - float stuff
1871618712
int daAlink_c::initShadowScaleLight() {
1871718713
dKy_shadow_mode_set(4);
1871818714

@@ -18770,8 +18766,10 @@ int daAlink_c::initShadowScaleLight() {
1877018766
field_0x375c.x = current.pos.x - (var_f31 * temp_f29);
1877118767
field_0x375c.z = current.pos.z - (var_f31 * temp_f28);
1877218768
} else {
18773-
field_0x375c.x = current.pos.x - (-30.0f * temp_f29) - (65.0f * temp_f28);
18774-
field_0x375c.z = current.pos.z - (-30.0f * temp_f28) + (65.0f * temp_f29);
18769+
field_0x375c.x = current.pos.x - (temp_f29 * -30.0f) - (temp_f28 * 65.0f);
18770+
// likely fakematch - debug indicates there probably isn't a temp
18771+
f32 temp = current.pos.z - (temp_f28 * -30.0f);
18772+
field_0x375c.z = temp + (temp_f29 * 65.0f);
1877518773
}
1877618774

1877718775
if (checkReinRide()) {

src/d/actor/d_a_alink_crawl.inc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,26 @@ f32 daAlink_c::getCrawlMoveSpeed() {
2828

2929
/* 800F7CE8-800F7E48 0F2628 0160+00 4/4 0/0 0/0 .text setCrawlMoveDirectionArrow__9daAlink_cFv */
3030
void daAlink_c::setCrawlMoveDirectionArrow() {
31-
static const u8 data_80452F38[2] = {1, 4};
31+
static const u8 data_80452F38[1] = {1};
32+
static const u8 data_80452F39[1] = {4};
3233

3334
u8 direction = 0;
34-
camera_class* camera = dComIfGp_getCamera(field_0x317c);
35+
camera_class* camera = (camera_class*)dComIfGp_getCamera(field_0x317c);
3536
BOOL bvar = cLib_distanceAngleS(fopCamM_GetAngleY(camera), shape_angle.y) > 0x4000;
3637

3738
if (field_0x3198 & 4) {
3839
if (!bvar) {
39-
direction = data_80452F38[0];
40+
direction = *data_80452F38;
4041
} else {
41-
direction = data_80452F38[1];
42+
direction = *data_80452F39;
4243
}
4344
}
4445

4546
if (field_0x3198 & 8) {
4647
if (!bvar) {
47-
direction |= data_80452F38[1];
48+
direction |= *data_80452F39;
4849
} else {
49-
direction |= data_80452F38[0];
50+
direction |= *data_80452F38;
5051
}
5152
}
5253

src/d/actor/d_a_alink_cut.inc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,9 +1696,8 @@ int daAlink_c::procCutTurnInit(int param_0, int param_1) {
16961696

16971697
setSingleAnime(anmID, anm_data->mSpeed, var_f31, anm_data->mEndFrame, morf);
16981698

1699-
int var_r29_3;
17001699
if (checkCutLargeTurnState()) {
1701-
var_r29_3 = 4;
1700+
param_1 = 4;
17021701
field_0x32cc = Z2SE_AL_KAITEN_L_SLASH;
17031702
setSwordVoiceSe(Z2SE_AL_V_KAITENGIRI_L);
17041703
field_0x3478 = cutData->mLargeAttackRadius;
@@ -1710,7 +1709,7 @@ int daAlink_c::procCutTurnInit(int param_0, int param_1) {
17101709
setCutType(CUT_TYPE_LARGE_TURN_LEFT);
17111710
}
17121711
} else {
1713-
var_r29_3 = 3;
1712+
param_1 = 3;
17141713
field_0x32cc = Z2SE_AL_KAITENGIRI;
17151714
setSwordVoiceSe(Z2SE_AL_V_KAITEN);
17161715

@@ -1738,7 +1737,7 @@ int daAlink_c::procCutTurnInit(int param_0, int param_1) {
17381737
mNormalSpeed = 0.0f;
17391738
mProcVar5.field_0x3012 = 0;
17401739
setCutWaterDropEffect();
1741-
initCutTurnAt(field_0x347c, var_r29_3);
1740+
initCutTurnAt(field_0x347c, param_1);
17421741
return 1;
17431742
}
17441743

src/d/actor/d_a_alink_damage.inc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,27 +177,26 @@ f32 daAlink_c::damageMagnification(int i_checkZoraMag, int param_1) {
177177
}
178178

179179
/* 800D72BC-800D7478 0D1BFC 01BC+00 6/6 1/1 0/0 .text setDamagePoint__9daAlink_cFiiii */
180-
// NONMATCHING - regalloc
181180
int daAlink_c::setDamagePoint(int i_dmgAmount, int i_checkZoraMag, int i_setDmgTimer, int param_3) {
182181
if (i_dmgAmount <= 0) {
183182
dComIfGp_setItemLifeCount(-i_dmgAmount, 0);
184183
return 0;
185184
}
186185

187186
f32 magnified_dmgF = (f32)i_dmgAmount * damageMagnification(i_checkZoraMag, param_3);
188-
int magnified_dmg = magnified_dmgF;
187+
i_dmgAmount = magnified_dmgF;
189188
if ((int)(magnified_dmgF * 10.0f) % 10 != 0) {
190-
magnified_dmg++;
189+
i_dmgAmount++;
191190
}
192191

193192
if (checkWolf()) {
194193
offWolfEyeUp();
195194
}
196195

197196
if (checkMagicArmorNoDamage()) {
198-
dComIfGp_setItemRupeeCount(-magnified_dmg * 10);
197+
dComIfGp_setItemRupeeCount(-i_dmgAmount * 10);
199198
} else {
200-
dComIfGp_setItemLifeCount(-magnified_dmg, 0);
199+
dComIfGp_setItemLifeCount(-i_dmgAmount, 0);
201200
}
202201

203202
onResetFlg1(RFLG1_DAMAGE_IMPACT);

0 commit comments

Comments
 (0)