-1337
File diff suppressed because it is too large
Load Diff
@@ -1,43 +0,0 @@
|
||||
#include "constants/maps.h"
|
||||
#include "constants/species.h"
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
.align 2
|
||||
|
||||
gUnknown_83CC2B8:: @ 83CC2B8
|
||||
.incbin "baserom.gba", 0x3CC2B8, 0x20
|
||||
|
||||
gUnknown_83CC2D8:: @ 83CC2D8
|
||||
.incbin "baserom.gba", 0x3CC2D8, 0xC
|
||||
|
||||
gUnknown_83CC2E4:: @ 83CC2E4
|
||||
.incbin "baserom.gba", 0x3CC2E4, 0x20
|
||||
|
||||
gUnknown_83CC304:: @ 83CC304
|
||||
.incbin "baserom.gba", 0x3CC304, 0x10
|
||||
|
||||
gUnknown_83CC314:: @ 83CC314
|
||||
.incbin "baserom.gba", 0x3CC314, 0x1C
|
||||
|
||||
gUnknown_83CC330:: @ 83CC330
|
||||
.incbin "baserom.gba", 0x3CC330, 0xC
|
||||
|
||||
gUnknown_83CC33C:: @ 83CC33C
|
||||
.incbin "baserom.gba", 0x3CC33C, 0x8
|
||||
|
||||
gUnknown_83CC344:: @ 83CC344
|
||||
.incbin "baserom.gba", 0x3CC344, 0x8
|
||||
|
||||
gUnknown_83CC34C:: @ 83CC34C
|
||||
.incbin "baserom.gba", 0x3CC34C, 0x8
|
||||
|
||||
gUnknown_83CC354:: @ 83CC354
|
||||
.incbin "baserom.gba", 0x3CC354, 0xC
|
||||
|
||||
gUnknown_83CC360:: @ 83CC360
|
||||
.incbin "baserom.gba", 0x3CC360, 0x3
|
||||
|
||||
gUnknown_83CC363:: @ 83CC363
|
||||
.incbin "baserom.gba", 0x3CC363, 0x3
|
||||
+24
-24
@@ -2904,73 +2904,73 @@ gUnknown_8419D89:: @ 8419D89
|
||||
.string "Waiting for the other TRAINER to\n"
|
||||
.string "finish reading your TRAINER CARD.$"
|
||||
|
||||
gUnknown_8419DCC:: @ 8419DCC
|
||||
gText_MenuOption:: @ 8419DCC
|
||||
.string "OPTION$"
|
||||
|
||||
gUnknown_8419DD3:: @ 0x8419DD3
|
||||
gText_TextSpeed:: @ 0x8419DD3
|
||||
.string "TEXT SPEED$"
|
||||
|
||||
gUnknown_8419DDE:: @ 0x8419DDE
|
||||
gText_BattleScene:: @ 0x8419DDE
|
||||
.string "BATTLE SCENE$"
|
||||
|
||||
gUnknown_8419DEB:: @ 0x8419DEB
|
||||
gText_BattleStyle:: @ 0x8419DEB
|
||||
.string "BATTLE STYLE$"
|
||||
|
||||
gUnknown_8419DF8:: @ 0x8419DF8
|
||||
gText_Sound:: @ 0x8419DF8
|
||||
.string "SOUND$"
|
||||
|
||||
gUnknown_8419DFE:: @ 0x8419DFE
|
||||
gText_ButtonMode:: @ 0x8419DFE
|
||||
.string "BUTTON MODE$"
|
||||
|
||||
gUnknown_8419E0A:: @ 0x8419E0A
|
||||
gText_Frame:: @ 0x8419E0A
|
||||
.string "FRAME$"
|
||||
|
||||
gUnknown_8419E10:: @ 0x8419E10
|
||||
gText_OptionMenuCancel:: @ 0x8419E10
|
||||
.string "CANCEL$"
|
||||
|
||||
gUnknown_8419E17:: @ 0x8419E17
|
||||
gText_TextSpeedSlow:: @ 0x8419E17
|
||||
.string "SLOW$"
|
||||
|
||||
gUnknown_8419E1C:: @ 0x8419E1C
|
||||
gText_TextSpeedMid:: @ 0x8419E1C
|
||||
.string "MID$"
|
||||
|
||||
gUnknown_8419E20:: @ 0x8419E20
|
||||
gText_TextSpeedFast:: @ 0x8419E20
|
||||
.string "FAST$"
|
||||
|
||||
gUnknown_8419E25:: @ 0x8419E25
|
||||
gText_BattleSceneOn:: @ 0x8419E25
|
||||
.string "ON$"
|
||||
|
||||
gUnknown_8419E28:: @ 0x8419E28
|
||||
gText_BattleSceneOff:: @ 0x8419E28
|
||||
.string "OFF$"
|
||||
|
||||
gUnknown_8419E2C:: @ 0x8419E2C
|
||||
gText_BattleStyleShift:: @ 0x8419E2C
|
||||
.string "SHIFT$"
|
||||
|
||||
gUnknown_8419E32:: @ 0x8419E32
|
||||
gText_BattleStyleSet:: @ 0x8419E32
|
||||
.string "SET$"
|
||||
|
||||
gUnknown_8419E36:: @ 0x8419E36
|
||||
gText_SoundMono:: @ 0x8419E36
|
||||
.string "MONO$"
|
||||
|
||||
gUnknown_8419E3B:: @ 0x8419E3B
|
||||
gText_SoundStereo:: @ 0x8419E3B
|
||||
.string "STEREO$"
|
||||
|
||||
gUnknown_8419E42:: @ 0x8419E42
|
||||
gTextJP_Type:: @ 0x8419E42
|
||||
.string "タイプ$"
|
||||
|
||||
gUnknown_8419E46:: @ 0x8419E46
|
||||
gText_ButtonTypeHelp:: @ 0x8419E46
|
||||
.string "HELP$"
|
||||
|
||||
gUnknown_8419E4B:: @ 0x8419E4B
|
||||
.string "LゅA$"
|
||||
gText_ButtonTypeLEqualsA:: @ 0x8419E4B
|
||||
.string "L=A$"
|
||||
|
||||
gUnknown_8419E4F:: @ 0x8419E4F
|
||||
gText_ButtonTypeLR:: @ 0x8419E4F
|
||||
.string "LR$"
|
||||
|
||||
gUnknown_8419E52:: @ 8419E52
|
||||
gText_FrameType:: @ 8419E52
|
||||
.string "TYPE$"
|
||||
|
||||
gUnknown_8419E57:: @ 8419E57
|
||||
gText_PickSwitchCancel:: @ 8419E57
|
||||
.string "{DPAD_UPDOWN}PICK {DPAD_LEFTRIGHT}SWITCH {A_BUTTON}{B_BUTTON}CANCEL$"
|
||||
|
||||
gUnknown_8419E72:: @ 0x8419E72
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
16
|
||||
255 255 255
|
||||
255 255 255
|
||||
99 99 99
|
||||
214 214 206
|
||||
230 8 8
|
||||
255 189 115
|
||||
33 156 8
|
||||
148 247 148
|
||||
49 82 206
|
||||
165 197 247
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
+5
-5
@@ -291,11 +291,11 @@ struct SaveBlock2
|
||||
/*0x012*/ u8 playTimeVBlanks;
|
||||
/*0x013*/ u8 optionsButtonMode; // OPTIONS_BUTTON_MODE_[NORMAL/LR/L_EQUALS_A]
|
||||
/*0x014*/ u16 optionsTextSpeed:3; // OPTIONS_TEXT_SPEED_[SLOW/MID/FAST]
|
||||
u16 optionsWindowFrameType:5; // Specifies one of the 20 decorative borders for text boxes
|
||||
u16 optionsSound:1; // OPTIONS_SOUND_[MONO/STEREO]
|
||||
u16 optionsBattleStyle:1; // OPTIONS_BATTLE_STYLE_[SHIFT/SET]
|
||||
u16 optionsBattleSceneOff:1; // whether battle animations are disabled
|
||||
u16 regionMapZoom:1; // whether the map is zoomed in
|
||||
u16 optionsWindowFrameType:5; // Specifies one of the 20 decorative borders for text boxes
|
||||
/*0x15*/ u16 optionsSound:1; // OPTIONS_SOUND_[MONO/STEREO]
|
||||
u16 optionsBattleStyle:1; // OPTIONS_BATTLE_STYLE_[SHIFT/SET]
|
||||
u16 optionsBattleSceneOff:1; // whether battle animations are disabled
|
||||
u16 regionMapZoom:1; // whether the map is zoomed in
|
||||
/*0x018*/ struct Pokedex pokedex;
|
||||
/*0x090*/ u8 filler_90[0x8];
|
||||
/*0x098*/ struct Time localTimeOffset;
|
||||
|
||||
@@ -12,7 +12,7 @@ struct YesNoFuncTable
|
||||
};
|
||||
|
||||
bool16 RunTextPrinters_CheckActive(u8 textPrinterId);
|
||||
bool8 sub_80BF72C(void);
|
||||
bool32 sub_80BF72C(void);
|
||||
bool8 sub_80BF748(void);
|
||||
bool8 MenuHelpers_LinkSomething(void);
|
||||
void SetVBlankHBlankCallbacksToNull(void);
|
||||
|
||||
@@ -763,6 +763,31 @@ extern const u8 gText_DecimalPoint[];
|
||||
// map_name_popup
|
||||
extern const u8 gUnknown_841D18D[];
|
||||
|
||||
// option menu
|
||||
extern const u8 gText_TextSpeed[];
|
||||
extern const u8 gText_BattleScene[];
|
||||
extern const u8 gText_BattleStyle[];
|
||||
extern const u8 gText_Sound[];
|
||||
extern const u8 gText_ButtonMode[];
|
||||
extern const u8 gText_Frame[];
|
||||
extern const u8 gText_OptionMenuCancel[];
|
||||
extern const u8 gText_TextSpeedSlow[];
|
||||
extern const u8 gText_TextSpeedMid[];
|
||||
extern const u8 gText_TextSpeedFast[];
|
||||
extern const u8 gText_BattleSceneOn[];
|
||||
extern const u8 gText_BattleSceneOff[];
|
||||
extern const u8 gText_BattleStyleShift[];
|
||||
extern const u8 gText_BattleStyleSet[];
|
||||
extern const u8 gText_SoundMono[];
|
||||
extern const u8 gText_SoundStereo[];
|
||||
extern const u8 gText_ButtonTypeHelp[];
|
||||
extern const u8 gText_ButtonTypeLR[];
|
||||
extern const u8 gText_ButtonTypeLEqualsA[];
|
||||
extern const u8 gText_MenuOption[];
|
||||
extern const u8 gText_FrameType[];
|
||||
extern const u8 gTextJP_Type[];
|
||||
extern const u8 gText_PickSwitchCancel[];
|
||||
|
||||
// evolution_scene
|
||||
extern const u8 gText_PkmnIsEvolving[];
|
||||
extern const u8 gText_CongratsPkmnEvolved[];
|
||||
|
||||
@@ -81,6 +81,19 @@
|
||||
#define TEXT_COLOR_TRANSPARENT 0x0
|
||||
#define TEXT_COLOR_WHITE 0x1
|
||||
#define TEXT_COLOR_DARK_GREY 0x2
|
||||
#define TEXT_COLOR_LIGHT_GREY 0x3
|
||||
#define TEXT_COLOR_RED 0x4
|
||||
#define TEXT_COLOR_LIGHT_RED 0x5
|
||||
#define TEXT_COLOR_GREEN 0x6
|
||||
#define TEXT_COLOR_LIGHT_GREEN 0x7
|
||||
#define TEXT_COLOR_BLUE 0x8
|
||||
#define TEXT_COLOR_LIGHT_BLUE 0x9
|
||||
#define TEXT_DYNAMIC_COLOR_1 0xA // Usually white
|
||||
#define TEXT_DYNAMIC_COLOR_2 0xB // Usually white w/ tinge of green
|
||||
#define TEXT_DYNAMIC_COLOR_3 0xC // Usually white
|
||||
#define TEXT_DYNAMIC_COLOR_4 0xD // Usually aquamarine
|
||||
#define TEXT_DYNAMIC_COLOR_5 0xE // Usually blue-green
|
||||
#define TEXT_DYNAMIC_COLOR_6 0xF // Usually cerulean
|
||||
|
||||
// battle placeholders are located in battle_message.h
|
||||
#define EXT_CTRL_CODE_COLOR 0x1
|
||||
|
||||
+2
-2
@@ -128,7 +128,7 @@ SECTIONS {
|
||||
src/wild_encounter.o(.text);
|
||||
asm/field_effect.o(.text);
|
||||
src/scanline_effect.o(.text);
|
||||
asm/option_menu.o(.text);
|
||||
src/option_menu.o(.text);
|
||||
src/pokedex.o(.text);
|
||||
asm/trainer_card.o(.text);
|
||||
asm/pokemon_storage_system.o(.text);
|
||||
@@ -432,7 +432,7 @@ SECTIONS {
|
||||
data/trainer_see.o(.rodata);
|
||||
src/wild_encounter.o(.rodata);
|
||||
data/field_effect.o(.rodata);
|
||||
data/option_menu.o(.rodata);
|
||||
src/option_menu.o(.rodata);
|
||||
data/trainer_card.o(.rodata);
|
||||
data/pokemon_storage_system.o(.rodata);
|
||||
src/pokemon_icon.o(.rodata);
|
||||
|
||||
+3
-3
@@ -457,7 +457,7 @@ static void CB2_InitBerryPouch(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
if (sub_80BF72C() == TRUE)
|
||||
if ((u8)sub_80BF72C() == TRUE)
|
||||
break;
|
||||
if (RunBerryPouchInit() == TRUE)
|
||||
break;
|
||||
@@ -934,7 +934,7 @@ static void Task_BerryPouchMain(u8 taskId)
|
||||
{
|
||||
s16 * data = gTasks[taskId].data;
|
||||
s32 menuInput;
|
||||
if (!gPaletteFade.active && sub_80BF72C() != TRUE)
|
||||
if (!gPaletteFade.active && (u8)sub_80BF72C() != TRUE)
|
||||
{
|
||||
menuInput = ListMenu_ProcessInput(data[0]);
|
||||
ListMenuGetScrollAndRow(data[0], &sStaticCnt.listMenuScrollOffset, &sStaticCnt.listMenuSelectedRow);
|
||||
@@ -1040,7 +1040,7 @@ static void Task_NormalContextMenu(u8 taskId)
|
||||
static void Task_NormalContextMenu_HandleInput(u8 taskId)
|
||||
{
|
||||
s8 input;
|
||||
if (sub_80BF72C() != TRUE)
|
||||
if ((u8)sub_80BF72C() != TRUE)
|
||||
{
|
||||
input = Menu_ProcessInputNoWrapAround();
|
||||
switch (input)
|
||||
|
||||
+1
-1
@@ -384,7 +384,7 @@ static bool8 ItemPc_DoGfxSetup(void)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 20:
|
||||
if (sub_80BF72C() != TRUE)
|
||||
if ((u8)sub_80BF72C() != TRUE)
|
||||
gMain.state++;
|
||||
break;
|
||||
default:
|
||||
|
||||
+3
-3
@@ -125,17 +125,17 @@ bool8 MenuHelpers_LinkSomething(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_80BF72C(void)
|
||||
bool32 sub_80BF72C(void)
|
||||
{
|
||||
if (!MenuHelpers_LinkSomething())
|
||||
return FALSE;
|
||||
else
|
||||
return sub_8058244();
|
||||
return (u8)sub_8058244();
|
||||
}
|
||||
|
||||
bool8 sub_80BF748(void)
|
||||
{
|
||||
if (sub_80BF72C() == TRUE)
|
||||
if ((u8)sub_80BF72C() == TRUE)
|
||||
return TRUE;
|
||||
else if (sub_800B270() != TRUE)
|
||||
return FALSE;
|
||||
|
||||
@@ -0,0 +1,577 @@
|
||||
#include "global.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "scanline_effect.h"
|
||||
#include "text_window_graphics.h"
|
||||
#include "menu.h"
|
||||
#include "menu_helpers.h"
|
||||
#include "task.h"
|
||||
#include "palette.h"
|
||||
#include "overworld.h"
|
||||
#include "malloc.h"
|
||||
#include "help_system.h"
|
||||
#include "main.h"
|
||||
#include "bg.h"
|
||||
#include "window.h"
|
||||
#include "text.h"
|
||||
#include "text_window.h"
|
||||
#include "string_util.h"
|
||||
#include "strings.h"
|
||||
#include "field_fadetransition.h"
|
||||
#include "gba/m4a_internal.h"
|
||||
|
||||
// Menu items
|
||||
enum
|
||||
{
|
||||
MENUITEM_TEXTSPEED = 0,
|
||||
MENUITEM_BATTLESCENE,
|
||||
MENUITEM_BATTLESTYLE,
|
||||
MENUITEM_SOUND,
|
||||
MENUITEM_BUTTONMODE,
|
||||
MENUITEM_FRAMETYPE,
|
||||
MENUITEM_CANCEL,
|
||||
MENUITEM_COUNT
|
||||
};
|
||||
|
||||
// Window Ids
|
||||
enum
|
||||
{
|
||||
WIN_TEXT_OPTION,
|
||||
WIN_OPTIONS
|
||||
};
|
||||
|
||||
// RAM symbols
|
||||
struct OptionMenu
|
||||
{
|
||||
/*0x00*/ u16 option[MENUITEM_COUNT];
|
||||
/*0x0E*/ u16 unkE;
|
||||
/*0x10*/ u8 state3;
|
||||
/*0x11*/ u8 state;
|
||||
/*0x12*/ u8 state2;
|
||||
/*0x13*/ u8 unk13;
|
||||
};
|
||||
|
||||
static EWRAM_DATA struct OptionMenu *sOptionMenuPtr = NULL;
|
||||
|
||||
//Function Declarataions
|
||||
static void CB2_InitOptionMenu(void);
|
||||
static void VBlankCB_OptionMenu(void);
|
||||
static void OptionMenu_InitCallbacks(void);
|
||||
static void OptionMenu_SetVBlankCallback(void);
|
||||
static void CB2_OptionMenu(void);
|
||||
static void SetOptionMenuTask(void);
|
||||
static void InitOptionMenuBg(void);
|
||||
static void OptionMenu_PickSwitchCancel(void);
|
||||
static void OptionMenu_ResetSpriteData(void);
|
||||
static bool8 LoadOptionMenuPalette(void);
|
||||
static void Task_OptionMenu(u8 taskId);
|
||||
static u8 OptionMenu_ProcessInput(void);
|
||||
static void BufferOptionMenuString(u8 selection);
|
||||
static void CloseAndSaveOptionMenu(u8 taskId);
|
||||
static void PrintOptionMenuHeader(void);
|
||||
static void sub_8088C0C(void);
|
||||
static void LoadOptionMenuItemNames(void);
|
||||
static void sub_8088DE0(u16 selection);
|
||||
|
||||
// Data Definitions
|
||||
static const struct WindowTemplate sOptionMenuWinTemplates[] =
|
||||
{
|
||||
{
|
||||
.bg = 1,
|
||||
.tilemapLeft = 2,
|
||||
.tilemapTop = 3,
|
||||
.width = 26,
|
||||
.height = 2,
|
||||
.paletteNum = 1,
|
||||
.baseBlock = 2
|
||||
},
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 2,
|
||||
.tilemapTop = 7,
|
||||
.width = 26,
|
||||
.height = 12,
|
||||
.paletteNum = 1,
|
||||
.baseBlock = 0x36
|
||||
},
|
||||
{
|
||||
.bg = 2,
|
||||
.tilemapLeft = 0,
|
||||
.tilemapTop = 0,
|
||||
.width = 30,
|
||||
.height = 2,
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x16e
|
||||
},
|
||||
DUMMY_WIN_TEMPLATE
|
||||
};
|
||||
|
||||
static const struct BgTemplate sOptionMenuBgTemplates[] =
|
||||
{
|
||||
{
|
||||
.bg = 1,
|
||||
.charBaseIndex = 1,
|
||||
.mapBaseIndex = 30,
|
||||
.screenSize = 0,
|
||||
.paletteMode = 0,
|
||||
.priority = 0,
|
||||
.baseTile = 0
|
||||
},
|
||||
{
|
||||
.bg = 0,
|
||||
.charBaseIndex = 1,
|
||||
.mapBaseIndex = 31,
|
||||
.screenSize = 0,
|
||||
.paletteMode = 0,
|
||||
.priority = 1,
|
||||
.baseTile = 0
|
||||
},
|
||||
{
|
||||
.bg = 2,
|
||||
.charBaseIndex = 1,
|
||||
.mapBaseIndex = 29,
|
||||
.screenSize = 0,
|
||||
.paletteMode = 0,
|
||||
.priority = 2,
|
||||
.baseTile = 0
|
||||
},
|
||||
};
|
||||
|
||||
static const u16 sOptionMenuPalette[] = INCBIN_U16("graphics/misc/unk_83cc2e4.gbapal");
|
||||
static const u16 sOptionMenuItemCounts[MENUITEM_COUNT] = {3, 2, 2, 2, 3, 10, 0};
|
||||
|
||||
static const u8 *const sOptionMenuItemsNames[MENUITEM_COUNT] =
|
||||
{
|
||||
[MENUITEM_TEXTSPEED] = gText_TextSpeed,
|
||||
[MENUITEM_BATTLESCENE] = gText_BattleScene,
|
||||
[MENUITEM_BATTLESTYLE] = gText_BattleStyle,
|
||||
[MENUITEM_SOUND] = gText_Sound,
|
||||
[MENUITEM_BUTTONMODE] = gText_ButtonMode,
|
||||
[MENUITEM_FRAMETYPE] = gText_Frame,
|
||||
[MENUITEM_CANCEL] = gText_OptionMenuCancel,
|
||||
};
|
||||
|
||||
static const u8 *const sTextSpeedOptions[] =
|
||||
{
|
||||
gText_TextSpeedSlow,
|
||||
gText_TextSpeedMid,
|
||||
gText_TextSpeedFast
|
||||
};
|
||||
|
||||
static const u8 *const sBattleSceneOptions[] =
|
||||
{
|
||||
gText_BattleSceneOn,
|
||||
gText_BattleSceneOff
|
||||
};
|
||||
|
||||
static const u8 *const sBattleStyleOptions[] =
|
||||
{
|
||||
gText_BattleStyleShift,
|
||||
gText_BattleStyleSet
|
||||
};
|
||||
|
||||
static const u8 *const sSoundOptions[] =
|
||||
{
|
||||
gText_SoundMono,
|
||||
gText_SoundStereo
|
||||
};
|
||||
|
||||
static const u8 *const sButtonTypeOptions[] =
|
||||
{
|
||||
gText_ButtonTypeHelp,
|
||||
gText_ButtonTypeLR,
|
||||
gText_ButtonTypeLEqualsA
|
||||
};
|
||||
|
||||
static const u8 sOptionMenuPickSwitchCancelTextColor[] = {TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY};
|
||||
static const u8 sOptionMenuTextColor[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_RED};
|
||||
|
||||
// Functions
|
||||
static void CB2_InitOptionMenu(void)
|
||||
{
|
||||
RunTasks();
|
||||
AnimateSprites();
|
||||
BuildOamBuffer();
|
||||
UpdatePaletteFade();
|
||||
}
|
||||
|
||||
static void VBlankCB_OptionMenu(void)
|
||||
{
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
TransferPlttBuffer();
|
||||
}
|
||||
|
||||
void CB2_OptionsMenuFromStartMenu(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (gMain.savedCallback == NULL)
|
||||
gMain.savedCallback = CB2_ReturnToStartMenu;
|
||||
sOptionMenuPtr = AllocZeroed(sizeof(struct OptionMenu));
|
||||
sOptionMenuPtr->state3 = 0;
|
||||
sOptionMenuPtr->state2 = 0;
|
||||
sOptionMenuPtr->state = 0;
|
||||
sOptionMenuPtr->unkE = 0;
|
||||
sOptionMenuPtr->option[MENUITEM_TEXTSPEED] = gSaveBlock2Ptr->optionsTextSpeed;
|
||||
sOptionMenuPtr->option[MENUITEM_BATTLESCENE] = gSaveBlock2Ptr->optionsBattleSceneOff;
|
||||
sOptionMenuPtr->option[MENUITEM_BATTLESTYLE] = gSaveBlock2Ptr->optionsBattleStyle;
|
||||
sOptionMenuPtr->option[MENUITEM_SOUND] = gSaveBlock2Ptr->optionsSound;
|
||||
sOptionMenuPtr->option[MENUITEM_BUTTONMODE] = gSaveBlock2Ptr->optionsButtonMode;
|
||||
sOptionMenuPtr->option[MENUITEM_FRAMETYPE] = gSaveBlock2Ptr->optionsWindowFrameType;
|
||||
|
||||
for (i = 0; i < MENUITEM_COUNT - 1; i++)
|
||||
{
|
||||
if (sOptionMenuPtr->option[i] > (sOptionMenuItemCounts[i]) - 1)
|
||||
sOptionMenuPtr->option[i] = 0;
|
||||
}
|
||||
HelpSystem_SetSomeVariable2(0xD);
|
||||
SetMainCallback2(CB2_OptionMenu);
|
||||
}
|
||||
|
||||
static void OptionMenu_InitCallbacks(void)
|
||||
{
|
||||
SetVBlankCallback(NULL);
|
||||
SetHBlankCallback(NULL);
|
||||
}
|
||||
|
||||
static void OptionMenu_SetVBlankCallback(void)
|
||||
{
|
||||
SetVBlankCallback(VBlankCB_OptionMenu);
|
||||
}
|
||||
|
||||
static void CB2_OptionMenu(void)
|
||||
{
|
||||
u8 i, state;
|
||||
state = sOptionMenuPtr->state;
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
OptionMenu_InitCallbacks();
|
||||
break;
|
||||
case 1:
|
||||
InitOptionMenuBg();
|
||||
break;
|
||||
case 2:
|
||||
OptionMenu_ResetSpriteData();
|
||||
break;
|
||||
case 3:
|
||||
if (LoadOptionMenuPalette() != TRUE)
|
||||
return;
|
||||
break;
|
||||
case 4:
|
||||
PrintOptionMenuHeader();
|
||||
break;
|
||||
case 5:
|
||||
sub_8088C0C();
|
||||
break;
|
||||
case 6:
|
||||
LoadOptionMenuItemNames();
|
||||
break;
|
||||
case 7:
|
||||
for (i = 0; i < MENUITEM_COUNT; i++)
|
||||
BufferOptionMenuString(i);
|
||||
break;
|
||||
case 8:
|
||||
sub_8088DE0(sOptionMenuPtr->unkE);
|
||||
break;
|
||||
case 9:
|
||||
OptionMenu_PickSwitchCancel();
|
||||
break;
|
||||
default:
|
||||
SetOptionMenuTask();
|
||||
break;
|
||||
}
|
||||
sOptionMenuPtr->state++;
|
||||
}
|
||||
|
||||
static void SetOptionMenuTask(void)
|
||||
{
|
||||
CreateTask(Task_OptionMenu, 0);
|
||||
SetMainCallback2(CB2_InitOptionMenu);
|
||||
}
|
||||
|
||||
static void InitOptionMenuBg(void)
|
||||
{
|
||||
void * dest = (void *)VRAM;
|
||||
DmaClearLarge16(3, dest, VRAM_SIZE, 0x1000);
|
||||
DmaClear32(3, (void *)OAM, OAM_SIZE);
|
||||
DmaClear16(3, (void *)PLTT, PLTT_SIZE);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0);
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, sOptionMenuBgTemplates, NELEMS(sOptionMenuBgTemplates));
|
||||
ChangeBgX(0, 0, 0);
|
||||
ChangeBgY(0, 0, 0);
|
||||
ChangeBgX(1, 0, 0);
|
||||
ChangeBgY(1, 0, 0);
|
||||
ChangeBgX(2, 0, 0);
|
||||
ChangeBgY(2, 0, 0);
|
||||
ChangeBgX(3, 0, 0);
|
||||
ChangeBgY(3, 0, 0);
|
||||
InitWindows(sOptionMenuWinTemplates);
|
||||
DeactivateAllTextPrinters();
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_EFFECT_LIGHTEN);
|
||||
SetGpuReg(REG_OFFSET_BLDY, BLDCNT_TGT1_BG1);
|
||||
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_CLR);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON);
|
||||
ShowBg(0);
|
||||
ShowBg(1);
|
||||
ShowBg(2);
|
||||
};
|
||||
|
||||
static void OptionMenu_PickSwitchCancel(void)
|
||||
{
|
||||
s32 x;
|
||||
x = 0xE4 - GetStringWidth(0, gText_PickSwitchCancel, 0);
|
||||
FillWindowPixelBuffer(2, PIXEL_FILL(15));
|
||||
AddTextPrinterParameterized3(2, 0, x, 0, sOptionMenuPickSwitchCancelTextColor, 0, gText_PickSwitchCancel);
|
||||
PutWindowTilemap(2);
|
||||
CopyWindowToVram(2, 3);
|
||||
}
|
||||
|
||||
static void OptionMenu_ResetSpriteData(void)
|
||||
{
|
||||
ResetSpriteData();
|
||||
ResetPaletteFade();
|
||||
FreeAllSpritePalettes();
|
||||
ResetTasks();
|
||||
ScanlineEffect_Stop();
|
||||
}
|
||||
|
||||
static bool8 LoadOptionMenuPalette(void)
|
||||
{
|
||||
switch (sOptionMenuPtr->state2)
|
||||
{
|
||||
case 0:
|
||||
LoadBgTiles(1, GetUserFrameGraphicsInfo(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA);
|
||||
break;
|
||||
case 1:
|
||||
LoadPalette(GetUserFrameGraphicsInfo(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20);
|
||||
break;
|
||||
case 2:
|
||||
LoadPalette(sOptionMenuPalette, 0x10, 0x20);
|
||||
LoadPalette(stdpal_get(2), 0xF0, 0x20);
|
||||
break;
|
||||
case 3:
|
||||
sub_814FDA0(1, 0x1B3, 0x30);
|
||||
break;
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
sOptionMenuPtr->state2++;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void Task_OptionMenu(u8 taskId)
|
||||
{
|
||||
switch (sOptionMenuPtr->state3)
|
||||
{
|
||||
case 0:
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
|
||||
OptionMenu_SetVBlankCallback();
|
||||
sOptionMenuPtr->state3++;
|
||||
break;
|
||||
case 2:
|
||||
if (sub_80BF72C() == TRUE)
|
||||
break;
|
||||
switch (OptionMenu_ProcessInput())
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
sOptionMenuPtr->state3++;
|
||||
break;
|
||||
case 2:
|
||||
LoadBgTiles(1, GetUserFrameGraphicsInfo(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->tiles, 0x120, 0x1AA);
|
||||
LoadPalette(GetUserFrameGraphicsInfo(sOptionMenuPtr->option[MENUITEM_FRAMETYPE])->palette, 0x20, 0x20);
|
||||
BufferOptionMenuString(sOptionMenuPtr->unkE);
|
||||
break;
|
||||
case 3:
|
||||
sub_8088DE0(sOptionMenuPtr->unkE);
|
||||
break;
|
||||
case 4:
|
||||
BufferOptionMenuString(sOptionMenuPtr->unkE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
||||
sOptionMenuPtr->state3++;
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
if (gPaletteFade.active)
|
||||
return;
|
||||
sOptionMenuPtr->state3++;
|
||||
break;
|
||||
case 5:
|
||||
CloseAndSaveOptionMenu(taskId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 OptionMenu_ProcessInput(void)
|
||||
{
|
||||
u16 current;
|
||||
u16* curr;
|
||||
if (JOY_REPT(DPAD_RIGHT))
|
||||
{
|
||||
current = sOptionMenuPtr->option[(sOptionMenuPtr->unkE)];
|
||||
if (current == (sOptionMenuItemCounts[sOptionMenuPtr->unkE] - 1))
|
||||
sOptionMenuPtr->option[sOptionMenuPtr->unkE] = 0;
|
||||
else
|
||||
sOptionMenuPtr->option[sOptionMenuPtr->unkE] = current + 1;
|
||||
if (sOptionMenuPtr->unkE == MENUITEM_FRAMETYPE)
|
||||
return 2;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
else if (JOY_REPT(DPAD_LEFT))
|
||||
{
|
||||
curr = &sOptionMenuPtr->option[sOptionMenuPtr->unkE];
|
||||
if (*curr == 0)
|
||||
*curr = sOptionMenuItemCounts[sOptionMenuPtr->unkE] - 1;
|
||||
else
|
||||
--*curr;
|
||||
|
||||
if (sOptionMenuPtr->unkE == MENUITEM_FRAMETYPE)
|
||||
return 2;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
else if (JOY_REPT(DPAD_UP))
|
||||
{
|
||||
if (sOptionMenuPtr->unkE == MENUITEM_TEXTSPEED)
|
||||
sOptionMenuPtr->unkE = MENUITEM_CANCEL;
|
||||
else
|
||||
sOptionMenuPtr->unkE = sOptionMenuPtr->unkE - 1;
|
||||
return 3;
|
||||
}
|
||||
else if (JOY_REPT(DPAD_DOWN))
|
||||
{
|
||||
if (sOptionMenuPtr->unkE == MENUITEM_CANCEL)
|
||||
sOptionMenuPtr->unkE = MENUITEM_TEXTSPEED;
|
||||
else
|
||||
sOptionMenuPtr->unkE = sOptionMenuPtr->unkE + 1;
|
||||
return 3;
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON) || JOY_NEW(A_BUTTON))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void BufferOptionMenuString(u8 selection)
|
||||
{
|
||||
u8 str[20];
|
||||
u8 buf[12];
|
||||
u8 dst[3];
|
||||
u8 x, y;
|
||||
|
||||
memcpy(dst, sOptionMenuTextColor, 3);
|
||||
x = 0x82;
|
||||
y = ((GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT) - 1) * selection) + 2;
|
||||
FillWindowPixelRect(1, 1, x, y, 0x46, GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT));
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
case MENUITEM_TEXTSPEED:
|
||||
AddTextPrinterParameterized3(1, 2, x, y, dst, -1, sTextSpeedOptions[sOptionMenuPtr->option[selection]]);
|
||||
break;
|
||||
case MENUITEM_BATTLESCENE:
|
||||
AddTextPrinterParameterized3(1, 2, x, y, dst, -1, sBattleSceneOptions[sOptionMenuPtr->option[selection]]);
|
||||
break;
|
||||
case MENUITEM_BATTLESTYLE:
|
||||
AddTextPrinterParameterized3(1, 2, x, y, dst, -1, sBattleStyleOptions[sOptionMenuPtr->option[selection]]);
|
||||
break;
|
||||
case MENUITEM_SOUND:
|
||||
AddTextPrinterParameterized3(1, 2, x, y, dst, -1, sSoundOptions[sOptionMenuPtr->option[selection]]);
|
||||
break;
|
||||
case MENUITEM_BUTTONMODE:
|
||||
AddTextPrinterParameterized3(1, 2, x, y, dst, -1, sButtonTypeOptions[sOptionMenuPtr->option[selection]]);
|
||||
break;
|
||||
case MENUITEM_FRAMETYPE:
|
||||
StringCopy(str, gText_FrameType);
|
||||
ConvertIntToDecimalStringN(buf, sOptionMenuPtr->option[selection] + 1, 1, 2);
|
||||
StringAppendN(str, buf, 3);
|
||||
AddTextPrinterParameterized3(1, 2, x, y, dst, -1, str);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
PutWindowTilemap(1);
|
||||
CopyWindowToVram(1, 3);
|
||||
}
|
||||
|
||||
static void CloseAndSaveOptionMenu(u8 taskId)
|
||||
{
|
||||
gFieldCallback = sub_807DF64;
|
||||
SetMainCallback2(gMain.savedCallback);
|
||||
FreeAllWindowBuffers();
|
||||
gSaveBlock2Ptr->optionsTextSpeed = sOptionMenuPtr->option[MENUITEM_TEXTSPEED];
|
||||
gSaveBlock2Ptr->optionsBattleSceneOff = sOptionMenuPtr->option[MENUITEM_BATTLESCENE];
|
||||
gSaveBlock2Ptr->optionsBattleStyle = sOptionMenuPtr->option[MENUITEM_BATTLESTYLE];
|
||||
gSaveBlock2Ptr->optionsSound = sOptionMenuPtr->option[MENUITEM_SOUND];
|
||||
gSaveBlock2Ptr->optionsButtonMode = sOptionMenuPtr->option[MENUITEM_BUTTONMODE];
|
||||
gSaveBlock2Ptr->optionsWindowFrameType = sOptionMenuPtr->option[MENUITEM_FRAMETYPE];
|
||||
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);
|
||||
FREE_AND_SET_NULL(sOptionMenuPtr);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
static void PrintOptionMenuHeader(void)
|
||||
{
|
||||
FillWindowPixelBuffer(0, PIXEL_FILL(1));
|
||||
AddTextPrinterParameterized(WIN_TEXT_OPTION, 2, gText_MenuOption, 8, 1, TEXT_SPEED_FF, NULL);
|
||||
PutWindowTilemap(0);
|
||||
CopyWindowToVram(0, 3);
|
||||
}
|
||||
|
||||
static void sub_8088C0C(void)
|
||||
{
|
||||
u8 h;
|
||||
h = 2;
|
||||
|
||||
FillBgTilemapBufferRect(1, 0x1B3, 1, 2, 1, 1, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1B4, 2, 2, 0x1B, 1, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1B5, 0x1C, 2, 1, 1, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1B6, 1, 3, 1, h, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1B8, 0x1C, 3, 1, h, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1B9, 1, 5, 1, 1, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1BA, 2, 5, 0x1B, 1, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1BB, 0x1C, 5, 1, 1, 3);
|
||||
FillBgTilemapBufferRect(1, 0x1AA, 1, 6, 1, 1, h);
|
||||
FillBgTilemapBufferRect(1, 0x1AB, 2, 6, 0x1A, 1, h);
|
||||
FillBgTilemapBufferRect(1, 0x1AC, 0x1C, 6, 1, 1, h);
|
||||
FillBgTilemapBufferRect(1, 0x1AD, 1, 7, 1, 0x10, h);
|
||||
FillBgTilemapBufferRect(1, 0x1AF, 0x1C, 7, 1, 0x10, h);
|
||||
FillBgTilemapBufferRect(1, 0x1B0, 1, 0x13, 1, 1, h);
|
||||
FillBgTilemapBufferRect(1, 0x1B1, 2, 0x13, 0x1A, 1, h);
|
||||
FillBgTilemapBufferRect(1, 0x1B2, 0x1C, 0x13, 1, 1, h);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
}
|
||||
|
||||
static void LoadOptionMenuItemNames(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
||||
for (i = 0; i < MENUITEM_COUNT; i++)
|
||||
{
|
||||
AddTextPrinterParameterized(WIN_OPTIONS, 2, sOptionMenuItemsNames[i], 8, (u8)((i * (GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT))) + 2) - i, TEXT_SPEED_FF, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8088DE0(u16 selection)
|
||||
{
|
||||
u16 v1, v2;
|
||||
|
||||
v1 = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT);
|
||||
v2 = selection * (v1 - 1) + 0x3A;
|
||||
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(v2, v2 + v1));
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0x10, 0xE0));
|
||||
}
|
||||
+3
-3
@@ -305,7 +305,7 @@ static void CB2_SetUpTMCaseUI_Blocking(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
if (sub_80BF72C() == TRUE)
|
||||
if ((u8)sub_80BF72C() == TRUE)
|
||||
break;
|
||||
if (DoSetUpTMCaseUI() == TRUE)
|
||||
break;
|
||||
@@ -734,7 +734,7 @@ static void Task_TMCaseMain(u8 taskId)
|
||||
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
if (sub_80BF72C() != TRUE)
|
||||
if ((u8)sub_80BF72C() != TRUE)
|
||||
{
|
||||
input = ListMenu_ProcessInput(data[0]);
|
||||
ListMenuGetScrollAndRow(data[0], &sTMCaseStaticResources.scrollOffset, &sTMCaseStaticResources.selectedRow);
|
||||
@@ -815,7 +815,7 @@ static void Task_TMContextMenu_HandleInput(u8 taskId)
|
||||
{
|
||||
s8 input;
|
||||
|
||||
if (sub_80BF72C() != TRUE)
|
||||
if ((u8)sub_80BF72C() != TRUE)
|
||||
{
|
||||
input = Menu_ProcessInputNoWrapAround();
|
||||
switch (input)
|
||||
|
||||
+1
-2
@@ -226,8 +226,7 @@ gFieldEffectArguments: @ 20386E0
|
||||
.include "src/scanline_effect.o"
|
||||
|
||||
.align 2
|
||||
gUnknown_2039620: @ 2039620
|
||||
.space 0x4
|
||||
.include "src/option_menu.o"
|
||||
|
||||
gTrainerCards: @ 2039624
|
||||
.space 0x180
|
||||
|
||||
Reference in New Issue
Block a user