Fix D_80097488 overlaps (#879)

Remove a bunch of fake symbols that were overlapping with `D_80097488`.
I created a new struct called `Pos`. Since it is very similar to
`Camera` I placed them close-by as in future we might want to merge
them.

I created some symbol hints like `D_8009748A_x_i_hi` as there are a few
functions that still use them.
This commit is contained in:
Luciano Ciccariello 2023-12-22 20:52:51 +00:00 committed by GitHub
parent fd49b82d1f
commit 60a167896f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 22 deletions

View File

@ -960,6 +960,10 @@ g_unkGraphicsStruct = 0x80097408;
g_BottomCornerTextTimer = 0x80097410;
g_BottomCornerTextPrims = 0x80097414;
g_entityDestroyed = 0x80097428;
D_80097488 = 0x80097488;
D_8009748A_x_i_hi = 0x8009748A;
D_8009748C_y_val = 0x8009748C;
D_8009748E_y_i_hi = 0x8009748E;
g_pads = 0x80097490;
g_pads_0_released = 0x80097492;
g_pads_0_tapped = 0x80097494;

View File

@ -988,6 +988,10 @@ g_unkGraphicsStruct = 0x80097408;
g_BottomCornerTextTimer = 0x80097410;
g_BottomCornerTextPrims = 0x80097414;
g_entityDestroyed = 0x80097428;
D_80097488 = 0x80097488;
D_8009748A_x_i_hi = 0x8009748A;
D_8009748C_y_val = 0x8009748C;
D_8009748E_y_i_hi = 0x8009748E;
g_pads = 0x80097490;
g_pads_0_released = 0x80097492;
g_pads_0_tapped = 0x80097494;

View File

@ -468,6 +468,11 @@ typedef void (*PfnEntityUpdate)(struct Entity*);
#include "unkstruct.h"
typedef struct {
f32 x;
f32 y;
} Pos;
typedef struct {
f32 posX;
f32 posY;
@ -1575,16 +1580,7 @@ extern s32 D_80097420[];
extern s32 D_80097424;
extern s32 D_80097448[]; // underwater physics. 7448 and 744C. Could be struct.
extern s32 D_80097450;
extern s32 D_80097488;
// Overlapping data, worth further investigation
extern u16 D_8009748A[];
extern s32 D_8009748C;
/*
* Elevator moving, "underflowed" to 0xFF
* when going up, 0x1 when going up
*/
extern u16 D_8009748E[];
extern Pos D_80097488;
extern Pad g_pads[PAD_COUNT];
extern Stages g_StageId;
extern s32 D_800974A4; // map open

View File

@ -1121,8 +1121,8 @@ void func_800F298C(void) {
g_api.o.TestCollisions();
D_8013759C = PLAYER.posX.i.hi;
g_Player.unk7C = PLAYER.posX.i.hi;
D_80097488 = 0;
D_8009748C = 0;
D_80097488.x.val = 0;
D_80097488.y.val = 0;
D_801375A0 = PLAYER.posY.i.hi;
g_Player.unk7E = PLAYER.posY.i.hi;
if ((g_StageId == STAGE_ST0) ||
@ -1221,8 +1221,8 @@ void func_800F298C(void) {
D_801375B8 = D_801375B0 - g_Tilemap.cameraY.i.hi;
D_801375A4 = D_8013759C - PLAYER.posX.val;
D_801375A8 = D_801375A0 - PLAYER.posY.val;
D_801375A4 -= D_80097488;
D_801375A8 -= D_8009748C;
D_801375A4 -= D_80097488.x.val;
D_801375A8 -= D_80097488.y.val;
func_800F0940();
for (i = 0, ent = &g_Entities[0]; i < LEN(g_Entities); i++, ent++) {

View File

@ -614,7 +614,7 @@ void EntityPlatform(Entity* self) {
if (temp_v0 > 496) {
self->posY.i.hi--;
player->posY.i.hi--;
D_8009748E[0]--;
D_80097488.y.i.hi--;
} else {
g_api.PlaySfx(SE_CEN_PLATFORM_STOP);
if (player->facingLeft == 0) {
@ -653,7 +653,7 @@ void EntityPlatform(Entity* self) {
if (temp_v0 < 592) {
self->posY.i.hi++;
player->posY.i.hi++;
*D_8009748A += 1;
D_80097488.x.i.hi++;
} else {
D_8003C8B8 = 1;
if (*D_80097400 != 0) {

View File

@ -570,8 +570,8 @@ void EntityCavernDoorPlatform(Entity* self) {
temp -= self->ext.generic.unk88.S16.unk2;
player->posX.i.hi += temp;
player->posY.i.hi++;
D_8009748A[0] += temp;
D_8009748A[2] += 1;
D_80097488.x.i.hi += temp;
D_80097488.y.i.hi += 1;
}
self->ext.generic.unk88.unk = self->posX.val;
self->ext.generic.unk8C.modeS32 = self->posY.val;

View File

@ -1014,7 +1014,7 @@ void EntityElevator2(Entity* self) {
self->posY.i.hi = 96 - camY;
} else if (temp != 0) {
g_Entities[player].posY.i.hi--;
D_8009748E[0]--;
D_80097488.y.i.hi--;
}
} else {
self->posY.i.hi++;
@ -1023,7 +1023,7 @@ void EntityElevator2(Entity* self) {
self->posY.i.hi = 216 - camY;
} else if (temp != 0) {
g_Entities[player].posY.i.hi++;
D_8009748E[0]++;
D_80097488.y.i.hi++;
}
}
}

View File

@ -178,7 +178,7 @@ void EntityElevator(Entity* self) {
if (temp != 0) {
g_api.func_8010DFF0(0, 1);
g_Entities[player].posY.i.hi--;
D_8009748E[0]--;
D_80097488.y.i.hi--;
}
} else {
self->posY.i.hi = y;
@ -198,7 +198,7 @@ void EntityElevator(Entity* self) {
if (temp != 0) {
g_api.func_8010DFF0(0, 1);
g_Entities[player].posY.i.hi++;
D_8009748E[0]++;
D_80097488.y.i.hi++;
}
break;
}