Demo work (#786)

* Demo work

* Fix PAL

* Fix d_door weak func order and link it

* Fix d_door for demo

* JKernel OK on demo + misc

* tag_attention 100% on demo

* More demo work and fix some retail fakematches
This commit is contained in:
LagoLunatic
2025-06-04 16:50:49 -04:00
committed by GitHub
parent 08571c4865
commit e24cbed367
69 changed files with 1800 additions and 479 deletions
+23 -35
View File
@@ -317,21 +317,6 @@ void daArrow_c::arrowUseMp() {
dComIfGp_setItemMagicCount(use_mp[mArrowType]);
}
// This is a fake inline (not present in debug maps) which is required for ShieldReflect to match.
// It's possible that an inline similar to this was added to the final game even though it didn't exist in the demo,
// as this section of code was missing from the demo's version of ShieldReflect.
inline void setSphereCoordsFromXYAngles(cXyz& xyz, f32 mag, s16 targetAngleX, s16 targetAngleY) {
f32 normZ;
f32 normY;
f32 normX;
normX = cM_ssin(targetAngleY) * cM_scos(targetAngleX);
normY = -cM_ssin(targetAngleX);
normZ = cM_scos(targetAngleY) * cM_scos(targetAngleX);
xyz.x = normX * mag;
xyz.y = normY * mag;
xyz.z = normZ * mag;
}
/* 800D4DC0-800D50A0 .text ShieldReflect__9daArrow_cFv */
void daArrow_c::ShieldReflect() {
f32 vel = speed.abs();
@@ -341,28 +326,31 @@ void daArrow_c::ShieldReflect() {
s16 targetAngleX = link->getBodyAngleX();
fopAc_ac_c* ganondorf;
if (fopAcM_SearchByName(PROC_GND, &ganondorf) && dComIfGp_getAttention().LockonTruth() && dComIfGp_getAttention().LockonTarget(0) == ganondorf) {
cXyz ganondorfChestPos = ganondorf->current.pos;
ganondorfChestPos.y = 130.0f + REG8_F(0);
targetAngleX = -cLib_targetAngleX(&link->current.pos, &ganondorfChestPos);
fopAcM_SetParam(ganondorf, 0x23);
mSparkleTimer = 15 + REG0_S(3);
mpSparkleEmitter = dComIfGp_particle_set(dPa_name::ID_COMMON_03EE, &link->current.pos);
if (fopAcM_SearchByName(PROC_GND, &ganondorf)) {
dAttention_c& attention = dComIfGp_getAttention();
if (attention.LockonTruth() && attention.LockonTarget(0) == ganondorf) {
cXyz ganondorfChestPos = ganondorf->current.pos;
#if VERSION == VERSION_DEMO
ganondorfChestPos.y += 130.0f + REG8_F(0);
#else
ganondorfChestPos.y = 130.0f + REG8_F(0);
#endif
targetAngleX = -cLib_targetAngleX(&link->current.pos, &ganondorfChestPos);
#if VERSION > VERSION_DEMO
fopAcM_SetParam(ganondorf, 0x23);
mSparkleTimer = 15 + REG0_S(3);
mpSparkleEmitter = dComIfGp_particle_set(dPa_name::ID_COMMON_03EE, &link->current.pos);
#endif
}
}
// // Regswaps without creating a fake inline.
// // f1 -> f3: normY
// // f3 -> f1: normZ
// f32 normZ;
// f32 normY;
// f32 normX;
// normX = cM_ssin(targetAngleY) * cM_scos(targetAngleX);
// normY = -cM_ssin(targetAngleX);
// normZ = cM_scos(targetAngleY) * cM_scos(targetAngleX);
// speed.x = normX * vel;
// speed.y = normY * vel;
// speed.z = normZ * vel;
setSphereCoordsFromXYAngles(speed, vel, targetAngleX, targetAngleY);
Vec norm;
norm.x = cM_ssin(targetAngleY) * cM_scos(targetAngleX);
norm.y = -cM_ssin(targetAngleX);
norm.z = cM_scos(targetAngleY) * cM_scos(targetAngleX);
speed.x = norm.x * vel;
speed.y = norm.y * vel;
speed.z = norm.z * vel;
shape_angle.x = cM_atan2s(-speed.y, -speed.absXZ());
shape_angle.y = cM_atan2s(-speed.x, -speed.z);