Skip to content

Commit

Permalink
Merge pull request #556 from CT075/difficultymenu-fields
Browse files Browse the repository at this point in the history
A few descriptive field names for DifficultyMenu procs
  • Loading branch information
RevoSucks authored Jan 15, 2024
2 parents 3646dbc + cc1866f commit d8ae860
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
7 changes: 4 additions & 3 deletions include/savemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct DifficultyMenuSpritesProc
/* 29 */ u8 unk_29_0 : 1;
/* 29 */ u8 unk_29_1 : 1;
/* 2A */ u8 unk_2a;
/* 2B */ u8 unk_2b;
/* 2B */ u8 current_selection;
/* 2C */ s16 unk_2c;
/* 2E */ s16 unk_2e;
/* 30 */ u16 unk_30;
Expand All @@ -83,9 +83,10 @@ struct DifficultyMenuSpritesProc
struct DifficultyMenuProc
{
/* 00 */ PROC_HEADER;
// Frame counter?
/* 2C */ int unk_2c;
/* 30 */ u8 unk_30;
/* 34 */ struct DifficultyMenuSpritesProc * unk_34;
/* 30 */ u8 current_selection;
/* 34 */ struct DifficultyMenuSpritesProc * sprites_proc;
/* 38 */ struct Text unk_38[5];
};

Expand Down
38 changes: 19 additions & 19 deletions src/difficultymenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void DrawDifficultyModeText(struct DifficultyMenuProc * proc)
}

th = proc->unk_38;
str = GetStringFromIndex(gTextIds_DifficultyDescription[proc->unk_30]);
str = GetStringFromIndex(gTextIds_DifficultyDescription[proc->current_selection]);

while (1)
{
Expand Down Expand Up @@ -390,19 +390,19 @@ void InitDifficultySelectScreen(struct DifficultyMenuProc * proc)

BG_EnableSyncByMask(BG0_SYNC_BIT | BG1_SYNC_BIT);

proc->unk_34 = StartDrawDifficultyMenuSprites(proc);
proc->unk_30 = 0;
proc->unk_34->unk_2b = 0;
proc->unk_34->unk_2c = gUnknown_08A209FC[proc->unk_30].a;
proc->unk_34->unk_2e = gUnknown_08A209FC[proc->unk_30].b;
proc->sprites_proc = StartDrawDifficultyMenuSprites(proc);
proc->current_selection = 0;
proc->sprites_proc->current_selection = 0;
proc->sprites_proc->unk_2c = gUnknown_08A209FC[proc->current_selection].a;
proc->sprites_proc->unk_2e = gUnknown_08A209FC[proc->current_selection].b;

return;
}

//! FE8U = 0x080AC1A8
void DifficultySelect_Init(struct DifficultyMenuProc * proc)
{
proc->unk_30 = 0;
proc->current_selection = 0;
proc->unk_2c = 0;
InitDifficultySelectScreen(proc);
return;
Expand Down Expand Up @@ -463,26 +463,26 @@ void DifficultySelect_Loop_KeyHandler(struct DifficultyMenuProc * proc)

if (gKeyStatusPtr->repeatedKeys & DPAD_UP)
{
if (proc->unk_30 == 0)
if (proc->current_selection == 0)
{
proc->unk_30 = 2;
proc->current_selection = 2;
}
else
{
proc->unk_30--;
proc->current_selection--;
}

hasChanged = 1;
}
else if (gKeyStatusPtr->repeatedKeys & DPAD_DOWN)
{
if (proc->unk_30 == 2)
if (proc->current_selection == 2)
{
proc->unk_30 = 0;
proc->current_selection = 0;
}
else
{
proc->unk_30++;
proc->current_selection++;
}

hasChanged = 1;
Expand All @@ -491,14 +491,14 @@ void DifficultySelect_Loop_KeyHandler(struct DifficultyMenuProc * proc)
if (hasChanged != 0)
{
PlaySoundEffect(0x66);
proc->unk_34->unk_2b = proc->unk_30;
sub_80AC680(proc->unk_34, gUnknown_08A209FC[proc->unk_30].a, gUnknown_08A209FC[proc->unk_30].b);
proc->sprites_proc->current_selection = proc->current_selection;
sub_80AC680(proc->sprites_proc, gUnknown_08A209FC[proc->current_selection].a, gUnknown_08A209FC[proc->current_selection].b);
DrawDifficultyModeText(proc);
sub_80AC034(proc);
return;
}

if (proc->unk_34->unk_29_1)
if (proc->sprites_proc->unk_29_1)
{
return;
}
Expand All @@ -507,7 +507,7 @@ void DifficultySelect_Loop_KeyHandler(struct DifficultyMenuProc * proc)
{
proc->unk_2c = 0;
PlaySoundEffect(0x6a);
switch (proc->unk_30)
switch (proc->current_selection)
{
case 0:
savemenu_SetDifficultyChoice(0, 0);
Expand Down Expand Up @@ -754,7 +754,7 @@ void DrawDifficultySprites_Loop(struct DifficultyMenuSpritesProc * proc)
s16 x = 8; // ?
s16 y = 48 + i * 32;

if (i == proc->unk_2b)
if (i == proc->current_selection)
{
PutSpriteExt(4, x, y, gSprite_08A20AC2, OAM2_PAL(5 + (i * 2)));
}
Expand All @@ -766,7 +766,7 @@ void DrawDifficultySprites_Loop(struct DifficultyMenuSpritesProc * proc)
PutSpriteExt(4, x, y, gSpriteArray_08A20B08[i], OAM2_PAL(4));
}

sub_80AC4F8(proc->unk_2a, proc->unk_2b);
sub_80AC4F8(proc->unk_2a, proc->current_selection);
DrawDifficultyMenuCursorMaybe(proc);

return;
Expand Down

0 comments on commit d8ae860

Please sign in to comment.