2018-01-01 17:41:34 +01:00
|
|
|
#include "global.h"
|
2018-11-19 16:28:55 +01:00
|
|
|
#include "battle.h"
|
2018-01-01 17:41:34 +01:00
|
|
|
#include "battle_transition.h"
|
2020-07-02 21:45:37 +02:00
|
|
|
#include "battle_transition_frontier.h"
|
2018-11-13 15:19:04 +01:00
|
|
|
#include "bg.h"
|
|
|
|
#include "decompress.h"
|
2018-12-24 00:02:29 +01:00
|
|
|
#include "event_object_movement.h"
|
2018-11-13 15:19:04 +01:00
|
|
|
#include "field_camera.h"
|
|
|
|
#include "field_effect.h"
|
2018-12-24 00:02:29 +01:00
|
|
|
#include "field_weather.h"
|
2018-11-13 15:19:04 +01:00
|
|
|
#include "gpu_regs.h"
|
2018-01-01 17:41:34 +01:00
|
|
|
#include "main.h"
|
2019-09-09 03:07:54 +02:00
|
|
|
#include "malloc.h"
|
2018-01-01 17:41:34 +01:00
|
|
|
#include "overworld.h"
|
|
|
|
#include "palette.h"
|
|
|
|
#include "random.h"
|
2018-11-13 15:19:04 +01:00
|
|
|
#include "scanline_effect.h"
|
2018-01-01 17:41:34 +01:00
|
|
|
#include "sound.h"
|
2018-11-13 15:19:04 +01:00
|
|
|
#include "sprite.h"
|
|
|
|
#include "task.h"
|
|
|
|
#include "trig.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "constants/field_effects.h"
|
2018-01-01 17:41:34 +01:00
|
|
|
#include "constants/songs.h"
|
|
|
|
#include "constants/trainers.h"
|
2019-04-04 23:05:46 +02:00
|
|
|
#include "constants/rgb.h"
|
2018-01-01 17:41:34 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#define PALTAG_UNUSED_MUGSHOT 0x100A
|
|
|
|
|
|
|
|
#define B_TRANS_DMA_FLAGS (1 | ((DMA_SRC_INC | DMA_DEST_FIXED | DMA_REPEAT | DMA_16BIT | DMA_START_HBLANK | DMA_ENABLE) << 16))
|
|
|
|
|
|
|
|
#define SET_TILEMAP_TILE(ptr, posY, posX, toStore) \
|
|
|
|
{ \
|
|
|
|
u32 index = (posY) * 32 + posX; \
|
|
|
|
ptr[index] = toStore; \
|
|
|
|
}
|
|
|
|
|
2018-01-01 17:41:34 +01:00
|
|
|
struct TransitionData
|
|
|
|
{
|
2018-01-16 21:37:46 +01:00
|
|
|
vu8 VBlank_DMA;
|
2018-01-01 17:41:34 +01:00
|
|
|
u16 WININ;
|
|
|
|
u16 WINOUT;
|
2018-01-16 21:37:46 +01:00
|
|
|
u16 WIN0H;
|
2018-01-01 17:41:34 +01:00
|
|
|
u16 WIN0V;
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 unused1;
|
|
|
|
u16 unused2;
|
2018-01-01 17:41:34 +01:00
|
|
|
u16 BLDCNT;
|
|
|
|
u16 BLDALPHA;
|
|
|
|
u16 BLDY;
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 cameraX;
|
|
|
|
s16 cameraY;
|
|
|
|
s16 BG0HOFS_Lower;
|
|
|
|
s16 BG0HOFS_Upper;
|
2018-01-16 21:37:46 +01:00
|
|
|
s16 BG0VOFS; // used but not set
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 unused3;
|
2018-01-01 17:41:34 +01:00
|
|
|
s16 field_20;
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 unused4;
|
2018-01-01 17:41:34 +01:00
|
|
|
s16 data[11];
|
|
|
|
};
|
|
|
|
|
2018-01-13 21:03:07 +01:00
|
|
|
struct StructRectangularSpiral
|
|
|
|
{
|
|
|
|
u8 field_0;
|
|
|
|
s16 field_2;
|
|
|
|
u8 field_4;
|
|
|
|
s16 field_6;
|
|
|
|
u8 field_8;
|
|
|
|
};
|
|
|
|
|
2018-01-02 20:38:33 +01:00
|
|
|
typedef bool8 (*TransitionStateFunc)(struct Task *task);
|
2018-01-01 17:41:34 +01:00
|
|
|
typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite);
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_StartIntro(struct Task *task);
|
|
|
|
static bool8 Transition_WaitForIntro(struct Task *task);
|
|
|
|
static bool8 Transition_StartMain(struct Task *task);
|
|
|
|
static bool8 Transition_WaitForMain(struct Task *task);
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static void LaunchBattleTransitionTask(u8 transitionId);
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_BattleTransition(u8 taskId);
|
|
|
|
static void Task_Intro(u8 taskId);
|
|
|
|
static void Task_Blur(u8 taskId);
|
|
|
|
static void Task_Swirl(u8 taskId);
|
|
|
|
static void Task_Shuffle(u8 taskId);
|
|
|
|
static void Task_BigPokeball(u8 taskId);
|
|
|
|
static void Task_PokeballsTrail(u8 taskId);
|
|
|
|
static void Task_Clockwise_BlackFade(u8 taskId);
|
|
|
|
static void Task_Ripple(u8 taskId);
|
|
|
|
static void Task_Wave(u8 taskId);
|
|
|
|
static void Task_Slice(u8 taskId);
|
|
|
|
static void Task_WhiteFade(u8 taskId);
|
|
|
|
static void Task_GridSquares(u8 taskId);
|
|
|
|
static void Task_Shards(u8 taskId);
|
|
|
|
static void Task_Sidney(u8 taskId);
|
|
|
|
static void Task_Phoebe(u8 taskId);
|
|
|
|
static void Task_Glacia(u8 taskId);
|
|
|
|
static void Task_Drake(u8 taskId);
|
|
|
|
static void Task_Champion(u8 taskId);
|
|
|
|
static void Task_Aqua(u8 taskId);
|
|
|
|
static void Task_Magma(u8 taskId);
|
|
|
|
static void Task_Regice(u8 taskId);
|
|
|
|
static void Task_Registeel(u8 taskId);
|
|
|
|
static void Task_Regirock(u8 taskId);
|
|
|
|
static void Task_Kyogre(u8 taskId);
|
|
|
|
static void Task_Groudon(u8 taskId);
|
|
|
|
static void Task_Rayquaza(u8 taskId);
|
|
|
|
static void Task_ShredSplit(u8 taskId);
|
|
|
|
static void Task_Blackhole1(u8 taskId);
|
|
|
|
static void Task_Blackhole2(u8 taskId);
|
|
|
|
static void Task_RectangularSpiral(u8 taskId);
|
|
|
|
static void Task_FrontierLogoWiggle(u8 taskId);
|
|
|
|
static void Task_FrontierLogoWave(u8 taskId);
|
|
|
|
static void Task_FrontierSquares(u8 taskId);
|
|
|
|
static void Task_FrontierSquaresScroll(u8 taskId);
|
|
|
|
static void Task_FrontierSquaresSpiral(u8 taskId);
|
2018-01-14 22:09:35 +01:00
|
|
|
static void VBlankCB_BattleTransition(void);
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Swirl(void);
|
|
|
|
static void HBlankCB_Swirl(void);
|
|
|
|
static void VBlankCB_Shuffle(void);
|
|
|
|
static void HBlankCB_Shuffle(void);
|
2021-10-25 16:42:08 +02:00
|
|
|
static void VBlankCB_PatternWeave(void);
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB1_BigPokeball(void);
|
|
|
|
static void VBlankCB_Clockwise_BlackFade(void);
|
|
|
|
static void VBlankCB_Ripple(void);
|
|
|
|
static void HBlankCB_Ripple(void);
|
2021-10-25 16:42:08 +02:00
|
|
|
static void VBlankCB_FrontierLogoWave(void);
|
|
|
|
static void HBlankCB_FrontierLogoWave(void);
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Wave(void);
|
|
|
|
static void VBlankCB_Slice(void);
|
|
|
|
static void HBlankCB_Slice(void);
|
|
|
|
static void VBlankCB0_WhiteFade(void);
|
|
|
|
static void VBlankCB1_WhiteFade(void);
|
|
|
|
static void HBlankCB_WhiteFade(void);
|
|
|
|
static void VBlankCB_Shards(void);
|
|
|
|
static void VBlankCB_Rayquaza(void);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Blur_Init(struct Task *task);
|
|
|
|
static bool8 Blur_Main(struct Task *task);
|
|
|
|
static bool8 Blur_End(struct Task *task);
|
|
|
|
static bool8 Swirl_Init(struct Task *task);
|
|
|
|
static bool8 Swirl_End(struct Task *task);
|
|
|
|
static bool8 Shuffle_Init(struct Task *task);
|
|
|
|
static bool8 Shuffle_End(struct Task *task);
|
|
|
|
static bool8 Aqua_Init(struct Task *task);
|
|
|
|
static bool8 Aqua_SetGfx(struct Task *task);
|
|
|
|
static bool8 Magma_Init(struct Task *task);
|
|
|
|
static bool8 Magma_SetGfx(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FramesCountdown(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Regi_Init(struct Task *task);
|
|
|
|
static bool8 Regice_SetGfx(struct Task *task);
|
|
|
|
static bool8 Registeel_SetGfx(struct Task *task);
|
|
|
|
static bool8 Regirock_SetGfx(struct Task *task);
|
|
|
|
static bool8 WeatherTrio_BgFadeBlack(struct Task *task);
|
|
|
|
static bool8 WeatherTrio_WaitFade(struct Task *task);
|
|
|
|
static bool8 Kyogre_Init(struct Task *task);
|
|
|
|
static bool8 Kyogre_PalettePulsate(struct Task *task);
|
|
|
|
static bool8 Kyogre_PaletteBrighten(struct Task *task);
|
|
|
|
static bool8 Groudon_Init(struct Task *task);
|
|
|
|
static bool8 Groudon_PalettePulsate(struct Task *task);
|
|
|
|
static bool8 Groudon_PaletteBrighten(struct Task *task);
|
|
|
|
static bool8 WeatherDuo_FadeOut(struct Task *task);
|
|
|
|
static bool8 WeatherDuo_End(struct Task *task);
|
|
|
|
static bool8 BigPokeball_Init(struct Task *task);
|
|
|
|
static bool8 BigPokeball_SetGfx(struct Task *task);
|
|
|
|
static bool8 PatternWeave_1(struct Task *task);
|
|
|
|
static bool8 PatternWeave_2(struct Task *task);
|
|
|
|
static bool8 PatternWeave_3(struct Task *task);
|
|
|
|
static bool8 PatternWeave_End(struct Task *task);
|
|
|
|
static bool8 PokeballsTrail_Init(struct Task *task);
|
|
|
|
static bool8 PokeballsTrail_Main(struct Task *task);
|
|
|
|
static bool8 PokeballsTrail_End(struct Task *task);
|
|
|
|
static bool8 Clockwise_BlackFade_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Clockwise_BlackFade_Func2(struct Task *task);
|
|
|
|
static bool8 Clockwise_BlackFade_Func3(struct Task *task);
|
|
|
|
static bool8 Clockwise_BlackFade_Func4(struct Task *task);
|
|
|
|
static bool8 Clockwise_BlackFade_Func5(struct Task *task);
|
|
|
|
static bool8 Clockwise_BlackFade_Func6(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Clockwise_BlackFade_End(struct Task *task);
|
|
|
|
static bool8 Ripple_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Ripple_Func2(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Wave_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Wave_Func2(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Wave_End(struct Task *task);
|
|
|
|
static bool8 Slice_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Slice_Func2(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Slice_End(struct Task *task);
|
|
|
|
static bool8 WhiteFade_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 WhiteFade_Func2(struct Task *task);
|
|
|
|
static bool8 WhiteFade_Func3(struct Task *task);
|
|
|
|
static bool8 WhiteFade_Func4(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 WhiteFade_End(struct Task *task);
|
|
|
|
static bool8 GridSquares_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 GridSquares_Func2(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 GridSquares_End(struct Task *task);
|
|
|
|
static bool8 Shards_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Shards_Func2(struct Task *task);
|
|
|
|
static bool8 Shards_Func3(struct Task *task);
|
|
|
|
static bool8 Shards_Func4(struct Task *task);
|
|
|
|
static bool8 Shards_Func5(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 ShredSplit_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 ShredSplit_Func2(struct Task *task);
|
|
|
|
static bool8 ShredSplit_Func3(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 ShredSplit_End(struct Task *task);
|
|
|
|
static bool8 Blackhole_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Blackhole1_Func2(struct Task *task);
|
|
|
|
static bool8 Blackhole1_Func3(struct Task *task);
|
|
|
|
static bool8 Blackhole2_Func2(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 RectangularSpiral_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 RectangularSpiral_Func2(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 RectangularSpiral_End(struct Task *task);
|
|
|
|
static bool8 FrontierLogoWiggle_Init(struct Task *task);
|
|
|
|
static bool8 FrontierLogoWiggle_SetGfx(struct Task *task);
|
|
|
|
static bool8 FrontierLogoWave_Init(struct Task *task);
|
|
|
|
static bool8 FrontierLogoWave_SetGfx(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierLogoWave_Func3(struct Task *task);
|
|
|
|
static bool8 FrontierLogoWave_Func4(struct Task *task);
|
|
|
|
static bool8 Rayquaza_Func3(struct Task *task);
|
|
|
|
static bool8 Rayquaza_Func4(struct Task *task);
|
|
|
|
static bool8 Rayquaza_Func5(struct Task *task);
|
|
|
|
static bool8 Rayquaza_Func6(struct Task *task);
|
|
|
|
static bool8 Rayquaza_Func7(struct Task *task);
|
|
|
|
static bool8 Rayquaza_Func8(struct Task *task);
|
|
|
|
static bool8 Rayquaza_Func9(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquares_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquares_Func2(struct Task *task);
|
|
|
|
static bool8 FrontierSquares_Func3(struct Task *task);
|
|
|
|
static bool8 FrontierSquares_End(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquaresSpiral_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresSpiral_Func2(struct Task *task);
|
|
|
|
static bool8 FrontierSquaresSpiral_Func3(struct Task *task);
|
|
|
|
static bool8 FrontierSquaresSpiral_Func4(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquaresScroll_Init(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresScroll_Func2(struct Task *task);
|
|
|
|
static bool8 FrontierSquaresScroll_Func3(struct Task *task);
|
|
|
|
static bool8 FrontierSquaresScroll_Func4(struct Task *task);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquaresScroll_End(struct Task *task);
|
|
|
|
static bool8 Mugshot_Init(struct Task *task);
|
|
|
|
static bool8 Mugshot_SetGfx(struct Task *task);
|
|
|
|
static bool8 Mugshot_ShowBanner(struct Task *task);
|
|
|
|
static bool8 Mugshot_StartOpponentSlide(struct Task *task);
|
|
|
|
static bool8 Mugshot_WaitStartPlayerSlide(struct Task *task);
|
|
|
|
static bool8 Mugshot_WaitPlayerSlide(struct Task *task);
|
|
|
|
static bool8 Mugshot_GradualWhiteFade(struct Task *task);
|
|
|
|
static bool8 Mugshot_InitFadeWhiteToBlack(struct Task *task);
|
|
|
|
static bool8 Mugshot_FadeToBlack(struct Task *task);
|
|
|
|
static bool8 Mugshot_End(struct Task *task);
|
|
|
|
static void DoMugshotTransition(u8 taskId);
|
|
|
|
static void Mugshots_CreateTrainerPics(struct Task *task);
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB0_Mugshots(void);
|
|
|
|
static void VBlankCB1_Mugshots(void);
|
|
|
|
static void HBlankCB_Mugshots(void);
|
2021-10-25 16:42:08 +02:00
|
|
|
static void InitTransitionData(void);
|
2020-06-01 16:17:25 +02:00
|
|
|
static void FadeScreenBlack(void);
|
2021-10-25 16:20:48 +02:00
|
|
|
static void CreateIntroTask(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4);
|
2018-01-14 22:09:35 +01:00
|
|
|
static void sub_814A014(u16 *a0, s16 a1, s16 a2, s16 a3);
|
2021-10-25 16:42:08 +02:00
|
|
|
static void SetSinWave(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize);
|
2020-06-01 16:17:25 +02:00
|
|
|
static void GetBg0TilemapDst(u16 **tileset);
|
2018-01-14 22:09:35 +01:00
|
|
|
static void sub_814A1AC(s16 *a0, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6);
|
|
|
|
static bool8 sub_814A228(s16 *a0, bool8 a1, bool8 a2);
|
2020-06-01 16:17:25 +02:00
|
|
|
static void SetTrainerPicSlideTable(s16 spriteId, s16 arrId);
|
|
|
|
static void IncrementTrainerPicState(s16 spriteId);
|
|
|
|
static s16 IsTrainerPicSlideDone(s16 spriteId);
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_Intro_1(struct Task *task);
|
|
|
|
static bool8 Transition_Intro_2(struct Task *task);
|
|
|
|
static bool8 IsIntroTaskDone(void);
|
2018-01-14 22:09:35 +01:00
|
|
|
static bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1);
|
2021-10-25 16:42:08 +02:00
|
|
|
static void SpriteCB_FldEffPokeball(struct Sprite *sprite);
|
|
|
|
static void SpriteCB_MugshotTrainerPic(struct Sprite *sprite);
|
2018-01-14 22:09:35 +01:00
|
|
|
static void sub_8149864(struct Sprite *sprite);
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 MugshotTrainerPic_Nothing(struct Sprite *sprite);
|
|
|
|
static bool8 MugshotTrainerPic_SetSlideOffsets(struct Sprite *sprite);
|
|
|
|
static bool8 MugshotTrainerPic_Slide1(struct Sprite *sprite);
|
|
|
|
static bool8 MugshotTrainerPic_Slide2(struct Sprite *sprite);
|
|
|
|
static bool8 MugshotTrainerPic_Slide3(struct Sprite *sprite);
|
2018-01-01 17:41:34 +01:00
|
|
|
|
2019-06-26 22:23:00 +02:00
|
|
|
static s16 sUnusedRectangularSpiralVar;
|
|
|
|
static u8 sTestingTransitionId;
|
|
|
|
static u8 sTestingTransitionState;
|
|
|
|
static struct StructRectangularSpiral sRectangularSpiralTransition[4];
|
2018-01-01 17:41:34 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
EWRAM_DATA static struct TransitionData *sTransitionData = NULL;
|
2018-01-01 17:41:34 +01:00
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u32 sBigPokeball_Tileset[] = INCBIN_U32("graphics/battle_transitions/big_pokeball.4bpp");
|
|
|
|
static const u32 sPokeballTrail_Tileset[] = INCBIN_U32("graphics/battle_transitions/pokeball_trail.4bpp");
|
2020-06-01 16:17:25 +02:00
|
|
|
static const u8 sPokeball_Gfx[] = INCBIN_U8("graphics/battle_transitions/pokeball.4bpp");
|
|
|
|
static const u32 sEliteFour_Tileset[] = INCBIN_U32("graphics/battle_transitions/elite_four_bg.4bpp");
|
|
|
|
static const u8 sUnusedBrendan_Gfx[] = INCBIN_U8("graphics/battle_transitions/unused_brendan.4bpp");
|
|
|
|
static const u8 sUnusedLass_Gfx[] = INCBIN_U8("graphics/battle_transitions/unused_lass.4bpp");
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u32 sShrinkingBoxTileset[] = INCBIN_U32("graphics/battle_transitions/shrinking_box.4bpp");
|
2020-06-02 13:30:05 +02:00
|
|
|
static const u16 sEvilTeam_Palette[] = INCBIN_U16("graphics/battle_transitions/evil_team.gbapal");
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u32 sTeamAqua_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_aqua.4bpp.lz");
|
|
|
|
static const u32 sTeamAqua_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_aqua.bin.lz");
|
|
|
|
static const u32 sTeamMagma_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_magma.4bpp.lz");
|
|
|
|
static const u32 sTeamMagma_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_magma.bin.lz");
|
2020-06-01 16:17:25 +02:00
|
|
|
static const u32 sRegis_Tileset[] = INCBIN_U32("graphics/battle_transitions/regis.4bpp");
|
2020-06-02 13:30:05 +02:00
|
|
|
static const u16 sRegice_Palette[] = INCBIN_U16("graphics/battle_transitions/regice.gbapal");
|
|
|
|
static const u16 sRegisteel_Palette[] = INCBIN_U16("graphics/battle_transitions/registeel.gbapal");
|
|
|
|
static const u16 sRegirock_Palette[] = INCBIN_U16("graphics/battle_transitions/regirock.gbapal");
|
2020-06-01 16:17:25 +02:00
|
|
|
static const u32 sRegice_Tilemap[] = INCBIN_U32("graphics/battle_transitions/regice.bin");
|
|
|
|
static const u32 sRegisteel_Tilemap[] = INCBIN_U32("graphics/battle_transitions/registeel.bin");
|
|
|
|
static const u32 sRegirock_Tilemap[] = INCBIN_U32("graphics/battle_transitions/regirock.bin");
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u16 gUnknown_085BDB14[] = INCBIN_U16("graphics/battle_transitions/85BDB14.gbapal");
|
2020-06-01 16:17:25 +02:00
|
|
|
static const u32 sKyogre_Tileset[] = INCBIN_U32("graphics/battle_transitions/kyogre.4bpp.lz");
|
|
|
|
static const u32 sKyogre_Tilemap[] = INCBIN_U32("graphics/battle_transitions/kyogre.bin.lz");
|
|
|
|
static const u32 sGroudon_Tileset[] = INCBIN_U32("graphics/battle_transitions/groudon.4bpp.lz");
|
|
|
|
static const u32 sGroudon_Tilemap[] = INCBIN_U32("graphics/battle_transitions/groudon.bin.lz");
|
|
|
|
static const u16 sKyogre1_Palette[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt1.gbapal");
|
|
|
|
static const u16 sKyogre2_Palette[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt2.gbapal");
|
|
|
|
static const u16 sGroudon1_Palette[] = INCBIN_U16("graphics/battle_transitions/groudon_pt1.gbapal");
|
|
|
|
static const u16 sGroudon2_Palette[] = INCBIN_U16("graphics/battle_transitions/groudon_pt2.gbapal");
|
|
|
|
static const u16 sRayquaza_Palette[] = INCBIN_U16("graphics/battle_transitions/rayquaza.gbapal");
|
|
|
|
static const u32 sRayquaza_Tileset[] = INCBIN_U32("graphics/battle_transitions/rayquaza.4bpp");
|
|
|
|
static const u32 sRayquaza_Tilemap[] = INCBIN_U32("graphics/battle_transitions/rayquaza.bin");
|
2020-07-02 21:45:37 +02:00
|
|
|
static const u16 sFrontierLogo_Palette[] = INCBIN_U16("graphics/battle_transitions/frontier_logo.gbapal");
|
|
|
|
static const u32 sFrontierLogo_Tileset[] = INCBIN_U32("graphics/battle_transitions/frontier_logo.4bpp.lz");
|
|
|
|
static const u32 sFrontierLogo_Tilemap[] = INCBIN_U32("graphics/battle_transitions/frontier_logo.bin.lz");
|
|
|
|
static const u16 sFrontierSquares_Palette[] = INCBIN_U16("graphics/battle_transitions/frontier_squares_blanktiles.gbapal");
|
|
|
|
static const u32 sFrontierSquares_FilledBg_Tileset[] = INCBIN_U32("graphics/battle_transitions/frontier_square_1.4bpp.lz");
|
|
|
|
static const u32 sFrontierSquares_EmptyBg_Tileset[] = INCBIN_U32("graphics/battle_transitions/frontier_square_2.4bpp.lz");
|
|
|
|
static const u32 sFrontierSquares_Shrink1_Tileset[] = INCBIN_U32("graphics/battle_transitions/frontier_square_3.4bpp.lz");
|
|
|
|
static const u32 sFrontierSquares_Shrink2_Tileset[] = INCBIN_U32("graphics/battle_transitions/frontier_square_4.4bpp.lz");
|
|
|
|
static const u32 sFrontierSquares_Tilemap[] = INCBIN_U32("graphics/battle_transitions/frontier_squares.bin");
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
// All battle transitions use the same intro
|
|
|
|
static const TaskFunc sTasks_Intro[B_TRANSITION_COUNT] =
|
2018-01-01 17:41:34 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
[0 ... B_TRANSITION_COUNT - 1] = &Task_Intro
|
2018-01-01 17:41:34 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
// After the intro each transition has a unique main task.
|
|
|
|
// This task will call the functions that do the transition effects.
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TaskFunc sTasks_Main[B_TRANSITION_COUNT] =
|
|
|
|
{
|
|
|
|
[B_TRANSITION_BLUR] = Task_Blur,
|
|
|
|
[B_TRANSITION_SWIRL] = Task_Swirl,
|
|
|
|
[B_TRANSITION_SHUFFLE] = Task_Shuffle,
|
|
|
|
[B_TRANSITION_BIG_POKEBALL] = Task_BigPokeball,
|
|
|
|
[B_TRANSITION_POKEBALLS_TRAIL] = Task_PokeballsTrail,
|
|
|
|
[B_TRANSITION_CLOCKWISE_BLACKFADE] = Task_Clockwise_BlackFade,
|
|
|
|
[B_TRANSITION_RIPPLE] = Task_Ripple,
|
|
|
|
[B_TRANSITION_WAVE] = Task_Wave,
|
|
|
|
[B_TRANSITION_SLICE] = Task_Slice,
|
|
|
|
[B_TRANSITION_WHITEFADE] = Task_WhiteFade,
|
|
|
|
[B_TRANSITION_GRID_SQUARES] = Task_GridSquares,
|
|
|
|
[B_TRANSITION_SHARDS] = Task_Shards,
|
|
|
|
[B_TRANSITION_SIDNEY] = Task_Sidney,
|
|
|
|
[B_TRANSITION_PHOEBE] = Task_Phoebe,
|
|
|
|
[B_TRANSITION_GLACIA] = Task_Glacia,
|
|
|
|
[B_TRANSITION_DRAKE] = Task_Drake,
|
|
|
|
[B_TRANSITION_CHAMPION] = Task_Champion,
|
|
|
|
[B_TRANSITION_AQUA] = Task_Aqua,
|
|
|
|
[B_TRANSITION_MAGMA] = Task_Magma,
|
|
|
|
[B_TRANSITION_REGICE] = Task_Regice,
|
|
|
|
[B_TRANSITION_REGISTEEL] = Task_Registeel,
|
|
|
|
[B_TRANSITION_REGIROCK] = Task_Regirock,
|
|
|
|
[B_TRANSITION_KYOGRE] = Task_Kyogre,
|
|
|
|
[B_TRANSITION_GROUDON] = Task_Groudon,
|
|
|
|
[B_TRANSITION_RAYQUAZA] = Task_Rayquaza,
|
|
|
|
[B_TRANSITION_SHRED_SPLIT] = Task_ShredSplit,
|
|
|
|
[B_TRANSITION_BLACKHOLE1] = Task_Blackhole1,
|
|
|
|
[B_TRANSITION_BLACKHOLE2] = Task_Blackhole2,
|
|
|
|
[B_TRANSITION_RECTANGULAR_SPIRAL] = Task_RectangularSpiral,
|
|
|
|
[B_TRANSITION_FRONTIER_LOGO_WIGGLE] = Task_FrontierLogoWiggle,
|
|
|
|
[B_TRANSITION_FRONTIER_LOGO_WAVE] = Task_FrontierLogoWave,
|
|
|
|
[B_TRANSITION_FRONTIER_SQUARES] = Task_FrontierSquares,
|
|
|
|
[B_TRANSITION_FRONTIER_SQUARES_SCROLL] = Task_FrontierSquaresScroll,
|
|
|
|
[B_TRANSITION_FRONTIER_SQUARES_SPIRAL] = Task_FrontierSquaresSpiral,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_MEET] = Task_FrontierCirclesMeet,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_CROSS] = Task_FrontierCirclesCross,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL] = Task_FrontierCirclesAsymmetricSpiral,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL] = Task_FrontierCirclesSymmetricSpiral,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ] = Task_FrontierCirclesMeetInSeq,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ] = Task_FrontierCirclesCrossInSeq,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ] = Task_FrontierCirclesAsymmetricSpiralInSeq,
|
|
|
|
[B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ] = Task_FrontierCirclesSymmetricSpiralInSeq,
|
2018-01-01 17:41:34 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sTaskHandlers[] =
|
2018-01-01 17:41:34 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
&Transition_StartIntro,
|
|
|
|
&Transition_WaitForIntro,
|
|
|
|
&Transition_StartMain,
|
|
|
|
&Transition_WaitForMain
|
2018-01-01 17:41:34 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sBlur_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Blur_Init,
|
|
|
|
Blur_Main,
|
|
|
|
Blur_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sSwirl_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Swirl_Init,
|
|
|
|
Swirl_End,
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sShuffle_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Shuffle_Init,
|
|
|
|
Shuffle_End,
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sAqua_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Aqua_Init,
|
|
|
|
Aqua_SetGfx,
|
|
|
|
PatternWeave_1,
|
|
|
|
PatternWeave_2,
|
|
|
|
PatternWeave_3,
|
2021-10-25 16:20:48 +02:00
|
|
|
FramesCountdown,
|
2021-10-25 16:42:08 +02:00
|
|
|
PatternWeave_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sMagma_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Magma_Init,
|
|
|
|
Magma_SetGfx,
|
|
|
|
PatternWeave_1,
|
|
|
|
PatternWeave_2,
|
|
|
|
PatternWeave_3,
|
2021-10-25 16:20:48 +02:00
|
|
|
FramesCountdown,
|
2021-10-25 16:42:08 +02:00
|
|
|
PatternWeave_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sBigPokeball_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
BigPokeball_Init,
|
|
|
|
BigPokeball_SetGfx,
|
|
|
|
PatternWeave_1,
|
|
|
|
PatternWeave_2,
|
|
|
|
PatternWeave_3,
|
|
|
|
PatternWeave_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sRegice_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Regi_Init,
|
|
|
|
Regice_SetGfx,
|
|
|
|
PatternWeave_1,
|
|
|
|
PatternWeave_2,
|
|
|
|
PatternWeave_3,
|
|
|
|
PatternWeave_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sRegisteel_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Regi_Init,
|
|
|
|
Registeel_SetGfx,
|
|
|
|
PatternWeave_1,
|
|
|
|
PatternWeave_2,
|
|
|
|
PatternWeave_3,
|
|
|
|
PatternWeave_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sRegirock_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Regi_Init,
|
|
|
|
Regirock_SetGfx,
|
|
|
|
PatternWeave_1,
|
|
|
|
PatternWeave_2,
|
|
|
|
PatternWeave_3,
|
|
|
|
PatternWeave_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sKyogre_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
WeatherTrio_BgFadeBlack,
|
|
|
|
WeatherTrio_WaitFade,
|
|
|
|
Kyogre_Init,
|
|
|
|
Kyogre_PalettePulsate,
|
|
|
|
Kyogre_PaletteBrighten,
|
2021-10-25 16:20:48 +02:00
|
|
|
FramesCountdown,
|
2021-10-25 16:42:08 +02:00
|
|
|
WeatherDuo_FadeOut,
|
|
|
|
WeatherDuo_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sPokeballsTrail_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
PokeballsTrail_Init,
|
|
|
|
PokeballsTrail_Main,
|
|
|
|
PokeballsTrail_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 sUnknown_085C8B88[2] = {-16, 256};
|
|
|
|
static const s16 sUnknown_085C8B8C[5] = {0, 32, 64, 18, 48};
|
|
|
|
static const s16 sUnknown_085C8B96[2] = {8, -8};
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sClockwise_BlackFade_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Clockwise_BlackFade_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
Clockwise_BlackFade_Func2,
|
|
|
|
Clockwise_BlackFade_Func3,
|
|
|
|
Clockwise_BlackFade_Func4,
|
|
|
|
Clockwise_BlackFade_Func5,
|
|
|
|
Clockwise_BlackFade_Func6,
|
2021-10-25 16:42:08 +02:00
|
|
|
Clockwise_BlackFade_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sRipple_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Ripple_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
Ripple_Func2
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sWave_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Wave_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
Wave_Func2,
|
2021-10-25 16:42:08 +02:00
|
|
|
Wave_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sMugshot_Funcs[] =
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Mugshot_Init,
|
|
|
|
Mugshot_SetGfx,
|
|
|
|
Mugshot_ShowBanner,
|
|
|
|
Mugshot_StartOpponentSlide,
|
|
|
|
Mugshot_WaitStartPlayerSlide,
|
|
|
|
Mugshot_WaitPlayerSlide,
|
|
|
|
Mugshot_GradualWhiteFade,
|
|
|
|
Mugshot_InitFadeWhiteToBlack,
|
|
|
|
Mugshot_FadeToBlack,
|
|
|
|
Mugshot_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
[MUGSHOT_SIDNEY] = TRAINER_PIC_ELITE_FOUR_SIDNEY,
|
|
|
|
[MUGSHOT_PHOEBE] = TRAINER_PIC_ELITE_FOUR_PHOEBE,
|
|
|
|
[MUGSHOT_GLACIA] = TRAINER_PIC_ELITE_FOUR_GLACIA,
|
|
|
|
[MUGSHOT_DRAKE] = TRAINER_PIC_ELITE_FOUR_DRAKE,
|
2020-05-31 12:41:27 +02:00
|
|
|
[MUGSHOT_CHAMPION] = TRAINER_PIC_CHAMPION_WALLACE,
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-05-31 12:41:27 +02:00
|
|
|
[MUGSHOT_SIDNEY] = {0x200, 0x200},
|
|
|
|
[MUGSHOT_PHOEBE] = {0x200, 0x200},
|
|
|
|
[MUGSHOT_GLACIA] = {0x1B0, 0x1B0},
|
|
|
|
[MUGSHOT_DRAKE] = {0x1A0, 0x1A0},
|
|
|
|
[MUGSHOT_CHAMPION] = {0x188, 0x188},
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
[MUGSHOT_SIDNEY] = { 0, 0},
|
|
|
|
[MUGSHOT_PHOEBE] = { 0, 0},
|
|
|
|
[MUGSHOT_GLACIA] = {-4, 4},
|
|
|
|
[MUGSHOT_DRAKE] = { 0, 5},
|
|
|
|
[MUGSHOT_CHAMPION] = {-8, 7},
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static const TransitionSpriteCallback sMugshotTrainerPicFuncs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
MugshotTrainerPic_Nothing,
|
|
|
|
MugshotTrainerPic_SetSlideOffsets,
|
|
|
|
MugshotTrainerPic_Slide1,
|
|
|
|
MugshotTrainerPic_Slide2,
|
|
|
|
MugshotTrainerPic_Nothing,
|
|
|
|
MugshotTrainerPic_Slide3,
|
|
|
|
MugshotTrainerPic_Nothing
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const s16 sTrainerPicSlideOffsets1[2] = {12, -12};
|
2021-10-25 16:42:08 +02:00
|
|
|
static const s16 sTrainerPicSlideOffsets2[2] = {-1, 1};
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sSlice_Funcs[] =
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Slice_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
Slice_Func2,
|
2021-10-25 16:42:08 +02:00
|
|
|
Slice_End
|
2018-01-02 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sShredSplit_Funcs[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
ShredSplit_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
ShredSplit_Func2,
|
|
|
|
ShredSplit_Func3,
|
2021-10-25 16:42:08 +02:00
|
|
|
ShredSplit_End
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u8 gUnknown_085C8C64[] = {39, 119};
|
|
|
|
static const s16 gUnknown_085C8C66[] = {1, -1};
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sBlackhole1_Funcs[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Blackhole_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
Blackhole1_Func2,
|
|
|
|
Blackhole1_Func3
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sBlackhole2_Funcs[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Blackhole_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
Blackhole2_Func2
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 gUnknown_085C8C80[] = {-6, 4};
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sRectangularSpiral_Funcs[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
RectangularSpiral_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
RectangularSpiral_Func2,
|
2021-10-25 16:42:08 +02:00
|
|
|
RectangularSpiral_End
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 gUnknown_085C8C90[] = {1, 27, 275, -1};
|
|
|
|
static const s16 gUnknown_085C8C98[] = {2, 486, -1};
|
|
|
|
static const s16 gUnknown_085C8C9E[] = {3, 262, -1};
|
|
|
|
static const s16 gUnknown_085C8CA4[] = {4, 507, -2};
|
|
|
|
static const s16 gUnknown_085C8CAA[] = {1, 213, -1};
|
|
|
|
static const s16 gUnknown_085C8CB0[] = {2, 548, -2};
|
|
|
|
static const s16 gUnknown_085C8CB6[] = {3, 196, -1};
|
|
|
|
static const s16 gUnknown_085C8CBC[] = {4, 573, 309, -1};
|
|
|
|
static const s16 gUnknown_085C8CC4[] = {1, 474, -1};
|
|
|
|
static const s16 gUnknown_085C8CCA[] = {2, 295, 32, -1};
|
|
|
|
static const s16 gUnknown_085C8CD2[] = {3, 58, -1};
|
|
|
|
static const s16 gUnknown_085C8CD8[] = {4, 455, -1};
|
|
|
|
static const s16 gUnknown_085C8CDE[] = {1, 540, -1};
|
|
|
|
static const s16 gUnknown_085C8CE4[] = {2, 229, -1};
|
|
|
|
static const s16 gUnknown_085C8CEA[] = {3, 244, 28, -1};
|
|
|
|
static const s16 gUnknown_085C8CF2[] = {4, 517, -1};
|
|
|
|
|
|
|
|
static const s16 *const gUnknown_085C8CF8[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2018-12-05 15:31:01 +01:00
|
|
|
gUnknown_085C8C90,
|
|
|
|
gUnknown_085C8CA4,
|
|
|
|
gUnknown_085C8C98,
|
|
|
|
gUnknown_085C8C9E,
|
|
|
|
gUnknown_085C8CEA,
|
|
|
|
gUnknown_085C8CE4,
|
|
|
|
gUnknown_085C8CF2,
|
|
|
|
gUnknown_085C8CDE
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 *const gUnknown_085C8D18[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2018-12-05 15:31:01 +01:00
|
|
|
gUnknown_085C8CBC,
|
|
|
|
gUnknown_085C8CB0,
|
|
|
|
gUnknown_085C8CB6,
|
|
|
|
gUnknown_085C8CAA,
|
|
|
|
gUnknown_085C8CCA,
|
|
|
|
gUnknown_085C8CD8,
|
|
|
|
gUnknown_085C8CC4,
|
|
|
|
gUnknown_085C8CD2
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 *const *const gUnknown_085C8D38[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2018-12-05 15:31:01 +01:00
|
|
|
gUnknown_085C8CF8,
|
|
|
|
gUnknown_085C8D18
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sGroudon_Funcs[] =
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
WeatherTrio_BgFadeBlack,
|
|
|
|
WeatherTrio_WaitFade,
|
|
|
|
Groudon_Init,
|
|
|
|
Groudon_PalettePulsate,
|
|
|
|
Groudon_PaletteBrighten,
|
2021-10-25 16:20:48 +02:00
|
|
|
FramesCountdown,
|
2021-10-25 16:42:08 +02:00
|
|
|
WeatherDuo_FadeOut,
|
|
|
|
WeatherDuo_End
|
2018-01-13 21:03:07 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sRayquaza_Funcs[] =
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
WeatherTrio_BgFadeBlack,
|
|
|
|
WeatherTrio_WaitFade,
|
2021-10-25 16:20:48 +02:00
|
|
|
Rayquaza_Func3,
|
|
|
|
Rayquaza_Func4,
|
|
|
|
Rayquaza_Func5,
|
|
|
|
Rayquaza_Func6,
|
|
|
|
Rayquaza_Func7,
|
|
|
|
Rayquaza_Func8,
|
|
|
|
Rayquaza_Func9,
|
|
|
|
Blackhole1_Func2,
|
|
|
|
Blackhole1_Func3
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sWhiteFade_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
WhiteFade_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
WhiteFade_Func2,
|
|
|
|
WhiteFade_Func3,
|
|
|
|
WhiteFade_Func4,
|
2021-10-25 16:42:08 +02:00
|
|
|
WhiteFade_End
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 sUnknown_085C8DA0[] = {0, 20, 15, 40, 10, 25, 35, 5};
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sGridSquares_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
GridSquares_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
GridSquares_Func2,
|
2021-10-25 16:42:08 +02:00
|
|
|
GridSquares_End
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sShards_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
Shards_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
Shards_Func2,
|
|
|
|
Shards_Func3,
|
|
|
|
Shards_Func4,
|
|
|
|
Shards_Func5
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 sUnknown_085C8DD0[][5] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
{56, 0, 0, 160, 0},
|
|
|
|
{104, 160, 240, 88, 1},
|
|
|
|
{240, 72, 56, 0, 1},
|
|
|
|
{0, 32, 144, 160, 0},
|
|
|
|
{144, 160, 184, 0, 1},
|
|
|
|
{56, 0, 168, 160, 0},
|
|
|
|
{168, 160, 48, 0, 1},
|
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const s16 sUnknown_085C8E16[] = {8, 4, 2, 1, 1, 1, 0};
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sTransitionIntroFuncs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
Transition_Intro_1,
|
|
|
|
Transition_Intro_2
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const struct SpriteFrameImage sSpriteImage_Pokeball[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sPokeball_Gfx, sizeof(sPokeball_Gfx)
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const union AnimCmd sSpriteAnim_Pokeball[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 1),
|
|
|
|
ANIMCMD_END
|
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const union AnimCmd *const sSpriteAnimTable_Pokeball[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sSpriteAnim_Pokeball
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const union AffineAnimCmd sSpriteAffineAnim_Pokeball1[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, -4, 1),
|
|
|
|
AFFINEANIMCMD_JUMP(0)
|
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const union AffineAnimCmd sSpriteAffineAnim_Pokeball2[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 4, 1),
|
|
|
|
AFFINEANIMCMD_JUMP(0)
|
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const union AffineAnimCmd *const sSpriteAffineAnimTable_Pokeball[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sSpriteAffineAnim_Pokeball1,
|
|
|
|
sSpriteAffineAnim_Pokeball2
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const struct SpriteTemplate sSpriteTemplate_Pokeball =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-09-14 19:14:14 +02:00
|
|
|
.tileTag = TAG_NONE,
|
2020-07-02 10:59:52 +02:00
|
|
|
.paletteTag = FLDEFF_PAL_TAG_POKEBALL,
|
2019-11-21 04:55:44 +01:00
|
|
|
.oam = &gObjectEventBaseOam_32x32,
|
2020-06-01 16:17:25 +02:00
|
|
|
.anims = sSpriteAnimTable_Pokeball,
|
|
|
|
.images = sSpriteImage_Pokeball,
|
|
|
|
.affineAnims = sSpriteAffineAnimTable_Pokeball,
|
2021-10-25 16:42:08 +02:00
|
|
|
.callback = SpriteCB_FldEffPokeball
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const struct OamData sOam_UnusedBrendanLass =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
.y = 0,
|
2019-12-04 21:25:13 +01:00
|
|
|
.affineMode = ST_OAM_AFFINE_OFF,
|
|
|
|
.objMode = ST_OAM_OBJ_NORMAL,
|
2018-01-14 20:45:44 +01: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(64x64),
|
2018-01-14 20:45:44 +01:00
|
|
|
.x = 0,
|
|
|
|
.matrixNum = 0,
|
2019-03-11 08:12:15 +01:00
|
|
|
.size = SPRITE_SIZE(64x64),
|
2018-01-14 20:45:44 +01:00
|
|
|
.tileNum = 0,
|
|
|
|
.priority = 0,
|
|
|
|
.paletteNum = 0,
|
|
|
|
.affineParam = 0,
|
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const struct SpriteFrameImage sImageTable_UnusedBrendan[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sUnusedBrendan_Gfx, sizeof(sUnusedBrendan_Gfx)
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const struct SpriteFrameImage sImageTable_UnusedLass[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sUnusedLass_Gfx, sizeof(sUnusedLass_Gfx)
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const union AnimCmd sSpriteAnim_UnusedBrendanLass[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 1),
|
|
|
|
ANIMCMD_END
|
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const union AnimCmd *const sSpriteAnimTable_UnusedBrendanLass[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sSpriteAnim_UnusedBrendanLass
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const struct SpriteTemplate sSpriteTemplate_UnusedBrendan =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-09-14 19:14:14 +02:00
|
|
|
.tileTag = TAG_NONE,
|
2021-10-25 16:42:08 +02:00
|
|
|
.paletteTag = PALTAG_UNUSED_MUGSHOT,
|
2020-06-01 16:17:25 +02:00
|
|
|
.oam = &sOam_UnusedBrendanLass,
|
|
|
|
.anims = sSpriteAnimTable_UnusedBrendanLass,
|
|
|
|
.images = sImageTable_UnusedBrendan,
|
2018-01-14 20:45:44 +01:00
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2021-10-25 16:42:08 +02:00
|
|
|
.callback = SpriteCB_MugshotTrainerPic
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static const struct SpriteTemplate sSpriteTemplate_UnusedLass =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-09-14 19:14:14 +02:00
|
|
|
.tileTag = TAG_NONE,
|
2021-10-25 16:42:08 +02:00
|
|
|
.paletteTag = PALTAG_UNUSED_MUGSHOT,
|
2020-06-01 16:17:25 +02:00
|
|
|
.oam = &sOam_UnusedBrendanLass,
|
|
|
|
.anims = sSpriteAnimTable_UnusedBrendanLass,
|
|
|
|
.images = sImageTable_UnusedLass,
|
2018-01-14 20:45:44 +01:00
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2021-10-25 16:42:08 +02:00
|
|
|
.callback = SpriteCB_MugshotTrainerPic
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-07-02 10:59:52 +02:00
|
|
|
static const u16 sFieldEffectPal_Pokeball[] = INCBIN_U16("graphics/field_effects/palettes/pokeball.gbapal");
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2020-07-02 10:59:52 +02:00
|
|
|
const struct SpritePalette gSpritePalette_Pokeball = {sFieldEffectPal_Pokeball, FLDEFF_PAL_TAG_POKEBALL};
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2019-04-16 16:40:32 +02:00
|
|
|
static const u16 sMugshotPal_Sidney[] = INCBIN_U16("graphics/battle_transitions/sidney_bg.gbapal");
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u16 sMugshotPal_Phoebe[] = INCBIN_U16("graphics/battle_transitions/phoebe_bg.gbapal");
|
|
|
|
static const u16 sMugshotPal_Glacia[] = INCBIN_U16("graphics/battle_transitions/glacia_bg.gbapal");
|
|
|
|
static const u16 sMugshotPal_Drake[] = INCBIN_U16("graphics/battle_transitions/drake_bg.gbapal");
|
|
|
|
static const u16 sMugshotPal_Champion[] = INCBIN_U16("graphics/battle_transitions/wallace_bg.gbapal");
|
|
|
|
static const u16 sMugshotPal_Brendan[] = INCBIN_U16("graphics/battle_transitions/brendan_bg.gbapal");
|
|
|
|
static const u16 sMugshotPal_May[] = INCBIN_U16("graphics/battle_transitions/may_bg.gbapal");
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-05-31 12:41:27 +02:00
|
|
|
[MUGSHOT_SIDNEY] = sMugshotPal_Sidney,
|
|
|
|
[MUGSHOT_PHOEBE] = sMugshotPal_Phoebe,
|
|
|
|
[MUGSHOT_GLACIA] = sMugshotPal_Glacia,
|
|
|
|
[MUGSHOT_DRAKE] = sMugshotPal_Drake,
|
|
|
|
[MUGSHOT_CHAMPION] = sMugshotPal_Champion
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2020-05-31 12:41:27 +02:00
|
|
|
static const u16 *const sPlayerMugshotsPals[GENDER_COUNT] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-05-31 12:41:27 +02:00
|
|
|
[MALE] = sMugshotPal_Brendan,
|
|
|
|
[FEMALE] = sMugshotPal_May
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u16 sUnusedTrainerPalette[] = INCBIN_U16("graphics/battle_transitions/unused_trainer.gbapal");
|
2021-10-25 16:42:08 +02:00
|
|
|
static const struct SpritePalette sSpritePalette_UnusedTrainer = {sUnusedTrainerPalette, PALTAG_UNUSED_MUGSHOT};
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static const u16 sBigPokeball_Tilemap[] = INCBIN_U16("graphics/battle_transitions/big_pokeball_map.bin");
|
|
|
|
static const u16 sMugshotsTilemap[] = INCBIN_U16("graphics/battle_transitions/elite_four_bg_map.bin");
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sFrontierLogoWiggle_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
FrontierLogoWiggle_Init,
|
|
|
|
FrontierLogoWiggle_SetGfx,
|
|
|
|
PatternWeave_1,
|
|
|
|
PatternWeave_2,
|
|
|
|
PatternWeave_3,
|
|
|
|
PatternWeave_End
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sFrontierLogoWave_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
FrontierLogoWave_Init,
|
|
|
|
FrontierLogoWave_SetGfx,
|
2021-10-25 16:20:48 +02:00
|
|
|
FrontierLogoWave_Func3,
|
|
|
|
FrontierLogoWave_Func4
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sFrontierSquares_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
FrontierSquares_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
FrontierSquares_Func2,
|
|
|
|
FrontierSquares_Func3,
|
|
|
|
FrontierSquares_End
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sFrontierSquaresSpiral_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
FrontierSquaresSpiral_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
FrontierSquaresSpiral_Func2,
|
|
|
|
FrontierSquaresSpiral_Func3,
|
|
|
|
FrontierSquaresSpiral_Func4,
|
|
|
|
FrontierSquares_End
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static const TransitionStateFunc sFrontierSquaresScroll_Funcs[] =
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
FrontierSquaresScroll_Init,
|
2021-10-25 16:20:48 +02:00
|
|
|
FrontierSquaresScroll_Func2,
|
|
|
|
FrontierSquaresScroll_Func3,
|
|
|
|
FrontierSquaresScroll_Func4,
|
2021-10-25 16:42:08 +02:00
|
|
|
FrontierSquaresScroll_End
|
2018-01-14 20:45:44 +01:00
|
|
|
};
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static const u8 gUnknown_085C9A30[] = {
|
|
|
|
0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
|
|
|
|
0x1b, 0x14, 0x0d, 0x06, 0x05, 0x04, 0x03,
|
|
|
|
0x02, 0x01, 0x00, 0x07, 0x0e, 0x15, 0x16,
|
|
|
|
0x17, 0x18, 0x19, 0x1a, 0x13, 0x0c, 0x0b,
|
|
|
|
0x0a, 0x09, 0x08, 0x0f, 0x10, 0x11, 0x12
|
|
|
|
};
|
|
|
|
|
|
|
|
static const u8 gUnknown_085C9A53[] = {
|
|
|
|
0x00, 0x10, 0x29, 0x16, 0x2c, 0x02, 0x2b, 0x15,
|
|
|
|
0x2e, 0x1b, 0x09, 0x30, 0x26, 0x05, 0x39, 0x3b,
|
|
|
|
0x0c, 0x3f, 0x23, 0x1c, 0x0a, 0x35, 0x07, 0x31,
|
|
|
|
0x27, 0x17, 0x37, 0x01, 0x3e, 0x11, 0x3d, 0x1e,
|
|
|
|
0x06, 0x22, 0x0f, 0x33, 0x20, 0x3a, 0x0d, 0x2d,
|
|
|
|
0x25, 0x34, 0x0b, 0x18, 0x3c, 0x13, 0x38, 0x21,
|
|
|
|
0x1d, 0x32, 0x28, 0x36, 0x0e, 0x03, 0x2f, 0x14,
|
|
|
|
0x12, 0x19, 0x04, 0x24, 0x1a, 0x2a, 0x1f, 0x08
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------
|
|
|
|
// Main transition functions
|
|
|
|
//---------------------------
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2018-01-01 17:41:34 +01:00
|
|
|
static void CB2_TestBattleTransition(void)
|
|
|
|
{
|
|
|
|
switch (sTestingTransitionState)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
LaunchBattleTransitionTask(sTestingTransitionId);
|
|
|
|
sTestingTransitionState++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (IsBattleTransitionDone())
|
|
|
|
{
|
|
|
|
sTestingTransitionState = 0;
|
2018-02-14 00:58:22 +01:00
|
|
|
SetMainCallback2(CB2_ReturnToField);
|
2018-01-01 17:41:34 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
RunTasks();
|
|
|
|
AnimateSprites();
|
|
|
|
BuildOamBuffer();
|
|
|
|
UpdatePaletteFade();
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
// Unused
|
|
|
|
static void TestBattleTransition(u8 transitionId)
|
2018-01-01 17:41:34 +01:00
|
|
|
{
|
|
|
|
sTestingTransitionId = transitionId;
|
|
|
|
SetMainCallback2(CB2_TestBattleTransition);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BattleTransition_StartOnField(u8 transitionId)
|
|
|
|
{
|
|
|
|
gMain.callback2 = CB2_OverworldBasic;
|
|
|
|
LaunchBattleTransitionTask(transitionId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BattleTransition_Start(u8 transitionId)
|
|
|
|
{
|
|
|
|
LaunchBattleTransitionTask(transitionId);
|
|
|
|
}
|
|
|
|
|
2018-01-14 20:45:44 +01:00
|
|
|
// in all tasks data[0] is reserved for the state
|
2018-01-01 17:41:34 +01:00
|
|
|
#define tState data[0]
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
// main task that launches sub-tasks for phase1 and phase2
|
|
|
|
#define tTransitionId data[1]
|
2018-01-01 17:41:34 +01:00
|
|
|
#define tTransitionDone data[15]
|
|
|
|
|
|
|
|
bool8 IsBattleTransitionDone(void)
|
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
u8 taskId = FindTaskIdByFunc(Task_BattleTransition);
|
2018-01-01 17:41:34 +01:00
|
|
|
if (gTasks[taskId].tTransitionDone)
|
|
|
|
{
|
|
|
|
DestroyTask(taskId);
|
2021-10-25 16:42:08 +02:00
|
|
|
FREE_AND_SET_NULL(sTransitionData);
|
2018-01-01 17:41:34 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static void LaunchBattleTransitionTask(u8 transitionId)
|
2018-01-01 17:41:34 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
u8 taskId = CreateTask(Task_BattleTransition, 2);
|
2018-01-14 20:45:44 +01:00
|
|
|
gTasks[taskId].tTransitionId = transitionId;
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData = AllocZeroed(sizeof(*sTransitionData));
|
2018-01-01 17:41:34 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_BattleTransition(u8 taskId)
|
2018-01-01 17:41:34 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sTaskHandlers[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-01 17:41:34 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_StartIntro(struct Task *task)
|
2018-01-01 17:41:34 +01:00
|
|
|
{
|
2018-12-08 19:05:03 +01:00
|
|
|
SetWeatherScreenFadeOut();
|
2018-01-01 17:41:34 +01:00
|
|
|
CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, 0x400);
|
2021-10-25 16:20:48 +02:00
|
|
|
if (sTasks_Intro[task->tTransitionId] != NULL)
|
2018-01-01 17:41:34 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
CreateTask(sTasks_Intro[task->tTransitionId], 4);
|
2018-01-01 17:41:34 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
task->tState = 2;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_WaitForIntro(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
if (FindTaskIdByFunc(sTasks_Intro[task->tTransitionId]) == TASK_NONE)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_StartMain(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
CreateTask(sTasks_Main[task->tTransitionId], 0);
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_WaitForMain(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
task->tTransitionDone = FALSE;
|
2021-10-25 16:20:48 +02:00
|
|
|
if (FindTaskIdByFunc(sTasks_Main[task->tTransitionId]) == TASK_NONE)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tTransitionDone = TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-01-14 20:45:44 +01:00
|
|
|
#undef tTransitionId
|
2018-01-02 20:38:33 +01:00
|
|
|
#undef tTransitionDone
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Intro(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
if (gTasks[taskId].tState == 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].tState++;
|
2021-10-25 16:20:48 +02:00
|
|
|
CreateIntroTask(0, 0, 3, 2, 2);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2021-10-25 16:20:48 +02:00
|
|
|
else if (IsIntroTaskDone())
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-14 20:45:44 +01:00
|
|
|
#define tFuncState data[7]
|
2018-01-02 20:38:33 +01:00
|
|
|
#define tOpponentSpriteId data[13]
|
|
|
|
#define tPlayerSpriteId data[14]
|
|
|
|
#define tMugshotId data[15]
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
//--------------------
|
|
|
|
// B_TRANSITION_BLUR
|
|
|
|
//--------------------
|
|
|
|
|
|
|
|
#define tDelay data[1]
|
|
|
|
#define tCounter data[2]
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Blur(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sBlur_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Blur_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_MOSAIC, 0);
|
|
|
|
SetGpuRegBits(REG_OFFSET_BG1CNT, BGCNT_MOSAIC);
|
|
|
|
SetGpuRegBits(REG_OFFSET_BG2CNT, BGCNT_MOSAIC);
|
|
|
|
SetGpuRegBits(REG_OFFSET_BG3CNT, BGCNT_MOSAIC);
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Blur_Main(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->tDelay != 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tDelay--;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tDelay = 4;
|
|
|
|
if (++task->tCounter == 10)
|
|
|
|
BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK);
|
|
|
|
SetGpuReg(REG_OFFSET_MOSAIC, (task->tCounter & 15) * 17);
|
|
|
|
if (task->tCounter > 14)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Blur_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
u8 taskId = FindTaskIdByFunc(Task_Blur);
|
2018-01-02 20:38:33 +01:00
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#undef tDelay
|
|
|
|
#undef tCounter
|
|
|
|
|
|
|
|
//--------------------
|
|
|
|
// B_TRANSITION_SWIRL
|
|
|
|
//--------------------
|
|
|
|
|
|
|
|
#define tSinIndex data[1]
|
|
|
|
#define tAmplitude data[2]
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Swirl(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sSwirl_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Swirl_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2021-10-25 16:42:08 +02:00
|
|
|
BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 16, RGB_BLACK);
|
|
|
|
SetSinWave(gScanlineEffectRegBuffers[1], sTransitionData->cameraX, 0, 2, 0, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Swirl);
|
|
|
|
SetHBlankCallback(HBlankCB_Swirl);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK);
|
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Swirl_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
task->tSinIndex += 4;
|
|
|
|
task->tAmplitude += 8;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], sTransitionData->cameraX, task->tSinIndex, 2, task->tAmplitude, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
u8 taskId = FindTaskIdByFunc(Task_Swirl);
|
2018-01-02 20:38:33 +01:00
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Swirl(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void HBlankCB_Swirl(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT];
|
2018-01-02 20:38:33 +01:00
|
|
|
REG_BG1HOFS = var;
|
|
|
|
REG_BG2HOFS = var;
|
|
|
|
REG_BG3HOFS = var;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#undef tSinIndex
|
|
|
|
#undef tAmplitude
|
|
|
|
|
|
|
|
//----------------------
|
|
|
|
// B_TRANSITION_SHUFFLE
|
|
|
|
//----------------------
|
|
|
|
|
|
|
|
#define tSinVal data[1]
|
|
|
|
#define tAmplitude data[2]
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Shuffle(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sShuffle_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Shuffle_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 16, RGB_BLACK);
|
|
|
|
memset(gScanlineEffectRegBuffers[1], sTransitionData->cameraY, DISPLAY_HEIGHT * 2);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Shuffle);
|
|
|
|
SetHBlankCallback(HBlankCB_Shuffle);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK);
|
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Shuffle_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 amplitude, sinVal;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
sinVal = task->tSinVal;
|
|
|
|
amplitude = task->tAmplitude >> 8;
|
|
|
|
task->tSinVal += 4224;
|
|
|
|
task->tAmplitude += 384;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++, sinVal += 4224)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 sinIndex = sinVal / 256;
|
|
|
|
gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraY + Sin(sinIndex, amplitude);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!gPaletteFade.active)
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_Shuffle));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Shuffle(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void HBlankCB_Shuffle(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT];
|
2018-01-02 20:38:33 +01:00
|
|
|
REG_BG1VOFS = var;
|
|
|
|
REG_BG2VOFS = var;
|
|
|
|
REG_BG3VOFS = var;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#undef tSinVal
|
|
|
|
#undef tAmplitude
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// B_TRANSITION_BIG_POKEBALL, B_TRANSITION_AQUA, B_TRANSITION_MAGMA,
|
|
|
|
// B_TRANSITION_REGICE, B_TRANSITION_REGISTEEL, B_TRANSITION_REGIROCK
|
|
|
|
// and B_TRANSITION_KYOGRE.
|
|
|
|
//
|
|
|
|
// With the exception of B_TRANSITION_KYOGRE, all of the above transitions
|
|
|
|
// use the same weave effect (see the PatternWeave functions).
|
|
|
|
// Unclear why Kyogre's was grouped here and not with Groudon/Rayquaza's.
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define tBlendTarget1 data[1]
|
|
|
|
#define tBlendTarget2 data[2]
|
|
|
|
#define tBlendDelay data[3]
|
|
|
|
|
|
|
|
// Data 1-3 change purpose for PatternWeave_End
|
|
|
|
#define tEndAmplitude data[1]
|
|
|
|
#define tEndAmplitudeDelta data[2]
|
|
|
|
#define tVBlankSet data[3]
|
|
|
|
|
|
|
|
#define tSinIndex data[4]
|
|
|
|
#define tAmplitude data[5]
|
|
|
|
#define tEndDelay data[8]
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_BigPokeball(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sBigPokeball_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Aqua(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sAqua_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Magma(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sMagma_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Regice(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sRegice_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Registeel(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sRegisteel_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Regirock(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sRegirock_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Kyogre(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sKyogre_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void InitPatternWeaveTransition(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tBlendTarget1 = 16;
|
|
|
|
task->tBlendTarget2 = 0;
|
|
|
|
task->tSinIndex = 0;
|
|
|
|
task->tAmplitude = 0x4000;
|
|
|
|
sTransitionData->WININ = WININ_WIN0_ALL;
|
|
|
|
sTransitionData->WINOUT = 0;
|
|
|
|
sTransitionData->WIN0H = DISPLAY_WIDTH;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
|
|
|
sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL;
|
|
|
|
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1);
|
|
|
|
|
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
|
|
|
gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SetVBlankCallback(VBlankCB_PatternWeave);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Aqua_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tEndDelay = 60;
|
|
|
|
InitPatternWeaveTransition(task);
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-06-01 16:17:25 +02:00
|
|
|
LZ77UnCompVram(sTeamAqua_Tileset, tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sEvilTeam_Palette, 0xF0, sizeof(sEvilTeam_Palette));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Magma_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tEndDelay = 60;
|
|
|
|
InitPatternWeaveTransition(task);
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-06-01 16:17:25 +02:00
|
|
|
LZ77UnCompVram(sTeamMagma_Tileset, tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sEvilTeam_Palette, 0xF0, sizeof(sEvilTeam_Palette));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Regi_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tEndDelay = 60;
|
|
|
|
InitPatternWeaveTransition(task);
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-06-01 16:17:25 +02:00
|
|
|
CpuCopy16(sRegis_Tileset, tileset, 0x2000);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 BigPokeball_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitPatternWeaveTransition(task);
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
|
|
|
CpuCopy16(sBigPokeball_Tileset, tileset, sizeof(sBigPokeball_Tileset));
|
|
|
|
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 BigPokeball_SetGfx(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 i, j;
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2021-10-25 16:42:08 +02:00
|
|
|
const u16 *bigPokeballMap;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
bigPokeballMap = sBigPokeball_Tilemap;
|
2018-01-02 20:38:33 +01:00
|
|
|
for (i = 0; i < 20; i++)
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
for (j = 0; j < 30; j++, bigPokeballMap++)
|
|
|
|
SET_TILEMAP_TILE(tilemap, i, j, *bigPokeballMap | 0xF000);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
|
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Aqua_SetGfx(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
|
|
|
LZ77UnCompVram(sTeamAqua_Tilemap, tilemap);
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Magma_SetGfx(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
|
|
|
LZ77UnCompVram(sTeamMagma_Tilemap, tilemap);
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Regice_SetGfx(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sRegice_Palette, 0xF0, sizeof(sRegice_Palette));
|
2020-06-01 16:17:25 +02:00
|
|
|
CpuCopy16(sRegice_Tilemap, tilemap, 0x500);
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Registeel_SetGfx(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sRegisteel_Palette, 0xF0, sizeof(sRegisteel_Palette));
|
2020-06-01 16:17:25 +02:00
|
|
|
CpuCopy16(sRegisteel_Tilemap, tilemap, 0x500);
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Regirock_SetGfx(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sRegirock_Palette, 0xF0, sizeof(sRegirock_Palette));
|
2020-06-01 16:17:25 +02:00
|
|
|
CpuCopy16(sRegirock_Tilemap, tilemap, 0x500);
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#define tTimer data[1]
|
|
|
|
|
|
|
|
static bool8 Kyogre_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-06-01 16:17:25 +02:00
|
|
|
LZ77UnCompVram(sKyogre_Tileset, tileset);
|
|
|
|
LZ77UnCompVram(sKyogre_Tilemap, tilemap);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Kyogre_PalettePulsate(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->tTimer % 3 == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 var = task->tTimer % 30;
|
2018-01-02 20:38:33 +01:00
|
|
|
var /= 3;
|
2020-06-01 16:17:25 +02:00
|
|
|
LoadPalette(sKyogre1_Palette + (var * 16), 0xF0, 0x20);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->tTimer > 58)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tTimer = 0;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Kyogre_PaletteBrighten(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->tTimer % 5 == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 var = task->tTimer / 5;
|
2020-06-01 16:17:25 +02:00
|
|
|
LoadPalette(sKyogre2_Palette + (var * 16), 0xF0, 0x20);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->tTimer > 68)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tTimer = 0;
|
|
|
|
task->tEndDelay = 30;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 WeatherDuo_FadeOut(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
BeginNormalPaletteFade(PALETTES_OBJECTS | (1 << 15), 1, 0, 16, RGB_BLACK);
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 WeatherDuo_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2018-01-02 20:38:33 +01:00
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#undef tTimer
|
|
|
|
|
|
|
|
// The PatternWeave_ functions are used by several different transitions.
|
|
|
|
// They create an effect where a pattern/image (such as the Magma emblem) is
|
|
|
|
// formed by a shimmering weave effect.
|
|
|
|
static bool8 PatternWeave_1(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
if (task->tBlendDelay == 0 || --task->tBlendDelay == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tBlendTarget2++;
|
|
|
|
task->tBlendDelay = 2;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1);
|
|
|
|
if (task->tBlendTarget2 > 15)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tSinIndex += 8;
|
|
|
|
task->tAmplitude -= 256;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 PatternWeave_2(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
if (task->tBlendDelay == 0 || --task->tBlendDelay == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tBlendTarget1--;
|
|
|
|
task->tBlendDelay = 2;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1);
|
|
|
|
if (task->tBlendTarget1 == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tSinIndex += 8;
|
|
|
|
task->tAmplitude -= 256;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 PatternWeave_3(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
task->tSinIndex += 8;
|
|
|
|
task->tAmplitude -= 256;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->tAmplitude <= 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tEndAmplitude = 160;
|
|
|
|
task->tEndAmplitudeDelta = 256;
|
|
|
|
task->tVBlankSet = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FramesCountdown(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (--task->tEndDelay == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 WeatherTrio_BgFadeBlack(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
BeginNormalPaletteFade(PALETTES_BG, 1, 0, 16, RGB_BLACK);
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 WeatherTrio_WaitFade(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 PatternWeave_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
if (task->tEndAmplitudeDelta < 1024)
|
|
|
|
task->tEndAmplitudeDelta += 128;
|
|
|
|
if (task->tEndAmplitude != 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tEndAmplitude -= task->tEndAmplitudeDelta >> 8;
|
|
|
|
if (task->tEndAmplitude < 0)
|
|
|
|
task->tEndAmplitude = 0;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A014(gScanlineEffectRegBuffers[0], 120, 80, task->tEndAmplitude);
|
|
|
|
if (task->tEndAmplitude == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
SetVBlankCallback(NULL);
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2018-01-02 20:38:33 +01:00
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (!task->tVBlankSet)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tVBlankSet++;
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB1_BigPokeball);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static void Transition_BigPokeball_Vblank(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
|
|
|
REG_BLDCNT = sTransitionData->BLDCNT;
|
|
|
|
REG_BLDALPHA = sTransitionData->BLDALPHA;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void VBlankCB_PatternWeave(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
Transition_BigPokeball_Vblank();
|
2021-10-25 16:42:08 +02:00
|
|
|
DmaSet(0, gScanlineEffectRegBuffers[1], ®_BG0HOFS, B_TRANS_DMA_FLAGS);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB1_BigPokeball(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
Transition_BigPokeball_Vblank();
|
2021-10-25 16:42:08 +02:00
|
|
|
DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#undef tAmplitude
|
|
|
|
#undef tSinIndex
|
|
|
|
#undef tBlendTarget1
|
|
|
|
#undef tBlendTarget2
|
|
|
|
#undef tEndAmplitude
|
|
|
|
#undef tVBlankSet
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_PokeballsTrail(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sPokeballsTrail_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 PokeballsTrail_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
|
|
|
CpuSet(sPokeballTrail_Tileset, tileset, 0x20);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill32(0, tilemap, BG_SCREEN_SIZE);
|
|
|
|
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 PokeballsTrail_Main(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 i;
|
|
|
|
s16 rand;
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 xCoords[ARRAY_COUNT(sUnknown_085C8B88)];
|
2018-01-02 20:38:33 +01:00
|
|
|
s16 arr1[ARRAY_COUNT(sUnknown_085C8B8C)];
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
memcpy(xCoords, sUnknown_085C8B88, sizeof(sUnknown_085C8B88));
|
2018-01-02 20:38:33 +01:00
|
|
|
memcpy(arr1, sUnknown_085C8B8C, sizeof(sUnknown_085C8B8C));
|
|
|
|
rand = Random() & 1;
|
|
|
|
for (i = 0; i <= 4; i++, rand ^= 1)
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
gFieldEffectArguments[0] = xCoords[rand]; // x
|
2018-01-02 20:38:33 +01:00
|
|
|
gFieldEffectArguments[1] = (i * 32) + 16; // y
|
|
|
|
gFieldEffectArguments[2] = rand;
|
|
|
|
gFieldEffectArguments[3] = arr1[i];
|
|
|
|
FieldEffectStart(FLDEFF_POKEBALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 PokeballsTrail_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
if (!FieldEffectActiveListContains(FLDEFF_POKEBALL))
|
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_PokeballsTrail));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#define sData0 data[0]
|
|
|
|
#define sData1 data[1]
|
|
|
|
#define sData2 data[2]
|
|
|
|
|
2018-01-02 20:38:33 +01:00
|
|
|
bool8 FldEff_Pokeball(void)
|
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u8 spriteId = CreateSpriteAtEnd(&sSpriteTemplate_Pokeball, gFieldEffectArguments[0], gFieldEffectArguments[1], 0);
|
2018-01-02 20:38:33 +01:00
|
|
|
gSprites[spriteId].oam.priority = 0;
|
2019-12-05 03:00:45 +01:00
|
|
|
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
2021-10-25 16:42:08 +02:00
|
|
|
gSprites[spriteId].sData0 = gFieldEffectArguments[2];
|
|
|
|
gSprites[spriteId].sData1 = gFieldEffectArguments[3];
|
|
|
|
gSprites[spriteId].sData2 = -1;
|
2018-01-02 20:38:33 +01:00
|
|
|
InitSpriteAffineAnim(&gSprites[spriteId]);
|
|
|
|
StartSpriteAffineAnim(&gSprites[spriteId], gFieldEffectArguments[2]);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void SpriteCB_FldEffPokeball(struct Sprite *sprite)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 arr0[ARRAY_COUNT(sUnknown_085C8B96)];
|
|
|
|
|
|
|
|
memcpy(arr0, sUnknown_085C8B96, sizeof(sUnknown_085C8B96));
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sprite->sData1 != 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sprite->sData1--;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->x >= 0 && sprite->x <= DISPLAY_WIDTH)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
s16 posX = sprite->x >> 3;
|
|
|
|
s16 posY = sprite->y >> 3;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (posX != sprite->sData2)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u32 var;
|
|
|
|
u16 *ptr;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sprite->sData2 = posX;
|
2020-06-01 16:17:25 +02:00
|
|
|
var = (((REG_BG0CNT >> 8) & 0x1F) << 11);
|
2018-01-02 20:38:33 +01:00
|
|
|
ptr = (u16 *)(VRAM + var);
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SET_TILEMAP_TILE(ptr, posY - 2, posX, 0xF001);
|
|
|
|
SET_TILEMAP_TILE(ptr, posY - 1, posX, 0xF001);
|
|
|
|
SET_TILEMAP_TILE(ptr, posY - 0, posX, 0xF001);
|
|
|
|
SET_TILEMAP_TILE(ptr, posY + 1, posX, 0xF001);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
sprite->x += arr0[sprite->sData0];
|
|
|
|
if (sprite->x < -15 || sprite->x > DISPLAY_WIDTH + 15)
|
2018-01-02 20:38:33 +01:00
|
|
|
FieldEffectStop(sprite, FLDEFF_POKEBALL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#undef sData0
|
|
|
|
#undef sData1
|
|
|
|
#undef sData2
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Clockwise_BlackFade(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sClockwise_BlackFade_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Clockwise_BlackFade_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->WININ = 0;
|
|
|
|
sTransitionData->WINOUT = WINOUT_WIN01_ALL;
|
|
|
|
sTransitionData->WIN0H = WIN_RANGE(DISPLAY_WIDTH, DISPLAY_WIDTH + 1);
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
|
|
|
gScanlineEffectRegBuffers[1][i] = WIN_RANGE(DISPLAY_WIDTH + 3, DISPLAY_WIDTH + 4);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Clockwise_BlackFade);
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[4] = 120;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Clockwise_BlackFade_Func2(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A1AC(sTransitionData->data, 120, 80, sTransitionData->data[4], -1, 1, 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
do
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[0][sTransitionData->data[3]] = (sTransitionData->data[2] + 1) | 0x7800;
|
|
|
|
} while (!sub_814A228(sTransitionData->data, 1, 1));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[4] += 16;
|
|
|
|
if (sTransitionData->data[4] >= DISPLAY_WIDTH)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[5] = 0;
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Clockwise_BlackFade_Func3(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 r1, r3;
|
|
|
|
vu8 var = 0;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A1AC(sTransitionData->data, 120, 80, 240, sTransitionData->data[5], 1, 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
r1 = 120, r3 = sTransitionData->data[2] + 1;
|
|
|
|
if (sTransitionData->data[5] >= DISPLAY_HEIGHT / 2)
|
|
|
|
r1 = sTransitionData->data[2], r3 = DISPLAY_WIDTH;
|
|
|
|
gScanlineEffectRegBuffers[0][sTransitionData->data[3]] = (r3) | (r1 << 8);
|
2018-01-02 20:38:33 +01:00
|
|
|
if (var != 0)
|
|
|
|
break;
|
2021-10-25 16:42:08 +02:00
|
|
|
var = sub_814A228(sTransitionData->data, 1, 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[5] += 8;
|
|
|
|
if (sTransitionData->data[5] >= DISPLAY_HEIGHT)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[4] = DISPLAY_WIDTH;
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
while (sTransitionData->data[3] < sTransitionData->data[5])
|
|
|
|
gScanlineEffectRegBuffers[0][++sTransitionData->data[3]] = (r3) | (r1 << 8);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Clockwise_BlackFade_Func4(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A1AC(sTransitionData->data, 120, 80, sTransitionData->data[4], 160, 1, 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
do
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[0][sTransitionData->data[3]] = (sTransitionData->data[2] << 8) | 0xF0;
|
|
|
|
} while (!sub_814A228(sTransitionData->data, 1, 1));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[4] -= 16;
|
|
|
|
if (sTransitionData->data[4] <= 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[5] = DISPLAY_HEIGHT;
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Clockwise_BlackFade_Func5(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 r1, r2, var4;
|
|
|
|
vu8 var = 0;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A1AC(sTransitionData->data, 120, 80, 0, sTransitionData->data[5], 1, 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
r1 = (gScanlineEffectRegBuffers[0][sTransitionData->data[3]]) & 0xFF;
|
|
|
|
r2 = sTransitionData->data[2];
|
|
|
|
if (sTransitionData->data[5] <= DISPLAY_HEIGHT / 2)
|
|
|
|
r2 = 120, r1 = sTransitionData->data[2];
|
2018-01-02 20:38:33 +01:00
|
|
|
var4 = (r1) | (r2 << 8);
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[0][sTransitionData->data[3]] = var4;
|
2018-01-02 20:38:33 +01:00
|
|
|
if (var != 0)
|
|
|
|
break;
|
2021-10-25 16:42:08 +02:00
|
|
|
var = sub_814A228(sTransitionData->data, 1, 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[5] -= 8;
|
|
|
|
if (sTransitionData->data[5] <= 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[4] = 0;
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
while (sTransitionData->data[3] > sTransitionData->data[5])
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[0][--sTransitionData->data[3]] = (r1) | (r2 << 8);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Clockwise_BlackFade_Func6(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A1AC(sTransitionData->data, 120, 80, sTransitionData->data[4], 0, 1, 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
do
|
|
|
|
{
|
|
|
|
s16 r2, r3;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
r2 = 120, r3 = sTransitionData->data[2];
|
|
|
|
if (sTransitionData->data[2] >= 120)
|
|
|
|
r2 = 0, r3 = DISPLAY_WIDTH;
|
|
|
|
gScanlineEffectRegBuffers[0][sTransitionData->data[3]] = (r3) | (r2 << 8);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
} while (!sub_814A228(sTransitionData->data, 1, 1));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->data[4] += 16;
|
|
|
|
if (sTransitionData->data[2] > 120)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Clockwise_BlackFade_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_Clockwise_BlackFade));
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Clockwise_BlackFade(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA != 0)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
2018-01-29 17:47:12 +01:00
|
|
|
REG_WIN0H = gScanlineEffectRegBuffers[1][0];
|
2021-10-25 16:42:08 +02:00
|
|
|
DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Ripple(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sRipple_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Ripple_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
|
|
|
gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraY;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Ripple);
|
|
|
|
SetHBlankCallback(HBlankCB_Ripple);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
EnableInterrupts(INTR_FLAG_HBLANK);
|
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Ripple_Func2(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
s16 r3;
|
|
|
|
u16 r4, r8;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
r3 = task->data[2] >> 8;
|
|
|
|
r4 = task->data[1];
|
2018-01-02 20:38:33 +01:00
|
|
|
r8 = 384;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] += 0x400;
|
|
|
|
if (task->data[2] <= 0x1FFF)
|
|
|
|
task->data[2] += 0x180;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++, r4 += r8)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 var = r4 >> 8;
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraY + Sin(var & 0xffff, r3);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[3] == 81)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[4]++;
|
|
|
|
BeginNormalPaletteFade(PALETTES_ALL, -2, 0, 16, RGB_BLACK);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[4] != 0 && !gPaletteFade.active)
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_Ripple));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Ripple(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void HBlankCB_Ripple(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT];
|
2018-01-02 20:38:33 +01:00
|
|
|
REG_BG1VOFS = var;
|
|
|
|
REG_BG2VOFS = var;
|
|
|
|
REG_BG3VOFS = var;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
// B_TRANSITION_WAVE
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Wave(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sWave_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Wave_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->WININ = WININ_WIN0_ALL;
|
|
|
|
sTransitionData->WINOUT = 0;
|
|
|
|
sTransitionData->WIN0H = DISPLAY_WIDTH;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
|
|
|
gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH + 2;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Wave);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Wave_Func2(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i, r5;
|
|
|
|
u16* toStore;
|
|
|
|
bool8 nextFunc;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-29 17:47:12 +01:00
|
|
|
toStore = gScanlineEffectRegBuffers[0];
|
2021-10-25 16:42:08 +02:00
|
|
|
r5 = task->data[2];
|
|
|
|
task->data[2] += 16;
|
|
|
|
task->data[1] += 8;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0, nextFunc = TRUE; i < DISPLAY_HEIGHT; i++, r5 += 4, toStore++)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 value = task->data[1] + Sin(r5, 40);
|
2018-01-02 20:38:33 +01:00
|
|
|
if (value < 0)
|
|
|
|
value = 0;
|
2021-10-25 16:42:08 +02:00
|
|
|
if (value > DISPLAY_WIDTH)
|
|
|
|
value = DISPLAY_WIDTH;
|
|
|
|
*toStore = (value << 8) | (DISPLAY_WIDTH + 1);
|
|
|
|
if (value < DISPLAY_WIDTH)
|
2018-01-02 20:38:33 +01:00
|
|
|
nextFunc = FALSE;
|
|
|
|
}
|
|
|
|
if (nextFunc)
|
|
|
|
task->tState++;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Wave_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_Wave));
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Wave(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA != 0)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
|
|
|
DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Sidney(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2019-04-16 16:40:32 +02:00
|
|
|
gTasks[taskId].tMugshotId = MUGSHOT_SIDNEY;
|
2021-10-25 16:42:08 +02:00
|
|
|
DoMugshotTransition(taskId);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Phoebe(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].tMugshotId = MUGSHOT_PHOEBE;
|
2021-10-25 16:42:08 +02:00
|
|
|
DoMugshotTransition(taskId);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Glacia(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].tMugshotId = MUGSHOT_GLACIA;
|
2021-10-25 16:42:08 +02:00
|
|
|
DoMugshotTransition(taskId);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Drake(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].tMugshotId = MUGSHOT_DRAKE;
|
2021-10-25 16:42:08 +02:00
|
|
|
DoMugshotTransition(taskId);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Champion(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].tMugshotId = MUGSHOT_CHAMPION;
|
2021-10-25 16:42:08 +02:00
|
|
|
DoMugshotTransition(taskId);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void DoMugshotTransition(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sMugshot_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2021-10-25 16:42:08 +02:00
|
|
|
Mugshots_CreateTrainerPics(task);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 1;
|
|
|
|
task->data[3] = DISPLAY_WIDTH - 1;
|
|
|
|
sTransitionData->WININ = WININ_WIN0_ALL;
|
|
|
|
sTransitionData->WINOUT = WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-29 17:47:12 +01:00
|
|
|
gScanlineEffectRegBuffers[1][i] = 0xF0F1;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB0_Mugshots);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_SetGfx(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 i, j;
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
|
|
|
const u16 *mugshotsMap;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
mugshotsMap = sMugshotsTilemap;
|
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
|
|
|
CpuSet(sEliteFour_Tileset, tileset, 0xF0);
|
2018-01-02 20:38:33 +01:00
|
|
|
LoadPalette(sOpponentMugshotsPals[task->tMugshotId], 0xF0, 0x20);
|
|
|
|
LoadPalette(sPlayerMugshotsPals[gSaveBlock2Ptr->playerGender], 0xFA, 0xC);
|
|
|
|
|
|
|
|
for (i = 0; i < 20; i++)
|
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
for (j = 0; j < 32; j++, mugshotsMap++)
|
2021-10-25 16:42:08 +02:00
|
|
|
SET_TILEMAP_TILE(tilemap, i, j, *mugshotsMap | 0xF000);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
EnableInterrupts(INTR_FLAG_HBLANK);
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetHBlankCallback(HBlankCB_Mugshots);
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_ShowBanner(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i, r5;
|
|
|
|
u16* toStore;
|
|
|
|
s16 value;
|
|
|
|
s32 mergedValue;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2018-01-29 17:47:12 +01:00
|
|
|
toStore = gScanlineEffectRegBuffers[0];
|
2021-10-25 16:42:08 +02:00
|
|
|
r5 = task->data[1];
|
|
|
|
task->data[1] += 16;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT / 2; i++, toStore++, r5 += 16)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
value = task->data[2] + Sin(r5, 16);
|
2018-01-02 20:38:33 +01:00
|
|
|
if (value < 0)
|
|
|
|
value = 1;
|
2021-10-25 16:42:08 +02:00
|
|
|
if (value > DISPLAY_WIDTH)
|
|
|
|
value = DISPLAY_WIDTH;
|
2018-01-02 20:38:33 +01:00
|
|
|
*toStore = value;
|
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
for (; i < DISPLAY_HEIGHT; i++, toStore++, r5 += 16)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
value = task->data[3] - Sin(r5, 16);
|
2018-01-02 20:38:33 +01:00
|
|
|
if (value < 0)
|
|
|
|
value = 0;
|
2021-10-25 16:42:08 +02:00
|
|
|
if (value > DISPLAY_WIDTH - 1)
|
|
|
|
value = DISPLAY_WIDTH - 1;
|
|
|
|
*toStore = (value << 8) | (DISPLAY_WIDTH);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] += 8;
|
|
|
|
task->data[3] -= 8;
|
|
|
|
if (task->data[2] > DISPLAY_WIDTH)
|
|
|
|
task->data[2] = DISPLAY_WIDTH;
|
|
|
|
if (task->data[3] < 0)
|
|
|
|
task->data[3] = 0;
|
|
|
|
mergedValue = *(s32*)(&task->data[2]);
|
|
|
|
if (mergedValue == DISPLAY_WIDTH)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->BG0HOFS_Lower -= 8;
|
|
|
|
sTransitionData->BG0HOFS_Upper += 8;
|
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_StartOpponentSlide(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
u16* toStore;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0, toStore = gScanlineEffectRegBuffers[0]; i < DISPLAY_HEIGHT; i++, toStore++)
|
|
|
|
*toStore = DISPLAY_WIDTH;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
|
|
|
|
|
|
|
sTransitionData->BG0HOFS_Lower -= 8;
|
|
|
|
sTransitionData->BG0HOFS_Upper += 8;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
SetTrainerPicSlideTable(task->tOpponentSpriteId, 0);
|
|
|
|
SetTrainerPicSlideTable(task->tPlayerSpriteId, 1);
|
|
|
|
IncrementTrainerPicState(task->tOpponentSpriteId);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-08-21 00:02:00 +02:00
|
|
|
PlaySE(SE_MUGSHOT);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_WaitStartPlayerSlide(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->BG0HOFS_Lower -= 8;
|
|
|
|
sTransitionData->BG0HOFS_Upper += 8;
|
|
|
|
|
|
|
|
// Start player's pic slide in once the opponent is finished
|
2020-06-01 16:17:25 +02:00
|
|
|
if (IsTrainerPicSlideDone(task->tOpponentSpriteId))
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2020-06-01 16:17:25 +02:00
|
|
|
IncrementTrainerPicState(task->tPlayerSpriteId);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_WaitPlayerSlide(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->BG0HOFS_Lower -= 8;
|
|
|
|
sTransitionData->BG0HOFS_Upper += 8;
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
if (IsTrainerPicSlideDone(task->tPlayerSpriteId))
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
SetVBlankCallback(NULL);
|
|
|
|
DmaStop(0);
|
2021-10-25 16:42:08 +02:00
|
|
|
memset(gScanlineEffectRegBuffers[0], 0, DISPLAY_HEIGHT * 2);
|
|
|
|
memset(gScanlineEffectRegBuffers[1], 0, DISPLAY_HEIGHT * 2);
|
2021-04-15 08:04:01 +02:00
|
|
|
SetGpuReg(REG_OFFSET_WIN0H, DISPLAY_WIDTH);
|
2018-01-02 20:38:33 +01:00
|
|
|
SetGpuReg(REG_OFFSET_BLDY, 0);
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[4] = 0;
|
|
|
|
sTransitionData->BLDCNT = BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN;
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB1_Mugshots);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_GradualWhiteFade(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
bool32 active;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
active = TRUE;
|
|
|
|
sTransitionData->BG0HOFS_Lower -= 8;
|
|
|
|
sTransitionData->BG0HOFS_Upper += 8;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[4] < DISPLAY_HEIGHT / 2)
|
|
|
|
task->data[4] += 2;
|
|
|
|
if (task->data[4] > DISPLAY_HEIGHT / 2)
|
|
|
|
task->data[4] = DISPLAY_HEIGHT / 2;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[3] & 1)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
s16 i;
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0, active = FALSE; i <= task->data[4]; i++)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 index1 = DISPLAY_HEIGHT / 2 - i;
|
|
|
|
s16 index2 = DISPLAY_HEIGHT / 2 + i;
|
2018-01-29 17:47:12 +01:00
|
|
|
if (gScanlineEffectRegBuffers[0][index1] <= 15)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
active = TRUE;
|
2018-01-29 17:47:12 +01:00
|
|
|
gScanlineEffectRegBuffers[0][index1]++;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
2018-01-29 17:47:12 +01:00
|
|
|
if (gScanlineEffectRegBuffers[0][index2] <= 15)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
active = TRUE;
|
2018-01-29 17:47:12 +01:00
|
|
|
gScanlineEffectRegBuffers[0][index2]++;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[4] == DISPLAY_HEIGHT / 2 && !active)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_InitFadeWhiteToBlack(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
BlendPalettes(PALETTES_ALL, 16, RGB_WHITE);
|
|
|
|
sTransitionData->BLDCNT = 0xFF;
|
|
|
|
task->data[3] = 0;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_FadeToBlack(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[3]++;
|
|
|
|
memset(gScanlineEffectRegBuffers[0], task->data[3], DISPLAY_HEIGHT * 2);
|
|
|
|
if (task->data[3] > 15)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Mugshot_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2018-01-02 20:38:33 +01:00
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB0_Mugshots(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA != 0)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
|
|
|
REG_BG0VOFS = sTransitionData->BG0VOFS;
|
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
|
|
|
DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB1_Mugshots(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA != 0)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
|
|
|
REG_BLDCNT = sTransitionData->BLDCNT;
|
|
|
|
DmaSet(0, gScanlineEffectRegBuffers[1], ®_BLDY, B_TRANS_DMA_FLAGS);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void HBlankCB_Mugshots(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (REG_VCOUNT < DISPLAY_HEIGHT / 2)
|
|
|
|
REG_BG0HOFS = sTransitionData->BG0HOFS_Lower;
|
2018-01-02 20:38:33 +01:00
|
|
|
else
|
2021-10-25 16:42:08 +02:00
|
|
|
REG_BG0HOFS = sTransitionData->BG0HOFS_Upper;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
// data fields for player/opponent sprites in mugshots
|
|
|
|
#define sState data[0]
|
|
|
|
#define sOffsetX data[1]
|
|
|
|
#define sOffsetX2 data[2]
|
|
|
|
#define sDone data[6]
|
|
|
|
#define sSlideTableId data[7]
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void Mugshots_CreateTrainerPics(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
struct Sprite *opponentSprite, *playerSprite;
|
|
|
|
|
|
|
|
s16 mugshotId = task->tMugshotId;
|
|
|
|
task->tOpponentSpriteId = CreateTrainerSprite(sMugshotsTrainerPicIDsTable[mugshotId],
|
|
|
|
sMugshotsOpponentCoords[mugshotId][0] - 32,
|
|
|
|
sMugshotsOpponentCoords[mugshotId][1] + 42,
|
|
|
|
0, gDecompressionBuffer);
|
2021-10-25 16:42:08 +02:00
|
|
|
task->tPlayerSpriteId = CreateTrainerSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender),
|
|
|
|
DISPLAY_WIDTH + 32,
|
|
|
|
106,
|
|
|
|
0, gDecompressionBuffer);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
opponentSprite = &gSprites[task->tOpponentSpriteId];
|
|
|
|
playerSprite = &gSprites[task->tPlayerSpriteId];
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
opponentSprite->callback = SpriteCB_MugshotTrainerPic;
|
|
|
|
playerSprite->callback = SpriteCB_MugshotTrainerPic;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2019-12-05 03:00:45 +01:00
|
|
|
opponentSprite->oam.affineMode = ST_OAM_AFFINE_DOUBLE;
|
|
|
|
playerSprite->oam.affineMode = ST_OAM_AFFINE_DOUBLE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
opponentSprite->oam.matrixNum = AllocOamMatrix();
|
|
|
|
playerSprite->oam.matrixNum = AllocOamMatrix();
|
|
|
|
|
2019-12-05 03:00:45 +01:00
|
|
|
opponentSprite->oam.shape = SPRITE_SHAPE(64x32);
|
|
|
|
playerSprite->oam.shape = SPRITE_SHAPE(64x32);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2019-12-05 03:00:45 +01:00
|
|
|
opponentSprite->oam.size = SPRITE_SIZE(64x32);
|
|
|
|
playerSprite->oam.size = SPRITE_SIZE(64x32);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2019-12-05 03:00:45 +01:00
|
|
|
CalcCenterToCornerVec(opponentSprite, SPRITE_SHAPE(64x32), SPRITE_SIZE(64x32), ST_OAM_AFFINE_DOUBLE);
|
|
|
|
CalcCenterToCornerVec(playerSprite, SPRITE_SHAPE(64x32), SPRITE_SIZE(64x32), ST_OAM_AFFINE_DOUBLE);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
SetOamMatrixRotationScaling(opponentSprite->oam.matrixNum, sMugshotsOpponentRotationScales[mugshotId][0], sMugshotsOpponentRotationScales[mugshotId][1], 0);
|
|
|
|
SetOamMatrixRotationScaling(playerSprite->oam.matrixNum, -512, 512, 0);
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void SpriteCB_MugshotTrainerPic(struct Sprite *sprite)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
while (sMugshotTrainerPicFuncs[sprite->sState](sprite));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 MugshotTrainerPic_Nothing(struct Sprite *sprite)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 MugshotTrainerPic_SetSlideOffsets(struct Sprite *sprite)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 offsets1[ARRAY_COUNT(sTrainerPicSlideOffsets1)];
|
|
|
|
s16 offsets2[ARRAY_COUNT(sTrainerPicSlideOffsets2)];
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
memcpy(offsets1, sTrainerPicSlideOffsets1, sizeof(sTrainerPicSlideOffsets1));
|
|
|
|
memcpy(offsets2, sTrainerPicSlideOffsets2, sizeof(sTrainerPicSlideOffsets2));
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
sprite->sState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
sprite->sOffsetX = offsets1[sprite->sSlideTableId];
|
|
|
|
sprite->sOffsetX2 = offsets2[sprite->sSlideTableId];
|
2018-01-02 20:38:33 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
// fast slide to around middle screen
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 MugshotTrainerPic_Slide1(struct Sprite *sprite)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->sOffsetX;
|
|
|
|
if (sprite->sSlideTableId && sprite->x < 133)
|
2020-06-01 16:17:25 +02:00
|
|
|
sprite->sState++;
|
2021-07-07 15:11:52 +02:00
|
|
|
else if (!sprite->sSlideTableId && sprite->x > 103)
|
2020-06-01 16:17:25 +02:00
|
|
|
sprite->sState++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
// slower but accelerating slide
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 MugshotTrainerPic_Slide2(struct Sprite *sprite)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sprite->sOffsetX += sprite->sOffsetX2;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->sOffsetX;
|
2020-06-01 16:17:25 +02:00
|
|
|
if (sprite->sOffsetX == 0)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sprite->sState++;
|
|
|
|
sprite->sOffsetX2 = -sprite->sOffsetX2;
|
|
|
|
sprite->sDone = TRUE;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
// Has no practical effect
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 MugshotTrainerPic_Slide3(struct Sprite *sprite)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
sprite->sOffsetX += sprite->sOffsetX2;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x += sprite->sOffsetX;
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sprite->x < -31 || sprite->x > DISPLAY_WIDTH + 31)
|
2020-06-01 16:17:25 +02:00
|
|
|
sprite->sState++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static void SetTrainerPicSlideTable(s16 spriteId, s16 arrId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
gSprites[spriteId].sSlideTableId = arrId;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static void IncrementTrainerPicState(s16 spriteId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
gSprites[spriteId].sState++;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static s16 IsTrainerPicSlideDone(s16 spriteId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
return gSprites[spriteId].sDone;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
#undef sState
|
|
|
|
#undef sOffsetX
|
|
|
|
#undef sOffsetX2
|
|
|
|
#undef sDone
|
|
|
|
#undef sSlideTableId
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Slice(u8 taskId)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sSlice_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Slice_Init(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 256;
|
|
|
|
task->data[3] = 1;
|
|
|
|
sTransitionData->WININ = WININ_WIN0_ALL;
|
|
|
|
sTransitionData->WINOUT = 0;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraX;
|
|
|
|
gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT + i] = DISPLAY_WIDTH;
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
EnableInterrupts(INTR_FLAG_HBLANK);
|
|
|
|
SetGpuRegBits(REG_OFFSET_DISPSTAT, DISPSTAT_HBLANK_INTR);
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Slice);
|
|
|
|
SetHBlankCallback(HBlankCB_Slice);
|
2018-01-02 20:38:33 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Slice_Func2(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] += (task->data[2] >> 8);
|
|
|
|
if (task->data[1] > DISPLAY_WIDTH)
|
|
|
|
task->data[1] = DISPLAY_WIDTH;
|
|
|
|
if (task->data[2] <= 0xFFF)
|
|
|
|
task->data[2] += task->data[3];
|
|
|
|
if (task->data[3] < 128)
|
|
|
|
task->data[3] <<= 1; // multiplying by two
|
2018-01-02 20:38:33 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
u16 *storeLoc1 = &gScanlineEffectRegBuffers[0][i];
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 *storeLoc2 = &gScanlineEffectRegBuffers[0][i + DISPLAY_HEIGHT];
|
2018-01-16 21:37:46 +01:00
|
|
|
if (i & 1)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
*storeLoc1 = sTransitionData->cameraX + task->data[1];
|
|
|
|
*storeLoc2 = DISPLAY_WIDTH - task->data[1];
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
*storeLoc1 = sTransitionData->cameraX - task->data[1];
|
|
|
|
*storeLoc2 = (task->data[1] << 8) | (DISPLAY_WIDTH + 1);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[1] >= DISPLAY_WIDTH)
|
2018-01-02 20:38:33 +01:00
|
|
|
task->tState++;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Slice_End(struct Task *task)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_Slice));
|
2018-01-02 20:38:33 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Slice(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 4);
|
|
|
|
DmaSet(0, &gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT], ®_WIN0H, B_TRANS_DMA_FLAGS);
|
2018-01-02 20:38:33 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void HBlankCB_Slice(void)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (REG_VCOUNT < DISPLAY_HEIGHT)
|
2018-01-02 20:38:33 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT];
|
2018-01-02 20:38:33 +01:00
|
|
|
REG_BG1HOFS = var;
|
|
|
|
REG_BG2HOFS = var;
|
|
|
|
REG_BG3HOFS = var;
|
|
|
|
}
|
|
|
|
}
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_ShredSplit(u8 taskId)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sShredSplit_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 ShredSplit_Init(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->WININ = WININ_WIN0_ALL;
|
|
|
|
sTransitionData->WINOUT = 0;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraX;
|
|
|
|
gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT + i] = DISPLAY_WIDTH;
|
|
|
|
gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraX;
|
|
|
|
gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT + i] = DISPLAY_WIDTH;
|
|
|
|
gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT * 2 + i] = 0;
|
|
|
|
gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT * 3 + i] = 256;
|
|
|
|
gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT * 4 + i] = 1;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[4] = 0;
|
|
|
|
task->data[5] = 0;
|
|
|
|
task->data[6] = 7;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
EnableInterrupts(INTR_FLAG_HBLANK);
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Slice);
|
|
|
|
SetHBlankCallback(HBlankCB_Slice);
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 ShredSplit_Func2(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
u16 i, j, k;
|
|
|
|
u8 arr1[ARRAY_COUNT(gUnknown_085C8C64)];
|
|
|
|
s16 arr2[ARRAY_COUNT(gUnknown_085C8C66)];
|
|
|
|
u8 var;
|
|
|
|
u16 *ptr4, *ptr3, *ptr1, *ptr2;
|
|
|
|
s16 unkVar;
|
|
|
|
|
|
|
|
memcpy(arr1, gUnknown_085C8C64, sizeof(arr1));
|
|
|
|
memcpy(arr2, gUnknown_085C8C66, sizeof(arr2));
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-13 21:03:07 +01:00
|
|
|
var = 0;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i <= task->data[5]; i++)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
{
|
|
|
|
for (k = 0; k < 2; k++)
|
|
|
|
{
|
|
|
|
unkVar = (arr1[j]) + (arr2[k] * -(i) * 2);
|
|
|
|
if (unkVar >= 0 && (unkVar != 79 || j != 1))
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
ptr4 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT * 2];
|
|
|
|
ptr3 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT * 3];
|
|
|
|
ptr1 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT * 4];
|
|
|
|
if (*ptr4 >= DISPLAY_WIDTH)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
*ptr4 = DISPLAY_WIDTH;
|
2018-01-13 21:03:07 +01:00
|
|
|
var++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*ptr4 += (*ptr3 >> 8);
|
|
|
|
if (*ptr1 <= 0x7F)
|
|
|
|
*ptr1 *= 2;
|
|
|
|
if (*ptr3 <= 0xFFF)
|
|
|
|
*ptr3 += *ptr1;
|
|
|
|
}
|
2018-01-29 17:47:12 +01:00
|
|
|
ptr2 = &gScanlineEffectRegBuffers[0][unkVar];
|
2021-10-25 16:42:08 +02:00
|
|
|
ptr3 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT];
|
|
|
|
*ptr2 = sTransitionData->cameraX + *ptr4;
|
|
|
|
*ptr3 = DISPLAY_WIDTH - *ptr4;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
{
|
|
|
|
for (k = 0; k < 2; k++)
|
|
|
|
{
|
|
|
|
unkVar = (arr1[j] + 1) + (arr2[k] * -(i) * 2);
|
2021-10-25 16:42:08 +02:00
|
|
|
if (unkVar <= DISPLAY_HEIGHT && (unkVar != DISPLAY_HEIGHT / 2 || j != 1))
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
ptr4 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT * 2];
|
|
|
|
ptr3 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT * 3];
|
|
|
|
ptr1 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT * 4];
|
|
|
|
if (*ptr4 >= DISPLAY_WIDTH)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
*ptr4 = DISPLAY_WIDTH;
|
2018-01-13 21:03:07 +01:00
|
|
|
var++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*ptr4 += (*ptr3 >> 8);
|
|
|
|
if (*ptr1 <= 0x7F)
|
|
|
|
*ptr1 *= 2;
|
|
|
|
if (*ptr3 <= 0xFFF)
|
|
|
|
*ptr3 += *ptr1;
|
|
|
|
}
|
2018-01-29 17:47:12 +01:00
|
|
|
ptr2 = &gScanlineEffectRegBuffers[0][unkVar];
|
2021-10-25 16:42:08 +02:00
|
|
|
ptr3 = &gScanlineEffectRegBuffers[0][unkVar + DISPLAY_HEIGHT];
|
|
|
|
*ptr2 = sTransitionData->cameraX - *ptr4;
|
|
|
|
*ptr3 = (*ptr4 << 8) | (DISPLAY_WIDTH + 1);
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (--task->data[4] < 0)
|
|
|
|
task->data[4] = 0;
|
|
|
|
if (task->data[4] <= 0 && task->data[5] + 1 <= 20)
|
|
|
|
task->data[4] = task->data[6], task->data[5]++;
|
|
|
|
if (var >= DISPLAY_HEIGHT)
|
2018-01-13 21:03:07 +01:00
|
|
|
task->tState++;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-13 21:03:07 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-01-21 14:23:04 +01:00
|
|
|
// This function never increments the state counter, because the loop condition
|
|
|
|
// is always false, resulting in the game being stuck in an infinite loop.
|
2018-01-29 17:47:12 +01:00
|
|
|
// It's possible this transition is only partially
|
2018-01-21 14:23:04 +01:00
|
|
|
// done and the second part was left out.
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 ShredSplit_Func3(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
bool32 done = TRUE;
|
|
|
|
u16 checkVar2 = 0xFF10;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (gScanlineEffectRegBuffers[1][i] != DISPLAY_WIDTH && gScanlineEffectRegBuffers[1][i] != checkVar2)
|
2018-01-13 21:03:07 +01:00
|
|
|
done = FALSE; // a break statement should be put here
|
|
|
|
}
|
|
|
|
|
|
|
|
if (done == TRUE)
|
|
|
|
task->tState++;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 ShredSplit_End(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_ShredSplit));
|
2018-01-13 21:03:07 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Blackhole1(u8 taskId)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sBlackhole1_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Blackhole2(u8 taskId)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sBlackhole2_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Blackhole_Init(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
s32 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->WININ = 0;
|
|
|
|
sTransitionData->WINOUT = WINOUT_WIN01_ALL;
|
|
|
|
sTransitionData->WIN0H = DISPLAY_WIDTH;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-29 17:47:12 +01:00
|
|
|
gScanlineEffectRegBuffers[1][i] = 0;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB1_BigPokeball);
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 1;
|
|
|
|
task->data[2] = 0x100;
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tFuncState = 0;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Blackhole1_Func3(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2018-01-14 20:45:44 +01:00
|
|
|
if (task->tFuncState == 1)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
SetVBlankCallback(NULL);
|
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
|
|
|
if (task->data[2] < 1024)
|
|
|
|
task->data[2] += 128;
|
|
|
|
if (task->data[1] < DISPLAY_HEIGHT)
|
|
|
|
task->data[1] += (task->data[2] >> 8);
|
|
|
|
if (task->data[1] > DISPLAY_HEIGHT)
|
|
|
|
task->data[1] = DISPLAY_HEIGHT;
|
|
|
|
sub_814A014(gScanlineEffectRegBuffers[0], 120, 80, task->data[1]);
|
|
|
|
if (task->data[1] == DISPLAY_HEIGHT)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tFuncState = 1;
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Blackhole1_Func2(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-14 20:45:44 +01:00
|
|
|
if (task->tFuncState == 0)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tFuncState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0x30;
|
|
|
|
task->data[6] = 0;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] += gUnknown_085C8C80[task->data[6]];
|
|
|
|
task->data[6] = (task->data[6] + 1) % 2;
|
|
|
|
sub_814A014(gScanlineEffectRegBuffers[0], 120, 80, task->data[1]);
|
|
|
|
if (task->data[1] < 9)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tFuncState = 0;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-13 21:03:07 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Blackhole2_Func2(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
u16 index; // should be s16 I think
|
|
|
|
s16 amplitude;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-14 20:45:44 +01:00
|
|
|
if (task->tFuncState == 0)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tFuncState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[5] = 2;
|
|
|
|
task->data[6] = 2;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[1] > DISPLAY_HEIGHT)
|
|
|
|
task->data[1] = DISPLAY_HEIGHT;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A014(gScanlineEffectRegBuffers[0], 120, 80, task->data[1]);
|
|
|
|
if (task->data[1] == DISPLAY_HEIGHT)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2018-01-13 21:03:07 +01:00
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
index = task->data[5];
|
|
|
|
if ((task->data[5] & 0xFF) <= 128)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
amplitude = task->data[6];
|
|
|
|
task->data[5] += 8;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
amplitude = task->data[6] - 1;
|
|
|
|
task->data[5] += 16;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] += Sin(index & 0xFF, amplitude);
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[1] <= 0)
|
|
|
|
task->data[1] = 1;
|
|
|
|
if (task->data[5] > 0xFE)
|
|
|
|
task->data[5] >>= 8, task->data[6]++;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-13 21:03:07 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_RectangularSpiral(u8 taskId)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sRectangularSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 RectangularSpiral_Init(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
|
|
|
CpuCopy16(sShrinkingBoxTileset, tileset, 0x20);
|
|
|
|
CpuCopy16(sShrinkingBoxTileset + 0x70, tileset + 0x20, 0x20);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0xF000, tilemap, BG_SCREEN_SIZE);
|
|
|
|
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[3] = 1;
|
2018-01-13 21:03:07 +01:00
|
|
|
task->tState++;
|
|
|
|
|
|
|
|
sRectangularSpiralTransition[0].field_0 = 0;
|
|
|
|
sRectangularSpiralTransition[0].field_2 = -1;
|
|
|
|
sRectangularSpiralTransition[0].field_4 = 1;
|
|
|
|
sRectangularSpiralTransition[0].field_6 = 308;
|
|
|
|
sRectangularSpiralTransition[0].field_8 = 0;
|
|
|
|
|
|
|
|
sRectangularSpiralTransition[1].field_0 = 0;
|
|
|
|
sRectangularSpiralTransition[1].field_2 = -1;
|
|
|
|
sRectangularSpiralTransition[1].field_4 = 1;
|
|
|
|
sRectangularSpiralTransition[1].field_6 = 308;
|
|
|
|
sRectangularSpiralTransition[1].field_8 = 0;
|
|
|
|
|
|
|
|
sRectangularSpiralTransition[2].field_0 = 0;
|
|
|
|
sRectangularSpiralTransition[2].field_2 = -3;
|
|
|
|
sRectangularSpiralTransition[2].field_4 = 1;
|
|
|
|
sRectangularSpiralTransition[2].field_6 = 307;
|
|
|
|
sRectangularSpiralTransition[2].field_8 = 0;
|
|
|
|
|
|
|
|
sRectangularSpiralTransition[3].field_0 = 0;
|
|
|
|
sRectangularSpiralTransition[3].field_2 = -3;
|
|
|
|
sRectangularSpiralTransition[3].field_4 = 1;
|
|
|
|
sRectangularSpiralTransition[3].field_6 = 307;
|
|
|
|
sRectangularSpiralTransition[3].field_8 = 0;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 RectangularSpiral_Func2(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-13 21:03:07 +01:00
|
|
|
u8 i;
|
|
|
|
u16 j;
|
|
|
|
bool32 done = TRUE;
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < ARRAY_COUNT(sRectangularSpiralTransition); j++)
|
|
|
|
{
|
|
|
|
s16 var = 0, var2 = 0;
|
|
|
|
s32 var3 = 0;
|
|
|
|
|
|
|
|
if (sub_8149048(gUnknown_085C8D38[j / 2], &sRectangularSpiralTransition[j]))
|
|
|
|
{
|
|
|
|
done = FALSE;
|
|
|
|
var = sRectangularSpiralTransition[j].field_2;
|
2021-06-01 01:01:20 +02:00
|
|
|
if ((j % 2) == 1)
|
2018-01-13 21:03:07 +01:00
|
|
|
var = 0x27D - var;
|
|
|
|
|
|
|
|
var2 = var % 32;
|
2021-06-01 01:01:20 +02:00
|
|
|
var3 = var / 32;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SET_TILEMAP_TILE(tilemap, var3, var2, 0xF002);
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (done == TRUE)
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 RectangularSpiral_End(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2018-01-13 21:03:07 +01:00
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
const s16 *array = arg0[arg1->field_0];
|
|
|
|
if (array[arg1->field_4] == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
// ??
|
|
|
|
sUnusedRectangularSpiralVar = array[0];
|
|
|
|
sUnusedRectangularSpiralVar = array[1];
|
|
|
|
sUnusedRectangularSpiralVar = array[2];
|
|
|
|
sUnusedRectangularSpiralVar = array[3];
|
|
|
|
|
|
|
|
switch (array[0])
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
arg1->field_2 += 0x1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
arg1->field_2 -= 0x1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
arg1->field_2 -= 0x20;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
arg1->field_2 += 0x20;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg1->field_2 > 0x27F || array[arg1->field_4] == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (arg1->field_8 == 0 && array[arg1->field_4] == -2)
|
|
|
|
{
|
|
|
|
arg1->field_8 = 1;
|
|
|
|
arg1->field_4 = 1;
|
|
|
|
arg1->field_2 = arg1->field_6;
|
|
|
|
arg1->field_0 = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg1->field_2 == array[arg1->field_4])
|
|
|
|
{
|
|
|
|
(arg1->field_0)++;
|
|
|
|
if (arg1->field_8 == 1)
|
|
|
|
{
|
|
|
|
if (arg1->field_0 > 7)
|
|
|
|
{
|
|
|
|
(arg1->field_4)++;
|
|
|
|
(arg1->field_0) = 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (arg1->field_0 > 3)
|
|
|
|
{
|
|
|
|
(arg1->field_4)++;
|
|
|
|
(arg1->field_0) = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Groudon(u8 taskId)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sGroudon_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Groudon_Init(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-13 21:03:07 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-06-01 16:17:25 +02:00
|
|
|
LZ77UnCompVram(sGroudon_Tileset, tileset);
|
|
|
|
LZ77UnCompVram(sGroudon_Tilemap, tilemap);
|
2018-01-13 21:03:07 +01:00
|
|
|
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0;
|
2018-01-13 21:03:07 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Groudon_PalettePulsate(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[1] % 3 == 0)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 var = (task->data[1] % 30) / 3;
|
2020-06-01 16:17:25 +02:00
|
|
|
LoadPalette(sGroudon1_Palette + (var * 16), 0xF0, 0x20);
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[1] > 58)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Groudon_PaletteBrighten(struct Task *task)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[1] % 5 == 0)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 var = task->data[1] / 5;
|
2020-06-01 16:17:25 +02:00
|
|
|
LoadPalette(sGroudon2_Palette + (var * 16), 0xF0, 0x20);
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[1] > 68)
|
2018-01-13 21:03:07 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0;
|
|
|
|
task->tEndDelay = 30;
|
2018-01-13 21:03:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
#undef tEndDelay
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Rayquaza(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sRayquaza_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Rayquaza_Func3(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-04-15 09:00:01 +02:00
|
|
|
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(26) | BGCNT_TXT256x512);
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-06-01 16:17:25 +02:00
|
|
|
CpuCopy16(sRayquaza_Tileset, tileset, 0x2000);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->field_20 = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tState++;
|
2020-06-01 16:17:25 +02:00
|
|
|
LoadPalette(sRayquaza_Palette + 0x50, 0xF0, 0x20);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
gScanlineEffectRegBuffers[0][i] = 0;
|
|
|
|
gScanlineEffectRegBuffers[1][i] = 0x100;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Rayquaza);
|
2018-01-14 20:45:44 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Rayquaza_Func4(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuCopy16(sRayquaza_Tilemap, tilemap, sizeof(sRayquaza_Tilemap));
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Rayquaza_Func5(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if ((task->data[1] % 4) == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 value = task->data[1] / 4;
|
2020-06-01 16:17:25 +02:00
|
|
|
const u16 *palPtr = &sRayquaza_Palette[(value + 5) * 16];
|
2018-01-14 20:45:44 +01:00
|
|
|
LoadPalette(palPtr, 0xF0, 0x20);
|
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[1] > 40)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Rayquaza_Func6(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[1] > 20)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 0;
|
|
|
|
BeginNormalPaletteFade(PALETTES_OBJECTS | (1 << 15), 2, 0, 16, RGB_BLACK);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Rayquaza_Func7(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->field_20 = 1;
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Rayquaza_Func8(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
BlendPalettes(PALETTES_BG & ~(1 << 15), 8, RGB_BLACK);
|
|
|
|
BlendPalettes(PALETTES_OBJECTS | (1 << 15), 0, RGB_BLACK);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Rayquaza_Func9(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if ((task->data[1] % 3) == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u16 value = task->data[1] / 3;
|
2020-06-01 16:17:25 +02:00
|
|
|
const u16 *palPtr = &sRayquaza_Palette[(value + 0) * 16];
|
2018-01-14 20:45:44 +01:00
|
|
|
LoadPalette(palPtr, 0xF0, 0x20);
|
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[1] >= 40)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->WININ = 0;
|
|
|
|
sTransitionData->WINOUT = WINOUT_WIN01_ALL;
|
|
|
|
sTransitionData->WIN0H = DISPLAY_WIDTH;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-29 17:47:12 +01:00
|
|
|
gScanlineEffectRegBuffers[1][i] = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB1_BigPokeball);
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 0x100;
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tFuncState = 0;
|
|
|
|
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Rayquaza(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
void *dmaSrc;
|
|
|
|
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->field_20 == 0)
|
2018-01-29 17:47:12 +01:00
|
|
|
dmaSrc = gScanlineEffectRegBuffers[0];
|
2021-10-25 16:42:08 +02:00
|
|
|
else if (sTransitionData->field_20 == 1)
|
2018-01-29 17:47:12 +01:00
|
|
|
dmaSrc = gScanlineEffectRegBuffers[1];
|
2018-01-14 20:45:44 +01:00
|
|
|
else
|
2018-01-29 17:47:12 +01:00
|
|
|
dmaSrc = gScanlineEffectRegBuffers[0];
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
DmaSet(0, dmaSrc, ®_BG0VOFS, B_TRANS_DMA_FLAGS);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_WhiteFade(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sWhiteFade_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 WhiteFade_Init(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->BLDCNT = BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN;
|
|
|
|
sTransitionData->BLDY = 0;
|
|
|
|
sTransitionData->WININ = WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ;
|
|
|
|
sTransitionData->WINOUT = WINOUT_WIN01_ALL;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
gScanlineEffectRegBuffers[1][i] = 0;
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[1][i + DISPLAY_HEIGHT] = DISPLAY_WIDTH;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
EnableInterrupts(INTR_FLAG_HBLANK);
|
2021-10-25 16:20:48 +02:00
|
|
|
SetHBlankCallback(HBlankCB_WhiteFade);
|
|
|
|
SetVBlankCallback(VBlankCB0_WhiteFade);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 WhiteFade_Func2(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
s16 i, posY;
|
|
|
|
s16 arr1[ARRAY_COUNT(sUnknown_085C8DA0)];
|
|
|
|
struct Sprite *sprite;
|
|
|
|
|
|
|
|
memcpy(arr1, sUnknown_085C8DA0, sizeof(sUnknown_085C8DA0));
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0, posY = 0; i < 8; i++, posY += 20)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
sprite = &gSprites[CreateInvisibleSprite(sub_8149864)];
|
2021-10-25 16:42:08 +02:00
|
|
|
sprite->x = DISPLAY_WIDTH;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y = posY;
|
2018-01-14 20:45:44 +01:00
|
|
|
sprite->data[5] = arr1[i];
|
|
|
|
}
|
|
|
|
sprite->data[6]++;
|
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 WhiteFade_Func3(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = 0;
|
|
|
|
if (sTransitionData->field_20 > 7)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
BlendPalettes(PALETTES_ALL, 16, RGB_WHITE);
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 WhiteFade_Func4(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
DmaStop(0);
|
|
|
|
SetVBlankCallback(0);
|
|
|
|
SetHBlankCallback(0);
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->WIN0H = DISPLAY_WIDTH;
|
|
|
|
sTransitionData->BLDY = 0;
|
|
|
|
sTransitionData->BLDCNT = 0xFF;
|
|
|
|
sTransitionData->WININ = WININ_WIN0_ALL;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB1_WhiteFade);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 WhiteFade_End(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++sTransitionData->BLDY > 16)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_WhiteFade));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB0_WhiteFade(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
REG_BLDCNT = sTransitionData->BLDCNT;
|
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 4);
|
|
|
|
DmaSet(0, &gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT], ®_WIN0H, B_TRANS_DMA_FLAGS);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB1_WhiteFade(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
REG_BLDY = sTransitionData->BLDY;
|
|
|
|
REG_BLDCNT = sTransitionData->BLDCNT;
|
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0H = sTransitionData->WIN0H;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void HBlankCB_WhiteFade(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
REG_BLDY = gScanlineEffectRegBuffers[1][REG_VCOUNT];
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static void sub_8149864(struct Sprite *sprite)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[5])
|
|
|
|
{
|
|
|
|
sprite->data[5]--;
|
|
|
|
if (sprite->data[6])
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = 1;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
u16 i;
|
2021-07-07 15:11:52 +02:00
|
|
|
u16* ptr1 = &gScanlineEffectRegBuffers[0][sprite->y];
|
2021-10-25 16:42:08 +02:00
|
|
|
u16* ptr2 = &gScanlineEffectRegBuffers[0][sprite->y + DISPLAY_HEIGHT];
|
2018-01-14 20:45:44 +01:00
|
|
|
for (i = 0; i < 20; i++)
|
|
|
|
{
|
|
|
|
ptr1[i] = sprite->data[0] >> 8;
|
2021-07-07 15:11:52 +02:00
|
|
|
ptr2[i] = (u8)(sprite->x);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->x == 0 && sprite->data[0] == 0x1000)
|
2018-01-14 20:45:44 +01:00
|
|
|
sprite->data[1] = 1;
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x -= 16;
|
2018-01-14 20:45:44 +01:00
|
|
|
sprite->data[0] += 0x80;
|
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
if (sprite->x < 0)
|
|
|
|
sprite->x = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
if (sprite->data[0] > 0x1000)
|
|
|
|
sprite->data[0] = 0x1000;
|
|
|
|
|
|
|
|
if (sprite->data[6])
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = 1;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
if (sprite->data[1])
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sprite->data[6] == 0 || (sTransitionData->field_20 > 6 && sprite->data[2]++ > 7))
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->field_20++;
|
2018-01-14 20:45:44 +01:00
|
|
|
DestroySprite(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_GridSquares(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sGridSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 GridSquares_Init(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuSet(sShrinkingBoxTileset, tileset, 16);
|
|
|
|
CpuFill16(0xF000, tilemap, BG_SCREEN_SIZE);
|
|
|
|
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 GridSquares_Func2(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16* tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[1] == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilemapDst(&tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 3;
|
|
|
|
task->data[2]++;
|
|
|
|
CpuSet(sShrinkingBoxTileset + (task->data[2] * 8), tileset, 16);
|
|
|
|
if (task->data[2] > 13)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = 16;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1]--;
|
2018-01-14 20:45:44 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 GridSquares_End(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (--task->data[1] == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_GridSquares));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_Shards(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sShards_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 Shards_Init(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->WININ = WININ_WIN0_ALL;
|
|
|
|
sTransitionData->WINOUT = 0;
|
|
|
|
sTransitionData->WIN0V = DISPLAY_HEIGHT;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
|
|
|
gScanlineEffectRegBuffers[0][i] = DISPLAY_WIDTH;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuSet(gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT);
|
2021-10-25 16:20:48 +02:00
|
|
|
SetVBlankCallback(VBlankCB_Shards);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Shards_Func2(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
sub_814A1AC(sTransitionData->data,
|
|
|
|
sUnknown_085C8DD0[task->data[1]][0],
|
|
|
|
sUnknown_085C8DD0[task->data[1]][1],
|
|
|
|
sUnknown_085C8DD0[task->data[1]][2],
|
|
|
|
sUnknown_085C8DD0[task->data[1]][3],
|
2018-01-14 20:45:44 +01:00
|
|
|
1, 1);
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = sUnknown_085C8DD0[task->data[1]][4];
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Shards_Func3(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
s16 i;
|
|
|
|
bool8 nextFunc;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
for (i = 0, nextFunc = FALSE; i < 16; i++)
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
s16 r3 = gScanlineEffectRegBuffers[0][sTransitionData->data[3]] >> 8;
|
|
|
|
s16 r4 = gScanlineEffectRegBuffers[0][sTransitionData->data[3]] & 0xFF;
|
|
|
|
if (task->data[2] == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (r3 < sTransitionData->data[2])
|
|
|
|
r3 = sTransitionData->data[2];
|
2018-01-14 20:45:44 +01:00
|
|
|
if (r3 > r4)
|
|
|
|
r3 = r4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (r4 > sTransitionData->data[2])
|
|
|
|
r4 = sTransitionData->data[2];
|
2018-01-14 20:45:44 +01:00
|
|
|
if (r4 <= r3)
|
|
|
|
r4 = r3;
|
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[0][sTransitionData->data[3]] = (r4) | (r3 << 8);
|
2018-01-14 20:45:44 +01:00
|
|
|
if (nextFunc)
|
|
|
|
{
|
|
|
|
task->tState++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
2021-10-25 16:42:08 +02:00
|
|
|
nextFunc = sub_814A228(sTransitionData->data, 1, 1);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-14 20:45:44 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Shards_Func4(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[1] < 7)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[3] = sUnknown_085C8E16[task->data[1] - 1];
|
2018-01-14 20:45:44 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DmaStop(0);
|
2020-06-01 16:17:25 +02:00
|
|
|
FadeScreenBlack();
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_Shards));
|
2018-01-14 20:45:44 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Shards_Func5(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (--task->data[3] == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
task->tState = 1;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-06-01 16:17:25 +02:00
|
|
|
|
|
|
|
return FALSE;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void VBlankCB_Shards(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
DmaStop(0);
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
|
|
|
REG_WININ = sTransitionData->WININ;
|
|
|
|
REG_WINOUT = sTransitionData->WINOUT;
|
|
|
|
REG_WIN0V = sTransitionData->WIN0V;
|
2018-01-29 17:47:12 +01:00
|
|
|
REG_WIN0H = gScanlineEffectRegBuffers[1][0];
|
2021-10-25 16:42:08 +02:00
|
|
|
DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef tFuncState
|
|
|
|
#undef tOpponentSpriteId
|
|
|
|
#undef tPlayerSpriteId
|
|
|
|
#undef tMugshotId
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void CreateIntroTask(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
u8 taskId = CreateTask(Task_BattleTransition_Intro, 3);
|
2021-10-25 16:42:08 +02:00
|
|
|
gTasks[taskId].data[1] = a0;
|
|
|
|
gTasks[taskId].data[2] = a1;
|
|
|
|
gTasks[taskId].data[3] = a2;
|
|
|
|
gTasks[taskId].data[4] = a3;
|
|
|
|
gTasks[taskId].data[5] = a4;
|
|
|
|
gTasks[taskId].data[6] = a0;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 IsIntroTaskDone(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
if (FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE)
|
2018-01-14 20:45:44 +01:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
void Task_BattleTransition_Intro(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sTransitionIntroFuncs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_Intro_1(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[6] == 0 || --task->data[6] == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[6] = task->data[1];
|
|
|
|
task->data[7] += task->data[4];
|
|
|
|
if (task->data[7] > 16)
|
|
|
|
task->data[7] = 16;
|
|
|
|
BlendPalettes(PALETTES_ALL, task->data[7], RGB(11, 11, 11));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[7] > 15)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
task->tState++;
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[6] = task->data[2];
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 Transition_Intro_2(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[6] == 0 || --task->data[6] == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[6] = task->data[2];
|
|
|
|
task->data[7] -= task->data[5];
|
|
|
|
if (task->data[7] < 0)
|
|
|
|
task->data[7] = 0;
|
|
|
|
BlendPalettes(PALETTES_ALL, task->data[7], RGB(11, 11, 11));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[7] == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (--task->data[3] == 0)
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_BattleTransition_Intro));
|
2018-01-14 20:45:44 +01:00
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[6] = task->data[1];
|
2018-01-14 20:45:44 +01:00
|
|
|
task->tState = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void InitTransitionData(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
memset(sTransitionData, 0, sizeof(*sTransitionData));
|
|
|
|
GetCameraOffsetWithPan(&sTransitionData->cameraX, &sTransitionData->cameraY);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static void VBlankCB_BattleTransition(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
LoadOam();
|
|
|
|
ProcessSpriteCopyRequests();
|
|
|
|
TransferPlttBuffer();
|
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static void GetBg0TilemapDst(u16 **tileset)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 charBase = REG_BG0CNT >> 2;
|
2021-10-25 16:42:08 +02:00
|
|
|
charBase <<= 14;
|
2020-06-01 16:17:25 +02:00
|
|
|
*tileset = (u16*)(VRAM + charBase);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
void GetBg0TilesDst(u16 **tilemap, u16 **tileset)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 screenBase = REG_BG0CNT >> 8;
|
|
|
|
u16 charBase = REG_BG0CNT >> 2;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
screenBase <<= 11;
|
|
|
|
charBase <<= 14;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
*tilemap = (u16*)(VRAM + screenBase);
|
|
|
|
*tileset = (u16*)(VRAM + charBase);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
static void FadeScreenBlack(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-02-24 17:01:02 +01:00
|
|
|
BlendPalettes(PALETTES_ALL, 16, RGB_BLACK);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void SetSinWave(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
for (i = 0; arrSize > 0; arrSize--, i++, index += indexIncrementer)
|
2021-10-25 16:42:08 +02:00
|
|
|
array[i] = sinAdd + Sin(index & 0xFF, amplitude);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void sub_814A014(u16 *array, s16 x, s16 y, s16 amplitude)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
s16 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
memset(array, 10, DISPLAY_HEIGHT * sizeof(s16));
|
2018-01-14 20:45:44 +01:00
|
|
|
for (i = 0; i < 64; i++)
|
|
|
|
{
|
|
|
|
s16 sinResult, cosResult;
|
|
|
|
s16 toStoreOrr, r2, r3, toStore, r7, r8;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sinResult = Sin(i, amplitude);
|
|
|
|
cosResult = Cos(i, amplitude);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
toStoreOrr = x - sinResult;
|
|
|
|
toStore = x + sinResult;
|
|
|
|
r7 = y - cosResult;
|
|
|
|
r8 = y + cosResult;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
if (toStoreOrr < 0)
|
|
|
|
toStoreOrr = 0;
|
2021-10-25 16:42:08 +02:00
|
|
|
if (toStore > DISPLAY_WIDTH)
|
|
|
|
toStore = DISPLAY_WIDTH;
|
2018-01-14 20:45:44 +01:00
|
|
|
if (r7 < 0)
|
|
|
|
r7 = 0;
|
2021-10-25 16:42:08 +02:00
|
|
|
if (r8 > DISPLAY_HEIGHT - 1)
|
|
|
|
r8 = DISPLAY_HEIGHT - 1;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
toStore |= (toStoreOrr << 8);
|
|
|
|
array[r7] = toStore;
|
|
|
|
array[r8] = toStore;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
cosResult = Cos(i + 1, amplitude);
|
|
|
|
r3 = y - cosResult;
|
|
|
|
r2 = y + cosResult;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
if (r3 < 0)
|
|
|
|
r3 = 0;
|
2021-10-25 16:42:08 +02:00
|
|
|
if (r2 > DISPLAY_HEIGHT - 1)
|
|
|
|
r2 = DISPLAY_HEIGHT - 1;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
while (r7 > r3)
|
|
|
|
array[--r7] = toStore;
|
|
|
|
while (r7 < r3)
|
|
|
|
array[++r7] = toStore;
|
|
|
|
|
|
|
|
while (r8 > r2)
|
|
|
|
array[--r8] = toStore;
|
|
|
|
while (r8 < r2)
|
|
|
|
array[++r8] = toStore;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static void sub_814A1AC(s16 *data, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
data[0] = a1;
|
|
|
|
data[1] = a2;
|
|
|
|
data[2] = a1;
|
|
|
|
data[3] = a2;
|
|
|
|
data[4] = a3;
|
|
|
|
data[5] = a4;
|
|
|
|
data[6] = a5;
|
|
|
|
data[7] = a6;
|
|
|
|
data[8] = a3 - a1;
|
|
|
|
if (data[8] < 0)
|
|
|
|
{
|
|
|
|
data[8] = -data[8];
|
|
|
|
data[6] = -a5;
|
|
|
|
}
|
|
|
|
data[9] = a4 - a2;
|
|
|
|
if (data[9] < 0)
|
|
|
|
{
|
|
|
|
data[9] = -data[9];
|
|
|
|
data[7] = -a6;
|
|
|
|
}
|
|
|
|
data[10] = 0;
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:09:35 +01:00
|
|
|
static bool8 sub_814A228(s16 *data, bool8 a1, bool8 a2)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
u8 var;
|
|
|
|
if (data[8] > data[9])
|
|
|
|
{
|
|
|
|
data[2] += data[6];
|
|
|
|
data[10] += data[9];
|
|
|
|
if (data[10] > data[8])
|
|
|
|
{
|
|
|
|
data[3] += data[7];
|
|
|
|
data[10] -= data[8];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
data[3] += data[7];
|
|
|
|
data[10] += data[8];
|
|
|
|
if (data[10] > data[9])
|
|
|
|
{
|
|
|
|
data[2] += data[6];
|
|
|
|
data[10] -= data[9];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var = 0;
|
|
|
|
if ((data[6] > 0 && data[2] >= data[4]) || (data[6] < 0 && data[2] <= data[4]))
|
|
|
|
{
|
|
|
|
var++;
|
|
|
|
if (a1)
|
|
|
|
data[2] = data[4];
|
|
|
|
}
|
|
|
|
if ((data[7] > 0 && data[3] >= data[5]) || (data[7] < 0 && data[3] <= data[5]))
|
|
|
|
{
|
|
|
|
var++;
|
|
|
|
if (a2)
|
|
|
|
data[3] = data[5];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (var == 2)
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierLogoWiggle_Init(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitPatternWeaveTransition(task);
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette));
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierLogoWiggle_SetGfx(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap);
|
2021-10-25 16:42:08 +02:00
|
|
|
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->data[4], 0x84, task->data[5], DISPLAY_HEIGHT);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_FrontierLogoWiggle(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sFrontierLogoWiggle_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_FrontierLogoWave(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sFrontierLogoWave_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierLogoWave_Init(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
InitTransitionData();
|
2018-01-29 17:47:12 +01:00
|
|
|
ScanlineEffect_Clear();
|
2018-01-14 20:45:44 +01:00
|
|
|
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON);
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 0x2000;
|
|
|
|
task->data[1] = 0x7FFF;
|
|
|
|
task->data[5] = 0;
|
|
|
|
task->data[6] = 16;
|
|
|
|
task->data[7] = 2560;
|
|
|
|
sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL;
|
|
|
|
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->data[5], task->data[6]);
|
|
|
|
REG_BLDCNT = sTransitionData->BLDCNT;
|
|
|
|
REG_BLDALPHA = sTransitionData->BLDALPHA;
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette));
|
|
|
|
sTransitionData->cameraY = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierLogoWave_SetGfx(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap);
|
2018-01-14 20:45:44 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierLogoWave_Func3(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
|
|
|
gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraY;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
SetVBlankCallback(VBlankCB_FrontierLogoWave);
|
|
|
|
SetHBlankCallback(HBlankCB_FrontierLogoWave);
|
2018-01-14 20:45:44 +01:00
|
|
|
EnableInterrupts(INTR_FLAG_HBLANK);
|
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierLogoWave_Func4(struct Task *task)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
u16 var6, amplitude, var8;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->VBlank_DMA = FALSE;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
amplitude = task->data[2] >> 8;
|
|
|
|
var6 = task->data[1];
|
2018-01-14 20:45:44 +01:00
|
|
|
var8 = 384;
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[1] = var6 - task->data[7];
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[3] >= 70)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[2] - 384 >= 0)
|
|
|
|
task->data[2] -= 384;
|
2018-01-14 20:45:44 +01:00
|
|
|
else
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 0;
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[3] >= 0 && task->data[3] % 3 == 0)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[5] < 16)
|
|
|
|
task->data[5]++;
|
|
|
|
else if (task->data[6] > 0)
|
|
|
|
task->data[6]--;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->data[5], task->data[6]);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
for (i = 0; i < DISPLAY_HEIGHT; i++, var6 += var8)
|
2018-01-14 20:45:44 +01: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
|
|
|
s16 index = var6 / 256;
|
2021-10-25 16:42:08 +02:00
|
|
|
gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraY + Sin(index & 0xff, amplitude);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[3] == 101)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[4]++;
|
|
|
|
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[4] != 0 && !gPaletteFade.active)
|
2021-10-25 16:20:48 +02:00
|
|
|
DestroyTask(FindTaskIdByFunc(Task_FrontierLogoWave));
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[7] -= 17;
|
|
|
|
sTransitionData->VBlank_DMA++;
|
2018-01-14 20:45:44 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void VBlankCB_FrontierLogoWave(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
|
|
|
VBlankCB_BattleTransition();
|
2021-10-25 16:42:08 +02:00
|
|
|
REG_BLDCNT = sTransitionData->BLDCNT;
|
|
|
|
REG_BLDALPHA = sTransitionData->BLDALPHA;
|
2018-01-14 20:45:44 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (sTransitionData->VBlank_DMA)
|
|
|
|
DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2);
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static void HBlankCB_FrontierLogoWave(void)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2018-01-29 17:47:12 +01:00
|
|
|
u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT];
|
2018-01-14 20:45:44 +01:00
|
|
|
REG_BG0VOFS = var;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_FrontierSquares(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sFrontierSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_FrontierSquaresSpiral(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sFrontierSquaresSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static void Task_FrontierSquaresScroll(u8 taskId)
|
2018-01-14 20:45:44 +01:00
|
|
|
{
|
2021-10-25 16:20:48 +02:00
|
|
|
while (sFrontierSquaresScroll_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
|
2018-01-14 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquares_Init(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
|
|
|
|
FillBgTilemapBufferRect(0, 1, 0, 0, 1, 0x20, 0xF);
|
|
|
|
FillBgTilemapBufferRect(0, 1, 0x1D, 0, 1, 0x20, 0xF);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette));
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 1;
|
|
|
|
task->data[3] = 0;
|
|
|
|
task->data[4] = 0;
|
|
|
|
task->data[7] = 10;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquares_Func2(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
CopyRectToBgTilemapBufferRect(0, sFrontierSquares_Tilemap, 0, 0, 4, 4, task->data[2], task->data[3], 4, 4, 0xF, 0, 0);
|
2018-01-14 22:09:35 +01:00
|
|
|
CopyBgTilemapBufferToVram(0);
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] += 4;
|
|
|
|
if (++task->data[4] == 7)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 1;
|
|
|
|
task->data[3] += 4;
|
|
|
|
task->data[4] = 0;
|
|
|
|
if (task->data[3] > 19)
|
2018-01-14 22:09:35 +01:00
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquares_Func3(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[6]++ >= task->data[7])
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
switch (task->data[5])
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
for (i = 250; i < 255; i++)
|
|
|
|
{
|
|
|
|
gPlttBufferUnfaded[i] = 0;
|
|
|
|
gPlttBufferFaded[i] = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2021-10-25 16:42:08 +02:00
|
|
|
BlendPalettes(PALETTES_ALL & ~(1 << 15), 16, RGB_BLACK);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierSquares_EmptyBg_Tileset, tileset);
|
2018-01-14 22:09:35 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierSquares_Shrink1_Tileset, tileset);
|
2018-01-14 22:09:35 +01:00
|
|
|
break;
|
|
|
|
case 3:
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierSquares_Shrink2_Tileset, tileset);
|
2018-01-14 22:09:35 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[6] = 0;
|
|
|
|
task->data[5]++;
|
2018-01-14 22:09:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquaresSpiral_Init(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
|
|
|
|
FillBgTilemapBufferRect(0, 1, 0, 0, 1, 0x20, 0xF);
|
|
|
|
FillBgTilemapBufferRect(0, 1, 0x1D, 0, 1, 0x20, 0xF);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sFrontierSquares_Palette, 0xE0, sizeof(sFrontierSquares_Palette));
|
|
|
|
LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette));
|
|
|
|
BlendPalette(0xE0, 16, 8, 0);
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 34;
|
|
|
|
task->data[3] = 0;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresSpiral_Func2(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u8 var = gUnknown_085C9A30[task->data[2]];
|
2018-01-14 22:09:35 +01:00
|
|
|
u8 varMod = var % 7;
|
|
|
|
u8 varDiv = var / 7;
|
2020-07-02 21:45:37 +02:00
|
|
|
CopyRectToBgTilemapBufferRect(0, &sFrontierSquares_Tilemap, 0, 0, 4, 4, 4 * varMod + 1, 4 * varDiv, 4, 4, 0xF, 0, 0);
|
2018-01-14 22:09:35 +01:00
|
|
|
CopyBgTilemapBufferToVram(0);
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (--task->data[2] < 0)
|
2018-01-14 22:09:35 +01:00
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresSpiral_Func3(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
BlendPalette(0xE0, 16, 3, 0);
|
|
|
|
BlendPalettes(PALETTES_ALL & ~(1 << 15 | 1 << 14), 16, RGB_BLACK);
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 0;
|
|
|
|
task->data[3] = 0;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresSpiral_Func4(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if ((task->data[3] ^= 1))
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
CopyRectToBgTilemapBufferRect(
|
|
|
|
0,
|
2020-07-02 21:45:37 +02:00
|
|
|
sFrontierSquares_Tilemap,
|
2018-01-14 22:09:35 +01:00
|
|
|
0,
|
|
|
|
0,
|
|
|
|
4,
|
|
|
|
4,
|
2021-10-25 16:42:08 +02:00
|
|
|
4 * (gUnknown_085C9A30[task->data[2]] % 7) + 1,
|
|
|
|
4 * (gUnknown_085C9A30[task->data[2]] / 7),
|
2018-01-14 22:09:35 +01:00
|
|
|
4,
|
|
|
|
4,
|
|
|
|
0xE,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[2] > 0)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
FillBgTilemapBufferRect(
|
|
|
|
0,
|
|
|
|
1,
|
2021-10-25 16:42:08 +02:00
|
|
|
4 * (gUnknown_085C9A30[task->data[2] - 1] % 7) + 1,
|
|
|
|
4 * (gUnknown_085C9A30[task->data[2] - 1] / 7),
|
2018-01-14 22:09:35 +01:00
|
|
|
4,
|
|
|
|
4,
|
|
|
|
0xF);
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2]++;
|
2018-01-14 22:09:35 +01:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (task->data[2] > 34)
|
2018-01-14 22:09:35 +01:00
|
|
|
task->tState++;
|
|
|
|
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquares_End(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
2021-10-25 16:42:08 +02:00
|
|
|
BlendPalettes(PALETTES_ALL, 16, RGB_BLACK);
|
2018-01-14 22:09:35 +01:00
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// sub task for phase2 32
|
|
|
|
#define tSub32_X_delta data[0]
|
|
|
|
#define tSub32_Y_delta data[1]
|
|
|
|
#define tSub32_Bool data[2]
|
|
|
|
|
|
|
|
static void sub_814ABE4(u8 taskId)
|
|
|
|
{
|
|
|
|
if (!(gTasks[taskId].tSub32_Bool ^= 1))
|
|
|
|
{
|
|
|
|
SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_X);
|
|
|
|
SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y);
|
|
|
|
gBattle_BG0_X += gTasks[taskId].tSub32_X_delta;
|
|
|
|
gBattle_BG0_Y += gTasks[taskId].tSub32_Y_delta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquaresScroll_Init(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
u8 taskId = 0;
|
2020-06-01 16:17:25 +02:00
|
|
|
u16 *tilemap, *tileset;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2020-06-01 16:17:25 +02:00
|
|
|
GetBg0TilesDst(&tilemap, &tileset);
|
2020-07-02 21:45:37 +02:00
|
|
|
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
|
2018-01-14 22:09:35 +01:00
|
|
|
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
2021-10-25 16:42:08 +02:00
|
|
|
LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette));
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
gBattle_BG0_X = 0;
|
|
|
|
gBattle_BG0_Y = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_X);
|
|
|
|
SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y);
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 0;
|
2018-01-14 22:09:35 +01:00
|
|
|
taskId = CreateTask(sub_814ABE4, 1);
|
|
|
|
switch (Random() % 4)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
gTasks[taskId].tSub32_X_delta = 1;
|
|
|
|
gTasks[taskId].tSub32_Y_delta = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
gTasks[taskId].tSub32_X_delta = -1;
|
|
|
|
gTasks[taskId].tSub32_Y_delta = -1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
gTasks[taskId].tSub32_X_delta = 1;
|
|
|
|
gTasks[taskId].tSub32_Y_delta = -1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
gTasks[taskId].tSub32_X_delta = -1;
|
|
|
|
gTasks[taskId].tSub32_Y_delta = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresScroll_Func2(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u8 var = gUnknown_085C9A53[task->data[2]];
|
2018-01-14 22:09:35 +01:00
|
|
|
u8 varDiv = var / 8;
|
|
|
|
u8 varAnd = var & 7;
|
|
|
|
|
|
|
|
CopyRectToBgTilemapBufferRect(
|
|
|
|
0,
|
2020-07-02 21:45:37 +02:00
|
|
|
&sFrontierSquares_Tilemap,
|
2018-01-14 22:09:35 +01:00
|
|
|
0,
|
|
|
|
0,
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
4 * varDiv + 1,
|
|
|
|
4 * varAnd,
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
0xF,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[2] > 63)
|
2018-01-14 22:09:35 +01:00
|
|
|
task->tState++;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresScroll_Func3(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
BlendPalettes(PALETTES_ALL & ~(1 << 15), 16, RGB_BLACK);
|
2018-01-14 22:09:35 +01:00
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
task->data[2] = 0;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
task->tState++;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:20:48 +02:00
|
|
|
static bool8 FrontierSquaresScroll_Func4(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
2021-10-25 16:42:08 +02:00
|
|
|
u8 var = gUnknown_085C9A53[task->data[2]];
|
2018-01-14 22:09:35 +01:00
|
|
|
u8 varDiv = var / 8;
|
2021-10-25 16:42:08 +02:00
|
|
|
u8 varAnd = var % 8;
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
FillBgTilemapBufferRect(0, 1, 4 * varDiv + 1, 4 * varAnd, 4, 4, 0xF);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
if (++task->data[2] > 63)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
DestroyTask(FindTaskIdByFunc(sub_814ABE4));
|
|
|
|
task->tState++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef tSub32_X_delta
|
|
|
|
#undef tSub32_Y_delta
|
|
|
|
#undef tSub32_Bool
|
|
|
|
|
2021-10-25 16:42:08 +02:00
|
|
|
static bool8 FrontierSquaresScroll_End(struct Task *task)
|
2018-01-14 22:09:35 +01:00
|
|
|
{
|
|
|
|
gBattle_BG0_X = 0;
|
|
|
|
gBattle_BG0_Y = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y);
|
|
|
|
|
|
|
|
FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20);
|
|
|
|
CopyBgTilemapBufferToVram(0);
|
2021-10-25 16:42:08 +02:00
|
|
|
BlendPalettes(PALETTES_ALL, 16, RGB_BLACK);
|
2018-01-14 22:09:35 +01:00
|
|
|
|
|
|
|
DestroyTask(FindTaskIdByFunc(task->func));
|
2021-05-14 19:41:22 +02:00
|
|
|
|
|
|
|
#ifndef UBFIX
|
2018-01-14 22:09:35 +01:00
|
|
|
task->tState++; // UB: changing value of a destroyed task
|
2021-05-14 19:41:22 +02:00
|
|
|
#endif
|
2018-01-14 22:09:35 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|