Merge pull request #1638 from GriffinRichards/menu-arr-count
Add missing menu array counts
This commit is contained in:
@@ -33,7 +33,7 @@ static void ClearDecorationInventory(u8 category)
|
|||||||
void ClearDecorationInventories(void)
|
void ClearDecorationInventories(void)
|
||||||
{
|
{
|
||||||
u8 category;
|
u8 category;
|
||||||
for (category = 0; category < 8; category++)
|
for (category = 0; category < DECORCAT_COUNT; category++)
|
||||||
ClearDecorationInventory(category);
|
ClearDecorationInventory(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2090,7 +2090,7 @@ static void NewGameBirchSpeech_ShowGenderMenu(void)
|
|||||||
DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3);
|
DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3);
|
||||||
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
||||||
PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender);
|
PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender);
|
||||||
InitMenuInUpperLeftCornerNormal(1, 2, 0);
|
InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sMenuActions_Gender), 0);
|
||||||
PutWindowTilemap(1);
|
PutWindowTilemap(1);
|
||||||
CopyWindowToVram(1, COPYWIN_FULL);
|
CopyWindowToVram(1, COPYWIN_FULL);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1542,25 +1542,25 @@ static s8 Menu_ProcessGridInputRepeat(void)
|
|||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
|
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
|
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
|
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
|
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
|
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
|
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
|||||||
+2
-2
@@ -511,7 +511,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var)
|
|||||||
tWindowId = AddWindow(&windowTemplate);
|
tWindowId = AddWindow(&windowTemplate);
|
||||||
SetStandardWindowBorderStyle(tWindowId, 0);
|
SetStandardWindowBorderStyle(tWindowId, 0);
|
||||||
PrintMenuTable(tWindowId, ARRAY_COUNT(sItemStorage_MenuActions), sItemStorage_MenuActions);
|
PrintMenuTable(tWindowId, ARRAY_COUNT(sItemStorage_MenuActions), sItemStorage_MenuActions);
|
||||||
InitMenuInUpperLeftCornerNormal(tWindowId, 4, var);
|
InitMenuInUpperLeftCornerNormal(tWindowId, ARRAY_COUNT(sItemStorage_MenuActions), var);
|
||||||
ScheduleBgCopyTilemapToVram(0);
|
ScheduleBgCopyTilemapToVram(0);
|
||||||
ItemStorageMenuPrint(sItemStorage_OptionDescriptions[var]);
|
ItemStorageMenuPrint(sItemStorage_OptionDescriptions[var]);
|
||||||
}
|
}
|
||||||
@@ -753,7 +753,7 @@ static void Mailbox_PrintMailOptions(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 windowId = MailboxMenu_AddWindow(MAILBOXWIN_OPTIONS);
|
u8 windowId = MailboxMenu_AddWindow(MAILBOXWIN_OPTIONS);
|
||||||
PrintMenuTable(windowId, ARRAY_COUNT(gMailboxMailOptions), gMailboxMailOptions);
|
PrintMenuTable(windowId, ARRAY_COUNT(gMailboxMailOptions), gMailboxMailOptions);
|
||||||
InitMenuInUpperLeftCornerNormal(windowId, 4, 0);
|
InitMenuInUpperLeftCornerNormal(windowId, ARRAY_COUNT(gMailboxMailOptions), 0);
|
||||||
ScheduleBgCopyTilemapToVram(0);
|
ScheduleBgCopyTilemapToVram(0);
|
||||||
gTasks[taskId].func = Mailbox_MailOptionsProcessInput;
|
gTasks[taskId].func = Mailbox_MailOptionsProcessInput;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1027,7 +1027,7 @@ static void ShowRegistryMenuActions(u8 taskId)
|
|||||||
tActionWindowId = AddWindow(&template);
|
tActionWindowId = AddWindow(&template);
|
||||||
SetStandardWindowBorderStyle(tActionWindowId, 0);
|
SetStandardWindowBorderStyle(tActionWindowId, 0);
|
||||||
PrintMenuTable(tActionWindowId, ARRAY_COUNT(sRegistryMenuActions), sRegistryMenuActions);
|
PrintMenuTable(tActionWindowId, ARRAY_COUNT(sRegistryMenuActions), sRegistryMenuActions);
|
||||||
InitMenuInUpperLeftCornerNormal(tActionWindowId, 2, 0);
|
InitMenuInUpperLeftCornerNormal(tActionWindowId, ARRAY_COUNT(sRegistryMenuActions), 0);
|
||||||
ScheduleBgCopyTilemapToVram(0);
|
ScheduleBgCopyTilemapToVram(0);
|
||||||
gTasks[taskId].func = HandleRegistryMenuActionsInput;
|
gTasks[taskId].func = HandleRegistryMenuActionsInput;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1394,7 +1394,7 @@ static void TradeMenuProcessInput(void)
|
|||||||
DrawTextBorderOuter(1, 1, 14);
|
DrawTextBorderOuter(1, 1, 14);
|
||||||
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
||||||
PrintMenuTable(1, ARRAY_COUNT(sSelectTradeMonActions), sSelectTradeMonActions);
|
PrintMenuTable(1, ARRAY_COUNT(sSelectTradeMonActions), sSelectTradeMonActions);
|
||||||
InitMenuInUpperLeftCornerNormal(1, 2, 0);
|
InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sSelectTradeMonActions), 0);
|
||||||
PutWindowTilemap(1);
|
PutWindowTilemap(1);
|
||||||
CopyWindowToVram(1, COPYWIN_FULL);
|
CopyWindowToVram(1, COPYWIN_FULL);
|
||||||
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_SELECTED_MON;
|
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_SELECTED_MON;
|
||||||
|
|||||||
+27
-21
@@ -15,7 +15,7 @@
|
|||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "script_menu.h"
|
#include "script_menu.h"
|
||||||
|
|
||||||
static const u8 * const sDefaultTraderNames[] =
|
static const u8 * const sDefaultTraderNames[NUM_TRADER_ITEMS] =
|
||||||
{
|
{
|
||||||
gText_Tristan,
|
gText_Tristan,
|
||||||
gText_Philip,
|
gText_Philip,
|
||||||
@@ -23,7 +23,7 @@ static const u8 * const sDefaultTraderNames[] =
|
|||||||
gText_Roberto,
|
gText_Roberto,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sDefaultTraderDecorations[] =
|
static const u8 sDefaultTraderDecorations[NUM_TRADER_ITEMS] =
|
||||||
{
|
{
|
||||||
DECOR_DUSKULL_DOLL,
|
DECOR_DUSKULL_DOLL,
|
||||||
DECOR_BALL_CUSHION,
|
DECOR_BALL_CUSHION,
|
||||||
@@ -39,7 +39,7 @@ void TraderSetup(void)
|
|||||||
trader->id = MAUVILLE_MAN_TRADER;
|
trader->id = MAUVILLE_MAN_TRADER;
|
||||||
trader->alreadyTraded = FALSE;
|
trader->alreadyTraded = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < NUM_TRADER_ITEMS; i++)
|
||||||
{
|
{
|
||||||
StringCopy(trader->playerNames[i], sDefaultTraderNames[i]);
|
StringCopy(trader->playerNames[i], sDefaultTraderNames[i]);
|
||||||
trader->decorations[i] = sDefaultTraderDecorations[i];
|
trader->decorations[i] = sDefaultTraderDecorations[i];
|
||||||
@@ -53,15 +53,25 @@ void Trader_ResetFlag(void)
|
|||||||
trader->alreadyTraded = FALSE;
|
trader->alreadyTraded = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define tWindowId data[3]
|
||||||
|
|
||||||
void CreateAvailableDecorationsMenu(u8 taskId)
|
void CreateAvailableDecorationsMenu(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
s16 * data = gTasks[taskId].data;
|
s16 * data = gTasks[taskId].data;
|
||||||
struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader;
|
struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader;
|
||||||
struct WindowTemplate windowTemplate = {0, 1, 1, 10, 10, 15, 1};
|
struct WindowTemplate windowTemplate = {
|
||||||
|
.bg = 0,
|
||||||
|
.tilemapLeft = 1,
|
||||||
|
.tilemapTop = 1,
|
||||||
|
.width = 10,
|
||||||
|
.height = 10,
|
||||||
|
.paletteNum = 15,
|
||||||
|
.baseBlock = 1
|
||||||
|
};
|
||||||
s32 windowWidth = GetStringWidth(FONT_NORMAL, gText_Exit, 0);
|
s32 windowWidth = GetStringWidth(FONT_NORMAL, gText_Exit, 0);
|
||||||
s32 fiveMarksWidth = GetStringWidth(FONT_NORMAL, gText_FiveMarks, 0);
|
s32 fiveMarksWidth = GetStringWidth(FONT_NORMAL, gText_FiveMarks, 0);
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < NUM_TRADER_ITEMS; i++)
|
||||||
{
|
{
|
||||||
s32 curWidth;
|
s32 curWidth;
|
||||||
if (trader->decorations[i] > NUM_DECORATIONS)
|
if (trader->decorations[i] > NUM_DECORATIONS)
|
||||||
@@ -72,17 +82,17 @@ void CreateAvailableDecorationsMenu(u8 taskId)
|
|||||||
windowWidth = curWidth;
|
windowWidth = curWidth;
|
||||||
}
|
}
|
||||||
windowTemplate.width = ConvertPixelWidthToTileWidth(windowWidth);
|
windowTemplate.width = ConvertPixelWidthToTileWidth(windowWidth);
|
||||||
data[3] = AddWindow(&windowTemplate);
|
tWindowId = AddWindow(&windowTemplate);
|
||||||
DrawStdFrameWithCustomTileAndPalette(data[3], FALSE, 0x214, 14);
|
DrawStdFrameWithCustomTileAndPalette(tWindowId, FALSE, 0x214, 14);
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < NUM_TRADER_ITEMS; i++)
|
||||||
{
|
{
|
||||||
if (trader->decorations[i] > NUM_DECORATIONS)
|
if (trader->decorations[i] > NUM_DECORATIONS)
|
||||||
AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_FiveMarks, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gText_FiveMarks, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL);
|
||||||
else
|
else
|
||||||
AddTextPrinterParameterized(data[3], FONT_NORMAL, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL);
|
||||||
}
|
}
|
||||||
AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_Exit, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gText_Exit, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL);
|
||||||
InitMenuInUpperLeftCornerNormal(data[3], 5, 0);
|
InitMenuInUpperLeftCornerNormal(tWindowId, NUM_TRADER_ITEMS + 1, 0);
|
||||||
ScheduleBgCopyTilemapToVram(0);
|
ScheduleBgCopyTilemapToVram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,17 +100,13 @@ void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId)
|
|||||||
{
|
{
|
||||||
s16 * data = gTasks[taskId].data;
|
s16 * data = gTasks[taskId].data;
|
||||||
if (decorationId > NUM_DECORATIONS)
|
if (decorationId > NUM_DECORATIONS)
|
||||||
{
|
|
||||||
gSpecialVar_0x8004 = 0xFFFF;
|
gSpecialVar_0x8004 = 0xFFFF;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gSpecialVar_0x8004 = decorationId;
|
gSpecialVar_0x8004 = decorationId;
|
||||||
}
|
|
||||||
|
|
||||||
ClearStdWindowAndFrameToTransparent(data[3], FALSE);
|
ClearStdWindowAndFrameToTransparent(tWindowId, FALSE);
|
||||||
ClearWindowTilemap(data[3]);
|
ClearWindowTilemap(tWindowId);
|
||||||
RemoveWindow(data[3]);
|
RemoveWindow(tWindowId);
|
||||||
ScheduleBgCopyTilemapToVram(0);
|
ScheduleBgCopyTilemapToVram(0);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
EnableBothScriptContexts();
|
EnableBothScriptContexts();
|
||||||
@@ -116,7 +122,7 @@ void Task_HandleGetDecorationMenuInput(u8 taskId)
|
|||||||
case MENU_NOTHING_CHOSEN:
|
case MENU_NOTHING_CHOSEN:
|
||||||
break;
|
break;
|
||||||
case MENU_B_PRESSED:
|
case MENU_B_PRESSED:
|
||||||
case 4:
|
case NUM_TRADER_ITEMS: // EXIT
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Task_BufferDecorSelectionAndCloseWindow(taskId, 0);
|
Task_BufferDecorSelectionAndCloseWindow(taskId, 0);
|
||||||
break;
|
break;
|
||||||
@@ -140,7 +146,7 @@ void DoesPlayerHaveNoDecorations(void)
|
|||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < DECORCAT_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (GetNumOwnedDecorationsInCategory(i))
|
if (GetNumOwnedDecorationsInCategory(i))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2987,7 +2987,7 @@ static void ShowKeyboardSwapMenu(void)
|
|||||||
{
|
{
|
||||||
FillWindowPixelBuffer(3, PIXEL_FILL(1));
|
FillWindowPixelBuffer(3, PIXEL_FILL(1));
|
||||||
DrawTextBorderOuter(3, 1, 13);
|
DrawTextBorderOuter(3, 1, 13);
|
||||||
PrintMenuActionTextsAtPos(3, FONT_SHORT, 8, 1, 14, 5, sKeyboardPageTitleTexts);
|
PrintMenuActionTextsAtPos(3, FONT_SHORT, 8, 1, 14, ARRAY_COUNT(sKeyboardPageTitleTexts), sKeyboardPageTitleTexts);
|
||||||
InitMenuNormal(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage());
|
InitMenuNormal(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage());
|
||||||
PutWindowTilemap(3);
|
PutWindowTilemap(3);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user