Rework g_unkGraphicsStruct (#1175)

I noticed that this struct had some overlap with other values in memory,
so I have pulled all those values into this struct.

The boundaries of this struct are uncertain and are a matter of ongoing
research.
This commit is contained in:
bismurphy 2024-05-26 10:51:25 -04:00 committed by GitHub
parent 461d3338d9
commit 8fdb4cce13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
48 changed files with 170 additions and 180 deletions

View File

@ -71,9 +71,7 @@ D_8008700C = 0x80086ABC;
D_8008701E = 0x80086ACE;
D_800973F8 = 0x80096EA8;
D_800973FC = 0x80096EAC;
g_unkGraphicsStruct = 0x80096EB8;
g_BottomCornerTextTimer = 0x80096EC0;
g_BottomCornerTextPrims = 0x80096EC4;
g_unkGraphicsStruct = 0x80096EB0;
g_entityDestroyed = 0x80096ED8;
D_8009748A = 0x80096F3A;
D_8009748E = 0x80096F3E;

View File

@ -987,9 +987,7 @@ g_PrimBuf_0_priority = 0x80087012;
g_PrimBuf_0_drawMode = 0x8008701E;
playerX = 0x800973F0;
playerY = 0x800973F4;
g_unkGraphicsStruct = 0x80097408;
g_BottomCornerTextTimer = 0x80097410;
g_BottomCornerTextPrims = 0x80097414;
g_unkGraphicsStruct = 0x80097400;
g_entityDestroyed = 0x80097428;
D_8009748A_x_i_hi = 0x8009748A;
D_8009748C_y_val = 0x8009748C;

View File

@ -16,7 +16,7 @@ D_08C6BC30 = 0x08C6BC30;
D_08C6BC34 = 0x08C6BC34;
D_08C6BC38 = 0x08C6BC38;
g_StageId = 0x091CE5B8;
g_unkGraphicsStruct = 0x091CE608;
g_unkGraphicsStruct = 0x091CE600;
g_randomNext = 0x091CE6B0;
g_Servant = 0x091CF028;
g_Player = 0x91CF030;

View File

@ -1008,9 +1008,7 @@ g_PrimBuf_0_priority = 0x80087012;
g_PrimBuf_0_drawMode = 0x8008701E;
playerX = 0x800973F0;
playerY = 0x800973F4;
g_unkGraphicsStruct = 0x80097408;
g_BottomCornerTextTimer = 0x80097410;
g_BottomCornerTextPrims = 0x80097414;
g_unkGraphicsStruct = 0x80097400;
g_entityDestroyed = 0x80097428;
D_8009748A_x_i_hi = 0x8009748A;
D_8009748C_y_val = 0x8009748C;

View File

@ -2,3 +2,4 @@ g_api = 0x8003C670;
g_CurrentRoom = 0x80072b50;
g_Camera = 0x80072b3c;
g_Player = 0x80072684;
g_unkGraphicsStruct = 0x80096EB0;

View File

@ -2,7 +2,7 @@ D_08C6BC30 = 0x08C6BC30;
D_08C6BC34 = 0x08C6BC34;
D_08C6BC38 = 0x08C6BC38;
g_StageId = 0x091CE5B8;
g_unkGraphicsStruct = 0x091CE608;
g_unkGraphicsStruct = 0x091CE600;
g_Servant = 0x091CF028;
g_Player = 0x091CF030;
g_api = 0x091CF738;

View File

@ -26,3 +26,4 @@ D_801A6E7C = 0x801A6E7C;
D_8017D000 = 0x8017D000;
D_8017D000 = 0x8017D000;
g_unkGraphicsStruct = 0x80097400;

View File

@ -1669,7 +1669,6 @@ extern s32 g_PrevScrollY;
extern s32 D_80073080;
extern Tilemap g_Tilemap;
extern Entity g_Entities[TOTAL_ENTITY_COUNT];
extern unkGraphicsStruct g_unkGraphicsStruct;
extern s32 g_entityDestroyed[18];
extern Event g_EvHwCardEnd;
extern Event g_EvHwCardErr;
@ -1686,14 +1685,7 @@ extern s8 D_80097B99;
extern s32 D_800973EC; // flag to check if the menu is shown
extern s32 D_800973F8;
extern s32 D_800973FC;
extern s32 D_80097400[];
extern s32 D_8009740C[];
extern s32 g_BottomCornerTextTimer;
extern s32 g_BottomCornerTextPrims;
extern s32 D_80097418;
extern s32 D_8009741C[];
extern s32 D_80097420[];
extern s32 D_80097424;
extern unkGraphicsStruct g_unkGraphicsStruct;
extern s32 D_80097448[]; // underwater physics. 7448 and 744C. Could be struct.
extern s32 D_80097450;
extern Pos D_80097488;

View File

@ -179,9 +179,18 @@ typedef struct {
} unk_800B08CC; // size = 0xC
typedef struct {
Multi g_zEntityCenter;
byte pad[0x1A];
s32 D_8009742C[8];
/* 0x00 */ s32 unk0;
/* 0x04 */ s32 unk4;
/* 0x08 */ Multi g_zEntityCenter;
/* 0x0C */ Multi unkC; // multi for dre/func_801961DC
/* 0x10 */ s32 BottomCornerTextTimer;
/* 0x14 */ s32 BottomCornerTextPrims;
/* 0x18 */ s32 unk18;
/* 0x1C */ s32 unk1C;
/* 0x20 */ s32 unk20;
/* 0x24 */ s32 unk24;
/* 0x28 */ s32 D_80097428[8]; // size must be 8 for the loop in
// func_800F298C
} unkGraphicsStruct;
typedef struct {

View File

@ -343,7 +343,7 @@ s32 func_800F0CD8(s32 arg0) {
s32 var_s0;
s32 var_v0;
if (D_80097418 == 0) {
if (g_unkGraphicsStruct.unk18 == 0) {
if (D_80097C98 == 2) {
var_v0 = SetNextRoomToLoad(
(g_Entities[0].posX.i.hi >> 8) + g_Tilemap.left,
@ -380,7 +380,7 @@ s32 func_800F0CD8(s32 arg0) {
playerX = g_Tilemap.width - 1;
}
}
if (D_80097424 == 0) {
if (g_unkGraphicsStruct.unk24 == 0) {
if (playerY < g_Tilemap.y + 4) {
temp_v0 = SetNextRoomToLoad(
(playerX >> 8) + g_Tilemap.left, g_Tilemap.top - 1);
@ -414,33 +414,34 @@ s32 func_800F0CD8(s32 arg0) {
}
}
block_25:
temp_a1 = g_Tilemap.x + *D_8009740C;
temp_a1 = g_Tilemap.x + g_unkGraphicsStruct.unkC;
if (playerX < temp_a1) {
if (arg0 != 0 && g_Tilemap.hSize != 1 &&
temp_a1 < playerX + D_801375A4) {
g_Entities[0].posX.i.hi =
(u16)g_Entities[0].posX.i.hi +
(playerX + D_801375A4 - (g_Tilemap.x + *D_8009740C));
(playerX + D_801375A4 -
(g_Tilemap.x + g_unkGraphicsStruct.unkC));
}
g_Tilemap.scrollX.i.hi = g_Tilemap.x;
} else {
temp_a1_2 = g_Tilemap.width + *D_8009740C - 0x100;
temp_a1_2 = g_Tilemap.width + g_unkGraphicsStruct.unkC - 0x100;
if (temp_a1_2 < playerX) {
if (arg0 != 0 && g_Tilemap.hSize != 1 &&
playerX + D_801375A4 < temp_a1_2) {
g_Entities[0].posX.i.hi =
((u16)g_Entities[0].posX.i.hi) +
(((playerX + D_801375A4) + 0x100) -
(g_Tilemap.width + (*D_8009740C)));
(g_Tilemap.width + (g_unkGraphicsStruct.unkC)));
}
g_Tilemap.scrollX.i.hi = g_Tilemap.width - 0x100;
} else {
g_Tilemap.scrollX.i.hi = playerX - (*D_8009740C);
g_Entities[0].posX.i.hi = *D_8009740C;
g_Tilemap.scrollX.i.hi = playerX - (g_unkGraphicsStruct.unkC);
g_Entities[0].posX.i.hi = g_unkGraphicsStruct.unkC;
}
}
if (D_8009741C != 0) {
if (g_unkGraphicsStruct.unk1C != 0) {
if (playerY < g_Tilemap.y + 0x8C) {
g_Tilemap.scrollY.i.hi = g_Tilemap.y + 4;
g_Entities[0].posY.i.hi = playerY - g_Tilemap.scrollY.i.hi;
@ -941,42 +942,33 @@ void func_800F2288(s32 arg0) {
}
void func_800F2404(s32 arg0) {
s32* temp;
s32* ptr;
s32 count;
s32 i;
if (arg0 == 0) {
g_BottomCornerTextTimer = 0;
g_unkGraphicsStruct.BottomCornerTextTimer = 0;
D_800973F8 = 0;
D_800973FC = 0;
}
temp = D_80097400;
*temp = 0;
D_8003C704 = 0;
D_80097418 = 0;
D_8009741C[0] = 0;
D_8009740C[0] = 0x80;
if (g_BottomCornerTextTimer != 0) {
FreePrimitives(g_BottomCornerTextPrims);
g_unkGraphicsStruct.unk0 = 0;
g_unkGraphicsStruct.unk18 = 0;
g_unkGraphicsStruct.unk1C = 0;
g_unkGraphicsStruct.unkC.unk = 0x80;
if (g_unkGraphicsStruct.BottomCornerTextTimer != 0) {
FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
}
g_BottomCornerTextTimer = 0;
g_BottomCornerTextPrims = 0;
g_unkGraphicsStruct.BottomCornerTextTimer = 0;
g_unkGraphicsStruct.BottomCornerTextPrims = 0;
g_unkGraphicsStruct.g_zEntityCenter.unk = 148;
count = 7;
ptr = &D_80097400[17];
while (count >= 0) {
*ptr = 0;
count -= 1;
ptr -= 1;
for (i = 0; i < LEN(g_unkGraphicsStruct.D_80097428); i++) {
g_unkGraphicsStruct.D_80097428[i] = 0;
}
D_80097420[0] = 0;
D_80097424 = 0;
g_unkGraphicsStruct.unk20 = 0;
g_unkGraphicsStruct.unk24 = 0;
D_80097448[0] = 0;
D_80097448[1] = 0;
D_80097450 = 0;
@ -1381,8 +1373,8 @@ void func_800F298C(void) {
D_801375AC = g_Tilemap.scrollX.i.hi;
D_801375B0 = g_Tilemap.scrollY.i.hi;
if (*D_80097420 != 0) {
func_8010E0D0(*D_80097420);
if (g_unkGraphicsStruct.unk20 != 0) {
func_8010E0D0(g_unkGraphicsStruct.unk20);
PlaySfx(SET_UNK_0E);
D_8003C9A4 = 5;
return;
@ -1492,7 +1484,7 @@ void func_800F298C(void) {
MuteCd();
}
} else if (D_8006BB00 != 0) {
if (*D_80097400 != 0) {
if (g_unkGraphicsStruct.unk0 != 0) {
D_80097928 = 0;
D_8006BB00 = 0;
UnMuteCd();
@ -1688,8 +1680,8 @@ void func_800F298C(void) {
func_800F0CD8(0);
if (g_StageId == STAGE_RTOP) {
DestroyEntitiesFromIndex(0x40);
for (i = 0; i < LEN(g_unkGraphicsStruct.D_8009742C); i++) {
g_unkGraphicsStruct.D_8009742C[i] = 0;
for (i = 0; i < LEN(g_unkGraphicsStruct.D_80097428); i++) {
g_unkGraphicsStruct.D_80097428[i] = 0;
}
g_PrevScrollX = (s32)g_Tilemap.scrollX.i.hi;
g_PrevScrollY = (s32)g_Tilemap.scrollY.i.hi;
@ -1698,8 +1690,8 @@ void func_800F298C(void) {
func_800F0CD8(0);
func_800F0CD8(0);
DestroyEntitiesFromIndex(0x40);
for (i = 0; i < LEN(g_unkGraphicsStruct.D_8009742C); i++) {
g_unkGraphicsStruct.D_8009742C[i] = 0;
for (i = 0; i < LEN(g_unkGraphicsStruct.D_80097428); i++) {
g_unkGraphicsStruct.D_80097428[i] = 0;
}
}
D_801375A4 = D_8013759C - PLAYER.posX.val;
@ -1741,8 +1733,8 @@ void func_800F298C(void) {
}
if (g_StageId != STAGE_RTOP) {
DestroyEntitiesFromIndex(0x40);
for (i = 0; i < LEN(g_unkGraphicsStruct.D_8009742C); i++) {
g_unkGraphicsStruct.D_8009742C[i] = 0;
for (i = 0; i < LEN(g_unkGraphicsStruct.D_80097428); i++) {
g_unkGraphicsStruct.D_80097428[i] = 0;
}
g_PrevScrollX = g_Tilemap.scrollX.i.hi;
g_PrevScrollY = g_Tilemap.scrollY.i.hi;
@ -1751,8 +1743,8 @@ void func_800F298C(void) {
func_800F0CD8(0);
func_800F0CD8(0);
DestroyEntitiesFromIndex(0x40);
for (i = 0; i < LEN(g_unkGraphicsStruct.D_8009742C); i++) {
g_unkGraphicsStruct.D_8009742C[i] = 0;
for (i = 0; i < LEN(g_unkGraphicsStruct.D_80097428); i++) {
g_unkGraphicsStruct.D_80097428[i] = 0;
}
}
g_PrevScrollX = g_Tilemap.scrollX.i.hi;
@ -1794,19 +1786,19 @@ void func_800F298C(void) {
func_801028AC(1);
break;
case 0x5:
if (*D_80097420 != 0) {
if (g_unkGraphicsStruct.unk20 != 0) {
if (g_StageId != STAGE_ST0) {
if (g_PlayableCharacter == PLAYER_ALUCARD) {
if (*D_80097420 == 0xFFF) {
if (g_unkGraphicsStruct.unk20 == 0xFFF) {
EntityAlucard();
func_8011A870();
g_api.o.unk28();
if (g_pads[1].pressed & PAD_DOWN) {
*D_80097420 = 0;
g_unkGraphicsStruct.unk20 = 0;
}
} else {
if (*D_80097420 != 0xFF) {
func_8010DF70(*D_80097420);
if (g_unkGraphicsStruct.unk20 != 0xFF) {
func_8010DF70(g_unkGraphicsStruct.unk20);
func_8011A4D0();
}
g_api.o.unk28();

View File

@ -455,7 +455,7 @@ void EntityAlucard(void) {
if (PLAYER.step != 0x30) {
func_8010E168(1, 4);
SetPlayerStep(0x30);
*D_80097400 = 1;
g_unkGraphicsStruct.unk0 = 1;
}
break;
case 2: /* switch 6 */
@ -465,7 +465,7 @@ void EntityAlucard(void) {
} else {
SetPlayerStep(0x31);
}
*D_80097400 = 1;
g_unkGraphicsStruct.unk0 = 1;
break;
}
} else {
@ -778,7 +778,7 @@ block_160:
weapon_func();
}
var_s0 = 0;
D_8009741C[0] &= ~2;
g_unkGraphicsStruct.unk1C &= ~2;
g_Player.unk0C &= ~8;
g_Player.unk08 = g_Player.unk0C;
g_Status.D_80097BF8 &= ~1;
@ -805,7 +805,7 @@ block_160:
case 5: /* switch 5 */
if (PLAYER.step_s == 3) {
func_8010E168(1, 4);
D_8009741C[0] |= 2;
g_unkGraphicsStruct.unk1C |= 2;
}
var_s0 = 0x28100001;
break;
@ -892,7 +892,7 @@ block_160:
PLAYER.palette = 0x810D;
break;
case 24: /* switch 5 */
D_8009741C[0] |= 2;
g_unkGraphicsStruct.unk1C |= 2;
if (abs(PLAYER.velocityX) > FIX(3)) {
func_8010E168(1, 4);
}

View File

@ -711,7 +711,7 @@ s32 func_8010EB5C(void) {
if (subWpnId == 0) {
return 1;
}
if (subWpnId == 6 && D_80097400[0] != 0) {
if (subWpnId == 6 && g_unkGraphicsStruct.unk0 != 0) {
return 4;
}
if (func_8010EADC(subWpnId, subWpn.unk6) < 0) {

View File

@ -1174,7 +1174,7 @@ void func_80115BB0(void) {
PLAYER.velocityX = 0;
PLAYER.animFrameDuration = 4;
if (D_80097420[0] == 0) {
if (g_unkGraphicsStruct.unk20 == 0) {
if (g_Player.pl_vram_flag & 1) {
func_8010E570(0);
} else {

View File

@ -9,7 +9,7 @@ void func_80115F54(void) {
var_s2 = false;
PLAYER.drawFlags = FLAG_DRAW_ROTZ;
plDraw = g_PlayerDraw;
if (*D_80097420 == 0xFFF && PLAYER.step_s != 0) {
if (g_unkGraphicsStruct.unk20 == 0xFFF && PLAYER.step_s != 0) {
SetPlayerStep(Player_Unk17);
PLAYER.velocityY = 0;
PLAYER.velocityX = 0;

View File

@ -80,7 +80,7 @@ void func_8011A4D0(void) {
s32 i2;
s32 enemy;
temp_s2 = *D_80097420;
temp_s2 = g_unkGraphicsStruct.unk20;
entity = g_CurrentEntity = &g_Entities[4];
for (i = 4; i < 64; i++, g_CurrentEntity++, entity++) {
if (i == 16 && entity->entityId == E_NONE) {

View File

@ -152,14 +152,6 @@ DR_ENV D_800974AC[16];
u32 D_8003C744 = 0;
s32 D_800973F8;
s32 D_800973FC;
s32 D_80097400[18];
s32 D_8009740C[3];
s32 g_BottomCornerTextTimer;
s32 g_BottomCornerTextPrims;
s32 D_80097418;
s32 D_8009741C[1];
s32 D_80097420[1];
s32 D_80097424;
s32 D_80097448[2];
s32 D_80097450;
Pos D_80097488;

View File

@ -939,7 +939,7 @@ void func_8015B348(void) {
switch (PLAYER.step_s) {
case 0:
g_CurrentEntity->flags |= FLAG_UNK_10000;
D_80097420[0] = 4;
g_unkGraphicsStruct.unk20 = 4;
func_8015C93C(0x2000);
if (PLAYER.velocityX == 0) {
@ -1056,7 +1056,7 @@ void func_8015B348(void) {
case 7:
if (PLAYER.animFrameDuration < 0) {
g_CurrentEntity->flags &= ~FLAG_UNK_10000;
D_80097420[0] = 0;
g_unkGraphicsStruct.unk20 = 0;
func_8015CF08();
func_8015C920(&D_801558DC);
g_Player.D_80072F00[13] = 4;

View File

@ -574,7 +574,7 @@ void func_8015E800(void) {
var_s5 = 0;
i = 0;
if (D_80097418 != 0) {
if (g_unkGraphicsStruct.unk18 != 0) {
*vram_ptr = 1;
return;
}
@ -748,7 +748,7 @@ void func_8015EE28(void) {
// weird thing where i has to get initialized first
i = 1;
if (D_80097418 != 0) {
if (g_unkGraphicsStruct.unk18 != 0) {
return;
}
for (i = 1; i < 4; i++) {
@ -911,7 +911,7 @@ void func_8015F414(void) {
u16* xPosPtr = &PLAYER.posX.i.hi;
s32* vram_ptr = &g_Player.pl_vram_flag;
if (D_80097418 != 0) {
if (g_unkGraphicsStruct.unk18 != 0) {
return;
}
temp_s0 =
@ -984,7 +984,7 @@ void func_8015F680(void) {
u16* xPosPtr = &PLAYER.posX.i.hi;
s32* vram_ptr = &g_Player.pl_vram_flag;
if (D_80097418 != 0) {
if (g_unkGraphicsStruct.unk18 != 0) {
return;
}
temp_s0 =
@ -1405,7 +1405,7 @@ void func_801603C4(void) {
s32 enemy;
s32 enemy2;
temp_s2 = *D_80097420;
temp_s2 = g_unkGraphicsStruct.unk20;
entity = g_CurrentEntity = &g_Entities[4];
for (i = 4; i < 0x40; i++, g_CurrentEntity++, entity++) {
if (entity->entityId != 0) {

View File

@ -1511,7 +1511,7 @@ void func_801719A4(Entity* self) {
s32 temp_a1_3;
s32 temp_t0;
s32 temp_v1_11;
if (*D_80097400 != 0) {
if (g_unkGraphicsStruct.unk0 != 0) {
// FAKE, needed to make step load at the right time
do {
D_800973FC = 0;

View File

@ -416,9 +416,9 @@ void CollectGold(u16 goldSize) {
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -150,13 +150,14 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -245,5 +246,5 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
#undef xpos
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}

View File

@ -542,7 +542,7 @@ void EntityPlatform(Entity* self) {
if ((GetDistanceToPlayerX() < 32) &&
((self->posY.i.hi - player->posY.i.hi) < 80)) {
D_8003C8B8 = 0;
*D_80097400 = 1;
g_unkGraphicsStruct.unk0 = 1;
if (g_Player.unk0C & PLAYER_STATUS_BAT_FORM) {
g_Player.padSim = PAD_R1;
} else if (g_Player.unk0C & PLAYER_STATUS_MIST_FORM) {
@ -656,8 +656,8 @@ void EntityPlatform(Entity* self) {
D_80097488.x.i.hi++;
} else {
D_8003C8B8 = 1;
if (*D_80097400 != 0) {
*D_80097400 = 0;
if (g_unkGraphicsStruct.unk0 != 0) {
g_unkGraphicsStruct.unk0 = 0;
}
g_Entities[1].ext.generic.unk7C.S8.unk0 = 1;
self->step++;

View File

@ -269,14 +269,14 @@ void func_80194FF4(u8 ySteps) {
INCLUDE_ASM("st/dre/nonmatchings/14774", EntitySuccubusCutscene);
void func_801961DC(s16 arg0) {
s16 temp_v0 = arg0 - *(s16*)D_8009740C;
s16 temp_v0 = arg0 - g_unkGraphicsStruct.unkC.S16.unk0;
if (temp_v0 > 1) {
D_8009740C[0]++;
g_unkGraphicsStruct.unkC.unk++;
} else if (temp_v0 < -1) {
D_8009740C[0]--;
g_unkGraphicsStruct.unkC.unk--;
} else {
D_8009740C[0] = arg0;
g_unkGraphicsStruct.unkC.unk = arg0;
}
}

View File

@ -479,9 +479,9 @@ void CollectGold(u16 goldSize) {
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -159,9 +159,9 @@ void EntityEquipItemDrop(Entity* self) {
break;
case 5:
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk != 0) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -656,13 +656,14 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -751,5 +752,5 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
#undef xpos
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}

View File

@ -537,9 +537,10 @@ void CollectGold(u16 goldSize) { // CollectGold
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims); // g_api.FreePrimitives
g_api.FreePrimitives(
g_unkGraphicsStruct.BottomCornerTextPrims); // g_api.FreePrimitives
*unk = 0;
}

View File

@ -12,7 +12,7 @@ void EntityPushAlucard(Entity* entity) {
g_Player.padSim = 0;
g_Player.D_80072EFC = 255;
player->posX.i.hi = 0;
*D_8009740C = 0;
g_unkGraphicsStruct.unkC.unk = 0;
player->animCurFrame = 0;
D_8003C8B8 = 0;
break;
@ -31,8 +31,8 @@ void EntityPushAlucard(Entity* entity) {
case 2:
player->posX.val += 0x88000;
*D_8009740C += 4;
if (*D_8009740C == 192) {
g_unkGraphicsStruct.unkC.unk += 4;
if (g_unkGraphicsStruct.unkC.unk == 192) {
entity->ext.generic.unk80.modeS32 = 0x48000;
entity->step++;
}
@ -41,8 +41,8 @@ void EntityPushAlucard(Entity* entity) {
break;
case 3:
if (*D_8009740C > 128) {
*D_8009740C -= 1;
if (g_unkGraphicsStruct.unkC.unk > 128) {
g_unkGraphicsStruct.unkC.unk -= 1;
entity->ext.generic.unk80.modeS32 = 0x38000;
} else {
entity->ext.generic.unk80.modeS32 = 0x48000;

View File

@ -447,9 +447,9 @@ void CollectGold(u16 goldSize) {
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -403,9 +403,9 @@ void EntityEquipItemDrop(Entity* self) {
break;
case 5:
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk != 0) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -865,13 +865,14 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -960,7 +961,7 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
#undef xpos
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}
INCLUDE_ASM("st/no3/nonmatchings/48A84", func_801D0A2C);

View File

@ -441,9 +441,9 @@ void CollectGold(u16 goldSize) {
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -412,9 +412,9 @@ void EntityEquipItemDrop(Entity* self) {
break;
case 5:
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk != 0) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -735,13 +735,14 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -830,7 +831,7 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
#undef xpos
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}
INCLUDE_ASM("st/np3/nonmatchings/402F4", func_801C4144);

View File

@ -472,7 +472,7 @@ void func_801B8E0C(Entity* self) {
case 0:
InitializeEntity(D_80180BEC);
D_8003C8B8 = 0;
*D_80097400 = 1;
g_unkGraphicsStruct.unk0 = 1;
g_Player.padSim = PAD_LEFT;
if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
g_Player.padSim = PAD_R2;
@ -500,8 +500,8 @@ void func_801B8E0C(Entity* self) {
case 2:
if (D_801CB734 & 0x2000) {
D_8003C8B8 = 1;
if (*D_80097400 != 0) {
*D_80097400 = 0;
if (g_unkGraphicsStruct.unk0 != 0) {
g_unkGraphicsStruct.unk0 = 0;
}
DestroyEntity(self);
}

View File

@ -477,9 +477,9 @@ void CollectGold(u16 goldSize) {
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -409,9 +409,9 @@ void EntityEquipItemDrop(Entity* self) {
break;
case 5:
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk != 0) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -770,13 +770,14 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -865,5 +866,5 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
#undef xpos
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}

View File

@ -296,9 +296,9 @@ void CollectGold(u16 goldSize) {
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -174,14 +174,14 @@ INCLUDE_ASM("st/st0/nonmatchings/28BF8", EntityDialogue);
void func_801AA218(s16 arg0) {
s16 temp_a1 = ((0xE0 - arg0) / 2) + 0x80;
s16 temp_v1 = temp_a1 - *D_8009740C;
s16 temp_v1 = temp_a1 - g_unkGraphicsStruct.unkC.S16.unk0;
if (temp_v1 >= 3) {
*D_8009740C = *D_8009740C + 2;
g_unkGraphicsStruct.unkC.unk += 2;
} else if (temp_v1 < -2) {
*D_8009740C = *D_8009740C - 2;
g_unkGraphicsStruct.unkC.unk -= 2;
} else {
*D_8009740C = temp_a1;
g_unkGraphicsStruct.unkC.unk = temp_a1;
}
}

View File

@ -921,13 +921,14 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -1016,7 +1017,7 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
#undef xpos
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}
INCLUDE_ASM("st/st0/nonmatchings/36358", EntityClouds);

View File

@ -11,10 +11,10 @@ void Update(void) {
}
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
if (!--*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
}
}

View File

@ -484,9 +484,9 @@ void CollectGold(u16 goldSize) {
*gold = MAX_GOLD;
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -413,9 +413,9 @@ void EntityEquipItemDrop(Entity* self) {
break;
case 5:
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk != 0) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
*unk = 0;
}

View File

@ -858,13 +858,14 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -953,5 +954,5 @@ void BottomCornerText(u8* str, u8 lower_left) {
}
}
#undef xpos
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}

View File

@ -59,13 +59,14 @@ void func_97000_8017AB54(u8* str, u8 lowerLeft) {
chIdx++;
}
g_BottomCornerTextPrims = g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_BottomCornerTextPrims == -1) {
g_unkGraphicsStruct.BottomCornerTextPrims =
g_api.AllocPrimitives(PRIM_SPRT, charcount + 4);
if (g_unkGraphicsStruct.BottomCornerTextPrims == -1) {
return;
}
#undef charcount
prim = &g_PrimBuf[g_BottomCornerTextPrims];
prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims];
prim->type = 3;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
@ -167,7 +168,7 @@ void func_97000_8017AB54(u8* str, u8 lowerLeft) {
xpos += 8;
}
}
g_BottomCornerTextTimer = 0x130;
g_unkGraphicsStruct.BottomCornerTextTimer = 0x130;
}
// Function that tests if a food is successfully eaten (collected)

View File

@ -251,7 +251,7 @@ void EntityWeaponShieldSpell(Entity* self) {
self->velocityY = 0;
DestroyEntityWeapon(1);
g_api.PlaySfx(0x641);
*D_80097420 = 1;
g_unkGraphicsStruct.unk20 = 1;
self->step++;
break;
@ -319,7 +319,7 @@ void EntityWeaponShieldSpell(Entity* self) {
g_api.CreateEntFactoryFromEntity(
self, ((g_HandId + 1) << 14) + 102, 0);
self->ext.weapon.unk80 = 0x18;
*D_80097420 = 0;
g_unkGraphicsStruct.unk20 = 0;
self->step++;
}
break;

View File

@ -10,10 +10,10 @@ void Update(void) {
}
}
unk = &g_BottomCornerTextTimer;
unk = &g_unkGraphicsStruct.BottomCornerTextTimer;
if (*unk) {
if (!--*unk) {
g_api.FreePrimitives(g_BottomCornerTextPrims);
g_api.FreePrimitives(g_unkGraphicsStruct.BottomCornerTextPrims);
}
}