From b65980cd4ea7e1a8052a0d2c5cb6edd73d35b89c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 17:50:52 -0500 Subject: Remove unused local variables and functions --- src/battle_interface.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/battle_interface.c') diff --git a/src/battle_interface.c b/src/battle_interface.c index adbef019d..df123630c 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1897,7 +1897,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; -- cgit v1.2.3 From d5d1caf96550c91baef4a7f02670a6f1c83f6559 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 30 Mar 2021 15:07:04 -0400 Subject: Add some uses of OBJ_VRAM/VRAM_SIZE --- src/battle_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/battle_interface.c') diff --git a/src/battle_interface.c b/src/battle_interface.c index df123630c..cccc0b971 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1935,7 +1935,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; @@ -1945,7 +1945,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); -- cgit v1.2.3 From 62abcecc54ac810dc082e5e822be4796a5064ece Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 15 Apr 2021 02:04:01 -0400 Subject: More usage of DISPLAY constants --- src/battle_interface.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/battle_interface.c') diff --git a/src/battle_interface.c b/src/battle_interface.c index cccc0b971..5518fd21b 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; -- cgit v1.2.3 From fa23b196a96e58eaa14d996ac88a3e9b1f274a84 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 3 May 2021 18:22:44 -0400 Subject: [LEAK-INFORMED] fix battle_interface fakematch --- src/battle_interface.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/battle_interface.c') diff --git a/src/battle_interface.c b/src/battle_interface.c index 5518fd21b..b309d62b0 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1099,21 +1099,14 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl) u32 windowId, spriteTileNum; u8 *windowTileData; u8 text[16]; - u32 xPos, var1; - void *objVram; + u32 xPos; + u8 *objVram; text[0] = 0xF9; text[1] = 5; - 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; -- cgit v1.2.3 From 7740ca13038810421d787a248cf62d307c1ab1ef Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Tue, 4 May 2021 01:55:16 -0400 Subject: replace raw values with char constants --- src/battle_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/battle_interface.c') diff --git a/src/battle_interface.c b/src/battle_interface.c index b309d62b0..ff376f6f1 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1101,9 +1101,9 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl) u8 text[16]; u32 xPos; u8 *objVram; - - text[0] = 0xF9; - text[1] = 5; + + text[0] = CHAR_EXTRA_SYMBOL; + text[1] = CHAR_LV_2; objVram = ConvertIntToDecimalStringN(text + 2, lvl, STR_CONV_MODE_LEFT_ALIGN, 3); xPos = 5 * (3 - (objVram - (text + 2))); -- cgit v1.2.3