added move description window

This commit is contained in:
cawtds 2024-07-24 20:34:30 +02:00
parent b2d370ef10
commit c48d2b698e
10 changed files with 136 additions and 15 deletions

View File

@ -139,5 +139,6 @@ void HideTriggerSprites(void);
void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle);
void DestroyAbilityPopUp(u8 battlerId);
void UpdateAbilityPopup(u8 battlerId);
void CategoryIcons_LoadSpritesGfx(void);
#endif // GUARD_BATTLE_INTERFACE_H

View File

@ -482,6 +482,7 @@
#define B_WIN_VS_OUTCOME_LEFT 22
#define B_WIN_VS_OUTCOME_RIGHT 23
#define B_WIN_OAK_OLD_MAN 24
#define B_WIN_MOVE_DESCRIPTION 25
#define B_TEXT_FLAG_NPC_CONTEXT_FONT (1 << 6)
#define B_TEXT_FLAG_WINDOW_CLEAR (1 << 7)

View File

@ -3,6 +3,11 @@
#include "main.h"
extern const u8 gNotDoneYetDescription[];
extern const struct CompressedSpriteSheet gSpriteSheet_CategoryIcons;
extern const struct SpritePalette gSpritePal_CategoryIcons;
extern const struct SpriteTemplate gSpriteTemplate_CategoryIcons;
void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16);
u8 GetMoveSlotToReplace(void);
void SummaryScreen_SetUnknownTaskId(u8 a0);

View File

@ -220,12 +220,14 @@ extern const u8 gText_WhatWillPlayerThrow[];
// battle_controller_player
extern const u8 gText_BattleSwitchWhich[];
extern const u8 gText_BattleSwitchWhich5[];
extern const u8 gText_MoveInterfaceDynamicColors[];
extern const u8 gText_MoveInterfacePP[];
extern const u8 gText_MoveInterfaceType[];
extern const u8 gText_LinkStandby[];
extern const u8 gText_BattleMenu[];
extern const u8 gText_WhatWillPkmnDo[];
extern const u8 gText_NewLine[];
// battle_controller_oak_old_man
extern const u8 gText_ForPetesSake[];

View File

@ -358,6 +358,15 @@ static const struct WindowTemplate sStandardBattleWindowTemplates[] = {
.paletteNum = 7,
.baseBlock = 0x090
},
[B_WIN_MOVE_DESCRIPTION] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 47,
.width = 18,
.height = 6,
.paletteNum = 5,
.baseBlock = 0x0350,
},
DUMMY_WIN_TEMPLATE
};

View File

@ -6,6 +6,7 @@
#include "item_menu.h"
#include "link.h"
#include "m4a.h"
#include "new_menu_helpers.h"
#include "party_menu.h"
#include "pokeball.h"
#include "strings.h"
@ -20,10 +21,12 @@
#include "battle_script_commands.h"
#include "battle_z_move.h"
#include "battle_gimmick.h"
#include "pokemon_summary_screen.h"
#include "recorded_battle.h"
#include "reshow_battle_screen.h"
#include "test_runner.h"
#include "constants/battle_anim.h"
#include "constants/battle_move_effects.h"
#include "constants/battle_partner.h"
#include "constants/items.h"
#include "constants/moves.h"
@ -68,6 +71,7 @@ static void MoveSelectionDisplayPpNumber(u32 battler);
static void MoveSelectionDisplayPpString(void);
static void MoveSelectionDisplayMoveType(u32 battler);
static void MoveSelectionDisplayMoveNames(u32 battler);
static void MoveSelectionDisplayMoveDescription(u32 battler);
static void HandleMoveSwitching(u32 battler);
static void WaitForMonSelection(u32 battler);
static void CompleteWhenChoseItem(u32 battler);
@ -657,8 +661,8 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
@ -673,8 +677,8 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
@ -688,8 +692,8 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
@ -704,12 +708,12 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
else if (JOY_NEW(SELECT_BUTTON) && !gBattleStruct->zmove.viewing)
else if (JOY_NEW(SELECT_BUTTON) && !gBattleStruct->zmove.viewing && !gBattleStruct->descriptionSubmenu)
{
if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK))
{
@ -725,6 +729,30 @@ void HandleInputChooseMove(u32 battler)
gBattlerControllerFuncs[battler] = HandleMoveSwitching;
}
}
else if (gBattleStruct->descriptionSubmenu)
{
if (JOY_NEW(B_MOVE_DESCRIPTION_BUTTON) || JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{
gBattleStruct->descriptionSubmenu = FALSE;
if (gCategoryIconSpriteId != 0xFF)
{
DestroySprite(&gSprites[gCategoryIconSpriteId]);
gCategoryIconSpriteId = 0xFF;
}
FillWindowPixelBuffer(B_WIN_MOVE_DESCRIPTION, PIXEL_FILL(0));
ClearStdWindowAndFrame(B_WIN_MOVE_DESCRIPTION, FALSE);
CopyWindowToVram(B_WIN_MOVE_DESCRIPTION, COPYWIN_GFX);
PlaySE(SE_SELECT);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
}
}
else if (JOY_NEW(B_MOVE_DESCRIPTION_BUTTON) && B_MOVE_DESCRIPTION_BUTTON != B_LAST_USED_BALL_BUTTON)
{
gBattleStruct->descriptionSubmenu = TRUE;
MoveSelectionDisplayMoveDescription(battler);
}
else if (JOY_NEW(START_BUTTON))
{
if (gBattleStruct->gimmick.usableGimmick[battler] != GIMMICK_NONE)
@ -1556,6 +1584,54 @@ static void MoveSelectionDisplayMoveType(u32 battler)
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE);
}
static void MoveSelectionDisplayMoveDescription(u32 battler)
{
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleResources->bufferA[battler][4]);
u16 move = moveInfo->moves[gMoveSelectionCursor[battler]];
u16 pwr = gMovesInfo[move].power;
u16 acc = gMovesInfo[move].accuracy;
u8 cat = gMovesInfo[move].category;
u8 pwr_num[3], acc_num[3];
u8 cat_desc[7] = _("CAT: ");
u8 pwr_desc[7] = _("PWR: ");
u8 acc_desc[7] = _("ACC: ");
u8 cat_start[] = _("{CLEAR_TO 0x03}");
u8 pwr_start[] = _("{CLEAR_TO 0x38}");
u8 acc_start[] = _("{CLEAR_TO 0x6D}");
LoadStdWindowFrameGfx();
DrawStdWindowFrame(B_WIN_MOVE_DESCRIPTION, FALSE);
if (pwr < 2)
StringCopy(pwr_num, gText_BattleSwitchWhich5);
else
ConvertIntToDecimalStringN(pwr_num, pwr, STR_CONV_MODE_LEFT_ALIGN, 3);
if (acc < 2)
StringCopy(acc_num, gText_BattleSwitchWhich5);
else
ConvertIntToDecimalStringN(acc_num, acc, STR_CONV_MODE_LEFT_ALIGN, 3);
StringCopy(gDisplayedStringBattle, cat_start);
StringAppend(gDisplayedStringBattle, cat_desc);
StringAppend(gDisplayedStringBattle, pwr_start);
StringAppend(gDisplayedStringBattle, pwr_desc);
StringAppend(gDisplayedStringBattle, pwr_num);
StringAppend(gDisplayedStringBattle, acc_start);
StringAppend(gDisplayedStringBattle, acc_desc);
StringAppend(gDisplayedStringBattle, acc_num);
StringAppend(gDisplayedStringBattle, gText_NewLine);
if (gMovesInfo[move].effect == EFFECT_PLACEHOLDER)
StringAppend(gDisplayedStringBattle, gNotDoneYetDescription);
else
StringAppend(gDisplayedStringBattle, gMovesInfo[move].description);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_DESCRIPTION);
if (gCategoryIconSpriteId == 0xFF)
gCategoryIconSpriteId = CreateSprite(&gSpriteTemplate_CategoryIcons, 38, 64, 1);
StartSpriteAnim(&gSprites[gCategoryIconSpriteId], cat);
CopyWindowToVram(B_WIN_MOVE_DESCRIPTION, COPYWIN_FULL);
}
void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1)
{
u16 src[2];

View File

@ -487,6 +487,7 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]);
LoadIndicatorSpritesGfx();
CategoryIcons_LoadSpritesGfx();
}
else if (!IsDoubleBattle())
{

View File

@ -2618,3 +2618,9 @@ static void Task_FreeAbilityPopUpGfx(u8 taskId)
DestroyTask(taskId);
}
}
void CategoryIcons_LoadSpritesGfx(void)
{
LoadCompressedSpriteSheet(&gSpriteSheet_CategoryIcons);
LoadSpritePalette(&gSpritePal_CategoryIcons);
}

View File

@ -3767,7 +3767,19 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = {
.fgColor = 2,
.bgColor = 1,
.shadowColor = 3,
}
},
[B_WIN_MOVE_DESCRIPTION] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
},
};
static const u8 sNpcTextColorToFont[] =

View File

@ -36,6 +36,7 @@
#include "battle_interface.h"
#include "mon_markings.h"
#include "pokemon_storage_system.h"
#include "constants/battle_move_effects.h"
#include "constants/sound.h"
// needs conflicting header to match (curIndex is s8 in the function, but has to be defined as u8 here)
@ -3158,11 +3159,18 @@ static void PokeSum_PrintSelectedMoveStats(void)
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
sMonSummaryScreen->summary.moveAccuracyStrBufs[sMoveSelectionCursorPos]);
AddTextPrinterParameterized4(sMonSummaryScreen->windowIds[POKESUM_WIN_TRAINER_MEMO], FONT_NORMAL,
7, 42,
0, 0,
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
gMovesInfo[sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]].description);
if (gMovesInfo[sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]].effect != EFFECT_PLACEHOLDER)
AddTextPrinterParameterized4(sMonSummaryScreen->windowIds[POKESUM_WIN_TRAINER_MEMO], FONT_NORMAL,
7, 42,
0, 0,
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
gMovesInfo[sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]].description);
else
AddTextPrinterParameterized4(sMonSummaryScreen->windowIds[POKESUM_WIN_TRAINER_MEMO], FONT_NORMAL,
7, 42,
0, 0,
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
gNotDoneYetDescription);
if (B_SHOW_CATEGORY_ICON == TRUE)
ShowCategoryIcon(GetBattleMoveCategory(sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]));