Start battle_transition documenting

This commit is contained in:
GriffinR 2021-10-25 10:42:08 -04:00
parent a612c27f2d
commit 1056209d8e
2 changed files with 1200 additions and 1164 deletions

View File

@ -47,8 +47,14 @@
#include "constants/trainers.h" #include "constants/trainers.h"
#include "constants/trainer_hill.h" #include "constants/trainer_hill.h"
enum enum {
{ TRANSITION_TYPE_NORMAL,
TRANSITION_TYPE_CAVE,
TRANSITION_TYPE_FLASH,
TRANSITION_TYPE_WATER,
};
enum {
TRAINER_PARAM_LOAD_VAL_8BIT, TRAINER_PARAM_LOAD_VAL_8BIT,
TRAINER_PARAM_LOAD_VAL_16BIT, TRAINER_PARAM_LOAD_VAL_16BIT,
TRAINER_PARAM_LOAD_VAL_32BIT, TRAINER_PARAM_LOAD_VAL_32BIT,
@ -85,7 +91,6 @@ static void HandleRematchVarsOnBattleEnd(void);
static const u8 *GetIntroSpeechOfApproachingTrainer(void); static const u8 *GetIntroSpeechOfApproachingTrainer(void);
static const u8 *GetTrainerCantBattleSpeech(void); static const u8 *GetTrainerCantBattleSpeech(void);
// ewram vars
EWRAM_DATA static u16 sTrainerBattleMode = 0; EWRAM_DATA static u16 sTrainerBattleMode = 0;
EWRAM_DATA u16 gTrainerBattleOpponent_A = 0; EWRAM_DATA u16 gTrainerBattleOpponent_A = 0;
EWRAM_DATA u16 gTrainerBattleOpponent_B = 0; EWRAM_DATA u16 gTrainerBattleOpponent_B = 0;
@ -103,24 +108,22 @@ EWRAM_DATA static u8 *sTrainerBBattleScriptRetAddr = NULL;
EWRAM_DATA static bool8 sShouldCheckTrainerBScript = FALSE; EWRAM_DATA static bool8 sShouldCheckTrainerBScript = FALSE;
EWRAM_DATA static u8 sNoOfPossibleTrainerRetScripts = 0; EWRAM_DATA static u8 sNoOfPossibleTrainerRetScripts = 0;
// const rom data
// The first transition is used if the enemy pokemon are lower level than our pokemon. // The first transition is used if the enemy pokemon are lower level than our pokemon.
// Otherwise, the second transition is used. // Otherwise, the second transition is used.
static const u8 sBattleTransitionTable_Wild[][2] = static const u8 sBattleTransitionTable_Wild[][2] =
{ {
{B_TRANSITION_SLICE, B_TRANSITION_WHITEFADE}, // Normal [TRANSITION_TYPE_NORMAL] = {B_TRANSITION_SLICE, B_TRANSITION_WHITEFADE},
{B_TRANSITION_CLOCKWISE_BLACKFADE, B_TRANSITION_GRID_SQUARES}, // Cave [TRANSITION_TYPE_CAVE] = {B_TRANSITION_CLOCKWISE_BLACKFADE, B_TRANSITION_GRID_SQUARES},
{B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES}, // Cave with flash used [TRANSITION_TYPE_FLASH] = {B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES},
{B_TRANSITION_WAVE, B_TRANSITION_RIPPLE}, // Water [TRANSITION_TYPE_WATER] = {B_TRANSITION_WAVE, B_TRANSITION_RIPPLE},
}; };
static const u8 sBattleTransitionTable_Trainer[][2] = static const u8 sBattleTransitionTable_Trainer[][2] =
{ {
{B_TRANSITION_POKEBALLS_TRAIL, B_TRANSITION_SHARDS}, // Normal [TRANSITION_TYPE_NORMAL] = {B_TRANSITION_POKEBALLS_TRAIL, B_TRANSITION_SHARDS},
{B_TRANSITION_SHUFFLE, B_TRANSITION_BIG_POKEBALL}, // Cave [TRANSITION_TYPE_CAVE] = {B_TRANSITION_SHUFFLE, B_TRANSITION_BIG_POKEBALL},
{B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES}, // Cave with flash used [TRANSITION_TYPE_FLASH] = {B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES},
{B_TRANSITION_SWIRL, B_TRANSITION_RIPPLE}, // Water [TRANSITION_TYPE_WATER] = {B_TRANSITION_SWIRL, B_TRANSITION_RIPPLE},
}; };
// Battle Frontier (excluding Pyramid and Dome, which have their own tables below) // Battle Frontier (excluding Pyramid and Dome, which have their own tables below)
@ -697,20 +700,20 @@ static u8 GetBattleTransitionTypeByMap(void)
PlayerGetDestCoords(&x, &y); PlayerGetDestCoords(&x, &y);
tileBehavior = MapGridGetMetatileBehaviorAt(x, y); tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
if (Overworld_GetFlashLevel()) if (Overworld_GetFlashLevel())
return B_TRANSITION_SHUFFLE; return TRANSITION_TYPE_FLASH;
if (!MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior)) if (!MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
{ {
switch (gMapHeader.mapType) switch (gMapHeader.mapType)
{ {
case MAP_TYPE_UNDERGROUND: case MAP_TYPE_UNDERGROUND:
return B_TRANSITION_SWIRL; return TRANSITION_TYPE_CAVE;
case MAP_TYPE_UNDERWATER: case MAP_TYPE_UNDERWATER:
return B_TRANSITION_BIG_POKEBALL; return TRANSITION_TYPE_WATER;
default: default:
return B_TRANSITION_BLUR; return TRANSITION_TYPE_NORMAL;
} }
} }
return B_TRANSITION_BIG_POKEBALL; return TRANSITION_TYPE_WATER;
} }
static u16 GetSumOfPlayerPartyLevel(u8 numMons) static u16 GetSumOfPlayerPartyLevel(u8 numMons)

File diff suppressed because it is too large Load Diff