2017-10-09 19:32:57 +02:00
# include "global.h"
2018-08-15 06:56:11 +02:00
# include "main.h"
2017-09-20 21:07:24 +02:00
# include "battle.h"
2018-08-15 06:56:11 +02:00
# include "battle_anim.h"
2018-10-30 22:17:03 +01:00
# include "frontier_util.h"
2018-08-15 06:56:11 +02:00
# include "battle_message.h"
# include "battle_tent.h"
2018-12-24 00:02:29 +01:00
# include "battle_factory.h"
2017-10-09 19:17:13 +02:00
# include "bg.h"
2018-08-15 06:56:11 +02:00
# include "contest.h"
# include "contest_effect.h"
2019-04-04 23:53:06 +02:00
# include "data.h"
2018-08-15 06:56:11 +02:00
# include "daycare.h"
2017-09-20 21:07:24 +02:00
# include "decompress.h"
2018-08-15 06:56:11 +02:00
# include "dynamic_placeholder_text_util.h"
# include "event_data.h"
# include "gpu_regs.h"
# include "graphics.h"
# include "international_string_util.h"
2017-10-19 01:25:08 +02:00
# include "item.h"
# include "link.h"
2017-09-20 21:07:24 +02:00
# include "m4a.h"
2019-09-09 03:07:54 +02:00
# include "malloc.h"
2018-08-15 06:56:11 +02:00
# include "menu.h"
# include "menu_helpers.h"
# include "mon_markings.h"
# include "party_menu.h"
2017-09-20 21:07:24 +02:00
# include "palette.h"
2018-08-15 06:56:11 +02:00
# include "pokeball.h"
2017-09-20 21:07:24 +02:00
# include "pokemon.h"
2018-08-15 06:56:11 +02:00
# include "pokemon_storage_system.h"
2018-08-15 10:44:20 +02:00
# include "pokemon_summary_screen.h"
2018-08-15 06:56:11 +02:00
# include "region_map.h"
# include "scanline_effect.h"
2017-09-20 21:07:24 +02:00
# include "sound.h"
# include "sprite.h"
# include "string_util.h"
2018-08-15 06:56:11 +02:00
# include "strings.h"
2017-09-20 21:07:24 +02:00
# include "task.h"
2017-10-19 01:25:08 +02:00
# include "text.h"
2018-08-15 06:56:11 +02:00
# include "tv.h"
2017-09-20 21:07:24 +02:00
# include "window.h"
2018-08-15 06:56:11 +02:00
# include "constants/items.h"
# include "constants/moves.h"
2019-10-18 01:22:03 +02:00
# include "constants/party_menu.h"
2018-08-15 10:44:20 +02:00
# include "constants/region_map_sections.h"
2019-02-04 13:44:09 +01:00
# include "constants/rgb.h"
2018-08-15 06:56:11 +02:00
# include "constants/songs.h"
2017-10-19 01:25:08 +02:00
2019-03-03 22:50:51 +01:00
// Screen titles (upper left)
# define PSS_LABEL_WINDOW_POKEMON_INFO_TITLE 0
# define PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE 1
# define PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE 2
# define PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE 3
// Button control text (upper right)
# define PSS_LABEL_WINDOW_PROMPT_CANCEL 4
# define PSS_LABEL_WINDOW_PROMPT_INFO 5
# define PSS_LABEL_WINDOW_PROMPT_SWITCH 6
# define PSS_LABEL_WINDOW_UNUSED1 7
// Info screen
# define PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL 8
# define PSS_LABEL_WINDOW_POKEMON_INFO_TYPE 9
// Skills screen
# define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT 10 // HP, Attack, Defense
# define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT 11 // Sp. Attack, Sp. Defense, Speed
# define PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP 12 // EXP, Next Level
# define PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS 13
// Moves screen
# define PSS_LABEL_WINDOW_MOVES_POWER_ACC 14 // Also contains the power and accuracy values
# define PSS_LABEL_WINDOW_MOVES_APPEAL_JAM 15
# define PSS_LABEL_WINDOW_UNUSED2 16
// Above/below the pokemon's portrait (left)
# define PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER 17
# define PSS_LABEL_WINDOW_PORTRAIT_NICKNAME 18 // The upper name
# define PSS_LABEL_WINDOW_PORTRAIT_SPECIES 19 // The lower name
# define PSS_LABEL_WINDOW_END 20
// Dynamic fields for the Pokemon Info page
# define PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER 0
# define PSS_DATA_WINDOW_INFO_ID 1
# define PSS_DATA_WINDOW_INFO_ABILITY 2
# define PSS_DATA_WINDOW_INFO_MEMO 3
// Dynamic fields for the Pokemon Skills page
# define PSS_DATA_WINDOW_SKILLS_HELD_ITEM 0
# define PSS_DATA_WINDOW_SKILLS_RIBBON_COUNT 1
# define PSS_DATA_WINDOW_SKILLS_STATS_LEFT 2 // HP, Attack, Defense
# define PSS_DATA_WINDOW_SKILLS_STATS_RIGHT 3 // Sp. Attack, Sp. Defense, Speed
# define PSS_DATA_WINDOW_EXP 4 // Exp, next level
// Dynamic fields for the Battle Moves and Contest Moves pages.
# define PSS_DATA_WINDOW_MOVE_NAMES 0
# define PSS_DATA_WINDOW_MOVE_PP 1
# define PSS_DATA_WINDOW_MOVE_DESCRIPTION 2
2020-05-18 14:03:01 +02:00
# define MOVE_SELECTOR_SPRITES_COUNT 10
// for the spriteIds field in PokemonSummaryScreenData
enum
{
SPRITE_ARR_ID_MON ,
SPRITE_ARR_ID_BALL ,
SPRITE_ARR_ID_STATUS ,
SPRITE_ARR_ID_TYPE , // 2 for mon types, 5 for move types(4 moves and 1 to learn), used interchangeably, because mon types and move types aren't shown on the same screen
SPRITE_ARR_ID_MOVE_SELECTOR1 = SPRITE_ARR_ID_TYPE + 5 , // 10 sprites that make up the selector
SPRITE_ARR_ID_MOVE_SELECTOR2 = SPRITE_ARR_ID_MOVE_SELECTOR1 + MOVE_SELECTOR_SPRITES_COUNT ,
SPRITE_ARR_ID_COUNT = SPRITE_ARR_ID_MOVE_SELECTOR2 + MOVE_SELECTOR_SPRITES_COUNT
} ;
2019-03-03 22:50:51 +01:00
static EWRAM_DATA struct PokemonSummaryScreenData
2018-08-15 06:56:11 +02:00
{
2018-08-15 07:05:48 +02:00
/*0x00*/ union {
2018-08-15 06:56:11 +02:00
struct Pokemon * mons ;
struct BoxPokemon * boxMons ;
} monList ;
2018-08-15 07:05:48 +02:00
/*0x04*/ MainCallback callback ;
/*0x08*/ struct Sprite * markingsSprite ;
2017-10-20 22:28:38 +02:00
/*0x0C*/ struct Pokemon currentMon ;
2018-08-15 06:56:11 +02:00
/*0x70*/ struct PokeSummary
{
u16 species ; // 0x0
u16 species2 ; // 0x2
u8 isEgg ; // 0x4
u8 level ; // 0x5
2018-08-15 10:44:20 +02:00
u8 ribbonCount ; // 0x6
2019-03-03 22:50:51 +01:00
u8 ailment ; // 0x7
2019-05-14 15:22:16 +02:00
u8 abilityNum ; // 0x8
2018-08-15 06:56:11 +02:00
u8 metLocation ; // 0x9
u8 metLevel ; // 0xA
u8 metGame ; // 0xB
u32 pid ; // 0xC
u32 exp ; // 0x10
2019-09-08 17:53:48 +02:00
u16 moves [ MAX_MON_MOVES ] ; // 0x14
u8 pp [ MAX_MON_MOVES ] ; // 0x1C
2018-08-15 06:56:11 +02:00
u16 currentHP ; // 0x20
u16 maxHP ; // 0x22
u16 atk ; // 0x24
u16 def ; // 0x26
u16 spatk ; // 0x28
u16 spdef ; // 0x2A
u16 speed ; // 0x2C
u16 item ; // 0x2E
u16 friendship ; // 0x30
u8 OTGender ; // 0x32
u8 nature ; // 0x33
u8 ppBonuses ; // 0x34
u8 sanity ; // 0x35
2020-05-18 14:03:01 +02:00
u8 OTName [ 17 ] ; // 0x36
2018-08-15 06:56:11 +02:00
u32 OTID ; // 0x48
} summary ;
2020-05-18 14:03:01 +02:00
u16 bgTilemapBuffers [ PSS_PAGE_COUNT ] [ 2 ] [ 0x400 ] ;
2018-08-15 06:56:11 +02:00
u8 mode ;
bool8 isBoxMon ;
u8 curMonIndex ;
u8 maxMonIndex ;
2018-08-15 10:44:20 +02:00
u8 currPageIndex ;
u8 minPageIndex ;
u8 maxPageIndex ;
2019-02-19 10:09:42 +01:00
bool8 lockMonFlag ; // This is used to prevent the player from changing pokemon in the move deleter select, etc, but it is not needed because the input is handled differently there
2018-08-15 06:56:11 +02:00
u16 newMove ;
u8 firstMoveIndex ;
u8 secondMoveIndex ;
2020-05-18 14:03:01 +02:00
bool8 lockMovesFlag ; // This is used to prevent the player from changing position of moves in a battle or when trading.
2019-02-19 10:09:42 +01:00
u8 bgDisplayOrder ; // Determines the order page backgrounds are loaded while scrolling between them
2018-08-15 06:56:11 +02:00
u8 filler40CA ;
u8 windowIds [ 8 ] ;
2020-05-18 14:03:01 +02:00
u8 spriteIds [ SPRITE_ARR_ID_COUNT ] ;
2018-08-15 06:56:11 +02:00
bool8 unk40EF ;
2019-02-19 10:09:42 +01:00
s16 switchCounter ; // Used for various switch statement cases that decompress/load graphics or pokemon data
2017-09-20 21:07:24 +02:00
u8 unk_filler4 [ 6 ] ;
2019-03-08 09:12:08 +01:00
} * sMonSummaryScreen = NULL ;
2019-02-19 10:09:42 +01:00
EWRAM_DATA u8 gLastViewedMonIndex = 0 ;
2019-10-18 01:22:03 +02:00
static EWRAM_DATA u8 sMoveSlotToReplace = 0 ;
2019-02-24 03:55:24 +01:00
ALIGNED ( 4 ) static EWRAM_DATA u8 sUnknownTaskId = 0 ;
2018-08-15 06:56:11 +02:00
// forward declarations
2020-05-18 14:03:01 +02:00
static bool8 LoadGraphics ( void ) ;
static void CB2_InitSummaryScreen ( void ) ;
2018-08-15 10:44:20 +02:00
static void InitBGs ( void ) ;
2020-05-18 14:03:01 +02:00
static bool8 DecompressGraphics ( void ) ;
2018-08-16 00:58:41 +02:00
static void CopyMonToSummaryStruct ( struct Pokemon * a ) ;
static bool8 ExtractMonDataToSummaryStruct ( struct Pokemon * a ) ;
2020-05-18 14:03:01 +02:00
static void SetDefaultTilemaps ( void ) ;
2019-02-04 13:44:09 +01:00
static void CloseSummaryScreen ( u8 taskId ) ;
2020-05-18 14:03:01 +02:00
static void Task_HandleInput ( u8 taskId ) ;
2019-03-03 22:50:51 +01:00
static void ChangeSummaryPokemon ( u8 taskId , s8 a ) ;
2020-05-18 14:03:01 +02:00
static void Task_ChangeSummaryMon ( u8 taskId ) ;
static s8 AdvanceMonIndex ( s8 delta ) ;
static s8 AdvanceMultiBattleMonIndex ( s8 delta ) ;
static bool8 IsValidToViewInMulti ( struct Pokemon * mon ) ;
2019-02-04 13:44:09 +01:00
static void ChangePage ( u8 taskId , s8 a ) ;
2019-02-19 10:09:42 +01:00
static void PssScrollRight ( u8 taskId ) ;
static void PssScrollRightEnd ( u8 taskId ) ;
static void PssScrollLeft ( u8 taskId ) ;
static void PssScrollLeftEnd ( u8 taskId ) ;
2020-05-18 14:03:01 +02:00
static void TryDrawExperienceProgressBar ( void ) ;
static void SwitchToMoveSelection ( u8 taskId ) ;
static void Task_HandleInput_MoveSelect ( u8 taskId ) ;
static bool8 HasMoreThanOneMove ( void ) ;
static void ChangeSelectedMove ( s16 * taskData , s8 direction , u8 * moveIndexPtr ) ;
static void CloseMoveSelectMode ( u8 taskId ) ;
static void SwitchToMovePositionSwitchMode ( u8 a ) ;
static void Task_HandleInput_MovePositionSwitch ( u8 taskId ) ;
static void ExitMovePositionSwitchMode ( u8 taskId , bool8 swapMoves ) ;
2018-08-16 00:58:41 +02:00
static void SwapMonMoves ( struct Pokemon * mon , u8 moveIndex1 , u8 moveIndex2 ) ;
static void SwapBoxMonMoves ( struct BoxPokemon * mon , u8 moveIndex1 , u8 moveIndex2 ) ;
2020-05-18 14:03:01 +02:00
static void Task_SetHandleReplaceMoveInput ( u8 taskId ) ;
static void Task_HandleReplaceMoveInput ( u8 taskId ) ;
2019-02-19 10:09:42 +01:00
static bool8 CanReplaceMove ( void ) ;
2020-05-18 14:03:01 +02:00
static void ShowCantForgetHMsWindow ( u8 taskId ) ;
static void Task_HandleInputCantForgetHMsMoves ( u8 taskId ) ;
2019-02-19 10:09:42 +01:00
static void DrawPagination ( void ) ;
2020-05-18 14:03:01 +02:00
static void HandlePowerAccTilemap ( u16 a , s16 b ) ;
static void Task_ShowPowerAccWindow ( u8 taskId ) ;
static void HandleAppealJamTilemap ( u16 a , s16 b , u16 c ) ;
static void Task_ShowAppealJamWindow ( u8 taskId ) ;
static void HandleStatusTilemap ( u16 a , s16 b ) ;
static void Task_ShowStatusWindow ( u8 taskId ) ;
static void TilemapFiveMovesDisplay ( u16 * dst , u16 palette , bool8 remove ) ;
2019-02-19 10:09:42 +01:00
static void DrawPokerusCuredSymbol ( struct Pokemon * mon ) ;
2018-09-02 14:47:12 +02:00
static void DrawExperienceProgressBar ( struct Pokemon * mon ) ;
2019-02-02 23:14:04 +01:00
static void DrawContestMoveHearts ( u16 move ) ;
2019-02-19 10:09:42 +01:00
static void LimitEggSummaryPageDisplay ( void ) ;
2019-02-04 13:44:09 +01:00
static void ResetWindows ( void ) ;
2019-09-26 02:49:56 +02:00
static void PrintMonInfo ( void ) ;
static void PrintNotEggInfo ( void ) ;
static void PrintEggInfo ( void ) ;
static void PrintGenderSymbol ( struct Pokemon * mon , u16 a ) ;
2020-05-18 14:03:01 +02:00
static void PrintPageNamesAndStats ( void ) ;
static void PutPageWindowTilemaps ( u8 a ) ;
2019-02-04 13:44:09 +01:00
static void ClearPageWindowTilemaps ( u8 a ) ;
2020-05-18 14:03:01 +02:00
static void RemoveWindowByIndex ( u8 a ) ;
2019-02-04 12:38:44 +01:00
static void PrintPageSpecificText ( u8 a ) ;
static void CreateTextPrinterTask ( u8 a ) ;
static void PrintInfoPageText ( void ) ;
2019-02-04 13:44:09 +01:00
static void Task_PrintInfoPage ( u8 taskId ) ;
2018-08-16 00:58:41 +02:00
static void PrintMonOTName ( void ) ;
static void PrintMonOTID ( void ) ;
static void PrintMonAbilityName ( void ) ;
static void PrintMonAbilityDescription ( void ) ;
static void BufferMonTrainerMemo ( void ) ;
static void PrintMonTrainerMemo ( void ) ;
static void BufferNatureString ( void ) ;
static void GetMetLevelString ( u8 * a ) ;
static bool8 DoesMonOTMatchOwner ( void ) ;
static bool8 DidMonComeFromGBAGames ( void ) ;
static bool8 IsInGamePartnerMon ( void ) ;
static void PrintEggOTName ( void ) ;
static void PrintEggOTID ( void ) ;
static void PrintEggState ( void ) ;
static void PrintEggMemo ( void ) ;
2019-02-04 13:44:09 +01:00
static void Task_PrintSkillsPage ( u8 taskId ) ;
2018-08-16 00:58:41 +02:00
static void PrintHeldItemName ( void ) ;
2019-02-04 12:38:44 +01:00
static void PrintSkillsPageText ( void ) ;
2018-08-16 00:58:41 +02:00
static void PrintRibbonCount ( void ) ;
static void BufferLeftColumnStats ( void ) ;
static void PrintLeftColumnStats ( void ) ;
static void BufferRightColumnStats ( void ) ;
static void PrintRightColumnStats ( void ) ;
static void PrintExpPointsNextLevel ( void ) ;
2019-02-04 12:38:44 +01:00
static void PrintBattleMoves ( void ) ;
2019-02-04 13:44:09 +01:00
static void Task_PrintBattleMoves ( u8 taskId ) ;
2018-08-16 00:58:41 +02:00
static void PrintMoveNameAndPP ( u8 a ) ;
2019-02-04 12:38:44 +01:00
static void PrintContestMoves ( void ) ;
2019-02-04 13:44:09 +01:00
static void Task_PrintContestMoves ( u8 taskId ) ;
2018-08-16 00:58:41 +02:00
static void PrintContestMoveDescription ( u8 a ) ;
static void PrintMoveDetails ( u16 a ) ;
static void PrintNewMoveDetailsOrCancelText ( void ) ;
2020-05-18 14:03:01 +02:00
static void AddAndFillMoveNamesWindow ( void ) ;
static void SwapMovesNamesPP ( u8 moveIndex1 , u8 moveIndex2 ) ;
2018-08-16 00:58:41 +02:00
static void PrintHMMovesCantBeForgotten ( void ) ;
2019-02-04 12:38:44 +01:00
static void ResetSpriteIds ( void ) ;
2019-02-02 23:14:04 +01:00
static void SetSpriteInvisibility ( u8 spriteArrayId , bool8 invisible ) ;
static void HidePageSpecificSprites ( void ) ;
static void SetTypeIcons ( void ) ;
static void CreateMoveTypeIcons ( void ) ;
static void SetMonTypeIcons ( void ) ;
static void SetMoveTypeIcons ( void ) ;
static void SetContestMoveTypeIcons ( void ) ;
static void SetNewMoveTypeIcon ( void ) ;
2020-05-18 14:03:01 +02:00
static void SwapMovesTypeSprites ( u8 moveIndex1 , u8 moveIndex2 ) ;
static u8 LoadMonGfxAndSprite ( struct Pokemon * a , s16 * b ) ;
static u8 CreateMonSprite ( struct Pokemon * unused ) ;
2019-02-04 15:35:49 +01:00
static void SpriteCB_Pokemon ( struct Sprite * ) ;
2019-02-19 10:09:42 +01:00
static void StopPokemonAnimations ( void ) ;
2018-08-16 00:58:41 +02:00
static void CreateMonMarkingsSprite ( struct Pokemon * mon ) ;
static void RemoveAndCreateMonMarkingsSprite ( struct Pokemon * mon ) ;
static void CreateCaughtBallSprite ( struct Pokemon * mon ) ;
static void CreateSetStatusSprite ( void ) ;
2020-05-18 14:03:01 +02:00
static void CreateMoveSelectorSprites ( u8 idArrayStart ) ;
static void SpriteCb_MoveSelector ( struct Sprite * sprite ) ;
static void DestroyMoveSelectorSprites ( u8 firstArrayId ) ;
static void SetMainMoveSelectorColor ( u8 whichColor ) ;
2020-05-25 10:19:18 +02:00
static void KeepMoveSelectorVisible ( u8 firstSpriteId ) ;
2017-09-20 21:07:24 +02:00
2018-08-12 00:03:19 +02:00
// const rom data
# include "data/text/move_descriptions.h"
2018-08-15 06:56:11 +02:00
# include "data/text/nature_names.h"
2020-05-18 14:03:01 +02:00
static const struct BgTemplate sBgTemplates [ ] =
2018-08-15 06:56:11 +02:00
{
{
. bg = 0 ,
. charBaseIndex = 0 ,
. mapBaseIndex = 31 ,
. screenSize = 0 ,
. paletteMode = 0 ,
. priority = 0 ,
. baseTile = 0 ,
} ,
{
. bg = 1 ,
. charBaseIndex = 2 ,
. mapBaseIndex = 27 ,
. screenSize = 1 ,
. paletteMode = 0 ,
. priority = 1 ,
. baseTile = 0 ,
} ,
{
. bg = 2 ,
. charBaseIndex = 2 ,
. mapBaseIndex = 25 ,
. screenSize = 1 ,
. paletteMode = 0 ,
. priority = 2 ,
. baseTile = 0 ,
} ,
{
. bg = 3 ,
. charBaseIndex = 2 ,
. mapBaseIndex = 29 ,
. screenSize = 1 ,
. paletteMode = 0 ,
. priority = 3 ,
. baseTile = 0 ,
} ,
} ;
2020-05-18 14:03:01 +02:00
struct TilemapCtrl
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
const u16 * gfx ;
u16 field_4 ;
u8 field_6 ;
u8 field_7 ;
u8 field_8 ;
u8 field_9 ;
} ;
static const u16 sStatusTilemap [ ] = INCBIN_U16 ( " graphics/interface/status_tilemap.bin " ) ;
static const struct TilemapCtrl sStatusTilemapCtrl1 =
{
sStatusTilemap , 1 , 10 , 2 , 0 , 18
2018-08-15 06:56:11 +02:00
} ;
2020-05-18 14:03:01 +02:00
static const struct TilemapCtrl sStatusTilemapCtrl2 =
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
sStatusTilemap , 1 , 10 , 2 , 0 , 50
2018-08-15 06:56:11 +02:00
} ;
2020-05-18 14:03:01 +02:00
static const struct TilemapCtrl sBattleMoveTilemapCtrl =
2018-08-15 06:56:11 +02:00
{
gSummaryScreenPowAcc_Tilemap , 0 , 10 , 7 , 0 , 45
} ;
2020-05-18 14:03:01 +02:00
static const struct TilemapCtrl sContestMoveTilemapCtrl =
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
gSummaryScreenAppealJam_Tilemap , 0 , 10 , 7 , 0 , 45
2018-08-15 06:56:11 +02:00
} ;
2020-05-18 14:03:01 +02:00
static const s8 sMultiBattleOrder [ ] = { 0 , 2 , 3 , 1 , 4 , 5 } ;
2019-02-19 10:09:42 +01:00
static const struct WindowTemplate sSummaryTemplate [ ] =
2018-08-15 06:56:11 +02:00
{
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_INFO_TITLE ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 0 ,
. tilemapTop = 0 ,
. width = 11 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 1 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 0 ,
. tilemapTop = 0 ,
. width = 11 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 23 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 0 ,
. tilemapTop = 0 ,
. width = 11 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 45 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 0 ,
. tilemapTop = 0 ,
. width = 11 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 67 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_PROMPT_CANCEL ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 22 ,
. tilemapTop = 0 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 7 ,
. baseBlock = 89 ,
2018-09-02 15:49:29 +02:00
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_PROMPT_INFO ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 22 ,
. tilemapTop = 0 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 7 ,
. baseBlock = 105 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_PROMPT_SWITCH ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 22 ,
. tilemapTop = 0 ,
. width = 8 ,
. height = 2 ,
. paletteNum = 7 ,
. baseBlock = 121 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_UNUSED1 ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 11 ,
. tilemapTop = 4 ,
. width = 0 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 137 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 11 ,
. tilemapTop = 4 ,
. width = 18 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 137 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_INFO_TYPE ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 11 ,
. tilemapTop = 6 ,
. width = 18 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 173 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 10 ,
. tilemapTop = 7 ,
. width = 6 ,
. height = 6 ,
. paletteNum = 6 ,
. baseBlock = 209 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 22 ,
. tilemapTop = 7 ,
. width = 5 ,
. height = 6 ,
. paletteNum = 6 ,
. baseBlock = 245 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 10 ,
. tilemapTop = 14 ,
. width = 11 ,
. height = 4 ,
. paletteNum = 6 ,
. baseBlock = 275 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 0 ,
. tilemapTop = 18 ,
. width = 6 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 319 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_MOVES_POWER_ACC ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 1 ,
. tilemapTop = 15 ,
. width = 9 ,
. height = 4 ,
. paletteNum = 6 ,
. baseBlock = 331 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_MOVES_APPEAL_JAM ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 1 ,
. tilemapTop = 15 ,
. width = 5 ,
. height = 4 ,
. paletteNum = 6 ,
. baseBlock = 367 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_UNUSED2 ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 22 ,
. tilemapTop = 4 ,
. width = 0 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 387 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 1 ,
. tilemapTop = 2 ,
. width = 4 ,
. height = 2 ,
. paletteNum = 7 ,
. baseBlock = 387 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_PORTRAIT_NICKNAME ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 1 ,
. tilemapTop = 12 ,
. width = 9 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 395 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_PORTRAIT_SPECIES ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 1 ,
. tilemapTop = 14 ,
. width = 9 ,
. height = 4 ,
. paletteNum = 6 ,
. baseBlock = 413 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_LABEL_WINDOW_END ] = DUMMY_WIN_TEMPLATE
2018-08-15 06:56:11 +02:00
} ;
2019-02-19 10:09:42 +01:00
static const struct WindowTemplate sPageInfoTemplate [ ] =
2018-08-15 06:56:11 +02:00
{
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 11 ,
. tilemapTop = 4 ,
. width = 11 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 449 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_INFO_ID ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 22 ,
. tilemapTop = 4 ,
. width = 7 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 471 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_INFO_ABILITY ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 11 ,
. tilemapTop = 9 ,
. width = 18 ,
. height = 4 ,
. paletteNum = 6 ,
. baseBlock = 485 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_INFO_MEMO ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 11 ,
. tilemapTop = 14 ,
. width = 18 ,
. height = 6 ,
. paletteNum = 6 ,
. baseBlock = 557 ,
} ,
2018-08-15 06:56:11 +02:00
} ;
2019-02-19 10:09:42 +01:00
static const struct WindowTemplate sPageSkillsTemplate [ ] =
2018-08-15 06:56:11 +02:00
{
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_SKILLS_HELD_ITEM ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 10 ,
. tilemapTop = 4 ,
. width = 10 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 449 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_SKILLS_RIBBON_COUNT ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 20 ,
. tilemapTop = 4 ,
. width = 10 ,
. height = 2 ,
. paletteNum = 6 ,
. baseBlock = 469 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_SKILLS_STATS_LEFT ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 16 ,
. tilemapTop = 7 ,
. width = 6 ,
. height = 6 ,
. paletteNum = 6 ,
. baseBlock = 489 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_SKILLS_STATS_RIGHT ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 27 ,
. tilemapTop = 7 ,
. width = 3 ,
. height = 6 ,
. paletteNum = 6 ,
. baseBlock = 525 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_EXP ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 24 ,
. tilemapTop = 14 ,
. width = 6 ,
. height = 4 ,
. paletteNum = 6 ,
. baseBlock = 543 ,
} ,
2018-08-15 06:56:11 +02:00
} ;
2019-02-19 10:09:42 +01:00
static const struct WindowTemplate sPageMovesTemplate [ ] = // This is used for both battle and contest moves
2018-08-15 06:56:11 +02:00
{
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_MOVE_NAMES ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 15 ,
. tilemapTop = 4 ,
. width = 9 ,
. height = 10 ,
. paletteNum = 6 ,
. baseBlock = 449 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_MOVE_PP ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 24 ,
. tilemapTop = 4 ,
. width = 6 ,
. height = 10 ,
. paletteNum = 8 ,
. baseBlock = 539 ,
} ,
2019-03-03 22:50:51 +01:00
[ PSS_DATA_WINDOW_MOVE_DESCRIPTION ] = {
2018-10-27 00:53:07 +02:00
. bg = 0 ,
2018-09-02 14:47:12 +02:00
. tilemapLeft = 10 ,
. tilemapTop = 15 ,
. width = 20 ,
. height = 4 ,
. paletteNum = 6 ,
. baseBlock = 599 ,
} ,
2018-08-15 06:56:11 +02:00
} ;
2020-05-18 14:03:01 +02:00
static const u8 sTextColors [ ] [ 3 ] =
2018-08-15 06:56:11 +02:00
{
{ 0 , 1 , 2 } ,
{ 0 , 3 , 4 } ,
{ 0 , 5 , 6 } ,
{ 0 , 7 , 8 } ,
{ 0 , 9 , 10 } ,
{ 0 , 11 , 12 } ,
{ 0 , 13 , 14 } ,
{ 0 , 7 , 8 } ,
{ 13 , 15 , 14 } ,
{ 0 , 1 , 2 } ,
{ 0 , 3 , 4 } ,
{ 0 , 5 , 6 } ,
{ 0 , 7 , 8 }
} ;
2019-02-04 12:38:44 +01:00
2019-02-19 10:09:42 +01:00
static const u8 sSummaryAButtonBitmap [ ] = INCBIN_U8 ( " graphics/interface/summary_a_button.4bpp " ) ;
static const u8 sSummaryBButtonBitmap [ ] = INCBIN_U8 ( " graphics/interface/summary_b_button.4bpp " ) ;
2019-02-04 12:38:44 +01:00
static void ( * const sTextPrinterFunctions [ ] ) ( void ) =
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
[ PSS_PAGE_INFO ] = PrintInfoPageText ,
[ PSS_PAGE_SKILLS ] = PrintSkillsPageText ,
[ PSS_PAGE_BATTLE_MOVES ] = PrintBattleMoves ,
[ PSS_PAGE_CONTEST_MOVES ] = PrintContestMoves
2018-08-15 06:56:11 +02:00
} ;
2019-02-04 12:38:44 +01:00
static void ( * const sTextPrinterTasks [ ] ) ( u8 taskId ) =
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
[ PSS_PAGE_INFO ] = Task_PrintInfoPage ,
[ PSS_PAGE_SKILLS ] = Task_PrintSkillsPage ,
[ PSS_PAGE_BATTLE_MOVES ] = Task_PrintBattleMoves ,
[ PSS_PAGE_CONTEST_MOVES ] = Task_PrintContestMoves
2018-08-15 06:56:11 +02:00
} ;
2019-02-04 12:38:44 +01:00
2019-02-19 10:09:42 +01:00
static const u8 sMemoNatureTextColor [ ] = _ ( " {COLOR LIGHT_RED}{SHADOW GREEN} " ) ;
static const u8 sMemoMiscTextColor [ ] = _ ( " {COLOR WHITE}{SHADOW DARK_GREY} " ) ; // This is also affected by palettes, apparently
2020-08-11 05:50:49 +02:00
static const u8 sStatsLeftColumnLayout [ ] = _ ( " {DYNAMIC 0}/{DYNAMIC 1} \n {DYNAMIC 2} \n {DYNAMIC 3} " ) ;
static const u8 sStatsRightColumnLayout [ ] = _ ( " {DYNAMIC 0} \n {DYNAMIC 1} \n {DYNAMIC 2} " ) ;
static const u8 sMovesPPLayout [ ] = _ ( " {PP}{DYNAMIC 0}/{DYNAMIC 1} " ) ;
2018-09-01 18:31:53 +02:00
2020-05-18 14:03:01 +02:00
# define TAG_MOVE_SELECTOR 30000
# define TAG_MON_STATUS 30001
2018-09-01 18:31:53 +02:00
# define TAG_MOVE_TYPES 30002
2020-05-18 14:03:01 +02:00
# define TAG_MON_MARKINGS 30003
2018-09-01 18:31:53 +02:00
static const struct OamData sOamData_MoveTypes =
2018-08-15 06:56:11 +02:00
{
. y = 0 ,
2019-12-04 21:25:13 +01:00
. affineMode = ST_OAM_AFFINE_OFF ,
. objMode = ST_OAM_OBJ_NORMAL ,
2018-08-15 06:56:11 +02:00
. mosaic = 0 ,
2019-12-04 21:25:13 +01:00
. bpp = ST_OAM_4BPP ,
2019-03-11 08:12:15 +01:00
. shape = SPRITE_SHAPE ( 32 x16 ) ,
2018-08-15 06:56:11 +02:00
. x = 0 ,
. matrixNum = 0 ,
2019-03-11 08:12:15 +01:00
. size = SPRITE_SIZE ( 32 x16 ) ,
2018-08-15 06:56:11 +02:00
. tileNum = 0 ,
. priority = 1 ,
. paletteNum = 0 ,
. affineParam = 0 ,
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeNormal [ ] = {
ANIMCMD_FRAME ( TYPE_NORMAL * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeFighting [ ] = {
ANIMCMD_FRAME ( TYPE_FIGHTING * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeFlying [ ] = {
ANIMCMD_FRAME ( TYPE_FLYING * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypePoison [ ] = {
ANIMCMD_FRAME ( TYPE_POISON * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeGround [ ] = {
ANIMCMD_FRAME ( TYPE_GROUND * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeRock [ ] = {
ANIMCMD_FRAME ( TYPE_ROCK * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeBug [ ] = {
ANIMCMD_FRAME ( TYPE_BUG * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeGhost [ ] = {
ANIMCMD_FRAME ( TYPE_GHOST * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeSteel [ ] = {
ANIMCMD_FRAME ( TYPE_STEEL * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeMystery [ ] = {
ANIMCMD_FRAME ( TYPE_MYSTERY * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeFire [ ] = {
ANIMCMD_FRAME ( TYPE_FIRE * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeWater [ ] = {
ANIMCMD_FRAME ( TYPE_WATER * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeGrass [ ] = {
ANIMCMD_FRAME ( TYPE_GRASS * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeElectric [ ] = {
ANIMCMD_FRAME ( TYPE_ELECTRIC * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypePsychic [ ] = {
ANIMCMD_FRAME ( TYPE_PSYCHIC * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeIce [ ] = {
ANIMCMD_FRAME ( TYPE_ICE * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeDragon [ ] = {
ANIMCMD_FRAME ( TYPE_DRAGON * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_TypeDark [ ] = {
ANIMCMD_FRAME ( TYPE_DARK * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_CategoryCool [ ] = {
ANIMCMD_FRAME ( ( CONTEST_CATEGORY_COOL + NUMBER_OF_MON_TYPES ) * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_CategoryBeauty [ ] = {
ANIMCMD_FRAME ( ( CONTEST_CATEGORY_BEAUTY + NUMBER_OF_MON_TYPES ) * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_CategoryCute [ ] = {
ANIMCMD_FRAME ( ( CONTEST_CATEGORY_CUTE + NUMBER_OF_MON_TYPES ) * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_CategorySmart [ ] = {
ANIMCMD_FRAME ( ( CONTEST_CATEGORY_SMART + NUMBER_OF_MON_TYPES ) * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd sSpriteAnim_CategoryTough [ ] = {
ANIMCMD_FRAME ( ( CONTEST_CATEGORY_TOUGH + NUMBER_OF_MON_TYPES ) * 8 , 0 , FALSE , FALSE ) ,
2018-08-15 06:56:11 +02:00
ANIMCMD_END
} ;
2018-09-01 18:31:53 +02:00
static const union AnimCmd * const sSpriteAnimTable_MoveTypes [ NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT ] = {
sSpriteAnim_TypeNormal ,
sSpriteAnim_TypeFighting ,
sSpriteAnim_TypeFlying ,
sSpriteAnim_TypePoison ,
sSpriteAnim_TypeGround ,
sSpriteAnim_TypeRock ,
sSpriteAnim_TypeBug ,
sSpriteAnim_TypeGhost ,
sSpriteAnim_TypeSteel ,
sSpriteAnim_TypeMystery ,
sSpriteAnim_TypeFire ,
sSpriteAnim_TypeWater ,
sSpriteAnim_TypeGrass ,
sSpriteAnim_TypeElectric ,
sSpriteAnim_TypePsychic ,
sSpriteAnim_TypeIce ,
sSpriteAnim_TypeDragon ,
sSpriteAnim_TypeDark ,
sSpriteAnim_CategoryCool ,
sSpriteAnim_CategoryBeauty ,
sSpriteAnim_CategoryCute ,
sSpriteAnim_CategorySmart ,
sSpriteAnim_CategoryTough ,
} ;
static const struct CompressedSpriteSheet sSpriteSheet_MoveTypes =
2018-08-15 06:56:11 +02:00
{
. data = gMoveTypes_Gfx ,
2018-09-01 18:31:53 +02:00
. size = ( NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT ) * 0x100 ,
. tag = TAG_MOVE_TYPES
2018-08-15 06:56:11 +02:00
} ;
2018-09-01 18:31:53 +02:00
static const struct SpriteTemplate sSpriteTemplate_MoveTypes =
2018-08-15 06:56:11 +02:00
{
2018-09-01 18:31:53 +02:00
. tileTag = TAG_MOVE_TYPES ,
. paletteTag = TAG_MOVE_TYPES ,
. oam = & sOamData_MoveTypes ,
. anims = sSpriteAnimTable_MoveTypes ,
2018-08-15 06:56:11 +02:00
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = SpriteCallbackDummy
} ;
2018-09-01 18:31:53 +02:00
static const u8 sMoveTypeToOamPaletteNum [ NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT ] =
{
[ TYPE_NORMAL ] = 13 ,
[ TYPE_FIGHTING ] = 13 ,
[ TYPE_FLYING ] = 14 ,
[ TYPE_POISON ] = 14 ,
[ TYPE_GROUND ] = 13 ,
[ TYPE_ROCK ] = 13 ,
[ TYPE_BUG ] = 15 ,
[ TYPE_GHOST ] = 14 ,
[ TYPE_STEEL ] = 13 ,
[ TYPE_MYSTERY ] = 15 ,
[ TYPE_FIRE ] = 13 ,
[ TYPE_WATER ] = 14 ,
[ TYPE_GRASS ] = 15 ,
[ TYPE_ELECTRIC ] = 13 ,
[ TYPE_PSYCHIC ] = 14 ,
[ TYPE_ICE ] = 14 ,
[ TYPE_DRAGON ] = 15 ,
[ TYPE_DARK ] = 13 ,
[ NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL ] = 13 ,
[ NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY ] = 14 ,
[ NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE ] = 14 ,
[ NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART ] = 15 ,
[ NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH ] = 13 ,
} ;
2020-05-18 14:03:01 +02:00
static const struct OamData sOamData_MoveSelector =
2018-08-15 06:56:11 +02:00
{
. y = 0 ,
2019-12-04 21:25:13 +01:00
. affineMode = ST_OAM_AFFINE_OFF ,
. objMode = ST_OAM_OBJ_NORMAL ,
2018-08-15 06:56:11 +02:00
. mosaic = 0 ,
2019-12-04 21:25:13 +01:00
. bpp = ST_OAM_4BPP ,
2019-03-11 08:12:15 +01:00
. shape = SPRITE_SHAPE ( 16 x16 ) ,
2018-08-15 06:56:11 +02:00
. x = 0 ,
. matrixNum = 0 ,
2019-03-11 08:12:15 +01:00
. size = SPRITE_SIZE ( 16 x16 ) ,
2018-08-15 06:56:11 +02:00
. tileNum = 0 ,
. priority = 1 ,
. paletteNum = 0 ,
. affineParam = 0 ,
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelector0 [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 0 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelector1 [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 4 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelector2 [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 8 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelector3 [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 12 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelectorLeft [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 16 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelectorRight [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 16 , 0 , TRUE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelectorMiddle [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 20 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelector7 [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 24 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelector8 [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 24 , 0 , TRUE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
static const union AnimCmd sSpriteAnim_MoveSelector9 [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 28 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2020-05-18 14:03:01 +02:00
// All except left, middle and right are unused
static const union AnimCmd * const sSpriteAnimTable_MoveSelector [ ] = {
sSpriteAnim_MoveSelector0 ,
sSpriteAnim_MoveSelector1 ,
sSpriteAnim_MoveSelector2 ,
sSpriteAnim_MoveSelector3 ,
sSpriteAnim_MoveSelectorLeft ,
sSpriteAnim_MoveSelectorRight ,
sSpriteAnim_MoveSelectorMiddle ,
sSpriteAnim_MoveSelector7 ,
sSpriteAnim_MoveSelector8 ,
sSpriteAnim_MoveSelector9 ,
2019-02-19 10:09:42 +01:00
} ;
static const struct CompressedSpriteSheet sMoveSelectorSpriteSheet =
{
2020-05-18 14:03:01 +02:00
. data = gSummaryMoveSelect_Gfx ,
2018-08-15 06:56:11 +02:00
. size = 0x400 ,
2020-05-18 14:03:01 +02:00
. tag = TAG_MOVE_SELECTOR
2018-08-15 06:56:11 +02:00
} ;
2020-05-18 14:03:01 +02:00
static const struct CompressedSpritePalette sMoveSelectorSpritePal =
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
. data = gSummaryMoveSelect_Pal ,
. tag = TAG_MOVE_SELECTOR
2018-08-15 06:56:11 +02:00
} ;
2020-05-18 14:03:01 +02:00
static const struct SpriteTemplate sMoveSelectorSpriteTemplate =
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
. tileTag = TAG_MOVE_SELECTOR ,
. paletteTag = TAG_MOVE_SELECTOR ,
. oam = & sOamData_MoveSelector ,
. anims = sSpriteAnimTable_MoveSelector ,
2018-08-15 06:56:11 +02:00
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = SpriteCallbackDummy
} ;
2018-09-02 14:47:12 +02:00
static const struct OamData sOamData_StatusCondition =
2018-08-15 06:56:11 +02:00
{
. y = 0 ,
2019-12-04 21:25:13 +01:00
. affineMode = ST_OAM_AFFINE_OFF ,
. objMode = ST_OAM_OBJ_NORMAL ,
2018-08-15 06:56:11 +02:00
. mosaic = 0 ,
2019-12-04 21:25:13 +01:00
. bpp = ST_OAM_4BPP ,
2019-03-11 08:12:15 +01:00
. shape = SPRITE_SHAPE ( 32 x8 ) ,
2018-08-15 06:56:11 +02:00
. x = 0 ,
. matrixNum = 0 ,
2019-03-11 08:12:15 +01:00
. size = SPRITE_SIZE ( 32 x8 ) ,
2018-08-15 06:56:11 +02:00
. tileNum = 0 ,
. priority = 3 ,
. paletteNum = 0 ,
. affineParam = 0 ,
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd sSpriteAnim_StatusPoison [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 0 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd sSpriteAnim_StatusParalyzed [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 4 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd sSpriteAnim_StatusSleep [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 8 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd sSpriteAnim_StatusFrozen [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 12 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd sSpriteAnim_StatusBurn [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 16 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd sSpriteAnim_StatusPokerus [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 20 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd sSpriteAnim_StatusFaint [ ] = {
2018-08-15 06:56:11 +02:00
ANIMCMD_FRAME ( 24 , 0 , FALSE , FALSE ) ,
ANIMCMD_END
} ;
2018-09-02 14:47:12 +02:00
static const union AnimCmd * const sSpriteAnimTable_StatusCondition [ ] = {
sSpriteAnim_StatusPoison ,
sSpriteAnim_StatusParalyzed ,
sSpriteAnim_StatusSleep ,
sSpriteAnim_StatusFrozen ,
sSpriteAnim_StatusBurn ,
sSpriteAnim_StatusPokerus ,
sSpriteAnim_StatusFaint ,
2018-08-15 06:56:11 +02:00
} ;
2019-02-02 23:14:04 +01:00
static const struct CompressedSpriteSheet sStatusIconsSpriteSheet =
2018-08-15 06:56:11 +02:00
{
. data = gStatusGfx_Icons ,
. size = 0x380 ,
2020-05-18 14:03:01 +02:00
. tag = TAG_MON_STATUS
2018-08-15 06:56:11 +02:00
} ;
2019-02-02 23:14:04 +01:00
static const struct CompressedSpritePalette sStatusIconsSpritePalette =
2018-08-15 06:56:11 +02:00
{
. data = gStatusPal_Icons ,
2020-05-18 14:03:01 +02:00
. tag = TAG_MON_STATUS
2018-08-15 06:56:11 +02:00
} ;
2018-09-02 14:47:12 +02:00
static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
. tileTag = TAG_MON_STATUS ,
. paletteTag = TAG_MON_STATUS ,
2018-09-02 14:47:12 +02:00
. oam = & sOamData_StatusCondition ,
. anims = sSpriteAnimTable_StatusCondition ,
2018-08-15 06:56:11 +02:00
. images = NULL ,
. affineAnims = gDummySpriteAffineAnimTable ,
. callback = SpriteCallbackDummy
} ;
2019-02-19 10:09:42 +01:00
static const u16 sSummaryMarkingsPalette [ ] = INCBIN_U16 ( " graphics/interface/summary_markings.gbapal " ) ;
2018-08-12 00:03:19 +02:00
// code
2018-08-15 10:44:20 +02:00
void ShowPokemonSummaryScreen ( u8 mode , void * mons , u8 monIndex , u8 maxMonIndex , void ( * callback ) ( void ) )
2018-08-15 06:56:11 +02:00
{
2019-03-08 09:12:08 +01:00
sMonSummaryScreen = AllocZeroed ( sizeof ( * sMonSummaryScreen ) ) ;
sMonSummaryScreen - > mode = mode ;
sMonSummaryScreen - > monList . mons = mons ;
sMonSummaryScreen - > curMonIndex = monIndex ;
sMonSummaryScreen - > maxMonIndex = maxMonIndex ;
sMonSummaryScreen - > callback = callback ;
2018-08-15 06:56:11 +02:00
2018-12-10 21:36:52 +01:00
if ( mode = = PSS_MODE_BOX )
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > isBoxMon = TRUE ;
2017-09-20 21:07:24 +02:00
else
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > isBoxMon = FALSE ;
2018-08-16 22:53:01 +02:00
2018-08-15 06:56:11 +02:00
switch ( mode )
2017-09-20 21:07:24 +02:00
{
2018-08-15 10:44:20 +02:00
case PSS_MODE_NORMAL :
2018-12-10 21:36:52 +01:00
case PSS_MODE_BOX :
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > minPageIndex = 0 ;
2020-05-18 14:03:01 +02:00
sMonSummaryScreen - > maxPageIndex = PSS_PAGE_COUNT - 1 ;
2017-10-03 21:42:28 +02:00
break ;
2020-05-18 14:03:01 +02:00
case PSS_MODE_LOCK_MOVES :
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > minPageIndex = 0 ;
2020-05-18 14:03:01 +02:00
sMonSummaryScreen - > maxPageIndex = PSS_PAGE_COUNT - 1 ;
sMonSummaryScreen - > lockMovesFlag = TRUE ;
2017-10-03 21:42:28 +02:00
break ;
2018-08-15 10:44:20 +02:00
case PSS_MODE_SELECT_MOVE :
2020-05-18 14:03:01 +02:00
sMonSummaryScreen - > minPageIndex = PSS_PAGE_BATTLE_MOVES ;
sMonSummaryScreen - > maxPageIndex = PSS_PAGE_COUNT - 1 ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > lockMonFlag = TRUE ;
2017-10-03 21:42:28 +02:00
break ;
2017-09-20 21:07:24 +02:00
}
2018-08-15 06:56:11 +02:00
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > currPageIndex = sMonSummaryScreen - > minPageIndex ;
2020-05-25 10:19:18 +02:00
SummaryScreen_SetUnknownTaskId ( 0xFF ) ;
2018-08-15 06:56:11 +02:00
2020-05-18 14:03:01 +02:00
if ( gMonSpritesGfxPtr = = NULL )
2017-09-20 21:07:24 +02:00
sub_806F2AC ( 0 , 0 ) ;
2018-08-16 22:53:01 +02:00
2020-05-18 14:03:01 +02:00
SetMainCallback2 ( CB2_InitSummaryScreen ) ;
2017-09-20 21:07:24 +02:00
}
2018-08-15 06:56:11 +02:00
void ShowSelectMovePokemonSummaryScreen ( struct Pokemon * mons , u8 monIndex , u8 maxMonIndex , void ( * callback ) ( void ) , u16 newMove )
2017-09-20 21:07:24 +02:00
{
2018-08-15 10:44:20 +02:00
ShowPokemonSummaryScreen ( PSS_MODE_SELECT_MOVE , mons , monIndex , maxMonIndex , callback ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > newMove = newMove ;
2017-09-20 21:07:24 +02:00
}
2018-08-15 10:44:20 +02:00
void ShowPokemonSummaryScreenSet40EF ( u8 mode , struct BoxPokemon * mons , u8 monIndex , u8 maxMonIndex , void ( * callback ) ( void ) )
2017-09-20 21:07:24 +02:00
{
2018-08-15 10:44:20 +02:00
ShowPokemonSummaryScreen ( mode , mons , monIndex , maxMonIndex , callback ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > unk40EF = TRUE ;
2017-09-20 21:07:24 +02:00
}
2020-05-18 14:03:01 +02:00
static void MainCB2 ( void )
2017-09-20 21:07:24 +02:00
{
RunTasks ( ) ;
AnimateSprites ( ) ;
BuildOamBuffer ( ) ;
2020-06-20 01:58:56 +02:00
DoScheduledBgTilemapCopiesToVram ( ) ;
2017-09-20 21:07:24 +02:00
UpdatePaletteFade ( ) ;
}
2020-05-18 14:03:01 +02:00
static void VBlank ( void )
2017-09-20 21:07:24 +02:00
{
LoadOam ( ) ;
ProcessSpriteCopyRequests ( ) ;
TransferPlttBuffer ( ) ;
}
2020-05-18 14:03:01 +02:00
static void CB2_InitSummaryScreen ( void )
2017-09-20 21:07:24 +02:00
{
2020-05-14 10:37:09 +02:00
while ( MenuHelpers_CallLinkSomething ( ) ! = TRUE & & LoadGraphics ( ) ! = TRUE & & MenuHelpers_LinkSomething ( ) ! = TRUE ) ;
2017-09-20 21:07:24 +02:00
}
2020-05-18 14:03:01 +02:00
static bool8 LoadGraphics ( void )
2017-09-20 21:07:24 +02:00
{
2017-10-03 21:42:28 +02:00
switch ( gMain . state )
{
case 0 :
SetVBlankHBlankCallbacksToNull ( ) ;
2017-12-09 21:23:40 +01:00
ResetVramOamAndBgCntRegs ( ) ;
2020-06-20 01:58:56 +02:00
ClearScheduledBgCopiesToVram ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 1 :
2018-01-16 18:59:06 +01:00
ScanlineEffect_Stop ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 2 :
ResetPaletteFade ( ) ;
gPaletteFade . bufferTransferDisabled = 1 ;
gMain . state + + ;
break ;
case 3 :
ResetSpriteData ( ) ;
gMain . state + + ;
break ;
case 4 :
FreeAllSpritePalettes ( ) ;
gMain . state + + ;
break ;
case 5 :
2018-08-15 10:44:20 +02:00
InitBGs ( ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter = 0 ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 6 :
2020-05-18 14:03:01 +02:00
if ( DecompressGraphics ( ) ! = FALSE )
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 7 :
2019-02-04 13:44:09 +01:00
ResetWindows ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 8 :
2019-02-19 10:09:42 +01:00
DrawPagination ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 9 :
2019-03-08 09:12:08 +01:00
CopyMonToSummaryStruct ( & sMonSummaryScreen - > currentMon ) ;
sMonSummaryScreen - > switchCounter = 0 ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 10 :
2019-03-08 09:12:08 +01:00
if ( ExtractMonDataToSummaryStruct ( & sMonSummaryScreen - > currentMon ) ! = 0 )
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 11 :
2019-09-26 02:49:56 +02:00
PrintMonInfo ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 12 :
2020-05-18 14:03:01 +02:00
PrintPageNamesAndStats ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 13 :
2019-03-08 09:12:08 +01:00
PrintPageSpecificText ( sMonSummaryScreen - > currPageIndex ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 14 :
2020-05-18 14:03:01 +02:00
SetDefaultTilemaps ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 15 :
2020-05-18 14:03:01 +02:00
PutPageWindowTilemaps ( sMonSummaryScreen - > currPageIndex ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 16 :
2019-02-04 12:38:44 +01:00
ResetSpriteIds ( ) ;
2019-02-02 23:14:04 +01:00
CreateMoveTypeIcons ( ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter = 0 ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 17 :
2020-05-18 14:03:01 +02:00
sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] = LoadMonGfxAndSprite ( & sMonSummaryScreen - > currentMon , & sMonSummaryScreen - > switchCounter ) ;
if ( sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ! = 0xFF )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter = 0 ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
2017-09-20 21:07:24 +02:00
}
2017-10-03 21:42:28 +02:00
break ;
case 18 :
2019-03-08 09:12:08 +01:00
CreateMonMarkingsSprite ( & sMonSummaryScreen - > currentMon ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 19 :
2019-03-08 09:12:08 +01:00
CreateCaughtBallSprite ( & sMonSummaryScreen - > currentMon ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 20 :
2018-08-15 20:47:10 +02:00
CreateSetStatusSprite ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 21 :
2019-02-02 23:14:04 +01:00
SetTypeIcons ( ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 22 :
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > mode ! = PSS_MODE_SELECT_MOVE )
2020-05-18 14:03:01 +02:00
CreateTask ( Task_HandleInput , 0 ) ;
2017-10-03 21:42:28 +02:00
else
2020-05-18 14:03:01 +02:00
CreateTask ( Task_SetHandleReplaceMoveInput , 0 ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 23 :
2020-05-18 14:03:01 +02:00
BlendPalettes ( 0xFFFFFFFF , 16 , 0 ) ;
2017-10-03 21:42:28 +02:00
gMain . state + + ;
break ;
case 24 :
2019-02-04 13:44:09 +01:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 16 , 0 , RGB_BLACK ) ;
2017-10-03 21:42:28 +02:00
gPaletteFade . bufferTransferDisabled = 0 ;
gMain . state + + ;
break ;
default :
2020-05-18 14:03:01 +02:00
SetVBlankCallback ( VBlank ) ;
SetMainCallback2 ( MainCB2 ) ;
2017-10-03 21:42:28 +02:00
return TRUE ;
}
return FALSE ;
2017-09-20 21:07:24 +02:00
}
2018-08-15 10:44:20 +02:00
static void InitBGs ( void )
2017-09-20 21:07:24 +02:00
{
ResetBgsAndClearDma3BusyFlags ( 0 ) ;
2020-05-18 14:03:01 +02:00
InitBgsFromTemplates ( 0 , sBgTemplates , ARRAY_COUNT ( sBgTemplates ) ) ;
2019-03-08 09:12:08 +01:00
SetBgTilemapBuffer ( 1 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 0 ] ) ;
SetBgTilemapBuffer ( 2 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_SKILLS ] [ 0 ] ) ;
SetBgTilemapBuffer ( 3 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] ) ;
2017-12-09 21:23:40 +01:00
ResetAllBgsCoordinates ( ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
ScheduleBgCopyTilemapToVram ( 2 ) ;
ScheduleBgCopyTilemapToVram ( 3 ) ;
2020-05-18 14:03:01 +02:00
SetGpuReg ( REG_OFFSET_DISPCNT , DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP ) ;
2017-10-20 22:18:29 +02:00
SetGpuReg ( REG_OFFSET_BLDCNT , 0 ) ;
2017-09-20 21:07:24 +02:00
ShowBg ( 0 ) ;
ShowBg ( 1 ) ;
ShowBg ( 2 ) ;
ShowBg ( 3 ) ;
}
2020-05-18 14:03:01 +02:00
static bool8 DecompressGraphics ( void )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
switch ( sMonSummaryScreen - > switchCounter )
2017-09-20 21:07:24 +02:00
{
2017-10-03 21:42:28 +02:00
case 0 :
2020-05-14 10:37:09 +02:00
ResetTempTileDataBuffers ( ) ;
DecompressAndCopyTileDataToVram ( 1 , & gStatusScreenBitmap , 0 , 0 , 0 ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 1 :
2020-05-14 10:37:09 +02:00
if ( FreeTempTileDataBuffersIfPossible ( ) ! = 1 )
2017-10-03 21:42:28 +02:00
{
2019-03-08 09:12:08 +01:00
LZDecompressWram ( gPageInfoTilemap , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] ) ;
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
}
break ;
case 2 :
2019-03-08 09:12:08 +01:00
LZDecompressWram ( gUnknown_08D98CC8 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 1 ] ) ;
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 3 :
2019-03-08 09:12:08 +01:00
LZDecompressWram ( gPageSkillsTilemap , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_SKILLS ] [ 1 ] ) ;
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 4 :
2019-03-08 09:12:08 +01:00
LZDecompressWram ( gPageBattleMovesTilemap , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 1 ] ) ;
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 5 :
2019-03-08 09:12:08 +01:00
LZDecompressWram ( gPageContestMovesTilemap , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 1 ] ) ;
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 6 :
2019-02-19 10:09:42 +01:00
LoadCompressedPalette ( gStatusScreenPalette , 0 , 0x100 ) ;
2017-10-03 21:42:28 +02:00
LoadPalette ( & gUnknown_08D85620 , 0x81 , 0x1E ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 7 :
2018-12-17 23:00:08 +01:00
LoadCompressedSpriteSheet ( & sSpriteSheet_MoveTypes ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 8 :
2019-02-19 10:09:42 +01:00
LoadCompressedSpriteSheet ( & sMoveSelectorSpriteSheet ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 9 :
2019-02-02 23:14:04 +01:00
LoadCompressedSpriteSheet ( & sStatusIconsSpriteSheet ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 10 :
2019-02-02 23:14:04 +01:00
LoadCompressedSpritePalette ( & sStatusIconsSpritePalette ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 11 :
2020-05-18 14:03:01 +02:00
LoadCompressedSpritePalette ( & sMoveSelectorSpritePal ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
break ;
case 12 :
2018-12-19 03:15:59 +01:00
LoadCompressedPalette ( gMoveTypes_Pal , 0x1D0 , 0x60 ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter = 0 ;
2018-08-15 06:56:11 +02:00
return TRUE ;
2017-09-20 21:07:24 +02:00
}
2018-08-15 06:56:11 +02:00
return FALSE ;
2017-09-20 21:07:24 +02:00
}
2018-08-16 00:58:41 +02:00
static void CopyMonToSummaryStruct ( struct Pokemon * mon )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
if ( ! sMonSummaryScreen - > isBoxMon )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
struct Pokemon * partyMon = sMonSummaryScreen - > monList . mons ;
* mon = partyMon [ sMonSummaryScreen - > curMonIndex ] ;
2017-09-20 21:07:24 +02:00
}
else
2017-09-22 21:17:59 +02:00
{
2019-03-08 09:12:08 +01:00
struct BoxPokemon * boxMon = sMonSummaryScreen - > monList . boxMons ;
BoxMonToMon ( & boxMon [ sMonSummaryScreen - > curMonIndex ] , mon ) ;
2017-09-22 21:17:59 +02:00
}
2017-09-20 21:07:24 +02:00
}
2019-03-03 22:50:51 +01:00
static bool8 ExtractMonDataToSummaryStruct ( struct Pokemon * mon )
2017-09-20 21:07:24 +02:00
{
u32 i ;
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2019-03-03 22:50:51 +01:00
// Spread the data extraction over multiple frames.
2019-03-08 09:12:08 +01:00
switch ( sMonSummaryScreen - > switchCounter )
2017-09-20 21:07:24 +02:00
{
2017-10-03 21:42:28 +02:00
case 0 :
2019-03-03 22:50:51 +01:00
sum - > species = GetMonData ( mon , MON_DATA_SPECIES ) ;
sum - > species2 = GetMonData ( mon , MON_DATA_SPECIES2 ) ;
sum - > exp = GetMonData ( mon , MON_DATA_EXP ) ;
sum - > level = GetMonData ( mon , MON_DATA_LEVEL ) ;
2019-05-14 15:22:16 +02:00
sum - > abilityNum = GetMonData ( mon , MON_DATA_ABILITY_NUM ) ;
2019-03-03 22:50:51 +01:00
sum - > item = GetMonData ( mon , MON_DATA_HELD_ITEM ) ;
sum - > pid = GetMonData ( mon , MON_DATA_PERSONALITY ) ;
sum - > sanity = GetMonData ( mon , MON_DATA_SANITY_IS_BAD_EGG ) ;
2018-08-15 10:44:20 +02:00
if ( sum - > sanity )
sum - > isEgg = TRUE ;
2017-10-03 21:42:28 +02:00
else
2019-03-03 22:50:51 +01:00
sum - > isEgg = GetMonData ( mon , MON_DATA_IS_EGG ) ;
2018-08-16 22:53:01 +02:00
2017-10-03 21:42:28 +02:00
break ;
case 1 :
2018-12-25 18:50:15 +01:00
for ( i = 0 ; i < MAX_MON_MOVES ; i + + )
2017-10-03 21:42:28 +02:00
{
2019-03-03 22:50:51 +01:00
sum - > moves [ i ] = GetMonData ( mon , MON_DATA_MOVE1 + i ) ;
sum - > pp [ i ] = GetMonData ( mon , MON_DATA_PP1 + i ) ;
2017-10-03 21:42:28 +02:00
}
2019-03-03 22:50:51 +01:00
sum - > ppBonuses = GetMonData ( mon , MON_DATA_PP_BONUSES ) ;
2017-10-03 21:42:28 +02:00
break ;
case 2 :
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > monList . mons = = gPlayerParty | | sMonSummaryScreen - > mode = = PSS_MODE_BOX | | sMonSummaryScreen - > unk40EF = = TRUE )
2017-10-03 21:42:28 +02:00
{
2019-03-03 22:50:51 +01:00
sum - > nature = GetNature ( mon ) ;
sum - > currentHP = GetMonData ( mon , MON_DATA_HP ) ;
sum - > maxHP = GetMonData ( mon , MON_DATA_MAX_HP ) ;
sum - > atk = GetMonData ( mon , MON_DATA_ATK ) ;
sum - > def = GetMonData ( mon , MON_DATA_DEF ) ;
sum - > spatk = GetMonData ( mon , MON_DATA_SPATK ) ;
sum - > spdef = GetMonData ( mon , MON_DATA_SPDEF ) ;
sum - > speed = GetMonData ( mon , MON_DATA_SPEED ) ;
2017-10-03 21:42:28 +02:00
}
else
{
2019-03-03 22:50:51 +01:00
sum - > nature = GetNature ( mon ) ;
sum - > currentHP = GetMonData ( mon , MON_DATA_HP ) ;
sum - > maxHP = GetMonData ( mon , MON_DATA_MAX_HP ) ;
sum - > atk = GetMonData ( mon , MON_DATA_ATK2 ) ;
sum - > def = GetMonData ( mon , MON_DATA_DEF2 ) ;
sum - > spatk = GetMonData ( mon , MON_DATA_SPATK2 ) ;
sum - > spdef = GetMonData ( mon , MON_DATA_SPDEF2 ) ;
sum - > speed = GetMonData ( mon , MON_DATA_SPEED2 ) ;
2017-10-03 21:42:28 +02:00
}
break ;
case 3 :
2019-03-03 22:58:54 +01:00
GetMonData ( mon , MON_DATA_OT_NAME , sum - > OTName ) ;
2020-05-18 14:03:01 +02:00
ConvertInternationalString ( sum - > OTName , GetMonData ( mon , MON_DATA_LANGUAGE ) ) ;
2019-03-04 04:27:57 +01:00
sum - > ailment = GetMonAilment ( mon ) ;
2019-03-03 22:50:51 +01:00
sum - > OTGender = GetMonData ( mon , MON_DATA_OT_GENDER ) ;
sum - > OTID = GetMonData ( mon , MON_DATA_OT_ID ) ;
sum - > metLocation = GetMonData ( mon , MON_DATA_MET_LOCATION ) ;
sum - > metLevel = GetMonData ( mon , MON_DATA_MET_LEVEL ) ;
sum - > metGame = GetMonData ( mon , MON_DATA_MET_GAME ) ;
sum - > friendship = GetMonData ( mon , MON_DATA_FRIENDSHIP ) ;
2017-10-03 21:42:28 +02:00
break ;
default :
2019-03-03 22:50:51 +01:00
sum - > ribbonCount = GetMonData ( mon , MON_DATA_RIBBON_COUNT ) ;
2017-10-03 21:42:28 +02:00
return TRUE ;
2017-09-20 21:07:24 +02:00
}
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > switchCounter + + ;
2017-10-03 21:42:28 +02:00
return FALSE ;
2017-09-20 21:07:24 +02:00
}
2020-05-18 14:03:01 +02:00
static void SetDefaultTilemaps ( void )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_BATTLE_MOVES & & sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_CONTEST_MOVES )
2017-09-20 21:07:24 +02:00
{
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 0 , 0xFF ) ;
HandleAppealJamTilemap ( 0 , 0xFF , 0 ) ;
2017-09-20 21:07:24 +02:00
}
else
{
2019-03-08 09:12:08 +01:00
DrawContestMoveHearts ( sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ) ;
2020-05-18 14:03:01 +02:00
TilemapFiveMovesDisplay ( sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 0 ] , 3 , FALSE ) ;
TilemapFiveMovesDisplay ( sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 0 ] , 1 , FALSE ) ;
2019-03-08 09:12:08 +01:00
SetBgTilemapBuffer ( 1 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 0 ] ) ;
SetBgTilemapBuffer ( 2 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 0 ] ) ;
2017-09-20 21:07:24 +02:00
ChangeBgX ( 2 , 0x10000 , 1 ) ;
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2017-09-20 21:07:24 +02:00
}
2020-05-18 14:03:01 +02:00
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . ailment = = AILMENT_NONE )
2020-05-18 14:03:01 +02:00
HandleStatusTilemap ( 0 , 0xFF ) ;
else if ( sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_BATTLE_MOVES & & sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_CONTEST_MOVES )
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2019-02-19 10:09:42 +01:00
LimitEggSummaryPageDisplay ( ) ;
2019-03-08 09:12:08 +01:00
DrawPokerusCuredSymbol ( & sMonSummaryScreen - > currentMon ) ;
2017-09-20 21:07:24 +02:00
}
2019-08-08 07:21:07 +02:00
static void FreeSummaryScreen ( void )
2017-09-20 21:07:24 +02:00
{
FreeAllWindowBuffers ( ) ;
2019-03-08 09:12:08 +01:00
Free ( sMonSummaryScreen ) ;
2017-09-20 21:07:24 +02:00
}
2019-02-04 13:44:09 +01:00
static void BeginCloseSummaryScreen ( u8 taskId )
2017-09-20 21:07:24 +02:00
{
2019-02-04 13:44:09 +01:00
BeginNormalPaletteFade ( 0xFFFFFFFF , 0 , 0 , 16 , RGB_BLACK ) ;
gTasks [ taskId ] . func = CloseSummaryScreen ;
2017-09-20 21:07:24 +02:00
}
2019-02-04 13:44:09 +01:00
static void CloseSummaryScreen ( u8 taskId )
2017-09-20 21:07:24 +02:00
{
2020-05-14 10:37:09 +02:00
if ( MenuHelpers_CallLinkSomething ( ) ! = TRUE & & ! gPaletteFade . active )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
SetMainCallback2 ( sMonSummaryScreen - > callback ) ;
gLastViewedMonIndex = sMonSummaryScreen - > curMonIndex ;
2018-08-15 20:47:10 +02:00
SummaryScreen_DestroyUnknownTask ( ) ;
2017-09-20 21:07:24 +02:00
ResetSpriteData ( ) ;
FreeAllSpritePalettes ( ) ;
StopCryAndClearCrySongs ( ) ;
2018-01-10 04:30:54 +01:00
m4aMPlayVolumeControl ( & gMPlayInfo_BGM , 0xFFFF , 0x100 ) ;
2020-05-18 14:03:01 +02:00
if ( gMonSpritesGfxPtr = = NULL )
2017-09-20 21:07:24 +02:00
sub_806F47C ( 0 ) ;
2019-08-08 07:21:07 +02:00
FreeSummaryScreen ( ) ;
2017-09-20 21:07:24 +02:00
DestroyTask ( taskId ) ;
}
}
2020-05-18 14:03:01 +02:00
static void Task_HandleInput ( u8 taskId )
2017-09-20 21:07:24 +02:00
{
2020-05-14 10:37:09 +02:00
if ( MenuHelpers_CallLinkSomething ( ) ! = TRUE & & ! gPaletteFade . active )
2017-09-20 21:07:24 +02:00
{
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
if ( gMain . newKeys & DPAD_UP )
2017-10-03 21:42:28 +02:00
{
2019-03-04 06:25:07 +01:00
ChangeSummaryPokemon ( taskId , - 1 ) ;
2017-10-03 21:42:28 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_DOWN )
2017-09-20 21:07:24 +02:00
{
2019-03-04 06:25:07 +01:00
ChangeSummaryPokemon ( taskId , 1 ) ;
2017-09-20 21:07:24 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( ( gMain . newKeys & DPAD_LEFT ) | | GetLRKeysPressed ( ) = = MENU_L_PRESSED )
2017-10-03 21:42:28 +02:00
{
2019-03-04 06:25:07 +01:00
ChangePage ( taskId , - 1 ) ;
2017-10-03 21:42:28 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( ( gMain . newKeys & DPAD_RIGHT ) | | GetLRKeysPressed ( ) = = MENU_R_PRESSED )
2017-10-03 21:42:28 +02:00
{
2019-03-04 06:25:07 +01:00
ChangePage ( taskId , 1 ) ;
2017-10-03 21:42:28 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & A_BUTTON )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_SKILLS )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex = = PSS_PAGE_INFO )
2017-09-20 21:07:24 +02:00
{
2019-02-19 10:09:42 +01:00
StopPokemonAnimations ( ) ;
2017-10-03 21:42:28 +02:00
PlaySE ( SE_SELECT ) ;
2019-02-04 13:44:09 +01:00
BeginCloseSummaryScreen ( taskId ) ;
2017-09-20 21:07:24 +02:00
}
2020-05-18 14:03:01 +02:00
else // Contest or Battle Moves
2017-09-20 21:07:24 +02:00
{
2017-10-03 21:42:28 +02:00
PlaySE ( SE_SELECT ) ;
2020-05-18 14:03:01 +02:00
SwitchToMoveSelection ( taskId ) ;
2017-09-20 21:07:24 +02:00
}
}
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & B_BUTTON )
2017-09-20 21:07:24 +02:00
{
2019-02-19 10:09:42 +01:00
StopPokemonAnimations ( ) ;
2017-10-03 21:42:28 +02:00
PlaySE ( SE_SELECT ) ;
2019-02-04 13:44:09 +01:00
BeginCloseSummaryScreen ( taskId ) ;
2017-09-20 21:07:24 +02:00
}
}
}
2019-03-03 22:50:51 +01:00
static void ChangeSummaryPokemon ( u8 taskId , s8 delta )
2017-09-20 21:07:24 +02:00
{
2020-05-18 14:03:01 +02:00
s8 monId ;
2017-09-22 21:17:59 +02:00
2019-03-08 09:12:08 +01:00
if ( ! sMonSummaryScreen - > lockMonFlag )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > isBoxMon = = TRUE )
2017-09-20 21:07:24 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_INFO )
2017-09-20 21:07:24 +02:00
{
2019-03-04 06:25:07 +01:00
if ( delta = = 1 )
2019-03-03 22:50:51 +01:00
delta = 0 ;
2017-09-22 21:17:59 +02:00
else
2019-03-03 22:50:51 +01:00
delta = 2 ;
2017-09-20 21:07:24 +02:00
}
else
2017-09-22 21:17:59 +02:00
{
2019-03-04 06:25:07 +01:00
if ( delta = = 1 )
2019-03-03 22:50:51 +01:00
delta = 1 ;
2017-09-22 21:17:59 +02:00
else
2019-03-03 22:50:51 +01:00
delta = 3 ;
2017-09-22 21:17:59 +02:00
}
2020-05-18 14:03:01 +02:00
monId = sub_80D214C ( sMonSummaryScreen - > monList . boxMons , sMonSummaryScreen - > curMonIndex , sMonSummaryScreen - > maxMonIndex , delta ) ;
2017-09-20 21:07:24 +02:00
}
2018-12-20 01:55:51 +01:00
else if ( IsMultiBattle ( ) = = TRUE )
2017-09-20 21:07:24 +02:00
{
2020-05-18 14:03:01 +02:00
monId = AdvanceMultiBattleMonIndex ( delta ) ;
2017-09-20 21:07:24 +02:00
}
else
2017-09-22 21:17:59 +02:00
{
2020-05-18 14:03:01 +02:00
monId = AdvanceMonIndex ( delta ) ;
2017-09-22 21:17:59 +02:00
}
2020-05-18 14:03:01 +02:00
if ( monId ! = - 1 )
2017-09-20 21:07:24 +02:00
{
2017-09-22 21:17:59 +02:00
PlaySE ( SE_SELECT ) ;
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . ailment ! = AILMENT_NONE )
2017-09-20 21:07:24 +02:00
{
2020-05-18 14:03:01 +02:00
SetSpriteInvisibility ( SPRITE_ARR_ID_STATUS , TRUE ) ;
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2020-05-18 14:03:01 +02:00
HandleStatusTilemap ( 0 , 2 ) ;
2017-09-20 21:07:24 +02:00
}
2020-05-18 14:03:01 +02:00
sMonSummaryScreen - > curMonIndex = monId ;
2017-09-20 21:07:24 +02:00
gTasks [ taskId ] . data [ 0 ] = 0 ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_ChangeSummaryMon ;
2017-09-20 21:07:24 +02:00
}
}
2017-09-21 03:25:48 +02:00
}
2020-05-18 14:03:01 +02:00
static void Task_ChangeSummaryMon ( u8 taskId )
2017-09-21 03:25:48 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2017-09-23 00:28:18 +02:00
2017-09-21 03:25:48 +02:00
switch ( data [ 0 ] )
{
2017-09-23 00:28:18 +02:00
case 0 :
StopCryAndClearCrySongs ( ) ;
break ;
case 1 :
2018-08-15 20:47:10 +02:00
SummaryScreen_DestroyUnknownTask ( ) ;
2020-05-18 14:03:01 +02:00
DestroySpriteAndFreeResources ( & gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ] ) ;
2017-09-23 00:28:18 +02:00
break ;
case 2 :
2020-05-18 14:03:01 +02:00
DestroySpriteAndFreeResources ( & gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_BALL ] ] ) ;
2017-09-23 00:28:18 +02:00
break ;
case 3 :
2019-03-08 09:12:08 +01:00
CopyMonToSummaryStruct ( & sMonSummaryScreen - > currentMon ) ;
sMonSummaryScreen - > switchCounter = 0 ;
2017-09-23 00:28:18 +02:00
break ;
case 4 :
2019-03-08 09:12:08 +01:00
if ( ExtractMonDataToSummaryStruct ( & sMonSummaryScreen - > currentMon ) = = FALSE )
2017-09-23 00:28:18 +02:00
return ;
break ;
case 5 :
2019-03-08 09:12:08 +01:00
RemoveAndCreateMonMarkingsSprite ( & sMonSummaryScreen - > currentMon ) ;
2017-09-23 00:28:18 +02:00
break ;
case 6 :
2019-03-08 09:12:08 +01:00
CreateCaughtBallSprite ( & sMonSummaryScreen - > currentMon ) ;
2017-09-23 00:28:18 +02:00
break ;
case 7 :
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . ailment ! = AILMENT_NONE )
2020-05-18 14:03:01 +02:00
HandleStatusTilemap ( 10 , - 2 ) ;
2019-03-08 09:12:08 +01:00
DrawPokerusCuredSymbol ( & sMonSummaryScreen - > currentMon ) ;
2017-09-23 00:28:18 +02:00
data [ 1 ] = 0 ;
break ;
case 8 :
2020-05-18 14:03:01 +02:00
sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] = LoadMonGfxAndSprite ( & sMonSummaryScreen - > currentMon , & data [ 1 ] ) ;
if ( sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] = = 0xFF )
2017-09-23 00:28:18 +02:00
return ;
2020-05-18 14:03:01 +02:00
gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ] . data [ 2 ] = 1 ;
TryDrawExperienceProgressBar ( ) ;
2017-09-23 00:28:18 +02:00
data [ 1 ] = 0 ;
break ;
case 9 :
2019-02-02 23:14:04 +01:00
SetTypeIcons ( ) ;
2017-09-23 00:28:18 +02:00
break ;
case 10 :
2019-09-26 02:49:56 +02:00
PrintMonInfo ( ) ;
2017-09-23 00:28:18 +02:00
break ;
case 11 :
2019-03-08 09:12:08 +01:00
PrintPageSpecificText ( sMonSummaryScreen - > currPageIndex ) ;
2019-02-19 10:09:42 +01:00
LimitEggSummaryPageDisplay ( ) ;
2017-09-23 00:28:18 +02:00
break ;
case 12 :
2020-05-18 14:03:01 +02:00
gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ] . data [ 2 ] = 0 ;
2017-09-23 00:28:18 +02:00
break ;
default :
2020-05-14 10:37:09 +02:00
if ( MenuHelpers_CallLinkSomething ( ) = = 0 & & FuncIsActiveTask ( Task_ShowStatusWindow ) = = 0 )
2017-09-23 00:28:18 +02:00
{
data [ 0 ] = 0 ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleInput ;
2017-09-23 00:28:18 +02:00
}
return ;
2017-09-21 03:25:48 +02:00
}
2017-09-23 00:28:18 +02:00
data [ 0 ] + + ;
2017-09-22 21:17:59 +02:00
}
2020-05-18 14:03:01 +02:00
static s8 AdvanceMonIndex ( s8 delta )
2017-09-22 21:17:59 +02:00
{
2019-03-08 09:12:08 +01:00
struct Pokemon * mon = sMonSummaryScreen - > monList . mons ;
2017-09-24 02:23:55 +02:00
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex = = PSS_PAGE_INFO )
2017-09-22 21:17:59 +02:00
{
2020-05-18 14:03:01 +02:00
if ( delta = = - 1 & & sMonSummaryScreen - > curMonIndex = = 0 )
2018-12-05 15:31:01 +01:00
return - 1 ;
2020-05-18 14:03:01 +02:00
else if ( delta = = 1 & & sMonSummaryScreen - > curMonIndex > = sMonSummaryScreen - > maxMonIndex )
2018-12-05 15:31:01 +01:00
return - 1 ;
2018-08-15 20:47:10 +02:00
else
2020-05-18 14:03:01 +02:00
return sMonSummaryScreen - > curMonIndex + delta ;
2017-09-22 21:17:59 +02:00
}
else
{
2019-03-08 09:12:08 +01:00
s8 index = sMonSummaryScreen - > curMonIndex ;
2017-09-24 02:23:55 +02:00
do
2017-09-22 21:17:59 +02:00
{
2020-05-18 14:03:01 +02:00
index + = delta ;
2019-03-08 09:12:08 +01:00
if ( index < 0 | | index > sMonSummaryScreen - > maxMonIndex )
2018-12-05 15:31:01 +01:00
return - 1 ;
2020-05-18 14:03:01 +02:00
} while ( GetMonData ( & mon [ index ] , MON_DATA_IS_EGG ) ) ;
2017-09-24 02:23:55 +02:00
return index ;
2017-09-22 21:17:59 +02:00
}
}
2020-05-18 14:03:01 +02:00
static s8 AdvanceMultiBattleMonIndex ( s8 delta )
2017-09-22 21:17:59 +02:00
{
2020-05-18 14:03:01 +02:00
struct Pokemon * mons = sMonSummaryScreen - > monList . mons ;
s8 index , arrId = 0 ;
2017-09-24 02:23:55 +02:00
u8 i ;
2020-05-18 14:03:01 +02:00
for ( i = 0 ; i < PARTY_SIZE ; i + + )
2017-09-22 21:17:59 +02:00
{
2020-05-18 14:03:01 +02:00
if ( sMultiBattleOrder [ i ] = = sMonSummaryScreen - > curMonIndex )
2017-09-22 21:17:59 +02:00
{
2020-05-18 14:03:01 +02:00
arrId = i ;
2017-09-24 02:23:55 +02:00
break ;
2017-09-22 21:17:59 +02:00
}
}
2017-09-24 02:23:55 +02:00
2018-08-15 06:56:11 +02:00
while ( TRUE )
2017-09-22 21:17:59 +02:00
{
2020-05-18 14:03:01 +02:00
const s8 * order = sMultiBattleOrder ;
2017-09-24 02:23:55 +02:00
2020-05-18 14:03:01 +02:00
arrId + = delta ;
if ( arrId < 0 | | arrId > = PARTY_SIZE )
2018-12-05 15:31:01 +01:00
return - 1 ;
2020-05-18 14:03:01 +02:00
index = order [ arrId ] ;
if ( IsValidToViewInMulti ( & mons [ index ] ) = = TRUE )
return index ;
2017-09-22 21:17:59 +02:00
}
}
2020-05-18 14:03:01 +02:00
static bool8 IsValidToViewInMulti ( struct Pokemon * mon )
2017-09-22 21:17:59 +02:00
{
2018-08-16 00:58:41 +02:00
if ( GetMonData ( mon , MON_DATA_SPECIES ) = = SPECIES_NONE )
2017-10-03 21:42:28 +02:00
return FALSE ;
2020-05-18 14:03:01 +02:00
else if ( sMonSummaryScreen - > curMonIndex ! = 0 | | ! GetMonData ( mon , MON_DATA_IS_EGG ) )
2017-10-03 21:42:28 +02:00
return TRUE ;
2017-09-22 21:17:59 +02:00
else
2017-10-03 21:42:28 +02:00
return FALSE ;
2017-09-24 02:23:55 +02:00
}
2019-03-03 22:50:51 +01:00
static void ChangePage ( u8 taskId , s8 delta )
2017-09-24 02:23:55 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2017-09-24 02:23:55 +02:00
s16 * data = gTasks [ taskId ] . data ;
if ( summary - > isEgg )
return ;
2019-03-08 09:12:08 +01:00
else if ( delta = = - 1 & & sMonSummaryScreen - > currPageIndex = = sMonSummaryScreen - > minPageIndex )
2017-09-24 02:23:55 +02:00
return ;
2019-03-08 09:12:08 +01:00
else if ( delta = = 1 & & sMonSummaryScreen - > currPageIndex = = sMonSummaryScreen - > maxPageIndex )
2017-09-24 02:23:55 +02:00
return ;
2018-08-16 22:53:01 +02:00
2017-09-24 02:23:55 +02:00
PlaySE ( SE_SELECT ) ;
2019-03-08 09:12:08 +01:00
ClearPageWindowTilemaps ( sMonSummaryScreen - > currPageIndex ) ;
sMonSummaryScreen - > currPageIndex + = delta ;
2017-09-24 02:23:55 +02:00
data [ 0 ] = 0 ;
2019-03-04 06:25:07 +01:00
if ( delta = = 1 )
2019-02-19 10:09:42 +01:00
SetTaskFuncWithFollowupFunc ( taskId , PssScrollRight , gTasks [ taskId ] . func ) ;
2017-09-24 02:23:55 +02:00
else
2019-02-19 10:09:42 +01:00
SetTaskFuncWithFollowupFunc ( taskId , PssScrollLeft , gTasks [ taskId ] . func ) ;
2019-03-08 09:12:08 +01:00
CreateTextPrinterTask ( sMonSummaryScreen - > currPageIndex ) ;
2019-02-02 23:14:04 +01:00
HidePageSpecificSprites ( ) ;
2017-09-24 02:23:55 +02:00
}
2019-02-19 10:09:42 +01:00
static void PssScrollRight ( u8 taskId ) // Scroll right
2017-09-24 02:23:55 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
if ( data [ 0 ] = = 0 )
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > bgDisplayOrder = = 0 )
2017-09-24 02:23:55 +02:00
{
data [ 1 ] = 1 ;
2018-12-26 13:05:02 +01:00
SetBgAttribute ( 1 , BG_ATTR_PRIORITY , 1 ) ;
SetBgAttribute ( 2 , BG_ATTR_PRIORITY , 2 ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
2017-09-24 02:23:55 +02:00
}
else
{
data [ 1 ] = 2 ;
2018-12-26 13:05:02 +01:00
SetBgAttribute ( 2 , BG_ATTR_PRIORITY , 1 ) ;
SetBgAttribute ( 1 , BG_ATTR_PRIORITY , 2 ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 2 ) ;
2017-09-24 02:23:55 +02:00
}
ChangeBgX ( data [ 1 ] , 0 , 0 ) ;
2019-03-08 09:12:08 +01:00
SetBgTilemapBuffer ( data [ 1 ] , sMonSummaryScreen - > bgTilemapBuffers [ sMonSummaryScreen - > currPageIndex ] [ 0 ] ) ;
2017-09-24 02:23:55 +02:00
ShowBg ( 1 ) ;
ShowBg ( 2 ) ;
}
ChangeBgX ( data [ 1 ] , 0x2000 , 1 ) ;
data [ 0 ] + = 32 ;
if ( data [ 0 ] > 0xFF )
2019-02-19 10:09:42 +01:00
gTasks [ taskId ] . func = PssScrollRightEnd ;
2017-09-24 02:23:55 +02:00
}
2019-02-19 10:09:42 +01:00
static void PssScrollRightEnd ( u8 taskId ) // display right
2017-09-24 02:23:55 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > bgDisplayOrder ^ = 1 ;
2017-09-24 02:23:55 +02:00
data [ 1 ] = 0 ;
data [ 0 ] = 0 ;
2019-02-19 10:09:42 +01:00
DrawPagination ( ) ;
2020-05-18 14:03:01 +02:00
PutPageWindowTilemaps ( sMonSummaryScreen - > currPageIndex ) ;
2019-02-02 23:14:04 +01:00
SetTypeIcons ( ) ;
2020-05-18 14:03:01 +02:00
TryDrawExperienceProgressBar ( ) ;
2017-09-24 02:23:55 +02:00
SwitchTaskToFollowupFunc ( taskId ) ;
}
2019-02-19 10:09:42 +01:00
static void PssScrollLeft ( u8 taskId ) // Scroll left
2017-09-24 02:23:55 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
if ( data [ 0 ] = = 0 )
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > bgDisplayOrder = = 0 )
2017-09-24 02:23:55 +02:00
data [ 1 ] = 2 ;
else
data [ 1 ] = 1 ;
ChangeBgX ( data [ 1 ] , 0x10000 , 0 ) ;
}
ChangeBgX ( data [ 1 ] , 0x2000 , 2 ) ;
data [ 0 ] + = 32 ;
if ( data [ 0 ] > 0xFF )
2019-02-19 10:09:42 +01:00
gTasks [ taskId ] . func = PssScrollLeftEnd ;
2017-09-24 02:23:55 +02:00
}
2019-02-19 10:09:42 +01:00
static void PssScrollLeftEnd ( u8 taskId ) // display left
2017-09-24 02:23:55 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > bgDisplayOrder = = 0 )
2017-09-24 02:23:55 +02:00
{
2018-12-26 13:05:02 +01:00
SetBgAttribute ( 1 , BG_ATTR_PRIORITY , 1 ) ;
SetBgAttribute ( 2 , BG_ATTR_PRIORITY , 2 ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 2 ) ;
2017-09-24 02:23:55 +02:00
}
else
{
2018-12-26 13:05:02 +01:00
SetBgAttribute ( 2 , BG_ATTR_PRIORITY , 1 ) ;
SetBgAttribute ( 1 , BG_ATTR_PRIORITY , 2 ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
2017-09-24 02:23:55 +02:00
}
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex > 1 )
2017-09-24 02:23:55 +02:00
{
2020-05-18 14:03:01 +02:00
SetBgTilemapBuffer ( data [ 1 ] , sMonSummaryScreen - > bgTilemapBuffers [ sMonSummaryScreen - > currPageIndex - 1 ] [ 0 ] ) ;
2017-09-24 02:23:55 +02:00
ChangeBgX ( data [ 1 ] , 0x10000 , 0 ) ;
}
ShowBg ( 1 ) ;
ShowBg ( 2 ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > bgDisplayOrder ^ = 1 ;
2017-09-24 02:23:55 +02:00
data [ 1 ] = 0 ;
data [ 0 ] = 0 ;
2019-02-19 10:09:42 +01:00
DrawPagination ( ) ;
2020-05-18 14:03:01 +02:00
PutPageWindowTilemaps ( sMonSummaryScreen - > currPageIndex ) ;
2019-02-02 23:14:04 +01:00
SetTypeIcons ( ) ;
2020-05-18 14:03:01 +02:00
TryDrawExperienceProgressBar ( ) ;
2017-09-24 02:23:55 +02:00
SwitchTaskToFollowupFunc ( taskId ) ;
}
2020-05-18 14:03:01 +02:00
static void TryDrawExperienceProgressBar ( void )
2017-09-24 02:23:55 +02:00
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > currPageIndex = = PSS_PAGE_SKILLS )
2019-03-08 09:12:08 +01:00
DrawExperienceProgressBar ( & sMonSummaryScreen - > currentMon ) ;
2017-09-24 02:23:55 +02:00
}
2020-05-18 14:03:01 +02:00
static void SwitchToMoveSelection ( u8 taskId )
2017-09-24 02:23:55 +02:00
{
u16 move ;
2020-05-18 14:03:01 +02:00
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > firstMoveIndex = 0 ;
move = sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ;
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2020-05-18 14:03:01 +02:00
if ( ! gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ] . invisible )
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 9 , - 3 ) ;
HandleAppealJamTilemap ( 9 , - 3 , move ) ;
if ( ! sMonSummaryScreen - > lockMovesFlag )
2017-09-24 02:23:55 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_INFO ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_SWITCH ) ;
2017-09-24 02:23:55 +02:00
}
2020-05-18 14:03:01 +02:00
TilemapFiveMovesDisplay ( sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 0 ] , 3 , FALSE ) ;
TilemapFiveMovesDisplay ( sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 0 ] , 1 , FALSE ) ;
2018-08-15 20:47:10 +02:00
PrintMoveDetails ( move ) ;
2018-08-15 10:44:20 +02:00
PrintNewMoveDetailsOrCancelText ( ) ;
2019-02-02 23:14:04 +01:00
SetNewMoveTypeIcon ( ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
ScheduleBgCopyTilemapToVram ( 1 ) ;
ScheduleBgCopyTilemapToVram ( 2 ) ;
2020-05-18 14:03:01 +02:00
CreateMoveSelectorSprites ( SPRITE_ARR_ID_MOVE_SELECTOR1 ) ;
gTasks [ taskId ] . func = Task_HandleInput_MoveSelect ;
2017-09-24 02:23:55 +02:00
}
2020-05-18 14:03:01 +02:00
static void Task_HandleInput_MoveSelect ( u8 taskId )
2017-09-24 02:23:55 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2017-10-03 21:42:28 +02:00
2020-05-14 10:37:09 +02:00
if ( MenuHelpers_CallLinkSomething ( ) ! = 1 )
2017-09-24 02:23:55 +02:00
{
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
if ( gMain . newKeys & DPAD_UP )
2017-09-24 02:23:55 +02:00
{
data [ 0 ] = 4 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( data , - 1 , & sMonSummaryScreen - > firstMoveIndex ) ;
2017-09-24 02:23:55 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_DOWN )
2017-09-24 02:23:55 +02:00
{
data [ 0 ] = 4 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( data , 1 , & sMonSummaryScreen - > firstMoveIndex ) ;
2017-09-24 02:23:55 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & A_BUTTON )
2017-09-24 02:23:55 +02:00
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > lockMovesFlag = = TRUE
2019-03-08 09:12:08 +01:00
| | ( sMonSummaryScreen - > newMove = = MOVE_NONE & & sMonSummaryScreen - > firstMoveIndex = = MAX_MON_MOVES ) )
2017-09-24 02:23:55 +02:00
{
PlaySE ( SE_SELECT ) ;
2020-05-18 14:03:01 +02:00
CloseMoveSelectMode ( taskId ) ;
2017-09-24 02:23:55 +02:00
}
2020-05-18 14:03:01 +02:00
else if ( HasMoreThanOneMove ( ) = = TRUE )
2017-09-24 02:23:55 +02:00
{
PlaySE ( SE_SELECT ) ;
2020-05-18 14:03:01 +02:00
SwitchToMovePositionSwitchMode ( taskId ) ;
2017-09-24 02:23:55 +02:00
}
else
2017-10-03 21:42:28 +02:00
{
2020-08-21 00:02:00 +02:00
PlaySE ( SE_FAILURE ) ;
2017-10-03 21:42:28 +02:00
}
2017-09-24 02:23:55 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & B_BUTTON )
2017-09-24 02:23:55 +02:00
{
PlaySE ( SE_SELECT ) ;
2020-05-18 14:03:01 +02:00
CloseMoveSelectMode ( taskId ) ;
2017-09-24 02:23:55 +02:00
}
}
}
2020-05-18 14:03:01 +02:00
static bool8 HasMoreThanOneMove ( void )
2017-09-24 02:23:55 +02:00
{
u8 i ;
2018-12-25 18:50:15 +01:00
for ( i = 1 ; i < MAX_MON_MOVES ; i + + )
2017-09-24 02:23:55 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . moves [ i ] ! = 0 )
2017-10-03 21:42:28 +02:00
return TRUE ;
2017-09-24 02:23:55 +02:00
}
2017-10-03 21:42:28 +02:00
return FALSE ;
2017-09-24 02:23:55 +02:00
}
2020-05-18 14:03:01 +02:00
static void ChangeSelectedMove ( s16 * taskData , s8 direction , u8 * moveIndexPtr )
2017-09-24 02:23:55 +02:00
{
2020-05-18 14:03:01 +02:00
s8 i , newMoveIndex ;
2017-10-03 21:42:28 +02:00
u16 move ;
2017-09-24 02:23:55 +02:00
PlaySE ( SE_SELECT ) ;
2020-05-18 14:03:01 +02:00
newMoveIndex = * moveIndexPtr ;
2018-12-25 18:50:15 +01:00
for ( i = 0 ; i < MAX_MON_MOVES ; i + + )
2017-09-24 02:23:55 +02:00
{
2020-05-18 14:03:01 +02:00
newMoveIndex + = direction ;
if ( newMoveIndex > taskData [ 0 ] )
newMoveIndex = 0 ;
else if ( newMoveIndex < 0 )
newMoveIndex = taskData [ 0 ] ;
if ( newMoveIndex = = MAX_MON_MOVES )
2017-10-03 21:42:28 +02:00
{
2019-03-08 09:12:08 +01:00
move = sMonSummaryScreen - > newMove ;
2017-09-24 02:23:55 +02:00
break ;
2017-10-03 21:42:28 +02:00
}
2020-05-18 14:03:01 +02:00
move = sMonSummaryScreen - > summary . moves [ newMoveIndex ] ;
2017-10-03 21:42:28 +02:00
if ( move ! = 0 )
break ;
}
2019-02-02 23:14:04 +01:00
DrawContestMoveHearts ( move ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
ScheduleBgCopyTilemapToVram ( 2 ) ;
2018-08-15 20:47:10 +02:00
PrintMoveDetails ( move ) ;
2020-05-18 14:03:01 +02:00
if ( ( * moveIndexPtr = = MAX_MON_MOVES & & sMonSummaryScreen - > newMove = = MOVE_NONE )
| | taskData [ 1 ] = = 1 )
2017-10-03 21:42:28 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2020-05-18 14:03:01 +02:00
if ( ! gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ] . invisible )
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 9 , - 3 ) ;
HandleAppealJamTilemap ( 9 , - 3 , move ) ;
2017-10-03 21:42:28 +02:00
}
2020-05-18 14:03:01 +02:00
if ( * moveIndexPtr ! = MAX_MON_MOVES
& & newMoveIndex = = MAX_MON_MOVES
& & sMonSummaryScreen - > newMove = = MOVE_NONE )
2017-10-03 21:42:28 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_POWER_ACC ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 0 , 3 ) ;
HandleAppealJamTilemap ( 0 , 3 , 0 ) ;
2017-10-03 21:42:28 +02:00
}
2020-05-18 14:03:01 +02:00
* moveIndexPtr = newMoveIndex ;
2020-05-25 10:19:18 +02:00
// Get rid of the 'flicker' effect(while idle) when scrolling.
2020-05-18 14:03:01 +02:00
if ( moveIndexPtr = = & sMonSummaryScreen - > firstMoveIndex )
2020-05-25 10:19:18 +02:00
KeepMoveSelectorVisible ( SPRITE_ARR_ID_MOVE_SELECTOR1 ) ;
2017-10-03 21:42:28 +02:00
else
2020-05-25 10:19:18 +02:00
KeepMoveSelectorVisible ( SPRITE_ARR_ID_MOVE_SELECTOR2 ) ;
2017-10-03 21:42:28 +02:00
}
2020-05-18 14:03:01 +02:00
static void CloseMoveSelectMode ( u8 taskId )
2017-10-03 21:42:28 +02:00
{
2020-05-25 10:19:18 +02:00
DestroyMoveSelectorSprites ( SPRITE_ARR_ID_MOVE_SELECTOR1 ) ;
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_SWITCH ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_INFO ) ;
2018-08-15 20:47:10 +02:00
PrintMoveDetails ( 0 ) ;
2020-05-18 14:03:01 +02:00
TilemapFiveMovesDisplay ( sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 0 ] , 3 , TRUE ) ;
TilemapFiveMovesDisplay ( sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 0 ] , 1 , TRUE ) ;
AddAndFillMoveNamesWindow ( ) ; // This function seems to have no effect.
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > firstMoveIndex ! = MAX_MON_MOVES )
2017-10-03 21:42:28 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_POWER_ACC ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 0 , 3 ) ;
HandleAppealJamTilemap ( 0 , 3 , 0 ) ;
2017-09-24 02:23:55 +02:00
}
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
ScheduleBgCopyTilemapToVram ( 1 ) ;
ScheduleBgCopyTilemapToVram ( 2 ) ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleInput ;
2017-10-03 21:42:28 +02:00
}
2020-05-18 14:03:01 +02:00
static void SwitchToMovePositionSwitchMode ( u8 taskId )
2017-10-03 21:42:28 +02:00
{
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > secondMoveIndex = sMonSummaryScreen - > firstMoveIndex ;
2020-05-18 14:03:01 +02:00
SetMainMoveSelectorColor ( 1 ) ;
CreateMoveSelectorSprites ( SPRITE_ARR_ID_MOVE_SELECTOR2 ) ;
gTasks [ taskId ] . func = Task_HandleInput_MovePositionSwitch ;
2017-10-03 21:42:28 +02:00
}
2020-05-18 14:03:01 +02:00
static void Task_HandleInput_MovePositionSwitch ( u8 taskId )
2017-10-03 21:42:28 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2018-08-15 10:44:20 +02:00
2020-05-14 10:37:09 +02:00
if ( MenuHelpers_CallLinkSomething ( ) ! = TRUE )
2017-10-03 21:42:28 +02:00
{
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
if ( gMain . newKeys & DPAD_UP )
2017-10-03 21:42:28 +02:00
{
data [ 0 ] = 3 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( & data [ 0 ] , - 1 , & sMonSummaryScreen - > secondMoveIndex ) ;
2017-10-03 21:42:28 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_DOWN )
2017-10-03 21:42:28 +02:00
{
data [ 0 ] = 3 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( & data [ 0 ] , 1 , & sMonSummaryScreen - > secondMoveIndex ) ;
2017-10-03 21:42:28 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & A_BUTTON )
2017-10-03 21:42:28 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > firstMoveIndex = = sMonSummaryScreen - > secondMoveIndex )
2020-05-18 14:03:01 +02:00
ExitMovePositionSwitchMode ( taskId , FALSE ) ;
2017-10-03 21:42:28 +02:00
else
2020-05-18 14:03:01 +02:00
ExitMovePositionSwitchMode ( taskId , TRUE ) ;
2017-10-03 21:42:28 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & B_BUTTON )
2018-08-15 10:44:20 +02:00
{
2020-05-18 14:03:01 +02:00
ExitMovePositionSwitchMode ( taskId , FALSE ) ;
2018-08-15 10:44:20 +02:00
}
2017-10-03 21:42:28 +02:00
}
}
2020-05-18 14:03:01 +02:00
static void ExitMovePositionSwitchMode ( u8 taskId , bool8 swapMoves )
2017-10-03 21:42:28 +02:00
{
u16 move ;
2018-08-15 10:44:20 +02:00
2017-10-03 21:42:28 +02:00
PlaySE ( SE_SELECT ) ;
2020-05-18 14:03:01 +02:00
SetMainMoveSelectorColor ( 0 ) ;
DestroyMoveSelectorSprites ( SPRITE_ARR_ID_MOVE_SELECTOR2 ) ;
2018-08-15 10:44:20 +02:00
2020-05-18 14:03:01 +02:00
if ( swapMoves = = TRUE )
2017-10-03 21:42:28 +02:00
{
2019-03-08 09:12:08 +01:00
if ( ! sMonSummaryScreen - > isBoxMon )
2017-10-03 21:42:28 +02:00
{
2020-05-18 14:03:01 +02:00
struct Pokemon * mon = sMonSummaryScreen - > monList . mons ;
SwapMonMoves ( & mon [ sMonSummaryScreen - > curMonIndex ] , sMonSummaryScreen - > firstMoveIndex , sMonSummaryScreen - > secondMoveIndex ) ;
2017-10-03 21:42:28 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
struct BoxPokemon * boxMon = sMonSummaryScreen - > monList . boxMons ;
SwapBoxMonMoves ( & boxMon [ sMonSummaryScreen - > curMonIndex ] , sMonSummaryScreen - > firstMoveIndex , sMonSummaryScreen - > secondMoveIndex ) ;
2017-10-03 21:42:28 +02:00
}
2019-03-08 09:12:08 +01:00
CopyMonToSummaryStruct ( & sMonSummaryScreen - > currentMon ) ;
2020-05-18 14:03:01 +02:00
SwapMovesNamesPP ( sMonSummaryScreen - > firstMoveIndex , sMonSummaryScreen - > secondMoveIndex ) ;
SwapMovesTypeSprites ( sMonSummaryScreen - > firstMoveIndex , sMonSummaryScreen - > secondMoveIndex ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > firstMoveIndex = sMonSummaryScreen - > secondMoveIndex ;
2017-10-03 21:42:28 +02:00
}
2018-08-15 10:44:20 +02:00
2019-03-08 09:12:08 +01:00
move = sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ;
2018-08-15 20:47:10 +02:00
PrintMoveDetails ( move ) ;
2019-02-02 23:14:04 +01:00
DrawContestMoveHearts ( move ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
ScheduleBgCopyTilemapToVram ( 2 ) ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleInput_MoveSelect ;
2017-10-03 21:42:28 +02:00
}
2018-08-16 00:58:41 +02:00
static void SwapMonMoves ( struct Pokemon * mon , u8 moveIndex1 , u8 moveIndex2 )
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-08-16 00:58:41 +02:00
u16 move1 = summary - > moves [ moveIndex1 ] ;
u16 move2 = summary - > moves [ moveIndex2 ] ;
u8 move1pp = summary - > pp [ moveIndex1 ] ;
u8 move2pp = summary - > pp [ moveIndex2 ] ;
u8 ppBonuses = summary - > ppBonuses ;
// Calculate PP bonuses
2019-02-19 10:09:42 +01:00
u8 ppUpMask1 = gPPUpGetMask [ moveIndex1 ] ;
2018-08-16 00:58:41 +02:00
u8 ppBonusMove1 = ( ppBonuses & ppUpMask1 ) > > ( moveIndex1 * 2 ) ;
2019-02-19 10:09:42 +01:00
u8 ppUpMask2 = gPPUpGetMask [ moveIndex2 ] ;
2018-08-16 00:58:41 +02:00
u8 ppBonusMove2 = ( ppBonuses & ppUpMask2 ) > > ( moveIndex2 * 2 ) ;
ppBonuses & = ~ ppUpMask1 ;
ppBonuses & = ~ ppUpMask2 ;
ppBonuses | = ( ppBonusMove1 < < ( moveIndex2 * 2 ) ) + ( ppBonusMove2 < < ( moveIndex1 * 2 ) ) ;
// Swap the moves
SetMonData ( mon , MON_DATA_MOVE1 + moveIndex1 , & move2 ) ;
SetMonData ( mon , MON_DATA_MOVE1 + moveIndex2 , & move1 ) ;
SetMonData ( mon , MON_DATA_PP1 + moveIndex1 , & move2pp ) ;
SetMonData ( mon , MON_DATA_PP1 + moveIndex2 , & move1pp ) ;
SetMonData ( mon , MON_DATA_PP_BONUSES , & ppBonuses ) ;
2018-08-16 22:53:01 +02:00
2018-08-16 00:58:41 +02:00
summary - > moves [ moveIndex1 ] = move2 ;
summary - > moves [ moveIndex2 ] = move1 ;
summary - > pp [ moveIndex1 ] = move2pp ;
summary - > pp [ moveIndex2 ] = move1pp ;
summary - > ppBonuses = ppBonuses ;
}
static void SwapBoxMonMoves ( struct BoxPokemon * mon , u8 moveIndex1 , u8 moveIndex2 )
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-08-16 00:58:41 +02:00
u16 move1 = summary - > moves [ moveIndex1 ] ;
u16 move2 = summary - > moves [ moveIndex2 ] ;
u8 move1pp = summary - > pp [ moveIndex1 ] ;
u8 move2pp = summary - > pp [ moveIndex2 ] ;
u8 ppBonuses = summary - > ppBonuses ;
2017-10-03 21:42:28 +02:00
2018-08-16 00:58:41 +02:00
// Calculate PP bonuses
2019-02-19 10:09:42 +01:00
u8 ppUpMask1 = gPPUpGetMask [ moveIndex1 ] ;
2018-08-16 00:58:41 +02:00
u8 ppBonusMove1 = ( ppBonuses & ppUpMask1 ) > > ( moveIndex1 * 2 ) ;
2019-02-19 10:09:42 +01:00
u8 ppUpMask2 = gPPUpGetMask [ moveIndex2 ] ;
2018-08-16 00:58:41 +02:00
u8 ppBonusMove2 = ( ppBonuses & ppUpMask2 ) > > ( moveIndex2 * 2 ) ;
ppBonuses & = ~ ppUpMask1 ;
ppBonuses & = ~ ppUpMask2 ;
ppBonuses | = ( ppBonusMove1 < < ( moveIndex2 * 2 ) ) + ( ppBonusMove2 < < ( moveIndex1 * 2 ) ) ;
2017-10-03 21:42:28 +02:00
2018-08-16 00:58:41 +02:00
// Swap the moves
SetBoxMonData ( mon , MON_DATA_MOVE1 + moveIndex1 , & move2 ) ;
SetBoxMonData ( mon , MON_DATA_MOVE1 + moveIndex2 , & move1 ) ;
SetBoxMonData ( mon , MON_DATA_PP1 + moveIndex1 , & move2pp ) ;
SetBoxMonData ( mon , MON_DATA_PP1 + moveIndex2 , & move1pp ) ;
SetBoxMonData ( mon , MON_DATA_PP_BONUSES , & ppBonuses ) ;
2018-08-16 22:53:01 +02:00
2018-08-16 00:58:41 +02:00
summary - > moves [ moveIndex1 ] = move2 ;
summary - > moves [ moveIndex2 ] = move1 ;
summary - > pp [ moveIndex1 ] = move2pp ;
summary - > pp [ moveIndex2 ] = move1pp ;
summary - > ppBonuses = ppBonuses ;
}
2020-05-18 14:03:01 +02:00
static void Task_SetHandleReplaceMoveInput ( u8 taskId )
2017-10-09 19:17:13 +02:00
{
2019-02-02 23:14:04 +01:00
SetNewMoveTypeIcon ( ) ;
2020-05-18 14:03:01 +02:00
CreateMoveSelectorSprites ( SPRITE_ARR_ID_MOVE_SELECTOR1 ) ;
gTasks [ taskId ] . func = Task_HandleReplaceMoveInput ;
2017-10-09 19:17:13 +02:00
}
2020-05-18 14:03:01 +02:00
static void Task_HandleReplaceMoveInput ( u8 taskId )
2017-10-09 19:17:13 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2017-11-14 20:23:25 +01:00
2020-05-14 10:37:09 +02:00
if ( MenuHelpers_CallLinkSomething ( ) ! = TRUE )
2017-10-09 19:17:13 +02:00
{
2019-03-03 22:50:51 +01:00
if ( gPaletteFade . active ! = TRUE )
2017-10-09 19:17:13 +02:00
{
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
if ( gMain . newKeys & DPAD_UP )
2017-10-09 19:17:13 +02:00
{
data [ 0 ] = 4 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( data , - 1 , & sMonSummaryScreen - > firstMoveIndex ) ;
2017-10-09 19:17:13 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_DOWN )
2017-10-09 19:17:13 +02:00
{
data [ 0 ] = 4 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( data , 1 , & sMonSummaryScreen - > firstMoveIndex ) ;
2017-10-09 19:17:13 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_LEFT | | GetLRKeysPressed ( ) = = MENU_L_PRESSED )
2017-10-09 19:17:13 +02:00
{
2019-03-04 06:25:07 +01:00
ChangePage ( taskId , - 1 ) ;
2017-10-09 19:17:13 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_RIGHT | | GetLRKeysPressed ( ) = = MENU_R_PRESSED )
2017-10-09 19:17:13 +02:00
{
2019-03-04 06:25:07 +01:00
ChangePage ( taskId , 1 ) ;
2017-10-09 19:17:13 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & A_BUTTON )
2017-10-09 19:17:13 +02:00
{
2019-02-19 10:09:42 +01:00
if ( CanReplaceMove ( ) = = TRUE )
2017-10-09 19:17:13 +02:00
{
2019-02-19 10:09:42 +01:00
StopPokemonAnimations ( ) ;
2017-10-09 19:17:13 +02:00
PlaySE ( SE_SELECT ) ;
2019-10-18 01:22:03 +02:00
sMoveSlotToReplace = sMonSummaryScreen - > firstMoveIndex ;
gSpecialVar_0x8005 = sMoveSlotToReplace ;
2019-02-04 13:44:09 +01:00
BeginCloseSummaryScreen ( taskId ) ;
2017-10-09 19:17:13 +02:00
}
else
{
2020-08-21 00:02:00 +02:00
PlaySE ( SE_FAILURE ) ;
2020-05-18 14:03:01 +02:00
ShowCantForgetHMsWindow ( taskId ) ;
2017-10-09 19:17:13 +02:00
}
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & B_BUTTON )
2017-10-09 19:17:13 +02:00
{
2019-02-19 10:09:42 +01:00
StopPokemonAnimations ( ) ;
2017-10-09 19:17:13 +02:00
PlaySE ( SE_SELECT ) ;
2019-10-18 01:22:03 +02:00
sMoveSlotToReplace = MAX_MON_MOVES ;
gSpecialVar_0x8005 = MAX_MON_MOVES ;
2019-02-04 13:44:09 +01:00
BeginCloseSummaryScreen ( taskId ) ;
2017-11-14 20:23:25 +01:00
}
2017-10-09 19:17:13 +02:00
}
}
}
2019-02-19 10:09:42 +01:00
static bool8 CanReplaceMove ( void )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > firstMoveIndex = = MAX_MON_MOVES
| | sMonSummaryScreen - > newMove = = MOVE_NONE
| | IsMoveHm ( sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ) ! = TRUE )
2017-10-22 21:01:34 +02:00
return TRUE ;
2017-10-09 19:17:13 +02:00
else
2017-10-22 21:01:34 +02:00
return FALSE ;
2017-10-09 19:17:13 +02:00
}
2020-05-18 14:03:01 +02:00
static void ShowCantForgetHMsWindow ( u8 taskId )
2017-10-09 19:17:13 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_POWER_ACC ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 0 , 3 ) ;
HandleAppealJamTilemap ( 0 , 3 , 0 ) ;
2018-08-16 00:58:41 +02:00
PrintHMMovesCantBeForgotten ( ) ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleInputCantForgetHMsMoves ;
2017-10-09 19:17:13 +02:00
}
2019-02-19 10:09:42 +01:00
// This redraws the power/accuracy window when the player scrolls out of the "HM Moves can't be forgotten" message
2020-05-18 14:03:01 +02:00
static void Task_HandleInputCantForgetHMsMoves ( u8 taskId )
2017-10-09 19:17:13 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
u16 move ;
2020-05-18 14:03:01 +02:00
if ( FuncIsActiveTask ( Task_ShowPowerAccWindow ) ! = 1 )
2017-10-09 19:17:13 +02:00
{
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
if ( gMain . newKeys & DPAD_UP )
2017-10-09 19:17:13 +02:00
{
data [ 1 ] = 1 ;
data [ 0 ] = 4 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( & data [ 0 ] , - 1 , & sMonSummaryScreen - > firstMoveIndex ) ;
2017-10-09 19:17:13 +02:00
data [ 1 ] = 0 ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleReplaceMoveInput ;
2017-10-09 19:17:13 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_DOWN )
2017-10-09 19:17:13 +02:00
{
data [ 1 ] = 1 ;
data [ 0 ] = 4 ;
2020-05-18 14:03:01 +02:00
ChangeSelectedMove ( & data [ 0 ] , 1 , & sMonSummaryScreen - > firstMoveIndex ) ;
2017-10-09 19:17:13 +02:00
data [ 1 ] = 0 ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleReplaceMoveInput ;
2017-10-09 19:17:13 +02:00
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_LEFT | | GetLRKeysPressed ( ) = = MENU_L_PRESSED )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_BATTLE_MOVES )
2017-10-09 19:17:13 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2020-05-18 14:03:01 +02:00
if ( ! gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ] . invisible )
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2019-03-08 09:12:08 +01:00
move = sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleReplaceMoveInput ;
2019-03-04 06:25:07 +01:00
ChangePage ( taskId , - 1 ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 9 , - 2 ) ;
HandleAppealJamTilemap ( 9 , - 2 , move ) ;
2017-10-09 19:17:13 +02:00
}
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & DPAD_RIGHT | | GetLRKeysPressed ( ) = = MENU_R_PRESSED )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > currPageIndex ! = PSS_PAGE_CONTEST_MOVES )
2017-10-09 19:17:13 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2020-05-18 14:03:01 +02:00
if ( ! gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ] . invisible )
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2019-03-08 09:12:08 +01:00
move = sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ;
2020-05-18 14:03:01 +02:00
gTasks [ taskId ] . func = Task_HandleReplaceMoveInput ;
2019-03-04 06:25:07 +01:00
ChangePage ( taskId , 1 ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 9 , - 2 ) ;
HandleAppealJamTilemap ( 9 , - 2 , move ) ;
2017-10-09 19:17:13 +02:00
}
}
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
else if ( gMain . newKeys & ( A_BUTTON | B_BUTTON ) )
2017-10-09 19:17:13 +02:00
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2020-05-18 14:03:01 +02:00
if ( ! gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ] . invisible )
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2019-03-08 09:12:08 +01:00
move = sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ;
2018-08-15 20:47:10 +02:00
PrintMoveDetails ( move ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2020-05-18 14:03:01 +02:00
HandlePowerAccTilemap ( 9 , - 3 ) ;
HandleAppealJamTilemap ( 9 , - 3 , move ) ;
gTasks [ taskId ] . func = Task_HandleReplaceMoveInput ;
2017-10-09 19:17:13 +02:00
}
}
}
2019-10-18 01:22:03 +02:00
u8 GetMoveSlotToReplace ( void )
2017-10-09 19:17:13 +02:00
{
2019-10-18 01:22:03 +02:00
return sMoveSlotToReplace ;
2017-10-09 19:17:13 +02:00
}
2019-02-19 10:09:42 +01:00
static void DrawPagination ( void ) // Updates the pagination dots at the top of the summary screen
2017-10-09 19:17:13 +02:00
{
u16 * alloced = Alloc ( 32 ) ;
u8 i ;
2018-08-16 00:58:41 +02:00
2017-10-09 19:17:13 +02:00
for ( i = 0 ; i < 4 ; i + + )
{
2018-08-16 00:58:41 +02:00
u8 j = i * 2 ;
2019-03-08 09:12:08 +01:00
if ( i < sMonSummaryScreen - > minPageIndex )
2017-10-09 19:17:13 +02:00
{
2018-08-16 00:58:41 +02:00
alloced [ j + 0 ] = 0x40 ;
alloced [ j + 1 ] = 0x40 ;
alloced [ j + 8 ] = 0x50 ;
alloced [ j + 9 ] = 0x50 ;
2017-10-09 19:17:13 +02:00
}
2019-03-08 09:12:08 +01:00
else if ( i > sMonSummaryScreen - > maxPageIndex )
2017-10-09 19:17:13 +02:00
{
2018-08-16 00:58:41 +02:00
alloced [ j + 0 ] = 0x4A ;
alloced [ j + 1 ] = 0x4A ;
alloced [ j + 8 ] = 0x5A ;
alloced [ j + 9 ] = 0x5A ;
2017-10-09 19:17:13 +02:00
}
2019-03-08 09:12:08 +01:00
else if ( i < sMonSummaryScreen - > currPageIndex )
2017-10-09 19:17:13 +02:00
{
2018-08-16 00:58:41 +02:00
alloced [ j + 0 ] = 0x46 ;
alloced [ j + 1 ] = 0x47 ;
alloced [ j + 8 ] = 0x56 ;
alloced [ j + 9 ] = 0x57 ;
2017-10-09 19:17:13 +02:00
}
2019-03-08 09:12:08 +01:00
else if ( i = = sMonSummaryScreen - > currPageIndex )
2017-10-09 19:17:13 +02:00
{
2019-03-08 09:12:08 +01:00
if ( i ! = sMonSummaryScreen - > maxPageIndex )
2017-10-09 19:17:13 +02:00
{
2018-08-16 00:58:41 +02:00
alloced [ j + 0 ] = 0x41 ;
alloced [ j + 1 ] = 0x42 ;
alloced [ j + 8 ] = 0x51 ;
alloced [ j + 9 ] = 0x52 ;
2017-10-09 19:17:13 +02:00
}
else
{
2018-08-16 00:58:41 +02:00
alloced [ j + 0 ] = 0x4B ;
alloced [ j + 1 ] = 0x4C ;
alloced [ j + 8 ] = 0x5B ;
alloced [ j + 9 ] = 0x5C ;
2017-10-09 19:17:13 +02:00
}
}
2019-03-08 09:12:08 +01:00
else if ( i ! = sMonSummaryScreen - > maxPageIndex )
2017-10-09 19:17:13 +02:00
{
2018-08-16 00:58:41 +02:00
alloced [ j + 0 ] = 0x43 ;
alloced [ j + 1 ] = 0x44 ;
alloced [ j + 8 ] = 0x53 ;
alloced [ j + 9 ] = 0x54 ;
2017-10-09 19:17:13 +02:00
}
else
{
2018-08-16 00:58:41 +02:00
alloced [ j + 0 ] = 0x48 ;
alloced [ j + 1 ] = 0x49 ;
alloced [ j + 8 ] = 0x58 ;
alloced [ j + 9 ] = 0x59 ;
2017-10-09 19:17:13 +02:00
}
}
CopyToBgTilemapBufferRect_ChangePalette ( 3 , alloced , 11 , 0 , 8 , 2 , 16 ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 3 ) ;
2017-10-09 19:17:13 +02:00
Free ( alloced ) ;
}
2020-05-18 14:03:01 +02:00
static void ChangeTilemap ( const struct TilemapCtrl * unkStruct , u16 * dest , u8 c , bool8 d )
2017-10-09 19:17:13 +02:00
{
2018-08-15 06:56:11 +02:00
u16 i ;
u16 * alloced = Alloc ( unkStruct - > field_6 * 2 * unkStruct - > field_7 ) ;
CpuFill16 ( unkStruct - > field_4 , alloced , unkStruct - > field_6 * 2 * unkStruct - > field_7 ) ;
if ( unkStruct - > field_6 ! = c )
2017-10-09 19:17:13 +02:00
{
if ( ! d )
{
2018-08-15 06:56:11 +02:00
for ( i = 0 ; i < unkStruct - > field_7 ; i + + )
2020-05-18 14:03:01 +02:00
CpuCopy16 ( & unkStruct - > gfx [ c + unkStruct - > field_6 * i ] , & alloced [ unkStruct - > field_6 * i ] , ( unkStruct - > field_6 - c ) * 2 ) ;
2017-10-09 19:17:13 +02:00
}
else
{
2018-08-15 06:56:11 +02:00
for ( i = 0 ; i < unkStruct - > field_7 ; i + + )
2020-05-18 14:03:01 +02:00
CpuCopy16 ( & unkStruct - > gfx [ unkStruct - > field_6 * i ] , & alloced [ c + unkStruct - > field_6 * i ] , ( unkStruct - > field_6 - c ) * 2 ) ;
2017-10-09 19:17:13 +02:00
}
}
2020-05-18 14:03:01 +02:00
2018-08-15 06:56:11 +02:00
for ( i = 0 ; i < unkStruct - > field_7 ; i + + )
CpuCopy16 ( & alloced [ unkStruct - > field_6 * i ] , & dest [ ( unkStruct - > field_9 + i ) * 32 + unkStruct - > field_8 ] , unkStruct - > field_6 * 2 ) ;
2020-05-18 14:03:01 +02:00
2017-10-09 19:17:13 +02:00
Free ( alloced ) ;
}
2020-05-18 14:03:01 +02:00
static void HandlePowerAccTilemap ( u16 a , s16 b )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
if ( b > sBattleMoveTilemapCtrl . field_6 )
b = sBattleMoveTilemapCtrl . field_6 ;
if ( b = = 0 | | b = = sBattleMoveTilemapCtrl . field_6 )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
ChangeTilemap ( & sBattleMoveTilemapCtrl , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 0 ] , b , TRUE ) ;
2017-10-09 19:17:13 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
u8 taskId = FindTaskIdByFunc ( Task_ShowPowerAccWindow ) ;
2018-12-05 15:31:01 +01:00
if ( taskId = = 0xFF )
2020-05-18 14:03:01 +02:00
taskId = CreateTask ( Task_ShowPowerAccWindow , 8 ) ;
2017-10-09 19:17:13 +02:00
gTasks [ taskId ] . data [ 0 ] = b ;
gTasks [ taskId ] . data [ 1 ] = a ;
}
}
2020-05-18 14:03:01 +02:00
static void Task_ShowPowerAccWindow ( u8 taskId )
2017-10-09 19:17:13 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
data [ 1 ] + = data [ 0 ] ;
if ( data [ 1 ] < 0 )
{
data [ 1 ] = 0 ;
}
2020-05-18 14:03:01 +02:00
else if ( data [ 1 ] > sBattleMoveTilemapCtrl . field_6 )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
data [ 1 ] = sBattleMoveTilemapCtrl . field_6 ;
2017-10-09 19:17:13 +02:00
}
2020-05-18 14:03:01 +02:00
ChangeTilemap ( & sBattleMoveTilemapCtrl , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_BATTLE_MOVES ] [ 0 ] , data [ 1 ] , TRUE ) ;
if ( data [ 1 ] < = 0 | | data [ 1 ] > = sBattleMoveTilemapCtrl . field_6 )
2017-10-09 19:17:13 +02:00
{
if ( data [ 0 ] < 0 )
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex = = 2 )
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_MOVES_POWER_ACC ) ;
2017-10-09 19:17:13 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
if ( ! gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ] . invisible )
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2017-10-09 19:17:13 +02:00
}
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2017-10-09 19:17:13 +02:00
DestroyTask ( taskId ) ;
}
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
ScheduleBgCopyTilemapToVram ( 2 ) ;
2017-10-09 19:17:13 +02:00
}
2020-05-18 14:03:01 +02:00
static void HandleAppealJamTilemap ( u16 a , s16 b , u16 move )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
if ( b > sContestMoveTilemapCtrl . field_6 )
b = sContestMoveTilemapCtrl . field_6 ;
if ( b = = 0 | | b = = sContestMoveTilemapCtrl . field_6 )
{
ChangeTilemap ( & sContestMoveTilemapCtrl , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 0 ] , b , TRUE ) ;
}
2017-10-09 19:17:13 +02:00
else
{
2020-05-18 14:03:01 +02:00
u8 taskId = FindTaskIdByFunc ( Task_ShowAppealJamWindow ) ;
2018-12-05 15:31:01 +01:00
if ( taskId = = 0xFF )
2020-05-18 14:03:01 +02:00
taskId = CreateTask ( Task_ShowAppealJamWindow , 8 ) ;
2017-10-09 19:17:13 +02:00
gTasks [ taskId ] . data [ 0 ] = b ;
gTasks [ taskId ] . data [ 1 ] = a ;
gTasks [ taskId ] . data [ 2 ] = move ;
}
}
2020-05-18 14:03:01 +02:00
static void Task_ShowAppealJamWindow ( u8 taskId )
2017-10-09 19:17:13 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
data [ 1 ] + = data [ 0 ] ;
if ( data [ 1 ] < 0 )
{
data [ 1 ] = 0 ;
}
2020-05-18 14:03:01 +02:00
else if ( data [ 1 ] > sContestMoveTilemapCtrl . field_6 )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
data [ 1 ] = sContestMoveTilemapCtrl . field_6 ;
2017-10-09 19:17:13 +02:00
}
2020-05-18 14:03:01 +02:00
ChangeTilemap ( & sContestMoveTilemapCtrl , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 0 ] , data [ 1 ] , TRUE ) ;
if ( data [ 1 ] < = 0 | | data [ 1 ] > = sContestMoveTilemapCtrl . field_6 )
2017-10-09 19:17:13 +02:00
{
if ( data [ 0 ] < 0 )
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex = = 3 & & FuncIsActiveTask ( PssScrollRight ) = = 0 )
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM ) ;
2019-02-02 23:14:04 +01:00
DrawContestMoveHearts ( data [ 2 ] ) ;
2017-10-09 19:17:13 +02:00
}
2017-11-14 20:23:25 +01:00
else
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
if ( ! gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ] . invisible )
2017-10-09 19:17:13 +02:00
{
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2017-10-09 19:17:13 +02:00
}
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2017-10-09 19:17:13 +02:00
}
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2017-10-09 19:17:13 +02:00
DestroyTask ( taskId ) ;
}
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
ScheduleBgCopyTilemapToVram ( 2 ) ;
2017-10-09 19:17:13 +02:00
}
2020-05-18 14:03:01 +02:00
static void HandleStatusTilemap ( u16 a , s16 b )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
if ( b > sStatusTilemapCtrl1 . field_6 )
b = sStatusTilemapCtrl1 . field_6 ;
if ( b = = 0 | | b = = sStatusTilemapCtrl1 . field_6 )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
ChangeTilemap ( & sStatusTilemapCtrl1 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] , b , FALSE ) ;
ChangeTilemap ( & sStatusTilemapCtrl2 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] , b , FALSE ) ;
2017-10-09 19:17:13 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
u8 taskId = CreateTask ( Task_ShowStatusWindow , 8 ) ;
2017-10-09 19:17:13 +02:00
gTasks [ taskId ] . data [ 0 ] = b ;
gTasks [ taskId ] . data [ 1 ] = a ;
}
}
2020-05-18 14:03:01 +02:00
static void Task_ShowStatusWindow ( u8 taskId )
2017-10-09 19:17:13 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
data [ 1 ] + = data [ 0 ] ;
if ( data [ 1 ] < 0 )
data [ 1 ] = 0 ;
2020-05-18 14:03:01 +02:00
else if ( data [ 1 ] > sStatusTilemapCtrl1 . field_6 )
data [ 1 ] = sStatusTilemapCtrl1 . field_6 ;
ChangeTilemap ( & sStatusTilemapCtrl1 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] , data [ 1 ] , FALSE ) ;
ChangeTilemap ( & sStatusTilemapCtrl2 , sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] , data [ 1 ] , FALSE ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 3 ) ;
2020-05-18 14:03:01 +02:00
if ( data [ 1 ] < = 0 | | data [ 1 ] > = sStatusTilemapCtrl1 . field_6 )
2017-10-09 19:17:13 +02:00
{
if ( data [ 0 ] < 0 )
{
2018-08-15 20:47:10 +02:00
CreateSetStatusSprite ( ) ;
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2017-10-09 19:17:13 +02:00
}
DestroyTask ( taskId ) ;
}
}
2020-05-18 14:03:01 +02:00
static void TilemapFiveMovesDisplay ( u16 * dst , u16 palette , bool8 remove )
2017-10-09 19:17:13 +02:00
{
2020-05-18 14:03:01 +02:00
u16 i , id ;
2018-08-16 00:58:41 +02:00
palette * = 0x1000 ;
2020-05-18 14:03:01 +02:00
id = 0x56A ;
if ( ! remove )
2017-10-09 19:17:13 +02:00
{
for ( i = 0 ; i < 20 ; i + + )
{
2020-05-18 14:03:01 +02:00
dst [ id + i ] = gSummaryScreenWindow_Tilemap [ i ] + palette ;
dst [ id + i + 0x20 ] = gSummaryScreenWindow_Tilemap [ i ] + palette ;
dst [ id + i + 0x40 ] = gSummaryScreenWindow_Tilemap [ i + 20 ] + palette ;
2017-10-09 19:17:13 +02:00
}
}
2020-05-18 14:03:01 +02:00
else // Remove
2017-10-09 19:17:13 +02:00
{
for ( i = 0 ; i < 20 ; i + + )
{
2020-05-18 14:03:01 +02:00
dst [ id + i ] = gSummaryScreenWindow_Tilemap [ i + 20 ] + palette ;
dst [ id + i + 0x20 ] = gSummaryScreenWindow_Tilemap [ i + 40 ] + palette ;
dst [ id + i + 0x40 ] = gSummaryScreenWindow_Tilemap [ i + 40 ] + palette ;
2017-10-09 19:17:13 +02:00
}
}
2017-10-09 22:49:14 +02:00
}
2018-08-15 06:56:11 +02:00
2019-02-19 10:09:42 +01:00
static void DrawPokerusCuredSymbol ( struct Pokemon * mon ) // This checks if the mon has been cured of pokerus
2017-10-09 22:49:14 +02:00
{
2019-02-19 10:09:42 +01:00
if ( ! CheckPartyPokerus ( mon , 0 ) & & CheckPartyHasHadPokerus ( mon , 0 ) ) // If yes it draws the cured symbol
2017-10-09 22:49:14 +02:00
{
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] [ 0x223 ] = 0x2C ;
sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 1 ] [ 0x223 ] = 0x2C ;
2017-10-09 22:49:14 +02:00
}
else
{
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 0 ] [ 0x223 ] = 0x81A ;
sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_INFO ] [ 1 ] [ 0x223 ] = 0x81A ;
2017-10-09 22:49:14 +02:00
}
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 3 ) ;
2017-10-09 22:49:14 +02:00
}
2019-09-26 02:49:56 +02:00
static void SetDexNumberColor ( bool8 isMonShiny )
2017-10-09 22:49:14 +02:00
{
2018-08-15 10:44:20 +02:00
if ( ! isMonShiny )
2019-10-26 03:55:01 +02:00
SetBgTilemapPalette ( 3 , 1 , 4 , 8 , 8 , 0 ) ;
2017-10-09 22:49:14 +02:00
else
2019-10-26 03:55:01 +02:00
SetBgTilemapPalette ( 3 , 1 , 4 , 8 , 8 , 5 ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 3 ) ;
2017-10-19 01:25:08 +02:00
}
2018-09-02 14:47:12 +02:00
static void DrawExperienceProgressBar ( struct Pokemon * unused )
2017-10-19 01:25:08 +02:00
{
2018-09-02 14:47:12 +02:00
s64 numExpProgressBarTicks ;
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2020-05-18 14:03:01 +02:00
u16 * dst ;
2017-10-19 01:25:08 +02:00
u8 i ;
2018-10-17 04:47:08 +02:00
if ( summary - > level < MAX_LEVEL )
2017-10-19 01:25:08 +02:00
{
2018-09-02 14:47:12 +02:00
u32 expBetweenLevels = gExperienceTables [ gBaseStats [ summary - > species ] . growthRate ] [ summary - > level + 1 ] - gExperienceTables [ gBaseStats [ summary - > species ] . growthRate ] [ summary - > level ] ;
u32 expSinceLastLevel = summary - > exp - gExperienceTables [ gBaseStats [ summary - > species ] . growthRate ] [ summary - > level ] ;
2017-10-19 01:25:08 +02:00
2018-09-02 14:47:12 +02:00
// Calculate the number of 1-pixel "ticks" to illuminate in the experience progress bar.
// There are 8 tiles that make up the bar, and each tile has 8 "ticks". Hence, the numerator
// is multiplied by 64.
numExpProgressBarTicks = expSinceLastLevel * 64 / expBetweenLevels ;
if ( numExpProgressBarTicks = = 0 & & expSinceLastLevel ! = 0 )
numExpProgressBarTicks = 1 ;
2017-10-19 01:25:08 +02:00
}
else
{
2018-09-02 14:47:12 +02:00
numExpProgressBarTicks = 0 ;
2017-10-19 01:25:08 +02:00
}
2020-05-18 14:03:01 +02:00
dst = & sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_SKILLS ] [ 1 ] [ 0x255 ] ;
2017-10-19 01:25:08 +02:00
for ( i = 0 ; i < 8 ; i + + )
{
2018-09-02 14:47:12 +02:00
if ( numExpProgressBarTicks > 7 )
2020-05-18 14:03:01 +02:00
dst [ i ] = 0x206A ;
2017-10-19 01:25:08 +02:00
else
2020-05-18 14:03:01 +02:00
dst [ i ] = 0x2062 + ( numExpProgressBarTicks % 8 ) ;
2018-09-02 14:47:12 +02:00
numExpProgressBarTicks - = 8 ;
if ( numExpProgressBarTicks < 0 )
numExpProgressBarTicks = 0 ;
2017-10-19 01:25:08 +02:00
}
2019-03-08 09:12:08 +01:00
if ( GetBgTilemapBuffer ( 1 ) = = sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_SKILLS ] [ 0 ] )
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 1 ) ;
2017-10-19 01:25:08 +02:00
else
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 2 ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-02 23:14:04 +01:00
static void DrawContestMoveHearts ( u16 move )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
u16 * tilemap = sMonSummaryScreen - > bgTilemapBuffers [ PSS_PAGE_CONTEST_MOVES ] [ 1 ] ;
2017-10-19 01:25:08 +02:00
u8 i ;
2018-08-15 10:44:20 +02:00
2017-10-19 01:25:08 +02:00
if ( move ! = MOVE_NONE )
{
2020-05-18 14:03:01 +02:00
u8 effectValue = gContestEffects [ gContestMoves [ move ] . effect ] . appeal ;
2018-12-05 15:31:01 +01:00
if ( effectValue ! = 0xFF )
2018-08-15 10:44:20 +02:00
effectValue / = 10 ;
2018-08-16 22:53:01 +02:00
2018-08-15 10:44:20 +02:00
for ( i = 0 ; i < 8 ; i + + )
2017-10-19 01:25:08 +02:00
{
2018-12-05 15:31:01 +01:00
if ( effectValue ! = 0xFF & & i < effectValue )
2018-08-15 10:44:20 +02:00
tilemap [ ( i / 4 * 32 ) + ( i & 3 ) + 0x1E6 ] = 0x103A ;
2017-10-19 01:25:08 +02:00
else
2018-08-15 10:44:20 +02:00
tilemap [ ( i / 4 * 32 ) + ( i & 3 ) + 0x1E6 ] = 0x1039 ;
2017-10-19 01:25:08 +02:00
}
2018-08-15 10:44:20 +02:00
effectValue = gContestEffects [ gContestMoves [ move ] . effect ] . jam ;
2018-12-05 15:31:01 +01:00
if ( effectValue ! = 0xFF )
2018-08-15 10:44:20 +02:00
effectValue / = 10 ;
2018-08-16 22:53:01 +02:00
2018-08-15 10:44:20 +02:00
for ( i = 0 ; i < 8 ; i + + )
2017-10-19 01:25:08 +02:00
{
2018-12-05 15:31:01 +01:00
if ( effectValue ! = 0xFF & & i < effectValue )
2018-08-15 10:44:20 +02:00
tilemap [ ( i / 4 * 32 ) + ( i & 3 ) + 0x226 ] = 0x103C ;
2017-10-19 01:25:08 +02:00
else
2018-08-15 10:44:20 +02:00
tilemap [ ( i / 4 * 32 ) + ( i & 3 ) + 0x226 ] = 0x103D ;
2017-10-19 01:25:08 +02:00
}
}
}
2019-02-19 10:09:42 +01:00
static void LimitEggSummaryPageDisplay ( void ) // If the pokemon is an egg, limit the number of pages displayed to 1
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . isEgg )
2017-10-19 01:25:08 +02:00
ChangeBgX ( 3 , 0x10000 , 0 ) ;
else
ChangeBgX ( 3 , 0 , 0 ) ;
}
2019-02-04 13:44:09 +01:00
static void ResetWindows ( void )
2017-10-19 01:25:08 +02:00
{
u8 i ;
2020-05-18 14:03:01 +02:00
2019-02-19 10:09:42 +01:00
InitWindows ( sSummaryTemplate ) ;
2017-10-19 01:25:08 +02:00
DeactivateAllTextPrinters ( ) ;
2020-05-25 10:19:18 +02:00
for ( i = 0 ; i < PSS_LABEL_WINDOW_END ; i + + )
2019-03-02 23:25:39 +01:00
FillWindowPixelBuffer ( i , PIXEL_FILL ( 0 ) ) ;
2019-03-08 09:12:08 +01:00
for ( i = 0 ; i < ARRAY_COUNT ( sMonSummaryScreen - > windowIds ) ; i + + )
sMonSummaryScreen - > windowIds [ i ] = 0xFF ;
2017-10-19 01:25:08 +02:00
}
2020-05-18 14:03:01 +02:00
static void PrintTextOnWindow ( u8 windowId , const u8 * string , u8 x , u8 y , u8 lineSpacing , u8 colorId )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
AddTextPrinterParameterized4 ( windowId , 1 , x , y , 0 , lineSpacing , sTextColors [ colorId ] , 0 , string ) ;
2017-10-19 01:25:08 +02:00
}
2019-09-26 02:49:56 +02:00
static void PrintMonInfo ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-03 22:58:54 +01:00
FillWindowPixelBuffer ( PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER , PIXEL_FILL ( 0 ) ) ;
FillWindowPixelBuffer ( PSS_LABEL_WINDOW_PORTRAIT_NICKNAME , PIXEL_FILL ( 0 ) ) ;
FillWindowPixelBuffer ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES , PIXEL_FILL ( 0 ) ) ;
2019-03-08 09:12:08 +01:00
if ( ! sMonSummaryScreen - > summary . isEgg )
2019-09-26 02:49:56 +02:00
PrintNotEggInfo ( ) ;
2017-10-19 01:25:08 +02:00
else
2019-09-26 02:49:56 +02:00
PrintEggInfo ( ) ;
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2017-10-19 01:25:08 +02:00
}
2019-09-26 02:49:56 +02:00
static void PrintNotEggInfo ( void )
2017-10-19 01:25:08 +02:00
{
u8 strArray [ 16 ] ;
2019-03-08 09:12:08 +01:00
struct Pokemon * mon = & sMonSummaryScreen - > currentMon ;
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-08-15 10:44:20 +02:00
u16 dexNum = SpeciesToPokedexNum ( summary - > species ) ;
2020-05-18 14:03:01 +02:00
2018-12-05 15:31:01 +01:00
if ( dexNum ! = 0xFFFF )
2017-10-19 01:25:08 +02:00
{
2019-12-10 19:48:20 +01:00
StringCopy ( gStringVar1 , & gText_NumberClear01 [ 0 ] ) ;
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar2 , dexNum , STR_CONV_MODE_LEADING_ZEROS , 3 ) ;
2017-10-19 01:25:08 +02:00
StringAppend ( gStringVar1 , gStringVar2 ) ;
2018-08-15 10:44:20 +02:00
if ( ! IsMonShiny ( mon ) )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER , gStringVar1 , 0 , 1 , 0 , 1 ) ;
2019-09-26 02:49:56 +02:00
SetDexNumberColor ( FALSE ) ;
2017-10-19 01:25:08 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER , gStringVar1 , 0 , 1 , 0 , 7 ) ;
2019-09-26 02:49:56 +02:00
SetDexNumberColor ( TRUE ) ;
2017-10-19 01:25:08 +02:00
}
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER ) ;
2017-10-19 01:25:08 +02:00
}
else
{
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER ) ;
2018-08-15 10:44:20 +02:00
if ( ! IsMonShiny ( mon ) )
2019-09-26 02:49:56 +02:00
SetDexNumberColor ( FALSE ) ;
2017-10-19 01:25:08 +02:00
else
2019-09-26 02:49:56 +02:00
SetDexNumberColor ( TRUE ) ;
2017-10-19 01:25:08 +02:00
}
2020-05-18 14:03:01 +02:00
StringCopy ( gStringVar1 , gText_LevelSymbol ) ;
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar2 , summary - > level , STR_CONV_MODE_LEFT_ALIGN , 3 ) ;
2017-10-19 01:25:08 +02:00
StringAppend ( gStringVar1 , gStringVar2 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES , gStringVar1 , 24 , 17 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
GetMonNickname ( mon , gStringVar1 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_NICKNAME , gStringVar1 , 0 , 1 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
strArray [ 0 ] = CHAR_SLASH ;
StringCopy ( & strArray [ 1 ] , & gSpeciesNames [ summary - > species2 ] [ 0 ] ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES , strArray , 0 , 1 , 0 , 1 ) ;
2019-09-26 02:49:56 +02:00
PrintGenderSymbol ( mon , summary - > species2 ) ;
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_NICKNAME ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2017-10-19 01:25:08 +02:00
}
2019-09-26 02:49:56 +02:00
static void PrintEggInfo ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
GetMonNickname ( & sMonSummaryScreen - > currentMon , gStringVar1 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_NICKNAME , gStringVar1 , 0 , 1 , 0 , 1 ) ;
2019-03-03 22:50:51 +01:00
PutWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_NICKNAME ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES ) ;
2017-10-19 01:25:08 +02:00
}
2019-09-26 02:49:56 +02:00
static void PrintGenderSymbol ( struct Pokemon * mon , u16 species )
2017-10-19 01:25:08 +02:00
{
2018-08-16 00:58:41 +02:00
if ( species ! = SPECIES_NIDORAN_M & & species ! = SPECIES_NIDORAN_F )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
switch ( GetMonGender ( mon ) )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
case MON_MALE :
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES , gText_MaleSymbol , 57 , 17 , 0 , 3 ) ;
break ;
case MON_FEMALE :
PrintTextOnWindow ( PSS_LABEL_WINDOW_PORTRAIT_SPECIES , gText_FemaleSymbol , 57 , 17 , 0 , 4 ) ;
break ;
2017-10-19 01:25:08 +02:00
}
}
}
2018-08-16 00:58:41 +02:00
static void PrintAOrBButtonIcon ( u8 windowId , bool8 bButton , u32 x )
2018-08-15 10:44:20 +02:00
{
2019-02-19 10:09:42 +01:00
// sSummaryBButtonBitmap - 0x80 = sSummaryAButtonBitmap
BlitBitmapToWindow ( windowId , ( bButton ) ? sSummaryBButtonBitmap : sSummaryBButtonBitmap - 0x80 , x , 0 , 16 , 16 ) ;
2018-08-15 10:44:20 +02:00
}
2020-05-18 14:03:01 +02:00
static void PrintPageNamesAndStats ( void )
2018-08-15 10:44:20 +02:00
{
int stringXPos ;
int iconXPos ;
int statsXPos ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_INFO_TITLE , gText_PkmnInfo , 2 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE , gText_PkmnSkills , 2 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE , gText_BattleMoves , 2 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE , gText_ContestMoves , 2 , 1 , 0 , 1 ) ;
2018-08-15 10:44:20 +02:00
2018-08-15 20:47:10 +02:00
stringXPos = GetStringRightAlignXOffset ( 1 , gText_Cancel2 , 62 ) ;
2018-08-15 10:44:20 +02:00
iconXPos = stringXPos - 16 ;
if ( iconXPos < 0 )
iconXPos = 0 ;
2019-03-03 22:50:51 +01:00
PrintAOrBButtonIcon ( PSS_LABEL_WINDOW_PROMPT_CANCEL , FALSE , iconXPos ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PROMPT_CANCEL , gText_Cancel2 , stringXPos , 1 , 0 , 0 ) ;
2018-08-16 22:53:01 +02:00
2020-05-18 14:03:01 +02:00
stringXPos = GetStringRightAlignXOffset ( 1 , gText_Info , 62 ) ;
2018-08-15 10:44:20 +02:00
iconXPos = stringXPos - 16 ;
if ( iconXPos < 0 )
iconXPos = 0 ;
2019-03-03 22:50:51 +01:00
PrintAOrBButtonIcon ( PSS_LABEL_WINDOW_PROMPT_INFO , FALSE , iconXPos ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PROMPT_INFO , gText_Info , stringXPos , 1 , 0 , 0 ) ;
2018-08-16 22:53:01 +02:00
2020-05-18 14:03:01 +02:00
stringXPos = GetStringRightAlignXOffset ( 1 , gText_Switch , 62 ) ;
2018-08-15 10:44:20 +02:00
iconXPos = stringXPos - 16 ;
if ( iconXPos < 0 )
iconXPos = 0 ;
2019-03-03 22:50:51 +01:00
PrintAOrBButtonIcon ( PSS_LABEL_WINDOW_PROMPT_SWITCH , FALSE , iconXPos ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_PROMPT_SWITCH , gText_Switch , stringXPos , 1 , 0 , 0 ) ;
2018-08-16 22:53:01 +02:00
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL , gText_RentalPkmn , 0 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_INFO_TYPE , gText_TypeSlash , 0 , 1 , 0 , 0 ) ;
2018-08-15 10:44:20 +02:00
statsXPos = 6 + GetStringCenterAlignXOffset ( 1 , gText_HP4 , 42 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT , gText_HP4 , statsXPos , 1 , 0 , 1 ) ;
2018-08-15 10:44:20 +02:00
statsXPos = 6 + GetStringCenterAlignXOffset ( 1 , gText_Attack3 , 42 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT , gText_Attack3 , statsXPos , 17 , 0 , 1 ) ;
2018-08-15 10:44:20 +02:00
statsXPos = 6 + GetStringCenterAlignXOffset ( 1 , gText_Defense3 , 42 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT , gText_Defense3 , statsXPos , 33 , 0 , 1 ) ;
2018-08-15 10:44:20 +02:00
statsXPos = 2 + GetStringCenterAlignXOffset ( 1 , gText_SpAtk4 , 36 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT , gText_SpAtk4 , statsXPos , 1 , 0 , 1 ) ;
2018-08-15 10:44:20 +02:00
statsXPos = 2 + GetStringCenterAlignXOffset ( 1 , gText_SpDef4 , 36 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT , gText_SpDef4 , statsXPos , 17 , 0 , 1 ) ;
2018-08-15 10:44:20 +02:00
statsXPos = 2 + GetStringCenterAlignXOffset ( 1 , gText_Speed2 , 36 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT , gText_Speed2 , statsXPos , 33 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP , gText_ExpPoints , 6 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP , gText_NextLv , 6 , 17 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS , gText_Status , 2 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_MOVES_POWER_ACC , gText_Power , 0 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_MOVES_POWER_ACC , gText_Accuracy2 , 0 , 17 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM , gText_Appeal , 0 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM , gText_Jam , 0 , 17 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
}
2020-05-18 14:03:01 +02:00
static void PutPageWindowTilemaps ( u8 page )
2017-10-19 01:25:08 +02:00
{
u8 i ;
2018-08-15 20:47:10 +02:00
2019-03-03 22:50:51 +01:00
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_INFO_TITLE ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE ) ;
2018-08-15 20:47:10 +02:00
2019-02-04 13:44:09 +01:00
switch ( page )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
case PSS_PAGE_INFO :
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_INFO_TITLE ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_CANCEL ) ;
if ( InBattleFactory ( ) = = TRUE | | InSlateportBattleTent ( ) = = TRUE )
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_INFO_TYPE ) ;
break ;
case PSS_PAGE_SKILLS :
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_TITLE ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT ) ;
PutWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP ) ;
break ;
case PSS_PAGE_BATTLE_MOVES :
PutWindowTilemap ( PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE ) ;
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
{
if ( sMonSummaryScreen - > newMove ! = MOVE_NONE | | sMonSummaryScreen - > firstMoveIndex ! = MAX_MON_MOVES )
PutWindowTilemap ( PSS_LABEL_WINDOW_MOVES_POWER_ACC ) ;
}
else
{
PutWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_INFO ) ;
}
break ;
case PSS_PAGE_CONTEST_MOVES :
PutWindowTilemap ( PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE ) ;
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
{
if ( sMonSummaryScreen - > newMove ! = MOVE_NONE | | sMonSummaryScreen - > firstMoveIndex ! = MAX_MON_MOVES )
PutWindowTilemap ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM ) ;
}
else
{
PutWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_INFO ) ;
}
break ;
2017-10-19 01:25:08 +02:00
}
2018-08-15 20:47:10 +02:00
2019-03-08 09:12:08 +01:00
for ( i = 0 ; i < ARRAY_COUNT ( sMonSummaryScreen - > windowIds ) ; i + + )
PutWindowTilemap ( sMonSummaryScreen - > windowIds [ i ] ) ;
2018-08-15 20:47:10 +02:00
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-04 13:44:09 +01:00
static void ClearPageWindowTilemaps ( u8 page )
2017-10-19 01:25:08 +02:00
{
u8 i ;
2020-05-18 14:03:01 +02:00
2019-02-04 13:44:09 +01:00
switch ( page )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
case PSS_PAGE_INFO :
ClearWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_CANCEL ) ;
if ( InBattleFactory ( ) = = TRUE | | InSlateportBattleTent ( ) = = TRUE )
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_INFO_TYPE ) ;
break ;
case PSS_PAGE_SKILLS :
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT ) ;
ClearWindowTilemap ( PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP ) ;
break ;
case PSS_PAGE_BATTLE_MOVES :
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
{
if ( sMonSummaryScreen - > newMove ! = MOVE_NONE | | sMonSummaryScreen - > firstMoveIndex ! = MAX_MON_MOVES )
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_POWER_ACC ) ;
}
else
{
ClearWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_INFO ) ;
}
break ;
case PSS_PAGE_CONTEST_MOVES :
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
{
if ( sMonSummaryScreen - > newMove ! = MOVE_NONE | | sMonSummaryScreen - > firstMoveIndex ! = MAX_MON_MOVES )
ClearWindowTilemap ( PSS_LABEL_WINDOW_MOVES_APPEAL_JAM ) ;
}
else
{
ClearWindowTilemap ( PSS_LABEL_WINDOW_PROMPT_INFO ) ;
}
break ;
2017-10-19 01:25:08 +02:00
}
2018-08-15 20:47:10 +02:00
2019-03-08 09:12:08 +01:00
for ( i = 0 ; i < ARRAY_COUNT ( sMonSummaryScreen - > windowIds ) ; i + + )
2020-05-18 14:03:01 +02:00
RemoveWindowByIndex ( i ) ;
2018-08-15 20:47:10 +02:00
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static u8 AddWindowFromTemplateList ( const struct WindowTemplate * template , u8 templateId )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
u8 * windowIdPtr = & sMonSummaryScreen - > windowIds [ templateId ] ;
2018-12-05 15:31:01 +01:00
if ( * windowIdPtr = = 0xFF )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
* windowIdPtr = AddWindow ( & template [ templateId ] ) ;
2019-03-02 23:25:39 +01:00
FillWindowPixelBuffer ( * windowIdPtr , PIXEL_FILL ( 0 ) ) ;
2017-10-19 01:25:08 +02:00
}
2018-04-12 19:06:07 +02:00
return * windowIdPtr ;
2017-10-19 01:25:08 +02:00
}
2020-05-18 14:03:01 +02:00
static void RemoveWindowByIndex ( u8 windowIndex )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
u8 * windowIdPtr = & sMonSummaryScreen - > windowIds [ windowIndex ] ;
2018-12-05 15:31:01 +01:00
if ( * windowIdPtr ! = 0xFF )
2017-10-19 01:25:08 +02:00
{
2018-04-12 19:06:07 +02:00
ClearWindowTilemap ( * windowIdPtr ) ;
RemoveWindow ( * windowIdPtr ) ;
2018-12-05 15:31:01 +01:00
* windowIdPtr = 0xFF ;
2017-10-19 01:25:08 +02:00
}
}
2019-02-04 12:38:44 +01:00
static void PrintPageSpecificText ( u8 pageIndex )
2017-10-19 01:25:08 +02:00
{
u16 i ;
2019-03-08 09:12:08 +01:00
for ( i = 0 ; i < ARRAY_COUNT ( sMonSummaryScreen - > windowIds ) ; i + + )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > windowIds [ i ] ! = 0xFF )
FillWindowPixelBuffer ( sMonSummaryScreen - > windowIds [ i ] , PIXEL_FILL ( 0 ) ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-04 12:38:44 +01:00
sTextPrinterFunctions [ pageIndex ] ( ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-04 12:38:44 +01:00
static void CreateTextPrinterTask ( u8 pageIndex )
2017-10-19 01:25:08 +02:00
{
2019-02-04 12:38:44 +01:00
CreateTask ( sTextPrinterTasks [ pageIndex ] , 16 ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-04 12:38:44 +01:00
static void PrintInfoPageText ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . isEgg )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
PrintEggOTName ( ) ;
PrintEggOTID ( ) ;
PrintEggState ( ) ;
PrintEggMemo ( ) ;
2017-10-19 01:25:08 +02:00
}
else
{
2018-08-15 10:44:20 +02:00
PrintMonOTName ( ) ;
PrintMonOTID ( ) ;
PrintMonAbilityName ( ) ;
PrintMonAbilityDescription ( ) ;
BufferMonTrainerMemo ( ) ;
PrintMonTrainerMemo ( ) ;
2017-10-19 01:25:08 +02:00
}
}
2019-02-04 13:44:09 +01:00
static void Task_PrintInfoPage ( u8 taskId )
2017-10-19 01:25:08 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2018-08-15 10:44:20 +02:00
switch ( data [ 0 ] )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
case 1 :
PrintMonOTName ( ) ;
break ;
case 2 :
PrintMonOTID ( ) ;
break ;
case 3 :
PrintMonAbilityName ( ) ;
break ;
case 4 :
PrintMonAbilityDescription ( ) ;
break ;
case 5 :
BufferMonTrainerMemo ( ) ;
break ;
case 6 :
PrintMonTrainerMemo ( ) ;
break ;
case 7 :
DestroyTask ( taskId ) ;
return ;
2017-10-19 01:25:08 +02:00
}
data [ 0 ] + + ;
}
2018-08-16 00:58:41 +02:00
static void PrintMonOTName ( void )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
int x , windowId ;
2019-03-03 22:50:51 +01:00
if ( InBattleFactory ( ) ! = TRUE & & InSlateportBattleTent ( ) ! = TRUE )
2017-10-19 01:25:08 +02:00
{
2019-03-03 22:50:51 +01:00
windowId = AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , gText_OTSlash , 0 , 1 , 0 , 1 ) ;
2018-08-15 10:44:20 +02:00
x = GetStringWidth ( 1 , gText_OTSlash , 0 ) ;
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . OTGender = = 0 )
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , sMonSummaryScreen - > summary . OTName , x , 1 , 0 , 5 ) ;
2017-10-19 01:25:08 +02:00
else
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , sMonSummaryScreen - > summary . OTName , x , 1 , 0 , 6 ) ;
2017-10-19 01:25:08 +02:00
}
}
2018-08-16 00:58:41 +02:00
static void PrintMonOTID ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
int xPos ;
2019-03-03 22:50:51 +01:00
if ( InBattleFactory ( ) ! = TRUE & & InSlateportBattleTent ( ) ! = TRUE )
2017-10-19 01:25:08 +02:00
{
2019-12-10 19:48:20 +01:00
ConvertIntToDecimalStringN ( StringCopy ( gStringVar1 , gText_IDNumber2 ) , ( u16 ) sMonSummaryScreen - > summary . OTID , STR_CONV_MODE_LEADING_ZEROS , 5 ) ;
2018-08-15 10:44:20 +02:00
xPos = GetStringRightAlignXOffset ( 1 , gStringVar1 , 56 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_ID ) , gStringVar1 , xPos , 1 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
}
}
2018-08-16 00:58:41 +02:00
static void PrintMonAbilityName ( void )
2017-10-19 01:25:08 +02:00
{
2019-05-14 15:22:16 +02:00
u8 ability = GetAbilityBySpecies ( sMonSummaryScreen - > summary . species , sMonSummaryScreen - > summary . abilityNum ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_ABILITY ) , gAbilityNames [ ability ] , 0 , 1 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintMonAbilityDescription ( void )
2017-10-19 01:25:08 +02:00
{
2019-05-14 15:22:16 +02:00
u8 ability = GetAbilityBySpecies ( sMonSummaryScreen - > summary . species , sMonSummaryScreen - > summary . abilityNum ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_ABILITY ) , gAbilityDescriptionPointers [ ability ] , 0 , 17 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void BufferMonTrainerMemo ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2018-08-15 06:56:11 +02:00
const u8 * text ;
2018-08-16 22:53:01 +02:00
2018-07-25 06:18:23 +02:00
DynamicPlaceholderTextUtil_Reset ( ) ;
2019-02-19 10:09:42 +01:00
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 0 , sMemoNatureTextColor ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 1 , sMemoMiscTextColor ) ;
2018-08-15 10:44:20 +02:00
BufferNatureString ( ) ;
2019-03-03 22:50:51 +01:00
if ( InBattleFactory ( ) = = TRUE | | InSlateportBattleTent ( ) = = TRUE | | IsInGamePartnerMon ( ) = = TRUE )
2018-08-15 10:44:20 +02:00
{
2018-07-25 06:18:23 +02:00
DynamicPlaceholderTextUtil_ExpandPlaceholders ( gStringVar4 , gText_XNature ) ;
2018-08-15 10:44:20 +02:00
}
2017-10-19 01:25:08 +02:00
else
{
2018-08-15 10:44:20 +02:00
u8 * metLevelString = Alloc ( 32 ) ;
u8 * metLocationString = Alloc ( 32 ) ;
GetMetLevelString ( metLevelString ) ;
if ( sum - > metLocation < MAPSEC_NONE )
2017-10-19 01:25:08 +02:00
{
2020-02-05 08:47:32 +01:00
GetMapNameHandleAquaHideout ( metLocationString , sum - > metLocation ) ;
2018-08-15 10:44:20 +02:00
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 4 , metLocationString ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-15 10:44:20 +02:00
if ( DoesMonOTMatchOwner ( ) = = TRUE )
2017-10-19 01:25:08 +02:00
{
if ( sum - > metLevel = = 0 )
2018-08-15 10:44:20 +02:00
text = ( sum - > metLocation > = MAPSEC_NONE ) ? gText_XNatureHatchedSomewhereAt : gText_XNatureHatchedAtYZ ;
2017-10-19 01:25:08 +02:00
else
2018-08-15 10:44:20 +02:00
text = ( sum - > metLocation > = MAPSEC_NONE ) ? gText_XNatureMetSomewhereAt : gText_XNatureMetAtYZ ;
2017-10-19 01:25:08 +02:00
}
2019-01-08 20:40:11 +01:00
else if ( sum - > metLocation = = METLOC_FATEFUL_ENCOUNTER )
2018-08-15 10:44:20 +02:00
{
2017-10-19 01:25:08 +02:00
text = gText_XNatureFatefulEncounter ;
2018-08-15 10:44:20 +02:00
}
2019-01-08 20:40:11 +01:00
else if ( sum - > metLocation ! = METLOC_IN_GAME_TRADE & & DidMonComeFromGBAGames ( ) )
2018-08-15 10:44:20 +02:00
{
text = ( sum - > metLocation > = MAPSEC_NONE ) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt ;
}
2017-10-19 01:25:08 +02:00
else
2018-08-15 10:44:20 +02:00
{
2017-10-19 01:25:08 +02:00
text = gText_XNatureObtainedInTrade ;
2018-08-15 10:44:20 +02:00
}
2018-07-25 06:18:23 +02:00
DynamicPlaceholderTextUtil_ExpandPlaceholders ( gStringVar4 , text ) ;
2018-08-15 10:44:20 +02:00
Free ( metLevelString ) ;
Free ( metLocationString ) ;
2017-10-19 01:25:08 +02:00
}
}
2018-08-16 00:58:41 +02:00
static void PrintMonTrainerMemo ( void )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_MEMO ) , gStringVar4 , 0 , 1 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void BufferNatureString ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokemonSummaryScreenData * sumStruct = sMonSummaryScreen ;
2018-07-25 06:18:23 +02:00
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 2 , gNatureNamePointers [ sumStruct - > summary . nature ] ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 5 , gText_EmptyString5 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void GetMetLevelString ( u8 * output )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
u8 level = sMonSummaryScreen - > summary . metLevel ;
2017-10-19 01:25:08 +02:00
if ( level = = 0 )
2018-03-06 13:29:10 +01:00
level = EGG_HATCH_LEVEL ;
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( output , level , STR_CONV_MODE_LEFT_ALIGN , 3 ) ;
2018-08-15 10:44:20 +02:00
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 3 , output ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static bool8 DoesMonOTMatchOwner ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2018-08-15 10:44:20 +02:00
u32 trainerId ;
u8 gender ;
2018-08-15 06:56:11 +02:00
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > monList . mons = = gEnemyParty )
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
u8 multiID = GetMultiplayerId ( ) ^ 1 ;
2020-05-18 14:03:01 +02:00
trainerId = gLinkPlayers [ multiID ] . trainerId & 0xFFFF ;
2018-08-15 10:44:20 +02:00
gender = gLinkPlayers [ multiID ] . gender ;
2017-10-19 01:25:08 +02:00
StringCopy ( gStringVar1 , gLinkPlayers [ multiID ] . name ) ;
}
else
{
2018-08-15 10:44:20 +02:00
trainerId = GetPlayerIDAsU32 ( ) & 0xFFFF ;
gender = gSaveBlock2Ptr - > playerGender ;
2017-10-19 01:25:08 +02:00
StringCopy ( gStringVar1 , gSaveBlock2Ptr - > playerName ) ;
}
2020-05-18 14:03:01 +02:00
2018-08-15 10:44:20 +02:00
if ( gender ! = sum - > OTGender | | trainerId ! = ( sum - > OTID & 0xFFFF ) | | StringCompareWithoutExtCtrlCodes ( gStringVar1 , sum - > OTName ) )
return FALSE ;
2020-05-18 14:03:01 +02:00
else
return TRUE ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static bool8 DidMonComeFromGBAGames ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2018-08-15 10:44:20 +02:00
if ( sum - > metGame > 0 & & sum - > metGame < = VERSION_LEAF_GREEN )
2017-10-22 21:01:34 +02:00
return TRUE ;
return FALSE ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
bool8 DidMonComeFromRSE ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2018-08-15 10:44:20 +02:00
if ( sum - > metGame > 0 & & sum - > metGame < = VERSION_EMERALD )
2017-10-22 21:01:34 +02:00
return TRUE ;
return FALSE ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static bool8 IsInGamePartnerMon ( void )
2017-10-19 01:25:08 +02:00
{
if ( ( gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER ) & & gMain . inBattle )
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > curMonIndex = = 1 | | sMonSummaryScreen - > curMonIndex = = 4 | | sMonSummaryScreen - > curMonIndex = = 5 )
2017-10-22 21:01:34 +02:00
return TRUE ;
2017-10-19 01:25:08 +02:00
}
2017-10-22 21:01:34 +02:00
return FALSE ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintEggOTName ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-03 22:50:51 +01:00
u32 windowId = AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER ) ;
2018-08-15 06:56:11 +02:00
u32 width = GetStringWidth ( 1 , gText_OTSlash , 0 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , gText_OTSlash , 0 , 1 , 0 , 1 ) ;
PrintTextOnWindow ( windowId , gText_FiveMarks , width , 1 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintEggOTID ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
int x ;
2019-12-10 19:48:20 +01:00
StringCopy ( gStringVar1 , gText_IDNumber2 ) ;
2017-10-19 01:25:08 +02:00
StringAppend ( gStringVar1 , gText_FiveMarks ) ;
2018-08-15 10:44:20 +02:00
x = GetStringRightAlignXOffset ( 1 , gStringVar1 , 56 ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_ID ) , gStringVar1 , x , 1 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintEggState ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 * text ;
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2018-08-15 10:44:20 +02:00
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . sanity = = TRUE )
2017-10-19 01:25:08 +02:00
text = gText_EggWillTakeALongTime ;
else if ( sum - > friendship < = 5 )
text = gText_EggAboutToHatch ;
else if ( sum - > friendship < = 10 )
text = gText_EggWillHatchSoon ;
else if ( sum - > friendship < = 40 )
text = gText_EggWillTakeSomeTime ;
else
text = gText_EggWillTakeALongTime ;
2018-08-16 22:53:01 +02:00
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_ABILITY ) , text , 0 , 1 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintEggMemo ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 * text ;
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2018-08-15 10:44:20 +02:00
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . sanity ! = 1 )
2017-10-19 01:25:08 +02:00
{
2019-01-08 20:40:11 +01:00
if ( sum - > metLocation = = METLOC_FATEFUL_ENCOUNTER )
2017-10-19 01:25:08 +02:00
text = gText_PeculiarEggNicePlace ;
2018-08-16 00:58:41 +02:00
else if ( DidMonComeFromGBAGames ( ) = = FALSE | | DoesMonOTMatchOwner ( ) = = FALSE )
2017-10-19 01:25:08 +02:00
text = gText_PeculiarEggTrade ;
2019-01-08 20:40:11 +01:00
else if ( sum - > metLocation = = METLOC_SPECIAL_EGG )
2018-08-16 00:58:41 +02:00
text = ( DidMonComeFromRSE ( ) = = TRUE ) ? gText_EggFromHotSprings : gText_EggFromTraveler ;
2017-10-19 01:25:08 +02:00
else
text = gText_OddEggFoundByCouple ;
}
else
2018-08-15 10:44:20 +02:00
{
2017-10-19 01:25:08 +02:00
text = gText_OddEggFoundByCouple ;
2018-08-15 10:44:20 +02:00
}
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageInfoTemplate , PSS_DATA_WINDOW_INFO_MEMO ) , text , 0 , 1 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-04 12:38:44 +01:00
static void PrintSkillsPageText ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
PrintHeldItemName ( ) ;
PrintRibbonCount ( ) ;
BufferLeftColumnStats ( ) ;
PrintLeftColumnStats ( ) ;
BufferRightColumnStats ( ) ;
PrintRightColumnStats ( ) ;
PrintExpPointsNextLevel ( ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-04 13:44:09 +01:00
static void Task_PrintSkillsPage ( u8 taskId )
2017-10-19 01:25:08 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2018-08-15 10:44:20 +02:00
switch ( data [ 0 ] )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
case 1 :
PrintHeldItemName ( ) ;
break ;
case 2 :
PrintRibbonCount ( ) ;
break ;
case 3 :
BufferLeftColumnStats ( ) ;
break ;
case 4 :
PrintLeftColumnStats ( ) ;
break ;
case 5 :
BufferRightColumnStats ( ) ;
break ;
case 6 :
PrintRightColumnStats ( ) ;
break ;
case 7 :
PrintExpPointsNextLevel ( ) ;
break ;
case 8 :
DestroyTask ( taskId ) ;
return ;
2017-10-19 01:25:08 +02:00
}
data [ 0 ] + + ;
}
2018-08-16 00:58:41 +02:00
static void PrintHeldItemName ( void )
2017-10-19 01:25:08 +02:00
{
2018-04-29 13:36:26 +02:00
const u8 * text ;
2020-05-25 10:19:18 +02:00
int x ;
2018-08-15 10:44:20 +02:00
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > summary . item = = ITEM_ENIGMA_BERRY
& & IsMultiBattle ( ) = = TRUE
& & ( sMonSummaryScreen - > curMonIndex = = 1 | | sMonSummaryScreen - > curMonIndex = = 4 | | sMonSummaryScreen - > curMonIndex = = 5 ) )
2017-10-19 01:25:08 +02:00
{
2018-04-29 13:36:26 +02:00
text = ItemId_GetName ( ITEM_ENIGMA_BERRY ) ;
2017-10-19 01:25:08 +02:00
}
2019-03-08 09:12:08 +01:00
else if ( sMonSummaryScreen - > summary . item = = ITEM_NONE )
2018-08-15 10:44:20 +02:00
{
2017-10-19 01:25:08 +02:00
text = gText_None ;
2018-08-15 10:44:20 +02:00
}
2017-10-19 01:25:08 +02:00
else
{
2019-03-08 09:12:08 +01:00
CopyItemName ( sMonSummaryScreen - > summary . item , gStringVar1 ) ;
2017-10-19 01:25:08 +02:00
text = gStringVar1 ;
}
2018-08-15 10:44:20 +02:00
2020-05-25 10:19:18 +02:00
x = GetStringCenterAlignXOffset ( 1 , text , 72 ) + 6 ;
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageSkillsTemplate , PSS_DATA_WINDOW_SKILLS_HELD_ITEM ) , text , x , 1 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintRibbonCount ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 * text ;
2020-05-25 10:19:18 +02:00
int x ;
2018-08-15 10:44:20 +02:00
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > summary . ribbonCount = = 0 )
2018-08-15 10:44:20 +02:00
{
2017-10-19 01:25:08 +02:00
text = gText_None ;
2018-08-15 10:44:20 +02:00
}
2017-10-19 01:25:08 +02:00
else
{
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar1 , sMonSummaryScreen - > summary . ribbonCount , STR_CONV_MODE_RIGHT_ALIGN , 2 ) ;
2017-10-19 01:25:08 +02:00
StringExpandPlaceholders ( gStringVar4 , gText_RibbonsVar1 ) ;
text = gStringVar4 ;
}
2018-08-15 10:44:20 +02:00
2020-05-25 10:19:18 +02:00
x = GetStringCenterAlignXOffset ( 1 , text , 70 ) + 6 ;
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageSkillsTemplate , PSS_DATA_WINDOW_SKILLS_RIBBON_COUNT ) , text , x , 1 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void BufferLeftColumnStats ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
u8 * currentHPString = Alloc ( 8 ) ;
u8 * maxHPString = Alloc ( 8 ) ;
u8 * attackString = Alloc ( 8 ) ;
u8 * defenseString = Alloc ( 8 ) ;
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( currentHPString , sMonSummaryScreen - > summary . currentHP , STR_CONV_MODE_RIGHT_ALIGN , 3 ) ;
ConvertIntToDecimalStringN ( maxHPString , sMonSummaryScreen - > summary . maxHP , STR_CONV_MODE_RIGHT_ALIGN , 3 ) ;
ConvertIntToDecimalStringN ( attackString , sMonSummaryScreen - > summary . atk , STR_CONV_MODE_RIGHT_ALIGN , 7 ) ;
ConvertIntToDecimalStringN ( defenseString , sMonSummaryScreen - > summary . def , STR_CONV_MODE_RIGHT_ALIGN , 7 ) ;
2018-08-16 22:53:01 +02:00
2018-07-25 06:18:23 +02:00
DynamicPlaceholderTextUtil_Reset ( ) ;
2018-08-15 10:44:20 +02:00
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 0 , currentHPString ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 1 , maxHPString ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 2 , attackString ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 3 , defenseString ) ;
2019-02-19 10:09:42 +01:00
DynamicPlaceholderTextUtil_ExpandPlaceholders ( gStringVar4 , sStatsLeftColumnLayout ) ;
2018-08-16 22:53:01 +02:00
2018-08-15 10:44:20 +02:00
Free ( currentHPString ) ;
Free ( maxHPString ) ;
Free ( attackString ) ;
Free ( defenseString ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintLeftColumnStats ( void )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageSkillsTemplate , PSS_DATA_WINDOW_SKILLS_STATS_LEFT ) , gStringVar4 , 4 , 1 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void BufferRightColumnStats ( void )
2017-10-19 01:25:08 +02:00
{
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar1 , sMonSummaryScreen - > summary . spatk , STR_CONV_MODE_RIGHT_ALIGN , 3 ) ;
ConvertIntToDecimalStringN ( gStringVar2 , sMonSummaryScreen - > summary . spdef , STR_CONV_MODE_RIGHT_ALIGN , 3 ) ;
ConvertIntToDecimalStringN ( gStringVar3 , sMonSummaryScreen - > summary . speed , STR_CONV_MODE_RIGHT_ALIGN , 3 ) ;
2018-08-16 22:53:01 +02:00
2018-07-25 06:18:23 +02:00
DynamicPlaceholderTextUtil_Reset ( ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 0 , gStringVar1 ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 1 , gStringVar2 ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 2 , gStringVar3 ) ;
2019-02-19 10:09:42 +01:00
DynamicPlaceholderTextUtil_ExpandPlaceholders ( gStringVar4 , sStatsRightColumnLayout ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintRightColumnStats ( void )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( AddWindowFromTemplateList ( sPageSkillsTemplate , PSS_DATA_WINDOW_SKILLS_STATS_RIGHT ) , gStringVar4 , 2 , 1 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintExpPointsNextLevel ( void )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * sum = & sMonSummaryScreen - > summary ;
2019-03-03 22:50:51 +01:00
u8 windowId = AddWindowFromTemplateList ( sPageSkillsTemplate , PSS_DATA_WINDOW_EXP ) ;
2020-05-18 14:03:01 +02:00
int x ;
2017-10-19 01:25:08 +02:00
u32 expToNextLevel ;
2018-08-15 10:44:20 +02:00
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar1 , sum - > exp , STR_CONV_MODE_RIGHT_ALIGN , 7 ) ;
2020-05-18 14:03:01 +02:00
x = GetStringRightAlignXOffset ( 1 , gStringVar1 , 42 ) + 2 ;
PrintTextOnWindow ( windowId , gStringVar1 , x , 1 , 0 , 0 ) ;
2018-08-15 10:44:20 +02:00
2018-10-17 04:47:08 +02:00
if ( sum - > level < MAX_LEVEL )
2017-10-19 01:25:08 +02:00
expToNextLevel = gExperienceTables [ gBaseStats [ sum - > species ] . growthRate ] [ sum - > level + 1 ] - sum - > exp ;
else
expToNextLevel = 0 ;
2018-08-16 22:53:01 +02:00
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar1 , expToNextLevel , STR_CONV_MODE_RIGHT_ALIGN , 6 ) ;
2020-05-18 14:03:01 +02:00
x = GetStringRightAlignXOffset ( 1 , gStringVar1 , 42 ) + 2 ;
PrintTextOnWindow ( windowId , gStringVar1 , x , 17 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
2019-02-04 12:38:44 +01:00
static void PrintBattleMoves ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
PrintMoveNameAndPP ( 0 ) ;
PrintMoveNameAndPP ( 1 ) ;
PrintMoveNameAndPP ( 2 ) ;
PrintMoveNameAndPP ( 3 ) ;
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
PrintNewMoveDetailsOrCancelText ( ) ;
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > firstMoveIndex = = MAX_MON_MOVES )
2017-10-19 01:25:08 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > newMove ! = MOVE_NONE )
PrintMoveDetails ( sMonSummaryScreen - > newMove ) ;
2017-10-19 01:25:08 +02:00
}
else
2018-08-15 10:44:20 +02:00
{
2019-03-08 09:12:08 +01:00
PrintMoveDetails ( sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ) ;
2018-08-15 10:44:20 +02:00
}
2017-10-19 01:25:08 +02:00
}
}
2019-02-04 13:44:09 +01:00
static void Task_PrintBattleMoves ( u8 taskId )
2017-10-19 01:25:08 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2018-08-15 10:44:20 +02:00
switch ( data [ 0 ] )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
case 1 :
PrintMoveNameAndPP ( 0 ) ;
break ;
case 2 :
PrintMoveNameAndPP ( 1 ) ;
break ;
case 3 :
PrintMoveNameAndPP ( 2 ) ;
break ;
case 4 :
PrintMoveNameAndPP ( 3 ) ;
break ;
case 5 :
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
PrintNewMoveDetailsOrCancelText ( ) ;
break ;
case 6 :
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
{
if ( sMonSummaryScreen - > firstMoveIndex = = MAX_MON_MOVES )
data [ 1 ] = sMonSummaryScreen - > newMove ;
else
data [ 1 ] = sMonSummaryScreen - > summary . moves [ sMonSummaryScreen - > firstMoveIndex ] ;
}
break ;
case 7 :
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
{
if ( sMonSummaryScreen - > newMove ! = MOVE_NONE | | sMonSummaryScreen - > firstMoveIndex ! = MAX_MON_MOVES )
PrintMoveDetails ( data [ 1 ] ) ;
}
break ;
case 8 :
DestroyTask ( taskId ) ;
return ;
2017-10-19 01:25:08 +02:00
}
data [ 0 ] + + ;
}
2018-08-16 00:58:41 +02:00
static void PrintMoveNameAndPP ( u8 moveIndex )
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
u8 pp ;
2020-05-18 14:03:01 +02:00
int ppState , x ;
2018-08-15 06:56:11 +02:00
const u8 * text ;
2020-05-18 14:03:01 +02:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2019-03-03 22:50:51 +01:00
u8 moveNameWindowId = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_NAMES ) ;
u8 ppValueWindowId = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_PP ) ;
2020-05-18 14:03:01 +02:00
u16 move = summary - > moves [ moveIndex ] ;
2018-08-15 06:56:11 +02:00
if ( move ! = 0 )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
pp = CalculatePPWithBonus ( move , summary - > ppBonuses , moveIndex ) ;
PrintTextOnWindow ( moveNameWindowId , gMoveNames [ move ] , 0 , moveIndex * 16 + 1 , 0 , 1 ) ;
ConvertIntToDecimalStringN ( gStringVar1 , summary - > pp [ moveIndex ] , STR_CONV_MODE_RIGHT_ALIGN , 2 ) ;
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar2 , pp , STR_CONV_MODE_RIGHT_ALIGN , 2 ) ;
2018-07-25 06:18:23 +02:00
DynamicPlaceholderTextUtil_Reset ( ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 0 , gStringVar1 ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 1 , gStringVar2 ) ;
2019-02-19 10:09:42 +01:00
DynamicPlaceholderTextUtil_ExpandPlaceholders ( gStringVar4 , sMovesPPLayout ) ;
2017-10-19 01:25:08 +02:00
text = gStringVar4 ;
2020-05-18 14:03:01 +02:00
ppState = GetCurrentPpToMaxPpState ( summary - > pp [ moveIndex ] , pp ) + 9 ;
x = GetStringRightAlignXOffset ( 1 , text , 44 ) ;
2017-10-19 01:25:08 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( moveNameWindowId , gText_OneDash , 0 , moveIndex * 16 + 1 , 0 , 1 ) ;
2017-10-19 01:25:08 +02:00
text = gText_TwoDashes ;
2018-08-15 06:56:11 +02:00
ppState = 12 ;
2020-05-18 14:03:01 +02:00
x = GetStringCenterAlignXOffset ( 1 , text , 44 ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-15 10:44:20 +02:00
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( ppValueWindowId , text , x , moveIndex * 16 + 1 , 0 , ppState ) ;
2017-10-19 01:25:08 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintMovePowerAndAccuracy ( u16 moveIndex )
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 * text ;
2018-08-15 10:44:20 +02:00
if ( moveIndex ! = 0 )
2017-10-19 01:25:08 +02:00
{
2019-03-03 22:58:54 +01:00
FillWindowPixelRect ( PSS_LABEL_WINDOW_MOVES_POWER_ACC , PIXEL_FILL ( 0 ) , 53 , 0 , 19 , 32 ) ;
2018-08-15 10:44:20 +02:00
if ( gBattleMoves [ moveIndex ] . power < 2 )
{
2017-10-19 01:25:08 +02:00
text = gText_ThreeDashes ;
2018-08-15 10:44:20 +02:00
}
2017-10-19 01:25:08 +02:00
else
{
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar1 , gBattleMoves [ moveIndex ] . power , STR_CONV_MODE_RIGHT_ALIGN , 3 ) ;
2017-10-19 01:25:08 +02:00
text = gStringVar1 ;
}
2018-08-15 10:44:20 +02:00
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_MOVES_POWER_ACC , text , 53 , 1 , 0 , 0 ) ;
2018-08-15 10:44:20 +02:00
if ( gBattleMoves [ moveIndex ] . accuracy = = 0 )
{
2017-10-19 01:25:08 +02:00
text = gText_ThreeDashes ;
2018-08-15 10:44:20 +02:00
}
2017-10-19 01:25:08 +02:00
else
{
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar1 , gBattleMoves [ moveIndex ] . accuracy , STR_CONV_MODE_RIGHT_ALIGN , 3 ) ;
2017-10-19 01:25:08 +02:00
text = gStringVar1 ;
}
2018-08-15 10:44:20 +02:00
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( PSS_LABEL_WINDOW_MOVES_POWER_ACC , text , 53 , 17 , 0 , 0 ) ;
2017-10-19 01:25:08 +02:00
}
}
2019-02-04 12:38:44 +01:00
static void PrintContestMoves ( void )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
PrintMoveNameAndPP ( 0 ) ;
PrintMoveNameAndPP ( 1 ) ;
PrintMoveNameAndPP ( 2 ) ;
PrintMoveNameAndPP ( 3 ) ;
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
2017-10-19 01:25:08 +02:00
{
2018-08-15 10:44:20 +02:00
PrintNewMoveDetailsOrCancelText ( ) ;
2019-03-08 09:12:08 +01:00
PrintContestMoveDescription ( sMonSummaryScreen - > firstMoveIndex ) ;
2017-10-19 01:25:08 +02:00
}
}
2019-02-04 13:44:09 +01:00
static void Task_PrintContestMoves ( u8 taskId )
2017-10-19 01:25:08 +02:00
{
s16 * data = gTasks [ taskId ] . data ;
2017-11-14 20:23:25 +01:00
2020-05-18 14:03:01 +02:00
switch ( data [ 0 ] )
2017-10-19 01:25:08 +02:00
{
2020-05-18 14:03:01 +02:00
case 1 :
PrintMoveNameAndPP ( 0 ) ;
break ;
case 2 :
PrintMoveNameAndPP ( 1 ) ;
break ;
case 3 :
PrintMoveNameAndPP ( 2 ) ;
break ;
case 4 :
PrintMoveNameAndPP ( 3 ) ;
break ;
case 5 :
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
PrintNewMoveDetailsOrCancelText ( ) ;
break ;
case 6 :
if ( sMonSummaryScreen - > mode = = PSS_MODE_SELECT_MOVE )
{
if ( sMonSummaryScreen - > newMove ! = MOVE_NONE | | sMonSummaryScreen - > firstMoveIndex ! = MAX_MON_MOVES )
PrintContestMoveDescription ( sMonSummaryScreen - > firstMoveIndex ) ;
}
break ;
case 7 :
DestroyTask ( taskId ) ;
return ;
2017-10-19 01:25:08 +02:00
}
data [ 0 ] + + ;
2017-11-14 20:23:25 +01:00
}
2018-07-28 23:26:19 +02:00
2018-08-16 00:58:41 +02:00
static void PrintContestMoveDescription ( u8 moveSlot )
2018-07-28 23:26:19 +02:00
{
u16 move ;
2018-12-25 18:50:15 +01:00
if ( moveSlot = = MAX_MON_MOVES )
2019-03-08 09:12:08 +01:00
move = sMonSummaryScreen - > newMove ;
2018-07-28 23:26:19 +02:00
else
2019-03-08 09:12:08 +01:00
move = sMonSummaryScreen - > summary . moves [ moveSlot ] ;
2018-07-28 23:26:19 +02:00
if ( move ! = MOVE_NONE )
{
2019-03-03 22:50:51 +01:00
u8 windowId = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_DESCRIPTION ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , gContestEffectDescriptionPointers [ gContestMoves [ move ] . effect ] , 6 , 1 , 0 , 0 ) ;
2018-07-28 23:26:19 +02:00
}
}
2018-08-16 00:58:41 +02:00
static void PrintMoveDetails ( u16 move )
2018-07-28 23:26:19 +02:00
{
2019-03-03 22:50:51 +01:00
u8 windowId = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_DESCRIPTION ) ;
2019-03-02 23:25:39 +01:00
FillWindowPixelBuffer ( windowId , PIXEL_FILL ( 0 ) ) ;
2018-07-28 23:26:19 +02:00
if ( move ! = MOVE_NONE )
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > currPageIndex = = PSS_MODE_BOX )
2018-07-28 23:26:19 +02:00
{
2018-08-15 10:44:20 +02:00
PrintMovePowerAndAccuracy ( move ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , gMoveDescriptionPointers [ move - 1 ] , 6 , 1 , 0 , 0 ) ;
2018-07-28 23:26:19 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , gContestEffectDescriptionPointers [ gContestMoves [ move ] . effect ] , 6 , 1 , 0 , 0 ) ;
2018-07-28 23:26:19 +02:00
}
PutWindowTilemap ( windowId ) ;
}
else
{
ClearWindowTilemap ( windowId ) ;
}
2020-05-14 10:37:09 +02:00
ScheduleBgCopyTilemapToVram ( 0 ) ;
2018-07-28 23:26:19 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintNewMoveDetailsOrCancelText ( void )
2018-07-28 23:26:19 +02:00
{
2019-03-03 22:50:51 +01:00
u8 windowId1 = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_NAMES ) ;
u8 windowId2 = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_PP ) ;
2018-08-15 10:44:20 +02:00
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > newMove = = MOVE_NONE )
2018-07-28 23:26:19 +02:00
{
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId1 , gText_Cancel , 0 , 65 , 0 , 1 ) ;
2018-07-28 23:26:19 +02:00
}
else
{
2019-03-08 09:12:08 +01:00
u16 move = sMonSummaryScreen - > newMove ;
2018-08-15 10:44:20 +02:00
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > currPageIndex = = PSS_PAGE_BATTLE_MOVES )
PrintTextOnWindow ( windowId1 , gMoveNames [ move ] , 0 , 65 , 0 , 6 ) ;
2018-07-28 23:26:19 +02:00
else
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId1 , gMoveNames [ move ] , 0 , 65 , 0 , 5 ) ;
2018-07-28 23:26:19 +02:00
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN ( gStringVar1 , gBattleMoves [ move ] . pp , STR_CONV_MODE_RIGHT_ALIGN , 2 ) ;
2018-07-28 23:26:19 +02:00
DynamicPlaceholderTextUtil_Reset ( ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 0 , gStringVar1 ) ;
DynamicPlaceholderTextUtil_SetPlaceholderPtr ( 1 , gStringVar1 ) ;
2019-02-19 10:09:42 +01:00
DynamicPlaceholderTextUtil_ExpandPlaceholders ( gStringVar4 , sMovesPPLayout ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId2 , gStringVar4 , GetStringRightAlignXOffset ( 1 , gStringVar4 , 44 ) , 65 , 0 , 12 ) ;
2018-07-28 23:26:19 +02:00
}
}
2020-05-18 14:03:01 +02:00
static void AddAndFillMoveNamesWindow ( void )
2018-07-28 23:26:19 +02:00
{
2019-03-03 22:50:51 +01:00
u8 windowId = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_NAMES ) ;
2019-03-02 23:25:39 +01:00
FillWindowPixelRect ( windowId , PIXEL_FILL ( 0 ) , 0 , 66 , 72 , 16 ) ;
2018-07-28 23:26:19 +02:00
CopyWindowToVram ( windowId , 2 ) ;
}
2020-05-18 14:03:01 +02:00
static void SwapMovesNamesPP ( u8 moveIndex1 , u8 moveIndex2 )
2018-07-28 23:26:19 +02:00
{
2019-03-03 22:50:51 +01:00
u8 windowId1 = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_NAMES ) ;
u8 windowId2 = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_PP ) ;
2018-07-28 23:26:19 +02:00
2020-05-18 14:03:01 +02:00
FillWindowPixelRect ( windowId1 , PIXEL_FILL ( 0 ) , 0 , moveIndex1 * 16 , 72 , 16 ) ;
FillWindowPixelRect ( windowId1 , PIXEL_FILL ( 0 ) , 0 , moveIndex2 * 16 , 72 , 16 ) ;
2018-07-28 23:26:19 +02:00
2020-05-18 14:03:01 +02:00
FillWindowPixelRect ( windowId2 , PIXEL_FILL ( 0 ) , 0 , moveIndex1 * 16 , 48 , 16 ) ;
FillWindowPixelRect ( windowId2 , PIXEL_FILL ( 0 ) , 0 , moveIndex2 * 16 , 48 , 16 ) ;
2018-07-28 23:26:19 +02:00
2018-08-15 10:44:20 +02:00
PrintMoveNameAndPP ( moveIndex1 ) ;
PrintMoveNameAndPP ( moveIndex2 ) ;
2018-07-28 23:26:19 +02:00
}
2018-08-16 00:58:41 +02:00
static void PrintHMMovesCantBeForgotten ( void )
2018-07-28 23:26:19 +02:00
{
2019-03-03 22:50:51 +01:00
u8 windowId = AddWindowFromTemplateList ( sPageMovesTemplate , PSS_DATA_WINDOW_MOVE_DESCRIPTION ) ;
2019-03-02 23:25:39 +01:00
FillWindowPixelBuffer ( windowId , PIXEL_FILL ( 0 ) ) ;
2020-05-18 14:03:01 +02:00
PrintTextOnWindow ( windowId , gText_HMMovesCantBeForgotten2 , 6 , 1 , 0 , 0 ) ;
2018-07-28 23:26:19 +02:00
}
2019-02-04 12:38:44 +01:00
static void ResetSpriteIds ( void )
2018-07-28 23:26:19 +02:00
{
u8 i ;
2019-03-08 09:12:08 +01:00
for ( i = 0 ; i < ARRAY_COUNT ( sMonSummaryScreen - > spriteIds ) ; i + + )
sMonSummaryScreen - > spriteIds [ i ] = 0xFF ;
2018-07-28 23:26:19 +02:00
}
2018-08-16 00:58:41 +02:00
static void DestroySpriteInArray ( u8 spriteArrayId )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > spriteIds [ spriteArrayId ] ! = 0xFF )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
DestroySprite ( & gSprites [ sMonSummaryScreen - > spriteIds [ spriteArrayId ] ] ) ;
sMonSummaryScreen - > spriteIds [ spriteArrayId ] = 0xFF ;
2018-07-28 23:26:19 +02:00
}
}
2019-02-02 23:14:04 +01:00
static void SetSpriteInvisibility ( u8 spriteArrayId , bool8 invisible )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
gSprites [ sMonSummaryScreen - > spriteIds [ spriteArrayId ] ] . invisible = invisible ;
2018-07-28 23:26:19 +02:00
}
2019-02-02 23:14:04 +01:00
static void HidePageSpecificSprites ( void )
2018-07-28 23:26:19 +02:00
{
2020-05-14 10:37:09 +02:00
// Keeps Pok<6F> mon, caught ball and status sprites visible.
2018-07-28 23:26:19 +02:00
u8 i ;
2020-05-18 14:03:01 +02:00
for ( i = SPRITE_ARR_ID_TYPE ; i < ARRAY_COUNT ( sMonSummaryScreen - > spriteIds ) ; i + + )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > spriteIds [ i ] ! = 0xFF )
2019-02-02 23:14:04 +01:00
SetSpriteInvisibility ( i , TRUE ) ;
2018-07-28 23:26:19 +02:00
}
}
2019-02-02 23:14:04 +01:00
static void SetTypeIcons ( void )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
switch ( sMonSummaryScreen - > currPageIndex )
2018-07-28 23:26:19 +02:00
{
2019-02-02 23:14:04 +01:00
case PSS_PAGE_INFO :
SetMonTypeIcons ( ) ;
2018-07-28 23:26:19 +02:00
break ;
2019-02-02 23:14:04 +01:00
case PSS_PAGE_BATTLE_MOVES :
SetMoveTypeIcons ( ) ;
SetNewMoveTypeIcon ( ) ;
2018-07-28 23:26:19 +02:00
break ;
2019-02-02 23:14:04 +01:00
case PSS_PAGE_CONTEST_MOVES :
SetContestMoveTypeIcons ( ) ;
SetNewMoveTypeIcon ( ) ;
2018-07-28 23:26:19 +02:00
break ;
}
}
2019-02-02 23:14:04 +01:00
static void CreateMoveTypeIcons ( void )
2018-07-28 23:26:19 +02:00
{
u8 i ;
2020-05-18 14:03:01 +02:00
for ( i = SPRITE_ARR_ID_TYPE ; i < SPRITE_ARR_ID_TYPE + 5 ; i + + )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > spriteIds [ i ] = = 0xFF )
sMonSummaryScreen - > spriteIds [ i ] = CreateSprite ( & sSpriteTemplate_MoveTypes , 0 , 0 , 2 ) ;
2018-07-28 23:26:19 +02:00
2019-02-02 23:14:04 +01:00
SetSpriteInvisibility ( i , TRUE ) ;
2018-07-28 23:26:19 +02:00
}
}
2020-05-18 14:03:01 +02:00
static void SetTypeSpritePosAndPal ( u8 typeId , u8 x , u8 y , u8 spriteArrayId )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
struct Sprite * sprite = & gSprites [ sMonSummaryScreen - > spriteIds [ spriteArrayId ] ] ;
2018-07-28 23:26:19 +02:00
StartSpriteAnim ( sprite , typeId ) ;
2018-09-01 18:31:53 +02:00
sprite - > oam . paletteNum = sMoveTypeToOamPaletteNum [ typeId ] ;
2018-07-28 23:26:19 +02:00
sprite - > pos1 . x = x + 16 ;
sprite - > pos1 . y = y + 8 ;
2019-02-02 23:14:04 +01:00
SetSpriteInvisibility ( spriteArrayId , FALSE ) ;
2018-07-28 23:26:19 +02:00
}
2019-02-02 23:14:04 +01:00
static void SetMonTypeIcons ( void )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-07-28 23:26:19 +02:00
if ( summary - > isEgg )
{
2020-05-18 14:03:01 +02:00
SetTypeSpritePosAndPal ( TYPE_MYSTERY , 120 , 48 , SPRITE_ARR_ID_TYPE ) ;
SetSpriteInvisibility ( SPRITE_ARR_ID_TYPE + 1 , TRUE ) ;
2018-07-28 23:26:19 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
SetTypeSpritePosAndPal ( gBaseStats [ summary - > species ] . type1 , 120 , 48 , SPRITE_ARR_ID_TYPE ) ;
2018-07-28 23:26:19 +02:00
if ( gBaseStats [ summary - > species ] . type1 ! = gBaseStats [ summary - > species ] . type2 )
{
2020-05-18 14:03:01 +02:00
SetTypeSpritePosAndPal ( gBaseStats [ summary - > species ] . type2 , 160 , 48 , SPRITE_ARR_ID_TYPE + 1 ) ;
SetSpriteInvisibility ( SPRITE_ARR_ID_TYPE + 1 , FALSE ) ;
2018-07-28 23:26:19 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
SetSpriteInvisibility ( SPRITE_ARR_ID_TYPE + 1 , TRUE ) ;
2018-07-28 23:26:19 +02:00
}
}
}
2019-02-02 23:14:04 +01:00
static void SetMoveTypeIcons ( void )
2018-07-28 23:26:19 +02:00
{
u8 i ;
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-12-25 18:50:15 +01:00
for ( i = 0 ; i < MAX_MON_MOVES ; i + + )
2018-07-28 23:26:19 +02:00
{
if ( summary - > moves [ i ] ! = MOVE_NONE )
2020-05-18 14:03:01 +02:00
SetTypeSpritePosAndPal ( gBattleMoves [ summary - > moves [ i ] ] . type , 85 , 32 + ( i * 16 ) , i + SPRITE_ARR_ID_TYPE ) ;
2018-07-28 23:26:19 +02:00
else
2020-05-25 10:19:18 +02:00
SetSpriteInvisibility ( i + SPRITE_ARR_ID_TYPE , TRUE ) ;
2018-07-28 23:26:19 +02:00
}
}
2019-02-02 23:14:04 +01:00
static void SetContestMoveTypeIcons ( void )
2018-07-28 23:26:19 +02:00
{
u8 i ;
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-12-25 18:50:15 +01:00
for ( i = 0 ; i < MAX_MON_MOVES ; i + + )
2018-07-28 23:26:19 +02:00
{
if ( summary - > moves [ i ] ! = MOVE_NONE )
2020-05-18 14:03:01 +02:00
SetTypeSpritePosAndPal ( NUMBER_OF_MON_TYPES + gContestMoves [ summary - > moves [ i ] ] . contestCategory , 85 , 32 + ( i * 16 ) , i + SPRITE_ARR_ID_TYPE ) ;
2018-07-28 23:26:19 +02:00
else
2020-05-25 10:19:18 +02:00
SetSpriteInvisibility ( i + SPRITE_ARR_ID_TYPE , TRUE ) ;
2018-07-28 23:26:19 +02:00
}
}
2019-02-02 23:14:04 +01:00
static void SetNewMoveTypeIcon ( void )
2018-07-28 23:26:19 +02:00
{
2019-03-08 09:12:08 +01:00
if ( sMonSummaryScreen - > newMove = = MOVE_NONE )
2018-07-28 23:26:19 +02:00
{
2020-05-18 14:03:01 +02:00
SetSpriteInvisibility ( SPRITE_ARR_ID_TYPE + 4 , TRUE ) ;
2018-07-28 23:26:19 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > currPageIndex = = PSS_PAGE_BATTLE_MOVES )
SetTypeSpritePosAndPal ( gBattleMoves [ sMonSummaryScreen - > newMove ] . type , 85 , 96 , SPRITE_ARR_ID_TYPE + 4 ) ;
2018-08-15 06:56:11 +02:00
else
2020-05-18 14:03:01 +02:00
SetTypeSpritePosAndPal ( NUMBER_OF_MON_TYPES + gContestMoves [ sMonSummaryScreen - > newMove ] . contestCategory , 85 , 96 , SPRITE_ARR_ID_TYPE + 4 ) ;
2018-08-15 06:56:11 +02:00
}
}
2020-05-18 14:03:01 +02:00
static void SwapMovesTypeSprites ( u8 moveIndex1 , u8 moveIndex2 )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
struct Sprite * sprite1 = & gSprites [ sMonSummaryScreen - > spriteIds [ moveIndex1 + SPRITE_ARR_ID_TYPE ] ] ;
struct Sprite * sprite2 = & gSprites [ sMonSummaryScreen - > spriteIds [ moveIndex2 + SPRITE_ARR_ID_TYPE ] ] ;
2018-08-15 06:56:11 +02:00
u8 temp = sprite1 - > animNum ;
sprite1 - > animNum = sprite2 - > animNum ;
sprite2 - > animNum = temp ;
temp = sprite1 - > oam . paletteNum ;
sprite1 - > oam . paletteNum = sprite2 - > oam . paletteNum ;
sprite2 - > oam . paletteNum = temp ;
sprite1 - > animBeginning = TRUE ;
sprite1 - > animEnded = FALSE ;
sprite2 - > animBeginning = TRUE ;
sprite2 - > animEnded = FALSE ;
}
2020-05-18 14:03:01 +02:00
static u8 LoadMonGfxAndSprite ( struct Pokemon * mon , s16 * state )
2018-08-15 06:56:11 +02:00
{
const struct CompressedSpritePalette * pal ;
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-08-15 06:56:11 +02:00
2020-05-18 14:03:01 +02:00
switch ( * state )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
default :
return CreateMonSprite ( mon ) ;
case 0 :
if ( gMain . inBattle )
{
if ( sub_80688F8 ( 3 , sMonSummaryScreen - > curMonIndex ) )
HandleLoadSpecialPokePic_DontHandleDeoxys ( & gMonFrontPicTable [ summary - > species2 ] , gMonSpritesGfxPtr - > sprites [ 1 ] , summary - > species2 , summary - > pid ) ;
else
HandleLoadSpecialPokePic_2 ( & gMonFrontPicTable [ summary - > species2 ] , gMonSpritesGfxPtr - > sprites [ 1 ] , summary - > species2 , summary - > pid ) ;
}
else
{
if ( gMonSpritesGfxPtr ! = NULL )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > monList . mons = = gPlayerParty | | sMonSummaryScreen - > mode = = PSS_MODE_BOX | | sMonSummaryScreen - > unk40EF = = TRUE )
2018-08-15 06:56:11 +02:00
HandleLoadSpecialPokePic_2 ( & gMonFrontPicTable [ summary - > species2 ] , gMonSpritesGfxPtr - > sprites [ 1 ] , summary - > species2 , summary - > pid ) ;
2020-05-18 14:03:01 +02:00
else
HandleLoadSpecialPokePic_DontHandleDeoxys ( & gMonFrontPicTable [ summary - > species2 ] , gMonSpritesGfxPtr - > sprites [ 1 ] , summary - > species2 , summary - > pid ) ;
2018-08-15 06:56:11 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > monList . mons = = gPlayerParty | | sMonSummaryScreen - > mode = = PSS_MODE_BOX | | sMonSummaryScreen - > unk40EF = = TRUE )
HandleLoadSpecialPokePic_2 ( & gMonFrontPicTable [ summary - > species2 ] , sub_806F4F8 ( 0 , 1 ) , summary - > species2 , summary - > pid ) ;
2018-08-15 06:56:11 +02:00
else
2020-05-18 14:03:01 +02:00
HandleLoadSpecialPokePic_DontHandleDeoxys ( & gMonFrontPicTable [ summary - > species2 ] , sub_806F4F8 ( 0 , 1 ) , summary - > species2 , summary - > pid ) ;
2018-08-15 06:56:11 +02:00
}
2020-05-18 14:03:01 +02:00
}
( * state ) + + ;
return 0xFF ;
case 1 :
pal = GetMonSpritePalStructFromOtIdPersonality ( summary - > species2 , summary - > OTID , summary - > pid ) ;
LoadCompressedSpritePalette ( pal ) ;
SetMultiuseSpriteTemplateToPokemon ( pal - > tag , 1 ) ;
( * state ) + + ;
return 0xFF ;
2018-08-15 06:56:11 +02:00
}
}
2019-02-04 15:35:49 +01:00
static void PlayMonCry ( void )
2018-08-15 06:56:11 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-08-15 06:56:11 +02:00
if ( ! summary - > isEgg )
{
2019-03-08 09:12:08 +01:00
if ( ShouldPlayNormalMonCry ( & sMonSummaryScreen - > currentMon ) = = TRUE )
2018-08-15 06:56:11 +02:00
PlayCry3 ( summary - > species2 , 0 , 0 ) ;
2018-07-28 23:26:19 +02:00
else
2018-08-15 06:56:11 +02:00
PlayCry3 ( summary - > species2 , 0 , 11 ) ;
}
}
2020-05-18 14:03:01 +02:00
static u8 CreateMonSprite ( struct Pokemon * unused )
2018-08-15 06:56:11 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-08-15 06:56:11 +02:00
u8 spriteId = CreateSprite ( & gMultiuseSpriteTemplate , 40 , 64 , 5 ) ;
2020-05-18 14:03:01 +02:00
FreeSpriteOamMatrix ( & gSprites [ spriteId ] ) ;
gSprites [ spriteId ] . data [ 0 ] = summary - > species2 ;
gSprites [ spriteId ] . data [ 2 ] = 0 ;
2019-02-04 15:35:49 +01:00
gSprites [ spriteId ] . callback = SpriteCB_Pokemon ;
2020-05-18 14:03:01 +02:00
gSprites [ spriteId ] . oam . priority = 0 ;
2018-08-15 06:56:11 +02:00
if ( ! IsMonSpriteNotFlipped ( summary - > species2 ) )
2020-05-18 14:03:01 +02:00
gSprites [ spriteId ] . hFlip = TRUE ;
2018-08-15 06:56:11 +02:00
else
2020-05-18 14:03:01 +02:00
gSprites [ spriteId ] . hFlip = FALSE ;
2018-08-15 06:56:11 +02:00
return spriteId ;
}
2019-02-04 15:35:49 +01:00
static void SpriteCB_Pokemon ( struct Sprite * sprite )
2018-08-15 06:56:11 +02:00
{
2019-03-08 09:12:08 +01:00
struct PokeSummary * summary = & sMonSummaryScreen - > summary ;
2018-08-15 06:56:11 +02:00
if ( ! gPaletteFade . active & & sprite - > data [ 2 ] ! = 1 )
{
sprite - > data [ 1 ] = IsMonSpriteNotFlipped ( sprite - > data [ 0 ] ) ;
2019-02-04 15:35:49 +01:00
PlayMonCry ( ) ;
2018-08-15 06:56:11 +02:00
PokemonSummaryDoMonAnimation ( sprite , sprite - > data [ 0 ] , summary - > isEgg ) ;
}
}
2020-05-25 10:19:18 +02:00
void SummaryScreen_SetUnknownTaskId ( u8 taskId )
2018-08-15 06:56:11 +02:00
{
2020-05-25 10:19:18 +02:00
sUnknownTaskId = taskId ;
2018-08-15 06:56:11 +02:00
}
2018-08-15 20:47:10 +02:00
void SummaryScreen_DestroyUnknownTask ( void )
2018-08-15 06:56:11 +02:00
{
2018-12-05 15:31:01 +01:00
if ( sUnknownTaskId ! = 0xFF )
2018-08-15 06:56:11 +02:00
{
2018-08-15 20:47:10 +02:00
DestroyTask ( sUnknownTaskId ) ;
2018-12-05 15:31:01 +01:00
sUnknownTaskId = 0xFF ;
2018-08-15 06:56:11 +02:00
}
}
2020-05-18 14:03:01 +02:00
// unused
static bool32 IsMonAnimationFinished ( void )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
if ( gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ] . callback = = SpriteCallbackDummy )
2018-08-15 06:56:11 +02:00
return FALSE ;
else
return TRUE ;
}
2019-02-19 10:09:42 +01:00
static void StopPokemonAnimations ( void ) // A subtle effect, this function stops pokemon animations when leaving the PSS
2018-08-15 06:56:11 +02:00
{
u16 i ;
u16 paletteIndex ;
2020-05-18 14:03:01 +02:00
gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ] . animPaused = TRUE ;
gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ] . callback = SpriteCallbackDummy ;
2019-02-19 10:09:42 +01:00
StopPokemonAnimationDelayTask ( ) ;
2018-08-15 06:56:11 +02:00
2020-05-18 14:03:01 +02:00
paletteIndex = ( gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MON ] ] . oam . paletteNum * 16 ) | 0x100 ;
2018-08-16 22:53:01 +02:00
2018-08-15 06:56:11 +02:00
for ( i = 0 ; i < 16 ; i + + )
{
2020-05-18 14:03:01 +02:00
u16 id = i + paletteIndex ;
gPlttBufferUnfaded [ id ] = gPlttBufferFaded [ id ] ;
2018-08-15 06:56:11 +02:00
}
}
2018-08-16 00:58:41 +02:00
static void CreateMonMarkingsSprite ( struct Pokemon * mon )
2018-08-15 06:56:11 +02:00
{
2020-10-11 00:17:34 +02:00
struct Sprite * sprite = CreateMonMarkingsSpriteWithPal ( TAG_MON_MARKINGS , TAG_MON_MARKINGS , sSummaryMarkingsPalette ) ;
2018-08-15 06:56:11 +02:00
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > markingsSprite = sprite ;
2018-08-15 06:56:11 +02:00
if ( sprite ! = NULL )
{
StartSpriteAnim ( sprite , GetMonData ( mon , MON_DATA_MARKINGS ) ) ;
2019-03-08 09:12:08 +01:00
sMonSummaryScreen - > markingsSprite - > pos1 . x = 60 ;
sMonSummaryScreen - > markingsSprite - > pos1 . y = 26 ;
sMonSummaryScreen - > markingsSprite - > oam . priority = 1 ;
2018-08-15 06:56:11 +02:00
}
}
2018-08-16 00:58:41 +02:00
static void RemoveAndCreateMonMarkingsSprite ( struct Pokemon * mon )
2018-08-15 06:56:11 +02:00
{
2019-03-08 09:12:08 +01:00
DestroySprite ( sMonSummaryScreen - > markingsSprite ) ;
2020-05-18 14:03:01 +02:00
FreeSpriteTilesByTag ( TAG_MON_MARKINGS ) ;
2018-08-15 20:47:10 +02:00
CreateMonMarkingsSprite ( mon ) ;
2018-08-15 06:56:11 +02:00
}
2018-08-16 00:58:41 +02:00
static void CreateCaughtBallSprite ( struct Pokemon * mon )
2018-08-15 06:56:11 +02:00
{
u8 ball = ItemIdToBallId ( GetMonData ( mon , MON_DATA_POKEBALL ) ) ;
LoadBallGfx ( ball ) ;
2020-05-18 14:03:01 +02:00
sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_BALL ] = CreateSprite ( & gBallSpriteTemplates [ ball ] , 16 , 136 , 0 ) ;
gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_BALL ] ] . callback = SpriteCallbackDummy ;
gSprites [ sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_BALL ] ] . oam . priority = 3 ;
2018-08-15 06:56:11 +02:00
}
2018-08-16 00:58:41 +02:00
static void CreateSetStatusSprite ( void )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
u8 * spriteId = & sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_STATUS ] ;
u8 statusAnim ;
2018-08-15 06:56:11 +02:00
2018-12-05 15:31:01 +01:00
if ( * spriteId = = 0xFF )
2018-09-02 14:47:12 +02:00
* spriteId = CreateSprite ( & sSpriteTemplate_StatusCondition , 64 , 152 , 0 ) ;
2018-08-15 06:56:11 +02:00
2020-05-18 14:03:01 +02:00
statusAnim = GetMonAilment ( & sMonSummaryScreen - > currentMon ) ;
if ( statusAnim ! = 0 )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
StartSpriteAnim ( & gSprites [ * spriteId ] , statusAnim - 1 ) ;
SetSpriteInvisibility ( SPRITE_ARR_ID_STATUS , FALSE ) ;
2018-08-15 06:56:11 +02:00
}
else
{
2020-05-18 14:03:01 +02:00
SetSpriteInvisibility ( SPRITE_ARR_ID_STATUS , TRUE ) ;
2018-08-15 06:56:11 +02:00
}
}
2020-05-18 14:03:01 +02:00
static void CreateMoveSelectorSprites ( u8 idArrayStart )
2018-08-15 06:56:11 +02:00
{
u8 i ;
2020-05-18 14:03:01 +02:00
u8 * spriteIds = & sMonSummaryScreen - > spriteIds [ idArrayStart ] ;
2018-08-15 06:56:11 +02:00
2020-05-18 14:03:01 +02:00
if ( sMonSummaryScreen - > currPageIndex > = PSS_PAGE_BATTLE_MOVES )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
u8 subpriority = 0 ;
if ( idArrayStart = = SPRITE_ARR_ID_MOVE_SELECTOR1 )
subpriority = 1 ;
2018-08-15 06:56:11 +02:00
2020-05-25 10:19:18 +02:00
for ( i = 0 ; i < MOVE_SELECTOR_SPRITES_COUNT ; i + + )
2018-08-15 06:56:11 +02:00
{
2020-05-18 14:03:01 +02:00
spriteIds [ i ] = CreateSprite ( & sMoveSelectorSpriteTemplate , i * 16 + 89 , 40 , subpriority ) ;
2018-08-15 06:56:11 +02:00
if ( i = = 0 )
2020-05-18 14:03:01 +02:00
StartSpriteAnim ( & gSprites [ spriteIds [ i ] ] , 4 ) ; // left
2018-08-15 06:56:11 +02:00
else if ( i = = 9 )
2020-05-18 14:03:01 +02:00
StartSpriteAnim ( & gSprites [ spriteIds [ i ] ] , 5 ) ; // right, actually the same as left, but flipped
2018-08-15 06:56:11 +02:00
else
2020-05-18 14:03:01 +02:00
StartSpriteAnim ( & gSprites [ spriteIds [ i ] ] , 6 ) ; // middle
gSprites [ spriteIds [ i ] ] . callback = SpriteCb_MoveSelector ;
gSprites [ spriteIds [ i ] ] . data [ 0 ] = idArrayStart ;
2018-08-15 06:56:11 +02:00
gSprites [ spriteIds [ i ] ] . data [ 1 ] = 0 ;
}
}
}
2020-05-18 14:03:01 +02:00
static void SpriteCb_MoveSelector ( struct Sprite * sprite )
2018-08-15 06:56:11 +02:00
{
if ( sprite - > animNum > 3 & & sprite - > animNum < 7 )
{
sprite - > data [ 1 ] = ( sprite - > data [ 1 ] + 1 ) & 0x1F ;
if ( sprite - > data [ 1 ] > 24 )
sprite - > invisible = TRUE ;
2018-07-28 23:26:19 +02:00
else
2018-08-15 06:56:11 +02:00
sprite - > invisible = FALSE ;
}
else
{
sprite - > data [ 1 ] = 0 ;
sprite - > invisible = FALSE ;
}
2020-05-18 14:03:01 +02:00
if ( sprite - > data [ 0 ] = = SPRITE_ARR_ID_MOVE_SELECTOR1 )
2019-03-08 09:12:08 +01:00
sprite - > pos2 . y = sMonSummaryScreen - > firstMoveIndex * 16 ;
2018-08-15 06:56:11 +02:00
else
2019-03-08 09:12:08 +01:00
sprite - > pos2 . y = sMonSummaryScreen - > secondMoveIndex * 16 ;
2018-08-15 06:56:11 +02:00
}
2020-05-18 14:03:01 +02:00
static void DestroyMoveSelectorSprites ( u8 firstArrayId )
2018-08-15 06:56:11 +02:00
{
u8 i ;
2020-05-18 14:03:01 +02:00
for ( i = 0 ; i < MOVE_SELECTOR_SPRITES_COUNT ; i + + )
DestroySpriteInArray ( firstArrayId + i ) ;
2018-08-15 06:56:11 +02:00
}
2020-05-18 14:03:01 +02:00
static void SetMainMoveSelectorColor ( u8 which )
2018-08-15 06:56:11 +02:00
{
u8 i ;
2020-05-18 14:03:01 +02:00
u8 * spriteIds = & sMonSummaryScreen - > spriteIds [ SPRITE_ARR_ID_MOVE_SELECTOR1 ] ;
2018-08-15 06:56:11 +02:00
2020-05-18 14:03:01 +02:00
which * = 3 ;
for ( i = 0 ; i < MOVE_SELECTOR_SPRITES_COUNT ; i + + )
2018-08-15 06:56:11 +02:00
{
if ( i = = 0 )
2020-05-18 14:03:01 +02:00
StartSpriteAnim ( & gSprites [ spriteIds [ i ] ] , which + 4 ) ;
2018-08-15 06:56:11 +02:00
else if ( i = = 9 )
2020-05-18 14:03:01 +02:00
StartSpriteAnim ( & gSprites [ spriteIds [ i ] ] , which + 5 ) ;
2018-08-15 06:56:11 +02:00
else
2020-05-18 14:03:01 +02:00
StartSpriteAnim ( & gSprites [ spriteIds [ i ] ] , which + 6 ) ;
2018-08-15 06:56:11 +02:00
}
}
2020-05-25 10:19:18 +02:00
static void KeepMoveSelectorVisible ( u8 firstSpriteId )
2018-08-15 06:56:11 +02:00
{
u8 i ;
2019-03-08 09:12:08 +01:00
u8 * spriteIds = & sMonSummaryScreen - > spriteIds [ firstSpriteId ] ;
2018-08-15 06:56:11 +02:00
2020-05-18 14:03:01 +02:00
for ( i = 0 ; i < MOVE_SELECTOR_SPRITES_COUNT ; i + + )
2018-08-15 06:56:11 +02:00
{
gSprites [ spriteIds [ i ] ] . data [ 1 ] = 0 ;
gSprites [ spriteIds [ i ] ] . invisible = FALSE ;
2018-07-28 23:26:19 +02:00
}
}