From 3b501cb4701cebdeaca3df9ed2b9d6833c59a4fc Mon Sep 17 00:00:00 2001 From: Slawter666 <38655737+Slawter666@users.noreply.github.com> Date: Thu, 22 Nov 2018 01:10:50 +0000 Subject: [PATCH] Document battle ui --- .../menu.png => battle_interface/textbox.png} | Bin .../textbox_0.pal} | 0 .../textbox_1.pal} | 0 .../textbox_map.bin} | Bin graphics_file_rules.mk | 4 +- include/pokemon.h | 19 ---- src/battle_bg.c | 22 ++-- src/battle_controller_player.c | 6 +- src/battle_interface.c | 102 +++++++++--------- src/battle_main.c | 6 +- src/battle_message.c | 57 +++++----- src/graphics.c | 6 +- 12 files changed, 102 insertions(+), 120 deletions(-) rename graphics/{interface/menu.png => battle_interface/textbox.png} (100%) rename graphics/{interface/menu_0.pal => battle_interface/textbox_0.pal} (100%) rename graphics/{interface/menu_1.pal => battle_interface/textbox_1.pal} (100%) rename graphics/{interface/menu_map.bin => battle_interface/textbox_map.bin} (100%) diff --git a/graphics/interface/menu.png b/graphics/battle_interface/textbox.png similarity index 100% rename from graphics/interface/menu.png rename to graphics/battle_interface/textbox.png diff --git a/graphics/interface/menu_0.pal b/graphics/battle_interface/textbox_0.pal similarity index 100% rename from graphics/interface/menu_0.pal rename to graphics/battle_interface/textbox_0.pal diff --git a/graphics/interface/menu_1.pal b/graphics/battle_interface/textbox_1.pal similarity index 100% rename from graphics/interface/menu_1.pal rename to graphics/battle_interface/textbox_1.pal diff --git a/graphics/interface/menu_map.bin b/graphics/battle_interface/textbox_map.bin similarity index 100% rename from graphics/interface/menu_map.bin rename to graphics/battle_interface/textbox_map.bin diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index fb250ad82..0a22a711c 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -309,8 +309,8 @@ graphics/pokenav/region_map.8bpp: %.8bpp: %.png $(MISCGFXDIR)/japanese_hof.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 29 -$(INTERFACEGFXDIR)/menu.gbapal: $(INTERFACEGFXDIR)/menu_0.gbapal \ - $(INTERFACEGFXDIR)/menu_1.gbapal +$(BATINTGFXDIR)/textbox.gbapal: $(BATINTGFXDIR)/textbox_0.gbapal \ + $(BATINTGFXDIR)/textbox_1.gbapal @cat $^ >$@ $(BTLANMSPRGFXDIR)/010.4bpp: $(BTLANMSPRGFXDIR)/010_0.4bpp \ diff --git a/include/pokemon.h b/include/pokemon.h index 3e69845e6..3bf728244 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -112,25 +112,6 @@ #define MON_FEMALE 0xFE #define MON_GENDERLESS 0xFF -#define TYPE_NORMAL 0x00 -#define TYPE_FIGHTING 0x01 -#define TYPE_FLYING 0x02 -#define TYPE_POISON 0x03 -#define TYPE_GROUND 0x04 -#define TYPE_ROCK 0x05 -#define TYPE_BUG 0x06 -#define TYPE_GHOST 0x07 -#define TYPE_STEEL 0x08 -#define TYPE_MYSTERY 0x09 -#define TYPE_FIRE 0x0a -#define TYPE_WATER 0x0b -#define TYPE_GRASS 0x0c -#define TYPE_ELECTRIC 0x0d -#define TYPE_PSYCHIC 0x0e -#define TYPE_ICE 0x0f -#define TYPE_DRAGON 0x10 -#define TYPE_DARK 0x11 - #define FRIENDSHIP_EVENT_GROW_LEVEL 0x0 #define FRIENDSHIP_EVENT_VITAMIN 0x1 // unused #define FRIENDSHIP_EVENT_BATTLE_ITEM 0x2 // unused diff --git a/src/battle_bg.c b/src/battle_bg.c index 51138040c..bb66a41fd 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -157,9 +157,9 @@ const struct BgTemplate gBattleBgTemplates[] = }, }; -static const struct WindowTemplate gUnknown_0831AA18[] = +static const struct WindowTemplate gStandardBattleWindowTemplates[] = { - { + { // 0 Standard battle message .bg = 0, .tilemapLeft = 2, .tilemapTop = 15, @@ -168,7 +168,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] = .paletteNum = 0, .baseBlock = 0x0090, }, - { + { // 1 "What will (pokemon) do?" .bg = 0, .tilemapLeft = 1, .tilemapTop = 35, @@ -177,7 +177,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] = .paletteNum = 0, .baseBlock = 0x01c0, }, - { + { // 2 "Fight/Pokemon/Bag/Run" .bg = 0, .tilemapLeft = 17, .tilemapTop = 35, @@ -186,7 +186,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] = .paletteNum = 5, .baseBlock = 0x0190, }, - { + { // 3 Top left move .bg = 0, .tilemapLeft = 2, .tilemapTop = 55, @@ -195,7 +195,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] = .paletteNum = 5, .baseBlock = 0x0300, }, - { + { // 4 Top right move .bg = 0, .tilemapLeft = 11, .tilemapTop = 55, @@ -204,7 +204,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] = .paletteNum = 5, .baseBlock = 0x0310, }, - { + { // 5 Bottom left move .bg = 0, .tilemapLeft = 2, .tilemapTop = 57, @@ -213,7 +213,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] = .paletteNum = 5, .baseBlock = 0x0320, }, - { + { // 6 Bottom right move .bg = 0, .tilemapLeft = 11, .tilemapTop = 57, @@ -378,7 +378,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] = DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate gUnknown_0831AAE0[] = +static const struct WindowTemplate gBattleArenaWindowTemplates[] = { { .bg = 0, @@ -592,8 +592,8 @@ static const struct WindowTemplate gUnknown_0831AAE0[] = const struct WindowTemplate * const gBattleWindowTemplates[] = { - gUnknown_0831AA18, - gUnknown_0831AAE0, + gStandardBattleWindowTemplates, + gBattleArenaWindowTemplates, }; static const struct BattleBackground gBattleTerrainTable[] = diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 3fabf25f8..e6dc4567c 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -114,7 +114,7 @@ static void MoveSelectionDisplayPpNumber(void); static void MoveSelectionDisplayPpString(void); static void MoveSelectionDisplayMoveType(void); static void MoveSelectionDisplayMoveNames(void); -static void HandleMoveSwitchting(void); +static void HandleMoveSwitching(void); static void sub_8058FC0(void); static void WaitForMonSelection(void); static void CompleteWhenChoseItem(void); @@ -617,7 +617,7 @@ static void HandleInputChooseMove(void) MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); BattlePutTextOnWindow(gText_BattleSwitchWhich, 0xB); - gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitchting; + gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitching; } } } @@ -672,7 +672,7 @@ u32 sub_8057FBC(void) // unused return var; } -static void HandleMoveSwitchting(void) +static void HandleMoveSwitching(void) { u8 perMovePPBonuses[4]; struct ChooseMoveStruct moveStruct; diff --git a/src/battle_interface.c b/src/battle_interface.c index ec8a06094..c7eb11293 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -168,15 +168,15 @@ extern const u8 gText_DynColor1Female[]; // this file's functions static const u8 *GetHealthboxElementGfxPtr(u8 elementId); -static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 arg3, u32 *windowId); +static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId); static void RemoveWindowOnHealthbox(u32 windowId); static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId); -static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 arg2); -static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2); -static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2); +static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 windowWidth); +static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth); +static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth); static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2); static void sub_8073E08(u8 taskId); @@ -965,7 +965,7 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) healthBarSpritePtr->subspriteMode = 2; healthBarSpritePtr->oam.priority = 1; - CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void*)(OBJ_VRAM0 + healthBarSpritePtr->oam.tileNum * 32), 64); + CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void*)(OBJ_VRAM0 + healthBarSpritePtr->oam.tileNum * TILE_SIZE_4BPP), 64); gSprites[healthboxLeftSpriteId].hMain_HealthBarSpriteId = healthbarSpriteId; gSprites[healthboxLeftSpriteId].hMain_Battler = battlerId; @@ -1154,7 +1154,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl) xPos += var1; windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, xPos, 3, 2, &windowId); - spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32; + spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; if (GetBattlerSide(gSprites[healthboxSpriteId].hMain_Battler) == B_SIDE_PLAYER) { @@ -1182,7 +1182,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent) if (GetBattlerSide(gSprites[healthboxSpriteId].hMain_Battler) == B_SIDE_PLAYER && !IsDoubleBattle()) { - spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32; + spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; if (maxOrCurrent != HP_CURRENT) // singles, max { ConvertIntToDecimalStringN(text, value, STR_CONV_MODE_RIGHT_ALIGN, 3); @@ -1243,7 +1243,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent) for (i = 0; i < 3; i++) { CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[i * 64 + 32], - (void*)((OBJ_VRAM0) + 32 * (gSprites[healthboxSpriteId].oam.tileNum + var + i)), + (void*)((OBJ_VRAM0) + TILE_SIZE_4BPP * (gSprites[healthboxSpriteId].oam.tileNum + var + i)), 0x20); } } @@ -1261,7 +1261,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 { if (gBattleSpritesDataPtr->battlerData[gSprites[healthboxSpriteId].data[6]].hpNumbersNoBars) // don't print text if only bars are visible { - spriteTileNum = gSprites[gSprites[healthboxSpriteId].data[5]].oam.tileNum * 32; + spriteTileNum = gSprites[gSprites[healthboxSpriteId].data[5]].oam.tileNum * TILE_SIZE_4BPP; objVram = (void*)(OBJ_VRAM0) + spriteTileNum; if (maxOrCurrent != HP_CURRENT) // doubles, max hp @@ -1271,7 +1271,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 HpTextIntoHealthboxObject((void*)(OBJ_VRAM0) + spriteTileNum + 0xC0, windowTileData, 2); RemoveWindowOnHealthbox(windowId); CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116), - (void*)(OBJ_VRAM0 + 0x680) + (gSprites[healthboxSpriteId].oam.tileNum * 32), + (void*)(OBJ_VRAM0 + 0x680) + (gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP), 0x20); } else @@ -1328,16 +1328,16 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 if (maxOrCurrent == HP_CURRENT) { CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[224], - (void*)((OBJ_VRAM0) + ((gSprites[r7].oam.tileNum + 4) * 32)), + (void*)((OBJ_VRAM0) + ((gSprites[r7].oam.tileNum + 4) * TILE_SIZE_4BPP)), 0x20); - CpuFill32(0, (void*)((OBJ_VRAM0) + (gSprites[r7].oam.tileNum * 32)), 0x20); + CpuFill32(0, (void*)((OBJ_VRAM0) + (gSprites[r7].oam.tileNum * TILE_SIZE_4BPP)), 0x20); } else { if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) // Impossible to reach part, because the battlerId is from the opponent's side. { CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116), - (void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * 32), + (void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * TILE_SIZE_4BPP), 0x20); } } @@ -1349,7 +1349,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon) { u8 text[20]; - s32 j, var2; + s32 j, spriteTileNum; u8 *barFontGfx; u8 i, var, nature, healthBarSpriteId; @@ -1376,12 +1376,12 @@ static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon) for (j = 1; j < var + 1; j++) { - var2 = (gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32; - CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20); + spriteTileNum = (gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * TILE_SIZE_4BPP; + CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (spriteTileNum), 0x20); barFontGfx += 0x20; - var2 = (8 + gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32; - CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20); + spriteTileNum = (8 + gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * TILE_SIZE_4BPP; + CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (spriteTileNum), 0x20); barFontGfx += 0x20; } @@ -1398,13 +1398,13 @@ static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon) if (j <= 1) { CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20], - (void*)(OBJ_VRAM0) + (gSprites[healthBarSpriteId].oam.tileNum + 2 + j) * 32, + (void*)(OBJ_VRAM0) + (gSprites[healthBarSpriteId].oam.tileNum + 2 + j) * TILE_SIZE_4BPP, 32); } else { CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20], - (void*)(OBJ_VRAM0 + 0xC0) + (j + gSprites[healthBarSpriteId].oam.tileNum) * 32, + (void*)(OBJ_VRAM0 + 0xC0) + (j + gSprites[healthBarSpriteId].oam.tileNum) * TILE_SIZE_4BPP, 32); } } @@ -1436,7 +1436,7 @@ void SwapHpBarsWithHpText(void) { healthBarSpriteId = gSprites[gHealthboxSpriteIds[i]].hMain_HealthBarSpriteId; - CpuFill32(0, (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * 32), 0x100); + CpuFill32(0, (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 0x100); UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_HP), HP_CURRENT); UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_MAX_HP), HP_MAX); } @@ -1444,7 +1444,7 @@ void SwapHpBarsWithHpText(void) { UpdateStatusIconInHealthbox(gHealthboxSpriteIds[i]); UpdateHealthboxAttribute(gHealthboxSpriteIds[i], &gPlayerParty[gBattlerPartyIndexes[i]], HEALTHBOX_HEALTH_BAR); - CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_117), (void*)(OBJ_VRAM0 + 0x680 + gSprites[gHealthboxSpriteIds[i]].oam.tileNum * 32), 32); + CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_117), (void*)(OBJ_VRAM0 + 0x680 + gSprites[gHealthboxSpriteIds[i]].oam.tileNum * TILE_SIZE_4BPP), 32); } } else @@ -1970,7 +1970,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) break; } - spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32; + spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER) { @@ -2008,9 +2008,9 @@ static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus) healthBarSpriteId = gSprites[healthboxSpriteId].hMain_HealthBarSpriteId; if (noStatus) - CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_70), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * 32), 32); + CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_70), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * TILE_SIZE_4BPP), 32); else - CpuFill32(0, (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * 32), 32); + CpuFill32(0, (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * TILE_SIZE_4BPP), 32); } static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) @@ -2068,10 +2068,10 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) statusGfxPtr = GetHealthboxElementGfxPtr(HEALTHBOX_GFX_39); for (i = 0; i < 3; i++) - CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * 32), 32); + CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * TILE_SIZE_4BPP), 32); if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) - CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * 32), 64); + CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 64); TryAddPokeballIconToHealthbox(healthboxSpriteId, TRUE); return; @@ -2082,13 +2082,13 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2); CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2); - CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96); + CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * TILE_SIZE_4BPP), 96); if (IsDoubleBattle() == TRUE || GetBattlerSide(battlerId) == B_SIDE_OPPONENT) { if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) { - CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * 32), 32); - CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 1) * 32), 32); + CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 32); + CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 1) * TILE_SIZE_4BPP), 32); } } TryAddPokeballIconToHealthbox(healthboxSpriteId, FALSE); @@ -2160,7 +2160,7 @@ static void UpdateSafariBallsTextOnHealthbox(u8 healthboxSpriteId) u8 *windowTileData; windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gText_SafariBalls, 0, 3, 2, &windowId); - spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32; + spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x40) + spriteTileNum, windowTileData, 6); TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x800) + spriteTileNum, windowTileData + 0xC0, 2); RemoveWindowOnHealthbox(windowId); @@ -2177,7 +2177,7 @@ static void UpdateLeftNoOfBallsTextOnHealthbox(u8 healthboxSpriteId) ConvertIntToDecimalStringN(txtPtr, gNumSafariBalls, STR_CONV_MODE_LEFT_ALIGN, 2); windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, GetStringRightAlignXOffset(0, text, 0x2F), 3, 2, &windowId); - spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32; + spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; SafariTextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x2C0) + spriteTileNum, windowTileData, 2); SafariTextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0xA00) + spriteTileNum, windowTileData + 0x40, 4); RemoveWindowOnHealthbox(windowId); @@ -2323,10 +2323,10 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar) u8 healthbarSpriteId = gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].hMain_HealthBarSpriteId; if (i < 2) CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32, - (void*)(OBJ_VRAM0 + (gSprites[healthbarSpriteId].oam.tileNum + 2 + i) * 32), 32); + (void*)(OBJ_VRAM0 + (gSprites[healthbarSpriteId].oam.tileNum + 2 + i) * TILE_SIZE_4BPP), 32); else CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32, - (void*)(OBJ_VRAM0 + 64 + (i + gSprites[healthbarSpriteId].oam.tileNum) * 32), 32); + (void*)(OBJ_VRAM0 + 64 + (i + gSprites[healthbarSpriteId].oam.tileNum) * TILE_SIZE_4BPP), 32); } break; case EXP_BAR: @@ -2345,10 +2345,10 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar) { if (i < 4) CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32, - (void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum + 0x24 + i) * 32), 32); + (void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum + 0x24 + i) * TILE_SIZE_4BPP), 32); else CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32, - (void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum) * 32), 32); + (void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum) * TILE_SIZE_4BPP), 32); } break; } @@ -2571,16 +2571,16 @@ u8 GetHPBarLevel(s16 hp, s16 maxhp) return result; } -static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 arg3, u32 *windowId) +static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId) { u16 winId; u8 color[3]; struct WindowTemplate winTemplate = sHealthboxWindowTemplate; winId = AddWindow(&winTemplate); - FillWindowPixelBuffer(winId, (arg3 << 4) | (arg3)); + FillWindowPixelBuffer(winId, (bgColor << 4) | (bgColor)); - color[0] = arg3; + color[0] = bgColor; color[1] = 1; color[2] = 3; @@ -2597,31 +2597,31 @@ static void RemoveWindowOnHealthbox(u32 windowId) static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2) { - CpuFill32(0x11111111 * arg1, dest, arg2 * 32); + CpuFill32(0x11111111 * arg1, dest, arg2 * TILE_SIZE_4BPP); } -static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2) +static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth) { - CpuCopy32(windowTileData + 256, dest, arg2 * 32); + CpuCopy32(windowTileData + 256, dest, windowWidth * TILE_SIZE_4BPP); } -static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 arg2) +static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 windowWidth) { - CpuCopy32(windowTileData + 256, dest + 256, arg2 * 32); - - if (arg2 > 0) + CpuCopy32(windowTileData + 256, dest + 256, windowWidth * TILE_SIZE_4BPP); +// + 256 as that prevents the top 4 blank rows of sHealthboxWindowTemplate from being copied + if (windowWidth > 0) { do { CpuCopy32(windowTileData + 20, dest + 20, 12); dest += 32, windowTileData += 32; - arg2--; - } while (arg2 != 0); + windowWidth--; + } while (windowWidth != 0); } } -static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2) +static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth) { - CpuCopy32(windowTileData, dest, arg2 * 32); - CpuCopy32(windowTileData + 256, dest + 256, arg2 * 32); + CpuCopy32(windowTileData, dest, windowWidth * TILE_SIZE_4BPP); + CpuCopy32(windowTileData + 256, dest + 256, windowWidth * TILE_SIZE_4BPP); } diff --git a/src/battle_main.c b/src/battle_main.c index 116f5963a..8bdd2220b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -166,7 +166,7 @@ static void HandleAction_WatchesCarefully(void); static void HandleAction_SafariZoneBallThrow(void); static void HandleAction_ThrowPokeblock(void); static void HandleAction_GoNear(void); -static void HandleAction_SafriZoneRun(void); +static void HandleAction_SafariZoneRun(void); static void HandleAction_WallyBallThrow(void); static void HandleAction_Action11(void); static void HandleAction_NothingIsFainted(void); @@ -515,7 +515,7 @@ static void (* const sTurnActionsFuncsTable[])(void) = HandleAction_SafariZoneBallThrow, // B_ACTION_SAFARI_BALL HandleAction_ThrowPokeblock, // B_ACTION_SAFARI_POKEBLOCK HandleAction_GoNear, // B_ACTION_SAFARI_GO_NEAR - HandleAction_SafriZoneRun, // B_ACTION_SAFARI_RUN + HandleAction_SafariZoneRun, // B_ACTION_SAFARI_RUN HandleAction_WallyBallThrow, // B_ACTION_WALLY_THROW HandleAction_RunBattleScript, // B_ACTION_EXEC_SCRIPT HandleAction_Action11, // not sure about this one @@ -5783,7 +5783,7 @@ static void HandleAction_GoNear(void) gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } -static void HandleAction_SafriZoneRun(void) +static void HandleAction_SafariZoneRun(void) { gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; PlaySE(SE_NIGERU); diff --git a/src/battle_message.c b/src/battle_message.c index 44ea5d7d7..47c4cbe1d 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1,25 +1,25 @@ #include "global.h" #include "battle.h" -#include "battle_message.h" -#include "constants/battle_string_ids.h" -#include "constants/moves.h" -#include "text.h" -#include "string_util.h" -#include "constants/items.h" -#include "constants/trainers.h" -#include "event_data.h" -#include "link.h" -#include "item.h" -#include "window.h" -#include "palette.h" #include "battle_controllers.h" +#include "battle_message.h" #include "battle_setup.h" -#include "menu.h" -#include "recorded_battle.h" -#include "international_string_util.h" -#include "frontier_util.h" #include "battle_tower.h" #include "data2.h" +#include "event_data.h" +#include "frontier_util.h" +#include "international_string_util.h" +#include "item.h" +#include "link.h" +#include "menu.h" +#include "palette.h" +#include "recorded_battle.h" +#include "string_util.h" +#include "text.h" +#include "window.h" +#include "constants/battle_string_ids.h" +#include "constants/items.h" +#include "constants/moves.h" +#include "constants/trainers.h" struct BattleWindowText { @@ -1367,7 +1367,8 @@ static const u8 sDummyWeirdStatusString[] = {EOS, EOS, EOS, EOS, EOS, EOS, EOS, static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = { - { // 0 +// The corresponding WindowTemplate is gStandardBattleWindowTemplates[] within src/battle_bg.c + { // 0 Standard battle message .fillValue = 0xFF, .fontId = 1, .x = 0, @@ -1379,7 +1380,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 15, .shadowColor = 6, }, - { // 1 + { // 1 "What will (pokemon) do?" .fillValue = 0xFF, .fontId = 1, .x = 1, @@ -1391,7 +1392,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 15, .shadowColor = 6, }, - { // 2 + { // 2 "Fight/Pokemon/Bag/Run" .fillValue = 0xEE, .fontId = 1, .x = 0, @@ -1403,7 +1404,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 3 + { // 3 Top left move .fillValue = 0xEE, .fontId = 7, .x = 0, @@ -1415,7 +1416,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 4 + { // 4 Top right move .fillValue = 0xEE, .fontId = 7, .x = 0, @@ -1427,7 +1428,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 5 + { // 5 Bottom left move .fillValue = 0xEE, .fontId = 7, .x = 0, @@ -1439,7 +1440,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 6 + { // 6 Bottom right move .fillValue = 0xEE, .fontId = 7, .x = 0, @@ -1451,7 +1452,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 7 + { // 7 "PP" .fillValue = 0xEE, .fontId = 7, .x = 0, @@ -1475,7 +1476,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 9 + { // 9 PP remaining .fillValue = 0xEE, .fontId = 1, .x = 2, @@ -1487,7 +1488,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 11, }, - { // 10 + { // 10 "type" .fillValue = 0xEE, .fontId = 7, .x = 0, @@ -1499,7 +1500,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 11 + { // 11 "switch which?" .fillValue = 0xEE, .fontId = 7, .x = 0, @@ -1511,7 +1512,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = .bgColor = 14, .shadowColor = 15, }, - { // 12 + { // 12 "gText_BattleYesNoChoice" .fillValue = 0xEE, .fontId = 1, .x = 0, diff --git a/src/graphics.c b/src/graphics.c index 7c28aa7b6..2a21b610a 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1,8 +1,8 @@ #include "global.h" -const u32 gBattleTextboxTiles[] = INCBIN_U32("graphics/interface/menu.4bpp.lz"); -const u32 gBattleTextboxPalette[] = INCBIN_U32("graphics/interface/menu.gbapal.lz"); -const u32 gBattleTextboxTilemap[] = INCBIN_U32("graphics/interface/menu_map.bin.lz"); +const u32 gBattleTextboxTiles[] = INCBIN_U32("graphics/battle_interface/textbox.4bpp.lz"); +const u32 gBattleTextboxPalette[] = INCBIN_U32("graphics/battle_interface/textbox.gbapal.lz"); +const u32 gBattleTextboxTilemap[] = INCBIN_U32("graphics/battle_interface/textbox_map.bin.lz"); const u32 gMonStillFrontPic_CircledQuestionMark[] = INCBIN_U32("graphics/pokemon/front_pics/circled_question_mark_still_front_pic.4bpp.lz"); const u32 gMonBackPic_CircledQuestionMark[] = INCBIN_U32("graphics/pokemon/back_pics/circled_question_mark_back_pic.4bpp.lz");