mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-10-07 02:24:01 +00:00
Cleanup DRA func_8012C600 (#1380)
Another adventure in examining a function alongside PSP. The CLAMP_MAX and CLAMP_MIN seem like nice ideas, but I wasn't getting them to match on PSP. And since they are very little-used in the repo, keeping them around in here just didn't seem worth it. As far as the `D_8013AE##` variables, I noticed they were consecutive in addresses (they're all s32, and are all different by 4 bytes). Rather than being a weird mix of individual values and arrays, I thought it made more sense to treat them all as an array, and indeed it still matches this way, so I think this is a more reasonable way to handle this data. I think those are all the changes that matter.
This commit is contained in:
parent
e73000308d
commit
7f48523477
@ -1134,7 +1134,7 @@ void func_80121F14(s32 arg0, s32 arg1) {
|
||||
}
|
||||
}
|
||||
|
||||
Primitive* func_80121F58(bool arg0, s32 arg1, Primitive* arg2, f32 arg3) {
|
||||
Primitive* func_80121F58(bool arg0, s32 arg1, Primitive* arg2, s16 facingLeft) {
|
||||
Primitive* prim;
|
||||
s16 temp_s4;
|
||||
s16 temp_s5;
|
||||
@ -1147,7 +1147,7 @@ Primitive* func_80121F58(bool arg0, s32 arg1, Primitive* arg2, f32 arg3) {
|
||||
s8 var_t2;
|
||||
|
||||
if (arg0 == 0) {
|
||||
if (arg3.i.lo != 0) {
|
||||
if (facingLeft) {
|
||||
prim = &D_801381F4[D_800AE230[arg1 >> 1]];
|
||||
var_t0 = prim->u0;
|
||||
var_t2 = prim->u1;
|
||||
|
@ -3114,8 +3114,6 @@ INCLUDE_ASM("dra/nonmatchings/843B0", EntityBatEcho);
|
||||
|
||||
void func_8012C600(void) {
|
||||
s32 x, y;
|
||||
s32 min1;
|
||||
s32 min2;
|
||||
s32 i;
|
||||
s32 t0 = PLAYER.posX.i.hi;
|
||||
s32 t1 = PLAYER.posY.i.hi;
|
||||
@ -3126,7 +3124,7 @@ void func_8012C600(void) {
|
||||
x = g_Entities[i + 21].posX.i.hi + 4;
|
||||
}
|
||||
}
|
||||
D_8013AEBC = x - t0;
|
||||
D_8013AEBC[0] = x - t0;
|
||||
|
||||
x = g_Entities[20].posX.i.hi - 8;
|
||||
for (i = 0; i < 9; i++) {
|
||||
@ -3134,7 +3132,7 @@ void func_8012C600(void) {
|
||||
x = g_Entities[i + 21].posX.i.hi - 4;
|
||||
}
|
||||
}
|
||||
D_8013AEC4 = x - t0;
|
||||
D_8013AEBC[2] = x - t0;
|
||||
|
||||
y = g_Entities[21].posY.i.hi;
|
||||
for (i = 0; i < 9; i++) {
|
||||
@ -3143,16 +3141,16 @@ void func_8012C600(void) {
|
||||
}
|
||||
}
|
||||
y = y - 4;
|
||||
|
||||
min1 = g_Entities[30].posY.i.hi - 12;
|
||||
if (y >= min1) {
|
||||
y = min1;
|
||||
if (y >= g_Entities[30].posY.i.hi - 12) {
|
||||
y = g_Entities[30].posY.i.hi - 12;
|
||||
}
|
||||
min2 = g_Entities[20].posY.i.hi - 8;
|
||||
if (y >= min2) {
|
||||
y = min2;
|
||||
if (y >= g_Entities[20].posY.i.hi - 8) {
|
||||
y = g_Entities[20].posY.i.hi - 8;
|
||||
}
|
||||
D_8013AEBC[3] = y - t1;
|
||||
if (D_8013AEBC[3] < -24) {
|
||||
D_8013AEBC[3] = -24;
|
||||
}
|
||||
D_8013AEC8[0] = CLAMP_MIN(y - t1, -24);
|
||||
|
||||
y = g_Entities[21].posY.i.hi;
|
||||
for (i = 0; i < 9; i++) {
|
||||
@ -3162,22 +3160,31 @@ void func_8012C600(void) {
|
||||
}
|
||||
y = y + 4;
|
||||
|
||||
min1 = PLAYER.posY.i.hi + 28;
|
||||
if (y <= min1) {
|
||||
y = min1;
|
||||
if (y <= PLAYER.posY.i.hi + 28) {
|
||||
y = PLAYER.posY.i.hi + 28;
|
||||
}
|
||||
min2 = g_Entities[17].posY.i.hi + 28;
|
||||
if (y <= min2) {
|
||||
y = min2;
|
||||
if (y <= g_Entities[17].posY.i.hi + 28) {
|
||||
y = g_Entities[17].posY.i.hi + 28;
|
||||
}
|
||||
D_8013AEBC[1] = y - t1;
|
||||
if (D_8013AEBC[1] > 0x27) {
|
||||
D_8013AEBC[1] = 0x27;
|
||||
}
|
||||
D_8013AEC0[0] = CLAMP_MAX(y - t1, 39);
|
||||
|
||||
if (!PLAYER.facingLeft) {
|
||||
D_8013AEC4 = CLAMP_MIN(D_8013AEC4, -0x2C);
|
||||
D_8013AEBC = CLAMP_MAX(D_8013AEBC, 0x14);
|
||||
if (D_8013AEBC[2] < -0x2C) {
|
||||
D_8013AEBC[2] = -0x2C;
|
||||
}
|
||||
if (D_8013AEBC[0] > 0x14) {
|
||||
D_8013AEBC[0] = 0x14;
|
||||
}
|
||||
} else {
|
||||
D_8013AEC4 = CLAMP_MIN(D_8013AEC4, -0x14);
|
||||
D_8013AEBC = CLAMP_MAX(D_8013AEBC, 0x2C);
|
||||
if (D_8013AEBC[2] < -0x14) {
|
||||
D_8013AEBC[2] = -0x14;
|
||||
}
|
||||
if (D_8013AEBC[0] > 0x2C) {
|
||||
D_8013AEBC[0] = 0x2C;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,14 +588,11 @@ void func_8013136C(Entity* self) {
|
||||
self->animCurFrame = 82;
|
||||
}
|
||||
break;
|
||||
// Might be possible to unify these fake empty cases.
|
||||
case 1:
|
||||
#ifdef VERSION_PSP
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
#else
|
||||
case 255:
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -680,10 +680,7 @@ extern s16 D_8013AEA6;
|
||||
extern s16 D_8013AE94;
|
||||
extern u8 g_ReverbDepth;
|
||||
extern s32 D_8013AE9C;
|
||||
extern s32 D_8013AEBC;
|
||||
extern s32 D_8013AEC0[];
|
||||
extern s32 D_8013AEC4;
|
||||
extern s32 D_8013AEC8[];
|
||||
extern s32 D_8013AEBC[4];
|
||||
extern s32 D_8013AECC;
|
||||
extern s32 D_8013AED0;
|
||||
extern s16 D_8013AED4[4];
|
||||
|
@ -435,10 +435,7 @@ s16 g_SoundCommandRingBuffer[MAX_SND_COUNT];
|
||||
s16 g_VolL;
|
||||
s16 g_VolR;
|
||||
s16 D_8013AE94;
|
||||
s32 D_8013AEBC;
|
||||
s32 D_8013AEC0[1];
|
||||
s32 D_8013AEC4;
|
||||
s32 D_8013AEC8[1];
|
||||
s32 D_8013AEBC[4];
|
||||
s32 D_8013AECC;
|
||||
u16 D_8013AEE0;
|
||||
Unkstruct_800BF554 g_SfxData[737];
|
||||
|
Loading…
Reference in New Issue
Block a user