Merge pull request #1086 from GriffinRichards/doc-unktrans

Document unk_transition
This commit is contained in:
GriffinR 2020-07-18 20:22:58 -04:00 committed by GitHub
commit 8e6dd3bafe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 895 additions and 859 deletions

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

View File

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 733 B

View File

@ -684,7 +684,7 @@ $(OBJEVENTGFXDIR)/pics/effects/unknown_4F6D38/0.4bpp: %.4bpp: %.png
$(INTERFACEGFXDIR)/selector_outline.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 8
$(BATTRANSGFXDIR)/frontier_transition.4bpp: %.4bpp: %.png
$(BATTRANSGFXDIR)/frontier_logo_center.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 43

View File

@ -28,7 +28,7 @@ void BattleSetup_StartLegendaryBattle(void);
void StartGroudonKyogreBattle(void);
void StartRegiBattle(void);
u8 BattleSetup_GetTerrainId(void);
u8 sub_80B100C(s32 arg0);
u8 GetSpecialBattleTransition(s32 arg0);
void ChooseStarter(void);
void ResetTrainerOpponentIds(void);
void SetMapVarsToTrainer(void);

View File

@ -24,49 +24,49 @@ enum // TRANSITION_MUGSHOT
// credits for the names go to Dyskinesia, Tetrable and Farore
// names are naturally subject to change
#define B_TRANSITION_BLUR 0
#define B_TRANSITION_SWIRL 1
#define B_TRANSITION_SHUFFLE 2
#define B_TRANSITION_BIG_POKEBALL 3
#define B_TRANSITION_POKEBALLS_TRAIL 4
#define B_TRANSITION_CLOCKWISE_BLACKFADE 5
#define B_TRANSITION_RIPPLE 6
#define B_TRANSITION_WAVE 7
#define B_TRANSITION_SLICE 8
#define B_TRANSITION_WHITEFADE 9
#define B_TRANSITION_GRID_SQUARES 10
#define B_TRANSITION_SHARDS 11
#define B_TRANSITION_SIDNEY 12
#define B_TRANSITION_PHOEBE 13
#define B_TRANSITION_GLACIA 14
#define B_TRANSITION_DRAKE 15
#define B_TRANSITION_CHAMPION 16
#define B_TRANSITION_BLUR 0
#define B_TRANSITION_SWIRL 1
#define B_TRANSITION_SHUFFLE 2
#define B_TRANSITION_BIG_POKEBALL 3
#define B_TRANSITION_POKEBALLS_TRAIL 4
#define B_TRANSITION_CLOCKWISE_BLACKFADE 5
#define B_TRANSITION_RIPPLE 6
#define B_TRANSITION_WAVE 7
#define B_TRANSITION_SLICE 8
#define B_TRANSITION_WHITEFADE 9
#define B_TRANSITION_GRID_SQUARES 10
#define B_TRANSITION_SHARDS 11
#define B_TRANSITION_SIDNEY 12
#define B_TRANSITION_PHOEBE 13
#define B_TRANSITION_GLACIA 14
#define B_TRANSITION_DRAKE 15
#define B_TRANSITION_CHAMPION 16
// added in Emerald
#define B_TRANSITION_AQUA 17
#define B_TRANSITION_MAGMA 18
#define B_TRANSITION_REGICE 19
#define B_TRANSITION_REGISTEEL 20
#define B_TRANSITION_REGIROCK 21
#define B_TRANSITION_KYOGRE 22
#define B_TRANSITION_GROUDON 23
#define B_TRANSITION_RAYQUAZA 24
#define B_TRANSITION_SHRED_SPLIT 25
#define B_TRANSITION_BLACKHOLE1 26
#define B_TRANSITION_BLACKHOLE2 27
#define B_TRANSITION_RECTANGULAR_SPIRAL 28
#define B_TRANSITION_29 29
#define B_TRANSITION_30 30
#define B_TRANSITION_31 31
#define B_TRANSITION_32 32
#define B_TRANSITION_33 33
#define B_TRANSITION_34 34
#define B_TRANSITION_35 35
#define B_TRANSITION_36 36
#define B_TRANSITION_37 37
#define B_TRANSITION_38 38
#define B_TRANSITION_39 39
#define B_TRANSITION_40 40
#define B_TRANSITION_41 41
#define B_TRANSITION_COUNT 42
#define B_TRANSITION_AQUA 17
#define B_TRANSITION_MAGMA 18
#define B_TRANSITION_REGICE 19
#define B_TRANSITION_REGISTEEL 20
#define B_TRANSITION_REGIROCK 21
#define B_TRANSITION_KYOGRE 22
#define B_TRANSITION_GROUDON 23
#define B_TRANSITION_RAYQUAZA 24
#define B_TRANSITION_SHRED_SPLIT 25
#define B_TRANSITION_BLACKHOLE1 26
#define B_TRANSITION_BLACKHOLE2 27
#define B_TRANSITION_RECTANGULAR_SPIRAL 28
#define B_TRANSITION_FRONTIER_LOGO_WIGGLE 29
#define B_TRANSITION_FRONTIER_LOGO_WAVE 30
#define B_TRANSITION_FRONTIER_SQUARES 31
#define B_TRANSITION_FRONTIER_SQUARES_SCROLL 32
#define B_TRANSITION_FRONTIER_SQUARES_SPIRAL 33
#define B_TRANSITION_FRONTIER_CIRCLES_MEET 34
#define B_TRANSITION_FRONTIER_CIRCLES_CROSS 35
#define B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL 36
#define B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL 37
#define B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ 38
#define B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ 39
#define B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ 40
#define B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ 41
#define B_TRANSITION_COUNT 42
#endif // GUARD_BATTLE_TRANSITION_H

View File

@ -0,0 +1,13 @@
#ifndef GUARD_BATTLE_TRANSITION_FRONTIER_H
#define GUARD_BATTLE_TRANSITION_FRONTIER_H
void Phase2Task_FrontierCirclesMeet(u8 taskId);
void Phase2Task_FrontierCirclesCross(u8 taskId);
void Phase2Task_FrontierCirclesAsymmetricSpiral(u8 taskId);
void Phase2Task_FrontierCirclesSymmetricSpiral(u8 taskId);
void Phase2Task_FrontierCirclesMeetInSeq(u8 taskId);
void Phase2Task_FrontierCirclesCrossInSeq(u8 taskId);
void Phase2Task_FrontierCirclesAsymmetricSpiralInSeq(u8 taskId);
void Phase2Task_FrontierCirclesSymmetricSpiralInSeq(u8 taskId);
#endif // GUARD_BATTLE_TRANSITION_FRONTIER_H

View File

@ -1,13 +0,0 @@
#ifndef GUARD_UNK_TRANSITION_H
#define GUARD_UNK_TRANSITION_H
void Phase2Task_34(u8 taskId);
void Phase2Task_35(u8 taskId);
void Phase2Task_36(u8 taskId);
void Phase2Task_37(u8 taskId);
void Phase2Task_38(u8 taskId);
void Phase2Task_39(u8 taskId);
void Phase2Task_40(u8 taskId);
void Phase2Task_41(u8 taskId);
#endif // GUARD_UNK_TRANSITION_H

View File

@ -331,7 +331,7 @@ SECTIONS {
src/walda_phrase.o(.text);
src/contest_link_util.o(.text);
src/gym_leader_rematch.o(.text);
src/unk_transition.o(.text);
src/battle_transition_frontier.o(.text);
src/international_string_util.o(.text);
} =0
@ -685,7 +685,7 @@ SECTIONS {
src/rayquaza_scene.o(.rodata);
src/walda_phrase.o(.rodata);
src/gym_leader_rematch.o(.rodata);
src/unk_transition.o(.rodata);
src/battle_transition_frontier.o(.rodata);
src/text_input_strings.o(.rodata);
data/fonts.o(.rodata);
src/mystery_event_msg.o(.rodata);

View File

@ -124,28 +124,43 @@ static const u8 sBattleTransitionTable_Trainer[][2] =
{B_TRANSITION_SWIRL, B_TRANSITION_RIPPLE}, // Water
};
static const u8 sUnknown_0854FE98[] =
// Battle Frontier (excluding Pyramid and Dome, which have their own tables below)
static const u8 sBattleTransitionTable_BattleFrontier[] =
{
B_TRANSITION_29, B_TRANSITION_30, B_TRANSITION_31, B_TRANSITION_32,
B_TRANSITION_34, B_TRANSITION_35, B_TRANSITION_36, B_TRANSITION_37,
B_TRANSITION_38, B_TRANSITION_39, B_TRANSITION_40, B_TRANSITION_41
B_TRANSITION_FRONTIER_LOGO_WIGGLE,
B_TRANSITION_FRONTIER_LOGO_WAVE,
B_TRANSITION_FRONTIER_SQUARES,
B_TRANSITION_FRONTIER_SQUARES_SCROLL,
B_TRANSITION_FRONTIER_CIRCLES_MEET,
B_TRANSITION_FRONTIER_CIRCLES_CROSS,
B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL,
B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL,
B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ,
B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ,
B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ,
B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ
};
static const u8 sUnknown_0854FEA4[] =
static const u8 sBattleTransitionTable_BattlePyramid[] =
{
B_TRANSITION_31, B_TRANSITION_32, B_TRANSITION_33
B_TRANSITION_FRONTIER_SQUARES,
B_TRANSITION_FRONTIER_SQUARES_SCROLL,
B_TRANSITION_FRONTIER_SQUARES_SPIRAL
};
static const u8 sUnknown_0854FEA7[] =
static const u8 sBattleTransitionTable_BattleDome[] =
{
B_TRANSITION_29, B_TRANSITION_31, B_TRANSITION_32, B_TRANSITION_33
B_TRANSITION_FRONTIER_LOGO_WIGGLE,
B_TRANSITION_FRONTIER_SQUARES,
B_TRANSITION_FRONTIER_SQUARES_SCROLL,
B_TRANSITION_FRONTIER_SQUARES_SPIRAL
};
static const struct TrainerBattleParameter sOrdinaryBattleParams[] =
{
{&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT},
{&gTrainerBattleOpponent_A, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerAIntroSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerADefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
@ -158,7 +173,7 @@ static const struct TrainerBattleParameter sContinueScriptBattleParams[] =
{
{&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT},
{&gTrainerBattleOpponent_A, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerAIntroSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerADefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
@ -171,7 +186,7 @@ static const struct TrainerBattleParameter sDoubleBattleParams[] =
{
{&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT},
{&gTrainerBattleOpponent_A, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerAIntroSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerADefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
@ -184,7 +199,7 @@ static const struct TrainerBattleParameter sOrdinaryNoIntroBattleParams[] =
{
{&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT},
{&gTrainerBattleOpponent_A, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerAIntroSpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
{&sTrainerADefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
@ -197,7 +212,7 @@ static const struct TrainerBattleParameter sContinueScriptDoubleBattleParams[] =
{
{&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT},
{&gTrainerBattleOpponent_A, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerAIntroSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerADefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
@ -210,7 +225,7 @@ static const struct TrainerBattleParameter sTrainerBOrdinaryBattleParams[] =
{
{&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT},
{&gTrainerBattleOpponent_B, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerBIntroSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerBDefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
@ -223,7 +238,7 @@ static const struct TrainerBattleParameter sTrainerBContinueScriptBattleParams[]
{
{&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT},
{&gTrainerBattleOpponent_B, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerObjectEventLocalId, TRAINER_PARAM_LOAD_VAL_16BIT},
{&sTrainerBIntroSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerBDefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT},
{&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT},
@ -234,7 +249,7 @@ static const struct TrainerBattleParameter sTrainerBContinueScriptBattleParams[]
#define REMATCH(trainer1, trainer2, trainer3, trainer4, trainer5, map) \
{ \
.trainerIds = {trainer1, trainer2, trainer3, trainer4, trainer5}, \
.trainerIds = {trainer1, trainer2, trainer3, trainer4, trainer5}, \
.mapGroup = MAP_GROUP(map), \
.mapNum = MAP_NUM(map), \
}
@ -449,9 +464,9 @@ static void DoTrainerBattle(void)
static void sub_80B0828(void)
{
if (InBattlePyramid())
CreateBattleStartTask(sub_80B100C(10), 0);
CreateBattleStartTask(GetSpecialBattleTransition(10), 0);
else
CreateBattleStartTask(sub_80B100C(11), 0);
CreateBattleStartTask(GetSpecialBattleTransition(11), 0);
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_TRAINER_BATTLES);
@ -839,7 +854,17 @@ static u8 GetTrainerBattleTransition(void)
return sBattleTransitionTable_Trainer[transitionType][1];
}
u8 sub_80B100C(s32 arg0)
// 0: Battle Tower
// 3: Battle Dome
// 4: Battle Palace
// 5: Battle Arena
// 6: Battle Factory
// 7: Battle Pike
// 10: Battle Pyramid
// 11: Trainer Hill
// 12: Secret Base
// 13: E-Reader
u8 GetSpecialBattleTransition(s32 id)
{
u16 var;
u8 enemyLevel = GetMonData(&gEnemyParty[0], MON_DATA_LEVEL);
@ -847,43 +872,43 @@ u8 sub_80B100C(s32 arg0)
if (enemyLevel < playerLevel)
{
switch (arg0)
switch (id)
{
case 11:
case 12:
case 13:
return B_TRANSITION_POKEBALLS_TRAIL;
case 10:
return sUnknown_0854FEA4[Random() % ARRAY_COUNT(sUnknown_0854FEA4)];
return sBattleTransitionTable_BattlePyramid[Random() % ARRAY_COUNT(sBattleTransitionTable_BattlePyramid)];
case 3:
return sUnknown_0854FEA7[Random() % ARRAY_COUNT(sUnknown_0854FEA7)];
return sBattleTransitionTable_BattleDome[Random() % ARRAY_COUNT(sBattleTransitionTable_BattleDome)];
}
if (VarGet(VAR_FRONTIER_BATTLE_MODE) != FRONTIER_MODE_LINK_MULTIS)
return sUnknown_0854FE98[Random() % ARRAY_COUNT(sUnknown_0854FE98)];
return sBattleTransitionTable_BattleFrontier[Random() % ARRAY_COUNT(sBattleTransitionTable_BattleFrontier)];
}
else
{
switch (arg0)
switch (id)
{
case 11:
case 12:
case 13:
return B_TRANSITION_BIG_POKEBALL;
case 10:
return sUnknown_0854FEA4[Random() % ARRAY_COUNT(sUnknown_0854FEA4)];
return sBattleTransitionTable_BattlePyramid[Random() % ARRAY_COUNT(sBattleTransitionTable_BattlePyramid)];
case 3:
return sUnknown_0854FEA7[Random() % ARRAY_COUNT(sUnknown_0854FEA7)];
return sBattleTransitionTable_BattleDome[Random() % ARRAY_COUNT(sBattleTransitionTable_BattleDome)];
}
if (VarGet(VAR_FRONTIER_BATTLE_MODE) != FRONTIER_MODE_LINK_MULTIS)
return sUnknown_0854FE98[Random() % ARRAY_COUNT(sUnknown_0854FE98)];
return sBattleTransitionTable_BattleFrontier[Random() % ARRAY_COUNT(sBattleTransitionTable_BattleFrontier)];
}
var = gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 0]
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 1];
return sUnknown_0854FE98[var % ARRAY_COUNT(sUnknown_0854FE98)];
return sBattleTransitionTable_BattleFrontier[var % ARRAY_COUNT(sBattleTransitionTable_BattleFrontier)];
}
void ChooseStarter(void)

View File

@ -2028,7 +2028,7 @@ void DoSpecialTrainerBattle(void)
}
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(0));
BattleTransition_StartOnField(GetSpecialBattleTransition(0));
break;
case SPECIAL_BATTLE_SECRET_BASE:
for (i = 0; i < PARTY_SIZE; i++)
@ -2038,7 +2038,7 @@ void DoSpecialTrainerBattle(void)
}
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(12));
BattleTransition_StartOnField(GetSpecialBattleTransition(12));
break;
case SPECIAL_BATTLE_EREADER:
ZeroEnemyPartyMons();
@ -2048,7 +2048,7 @@ void DoSpecialTrainerBattle(void)
gTrainerBattleOpponent_A = 0;
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(13));
BattleTransition_StartOnField(GetSpecialBattleTransition(13));
break;
case SPECIAL_BATTLE_DOME:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOME;
@ -2058,7 +2058,7 @@ void DoSpecialTrainerBattle(void)
FillFrontierTrainerParty(DOME_BATTLE_PARTY_SIZE);
CreateTask(Task_StartBattleAfterTransition, 1);
sub_806E694(0);
BattleTransition_StartOnField(sub_80B100C(3));
BattleTransition_StartOnField(GetSpecialBattleTransition(3));
break;
case SPECIAL_BATTLE_PALACE:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_PALACE;
@ -2070,7 +2070,7 @@ void DoSpecialTrainerBattle(void)
FillTentTrainerParty(FRONTIER_PARTY_SIZE);
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(4));
BattleTransition_StartOnField(GetSpecialBattleTransition(4));
break;
case SPECIAL_BATTLE_ARENA:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_ARENA;
@ -2080,7 +2080,7 @@ void DoSpecialTrainerBattle(void)
FillTentTrainerParty(FRONTIER_PARTY_SIZE);
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(5));
BattleTransition_StartOnField(GetSpecialBattleTransition(5));
break;
case SPECIAL_BATTLE_FACTORY:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_FACTORY;
@ -2089,28 +2089,28 @@ void DoSpecialTrainerBattle(void)
FillFactoryTrainerParty();
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(6));
BattleTransition_StartOnField(GetSpecialBattleTransition(6));
break;
case SPECIAL_BATTLE_PIKE_SINGLE:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_BATTLE_TOWER;
FillFrontierTrainerParty(FRONTIER_PARTY_SIZE);
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(7));
BattleTransition_StartOnField(GetSpecialBattleTransition(7));
break;
case SPECIAL_BATTLE_PYRAMID:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID;
FillFrontierTrainerParty(FRONTIER_PARTY_SIZE);
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(10));
BattleTransition_StartOnField(GetSpecialBattleTransition(10));
break;
case SPECIAL_BATTLE_PIKE_DOUBLE:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS;
FillFrontierTrainersParties(1);
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(7));
BattleTransition_StartOnField(GetSpecialBattleTransition(7));
break;
case SPECIAL_BATTLE_STEVEN:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER;

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "battle.h"
#include "battle_transition.h"
#include "battle_transition_frontier.h"
#include "bg.h"
#include "decompress.h"
#include "event_object_movement.h"
@ -18,7 +19,6 @@
#include "sprite.h"
#include "task.h"
#include "trig.h"
#include "unk_transition.h"
#include "util.h"
#include "constants/field_effects.h"
#include "constants/songs.h"
@ -93,11 +93,11 @@ static void Phase2Task_ShredSplit(u8 taskId);
static void Phase2Task_Blackhole1(u8 taskId);
static void Phase2Task_Blackhole2(u8 taskId);
static void Phase2Task_RectangularSpiral(u8 taskId);
static void Phase2Task_29(u8 taskId);
static void Phase2Task_30(u8 taskId);
static void Phase2Task_31(u8 taskId);
static void Phase2Task_32(u8 taskId);
static void Phase2Task_33(u8 taskId);
static void Phase2Task_FrontierLogoWiggle(u8 taskId);
static void Phase2Task_FrontierLogoWave(u8 taskId);
static void Phase2Task_FrontierSquares(u8 taskId);
static void Phase2Task_FrontierSquaresScroll(u8 taskId);
static void Phase2Task_FrontierSquaresSpiral(u8 taskId);
static void VBlankCB_BattleTransition(void);
static void VBlankCB_Phase2_Swirl(void);
static void HBlankCB_Phase2_Swirl(void);
@ -192,12 +192,12 @@ static bool8 Phase2_Blackhole2_Func2(struct Task *task);
static bool8 Phase2_RectangularSpiral_Func1(struct Task *task);
static bool8 Phase2_RectangularSpiral_Func2(struct Task *task);
static bool8 Phase2_RectangularSpiral_Func3(struct Task *task);
static bool8 Phase2_29_Func1(struct Task *task);
static bool8 Phase2_29_Func2(struct Task *task);
static bool8 Phase2_30_Func1(struct Task *task);
static bool8 Phase2_30_Func2(struct Task *task);
static bool8 Phase2_30_Func3(struct Task *task);
static bool8 Phase2_30_Func4(struct Task *task);
static bool8 Phase2_FrontierLogoWiggle_Func1(struct Task *task);
static bool8 Phase2_FrontierLogoWiggle_Func2(struct Task *task);
static bool8 Phase2_FrontierLogoWave_Func1(struct Task *task);
static bool8 Phase2_FrontierLogoWave_Func2(struct Task *task);
static bool8 Phase2_FrontierLogoWave_Func3(struct Task *task);
static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task);
static bool8 Phase2_Rayquaza_Func3(struct Task *task);
static bool8 Phase2_Rayquaza_Func4(struct Task *task);
static bool8 Phase2_Rayquaza_Func5(struct Task *task);
@ -205,19 +205,19 @@ static bool8 Phase2_Rayquaza_Func6(struct Task *task);
static bool8 Phase2_Rayquaza_Func7(struct Task *task);
static bool8 Phase2_Rayquaza_Func8(struct Task *task);
static bool8 Phase2_Rayquaza_Func9(struct Task *task);
static bool8 Phase2_31_Func1(struct Task *task);
static bool8 Phase2_31_Func2(struct Task *task);
static bool8 Phase2_31_Func3(struct Task *task);
static bool8 Phase2_31_33_Func5(struct Task *task);
static bool8 Phase2_33_Func1(struct Task *task);
static bool8 Phase2_33_Func2(struct Task *task);
static bool8 Phase2_33_Func3(struct Task *task);
static bool8 Phase2_33_Func4(struct Task *task);
static bool8 Phase2_32_Func1(struct Task *task);
static bool8 Phase2_32_Func2(struct Task *task);
static bool8 Phase2_32_Func3(struct Task *task);
static bool8 Phase2_32_Func4(struct Task *task);
static bool8 Phase2_32_Func5(struct Task *task);
static bool8 Phase2_FrontierSquares_Func1(struct Task *task);
static bool8 Phase2_FrontierSquares_Func2(struct Task *task);
static bool8 Phase2_FrontierSquares_Func3(struct Task *task);
static bool8 Phase2_FrontierSquares_End(struct Task *task);
static bool8 Phase2_FrontierSquaresSpiral_Func1(struct Task *task);
static bool8 Phase2_FrontierSquaresSpiral_Func2(struct Task *task);
static bool8 Phase2_FrontierSquaresSpiral_Func3(struct Task *task);
static bool8 Phase2_FrontierSquaresSpiral_Func4(struct Task *task);
static bool8 Phase2_FrontierSquaresScroll_Func1(struct Task *task);
static bool8 Phase2_FrontierSquaresScroll_Func2(struct Task *task);
static bool8 Phase2_FrontierSquaresScroll_Func3(struct Task *task);
static bool8 Phase2_FrontierSquaresScroll_Func4(struct Task *task);
static bool8 Phase2_FrontierSquaresScroll_Func5(struct Task *task);
static bool8 Phase2_Mugshot_Func1(struct Task *task);
static bool8 Phase2_Mugshot_Func2(struct Task *task);
static bool8 Phase2_Mugshot_Func3(struct Task *task);
@ -302,15 +302,15 @@ static const u16 sGroudon2_Palette[] = INCBIN_U16("graphics/battle_transitions/g
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");
static const u16 gUnknown_085C7BE0[] = INCBIN_U16("graphics/battle_transitions/frontier_brain.gbapal");
static const u32 gUnknown_085C7C00[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.4bpp.lz");
static const u32 gUnknown_085C828C[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.bin.lz");
static const u16 gUnknown_085C8578[] = INCBIN_U16("graphics/battle_transitions/frontier_squares_blanktiles.gbapal");
static const u32 gUnknown_085C8598[] = INCBIN_U32("graphics/battle_transitions/frontier_square_1.4bpp.lz");
static const u32 gUnknown_085C86F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_2.4bpp.lz");
static const u32 gUnknown_085C87F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_3.4bpp.lz");
static const u32 gUnknown_085C88A4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_4.4bpp.lz");
static const u32 gUnknown_085C8928[] = INCBIN_U32("graphics/battle_transitions/frontier_squares.bin");
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");
static const TaskFunc sPhase1_Tasks[B_TRANSITION_COUNT] =
{
@ -348,19 +348,19 @@ static const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] =
[B_TRANSITION_BLACKHOLE1] = Phase2Task_Blackhole1,
[B_TRANSITION_BLACKHOLE2] = Phase2Task_Blackhole2,
[B_TRANSITION_RECTANGULAR_SPIRAL] = Phase2Task_RectangularSpiral,
[B_TRANSITION_29] = Phase2Task_29,
[B_TRANSITION_30] = Phase2Task_30,
[B_TRANSITION_31] = Phase2Task_31,
[B_TRANSITION_32] = Phase2Task_32,
[B_TRANSITION_33] = Phase2Task_33,
[B_TRANSITION_34] = Phase2Task_34,
[B_TRANSITION_35] = Phase2Task_35,
[B_TRANSITION_36] = Phase2Task_36,
[B_TRANSITION_37] = Phase2Task_37,
[B_TRANSITION_38] = Phase2Task_38,
[B_TRANSITION_39] = Phase2Task_39,
[B_TRANSITION_40] = Phase2Task_40,
[B_TRANSITION_41] = Phase2Task_41,
[B_TRANSITION_FRONTIER_LOGO_WIGGLE] = Phase2Task_FrontierLogoWiggle,
[B_TRANSITION_FRONTIER_LOGO_WAVE] = Phase2Task_FrontierLogoWave,
[B_TRANSITION_FRONTIER_SQUARES] = Phase2Task_FrontierSquares,
[B_TRANSITION_FRONTIER_SQUARES_SCROLL] = Phase2Task_FrontierSquaresScroll,
[B_TRANSITION_FRONTIER_SQUARES_SPIRAL] = Phase2Task_FrontierSquaresSpiral,
[B_TRANSITION_FRONTIER_CIRCLES_MEET] = Phase2Task_FrontierCirclesMeet,
[B_TRANSITION_FRONTIER_CIRCLES_CROSS] = Phase2Task_FrontierCirclesCross,
[B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL] = Phase2Task_FrontierCirclesAsymmetricSpiral,
[B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL] = Phase2Task_FrontierCirclesSymmetricSpiral,
[B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ] = Phase2Task_FrontierCirclesMeetInSeq,
[B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ] = Phase2Task_FrontierCirclesCrossInSeq,
[B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ] = Phase2Task_FrontierCirclesAsymmetricSpiralInSeq,
[B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ] = Phase2Task_FrontierCirclesSymmetricSpiralInSeq,
};
static const TransitionStateFunc sMainTransitionPhases[] =
@ -856,48 +856,48 @@ static const struct SpritePalette sSpritePalette_UnusedTrainer =
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");
static const TransitionStateFunc sPhase2_29_Funcs[] =
static const TransitionStateFunc sPhase2_FrontierLogoWiggle_Funcs[] =
{
Phase2_29_Func1,
Phase2_29_Func2,
Phase2_FrontierLogoWiggle_Func1,
Phase2_FrontierLogoWiggle_Func2,
Phase2_BigPokeball_Func3,
Phase2_BigPokeball_Func4,
Phase2_BigPokeball_Func5,
Phase2_BigPokeball_Func6
};
static const TransitionStateFunc sPhase2_30_Funcs[] =
static const TransitionStateFunc sPhase2_FrontierLogoWave_Funcs[] =
{
Phase2_30_Func1,
Phase2_30_Func2,
Phase2_30_Func3,
Phase2_30_Func4
Phase2_FrontierLogoWave_Func1,
Phase2_FrontierLogoWave_Func2,
Phase2_FrontierLogoWave_Func3,
Phase2_FrontierLogoWave_Func4
};
static const TransitionStateFunc sPhase2_31_Funcs[] =
static const TransitionStateFunc sPhase2_FrontierSquares_Funcs[] =
{
Phase2_31_Func1,
Phase2_31_Func2,
Phase2_31_Func3,
Phase2_31_33_Func5
Phase2_FrontierSquares_Func1,
Phase2_FrontierSquares_Func2,
Phase2_FrontierSquares_Func3,
Phase2_FrontierSquares_End
};
static const TransitionStateFunc sPhase2_33_Funcs[] =
static const TransitionStateFunc sPhase2_FrontierSquaresSpiral_Funcs[] =
{
Phase2_33_Func1,
Phase2_33_Func2,
Phase2_33_Func3,
Phase2_33_Func4,
Phase2_31_33_Func5
Phase2_FrontierSquaresSpiral_Func1,
Phase2_FrontierSquaresSpiral_Func2,
Phase2_FrontierSquaresSpiral_Func3,
Phase2_FrontierSquaresSpiral_Func4,
Phase2_FrontierSquares_End
};
static const TransitionStateFunc sPhase2_32_Funcs[] =
static const TransitionStateFunc sPhase2_FrontierSquaresScroll_Funcs[] =
{
Phase2_32_Func1,
Phase2_32_Func2,
Phase2_32_Func3,
Phase2_32_Func4,
Phase2_32_Func5
Phase2_FrontierSquaresScroll_Func1,
Phase2_FrontierSquaresScroll_Func2,
Phase2_FrontierSquaresScroll_Func3,
Phase2_FrontierSquaresScroll_Func4,
Phase2_FrontierSquaresScroll_Func5
};
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};
@ -3856,43 +3856,43 @@ static bool8 sub_814A228(s16 *data, bool8 a1, bool8 a2)
#define tData6 data[6]
#define tData7 data[7]
static bool8 Phase2_29_Func1(struct Task *task)
static bool8 Phase2_FrontierLogoWiggle_Func1(struct Task *task)
{
u16 *tilemap, *tileset;
sub_814669C(task);
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, 0x800);
LZ77UnCompVram(gUnknown_085C7C00, tileset);
LoadPalette(gUnknown_085C7BE0, 0xF0, 0x20);
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
LoadPalette(sFrontierLogo_Palette, 0xF0, 0x20);
task->tState++;
return FALSE;
}
static bool8 Phase2_29_Func2(struct Task *task)
static bool8 Phase2_FrontierLogoWiggle_Func2(struct Task *task)
{
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(gUnknown_085C828C, tilemap);
LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap);
sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 0x84, task->tData5, 160);
task->tState++;
return TRUE;
}
static void Phase2Task_29(u8 taskId)
static void Phase2Task_FrontierLogoWiggle(u8 taskId)
{
while (sPhase2_29_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
while (sPhase2_FrontierLogoWiggle_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static void Phase2Task_30(u8 taskId)
static void Phase2Task_FrontierLogoWave(u8 taskId)
{
while (sPhase2_30_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
while (sPhase2_FrontierLogoWave_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 Phase2_30_Func1(struct Task *task)
static bool8 Phase2_FrontierLogoWave_Func1(struct Task *task)
{
u16 *tilemap, *tileset;
@ -3910,26 +3910,26 @@ static bool8 Phase2_30_Func1(struct Task *task)
REG_BLDALPHA = sTransitionStructPtr->BLDALPHA;
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, 0x800);
LZ77UnCompVram(gUnknown_085C7C00, tileset);
LoadPalette(gUnknown_085C7BE0, 0xF0, 0x20);
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
LoadPalette(sFrontierLogo_Palette, 0xF0, 0x20);
sTransitionStructPtr->field_16 = 0;
task->tState++;
return FALSE;
}
static bool8 Phase2_30_Func2(struct Task *task)
static bool8 Phase2_FrontierLogoWave_Func2(struct Task *task)
{
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(gUnknown_085C828C, tilemap);
LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap);
task->tState++;
return TRUE;
}
static bool8 Phase2_30_Func3(struct Task *task)
static bool8 Phase2_FrontierLogoWave_Func3(struct Task *task)
{
u8 i;
@ -3946,7 +3946,7 @@ static bool8 Phase2_30_Func3(struct Task *task)
return TRUE;
}
static bool8 Phase2_30_Func4(struct Task *task)
static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task)
{
u8 i;
u16 var6, amplitude, var8;
@ -3991,7 +3991,7 @@ static bool8 Phase2_30_Func4(struct Task *task)
}
if (task->tData4 != 0 && !gPaletteFade.active)
DestroyTask(FindTaskIdByFunc(Phase2Task_30));
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierLogoWave));
task->tData7 -= 17;
sTransitionStructPtr->VBlank_DMA++;
@ -4014,33 +4014,33 @@ static void HBlankCB_Phase2_30(void)
REG_BG0VOFS = var;
}
static void Phase2Task_31(u8 taskId)
static void Phase2Task_FrontierSquares(u8 taskId)
{
while (sPhase2_31_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
while (sPhase2_FrontierSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static void Phase2Task_33(u8 taskId)
static void Phase2Task_FrontierSquaresSpiral(u8 taskId)
{
while (sPhase2_33_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
while (sPhase2_FrontierSquaresSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static void Phase2Task_32(u8 taskId)
static void Phase2Task_FrontierSquaresScroll(u8 taskId)
{
while (sPhase2_32_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
while (sPhase2_FrontierSquaresScroll_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 Phase2_31_Func1(struct Task *task)
static bool8 Phase2_FrontierSquares_Func1(struct Task *task)
{
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(gUnknown_085C8598, tileset);
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
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);
LoadPalette(gUnknown_085C8578, 0xF0, 0x20);
LoadPalette(sFrontierSquares_Palette, 0xF0, 0x20);
task->tData2 = 1;
task->tData3 = 0;
@ -4051,9 +4051,9 @@ static bool8 Phase2_31_Func1(struct Task *task)
return FALSE;
}
static bool8 Phase2_31_Func2(struct Task *task)
static bool8 Phase2_FrontierSquares_Func2(struct Task *task)
{
CopyRectToBgTilemapBufferRect(0, gUnknown_085C8928, 0, 0, 4, 4, task->tData2, task->tData3, 4, 4, 0xF, 0, 0);
CopyRectToBgTilemapBufferRect(0, sFrontierSquares_Tilemap, 0, 0, 4, 4, task->tData2, task->tData3, 4, 4, 0xF, 0, 0);
CopyBgTilemapBufferToVram(0);
task->tData2 += 4;
@ -4069,7 +4069,7 @@ static bool8 Phase2_31_Func2(struct Task *task)
return FALSE;
}
static bool8 Phase2_31_Func3(struct Task *task)
static bool8 Phase2_FrontierSquares_Func3(struct Task *task)
{
u8 i;
u16 *tilemap, *tileset;
@ -4088,13 +4088,13 @@ static bool8 Phase2_31_Func3(struct Task *task)
break;
case 1:
BlendPalettes(0xFFFF7FFF, 0x10, 0);
LZ77UnCompVram(gUnknown_085C86F4, tileset);
LZ77UnCompVram(sFrontierSquares_EmptyBg_Tileset, tileset);
break;
case 2:
LZ77UnCompVram(gUnknown_085C87F4, tileset);
LZ77UnCompVram(sFrontierSquares_Shrink1_Tileset, tileset);
break;
case 3:
LZ77UnCompVram(gUnknown_085C88A4, tileset);
LZ77UnCompVram(sFrontierSquares_Shrink2_Tileset, tileset);
break;
default:
FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20);
@ -4110,19 +4110,19 @@ static bool8 Phase2_31_Func3(struct Task *task)
return FALSE;
}
static bool8 Phase2_33_Func1(struct Task *task)
static bool8 Phase2_FrontierSquaresSpiral_Func1(struct Task *task)
{
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(gUnknown_085C8598, tileset);
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
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);
LoadPalette(gUnknown_085C8578, 0xE0, 0x20);
LoadPalette(gUnknown_085C8578, 0xF0, 0x20);
LoadPalette(sFrontierSquares_Palette, 0xE0, 0x20);
LoadPalette(sFrontierSquares_Palette, 0xF0, 0x20);
BlendPalette(0xE0, 0x10, 8, 0);
task->tData2 = 34;
@ -4132,12 +4132,12 @@ static bool8 Phase2_33_Func1(struct Task *task)
return FALSE;
}
static bool8 Phase2_33_Func2(struct Task *task)
static bool8 Phase2_FrontierSquaresSpiral_Func2(struct Task *task)
{
u8 var = gUnknown_085C9A30[task->tData2];
u8 varMod = var % 7;
u8 varDiv = var / 7;
CopyRectToBgTilemapBufferRect(0, &gUnknown_085C8928, 0, 0, 4, 4, 4 * varMod + 1, 4 * varDiv, 4, 4, 0xF, 0, 0);
CopyRectToBgTilemapBufferRect(0, &sFrontierSquares_Tilemap, 0, 0, 4, 4, 4 * varMod + 1, 4 * varDiv, 4, 4, 0xF, 0, 0);
CopyBgTilemapBufferToVram(0);
if (--task->tData2 < 0)
@ -4145,7 +4145,7 @@ static bool8 Phase2_33_Func2(struct Task *task)
return FALSE;
}
static bool8 Phase2_33_Func3(struct Task *task)
static bool8 Phase2_FrontierSquaresSpiral_Func3(struct Task *task)
{
BlendPalette(0xE0, 0x10, 3, 0);
BlendPalettes(0xFFFF3FFF, 0x10, 0);
@ -4157,13 +4157,13 @@ static bool8 Phase2_33_Func3(struct Task *task)
return FALSE;
}
static bool8 Phase2_33_Func4(struct Task *task)
static bool8 Phase2_FrontierSquaresSpiral_Func4(struct Task *task)
{
if ((task->tData3 ^= 1))
{
CopyRectToBgTilemapBufferRect(
0,
gUnknown_085C8928,
sFrontierSquares_Tilemap,
0,
0,
4,
@ -4200,7 +4200,7 @@ static bool8 Phase2_33_Func4(struct Task *task)
return FALSE;
}
static bool8 Phase2_31_33_Func5(struct Task *task)
static bool8 Phase2_FrontierSquares_End(struct Task *task)
{
FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20);
CopyBgTilemapBufferToVram(0);
@ -4225,16 +4225,16 @@ static void sub_814ABE4(u8 taskId)
}
}
static bool8 Phase2_32_Func1(struct Task *task)
static bool8 Phase2_FrontierSquaresScroll_Func1(struct Task *task)
{
u8 taskId = 0;
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(gUnknown_085C8598, tileset);
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
CopyBgTilemapBufferToVram(0);
LoadPalette(gUnknown_085C8578, 0xF0, 0x20);
LoadPalette(sFrontierSquares_Palette, 0xF0, 0x20);
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
@ -4267,7 +4267,7 @@ static bool8 Phase2_32_Func1(struct Task *task)
return FALSE;
}
static bool8 Phase2_32_Func2(struct Task *task)
static bool8 Phase2_FrontierSquaresScroll_Func2(struct Task *task)
{
u8 var = gUnknown_085C9A53[task->tData2];
u8 varDiv = var / 8;
@ -4275,7 +4275,7 @@ static bool8 Phase2_32_Func2(struct Task *task)
CopyRectToBgTilemapBufferRect(
0,
&gUnknown_085C8928,
&sFrontierSquares_Tilemap,
0,
0,
4,
@ -4294,7 +4294,7 @@ static bool8 Phase2_32_Func2(struct Task *task)
return 0;
}
static bool8 Phase2_32_Func3(struct Task *task)
static bool8 Phase2_FrontierSquaresScroll_Func3(struct Task *task)
{
BlendPalettes(0xFFFF7FFF, 0x10, 0);
@ -4304,7 +4304,7 @@ static bool8 Phase2_32_Func3(struct Task *task)
return FALSE;
}
static bool8 Phase2_32_Func4(struct Task *task)
static bool8 Phase2_FrontierSquaresScroll_Func4(struct Task *task)
{
u8 var = gUnknown_085C9A53[task->tData2];
u8 varDiv = var / 8;
@ -4326,7 +4326,7 @@ static bool8 Phase2_32_Func4(struct Task *task)
#undef tSub32_Y_delta
#undef tSub32_Bool
static bool8 Phase2_32_Func5(struct Task *task)
static bool8 Phase2_FrontierSquaresScroll_Func5(struct Task *task)
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;

View File

@ -0,0 +1,650 @@
#include "global.h"
#include "sprite.h"
#include "decompress.h"
#include "battle_transition_frontier.h"
#include "battle_transition.h"
#include "task.h"
#include "palette.h"
#include "trig.h"
#include "bg.h"
#include "gpu_regs.h"
#include "constants/rgb.h"
/*
There are 3 "categories" of Battle Frontier transition
1. The full logo is used (B_TRANSITION_FRONTIER_LOGO_*)
2. Small squares with the logo on it are used (B_TRANSITION_FRONTIER_SQUARES_*)
3. The balls that make up the logo come together to form the full logo (B_TRANSITION_FRONTIER_CIRCLES_*)
This file handles category 3. Functions for the other two are handled in battle_transition.c
*/
typedef bool8 (*TransitionStateFunc)(struct Task *task);
// this file's functions
static void SpriteCB_LogoCircleSlide(struct Sprite *sprite);
static void SpriteCB_LogoCircleSpiral(struct Sprite *sprite);
static bool8 WaitForLogoCirclesAnim(struct Task *task);
static bool8 FadeInCenterLogoCircle(struct Task *task);
static bool8 Circles_Init(struct Task *task);
static bool8 CirclesMeet_CreateSprites(struct Task *task);
static bool8 CirclesMeet_End(struct Task *task);
static bool8 CirclesCross_CreateSprites(struct Task *task);
static bool8 CirclesCross_End(struct Task *task);
static bool8 CirclesAsymmetricSpiral_CreateSprites(struct Task *task);
static bool8 CirclesAsymmetricSpiral_End(struct Task *task);
static bool8 CirclesSymmetricSpiral_CreateSprites(struct Task *task);
static bool8 CirclesSymmetricSpiral_End(struct Task *task);
static bool8 CirclesMeetInSeq_CreateSprites(struct Task *task);
static bool8 CirclesMeetInSeq_End(struct Task *task);
static bool8 CirclesCrossInSeq_CreateSprites(struct Task *task);
static bool8 CirclesCrossInSeq_End(struct Task *task);
static bool8 CirclesAsymmetricSpiralInSeq_CreateSprites(struct Task *task);
static bool8 CirclesAsymmetricSpiralInSeq_End(struct Task *task);
static bool8 CirclesSymmetricSpiralInSeq_CreateSprites(struct Task *task);
static bool8 CirclesSymmetricSpiralInSeq_End(struct Task *task);
#define PALTAG_LOGO_CIRCLES 0x2E90
// const rom data
static const u32 sLogoCenter_Gfx[] = INCBIN_U32("graphics/battle_transitions/frontier_logo_center.4bpp.lz");
static const u32 sLogoCenter_Tilemap[] = INCBIN_U32("graphics/battle_transitions/frontier_logo_center.bin");
static const u32 sLogoCircles_Gfx[] = INCBIN_U32("graphics/battle_transitions/frontier_logo_circles.4bpp.lz");
static const u16 sLogo_Pal[] = INCBIN_U16("graphics/battle_transitions/frontier_logo_circles.gbapal");
// Unused Empty data.
static const u8 sFiller[0x1C0] = {0};
static const struct OamData sOamData_LogoCircles =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const struct CompressedSpriteSheet sSpriteSheet_LogoCircles =
{
.data = sLogoCircles_Gfx,
.size = 0x1800,
.tag = PALTAG_LOGO_CIRCLES
};
static const struct SpritePalette sSpritePalette_LogoCircles =
{
.data = sLogo_Pal,
.tag = PALTAG_LOGO_CIRCLES
};
static const union AnimCmd sAnim_LogoCircle_Top[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END
};
static const union AnimCmd sAnim_LogoCircle_Left[] =
{
ANIMCMD_FRAME(64, 1),
ANIMCMD_END
};
static const union AnimCmd sAnim_LogoCircle_Right[] =
{
ANIMCMD_FRAME(128, 1),
ANIMCMD_END
};
static const union AnimCmd *const sAnimTable_LogoCircles[] =
{
sAnim_LogoCircle_Top,
sAnim_LogoCircle_Left,
sAnim_LogoCircle_Right
};
static const struct SpriteTemplate sSpriteTemplate_LogoCircles =
{
.tileTag = PALTAG_LOGO_CIRCLES,
.paletteTag = PALTAG_LOGO_CIRCLES,
.oam = &sOamData_LogoCircles,
.anims = sAnimTable_LogoCircles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const TransitionStateFunc sPhase2_FrontierCirclesMeet_Funcs[] =
{
Circles_Init,
CirclesMeet_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesMeet_End
};
static const TransitionStateFunc sPhase2_FrontierCirclesCross_Funcs[] =
{
Circles_Init,
CirclesCross_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesCross_End
};
static const TransitionStateFunc sPhase2_FrontierCirclesAsymmetricSpiral_Funcs[] =
{
Circles_Init,
CirclesAsymmetricSpiral_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesAsymmetricSpiral_End
};
static const TransitionStateFunc sPhase2_FrontierCirclesSymmetricSpiral_Funcs[] =
{
Circles_Init,
CirclesSymmetricSpiral_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesSymmetricSpiral_End
};
static const TransitionStateFunc sPhase2_FrontierCirclesMeetInSeq_Funcs[] =
{
Circles_Init,
CirclesMeetInSeq_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesMeetInSeq_End
};
static const TransitionStateFunc sPhase2_FrontierCirclesCrossInSeq_Funcs[] =
{
Circles_Init,
CirclesCrossInSeq_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesCrossInSeq_End
};
static const TransitionStateFunc sPhase2_FrontierCirclesAsymmetricSpiralInSeq_Funcs[] =
{
Circles_Init,
CirclesAsymmetricSpiralInSeq_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesAsymmetricSpiralInSeq_End
};
static const TransitionStateFunc sPhase2_FrontierCirclesSymmetricSpiralInSeq_Funcs[] =
{
Circles_Init,
CirclesSymmetricSpiralInSeq_CreateSprites,
WaitForLogoCirclesAnim,
FadeInCenterLogoCircle,
CirclesSymmetricSpiralInSeq_End
};
// code
static void LoadLogoGfx(void)
{
u16 *dst1, *dst2;
GetBg0TilesDst(&dst1, &dst2);
LZ77UnCompVram(sLogoCenter_Gfx, dst2);
LZ77UnCompVram(sLogoCenter_Tilemap, dst1);
LoadPalette(sLogo_Pal, 0xF0, 0x20);
LoadCompressedSpriteSheet(&sSpriteSheet_LogoCircles);
LoadSpritePalette(&sSpritePalette_LogoCircles);
}
static u8 CreateSlidingLogoCircleSprite(s16 x, s16 y, u8 arg2, u8 arg3, s8 arg4, s8 arg5, u8 spriteAnimNum)
{
u8 spriteId = CreateSprite(&sSpriteTemplate_LogoCircles, x, y, 0);
switch (spriteAnimNum)
{
case 0:
gSprites[spriteId].data[0] = 120;
gSprites[spriteId].data[1] = 45;
break;
case 1:
gSprites[spriteId].data[0] = 89;
gSprites[spriteId].data[1] = 97;
break;
case 2:
gSprites[spriteId].data[0] = 151;
gSprites[spriteId].data[1] = 97;
break;
}
gSprites[spriteId].data[2] = arg4;
gSprites[spriteId].data[3] = arg5;
gSprites[spriteId].data[6] = arg2;
gSprites[spriteId].data[7] = arg3;
gSprites[spriteId].data[4] = 0;
gSprites[spriteId].data[5] = 0;
StartSpriteAnim(&gSprites[spriteId], spriteAnimNum);
gSprites[spriteId].callback = SpriteCB_LogoCircleSlide;
return spriteId;
}
static void SpriteCB_LogoCircleSlide(struct Sprite *sprite)
{
s16 *data = sprite->data;
if (sprite->pos1.x == data[0] && sprite->pos1.y == data[1])
{
sprite->callback = SpriteCallbackDummy;
}
else
{
if (data[4] == data[6])
{
sprite->pos1.x += data[2];
data[4] = 0;
}
else
{
data[4]++;
}
if (data[5] == data[7])
{
sprite->pos1.y += data[3];
data[5] = 0;
}
else
{
data[5]++;
}
}
}
static u8 CreateSpiralingLogoCircleSprite(s16 x, s16 y, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, u8 spriteAnimNum)
{
u8 spriteId = CreateSprite(&sSpriteTemplate_LogoCircles, x, y, 0);
switch (spriteAnimNum)
{
case 0:
gSprites[spriteId].data[0] = 120;
gSprites[spriteId].data[1] = 45;
break;
case 1:
gSprites[spriteId].data[0] = 89;
gSprites[spriteId].data[1] = 97;
break;
case 2:
gSprites[spriteId].data[0] = 151;
gSprites[spriteId].data[1] = 97;
break;
}
gSprites[spriteId].data[2] = arg2;
gSprites[spriteId].data[3] = arg3;
gSprites[spriteId].data[4] = arg4;
gSprites[spriteId].data[5] = arg5;
gSprites[spriteId].data[6] = arg6;
StartSpriteAnim(&gSprites[spriteId], spriteAnimNum);
gSprites[spriteId].callback = SpriteCB_LogoCircleSpiral;
return spriteId;
}
static void SpriteCB_LogoCircleSpiral(struct Sprite *sprite)
{
sprite->pos2.x = (Sin2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096
sprite->pos2.y = (Cos2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096
sprite->data[2] = (sprite->data[2] + sprite->data[3]) % 360;
if (sprite->data[4] != sprite->data[5])
sprite->data[4] += sprite->data[6];
else
sprite->callback = SpriteCallbackDummy;
}
#define tState data[0]
static void DestroyLogoCirclesGfx(struct Task *task)
{
FreeSpriteTilesByTag(PALTAG_LOGO_CIRCLES);
FreeSpritePaletteByTag(PALTAG_LOGO_CIRCLES);
DestroySprite(&gSprites[task->data[4]]);
DestroySprite(&gSprites[task->data[5]]);
DestroySprite(&gSprites[task->data[6]]);
}
static bool8 IsLogoCirclesAnimFinished(struct Task *task)
{
if (gSprites[task->data[4]].callback == SpriteCallbackDummy
&& gSprites[task->data[5]].callback == SpriteCallbackDummy
&& gSprites[task->data[6]].callback == SpriteCallbackDummy)
return TRUE;
else
return FALSE;
}
static bool8 Circles_Init(struct Task *task)
{
if (task->data[1] == 0)
{
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON);
task->data[1]++;
return FALSE;
}
else
{
LoadLogoGfx();
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0x500, 2);
task->data[1] = 0;
task->tState++;
return TRUE;
}
}
static bool8 FadeInCenterLogoCircle(struct Task *task)
{
if (task->data[2] == 0)
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON);
if (task->data[2] == 16)
{
if (task->data[3] == 31)
{
BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 0x10, RGB_BLACK);
task->tState++;
}
else
{
task->data[3]++;
}
}
else
{
u16 blnd;
task->data[2]++;
blnd = task->data[2];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(blnd, 16 - blnd));
}
return FALSE;
}
static bool8 WaitForLogoCirclesAnim(struct Task *task)
{
if (IsLogoCirclesAnimFinished(task) == TRUE)
task->tState++;
return FALSE;
}
void Phase2Task_FrontierCirclesMeet(u8 taskId)
{
while (sPhase2_FrontierCirclesMeet_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesMeet_CreateSprites(struct Task *task)
{
task->data[4] = CreateSlidingLogoCircleSprite(120, -51, 0, 0, 0, 2, 0);
task->data[5] = CreateSlidingLogoCircleSprite(-7, 193, 0, 0, 2, -2, 1);
task->data[6] = CreateSlidingLogoCircleSprite(247, 193, 0, 0, -2, -2, 2);
task->tState++;
return FALSE;
}
static bool8 CirclesMeet_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesMeet));
}
return FALSE;
}
void Phase2Task_FrontierCirclesCross(u8 taskId)
{
while (sPhase2_FrontierCirclesCross_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesCross_CreateSprites(struct Task *task)
{
task->data[4] = CreateSlidingLogoCircleSprite(120, 197, 0, 0, 0, -4, 0);
task->data[5] = CreateSlidingLogoCircleSprite(241, 59, 0, 1, -4, 2, 1);
task->data[6] = CreateSlidingLogoCircleSprite(-1, 59, 0, 1, 4, 2, 2);
task->tState++;
return FALSE;
}
static bool8 CirclesCross_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesCross));
}
return FALSE;
}
void Phase2Task_FrontierCirclesAsymmetricSpiral(u8 taskId)
{
while (sPhase2_FrontierCirclesAsymmetricSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesAsymmetricSpiral_CreateSprites(struct Task *task)
{
task->data[4] = CreateSpiralingLogoCircleSprite(120, 45, 12, 4, 128, 0, -4, 0);
task->data[5] = CreateSpiralingLogoCircleSprite(89, 97, 252, 4, 128, 0, -4, 1);
task->data[6] = CreateSpiralingLogoCircleSprite(151, 97, 132, 4, 128, 0, -4, 2);
task->tState++;
return FALSE;
}
static bool8 CirclesAsymmetricSpiral_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesAsymmetricSpiral));
}
return FALSE;
}
void Phase2Task_FrontierCirclesSymmetricSpiral(u8 taskId)
{
while (sPhase2_FrontierCirclesSymmetricSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesSymmetricSpiral_CreateSprites(struct Task *task)
{
task->data[4] = CreateSpiralingLogoCircleSprite(120, 80, 284, 8, 131, 35, -3, 0);
task->data[5] = CreateSpiralingLogoCircleSprite(120, 80, 44, 8, 131, 35, -3, 1);
task->data[6] = CreateSpiralingLogoCircleSprite(121, 80, 164, 8, 131, 35, -3, 2);
task->tState++;
return FALSE;
}
static bool8 CirclesSymmetricSpiral_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesSymmetricSpiral));
}
return FALSE;
}
void Phase2Task_FrontierCirclesMeetInSeq(u8 taskId)
{
while (sPhase2_FrontierCirclesMeetInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesMeetInSeq_CreateSprites(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = CreateSlidingLogoCircleSprite(120, -51, 0, 0, 0, 4, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = CreateSlidingLogoCircleSprite(-7, 193, 0, 0, 4, -4, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = CreateSlidingLogoCircleSprite(247, 193, 0, 0, -4, -4, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 CirclesMeetInSeq_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesMeetInSeq));
}
return FALSE;
}
void Phase2Task_FrontierCirclesCrossInSeq(u8 taskId)
{
while (sPhase2_FrontierCirclesCrossInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesCrossInSeq_CreateSprites(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = CreateSlidingLogoCircleSprite(120, 197, 0, 0, 0, -8, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = CreateSlidingLogoCircleSprite(241, 78, 0, 0, -8, 1, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = CreateSlidingLogoCircleSprite(-1, 78, 0, 0, 8, 1, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 CirclesCrossInSeq_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesCrossInSeq));
}
return FALSE;
}
void Phase2Task_FrontierCirclesAsymmetricSpiralInSeq(u8 taskId)
{
while (sPhase2_FrontierCirclesAsymmetricSpiralInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesAsymmetricSpiralInSeq_CreateSprites(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = CreateSpiralingLogoCircleSprite(120, 45, 12, 4, 128, 0, -4, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = CreateSpiralingLogoCircleSprite(89, 97, 252, 4, 128, 0, -4, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = CreateSpiralingLogoCircleSprite(151, 97, 132, 4, 128, 0, -4, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 CirclesAsymmetricSpiralInSeq_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesAsymmetricSpiralInSeq));
}
return FALSE;
}
void Phase2Task_FrontierCirclesSymmetricSpiralInSeq(u8 taskId)
{
while (sPhase2_FrontierCirclesSymmetricSpiralInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 CirclesSymmetricSpiralInSeq_CreateSprites(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = CreateSpiralingLogoCircleSprite(120, 80, 284, 8, 131, 35, -3, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = CreateSpiralingLogoCircleSprite(120, 80, 44, 8, 131, 35, -3, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = CreateSpiralingLogoCircleSprite(121, 80, 164, 8, 131, 35, -3, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 CirclesSymmetricSpiralInSeq_End(struct Task *task)
{
if (!gPaletteFade.active)
{
DestroyLogoCirclesGfx(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesSymmetricSpiralInSeq));
}
return FALSE;
}

View File

@ -1,639 +0,0 @@
#include "global.h"
#include "sprite.h"
#include "decompress.h"
#include "unk_transition.h"
#include "battle_transition.h"
#include "task.h"
#include "palette.h"
#include "trig.h"
#include "bg.h"
#include "gpu_regs.h"
#include "constants/rgb.h"
typedef bool8 (*TransitionStateFunc)(struct Task *task);
// this file's functions
static void sub_81DA848(struct Sprite *sprite);
static void sub_81DA9BC(struct Sprite *sprite);
static bool8 sub_81DAACC(struct Task *task);
static bool8 sub_81DAC14(struct Task *task);
static bool8 sub_81DABBC(struct Task *task);
static bool8 sub_81DAB4C(struct Task *task);
static bool8 sub_81DAC80(struct Task *task);
static bool8 sub_81DACEC(struct Task *task);
static bool8 sub_81DAD58(struct Task *task);
static bool8 sub_81DADC4(struct Task *task);
static bool8 sub_81DAE44(struct Task *task);
static bool8 sub_81DAEB0(struct Task *task);
static bool8 sub_81DAF34(struct Task *task);
static bool8 sub_81DAFA0(struct Task *task);
static bool8 sub_81DB02C(struct Task *task);
static bool8 sub_81DB098(struct Task *task);
static bool8 sub_81DB124(struct Task *task);
static bool8 sub_81DB190(struct Task *task);
static bool8 sub_81DB224(struct Task *task);
static bool8 sub_81DB290(struct Task *task);
static bool8 sub_81DB328(struct Task *task);
// const rom data
static const u32 gUnknown_0862AD54[] = INCBIN_U32("graphics/battle_transitions/frontier_transition.4bpp.lz");
static const u32 gUnknown_0862AF30[] = INCBIN_U32("graphics/battle_transitions/frontier_transition.bin");
static const u32 gUnknown_0862B0DC[] = INCBIN_U32("graphics/battle_transitions/frontier_transition_circles.4bpp.lz");
static const u16 gUnknown_0862B53C[] = INCBIN_U16("graphics/battle_transitions/frontier_transition.gbapal");
// Unused Empty data.
static const u8 sFiller[0x1C0] = {0};
static const struct OamData sOamData_862B71C =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const struct CompressedSpriteSheet sUnknown_0862B724 =
{
.data = gUnknown_0862B0DC,
.size = 0x1800,
.tag = 11920
};
static const struct SpritePalette sUnknown_0862B72C =
{
.data = gUnknown_0862B53C,
.tag = 11920
};
static const union AnimCmd sSpriteAnim_862B734[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_862B73C[] =
{
ANIMCMD_FRAME(64, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_862B744[] =
{
ANIMCMD_FRAME(128, 1),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_862B74C[] =
{
sSpriteAnim_862B734,
sSpriteAnim_862B73C,
sSpriteAnim_862B744
};
static const struct SpriteTemplate sUnknown_0862B758 =
{
.tileTag = 11920,
.paletteTag = 11920,
.oam = &sOamData_862B71C,
.anims = sSpriteAnimTable_862B74C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const TransitionStateFunc sPhase2_34_Funcs[] =
{
sub_81DAACC,
sub_81DAC14,
sub_81DABBC,
sub_81DAB4C,
sub_81DAC80
};
static const TransitionStateFunc sPhase2_35_Funcs[] =
{
sub_81DAACC,
sub_81DACEC,
sub_81DABBC,
sub_81DAB4C,
sub_81DAD58
};
static const TransitionStateFunc sPhase2_36_Funcs[] =
{
sub_81DAACC,
sub_81DADC4,
sub_81DABBC,
sub_81DAB4C,
sub_81DAE44
};
static const TransitionStateFunc sPhase2_37_Funcs[] =
{
sub_81DAACC,
sub_81DAEB0,
sub_81DABBC,
sub_81DAB4C,
sub_81DAF34
};
static const TransitionStateFunc sPhase2_38_Funcs[] =
{
sub_81DAACC,
sub_81DAFA0,
sub_81DABBC,
sub_81DAB4C,
sub_81DB02C
};
static const TransitionStateFunc sPhase2_39_Funcs[] =
{
sub_81DAACC,
sub_81DB098,
sub_81DABBC,
sub_81DAB4C,
sub_81DB124
};
static const TransitionStateFunc sPhase2_40_Funcs[] =
{
sub_81DAACC,
sub_81DB190,
sub_81DABBC,
sub_81DAB4C,
sub_81DB224
};
static const TransitionStateFunc sPhase2_41_Funcs[] =
{
sub_81DAACC,
sub_81DB290,
sub_81DABBC,
sub_81DAB4C,
sub_81DB328
};
// code
static void sub_81DA700(void)
{
u16 *dst1, *dst2;
GetBg0TilesDst(&dst1, &dst2);
LZ77UnCompVram(gUnknown_0862AD54, dst2);
LZ77UnCompVram(gUnknown_0862AF30, dst1);
LoadPalette(gUnknown_0862B53C, 0xF0, 0x20);
LoadCompressedSpriteSheet(&sUnknown_0862B724);
LoadSpritePalette(&sUnknown_0862B72C);
}
static u8 sub_81DA74C(s16 x, s16 y, u8 arg2, u8 arg3, s8 arg4, s8 arg5, u8 spriteAnimNum)
{
u8 spriteId = CreateSprite(&sUnknown_0862B758, x, y, 0);
switch (spriteAnimNum)
{
case 0:
gSprites[spriteId].data[0] = 120;
gSprites[spriteId].data[1] = 45;
break;
case 1:
gSprites[spriteId].data[0] = 89;
gSprites[spriteId].data[1] = 97;
break;
case 2:
gSprites[spriteId].data[0] = 151;
gSprites[spriteId].data[1] = 97;
break;
}
gSprites[spriteId].data[2] = arg4;
gSprites[spriteId].data[3] = arg5;
gSprites[spriteId].data[6] = arg2;
gSprites[spriteId].data[7] = arg3;
gSprites[spriteId].data[4] = 0;
gSprites[spriteId].data[5] = 0;
StartSpriteAnim(&gSprites[spriteId], spriteAnimNum);
gSprites[spriteId].callback = sub_81DA848;
return spriteId;
}
static void sub_81DA848(struct Sprite *sprite)
{
s16 *data = sprite->data;
if (sprite->pos1.x == data[0] && sprite->pos1.y == data[1])
{
sprite->callback = SpriteCallbackDummy;
}
else
{
if (data[4] == data[6])
{
sprite->pos1.x += data[2];
data[4] = 0;
}
else
{
data[4]++;
}
if (data[5] == data[7])
{
sprite->pos1.y += data[3];
data[5] = 0;
}
else
{
data[5]++;
}
}
}
static u8 sub_81DA8BC(s16 x, s16 y, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, u8 spriteAnimNum)
{
u8 spriteId = CreateSprite(&sUnknown_0862B758, x, y, 0);
switch (spriteAnimNum)
{
case 0:
gSprites[spriteId].data[0] = 120;
gSprites[spriteId].data[1] = 45;
break;
case 1:
gSprites[spriteId].data[0] = 89;
gSprites[spriteId].data[1] = 97;
break;
case 2:
gSprites[spriteId].data[0] = 151;
gSprites[spriteId].data[1] = 97;
break;
}
gSprites[spriteId].data[2] = arg2;
gSprites[spriteId].data[3] = arg3;
gSprites[spriteId].data[4] = arg4;
gSprites[spriteId].data[5] = arg5;
gSprites[spriteId].data[6] = arg6;
StartSpriteAnim(&gSprites[spriteId], spriteAnimNum);
gSprites[spriteId].callback = sub_81DA9BC;
return spriteId;
}
static void sub_81DA9BC(struct Sprite *sprite)
{
sprite->pos2.x = (Sin2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096
sprite->pos2.y = (Cos2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096
sprite->data[2] = (sprite->data[2] + sprite->data[3]) % 360;
if (sprite->data[4] != sprite->data[5])
sprite->data[4] += sprite->data[6];
else
sprite->callback = SpriteCallbackDummy;
}
#define tState data[0]
static void sub_81DAA20(struct Task *task)
{
FreeSpriteTilesByTag(11920);
FreeSpritePaletteByTag(11920);
DestroySprite(&gSprites[task->data[4]]);
DestroySprite(&gSprites[task->data[5]]);
DestroySprite(&gSprites[task->data[6]]);
}
static bool8 sub_81DAA74(struct Task *task)
{
if (gSprites[task->data[4]].callback == SpriteCallbackDummy
&& gSprites[task->data[5]].callback == SpriteCallbackDummy
&& gSprites[task->data[6]].callback == SpriteCallbackDummy)
return TRUE;
else
return FALSE;
}
static bool8 sub_81DAACC(struct Task *task)
{
if (task->data[1] == 0)
{
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON);
task->data[1]++;
return FALSE;
}
else
{
sub_81DA700();
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0x500, 2);
task->data[1] = 0;
task->tState++;
return TRUE;
}
}
static bool8 sub_81DAB4C(struct Task *task)
{
if (task->data[2] == 0)
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON);
if (task->data[2] == 16)
{
if (task->data[3] == 31)
{
BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 0x10, RGB_BLACK);
task->tState++;
}
else
{
task->data[3]++;
}
}
else
{
u16 blnd;
task->data[2]++;
blnd = task->data[2];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(blnd, 16 - blnd));
}
return FALSE;
}
static bool8 sub_81DABBC(struct Task *task)
{
if (sub_81DAA74(task) == TRUE)
task->tState++;
return FALSE;
}
void Phase2Task_34(u8 taskId)
{
while (sPhase2_34_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DAC14(struct Task *task)
{
task->data[4] = sub_81DA74C(120, -51, 0, 0, 0, 2, 0);
task->data[5] = sub_81DA74C(-7, 193, 0, 0, 2, -2, 1);
task->data[6] = sub_81DA74C(247, 193, 0, 0, -2, -2, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAC80(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_34));
}
return FALSE;
}
void Phase2Task_35(u8 taskId)
{
while (sPhase2_35_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DACEC(struct Task *task)
{
task->data[4] = sub_81DA74C(120, 197, 0, 0, 0, -4, 0);
task->data[5] = sub_81DA74C(241, 59, 0, 1, -4, 2, 1);
task->data[6] = sub_81DA74C(-1, 59, 0, 1, 4, 2, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAD58(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_35));
}
return FALSE;
}
void Phase2Task_36(u8 taskId)
{
while (sPhase2_36_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DADC4(struct Task *task)
{
task->data[4] = sub_81DA8BC(120, 45, 12, 4, 128, 0, -4, 0);
task->data[5] = sub_81DA8BC(89, 97, 252, 4, 128, 0, -4, 1);
task->data[6] = sub_81DA8BC(151, 97, 132, 4, 128, 0, -4, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAE44(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_36));
}
return FALSE;
}
void Phase2Task_37(u8 taskId)
{
while (sPhase2_37_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DAEB0(struct Task *task)
{
task->data[4] = sub_81DA8BC(120, 80, 284, 8, 131, 35, -3, 0);
task->data[5] = sub_81DA8BC(120, 80, 44, 8, 131, 35, -3, 1);
task->data[6] = sub_81DA8BC(121, 80, 164, 8, 131, 35, -3, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAF34(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_37));
}
return FALSE;
}
void Phase2Task_38(u8 taskId)
{
while (sPhase2_38_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DAFA0(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA74C(120, -51, 0, 0, 0, 4, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA74C(-7, 193, 0, 0, 4, -4, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA74C(247, 193, 0, 0, -4, -4, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB02C(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_38));
}
return FALSE;
}
void Phase2Task_39(u8 taskId)
{
while (sPhase2_39_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DB098(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA74C(120, 197, 0, 0, 0, -8, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA74C(241, 78, 0, 0, -8, 1, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA74C(-1, 78, 0, 0, 8, 1, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB124(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_39));
}
return FALSE;
}
void Phase2Task_40(u8 taskId)
{
while (sPhase2_40_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DB190(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA8BC(120, 45, 12, 4, 128, 0, -4, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA8BC(89, 97, 252, 4, 128, 0, -4, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA8BC(151, 97, 132, 4, 128, 0, -4, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB224(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_40));
}
return FALSE;
}
void Phase2Task_41(u8 taskId)
{
while (sPhase2_41_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DB290(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA8BC(120, 80, 284, 8, 131, 35, -3, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA8BC(120, 80, 44, 8, 131, 35, -3, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA8BC(121, 80, 164, 8, 131, 35, -3, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB328(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_41));
}
return FALSE;
}