Minor d_a_alink improvements (#2646)

This commit is contained in:
Max Roncace
2025-09-10 21:10:04 -07:00
committed by GitHub
parent 84eed3ea68
commit 4b729b0f65
12 changed files with 233 additions and 266 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ struct J3DTransformInfo {
asm {
psq_l var_f31, 0x0(var_r31), 0, 0
psq_st var_f31, 0x0(var_r30), 0, 0
lfs var_f0, 0x8(var_r31)
stfs var_f0, 0x8(var_r30)
lfs var_f31, 0x8(var_r31)
stfs var_f31, 0x8(var_r30)
lwz var_r0, 0xc(var_r31)
stw var_r0, 0xc(var_r30)
lha var_r0, 0x10(var_r31)
+6 -3
View File
@@ -29,10 +29,13 @@ public:
void onOutFlg() { mOutFlg = true; }
void setFrontJoint(int i_jointNo) { mFrontJoint = i_jointNo; }
void setBackJoint(int i_jointNo) { mBackJoint = i_jointNo; }
f32 getStartRate(const cXyz* param_0) {
return field_0x714 ? field_0x724 * (param_0->x - getRopeStartPos()->x) :
field_0x724 * (param_0->z - getRopeStartPos()->z);
if (field_0x714) {
return field_0x724 * (param_0->x - getRopeStartPos()->x);
} else {
return field_0x724 * (param_0->z - getRopeStartPos()->z);
}
}
void rideKeep() {
+12 -14
View File
@@ -4466,12 +4466,11 @@ BOOL daAlink_c::checkHorseStart(u32 pLastMode, int pStartMode) {
}
/* 800A551C-800A5CC8 09FE5C 07AC+00 1/1 0/0 0/0 .text setStartProcInit__9daAlink_cFv */
// small regalloc, equivalent
int daAlink_c::setStartProcInit() {
BOOL sp10 = 0;
int start_mode = getStartMode();
u32 last_mode = getLastSceneMode();
daHorse_c* horsep = dComIfGp_getHorseActor();
daHorse_c* horsep = (daHorse_c*)dComIfGp_getHorseActor();
BOOL horse_start = checkHorseStart(last_mode, start_mode);
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
i_ctrl->setFrameCtrl(i_attr, i_start, i_end, i_rate, i_frame);
}
/* 80453278-80453280 001878 0008+00 1/1 0/0 0/0 .sdata2 kandelaarAnm$62207 */
static const daAlink_BckData kandelaarAnm[2] = {
{0x026A, 0x0268}, // waits, waitk
{0x0266, 0x0264}, // waiths, waithk
};
/* 800AC450-800AC558 0A6D90 0108+00 23/23 0/0 0/0 .text
* getMainBckData__9daAlink_cCFQ29daAlink_c11daAlink_ANM */
const daAlink_BckData* daAlink_c::getMainBckData(daAlink_c::daAlink_ANM i_anmID) const {
static const daAlink_BckData kandelaarAnm[2] = {
{0x026A, 0x0268}, // waits, waitk
{0x0266, 0x0264}, // waiths, waithk
};
if (mEquipItem == fpcNm_ITEM_KANTERA) {
if (i_anmID == ANM_WAIT) {
return &kandelaarAnm[0];
@@ -11178,11 +11176,10 @@ void daAlink_c::orderPeep() {
}
}
/* 804532B0-804532B4 0018B0 0004+00 1/1 0/0 0/0 .sdata2 itemTalkType$67468 */
static const u16 itemTalkType[2] = {6, 7};
/* 800B7BF8-800B7D4C 0B2538 0154+00 13/13 0/0 0/0 .text orderTalk__9daAlink_cFi */
int daAlink_c::orderTalk(int i_checkZTalk) {
static const u16 itemTalkType[2] = {6, 7};
if (notTalk()) {
return 0;
}
@@ -18712,7 +18709,6 @@ bool daAlink_c::checkItemDraw() {
/* 800CB694-800CBA38 0C5FD4 03A4+00 0/0 0/0 1/1 .text initShadowScaleLight__9daAlink_cFv
*/
// NONMATCHING - float stuff
int daAlink_c::initShadowScaleLight() {
dKy_shadow_mode_set(4);
@@ -18770,8 +18766,10 @@ int daAlink_c::initShadowScaleLight() {
field_0x375c.x = current.pos.x - (var_f31 * temp_f29);
field_0x375c.z = current.pos.z - (var_f31 * temp_f28);
} else {
field_0x375c.x = current.pos.x - (-30.0f * temp_f29) - (65.0f * temp_f28);
field_0x375c.z = current.pos.z - (-30.0f * temp_f28) + (65.0f * temp_f29);
field_0x375c.x = current.pos.x - (temp_f29 * -30.0f) - (temp_f28 * 65.0f);
// likely fakematch - debug indicates there probably isn't a temp
f32 temp = current.pos.z - (temp_f28 * -30.0f);
field_0x375c.z = temp + (temp_f29 * 65.0f);
}
if (checkReinRide()) {
+7 -6
View File
@@ -28,25 +28,26 @@ f32 daAlink_c::getCrawlMoveSpeed() {
/* 800F7CE8-800F7E48 0F2628 0160+00 4/4 0/0 0/0 .text setCrawlMoveDirectionArrow__9daAlink_cFv */
void daAlink_c::setCrawlMoveDirectionArrow() {
static const u8 data_80452F38[2] = {1, 4};
static const u8 data_80452F38[1] = {1};
static const u8 data_80452F39[1] = {4};
u8 direction = 0;
camera_class* camera = dComIfGp_getCamera(field_0x317c);
camera_class* camera = (camera_class*)dComIfGp_getCamera(field_0x317c);
BOOL bvar = cLib_distanceAngleS(fopCamM_GetAngleY(camera), shape_angle.y) > 0x4000;
if (field_0x3198 & 4) {
if (!bvar) {
direction = data_80452F38[0];
direction = *data_80452F38;
} else {
direction = data_80452F38[1];
direction = *data_80452F39;
}
}
if (field_0x3198 & 8) {
if (!bvar) {
direction |= data_80452F38[1];
direction |= *data_80452F39;
} else {
direction |= data_80452F38[0];
direction |= *data_80452F38;
}
}
+3 -4
View File
@@ -1696,9 +1696,8 @@ int daAlink_c::procCutTurnInit(int param_0, int param_1) {
setSingleAnime(anmID, anm_data->mSpeed, var_f31, anm_data->mEndFrame, morf);
int var_r29_3;
if (checkCutLargeTurnState()) {
var_r29_3 = 4;
param_1 = 4;
field_0x32cc = Z2SE_AL_KAITEN_L_SLASH;
setSwordVoiceSe(Z2SE_AL_V_KAITENGIRI_L);
field_0x3478 = cutData->mLargeAttackRadius;
@@ -1710,7 +1709,7 @@ int daAlink_c::procCutTurnInit(int param_0, int param_1) {
setCutType(CUT_TYPE_LARGE_TURN_LEFT);
}
} else {
var_r29_3 = 3;
param_1 = 3;
field_0x32cc = Z2SE_AL_KAITENGIRI;
setSwordVoiceSe(Z2SE_AL_V_KAITEN);
@@ -1738,7 +1737,7 @@ int daAlink_c::procCutTurnInit(int param_0, int param_1) {
mNormalSpeed = 0.0f;
mProcVar5.field_0x3012 = 0;
setCutWaterDropEffect();
initCutTurnAt(field_0x347c, var_r29_3);
initCutTurnAt(field_0x347c, param_1);
return 1;
}
+4 -5
View File
@@ -177,7 +177,6 @@ f32 daAlink_c::damageMagnification(int i_checkZoraMag, int param_1) {
}
/* 800D72BC-800D7478 0D1BFC 01BC+00 6/6 1/1 0/0 .text setDamagePoint__9daAlink_cFiiii */
// NONMATCHING - regalloc
int daAlink_c::setDamagePoint(int i_dmgAmount, int i_checkZoraMag, int i_setDmgTimer, int param_3) {
if (i_dmgAmount <= 0) {
dComIfGp_setItemLifeCount(-i_dmgAmount, 0);
@@ -185,9 +184,9 @@ int daAlink_c::setDamagePoint(int i_dmgAmount, int i_checkZoraMag, int i_setDmgT
}
f32 magnified_dmgF = (f32)i_dmgAmount * damageMagnification(i_checkZoraMag, param_3);
int magnified_dmg = magnified_dmgF;
i_dmgAmount = magnified_dmgF;
if ((int)(magnified_dmgF * 10.0f) % 10 != 0) {
magnified_dmg++;
i_dmgAmount++;
}
if (checkWolf()) {
@@ -195,9 +194,9 @@ int daAlink_c::setDamagePoint(int i_dmgAmount, int i_checkZoraMag, int i_setDmgT
}
if (checkMagicArmorNoDamage()) {
dComIfGp_setItemRupeeCount(-magnified_dmg * 10);
dComIfGp_setItemRupeeCount(-i_dmgAmount * 10);
} else {
dComIfGp_setItemLifeCount(-magnified_dmg, 0);
dComIfGp_setItemLifeCount(-i_dmgAmount, 0);
}
onResetFlg1(RFLG1_DAMAGE_IMPACT);
+61 -80
View File
@@ -773,16 +773,15 @@ void daAlink_c::setWaterfallEffect() {
}
}
/* 80453094-8045309C 001694 0006+02 1/1 0/0 0/0 .sdata2 effName$40765 */
static const u16 effName_40765[] = {
0x0407,
0x0408,
0x0409,
};
/* 8012277C-801228F4 11D0BC 0178+00 1/1 0/0 0/0 .text setMagneBootsEffect__9daAlink_cFv
*/
void daAlink_c::setMagneBootsEffect() {
static const u16 effName[] = {
0x0407,
0x0408,
0x0409,
};
cXyz sp20;
int i, j;
@@ -801,7 +800,7 @@ void daAlink_c::setMagneBootsEffect() {
u32* var_r28 = field_0x3228[i];
for (j = 0; j < 3; j++, var_r28++) {
JPABaseEmitter* temp_r3 = setEmitter(var_r28, effName_40765[j], &current.pos, NULL);
JPABaseEmitter* temp_r3 = setEmitter(var_r28, effName[j], &current.pos, NULL);
if (temp_r3 != NULL) {
if (j == 1) {
temp_r3->setGlobalRTMatrix(mpLinkBootModels[i]->getAnmMtx(1));
@@ -940,25 +939,20 @@ void daAlink_c::clearCutTurnEffectID() {
}
}
/* 804530AC-804530B0 0016AC 0004+00 1/1 0/0 0/0 .sdata2 effNameNormal$41086 */
static const u16 effNameNormal[] = {
0x0159,
0x015A,
};
/* 804530B0-804530B8 0016B0 0008+00 1/1 0/0 0/0 .sdata2 effNameLight$41091 */
static const u16 effNameLight[] = {
0x0A28, 0x0A29, 0x0A2A, 0x0A2B,
};
/* 804530B8-804530BC 0016B8 0004+00 1/1 0/0 0/0 .sdata2 effNameWater$41101 */
static const u16 effNameWater[] = {
0x0C52,
0x0C53,
};
/* 80122F78-801233A4 11D8B8 042C+00 1/1 0/0 0/0 .text setCutTurnEffect__9daAlink_cFv */
void daAlink_c::setCutTurnEffect() {
static const u16 effNameNormal[] = {
0x0159,
0x015A,
};
static const u16 effNameLight[] = {
0x0A28, 0x0A29, 0x0A2A, 0x0A2B,
};
static const u16 effNameWater[] = {
0x0C52,
0x0C53,
};
static Vec const waterEffScale = {1.5f, 1.5f, 1.5f};
static Vec const leftTransNormal[] = {
@@ -1248,23 +1242,20 @@ void daAlink_c::setWolfDigEffect() {
}
}
/* 804530D8-804530E0 0016D8 0006+02 1/1 0/0 0/0 .sdata2 name0$41422 */
static const u16 name0[] = {
0x02A3,
0x83A2,
0x884F,
};
/* 804530E0-804530E8 0016E0 0006+02 1/1 0/0 0/0 .sdata2 name1$41423 */
static const u16 name1[] = {
0x02A3,
0x83A3,
0x8850,
};
/* 80123BF0-80123C8C 11E530 009C+00 2/2 0/0 0/0 .text
* setWolfSwimEndEffect__9daAlink_cFPP14JPABaseEmitterPP14JPABaseEmitter */
void daAlink_c::setWolfSwimEndEffect(JPABaseEmitter** param_0, JPABaseEmitter** param_1) {
static const u16 name0[] = {
0x02A3,
0x83A2,
0x884F,
};
static const u16 name1[] = {
0x02A3,
0x83A3,
0x8850,
};
int var_r30 = mProcVar3.field_0x300e;
if (var_r30 >= 3 || var_r30 < 0) {
var_r30 = 1;
@@ -1277,15 +1268,14 @@ void daAlink_c::setWolfSwimEndEffect(JPABaseEmitter** param_0, JPABaseEmitter**
}
}
/* 804530E8-804530F0 0016E8 0006+02 1/1 0/0 0/0 .sdata2 effID$41443 */
static const u16 effID[] = {
0x0244,
0x0245,
0x0246,
};
/* 80123C8C-80123D88 11E5CC 00FC+00 1/1 0/0 0/0 .text setWolfLockAttackEffect__9daAlink_cFv */
void daAlink_c::setWolfLockAttackEffect() {
static const u16 effID[] = {
0x0244,
0x0245,
0x0246,
};
u8 var_r30;
if (dComIfGp_checkPlayerStatus1(0, 0x01000000)) {
var_r30 = 0xFF;
@@ -1353,21 +1343,18 @@ void daAlink_c::setWolfJumpAttackEffect() {
}
}
/* 804530F0-804530F4 0016F0 0004+00 1/1 0/0 0/0 .sdata2 normalNameID$41521 */
static const u16 normalNameID[] = {
0x8390,
0x8391,
};
/* 804530F4-804530F8 0016F4 0004+00 1/1 0/0 0/0 .sdata2 ganonNameID$41522 */
static const u16 ganonNameID[] = {
0x8C2A,
0x8C2B,
};
/* 80123ED0-80124144 11E810 0274+00 2/2 0/0 0/0 .text
* setWolfBarrierHitEffect__9daAlink_cFR11dBgS_LinChk */
void daAlink_c::setWolfBarrierHitEffect(dBgS_LinChk& param_0) {
static const u16 normalNameID[] = {
0x8390,
0x8391,
};
static const u16 ganonNameID[] = {
0x8C2A,
0x8C2B,
};
cM3dGPla sp10;
dComIfG_Bgsp().GetTriPla(param_0, &sp10);
@@ -1402,13 +1389,12 @@ void daAlink_c::setCutWaterDropEffect() {
}
}
/* 804530F8-80453100 0016F8 0008+00 1/1 0/0 0/0 .sdata2 effDataTable$41650 */
static const u16 effDataTable[] = {
0x02A5, 0x02A6, 0x02A7, 0x02A8,
};
/* 801241E0-801244E4 11EB20 0304+00 1/1 0/0 0/0 .text setWaterDropEffect__9daAlink_cFv */
void daAlink_c::setWaterDropEffect() {
static const u16 effDataTable[] = {
0x02A5, 0x02A6, 0x02A7, 0x02A8,
};
Vec spC;
int i;
@@ -1817,9 +1803,6 @@ void daAlink_c::setFirePointDamageEffect() {
}
}
/* 8045310C-80453110 00170C 0004+00 1/1 0/0 0/0 .sdata2 effName$42224 */
/* 80125338-80125524 11FC78 01EC+00 1/1 0/0 0/0 .text setFreezeEffect__9daAlink_cFv */
void daAlink_c::setFreezeEffect() {
static Vec const effScale = {1.0f, 1.8f, 1.0f};
@@ -1863,18 +1846,17 @@ void daAlink_c::setFreezeEffect() {
}
}
/* 80453110-80453114 001710 0004+00 1/1 0/0 0/0 .sdata2 effName$42309 */
static const u16 effName_42309[] = {
0x0814,
0x0815,
};
/* 80125524-801255BC 11FE64 0098+00 1/1 0/0 0/0 .text setWoodShieldBurnEffect__9daAlink_cFv */
void daAlink_c::setWoodShieldBurnEffect() {
static const u16 effName[] = {
0x0814,
0x0815,
};
if (field_0x2fcb != 0) {
for (int i = 0; i < 2; i++) {
JPABaseEmitter* emitter =
setEmitter(&field_0x3260[i], effName_42309[i], &current.pos, NULL);
setEmitter(&field_0x3260[i], effName[i], &current.pos, NULL);
if (emitter != NULL) {
emitter->setGlobalRTMatrix(mShieldModel->getBaseTRMtx());
@@ -1894,16 +1876,15 @@ void daAlink_c::clearWoodShieldBurnEffect() {
}
}
/* 80453114-80453118 001714 0004+00 1/1 0/0 0/0 .sdata2 effName$42340 */
static const u16 effName_42340[] = {
0x0816,
0x0817,
};
/* 80125628-801256EC 11FF68 00C4+00 1/1 0/0 0/0 .text setWoodShieldBurnOutEffect__9daAlink_cFv */
void daAlink_c::setWoodShieldBurnOutEffect() {
static const u16 effName[] = {
0x0816,
0x0817,
};
for (int i = 0; i < 2; i++) {
JPABaseEmitter* emitter = dComIfGp_particle_setColor(effName_42340[i], &current.pos,
JPABaseEmitter* emitter = dComIfGp_particle_setColor(effName[i], &current.pos,
&tevStr, NULL, NULL, 0.0f, -1);
if (emitter != NULL) {
+2 -2
View File
@@ -280,7 +280,7 @@ int daAlink_c::procGuardSlipInit(int param_0, dCcD_GObjInf* param_1) {
mProcVar2.field_0x300c = 0;
mProcVar3.field_0x300e = 0;
} else {
const daAlinkHIO_guard_c1* var_r27 = &daAlinkHIO_guard_c0::m;
const daAlinkHIO_anm_c* var_r27 = &daAlinkHIO_guard_c0::m.mGuardHitAnm;
daAlink_ANM var_r28;
if (field_0x2f98 == 2) {
var_r28 = ANM_GUARD_LEFT;
@@ -288,7 +288,7 @@ int daAlink_c::procGuardSlipInit(int param_0, dCcD_GObjInf* param_1) {
var_r28 = ANM_GUARD_RIGHT;
}
setSingleAnimeParam(var_r28, &var_r27->mGuardHitAnm);
setSingleAnimeParam(var_r28, var_r27);
setUpperGuardAnime(-1.0f);
mProcVar2.field_0x300c = (current.angle.y + 0x8000) - shape_angle.y;
+7 -8
View File
@@ -2634,17 +2634,16 @@ void daAlink_c::setRoofHangHandOnSE(cBgS_PolyInfo* unused) {
}
}
/* 80452FA8-80452FB0 0015A8 0008+00 1/1 0/0 0/0 .sdata2 offsetAngle$25945 */
static const s16 offsetAngle[] = {
0x0000,
0x8000,
0x4000,
0xC000,
};
/* 80100668-80100770 0FAFA8 0108+00 3/3 0/0 0/0 .text checkRoofHangMovePos__9daAlink_cFv
*/
int daAlink_c::checkRoofHangMovePos() {
static const s16 offsetAngle[] = {
0x0000,
0x8000,
0x4000,
0xC000,
};
if (field_0x2f98 >= 4) {
field_0x2f98 = 0;
}
+2 -5
View File
@@ -834,7 +834,6 @@ void daAlink_c::setHookshotTopPosFly() {
static cXyz l_hookSnowSandHitScale(0.5f, 0.5f, 0.5f);
/* 80109BDC-8010B2DC 10451C 1700+00 1/1 0/0 0/0 .text setHookshotPos__9daAlink_cFv */
// NONMATCHING - almost, just cXyz stack order
void daAlink_c::setHookshotPos() {
mDoMtx_stack_c::copy(mpLinkModel->getAnmMtx(field_0x30c0));
mDoMtx_stack_c::transM(-2.0f, 1.0f, 1.0f);
@@ -1009,8 +1008,7 @@ void daAlink_c::setHookshotPos() {
mDoMtx_stack_c::copy(mHeldItemModel->getBaseTRMtx());
cXyz sp134(hookRoot);
mDoMtx_stack_c::transM(sp134);
mDoMtx_stack_c::transM(cXyz(hookRoot));
if (mTargetedActor != NULL || mItemMode != 2) {
mDoMtx_stack_c::multVecZero(&mHookshotTopPos);
}
@@ -1213,8 +1211,7 @@ void daAlink_c::setHookshotPos() {
if (field_0x3024 == 0) {
mDoMtx_stack_c::copy(field_0x0710->getBaseTRMtx());
cXyz sp5C(hookRoot);
mDoMtx_stack_c::transM(sp5C);
mDoMtx_stack_c::transM(cXyz(hookRoot));
mIronBallBgChkPos = field_0x3810;
}
+2 -3
View File
@@ -330,11 +330,10 @@ void daAlink_c::statusWindowExecute(const cXyz* i_pos, s16 i_angle) {
}
}
/* 804531E8-804531F0 0017E8 0008+00 1/1 0/0 0/0 .sdata2 waterColor$53845 */
static const GXColorS10 waterColor = {0, 0, 0, 0};
/* 80140984-80140AC8 13B2C4 0144+00 0/0 1/1 0/0 .text statusWindowDraw__9daAlink_cFv */
void daAlink_c::statusWindowDraw() {
static const GXColorS10 waterColor = {0, 0, 0, 0};
if (mClothesChangeWaitTimer == 0) {
g_env_light.settingTevStruct(12, &current.pos, &tevStr);
initTevCustomColor();
File diff suppressed because it is too large Load Diff