Move Relearner now displays move category (#5081)

* Move relearner now displays move category

* Update move_relearner.c

* Update move_relearner.c

* Address reviews
This commit is contained in:
kittenchilly 2024-08-06 16:58:18 -05:00 committed by GitHub
parent db3bb40c1a
commit e4f09c8103
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 1 deletions

View File

@ -219,7 +219,7 @@
#define B_FAST_HP_DRAIN TRUE // If set to TRUE, HP bars will move faster.
#define B_FAST_EXP_GROW TRUE // If set to TRUE, EXP bars will move faster.
#define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move.
#define B_SHOW_CATEGORY_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category.
#define B_SHOW_CATEGORY_ICON TRUE // If set to TRUE, it will show an icon in the summary and move relearner showing the move's category.
#define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
#define B_EXPANDED_MOVE_NAMES TRUE // If set to FALSE, move names are decreased from 16 characters to 12 characters.
#define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles.

View File

@ -3,5 +3,6 @@
void TeachMoveRelearnerMove(void);
void MoveRelearnerShowHideHearts(s32);
void MoveRelearnerShowHideCategoryIcon(s32);
#endif //GUARD_MOVE_RELEARNER_H

View File

@ -756,6 +756,9 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
u8 buffer[32];
const u8 *str;
if (B_SHOW_CATEGORY_ICON == TRUE)
MoveRelearnerShowHideCategoryIcon(chosenMove);
FillWindowPixelBuffer(RELEARNERWIN_DESC_BATTLE, PIXEL_FILL(1));
str = gText_MoveRelearnerBattleMoves;
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 128);

View File

@ -1,9 +1,11 @@
#include "global.h"
#include "main.h"
#include "battle.h"
#include "battle_util.h"
#include "bg.h"
#include "contest_effect.h"
#include "data.h"
#include "decompress.h"
#include "event_data.h"
#include "field_screen_effect.h"
#include "gpu_regs.h"
@ -173,6 +175,7 @@ static EWRAM_DATA struct
u8 moveListScrollArrowTask; /*0x113*/
u8 moveDisplayArrowTask; /*0x114*/
u16 scrollOffset; /*0x116*/
u8 categoryIconSpriteId; /*0x117*/
} *sMoveRelearnerStruct = {0};
static EWRAM_DATA struct {
@ -803,6 +806,9 @@ static void HandleInput(bool8 showContest)
ScheduleBgCopyTilemapToVram(1);
MoveRelearnerShowHideHearts(GetCurrentSelectedMove());
if (B_SHOW_CATEGORY_ICON == TRUE)
MoveRelearnerShowHideCategoryIcon(GetCurrentSelectedMove());
break;
case LIST_CANCEL:
PlaySE(SE_SELECT);
@ -851,6 +857,10 @@ static void CreateUISprites(void)
sMoveRelearnerStruct->moveListScrollArrowTask = TASK_NONE;
AddScrollArrows();
sMoveRelearnerStruct->categoryIconSpriteId = 0xFF;
LoadCompressedSpriteSheet(&gSpriteSheet_CategoryIcons);
LoadSpritePalette(&gSpritePal_CategoryIcons);
// These are the appeal hearts.
for (i = 0; i < 8; i++)
sMoveRelearnerStruct->heartSpriteIds[i] = CreateSprite(&sConstestMoveHeartSprite, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 36, 0);
@ -957,3 +967,23 @@ void MoveRelearnerShowHideHearts(s32 moveId)
}
}
}
void MoveRelearnerShowHideCategoryIcon(s32 moveId)
{
if (sMoveRelearnerMenuSate.showContestInfo || moveId == LIST_CANCEL)
{
if (sMoveRelearnerStruct->categoryIconSpriteId != 0xFF)
DestroySprite(&gSprites[sMoveRelearnerStruct->categoryIconSpriteId]);
sMoveRelearnerStruct->categoryIconSpriteId = 0xFF;
gSprites[sMoveRelearnerStruct->categoryIconSpriteId].invisible = TRUE;
}
else
{
if (sMoveRelearnerStruct->categoryIconSpriteId == 0xFF)
sMoveRelearnerStruct->categoryIconSpriteId = CreateSprite(&gSpriteTemplate_CategoryIcons, 66, 40, 0);
gSprites[sMoveRelearnerStruct->categoryIconSpriteId].invisible = FALSE;
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->categoryIconSpriteId], GetBattleMoveCategory(moveId));
}
}