Ability pop-up displays properly long abilities
This commit is contained in:
parent
21fe205f0f
commit
17b47de90d
1 changed files with 20 additions and 8 deletions
|
@ -2908,7 +2908,7 @@ static void TextIntoAbilityPopUp(void *dest, u8 *windowTileData, s32 arg2, bool3
|
|||
|
||||
#define MAX_CHARS_PRINTED 12
|
||||
|
||||
static void PrintOnAbilityPopUp(const u8 *str, u8 *spriteTileData1, u8 *spriteTileData2, u32 x1, u32 x2, u32 y, u32 color1, u32 color2, u32 color3)
|
||||
static void PrintOnAbilityPopUp(const u8 *str, u8 *spriteTileData1, u8 *spriteTileData2, u32 x1, u32 x2, u32 y, u32 color1, u32 color2, u32 color3, bool32 alignAbilityChars)
|
||||
{
|
||||
u32 windowId, i;
|
||||
u8 *windowTileData;
|
||||
|
@ -2923,6 +2923,15 @@ static void PrintOnAbilityPopUp(const u8 *str, u8 *spriteTileData1, u8 *spriteTi
|
|||
}
|
||||
text1[i] = EOS;
|
||||
|
||||
// Because there are two Windows, we need to align the strings, so that the first char in the second window starts right after the last char in the first window.
|
||||
// Windows are 64 pixels in width.
|
||||
if (alignAbilityChars && i == MAX_CHARS_PRINTED)
|
||||
{
|
||||
u32 width = GetStringWidth(FONT_SMALL, text1, 0);
|
||||
while (x1 + width < 64)
|
||||
x1++;
|
||||
}
|
||||
|
||||
windowTileData = AddTextPrinterAndCreateWindowOnAbilityPopUp(text1, x1, y, color1, color2, color3, &windowId);
|
||||
TextIntoAbilityPopUp(spriteTileData1, windowTileData, 8, (y == 0));
|
||||
RemoveWindow(windowId);
|
||||
|
@ -2951,7 +2960,8 @@ static void ClearAbilityName(u8 spriteId1, u8 spriteId2)
|
|||
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256,
|
||||
6, 1,
|
||||
4,
|
||||
7, 9, 1);
|
||||
7, 9, 1,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2)
|
||||
|
@ -2988,7 +2998,8 @@ static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2)
|
|||
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32),
|
||||
7, 0,
|
||||
0,
|
||||
2, 7, 1);
|
||||
2, 7, 1,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static void PrintAbilityOnAbilityPopUp(u32 ability, u8 spriteId1, u8 spriteId2)
|
||||
|
@ -2996,9 +3007,10 @@ static void PrintAbilityOnAbilityPopUp(u32 ability, u8 spriteId1, u8 spriteId2)
|
|||
PrintOnAbilityPopUp(gAbilityNames[ability],
|
||||
(void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32) + 256,
|
||||
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256,
|
||||
6, 1,
|
||||
6, 0,
|
||||
4,
|
||||
7, 9, 1);
|
||||
7, 9, 1,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
#define PIXEL_COORDS_TO_OFFSET(x, y)( \
|
||||
|
|
Loading…
Reference in a new issue