mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
my god, it matches
This commit is contained in:
@@ -2926,11 +2926,7 @@ beginseg
|
||||
name "ovl_Obj_Mine"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.o"
|
||||
#ifdef NON_MATCHING
|
||||
include "build/src/overlays/actors/ovl_Obj_Mine/ovl_Obj_Mine_reloc.o"
|
||||
#else
|
||||
include "build/data/ovl_Obj_Mine/ovl_Obj_Mine.reloc.o"
|
||||
#endif
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
||||
@@ -478,28 +478,27 @@ void ObjMine_Water_WallCheck(ObjMine* this, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// https://decomp.me/scratch/BW51G
|
||||
// Probably equivalent, but nightmare loop unrolls. The tension section also has weird comparisons. It should be
|
||||
// equivalent to what's written, but it seems the actual code comparisons were implemented differently. ASM suggests
|
||||
// multiple index variables were used at once.
|
||||
Vec3f sLastLinkAccel[OBJMINE_CHAIN_MAX + 1];
|
||||
|
||||
void ObjMine_Water_ApplyForces(ObjMine* this) {
|
||||
static Vec3f sLastLinkAccel[OBJMINE_CHAIN_MAX + 1];
|
||||
ObjMineWaterChain* waterChain = &this->chain.water;
|
||||
ObjMineWaterLink* waterLink;
|
||||
s32 i;
|
||||
s16 swayPhase;
|
||||
s16 swayPhase = 0;
|
||||
s32 linkCount = OBJMINE_GET_LINK_COUNT(&this->actor);
|
||||
f32 inverseCount = 1.0f / linkCount;
|
||||
f32 restoreY = (waterChain->links[linkCount - 1].pos.y - waterChain->restY) * waterChain->restoreY;
|
||||
Vec3f tension;
|
||||
f32 scaledKnockback;
|
||||
s32 index;
|
||||
s32 pad;
|
||||
Vec3f* lastLinkAccel;
|
||||
|
||||
// Applies the buoyant force and sway from the water.
|
||||
for (i = 0, waterLink = waterChain->links, swayPhase = 0; i < linkCount;
|
||||
i++, waterLink++, swayPhase += waterChain->swayPhaseVel) {
|
||||
Math_Vec3f_Copy(&sLastLinkAccel[i], &waterLink->accel);
|
||||
for (i = 0, waterLink = waterChain->links, lastLinkAccel = sLastLinkAccel; i < linkCount;
|
||||
i++, waterLink++, swayPhase += waterChain->swayPhaseVel, lastLinkAccel++) {
|
||||
Math_Vec3f_Copy(lastLinkAccel, &waterLink->accel);
|
||||
|
||||
if (waterLink->pos.y <= this->actor.home.pos.y) {
|
||||
waterLink->accel.y = waterChain->restoreY * -96.0f;
|
||||
} else if (restoreY > 0.0f) {
|
||||
@@ -507,6 +506,7 @@ void ObjMine_Water_ApplyForces(ObjMine* this) {
|
||||
} else {
|
||||
waterLink->accel.y = restoreY;
|
||||
}
|
||||
|
||||
waterLink->accel.x = (waterLink->pos.x - this->actor.home.pos.x) * waterChain->restoreXZ;
|
||||
waterLink->accel.z = (waterLink->pos.z - this->actor.home.pos.z) * waterChain->restoreXZ;
|
||||
waterLink->accel.x += waterChain->swayXZ * Math_SinS(swayPhase);
|
||||
@@ -538,12 +538,14 @@ void ObjMine_Water_ApplyForces(ObjMine* this) {
|
||||
// frame.
|
||||
for (i = 0, waterLink = waterChain->links; i < linkCount; i++, waterLink++) {
|
||||
Math_Vec3f_Copy(&tension, &gZeroVec3f);
|
||||
if (i - 2 >= 0) {
|
||||
|
||||
if (i >= 2) {
|
||||
tension.x += sLastLinkAccel[i - 2].x * 0.075f;
|
||||
tension.y += sLastLinkAccel[i - 2].y * 0.075f;
|
||||
tension.z += sLastLinkAccel[i - 2].z * 0.075f;
|
||||
}
|
||||
if (i - 1 >= 0) {
|
||||
|
||||
if (i >= 1) {
|
||||
tension.x += sLastLinkAccel[i - 1].x * 0.15f;
|
||||
tension.y += sLastLinkAccel[i - 1].y * 0.15f;
|
||||
tension.z += sLastLinkAccel[i - 1].z * 0.15f;
|
||||
@@ -553,26 +555,24 @@ void ObjMine_Water_ApplyForces(ObjMine* this) {
|
||||
tension.y += sLastLinkAccel[i].y * 0.3f;
|
||||
tension.z += sLastLinkAccel[i].z * 0.3f;
|
||||
|
||||
if (i + 1 < linkCount) {
|
||||
tension.x += sLastLinkAccel[i + 1].x * 0.15f;
|
||||
tension.y += sLastLinkAccel[i + 1].y * 0.15f;
|
||||
tension.z += sLastLinkAccel[i + 1].z * 0.15f;
|
||||
index = i + 1;
|
||||
if (index < linkCount) {
|
||||
tension.x += sLastLinkAccel[index].x * 0.15f;
|
||||
tension.y += sLastLinkAccel[index].y * 0.15f;
|
||||
tension.z += sLastLinkAccel[index].z * 0.15f;
|
||||
}
|
||||
if (i + 2 < linkCount) {
|
||||
tension.x += sLastLinkAccel[i + 2].x * 0.075f;
|
||||
tension.y += sLastLinkAccel[i + 2].y * 0.075f;
|
||||
tension.z += sLastLinkAccel[i + 2].z * 0.075f;
|
||||
|
||||
index = i + 2;
|
||||
if (index < linkCount) {
|
||||
tension.x += sLastLinkAccel[index].x * 0.075f;
|
||||
tension.y += sLastLinkAccel[index].y * 0.075f;
|
||||
tension.z += sLastLinkAccel[index].z * 0.075f;
|
||||
}
|
||||
waterLink->accel.x += tension.x;
|
||||
waterLink->accel.y += tension.y;
|
||||
waterLink->accel.z += tension.z;
|
||||
}
|
||||
}
|
||||
#else
|
||||
Vec3f sLastLinkAccel[OBJMINE_CHAIN_MAX + 1];
|
||||
void ObjMine_Water_ApplyForces(ObjMine* this);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mine/ObjMine_Water_ApplyForces.s")
|
||||
#endif
|
||||
|
||||
void ObjMine_Water_UpdateLinks(ObjMine* this) {
|
||||
s32 pad; // Could be recast to thisx as in ObjMine_Path_Move
|
||||
|
||||
Reference in New Issue
Block a user