diff options
author | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2021-05-23 10:51:26 -0400 |
---|---|---|
committer | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2021-05-23 10:51:26 -0400 |
commit | c723d980e772f7e7ab82dbcb7ad07132c09ab5b4 (patch) | |
tree | 0bed002b2990b9e837220618a321f3b6517a1099 /src/battle_interface.c | |
parent | c50a21fba07db80ac44c6f09fd202ba4b2e2c7d3 (diff) | |
parent | ffbbc88801de3fc56d0bf5f0af1418ca7cfcfa4f (diff) |
Merge branch 'master' of https://github.com/pret/pokeemerald
Diffstat (limited to 'src/battle_interface.c')
-rw-r--r-- | src/battle_interface.c | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/src/battle_interface.c b/src/battle_interface.c index adbef019d..ff376f6f1 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -330,7 +330,7 @@ static const struct SpriteTemplate sHealthbarSpriteTemplates[MAX_BATTLERS_COUNT] static const struct Subsprite sUnknown_0832C220[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -346,7 +346,7 @@ static const struct Subsprite sUnknown_0832C220[] = .priority = 1 }, { - .x = 240, + .x = DISPLAY_WIDTH, .y = 32, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -374,7 +374,7 @@ static const struct Subsprite sUnknown_0832C220[] = static const struct Subsprite sUnknown_0832C234[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -390,7 +390,7 @@ static const struct Subsprite sUnknown_0832C234[] = .priority = 1 }, { - .x = 240, + .x = DISPLAY_WIDTH, .y = 32, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -418,7 +418,7 @@ static const struct Subsprite sUnknown_0832C234[] = static const struct Subsprite sUnknown_0832C248[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -438,7 +438,7 @@ static const struct Subsprite sUnknown_0832C248[] = static const struct Subsprite sUnknown_0832C250[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -458,7 +458,7 @@ static const struct Subsprite sUnknown_0832C250[] = static const struct Subsprite sUnknown_0832C258[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -478,7 +478,7 @@ static const struct Subsprite sUnknown_0832C258[] = static const struct Subsprite sUnknown_0832C260[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -494,7 +494,7 @@ static const struct Subsprite sUnknown_0832C260[] = .priority = 1 }, { - .x = 224, + .x = DISPLAY_WIDTH - 16, .y = 0, .shape = SPRITE_SHAPE(8x8), .size = SPRITE_SIZE(8x8), @@ -869,8 +869,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) { if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) { - healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[0], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[0], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.shape = ST_OAM_SQUARE; @@ -879,8 +879,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) } else { - healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[0], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[0], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxRightSpriteId].oam.tileNum += 32; @@ -895,8 +895,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) { if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) { - healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.affineParam = healthboxRightSpriteId; @@ -908,8 +908,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) } else { - healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.affineParam = healthboxRightSpriteId; @@ -946,8 +946,8 @@ u8 CreateSafariPlayerHealthboxSprites(void) { u8 healthboxLeftSpriteId, healthboxRightSpriteId; - healthboxLeftSpriteId = CreateSprite(&sHealthboxSafariSpriteTemplate, 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxSafariSpriteTemplate, 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxSafariSpriteTemplate, DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxSafariSpriteTemplate, DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.shape = ST_OAM_SQUARE; gSprites[healthboxRightSpriteId].oam.shape = ST_OAM_SQUARE; @@ -1099,21 +1099,14 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl) u32 windowId, spriteTileNum; u8 *windowTileData; u8 text[16]; - u32 xPos, var1; - void *objVram; - - text[0] = 0xF9; - text[1] = 5; + u32 xPos; + u8 *objVram; + + text[0] = CHAR_EXTRA_SYMBOL; + text[1] = CHAR_LV_2; - xPos = (u32) ConvertIntToDecimalStringN(text + 2, lvl, STR_CONV_MODE_LEFT_ALIGN, 3); - // Alright, that part was unmatchable. It's basically doing: - // xPos = 5 * (3 - (u32)(&text[2])); - xPos--; - xPos--; - xPos -= ((u32)(text)); - var1 = (3 - xPos); - xPos = 4 * var1; - xPos += var1; + objVram = ConvertIntToDecimalStringN(text + 2, lvl, STR_CONV_MODE_LEFT_ALIGN, 3); + xPos = 5 * (3 - (objVram - (text + 2))); windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, xPos, 3, 2, &windowId); spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; @@ -1897,7 +1890,6 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) { u8 nickname[POKEMON_NAME_LENGTH + 1]; void *ptr; - const u8 *genderTxt; u32 windowId, spriteTileNum; u8 *windowTileData; u16 species; @@ -1936,7 +1928,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER) { - TextIntoHealthboxObject((void*)(VRAM + 0x10040 + spriteTileNum), windowTileData, 6); + TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x40 + spriteTileNum), windowTileData, 6); ptr = (void*)(OBJ_VRAM0); if (!IsDoubleBattle()) ptr += spriteTileNum + 0x800; @@ -1946,7 +1938,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) } else { - TextIntoHealthboxObject((void*)(VRAM + 0x10020 + spriteTileNum), windowTileData, 7); + TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x20 + spriteTileNum), windowTileData, 7); } RemoveWindowOnHealthbox(windowId); |