Clean up script_menu documentation

This commit is contained in:
GriffinR 2019-09-19 19:23:24 -04:00
parent 9fb24bbbce
commit b6dffcf8b7
7 changed files with 299 additions and 285 deletions

View File

@ -825,7 +825,7 @@
.byte \y
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (gMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoice x:req, y:req, list:req, b:req
.byte 0x6f
.byte \x
@ -834,7 +834,7 @@
.byte \b
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (gMultichoiceLists) and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoicedefault x:req, y:req, list:req, default:req, b:req
.byte 0x70
.byte \x
@ -844,7 +844,7 @@
.byte \b
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (gMultichoiceLists) and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
.macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req
.byte 0x71
.byte \x

View File

@ -344,7 +344,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276E22:: @ 8276E22
OldaleTown_PokemonCenter_2F_EventScript_276E30:: @ 8276E30
setvar VAR_0x8004, 0
goto_if_set FLAG_VISITED_MAUVILLE_CITY, OldaleTown_PokemonCenter_2F_EventScript_276E75
multichoice 0, 0, MULTI_LINK_SERVICES_A1, 0
multichoice 0, 0, MULTI_CABLE_CLUB_NO_RECORD_MIX, 0
switch VAR_RESULT
case 0, OldaleTown_PokemonCenter_2F_EventScript_2770B2
case 1, OldaleTown_PokemonCenter_2F_EventScript_276EB7
@ -353,7 +353,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276E30:: @ 8276E30
end
OldaleTown_PokemonCenter_2F_EventScript_276E75:: @ 8276E75
multichoice 0, 0, MULTI_LINK_SERVICES_B1, 0
multichoice 0, 0, MULTI_CABLE_CLUB_WITH_RECORD_MIX, 0
switch VAR_RESULT
case 0, OldaleTown_PokemonCenter_2F_EventScript_2770B2
case 1, OldaleTown_PokemonCenter_2F_EventScript_276EB7
@ -1103,7 +1103,7 @@ OldaleTown_PokemonCenter_2F_EventScript_2776E3:: @ 82776E3
compare VAR_RESULT, 0
goto_if_eq OldaleTown_PokemonCenter_2F_EventScript_27778B
goto_if_set FLAG_VISITED_MAUVILLE_CITY, OldaleTown_PokemonCenter_2F_EventScript_27773E
multichoice 0, 0, MULTI_LINK_SERVICES_C, 0
multichoice 0, 0, MULTI_WIRELESS_NO_RECORD, 0
switch VAR_RESULT
case 0, OldaleTown_PokemonCenter_2F_EventScript_27780D
case 1, OldaleTown_PokemonCenter_2F_EventScript_27783B
@ -1113,7 +1113,7 @@ OldaleTown_PokemonCenter_2F_EventScript_2776E3:: @ 82776E3
end
OldaleTown_PokemonCenter_2F_EventScript_27773E:: @ 827773E
multichoice 0, 0, MULTI_LINK_SERVICES_D, 0
multichoice 0, 0, MULTI_WIRELESS_ALL_SERVICES, 0
switch VAR_RESULT
case 0, OldaleTown_PokemonCenter_2F_EventScript_27780D
case 1, OldaleTown_PokemonCenter_2F_EventScript_27783B
@ -1125,7 +1125,7 @@ OldaleTown_PokemonCenter_2F_EventScript_27773E:: @ 827773E
OldaleTown_PokemonCenter_2F_EventScript_27778B:: @ 827778B
goto_if_set FLAG_VISITED_MAUVILLE_CITY, OldaleTown_PokemonCenter_2F_EventScript_2777CB
multichoice 0, 0, MULTI_LINK_SERVICES_A2, 0
multichoice 0, 0, MULTI_WIRELESS_NO_RECORD_BERRY, 0
switch VAR_RESULT
case 0, OldaleTown_PokemonCenter_2F_EventScript_27780D
case 1, OldaleTown_PokemonCenter_2F_EventScript_27783B
@ -1134,7 +1134,7 @@ OldaleTown_PokemonCenter_2F_EventScript_27778B:: @ 827778B
end
OldaleTown_PokemonCenter_2F_EventScript_2777CB:: @ 82777CB
multichoice 0, 0, MULTI_LINK_SERVICES_B2, 0
multichoice 0, 0, MULTI_WIRELESS_NO_BERRY, 0
switch VAR_RESULT
case 0, OldaleTown_PokemonCenter_2F_EventScript_27780D
case 1, OldaleTown_PokemonCenter_2F_EventScript_27783B

View File

@ -82,12 +82,12 @@
#define MULTI_SHARDS_YBG 71
#define MULTI_SHARDS_RYBG 72
#define MULTI_TOURNEY_WITH_RECORD 73
#define MULTI_LINK_SERVICES_A1 74 // TODO: rename
#define MULTI_LINK_SERVICES_A2 75 //
#define MULTI_LINK_SERVICES_B1 76 //
#define MULTI_LINK_SERVICES_B2 77 //
#define MULTI_LINK_SERVICES_C 78 //
#define MULTI_LINK_SERVICES_D 79 //
#define MULTI_CABLE_CLUB_NO_RECORD_MIX 74
#define MULTI_WIRELESS_NO_RECORD_BERRY 75
#define MULTI_CABLE_CLUB_WITH_RECORD_MIX 76
#define MULTI_WIRELESS_NO_BERRY 77
#define MULTI_WIRELESS_NO_RECORD 78
#define MULTI_WIRELESS_ALL_SERVICES 79
#define MULTI_WIRELESS_MINIGAME 80
#define MULTI_LINK_LEADER 81
#define MULTI_CONTEST_RANK 82

View File

@ -114,6 +114,21 @@
// 0x7
#define TEXT_COLOR_BLUE 0x8
#define PLACEHOLDER_ID_UNKNOWN 0x0
#define PLACEHOLDER_ID_PLAYER 0x1
#define PLACEHOLDER_ID_STRING_VAR_1 0x2
#define PLACEHOLDER_ID_STRING_VAR_2 0x3
#define PLACEHOLDER_ID_STRING_VAR_3 0x4
#define PLACEHOLDER_ID_KUN 0x5
#define PLACEHOLDER_ID_RIVAL 0x6
#define PLACEHOLDER_ID_VERSION 0x7
#define PLACEHOLDER_ID_AQUA 0x8
#define PLACEHOLDER_ID_MAGMA 0x9
#define PLACEHOLDER_ID_ARCHIE 0xA
#define PLACEHOLDER_ID_MAXIE 0xB
#define PLACEHOLDER_ID_KYOGRE 0xC
#define PLACEHOLDER_ID_GROUDON 0xD
// battle placeholders are located in battle_message.h
#define NUM_TEXT_PRINTERS 32

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ static u16 GetLengthWithExpandedPlayerName(const u8 *str)
if (*str == PLACEHOLDER_BEGIN)
{
str++;
if (*str == 1) // 01 is the second byte of the {PLAYER} placeholder
if (*str == PLACEHOLDER_ID_PLAYER)
{
length += StringLength(gSaveBlock2Ptr->playerName);
str++;
@ -94,8 +94,8 @@ static void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, bool8 ignoreB
{
int i;
u8 windowId;
u8 count = gMultichoiceLists[multichoiceId].count;
const struct MenuAction *actions = gMultichoiceLists[multichoiceId].list;
u8 count = sMultichoiceLists[multichoiceId].count;
const struct MenuAction *actions = sMultichoiceLists[multichoiceId].list;
int width = 0;
u8 newWidth;
@ -129,9 +129,9 @@ static void InitMultichoiceCheckWrap(bool8 ignoreBPress, u8 count, u8 windowId,
u8 taskId;
sProcessInputDelay = 2;
for (i = 0; i < ARRAY_COUNT(gLinkServicesMultichoiceIds); i++)
for (i = 0; i < ARRAY_COUNT(sLinkServicesMultichoiceIds); i++)
{
if (gLinkServicesMultichoiceIds[i] == multichoiceId)
if (sLinkServicesMultichoiceIds[i] == multichoiceId)
{
sProcessInputDelay = 12;
}
@ -263,22 +263,22 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, bool8 ignore
gSpecialVar_Result = 0xFF;
width = 0;
for (i = 0; i < gMultichoiceLists[multichoiceId].count; i++)
for (i = 0; i < sMultichoiceLists[multichoiceId].count; i++)
{
width = DisplayTextAndGetWidth(gMultichoiceLists[multichoiceId].list[i].text, width);
width = DisplayTextAndGetWidth(sMultichoiceLists[multichoiceId].list[i].text, width);
}
newWidth = ConvertPixelWidthToTileWidth(width);
left = ScriptMenu_AdjustLeftCoordFromWidth(left, columnCount * newWidth);
rowCount = gMultichoiceLists[multichoiceId].count / columnCount;
rowCount = sMultichoiceLists[multichoiceId].count / columnCount;
taskId = CreateTask(Task_HandleMultichoiceGridInput, 80);
gTasks[taskId].tIgnoreBPress = ignoreBPress;
gTasks[taskId].tWindowId = CreateWindowFromRect(left, top, columnCount * newWidth, rowCount * 2);
SetStandardWindowBorderStyle(gTasks[taskId].tWindowId, 0);
PrintMenuGridTable(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, gMultichoiceLists[multichoiceId].list);
PrintMenuGridTable(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, sMultichoiceLists[multichoiceId].list);
sub_8199944(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, 0);
CopyWindowToVram(gTasks[taskId].tWindowId, 3);
return TRUE;
@ -515,7 +515,7 @@ static void CreateLilycoveSSTidalMultichoice(void)
u8 selection = sLilycoveSSTidalSelections[j];
if (selection != 0xFF)
{
pixelWidth = DisplayTextAndGetWidth(gLilycoveSSTidalDestinations[selection], pixelWidth);
pixelWidth = DisplayTextAndGetWidth(sLilycoveSSTidalDestinations[selection], pixelWidth);
}
}
@ -527,7 +527,7 @@ static void CreateLilycoveSSTidalMultichoice(void)
{
if (sLilycoveSSTidalSelections[i] != 0xFF)
{
AddTextPrinterParameterized(windowId, 1, gLilycoveSSTidalDestinations[sLilycoveSSTidalSelections[i]], 8, selectionCount * 16 + 1, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(windowId, 1, sLilycoveSSTidalDestinations[sLilycoveSSTidalSelections[i]], 8, selectionCount * 16 + 1, TEXT_SPEED_FF, NULL);
selectionCount++;
}
}
@ -643,29 +643,29 @@ static void DrawLinkServicesMultichoiceMenu(u8 multichoiceId)
{
switch (multichoiceId)
{
case MULTI_LINK_SERVICES_B2:
case MULTI_WIRELESS_NO_BERRY:
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, sWirelessOptionsNoBerryCrush[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case MULTI_LINK_SERVICES_B1:
case MULTI_CABLE_CLUB_WITH_RECORD_MIX:
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, sCableClubOptions_WithRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case MULTI_LINK_SERVICES_C:
case MULTI_WIRELESS_NO_RECORD:
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, sWirelessOptions_NoRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case MULTI_LINK_SERVICES_D:
case MULTI_WIRELESS_ALL_SERVICES:
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, sWirelessOptions_AllServices[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case MULTI_LINK_SERVICES_A2:
case MULTI_WIRELESS_NO_RECORD_BERRY:
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, sWirelessOptions_NoRecordMixBerryCrush[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case MULTI_LINK_SERVICES_A1:
case MULTI_CABLE_CLUB_NO_RECORD_MIX:
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, sCableClubOptions_NoRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
}
}

View File

@ -505,20 +505,20 @@ const u8 *GetExpandedPlaceholder(u32 id)
static const ExpandPlaceholderFunc funcs[] =
{
ExpandPlaceholder_UnknownStringVar,
ExpandPlaceholder_PlayerName,
ExpandPlaceholder_StringVar1,
ExpandPlaceholder_StringVar2,
ExpandPlaceholder_StringVar3,
ExpandPlaceholder_KunChan,
ExpandPlaceholder_RivalName,
ExpandPlaceholder_Version,
ExpandPlaceholder_Aqua,
ExpandPlaceholder_Magma,
ExpandPlaceholder_Archie,
ExpandPlaceholder_Maxie,
ExpandPlaceholder_Kyogre,
ExpandPlaceholder_Groudon,
[PLACEHOLDER_ID_UNKNOWN] = ExpandPlaceholder_UnknownStringVar,
[PLACEHOLDER_ID_PLAYER] = ExpandPlaceholder_PlayerName,
[PLACEHOLDER_ID_STRING_VAR_1] = ExpandPlaceholder_StringVar1,
[PLACEHOLDER_ID_STRING_VAR_2] = ExpandPlaceholder_StringVar2,
[PLACEHOLDER_ID_STRING_VAR_3] = ExpandPlaceholder_StringVar3,
[PLACEHOLDER_ID_KUN] = ExpandPlaceholder_KunChan,
[PLACEHOLDER_ID_RIVAL] = ExpandPlaceholder_RivalName,
[PLACEHOLDER_ID_VERSION] = ExpandPlaceholder_Version,
[PLACEHOLDER_ID_AQUA] = ExpandPlaceholder_Aqua,
[PLACEHOLDER_ID_MAGMA] = ExpandPlaceholder_Magma,
[PLACEHOLDER_ID_ARCHIE] = ExpandPlaceholder_Archie,
[PLACEHOLDER_ID_MAXIE] = ExpandPlaceholder_Maxie,
[PLACEHOLDER_ID_KYOGRE] = ExpandPlaceholder_Kyogre,
[PLACEHOLDER_ID_GROUDON] = ExpandPlaceholder_Groudon,
};
if (id >= ARRAY_COUNT(funcs))