Split+data options_menu

This commit is contained in:
Kermalis 2023-09-23 03:33:46 -04:00
parent 3635746993
commit 7fbe27f7b8
19 changed files with 545 additions and 609 deletions

View File

@ -1,97 +0,0 @@
.section .rodata
@ options_menu #1
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_80DBFB0
gUnknown_80DBFB0: @ 80DBFB0
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global UnkData_80DBFC8
UnkData_80DBFC8:
.byte 0x01, 0x00, 0x07, 0x00
.global gUnknown_80DBFCC
gUnknown_80DBFCC: @ 80DBFCC
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x06, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x02, 0x00
.byte 0x0A, 0x00, 0x06, 0x00
.byte 0x06, 0x00, 0x00, 0x00
.4byte UnkData_80DBFC8
.global gOthers_MenuOption
gOthers_MenuOption: @ 80DBFE4
.string "Others\0"
.align 2,0
.global gUnknown_80DBFEC
gUnknown_80DBFEC: @ 80DBFEC
.string "Change settings?\0"
.align 2,0
.global gOthers_GameOptions
gOthers_GameOptions: @ 80DC000
.string "Game Options\0"
.align 2,0
.global gOthers_Hints
gOthers_Hints: @ 80DC010
.string "Hints\0"
@ options_menu #2
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_80DC020
gUnknown_80DC020: @ 80DC020
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global UnkData_80DC038
UnkData_80DC038:
.byte 0x01, 0x00, 0x0a, 0x00
.global gUnknown_80DC03C
gUnknown_80DC03C: @ 80DC03C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x06, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x02, 0x00
.byte 0x18, 0x00, 0x10, 0x00
.byte 0x12, 0x00, 0x00, 0x00
.4byte UnkData_80DC038
.global gWindowBGTitle
gWindowBGTitle: @ 80DC054
.string "Game Options\0"
.align 2,0
.global gUnknown_80DC064
gUnknown_80DC064: @ 80DC064
.string "Windows{UNK_MACRO_3D M3D_80}Blue{UNK_MACRO_3D M3D_120}Red{UNK_MACRO_3D M3D_160}Green\0"
.align 2,0
.global gWindowBGBlueString
gWindowBGBlueString: @ 80DC084
.string "Blue\0"
.align 2,0
.global gWindowBGRedString
gWindowBGRedString: @ 80DC08C
.string "Red\0"
.align 2,0
.global gWindowBGGreenString
gWindowBGGreenString: @ 80DC090
.string "Green\0"

View File

@ -16,7 +16,7 @@ enum FarOffPals
// GBA has 3 options while DS has 7 // GBA has 3 options while DS has 7
enum MapOption enum MapOption
{ {
MAP_OPTION_OFF = 0, MAP_OPTION_OFF,
MAP_OPTION_CLEAR, MAP_OPTION_CLEAR,
MAP_OPTION_SHADE, MAP_OPTION_SHADE,
NUM_GBA_MAP_OPTIONS, NUM_GBA_MAP_OPTIONS,
@ -24,7 +24,7 @@ enum MapOption
enum DSMapOption enum DSMapOption
{ {
TOP_TEAM_DATA_NO_BOTTOM = 0, TOP_TEAM_DATA_NO_BOTTOM,
TOP_TEAM_DATA_CLEAR_MAP_BOTTOM, TOP_TEAM_DATA_CLEAR_MAP_BOTTOM,
TOP_TEAM_DATA_SHADED_MAP_BOTTOM, TOP_TEAM_DATA_SHADED_MAP_BOTTOM,
TOP_MESSAGE_LOG_NO_BOTTOM, TOP_MESSAGE_LOG_NO_BOTTOM,
@ -36,12 +36,13 @@ enum DSMapOption
enum windowColor enum windowColor
{ {
WINDOW_COLOR_BLUE = 0, WINDOW_COLOR_BLUE,
WINDOW_COLOR_RED, WINDOW_COLOR_RED,
WINDOW_COLOR_GREEN, WINDOW_COLOR_GREEN,
NUM_WINDOW_COLORS, NUM_WINDOW_COLORS,
}; };
// size: 0x10
typedef struct GameOptions typedef struct GameOptions
{ {
// TODO: find where Controls/Touch Screen are in this structure in PMD Blue // TODO: find where Controls/Touch Screen are in this structure in PMD Blue
@ -52,13 +53,15 @@ typedef struct GameOptions
/* 0x3 */ bool8 gridEnable; /* 0x3 */ bool8 gridEnable;
/* 0x4 */ u8 mapOption; /* 0x4 */ u8 mapOption;
/* 0x5 */ u8 fill5[3]; /* 0x5 */ u8 fill5[3];
/* 0x8 */ u8 windowColor; /* 0x8 */ u8 windowColor;
/* 0x9 */ u8 unk9; // maybe Controls? /* 0x9 */ u8 unk9; // maybe Controls?
/* 0xA */ u8 unkA; // maybe Touch Screen? /* 0xA */ u8 unkA; // maybe Touch Screen?
/* 0xB */ u8 playerGender; /* 0xB */ u8 playerGender;
/* 0xC */ u8 unkC; /* 0xC */ u8 unkC;
} GameOptions; } GameOptions;
extern GameOptions *gGameOptionsRef;
GameOptions *GetGameOptions(void); GameOptions *GetGameOptions(void);
bool8 GameOptionsNotChange(GameOptions *); bool8 GameOptionsNotChange(GameOptions *);
void InitializeGameOptions(bool8 initializeGender); void InitializeGameOptions(bool8 initializeGender);

View File

@ -1,8 +0,0 @@
#ifndef GUARD_OPTIONS_MENU_H
#define GUARD_OPTIONS_MENU_H
bool8 sub_801DCC4(void);
u32 sub_801DCE8(void);
void sub_801DD50(void);
#endif // GUARD_OPTIONS_MENU_H

24
include/options_menu1.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef GUARD_OPTIONS_MENU1_H
#define GUARD_OPTIONS_MENU1_H
#include "game_options.h"
#include "structs/menu.h"
// size: 0x11C
struct unkStruct_203B25C
{
/* 0x0 */ u32 state;
/* 0x4 */ u32 chosenHintIndex;
/* 0x8 */ GameOptions newOptions;
/* 0x18 */ u32 menuAction;
/* 0x1C */ MenuStruct menu;
/* 0x6C */ MenuItem menuItems[8];
u16 unkAC[8];
UnkTextStruct2 unkBC[4];
};
bool8 sub_801DCC4(void);
u32 sub_801DCE8(void);
void sub_801DD50(void);
#endif // GUARD_OPTIONS_MENU1_H

22
include/options_menu2.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef GUARD_OPTIONS_MENU2_H
#define GUARD_OPTIONS_MENU2_H
#include "game_options.h"
#include "structs/menu.h"
// size: 0xAC
struct unkStruct_203B260
{
/* 0x0 */ GameOptions *optionsMenu;
/* 0x4 */ MenuInputStructSub unk4;
/* 0x10 */ MenuInputStruct input;
u32 unk44;
UnkTextStruct2 *unk48;
UnkTextStruct2 unk4C[4];
};
bool8 sub_801E198(GameOptions *optionsMenu);
u32 sub_801E218(void);
void sub_801E2C4(void);
#endif // GUARD_OPTIONS_MENU2_H

View File

@ -112,7 +112,8 @@ SECTIONS {
src/code_801C8C4.o(.text); src/code_801C8C4.o(.text);
src/code_801D014.o(.text); src/code_801D014.o(.text);
src/code_801D9E4.o(.text); src/code_801D9E4.o(.text);
src/options_menu.o(.text); src/options_menu1.o(.text);
src/options_menu2.o(.text);
src/hints_menu1.o(.text); src/hints_menu1.o(.text);
src/hints_menu2.o(.text); src/hints_menu2.o(.text);
src/gulpin_shop.o(.text); src/gulpin_shop.o(.text);
@ -431,7 +432,8 @@ SECTIONS {
src/code_801C8C4.o(.rodata); src/code_801C8C4.o(.rodata);
src/code_801D014.o(.rodata); src/code_801D014.o(.rodata);
src/code_801D9E4.o(.rodata); src/code_801D9E4.o(.rodata);
data/data_80DBD98.o(.rodata); src/options_menu1.o(.rodata);
src/options_menu2.o(.rodata);
src/hints_menu1.o(.rodata); src/hints_menu1.o(.rodata);
src/hints_menu2.o(.rodata); src/hints_menu2.o(.rodata);
src/gulpin_shop.o(.rodata); src/gulpin_shop.o(.rodata);

View File

@ -54,7 +54,6 @@ extern u32 gUnknown_203B03C;
extern u16 gUnknown_2026E4E; extern u16 gUnknown_2026E4E;
extern s32 gUnknown_2000A80; extern s32 gUnknown_2000A80;
extern OpenedFile *gTitlePaletteFile; extern OpenedFile *gTitlePaletteFile;
extern GameOptions *gGameOptionsRef;
extern char gPMDBuildVersion[]; extern char gPMDBuildVersion[];

View File

@ -17,8 +17,6 @@
#include "sprite.h" #include "sprite.h"
#include "event_flag.h" #include "event_flag.h"
extern GameOptions *gGameOptionsRef;
// size: 0x4DD8 // size: 0x4DD8
struct UnkBgStruct struct UnkBgStruct
{ {

View File

@ -12,8 +12,6 @@
extern void nullsub_8(u8); extern void nullsub_8(u8);
extern void xxx_call_update_bg_vram(); extern void xxx_call_update_bg_vram();
extern GameOptions *gGameOptionsRef;
void sub_8012A18() void sub_8012A18()
{ {
sub_8011860(); sub_8011860();

View File

@ -19,7 +19,7 @@
#include "ground_map_1.h" #include "ground_map_1.h"
#include "memory.h" #include "memory.h"
#include "menu_input.h" #include "menu_input.h"
#include "options_menu.h" #include "options_menu1.h"
#include "party_list_menu.h" #include "party_list_menu.h"
#include "rescue_team_info.h" #include "rescue_team_info.h"
#include "text1.h" #include "text1.h"

View File

@ -15,8 +15,6 @@
#include "game_options.h" #include "game_options.h"
#include "text_util.h" #include "text_util.h"
extern GameOptions *gGameOptionsRef;
struct unkStruct_80F520C struct unkStruct_80F520C
{ {
u8 unk0; u8 unk0;

25
src/data/options_menu1.h Normal file
View File

@ -0,0 +1,25 @@
ALIGNED(4) static const u8 sFill[] = _("pksdir0");
static const UnkTextStruct2 sUnknown_80DBFB0 = {
0, 0, 0, 0,
3,
0, 0,
0, 0,
0, 0,
NULL
};
static const u8 sUnknown_80DBFC8[] = {1, 0, 7, 0};
static const UnkTextStruct2 sUnknown_80DBFCC = {
0, 0, 0, 0,
6,
2, 2,
10, 6,
6, 0,
sUnknown_80DBFC8
};
ALIGNED(4) static const u8 sOthers[] = _("Others");
ALIGNED(4) static const u8 sChangeSettingsPrompt[] = _("Change settings?");
ALIGNED(4) static const u8 sGameOptions[] = _("Game Options");
ALIGNED(4) static const u8 sHints[] = _("Hints");

26
src/data/options_menu2.h Normal file
View File

@ -0,0 +1,26 @@
ALIGNED(4) static const u8 sFill[] = _("pksdir0");
static const UnkTextStruct2 sUnknown_80DC020 = {
0, 0, 0, 0,
3,
0, 0,
0, 0,
0, 0,
NULL
};
static const u8 sUnknown_80DC038[] = {1, 0, 10, 0};
static const UnkTextStruct2 sUnknown_80DC03C = {
0, 0, 0, 0,
6,
2, 2,
24, 16,
18, 0,
sUnknown_80DC038
};
ALIGNED(4) static const u8 sGameOptions[] = _("Game Options");
ALIGNED(4) static const u8 sUnknown_80DC064[] = _("Windows{UNK_MACRO_3D M3D_80}Blue{UNK_MACRO_3D M3D_120}Red{UNK_MACRO_3D M3D_160}Green");
ALIGNED(4) static const u8 sBlue[] = _("Blue");
ALIGNED(4) static const u8 sRed[] = _("Red");
ALIGNED(4) static const u8 sGreen[] = _("Green");

View File

@ -1,486 +0,0 @@
#include "global.h"
#include "code_80118A4.h"
#include "code_80130A8.h"
#include "code_8098BDC.h"
#include "common_strings.h"
#include "constants/colors.h"
#include "constants/input.h"
#include "game_options.h"
#include "hints_menu1.h"
#include "hints_menu2.h"
#include "memory.h"
#include "menu_input.h"
#include "options_menu.h"
#include "text1.h"
#include "text2.h"
struct unkStruct_203B25C
{
// size: 0x11C
u32 state;
u32 chosenHintIndex;
GameOptions newOptions;
u32 menuAction;
MenuStruct menu;
MenuItem menuItems[8];
u16 unkAC[8];
UnkTextStruct2 unkBC[4];
};
struct unkStruct_203B260
{
GameOptions *optionsMenu;
MenuInputStructSub unk4;
MenuInputStruct input;
u32 unk44;
UnkTextStruct2 * unk48;
UnkTextStruct2 unk4C[4];
};
struct unkStruct_203B260 *gUnknown_203B260;
extern GameOptions *gGameOptionsRef;
extern struct unkStruct_203B25C *gUnknown_203B25C;
extern const UnkTextStruct2 gUnknown_80DBFB0;
extern const UnkTextStruct2 gUnknown_80DBFCC;
extern const UnkTextStruct2 gUnknown_80DC020;
extern const UnkTextStruct2 gUnknown_80DC03C;
extern const u8 gWindowBGTitle[];
extern const u8 gUnknown_80DC064[];
extern const u8 gWindowBGGreenString[];
extern const u8 gWindowBGRedString[];
extern const u8 gWindowBGBlueString[];
extern const char gOthers_MenuOption[];
extern const char gUnknown_80DBFEC[];
extern const char gOthers_GameOptions[];
extern const char gOthers_Hints[];
extern void CreateOthersMenu(void);
void CreateOptionsMenu(void);
void nullsub_38(void);
extern void SetOptionsMenuState(u32);
extern void HandleOthersMenu();
extern void sub_801E088();
extern void sub_801E0E0();
extern void sub_801E0FC();
extern void HandleChangeSettingsMenu();
extern void sub_801DD84();
extern void sub_801DED0();
extern bool8 sub_801E198(GameOptions *);
extern void CreateChangeSettingsConfirmMenu(void);
extern u32 sub_801E218(void);
extern void sub_801E2C4(void);
enum
{
MENU_OPTION_DEFAULT = 1,
MENU_OPTION_HINTS,
MENU_OPTION_GAMEOPTIONS,
MENU_OPTION_YES,
MENU_OPTION_NO
};
enum OptionsMenuStates {
OPTIONS_MENU_INIT,
OPTIONS_MENU_MAIN,
OPTIONS_MENU_EXIT,
OPTIONS_MENU_PRE_HINT_SELECTION,
OPTIONS_MENU_HINT_SELECTION,
OPTIONS_MENU_DISPLAY_HINT,
OPTIONS_MENU_UNKNOWN_6,
OPTIONS_MENU_CONFIRM_NEW_OPTIONS,
};
bool8 sub_801DCC4(void)
{
gUnknown_203B25C = MemoryAlloc(sizeof(struct unkStruct_203B25C), 8);
SetOptionsMenuState(OPTIONS_MENU_INIT);
return TRUE;
}
u32 sub_801DCE8(void)
{
switch(gUnknown_203B25C->state)
{
case OPTIONS_MENU_EXIT:
return 3;
case OPTIONS_MENU_INIT:
case OPTIONS_MENU_MAIN:
HandleOthersMenu();
break;
case OPTIONS_MENU_PRE_HINT_SELECTION:
case OPTIONS_MENU_HINT_SELECTION:
sub_801E088();
break;
case OPTIONS_MENU_DISPLAY_HINT:
sub_801E0E0();
break;
case 6:
sub_801E0FC();
break;
case OPTIONS_MENU_CONFIRM_NEW_OPTIONS:
HandleChangeSettingsMenu();
break;
default:
break;
}
return 0;
}
void sub_801DD50(void)
{
if(gUnknown_203B25C != NULL)
{
MemoryFree(gUnknown_203B25C);
gUnknown_203B25C = NULL;
}
}
void SetOptionsMenuState(u32 newState)
{
gUnknown_203B25C->state = newState;
sub_801DD84();
sub_801DED0();
}
void sub_801DD84(void)
{
s32 index;
sub_8006518(gUnknown_203B25C->unkBC);
switch(gUnknown_203B25C->state)
{
case OPTIONS_MENU_INIT:
CreateOthersMenu();
for(index = 0; index < 8; index++)
{
if(gUnknown_203B25C->unkAC[index] == 0)
{
gUnknown_203B25C->menuAction = gUnknown_203B25C->menuItems[index].menuAction;
break;
}
}
for(index = 0; index < 4; index++)
{
gUnknown_203B25C->unkBC[index] = gUnknown_80DBFB0;
}
gUnknown_203B25C->unkBC[0] = gUnknown_80DBFCC;
sub_8012CAC(&gUnknown_203B25C->unkBC[0], gUnknown_203B25C->menuItems);
gUnknown_203B25C->unkBC[0].unkC = 0xA;
break;
case OPTIONS_MENU_MAIN:
CreateOthersMenu();
for(index = 0; index < 4; index++)
{
gUnknown_203B25C->unkBC[index] = gUnknown_80DBFB0;
}
gUnknown_203B25C->unkBC[0] = gUnknown_80DBFCC;
sub_8012CAC(&gUnknown_203B25C->unkBC[0], gUnknown_203B25C->menuItems);
gUnknown_203B25C->unkBC[0].unkC = 0xA;
break;
default:
for(index = 0; index < 4; index++)
{
gUnknown_203B25C->unkBC[index] = gUnknown_80DBFB0;
}
break;
}
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B25C->unkBC, TRUE, TRUE);
}
void sub_801DED0(void)
{
switch(gUnknown_203B25C->state) {
case OPTIONS_MENU_INIT:
case OPTIONS_MENU_MAIN:
gUnknown_203B25C->menu.unk0 = gOthers_MenuOption;
sub_8012D60(&gUnknown_203B25C->menu,gUnknown_203B25C->menuItems,0,gUnknown_203B25C->unkAC,gUnknown_203B25C->menuAction,0);
break;
case OPTIONS_MENU_PRE_HINT_SELECTION:
sub_801E3F0(0);
break;
case OPTIONS_MENU_HINT_SELECTION:
CreateHintSelectionScreen(1);
break;
case OPTIONS_MENU_DISPLAY_HINT:
CreateHintDisplayScreen(gUnknown_203B25C->chosenHintIndex);
break;
case 6:
// Load our current options?
gUnknown_203B25C->newOptions = *gGameOptionsRef;
sub_801E198(&gUnknown_203B25C->newOptions);
break;
case OPTIONS_MENU_CONFIRM_NEW_OPTIONS:
CreateChangeSettingsConfirmMenu();
// Change settings?
sub_8014248(gUnknown_80DBFEC,0,4,gUnknown_203B25C->menuItems,0,4,0,0,0x20);
break;
}
}
void CreateOthersMenu(void)
{
s32 loopMax;
MemoryFill16(gUnknown_203B25C->unkAC,0,sizeof(gUnknown_203B25C->unkAC));
loopMax = 0;
gUnknown_203B25C->menuItems[loopMax].text = gOthers_GameOptions;
gUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_GAMEOPTIONS;
loopMax += 1;
gUnknown_203B25C->menuItems[loopMax].text = gOthers_Hints;
gUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_HINTS;
loopMax += 1;
gUnknown_203B25C->menuItems[loopMax].text = NULL;
gUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_DEFAULT;
}
void CreateChangeSettingsConfirmMenu(void)
{
s32 loopMax;
MemoryFill16(gUnknown_203B25C->unkAC,0,sizeof(gUnknown_203B25C->unkAC));
loopMax = 0;
gUnknown_203B25C->menuItems[loopMax].text = *gCommonYes;
gUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_YES;
loopMax += 1;
gUnknown_203B25C->menuItems[loopMax].text = *gCommonNo;
gUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_NO;
loopMax += 1;
gUnknown_203B25C->menuItems[loopMax].text = NULL;
gUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_DEFAULT;
}
void HandleOthersMenu(void)
{
s32 menuAction;
menuAction = 0;
if (sub_8012FD8(&gUnknown_203B25C->menu) == '\0') {
sub_8013114(&gUnknown_203B25C->menu,&menuAction);
gUnknown_203B25C->menuAction = menuAction;
}
switch(menuAction)
{
case MENU_OPTION_HINTS:
SetOptionsMenuState(OPTIONS_MENU_PRE_HINT_SELECTION);
break;
case MENU_OPTION_GAMEOPTIONS:
SetOptionsMenuState(6);
break;
case MENU_OPTION_DEFAULT:
SetOptionsMenuState(OPTIONS_MENU_EXIT);
break;
}
}
void sub_801E088(void)
{
switch(sub_801E474(TRUE))
{
case 3:
case 4:
gUnknown_203B25C->chosenHintIndex = GetChosenHintIndex();
SetOptionsMenuState(OPTIONS_MENU_DISPLAY_HINT);
break;
case 2:
sub_801E54C();
SetOptionsMenuState(OPTIONS_MENU_MAIN);
break;
case 0:
case 1:
default:
break;
}
}
void sub_801E0E0(void)
{
switch(HandleHintDisplayScreenInput())
{
case 3:
case 2:
DestroyHintDisplayScreen();
SetOptionsMenuState(OPTIONS_MENU_HINT_SELECTION);
break;
case 0:
case 1:
default:
break;
}
}
void sub_801E0FC(void)
{
switch(sub_801E218())
{
case 2:
case 3:
sub_801E2C4();
// Check to see if the options changed?
if (GameOptionsNotChange(&gUnknown_203B25C->newOptions)) {
SetOptionsMenuState(OPTIONS_MENU_MAIN);
}
else {
SetOptionsMenuState(OPTIONS_MENU_CONFIRM_NEW_OPTIONS);
}
break;
case 0:
case 1:
break;
}
}
void HandleChangeSettingsMenu(void)
{
s32 menuAction;
if (sub_80144A4(&menuAction) == 0)
{
switch(menuAction)
{
case MENU_OPTION_YES:
// Save our option changes??
*gGameOptionsRef = gUnknown_203B25C->newOptions;
SetWindowBGColor();
sub_8099690(0);
SetOptionsMenuState(OPTIONS_MENU_MAIN);
break;
case MENU_OPTION_DEFAULT:
case MENU_OPTION_NO:
SetOptionsMenuState(OPTIONS_MENU_MAIN);
break;
}
}
}
// THIS IS A NEW FILE
bool8 sub_801E198(GameOptions *optionsMenu)
{
gUnknown_203B260 = MemoryAlloc(sizeof(struct unkStruct_203B260), 8);
gUnknown_203B260->optionsMenu = optionsMenu;
sub_801317C(&gUnknown_203B260->unk4);
gUnknown_203B260->unk44 = 0;
gUnknown_203B260->unk48 = &gUnknown_203B260->unk4C[0];
sub_8006518(gUnknown_203B260->unk4C);
gUnknown_203B260->unk4C[gUnknown_203B260->unk44] = gUnknown_80DC03C;
sub_8012D08(gUnknown_203B260->unk48,1);
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B260->unk4C, TRUE, TRUE);
sub_8013818(&gUnknown_203B260->input,1,1,gUnknown_203B260->unk44);
nullsub_38();
CreateOptionsMenu();
return TRUE;
}
u32 sub_801E218(void)
{
bool32 flag;
flag = FALSE;
switch(sub_8012AE8())
{
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
return 2;
case INPUT_A_BUTTON:
PlayMenuSoundEffect(0);
return 3;
case INPUT_DPAD_LEFT:
if (gUnknown_203B260->input.menuIndex == 0)
{
if (gUnknown_203B260->optionsMenu->windowColor == WINDOW_COLOR_BLUE) {
gUnknown_203B260->optionsMenu->windowColor = WINDOW_COLOR_GREEN;
}
else {
gUnknown_203B260->optionsMenu->windowColor--;
}
PlayMenuSoundEffect(3);
flag = TRUE;
}
break;
case INPUT_DPAD_RIGHT:
if(gUnknown_203B260->input.menuIndex == 0)
{
if (gUnknown_203B260->optionsMenu->windowColor > WINDOW_COLOR_RED) {
gUnknown_203B260->optionsMenu->windowColor = WINDOW_COLOR_BLUE;
}
else
gUnknown_203B260->optionsMenu->windowColor++;
PlayMenuSoundEffect(3);
flag = TRUE;
}
break;
}
// == 1 is needed for matching
if ((sub_80138B8(&gUnknown_203B260->input,1) != 0) || (flag == TRUE)) {
nullsub_38();
CreateOptionsMenu();
return 1;
}
else {
return 0;
}
}
void sub_801E2C4(void)
{
if(gUnknown_203B260 != NULL)
{
gUnknown_203B260->unk4C[gUnknown_203B260->unk44] = gUnknown_80DC020;
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B260->unk4C, TRUE, TRUE);
MemoryFree(gUnknown_203B260);
gUnknown_203B260 = NULL;
}
}
void nullsub_38(void)
{
}
void CreateOptionsMenu(void)
{
u32 length;
u32 y;
sub_8008C54(gUnknown_203B260->unk44);
sub_80073B8(gUnknown_203B260->unk44);
xxx_call_draw_string(0x10,0,gWindowBGTitle,gUnknown_203B260->unk44,0);
y = sub_8013800(&gUnknown_203B260->input,0);
xxx_call_draw_string(8,y,gUnknown_80DC064,gUnknown_203B260->unk44,0);
switch(gUnknown_203B260->optionsMenu->windowColor)
{
case WINDOW_COLOR_BLUE:
length = sub_8008ED0(gWindowBGBlueString);
sub_80078A4(gUnknown_203B260->unk44,gUnknown_203B260->optionsMenu->windowColor * 0x28 + 0x50,
y + 0xA,length,COLOR_WHITE_2);
break;
case WINDOW_COLOR_RED:
length = sub_8008ED0(gWindowBGRedString);
sub_80078A4(gUnknown_203B260->unk44,gUnknown_203B260->optionsMenu->windowColor * 0x28 + 0x50,
y + 0xA,length,COLOR_WHITE_2);
break;
case WINDOW_COLOR_GREEN:
length = sub_8008ED0(gWindowBGGreenString);
sub_80078A4(gUnknown_203B260->unk44,gUnknown_203B260->optionsMenu->windowColor * 0x28 + 0x50,
y + 0xA,length,COLOR_WHITE_2);
break;
}
sub_80073E0(gUnknown_203B260->unk44);
}

310
src/options_menu1.c Normal file
View File

@ -0,0 +1,310 @@
#include "global.h"
#include "code_80130A8.h"
#include "code_8098BDC.h"
#include "common_strings.h"
#include "hints_menu1.h"
#include "hints_menu2.h"
#include "memory.h"
#include "menu_input.h"
#include "options_menu1.h"
#include "options_menu2.h"
#include "text1.h"
#include "text2.h"
enum
{
MENU_OPTION_DEFAULT = 1,
MENU_OPTION_HINTS,
MENU_OPTION_GAMEOPTIONS,
MENU_OPTION_YES,
MENU_OPTION_NO
};
enum OptionsMenuStates
{
OPTIONS_MENU_INIT,
OPTIONS_MENU_MAIN,
OPTIONS_MENU_EXIT,
OPTIONS_MENU_PRE_HINT_SELECTION,
OPTIONS_MENU_HINT_SELECTION,
OPTIONS_MENU_DISPLAY_HINT,
OPTIONS_MENU_UNKNOWN_6,
OPTIONS_MENU_CONFIRM_NEW_OPTIONS,
};
static EWRAM_DATA_2 struct unkStruct_203B25C *sUnknown_203B25C = {0};
#include "data/options_menu1.h"
static void CreateChangeSettingsConfirmMenu(void);
static void CreateOthersMenu(void);
static void HandleChangeSettingsMenu(void);
static void HandleOthersMenu(void);
static void SetOptionsMenuState(u32 newState);
static void sub_801DD84(void);
static void sub_801DED0(void);
static void sub_801E088(void);
static void sub_801E0E0(void);
static void sub_801E0FC(void);
bool8 sub_801DCC4(void)
{
sUnknown_203B25C = MemoryAlloc(sizeof(struct unkStruct_203B25C), 8);
SetOptionsMenuState(OPTIONS_MENU_INIT);
return TRUE;
}
u32 sub_801DCE8(void)
{
switch (sUnknown_203B25C->state) {
case OPTIONS_MENU_EXIT:
return 3;
case OPTIONS_MENU_INIT:
case OPTIONS_MENU_MAIN:
HandleOthersMenu();
break;
case OPTIONS_MENU_PRE_HINT_SELECTION:
case OPTIONS_MENU_HINT_SELECTION:
sub_801E088();
break;
case OPTIONS_MENU_DISPLAY_HINT:
sub_801E0E0();
break;
case 6:
sub_801E0FC();
break;
case OPTIONS_MENU_CONFIRM_NEW_OPTIONS:
HandleChangeSettingsMenu();
break;
default:
break;
}
return 0;
}
void sub_801DD50(void)
{
if (sUnknown_203B25C != NULL) {
MemoryFree(sUnknown_203B25C);
sUnknown_203B25C = NULL;
}
}
static void SetOptionsMenuState(u32 newState)
{
sUnknown_203B25C->state = newState;
sub_801DD84();
sub_801DED0();
}
static void sub_801DD84(void)
{
s32 i;
sub_8006518(sUnknown_203B25C->unkBC);
switch (sUnknown_203B25C->state) {
case OPTIONS_MENU_INIT:
CreateOthersMenu();
for (i = 0; i < 8; i++) {
if (sUnknown_203B25C->unkAC[i] == 0) {
sUnknown_203B25C->menuAction = sUnknown_203B25C->menuItems[i].menuAction;
break;
}
}
for(i = 0; i < 4; i++)
sUnknown_203B25C->unkBC[i] = sUnknown_80DBFB0;
sUnknown_203B25C->unkBC[0] = sUnknown_80DBFCC;
sub_8012CAC(&sUnknown_203B25C->unkBC[0], sUnknown_203B25C->menuItems);
sUnknown_203B25C->unkBC[0].unkC = 10;
break;
case OPTIONS_MENU_MAIN:
CreateOthersMenu();
for (i = 0; i < 4; i++)
sUnknown_203B25C->unkBC[i] = sUnknown_80DBFB0;
sUnknown_203B25C->unkBC[0] = sUnknown_80DBFCC;
sub_8012CAC(&sUnknown_203B25C->unkBC[0], sUnknown_203B25C->menuItems);
sUnknown_203B25C->unkBC[0].unkC = 10;
break;
default:
for (i = 0; i < 4; i++)
sUnknown_203B25C->unkBC[i] = sUnknown_80DBFB0;
break;
}
ResetUnusedInputStruct();
sub_800641C(sUnknown_203B25C->unkBC, TRUE, TRUE);
}
static void sub_801DED0(void)
{
switch (sUnknown_203B25C->state) {
case OPTIONS_MENU_INIT:
case OPTIONS_MENU_MAIN:
sUnknown_203B25C->menu.unk0 = sOthers;
sub_8012D60(&sUnknown_203B25C->menu, sUnknown_203B25C->menuItems, 0, sUnknown_203B25C->unkAC, sUnknown_203B25C->menuAction, 0);
break;
case OPTIONS_MENU_PRE_HINT_SELECTION:
sub_801E3F0(0);
break;
case OPTIONS_MENU_HINT_SELECTION:
CreateHintSelectionScreen(1);
break;
case OPTIONS_MENU_DISPLAY_HINT:
CreateHintDisplayScreen(sUnknown_203B25C->chosenHintIndex);
break;
case 6:
// Load our current options?
sUnknown_203B25C->newOptions = *gGameOptionsRef;
sub_801E198(&sUnknown_203B25C->newOptions);
break;
case OPTIONS_MENU_CONFIRM_NEW_OPTIONS:
CreateChangeSettingsConfirmMenu();
sub_8014248(sChangeSettingsPrompt, 0, 4, sUnknown_203B25C->menuItems, 0, 4, 0, 0, 32);
break;
}
}
static void CreateOthersMenu(void)
{
s32 loopMax;
MemoryFill16(sUnknown_203B25C->unkAC, 0, sizeof(sUnknown_203B25C->unkAC));
loopMax = 0;
sUnknown_203B25C->menuItems[loopMax].text = sGameOptions;
sUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_GAMEOPTIONS;
loopMax++;
sUnknown_203B25C->menuItems[loopMax].text = sHints;
sUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_HINTS;
loopMax++;
sUnknown_203B25C->menuItems[loopMax].text = NULL;
sUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_DEFAULT;
}
static void CreateChangeSettingsConfirmMenu(void)
{
s32 loopMax;
MemoryFill16(sUnknown_203B25C->unkAC, 0, sizeof(sUnknown_203B25C->unkAC));
loopMax = 0;
sUnknown_203B25C->menuItems[loopMax].text = gCommonYes[0];
sUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_YES;
loopMax++;
sUnknown_203B25C->menuItems[loopMax].text = gCommonNo[0];
sUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_NO;
loopMax++;
sUnknown_203B25C->menuItems[loopMax].text = NULL;
sUnknown_203B25C->menuItems[loopMax].menuAction = MENU_OPTION_DEFAULT;
}
static void HandleOthersMenu(void)
{
s32 menuAction;
menuAction = 0;
if (sub_8012FD8(&sUnknown_203B25C->menu) == 0) {
sub_8013114(&sUnknown_203B25C->menu, &menuAction);
sUnknown_203B25C->menuAction = menuAction;
}
switch (menuAction) {
case MENU_OPTION_HINTS:
SetOptionsMenuState(OPTIONS_MENU_PRE_HINT_SELECTION);
break;
case MENU_OPTION_GAMEOPTIONS:
SetOptionsMenuState(6);
break;
case MENU_OPTION_DEFAULT:
SetOptionsMenuState(OPTIONS_MENU_EXIT);
break;
}
}
static void sub_801E088(void)
{
switch (sub_801E474(TRUE)) {
case 3:
case 4:
sUnknown_203B25C->chosenHintIndex = GetChosenHintIndex();
SetOptionsMenuState(OPTIONS_MENU_DISPLAY_HINT);
break;
case 2:
sub_801E54C();
SetOptionsMenuState(OPTIONS_MENU_MAIN);
break;
case 0:
case 1:
default:
break;
}
}
static void sub_801E0E0(void)
{
switch (HandleHintDisplayScreenInput()) {
case 3:
case 2:
DestroyHintDisplayScreen();
SetOptionsMenuState(OPTIONS_MENU_HINT_SELECTION);
break;
case 0:
case 1:
default:
break;
}
}
static void sub_801E0FC(void)
{
switch (sub_801E218()) {
case 2:
case 3:
sub_801E2C4();
// Check to see if the options changed?
if (GameOptionsNotChange(&sUnknown_203B25C->newOptions))
SetOptionsMenuState(OPTIONS_MENU_MAIN);
else
SetOptionsMenuState(OPTIONS_MENU_CONFIRM_NEW_OPTIONS);
break;
case 0:
case 1:
break;
}
}
static void HandleChangeSettingsMenu(void)
{
s32 menuAction;
if (sub_80144A4(&menuAction))
return;
switch (menuAction) {
case MENU_OPTION_YES:
// Save our option changes??
*gGameOptionsRef = sUnknown_203B25C->newOptions;
SetWindowBGColor();
sub_8099690(0);
SetOptionsMenuState(OPTIONS_MENU_MAIN);
break;
case MENU_OPTION_DEFAULT:
case MENU_OPTION_NO:
SetOptionsMenuState(OPTIONS_MENU_MAIN);
break;
}
}

125
src/options_menu2.c Normal file
View File

@ -0,0 +1,125 @@
#include "global.h"
#include "code_80118A4.h"
#include "constants/colors.h"
#include "constants/input.h"
#include "memory.h"
#include "menu_input.h"
#include "options_menu2.h"
#include "text1.h"
#include "text2.h"
static EWRAM_DATA_2 struct unkStruct_203B260 *sUnknown_203B260 = {0};
#include "data/options_menu2.h"
static void CreateOptionsMenu(void);
static void nullsub_38(void);
bool8 sub_801E198(GameOptions *optionsMenu)
{
sUnknown_203B260 = MemoryAlloc(sizeof(struct unkStruct_203B260), 8);
sUnknown_203B260->optionsMenu = optionsMenu;
sub_801317C(&sUnknown_203B260->unk4);
sUnknown_203B260->unk44 = 0;
sUnknown_203B260->unk48 = &sUnknown_203B260->unk4C[0];
sub_8006518(sUnknown_203B260->unk4C);
sUnknown_203B260->unk4C[sUnknown_203B260->unk44] = sUnknown_80DC03C;
sub_8012D08(sUnknown_203B260->unk48, 1);
ResetUnusedInputStruct();
sub_800641C(sUnknown_203B260->unk4C, TRUE, TRUE);
sub_8013818(&sUnknown_203B260->input, 1, 1, sUnknown_203B260->unk44);
nullsub_38();
CreateOptionsMenu();
return TRUE;
}
u32 sub_801E218(void)
{
bool32 flag;
flag = FALSE;
switch (sub_8012AE8()) {
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
return 2;
case INPUT_A_BUTTON:
PlayMenuSoundEffect(0);
return 3;
case INPUT_DPAD_LEFT:
if (sUnknown_203B260->input.menuIndex == 0) {
if (sUnknown_203B260->optionsMenu->windowColor == WINDOW_COLOR_BLUE)
sUnknown_203B260->optionsMenu->windowColor = WINDOW_COLOR_GREEN;
else
sUnknown_203B260->optionsMenu->windowColor--;
PlayMenuSoundEffect(3);
flag = TRUE;
}
break;
case INPUT_DPAD_RIGHT:
if (sUnknown_203B260->input.menuIndex == 0) {
if (sUnknown_203B260->optionsMenu->windowColor > WINDOW_COLOR_RED)
sUnknown_203B260->optionsMenu->windowColor = WINDOW_COLOR_BLUE;
else
sUnknown_203B260->optionsMenu->windowColor++;
PlayMenuSoundEffect(3);
flag = TRUE;
}
break;
}
// == 1 is needed for matching
if (sub_80138B8(&sUnknown_203B260->input, 1) != 0 || flag == TRUE) {
nullsub_38();
CreateOptionsMenu();
return 1;
}
return 0;
}
void sub_801E2C4(void)
{
if (sUnknown_203B260 != NULL) {
sUnknown_203B260->unk4C[sUnknown_203B260->unk44] = sUnknown_80DC020;
ResetUnusedInputStruct();
sub_800641C(sUnknown_203B260->unk4C, TRUE, TRUE);
MemoryFree(sUnknown_203B260);
sUnknown_203B260 = NULL;
}
}
static void nullsub_38(void)
{
}
static void CreateOptionsMenu(void)
{
u32 length;
u32 y;
sub_8008C54(sUnknown_203B260->unk44);
sub_80073B8(sUnknown_203B260->unk44);
xxx_call_draw_string(16, 0, sGameOptions,sUnknown_203B260->unk44, 0);
y = sub_8013800(&sUnknown_203B260->input, 0);
xxx_call_draw_string(8, y, sUnknown_80DC064, sUnknown_203B260->unk44, 0);
switch (sUnknown_203B260->optionsMenu->windowColor) {
case WINDOW_COLOR_BLUE:
length = sub_8008ED0(sBlue);
sub_80078A4(sUnknown_203B260->unk44, (sUnknown_203B260->optionsMenu->windowColor * 40) + 80, y + 10, length, COLOR_WHITE_2);
break;
case WINDOW_COLOR_RED:
length = sub_8008ED0(sRed);
sub_80078A4(sUnknown_203B260->unk44, (sUnknown_203B260->optionsMenu->windowColor * 40) + 80, y + 10, length, COLOR_WHITE_2);
break;
case WINDOW_COLOR_GREEN:
length = sub_8008ED0(sGreen);
sub_80078A4(sUnknown_203B260->unk44, (sUnknown_203B260->optionsMenu->windowColor * 40) + 80, y + 10, length, COLOR_WHITE_2);
break;
}
sub_80073E0(sUnknown_203B260->unk44);
}

View File

@ -52,8 +52,6 @@ extern void RedrawPartnerSelectionMenu(void);
extern u32 sub_80095E4(s16, u32); extern u32 sub_80095E4(s16, u32);
extern GameOptions *gGameOptionsRef;
extern const char gStarterReveal[]; extern const char gStarterReveal[];
extern u8 gAvailablePokemonNames[0x50]; extern u8 gAvailablePokemonNames[0x50];

View File

@ -11,6 +11,7 @@
#include "code_80130A8.h" #include "code_80130A8.h"
#include "code_80118A4.h" #include "code_80118A4.h"
#include "code_803B050.h" #include "code_803B050.h"
#include "game_options.h"
struct unkStruct_203B2CC struct unkStruct_203B2CC
{ {
@ -49,7 +50,6 @@ struct unkStruct_203B2D8
u8 unkA0[4]; u8 unkA0[4];
}; };
extern struct unkStruct_203B2D8 *gUnknown_203B2D8; extern struct unkStruct_203B2D8 *gUnknown_203B2D8;
extern GameOptions *gGameOptionsRef;
const UnkTextStruct2 gUnknown_80DFBD0 = const UnkTextStruct2 gUnknown_80DFBD0 =
{ {

View File

@ -15,7 +15,6 @@
EWRAM_DATA_2 u32 gUnknown_203B17C = {0}; EWRAM_DATA_2 u32 gUnknown_203B17C = {0};
EWRAM_DATA_2 char *gUnknown_203B180 = {0}; EWRAM_DATA_2 char *gUnknown_203B180 = {0};
EWRAM_DATA_2 struct UnkStruct_203B184 *gUnknown_203B184 = {0}; EWRAM_DATA_2 struct UnkStruct_203B184 *gUnknown_203B184 = {0};
extern GameOptions *gGameOptionsRef;
// size: 0x800 // size: 0x800
struct unk_struct struct unk_struct