diff options
Diffstat (limited to 'src/trader.c')
-rw-r--r-- | src/trader.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/trader.c b/src/trader.c index b89ad6043..040ee695b 100644 --- a/src/trader.c +++ b/src/trader.c @@ -53,12 +53,22 @@ void Trader_ResetFlag(void) trader->alreadyTraded = FALSE; } +#define tWindowId data[3] + void CreateAvailableDecorationsMenu(u8 taskId) { u8 i; s16 * data = gTasks[taskId].data; 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 fiveMarksWidth = GetStringWidth(FONT_NORMAL, gText_FiveMarks, 0); for (i = 0; i < NUM_TRADER_ITEMS; i++) @@ -72,17 +82,17 @@ void CreateAvailableDecorationsMenu(u8 taskId) windowWidth = curWidth; } windowTemplate.width = ConvertPixelWidthToTileWidth(windowWidth); - data[3] = AddWindow(&windowTemplate); - DrawStdFrameWithCustomTileAndPalette(data[3], FALSE, 0x214, 14); + tWindowId = AddWindow(&windowTemplate); + DrawStdFrameWithCustomTileAndPalette(tWindowId, FALSE, 0x214, 14); for (i = 0; i < NUM_TRADER_ITEMS; i++) { 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 - 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); - InitMenuInUpperLeftCornerNormal(data[3], NUM_TRADER_ITEMS + 1, 0); + AddTextPrinterParameterized(tWindowId, FONT_NORMAL, gText_Exit, 8, 16 * i + 1, TEXT_SKIP_DRAW, NULL); + InitMenuInUpperLeftCornerNormal(tWindowId, NUM_TRADER_ITEMS + 1, 0); ScheduleBgCopyTilemapToVram(0); } @@ -94,9 +104,9 @@ void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId) else gSpecialVar_0x8004 = decorationId; - ClearStdWindowAndFrameToTransparent(data[3], FALSE); - ClearWindowTilemap(data[3]); - RemoveWindow(data[3]); + ClearStdWindowAndFrameToTransparent(tWindowId, FALSE); + ClearWindowTilemap(tWindowId); + RemoveWindow(tWindowId); ScheduleBgCopyTilemapToVram(0); DestroyTask(taskId); EnableBothScriptContexts(); @@ -112,7 +122,7 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) case MENU_NOTHING_CHOSEN: break; case MENU_B_PRESSED: - case NUM_TRADER_ITEMS: + case NUM_TRADER_ITEMS: // EXIT PlaySE(SE_SELECT); Task_BufferDecorSelectionAndCloseWindow(taskId, 0); break; @@ -136,7 +146,7 @@ void DoesPlayerHaveNoDecorations(void) { u8 i; - for (i = 0; i < 8; i++) + for (i = 0; i < DECORCAT_COUNT; i++) { if (GetNumOwnedDecorationsInCategory(i)) { |