added missing battle configs

This commit is contained in:
cawtds 2024-07-24 20:06:13 +02:00
parent 343a477c0c
commit b2d370ef10
20 changed files with 474 additions and 37 deletions

View File

@ -1997,6 +1997,90 @@
special CreateEnemyEventMon
.endm
.macro setdynamicaifunc func:req
callnative ScriptSetDynamicAiFunc
.4byte \func
.endm
@ Set up a totem boost for the next battle.
@ 'battler' is the position of the mon you want to gain a boost. see B_POSITION_xx in include/constants/battle.h.
@ The rest of the arguments are the stat change values to each stat.
@ For example, giving the first opponent +1 to atk and -2 to speed would be: settotemboost B_POSITION_OPPONENT_LEFT, 1, 0, -2
.macro settotemboost battler:req, atk=0,def=0,speed=0,spatk=0,spdef=0,acc=0,evas=0
setvar VAR_0x8000, \battler
setvar VAR_0x8001, \atk
setvar VAR_0x8002, \def
setvar VAR_0x8003, \speed
setvar VAR_0x8004, \spatk
setvar VAR_0x8005, \spdef
setvar VAR_0x8006, \acc
setvar VAR_0x8007, \evas
special SetTotemBoost
.endm
@ useful totem boost macros
.macro totemboost_atk1 battler:req
settotemboost \battler, 1
.endm
.macro totemboost_def1 battler:req
settotemboost \battler, 0, 1
.endm
.macro totemboost_speed1 battler:req
settotemboost \battler, 0, 0, 1
.endm
.macro totemboost_spatk1 battler:req
settotemboost \battler, 0, 0, 0, 1
.endm
.macro totemboost_spdef1 battler:req
settotemboost \battler, 0, 0, 0, 0, 1
.endm
.macro totemboost_acc1 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 1
.endm
.macro totemboost_evas1 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 0, 1
.endm
.macro totemboost_atk2 battler:req
settotemboost \battler, 2
.endm
.macro totemboost_def2 battler:req
settotemboost \battler, 0, 2
.endm
.macro totemboost_speed2 battler:req
settotemboost \battler, 0, 0, 2
.endm
.macro totemboost_spatk2 battler:req
settotemboost \battler, 0, 0, 0, 2
.endm
.macro totemboost_spdef2 battler:req
settotemboost \battler, 0, 0, 0, 0, 2
.endm
.macro totemboost_acc2 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 2
.endm
.macro totemboost_evas2 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 0, 2
.endm
@ Attempts to trigger a special evolution method in the overworld.
@ There may be other conditions required which are coded for in GetEvolutionTargetSpecies.
@ EX: tryspecialevo EVO_WATER_SCROLL, FALSE, FALSE triggers Kubfu's EVO_WATER_SCROLL evolution
@ method, cannot be cancelled in the evolution scene, and will only evolve one Kubfu if there
@ are multiple in the player's party.
.macro tryspecialevo evoMethod:req, canStopEvo=TRUE, tryMultiple=TRUE
setvar VAR_0x8000, \evoMethod
setvar VAR_0x8001, \canStopEvo
setvar VAR_0x8002, \tryMultiple
special TrySpecialOverworldEvo
.endm
.macro ai_vs_ai_battle trainer1:req, trainer2:req
setflag B_FLAG_AI_VS_AI_BATTLE
setvar VAR_0x8004, \trainer1
callnative CreateTrainerPartyForPlayer
trainerbattle_no_intro \trainer2, NULL
.endm
@ Sets VAR_RESULT to TRUE if stat can be hyper trained, or to
@ FALSE otherwise.

View File

@ -809,6 +809,7 @@ gStdScriptsEnd::
.include "data/scripts/std_msgbox.inc"
.include "data/scripts/trainer_battle.inc"
.include "data/scripts/config.inc"
.include "data/scripts/debug.inc"
@ Unused

12
data/scripts/config.inc Normal file
View File

@ -0,0 +1,12 @@
Debug_FlagsAndVarNotSetBattleConfigMessage::
lockall
message Debug_FlagsAndVarNotSetBattleConfigMessage_Text
waitmessage
waitbuttonpress
releaseall
end
Debug_FlagsAndVarNotSetBattleConfigMessage_Text:
.string "Feature unavailable! Please define a\n"
.string "usable flag and a usable var in:\l"
.string "'include/config/battle.h'!$"

View File

@ -455,4 +455,5 @@ gSpecials::
def_special GetNumberSprayStrength
def_special GetSprayId
def_special GetLastUsedSprayType
def_special TrySkyBattle
gSpecialsEnd::

View File

@ -455,6 +455,7 @@ void InitSpritePosToAnimTargetsCentre(struct Sprite *sprite, bool32 respectMonPi
//
void MoveBattlerSpriteToBG(u8 battlerId, u8);
void ResetBattleAnimBg(u8);
void LoadMoveBg(u16 bgId);
void ClearBattleAnimationVars(void);
void DoMoveAnim(u16 move);
void LaunchBattleAnimation(u32 animType, u16 animId);

View File

@ -21,5 +21,6 @@ void LoadBattleMenuWindowGfx(void);
void LoadBattleTextboxAndBackground(void);
void BattleInitBgsAndWindows(void);
void DrawMainBattleBackground(void);
void DrawTerrainTypeBattleBackground(void);
#endif // GUARD_BATTLE_BG_H

View File

@ -223,7 +223,7 @@
#define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
#define B_EXPANDED_MOVE_NAMES TRUE // If set to FALSE, move names are decreased from 16 characters to 12 characters.
#define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles.
#define B_QUICK_MOVE_CURSOR_TO_RUN FALSE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option
#define B_QUICK_MOVE_CURSOR_TO_RUN TRUE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option
#define B_MOVE_DESCRIPTION_BUTTON L_BUTTON // If set to a button other than B_LAST_USED_BALL_BUTTON, pressing this button will open the move description menu
// Catching settings

View File

@ -60,7 +60,6 @@ static void Task_ClearMonBgStatic(u8 taskId);
static void Task_FadeToBg(u8 taskId);
static void Task_PanFromInitialToTarget(u8 taskId);
static void Task_InitUpdateMonBg(u8 taskId);
static void LoadMoveBg(u16 bgId);
static void LoadDefaultBg(void);
static void Task_LoopAndPlaySE(u8 taskId);
static void Task_WaitAndPlaySE(u8 taskId);
@ -1396,7 +1395,7 @@ static void Task_FadeToBg(u8 taskId)
}
}
static void LoadMoveBg(u16 bgId)
void LoadMoveBg(u16 bgId)
{
LZDecompressVram(gBattleAnimBackgroundTable[bgId].tilemap, (void *)(BG_SCREEN_ADDR(26)));
LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)(BG_CHAR_ADDR(2)));
@ -1405,7 +1404,10 @@ static void LoadMoveBg(u16 bgId)
static void LoadDefaultBg(void)
{
DrawMainBattleBackground();
if (B_TERRAIN_BG_CHANGE == TRUE && gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
DrawTerrainTypeBattleBackground();
else
DrawMainBattleBackground();
}
static void Cmd_restorebg(void)

View File

@ -1227,7 +1227,17 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite)
}
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
if (gBattleAnimArgs[7])
if (B_UPDATED_MOVE_DATA >= GEN_5)
{
s16 x, y;
SetAverageBattlerPositions(gBattleAnimTarget, gBattleAnimArgs[7], &x, &y);
sprite->data[1] = sprite->x + gBattleAnimArgs[1];
sprite->data[2] = x + gBattleAnimArgs[3];
sprite->data[3] = sprite->y + gBattleAnimArgs[2];
sprite->data[4] = y + gBattleAnimArgs[4];
sprite->data[7] |= GetBattlerSpriteBGPriority(gBattleAnimTarget) << 8;
}
else if (gBattleAnimArgs[7])
{
sprite->data[1] = sprite->x + gBattleAnimArgs[1];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[3];
@ -1269,7 +1279,13 @@ static void MovePoisonGasCloud(struct Sprite *sprite)
if (sprite->data[0] <= 0)
{
sprite->data[0] = 80;
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
#if B_UPDATED_MOVE_DATA >= GEN_5
s16 x, y;
SetAverageBattlerPositions(gBattleAnimTarget, 0, &x, &y);
sprite->x = x;
#else
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
#endif
sprite->data[1] = sprite->x;
sprite->data[2] = sprite->x;
sprite->y += sprite->y2;

View File

@ -1026,10 +1026,23 @@ void AnimTask_CreateSurfWave(u8 taskId)
RelocateBattleBgPal(animBg.paletteId, animBg.bgTilemap, 0, 1);
}
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Surf, animBg.tilesOffset);
if (gBattleAnimArgs[0] == 0)
LoadCompressedPalette(gBattleAnimBgPalette_Surf, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
else
switch (gBattleAnimArgs[0])
{
case ANIM_SURF_PAL_SURF:
default:
if (B_NEW_SURF_PARTICLE_PALETTE == TRUE)
LoadCompressedPalette(gBattleAnimSpritePal_NewSurf, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
else
LoadCompressedPalette(gBattleAnimBgPalette_Surf, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
break;
case ANIM_SURF_PAL_MUDDY_WATER:
LoadCompressedPalette(gBattleAnimBgPalette_MuddyWater, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
break;
case ANIM_SURF_PAL_SLUDGE_WAVE:
LoadCompressedPalette(gBattleAnimBgPalette_SludgeWave, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
break;
}
taskId2 = CreateTask(AnimTask_SurfWaveScanlineEffect, gTasks[taskId].priority + 1);
gTasks[taskId].data[15] = taskId2;
gTasks[taskId2].data[0] = 0;

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "gflib.h"
#include "battle.h"
#include "battle_anim.h"
#include "battle_bg.h"
#include "battle_message.h"
#include "battle_terrain.h"
@ -12,6 +13,7 @@
#include "sound.h"
#include "text_window.h"
#include "trig.h"
#include "constants/battle_anim.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/trainers.h"
@ -464,7 +466,10 @@ void LoadBattleTextboxAndBackground(void)
CopyBgTilemapBufferToVram(0);
LoadCompressedPalette(gBattleInterface_Textbox_Pal, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadBattleMenuWindowGfx();
DrawMainBattleBackground();
if (B_TERRAIN_BG_CHANGE == TRUE)
DrawTerrainTypeBattleBackground();
else
DrawMainBattleBackground();
}
static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY)
@ -859,3 +864,25 @@ bool8 LoadChosenBattleElement(u8 caseId)
}
return ret;
}
void DrawTerrainTypeBattleBackground(void)
{
switch (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
{
case STATUS_FIELD_GRASSY_TERRAIN:
LoadMoveBg(BG_GRASSY_TERRAIN);
break;
case STATUS_FIELD_MISTY_TERRAIN:
LoadMoveBg(BG_MISTY_TERRAIN);
break;
case STATUS_FIELD_ELECTRIC_TERRAIN:
LoadMoveBg(BG_ELECTRIC_TERRAIN);
break;
case STATUS_FIELD_PSYCHIC_TERRAIN:
LoadMoveBg(BG_PSYCHIC_TERRAIN);
break;
default:
DrawMainBattleBackground();
break;
}
}

View File

@ -268,6 +268,16 @@ static void HandleInputChooseAction(u32 battler)
BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_CANCEL_PARTNER, 0);
PlayerBufferExecCompleted(battler);
}
else if (B_QUICK_MOVE_CURSOR_TO_RUN)
{
if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER)) // If wild battle, pressing B moves cursor to "Run".
{
PlaySE(SE_SELECT);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]);
gActionSelectionCursor[battler] = 3;
ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0);
}
}
}
else if (JOY_NEW(START_BUTTON))
{

View File

@ -173,6 +173,13 @@ static void HandleInputChooseAction(u32 battler)
ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0);
}
}
else if (B_QUICK_MOVE_CURSOR_TO_RUN && JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]);
gActionSelectionCursor[battler] = 3;
ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0);
}
}
static void Controller_WaitForHealthbox(u32 battler)

View File

@ -263,14 +263,14 @@ const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] =
{
TRAINER_CLASS(NONE, "{PKMN} TRAINER"),
TRAINER_CLASS(PKMN_TRAINER_UNUSED, "{PKMN} TRAINER"),
TRAINER_CLASS(AQUA_LEADER, "AQUA LEADER", 20),
TRAINER_CLASS(AQUA_LEADER, "AQUA LEADER", 20, ITEM_MASTER_BALL),
TRAINER_CLASS(TEAM_AQUA, "TEAM AQUA", 5),
TRAINER_CLASS(RS_AROMA_LADY, "AROMA LADY", 10),
TRAINER_CLASS(RS_RUIN_MANIAC, "RUIN MANIAC", 15),
TRAINER_CLASS(INTERVIEWER, "INTERVIEWER", 12),
TRAINER_CLASS(RS_TUBER_F, "TUBER", 1),
TRAINER_CLASS(RS_TUBER_M, "TUBER", 1),
TRAINER_CLASS(RS_COOLTRAINER, "COOLTRAINER", 12),
TRAINER_CLASS(RS_COOLTRAINER, "COOLTRAINER", 12, ITEM_ULTRA_BALL),
TRAINER_CLASS(HEX_MANIAC, "HEX MANIAC", 6),
TRAINER_CLASS(RS_LADY, "LADY", 50),
TRAINER_CLASS(RS_BEAUTY, "BEAUTY", 20),
@ -283,8 +283,8 @@ const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] =
TRAINER_CLASS(RS_CAMPER, "CAMPER", 4),
TRAINER_CLASS(BUG_MANIAC, "BUG MANIAC", 15),
TRAINER_CLASS(RS_PSYCHIC, "PSYCHIC", 6),
TRAINER_CLASS(RS_GENTLEMAN, "GENTLEMAN", 20),
TRAINER_CLASS(RS_ELITE_FOUR, "ELITE FOUR", 25),
TRAINER_CLASS(RS_GENTLEMAN, "GENTLEMAN", 20, ITEM_LUXURY_BALL),
TRAINER_CLASS(RS_ELITE_FOUR, "ELITE FOUR", 25, ITEM_ULTRA_BALL),
TRAINER_CLASS(RS_LEADER, "LEADER", 25),
TRAINER_CLASS(SCHOOL_KID, "SCHOOL KID", 5),
TRAINER_CLASS(SR_AND_JR, "SR. AND JR.", 4),
@ -299,16 +299,16 @@ const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] =
TRAINER_CLASS(NINJA_BOY, "NINJA BOY", 3),
TRAINER_CLASS(BATTLE_GIRL, "BATTLE GIRL", 6),
TRAINER_CLASS(PARASOL_LADY, "PARASOL LADY", 10),
TRAINER_CLASS(RS_SWIMMER_F, "SWIMMER♀", 2),
TRAINER_CLASS(RS_SWIMMER_F, "SWIMMER♀", 2, ITEM_DIVE_BALL),
TRAINER_CLASS(RS_PICNICKER, "PICNICKER", 4),
TRAINER_CLASS(RS_TWINS, "TWINS", 3),
TRAINER_CLASS(RS_SAILOR, "SAILOR", 8),
TRAINER_CLASS(BOARDER, "BOARDER"),
TRAINER_CLASS(COLLECTOR, "COLLECTOR", 15),
TRAINER_CLASS(COLLECTOR, "COLLECTOR", 15, ITEM_PREMIER_BALL),
TRAINER_CLASS(PKMN_TRAINER, "{PKMN} TRAINER", 15),
TRAINER_CLASS(RS_PKMN_BREEDER, "{PKMN} BREEDER", 10),
TRAINER_CLASS(RS_PKMN_RANGER, "{PKMN} RANGER", 12),
TRAINER_CLASS(MAGMA_LEADER, "MAGMA LEADER", 20),
TRAINER_CLASS(MAGMA_LEADER, "MAGMA LEADER", 20, ITEM_MASTER_BALL),
TRAINER_CLASS(TEAM_MAGMA, "TEAM MAGMA", 5),
TRAINER_CLASS(RS_LASS, "LASS", 4),
TRAINER_CLASS(RS_BUG_CATCHER, "BUG CATCHER", 4),
@ -330,12 +330,12 @@ const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] =
TRAINER_CLASS(BIKER, "BIKER", 5),
TRAINER_CLASS(BURGLAR, "BURGLAR", 22),
TRAINER_CLASS(ENGINEER, "ENGINEER", 12),
TRAINER_CLASS(FISHERMAN, "FISHERMAN", 9),
TRAINER_CLASS(FISHERMAN, "FISHERMAN", 9, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? ITEM_DIVE_BALL : ITEM_LURE_BALL),
TRAINER_CLASS(SWIMMER_M, "SWIMMER♂", 1),
TRAINER_CLASS(CUE_BALL, "CUE BALL", 6),
TRAINER_CLASS(GAMER, "GAMER", 18),
TRAINER_CLASS(BEAUTY, "BEAUTY", 18),
TRAINER_CLASS(SWIMMER_F, "SWIMMER♀", 1),
TRAINER_CLASS(SWIMMER_F, "SWIMMER♀", 1, ITEM_DIVE_BALL),
TRAINER_CLASS(PSYCHIC, "PSYCHIC", 5),
TRAINER_CLASS(ROCKER, "ROCKER", 6),
TRAINER_CLASS(JUGGLER, "JUGGLER", 10),
@ -347,9 +347,9 @@ const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] =
TRAINER_CLASS(BOSS, "BOSS", 25),
TRAINER_CLASS(LEADER, "LEADER", 25),
TRAINER_CLASS(TEAM_ROCKET, "TEAM ROCKET", 8),
TRAINER_CLASS(COOLTRAINER, "COOLTRAINER", 9),
TRAINER_CLASS(ELITE_FOUR, "ELITE FOUR", 25),
TRAINER_CLASS(GENTLEMAN, "GENTLEMAN", 18),
TRAINER_CLASS(COOLTRAINER, "COOLTRAINER", 9, ITEM_ULTRA_BALL),
TRAINER_CLASS(ELITE_FOUR, "ELITE FOUR", 25, ITEM_ULTRA_BALL),
TRAINER_CLASS(GENTLEMAN, "GENTLEMAN", 18, ITEM_LUXURY_BALL),
TRAINER_CLASS(RIVAL_LATE, "RIVAL", 9),
TRAINER_CLASS(CHAMPION, "CHAMPION", 25),
TRAINER_CLASS(CHANNELER, "CHANNELER", 8),
@ -362,7 +362,7 @@ const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT] =
TRAINER_CLASS(PLAYER, "{PKMN} TRAINER", 1), // changed from "PLAYER"
TRAINER_CLASS(CRUSH_GIRL, "CRUSH GIRL", 6),
TRAINER_CLASS(TUBER, "TUBER", 1),
TRAINER_CLASS(PKMN_BREEDER, "{PKMN} BREEDER", 7),
TRAINER_CLASS(PKMN_BREEDER, "{PKMN} BREEDER", 7, B_TRAINER_CLASS_POKE_BALLS >= GEN_8 ? ITEM_HEAL_BALL : ITEM_FRIEND_BALL),
TRAINER_CLASS(PKMN_RANGER, "{PKMN} RANGER", 9),
TRAINER_CLASS(AROMA_LADY, "AROMA LADY", 7),
TRAINER_CLASS(RUIN_MANIAC, "RUIN MANIAC", 12),

View File

@ -449,6 +449,19 @@ void StartRegiBattle(void)
IncrementGameStat(GAME_STAT_WILD_BATTLES);
}
static void DowngradeBadPoison(void)
{
u8 i;
u32 status = STATUS1_POISON;
if (B_TOXIC_REVERSAL < GEN_5)
return;
for(i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) && GetMonData(&gPlayerParty[i], MON_DATA_STATUS) == STATUS1_TOXIC_POISON)
SetMonData(&gPlayerParty[i], MON_DATA_STATUS, &status);
}
}
static void CB2_EndWildBattle(void)
{
CpuFill16(0, (void *)BG_PLTT, BG_PLTT_SIZE);
@ -460,6 +473,7 @@ static void CB2_EndWildBattle(void)
else
{
SetMainCallback2(CB2_ReturnToField);
DowngradeBadPoison();
gFieldCallback = FieldCB_SafariZoneRanOutOfBalls;
}
}
@ -471,7 +485,10 @@ static void CB2_EndScriptedWildBattle(void)
if (IsPlayerDefeated(gBattleOutcome) == TRUE)
SetMainCallback2(CB2_WhiteOut);
else
{
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
}
static void CB2_EndMarowakBattle(void)
@ -489,6 +506,7 @@ static void CB2_EndMarowakBattle(void)
gSpecialVar_Result = FALSE;
else
gSpecialVar_Result = TRUE;
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
}
@ -927,8 +945,33 @@ void StartTrainerBattle(void)
ScriptContext_Stop();
}
static void SaveChangesToPlayerParty(void)
{
u8 i = 0, j = 0;
u8 participatedPokemon = VarGet(B_VAR_SKY_BATTLE);
for (i = 0; i < PARTY_SIZE; i++)
{
if ((participatedPokemon >> i & 1) == 1)
{
gSaveBlock1Ptr->playerParty[i] = gPlayerParty[j];
j++;
}
}
}
static void HandleBattleVariantEndParty(void)
{
if (B_FLAG_SKY_BATTLE == 0 || !FlagGet(B_FLAG_SKY_BATTLE))
return;
SaveChangesToPlayerParty();
LoadPlayerParty();
FlagClear(B_FLAG_SKY_BATTLE);
}
static void CB2_EndTrainerBattle(void)
{
HandleBattleVariantEndParty();
if (sTrainerBattleMode == TRAINER_BATTLE_EARLY_RIVAL)
{
if (IsPlayerDefeated(gBattleOutcome) == TRUE)
@ -950,6 +993,7 @@ static void CB2_EndTrainerBattle(void)
else
{
gSpecialVar_Result = FALSE;
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
SetBattledTrainerFlag();
QuestLogEvents_HandleEndTrainerBattle();
@ -960,6 +1004,7 @@ static void CB2_EndTrainerBattle(void)
{
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
{
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
@ -969,6 +1014,7 @@ static void CB2_EndTrainerBattle(void)
else
{
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
DowngradeBadPoison();
SetBattledTrainerFlag();
QuestLogEvents_HandleEndTrainerBattle();
}
@ -979,6 +1025,7 @@ static void CB2_EndRematchBattle(void)
{
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
{
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
@ -991,6 +1038,7 @@ static void CB2_EndRematchBattle(void)
SetBattledTrainerFlag();
ClearRematchStateOfLastTalked();
ResetDeferredLinkEvent();
DowngradeBadPoison();
}
}

View File

@ -1014,8 +1014,16 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_Pencil, 0x0200, ANIM_TAG_PENCIL},
{gBattleAnimSpriteGfx_AirWave, 0x0100, ANIM_TAG_AIR_WAVE},
{gBattleAnimSpriteGfx_Orb, 0x0200, ANIM_TAG_ORB},
#if B_NEW_SWORD_PARTICLE
{gBattleAnimSpriteGfx_NewSword, 0x0400, ANIM_TAG_SWORD},
#else
{gBattleAnimSpriteGfx_Sword, 0x0400, ANIM_TAG_SWORD},
#endif
#if B_NEW_LEECH_SEED_PARTICLE
{gBattleAnimSpriteGfx_NewLeechSeed, 0x0180, ANIM_TAG_SEED},
#else
{gBattleAnimSpriteGfx_Seed, 0x0180, ANIM_TAG_SEED},
#endif
{gBattleAnimSpriteGfx_Explosion6, 0x0800, ANIM_TAG_EXPLOSION_6},
{gBattleAnimSpriteGfx_PinkOrb, 0x0020, ANIM_TAG_PINK_ORB},
{gBattleAnimSpriteGfx_Gust, 0x0400, ANIM_TAG_GUST},
@ -1038,7 +1046,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_HitDuplicate, 0x0A00, ANIM_TAG_HIT_DUPLICATE},
{gBattleAnimSpriteGfx_Leer, 0x0A00, ANIM_TAG_LEER},
{gBattleAnimSpriteGfx_BlueBurst, 0x0A00, ANIM_TAG_BLUE_BURST},
#if B_NEW_EMBER_PARTICLES
{gBattleAnimSpriteGfx_NewEmbers, 0x0A00, ANIM_TAG_SMALL_EMBER},
#else
{gBattleAnimSpriteGfx_SmallEmber, 0x0A00, ANIM_TAG_SMALL_EMBER},
#endif
{gBattleAnimSpriteGfx_GraySmoke, 0x0A00, ANIM_TAG_GRAY_SMOKE},
{gBattleAnimSpriteGfx_BlueStar, 0x0E00, ANIM_TAG_BLUE_STAR},
{gBattleAnimSpriteGfx_BubbleBurst, 0x0380, ANIM_TAG_BUBBLE_BURST},
@ -1067,12 +1079,20 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_RedFist, 0x0200, ANIM_TAG_RED_FIST},
{gBattleAnimSpriteGfx_SlamHit, 0x1000, ANIM_TAG_SLAM_HIT},
{gBattleAnimSpriteGfx_Ring, 0x0180, ANIM_TAG_RING},
#if B_NEW_ROCKS_PARTICLE == TRUE
{gBattleAnimSpriteGfx_NewRocks, 0x0C00, ANIM_TAG_ROCKS},
#else
{gBattleAnimSpriteGfx_Rocks, 0x0C00, ANIM_TAG_ROCKS},
#endif
{gBattleAnimSpriteGfx_Z, 0x0100, ANIM_TAG_Z},
{gBattleAnimSpriteGfx_YellowUnk2, 0x0040, ANIM_TAG_YELLOW_UNK_2},
{gBattleAnimSpriteGfx_AirSlash, 0x0180, ANIM_TAG_AIR_SLASH},
{gBattleAnimSpriteGfx_SpinningGreenOrbs, 0x0800, ANIM_TAG_SPINNING_GREEN_ORBS},
#if B_NEW_LEAF_PARTICLE
{gBattleAnimSpriteGfx_NewLeaf, 0x0480, ANIM_TAG_LEAF},
#else
{gBattleAnimSpriteGfx_Leaf, 0x0480, ANIM_TAG_LEAF},
#endif
{gBattleAnimSpriteGfx_Finger, 0x0200, ANIM_TAG_FINGER},
{gBattleAnimSpriteGfx_PoisonPowder, 0x0200, ANIM_TAG_POISON_POWDER},
{gBattleAnimSpriteGfx_BrownTriangle, 0x0100, ANIM_TAG_BROWN_TRIANGLE},
@ -1148,11 +1168,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_CircleImpact, 0x0020, ANIM_TAG_CIRCLE_IMPACT},
{gBattleAnimSpriteGfx_Scratch, 0x0a00, ANIM_TAG_SCRATCH},
{gBattleAnimSpriteGfx_Cut, 0x0800, ANIM_TAG_CUT},
#if B_NEW_TEETH_PARTICLE
{gBattleAnimSpriteGfx_NewTeeth, 0x0800, ANIM_TAG_SHARP_TEETH},
#else
{gBattleAnimSpriteGfx_SharpTeeth, 0x0800, ANIM_TAG_SHARP_TEETH},
#endif
{gBattleAnimSpriteGfx_RainbowRings, 0x00c0, ANIM_TAG_RAINBOW_RINGS},
{gBattleAnimSpriteGfx_IceCrystals, 0x01c0, ANIM_TAG_ICE_CRYSTALS},
{gBattleAnimSpriteGfx_IceSpikes, 0x0100, ANIM_TAG_ICE_SPIKES},
#if B_NEW_HANDS_FEET_PARTICLE
{gBattleAnimSpriteGfx_NewHandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET},
#else
{gBattleAnimSpriteGfx_HandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET},
#endif
{gBattleAnimSpriteGfx_MistCloud, 0x0200, ANIM_TAG_MIST_CLOUD},
{gBattleAnimSpriteGfx_Clamp, 0x0800, ANIM_TAG_CLAMP},
{gBattleAnimSpriteGfx_Bubble, 0x0180, ANIM_TAG_BUBBLE},
@ -1165,7 +1193,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_HornHit2, 0x0100, ANIM_TAG_HORN_HIT_2},
{gBattleAnimSpriteGfx_AirWave2, 0x0100, ANIM_TAG_AIR_WAVE_2},
{gBattleAnimSpriteGfx_SmallBubbles, 0x0140, ANIM_TAG_SMALL_BUBBLES},
#if B_NEW_FLY_BUBBLE_PARTICLE
{gBattleAnimSpriteGfx_NewFly, 0x0800, ANIM_TAG_ROUND_SHADOW},
#else
{gBattleAnimSpriteGfx_RoundShadow, 0x0800, ANIM_TAG_ROUND_SHADOW},
#endif
{gBattleAnimSpriteGfx_Sunlight, 0x0200, ANIM_TAG_SUNLIGHT},
{gBattleAnimSpriteGfx_Spore, 0x0100, ANIM_TAG_SPORE},
{gBattleAnimSpriteGfx_Flower, 0x00a0, ANIM_TAG_FLOWER},
@ -1196,7 +1228,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_FocusEnergy, 0x0400, ANIM_TAG_FOCUS_ENERGY},
{gBattleAnimSpriteGfx_SphereToCube, 0x0a00, ANIM_TAG_SPHERE_TO_CUBE},
{gBattleAnimSpriteGfx_Tendrils, 0x1000, ANIM_TAG_TENDRILS},
#if B_NEW_MEAN_LOOK_PARTICLE
{gBattleAnimSpriteGfx_NewEye, 0x0800, ANIM_TAG_EYE},
#else
{gBattleAnimSpriteGfx_Eye, 0x0800, ANIM_TAG_EYE},
#endif
{gBattleAnimSpriteGfx_WhiteShadow, 0x0400, ANIM_TAG_WHITE_SHADOW},
{gBattleAnimSpriteGfx_TealAlert, 0x0200, ANIM_TAG_TEAL_ALERT},
{gBattleAnimSpriteGfx_OpeningEye, 0x0800, ANIM_TAG_OPENING_EYE},
@ -1208,7 +1244,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_Spiral, 0x0800, ANIM_TAG_SPIRAL},
{gBattleAnimSpriteGfx_SnoreZ, 0x0200, ANIM_TAG_SNORE_Z},
{gBattleAnimSpriteGfx_Explosion, 0x0800, ANIM_TAG_EXPLOSION},
#if B_NEW_CURSE_NAIL_PARTICLE
{gBattleAnimSpriteGfx_NewNail, 0x0400, ANIM_TAG_NAIL},
#else
{gBattleAnimSpriteGfx_Nail, 0x0400, ANIM_TAG_NAIL},
#endif
{gBattleAnimSpriteGfx_GhostlySpirit, 0x0200, ANIM_TAG_GHOSTLY_SPIRIT},
{gBattleAnimSpriteGfx_WarmRock, 0x0a80, ANIM_TAG_WARM_ROCK},
{gBattleAnimSpriteGfx_BreakingEgg, 0x0600, ANIM_TAG_BREAKING_EGG},
@ -1235,7 +1275,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_Roots, 0x0800, ANIM_TAG_ROOTS},
{gBattleAnimSpriteGfx_ItemBag, 0x0200, ANIM_TAG_ITEM_BAG},
{gBattleAnimSpriteGfx_JaggedMusicNote, 0x0400, ANIM_TAG_JAGGED_MUSIC_NOTE},
#if B_NEW_BATON_PASS_BALL_PARTICLE
{gBattleAnimSpriteGfx_NewPokeball, 0x0080, ANIM_TAG_POKEBALL},
#else
{gBattleAnimSpriteGfx_Pokeball, 0x0080, ANIM_TAG_POKEBALL},
#endif
{gBattleAnimSpriteGfx_Spotlight, 0x0800, ANIM_TAG_SPOTLIGHT},
{gBattleAnimSpriteGfx_LetterZ, 0x0200, ANIM_TAG_LETTER_Z},
{gBattleAnimSpriteGfx_RapidSpin, 0x0300, ANIM_TAG_RAPID_SPIN},
@ -1250,7 +1294,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_PinkPetal, 0x0080, ANIM_TAG_PINK_PETAL},
{gBattleAnimSpriteGfx_PainSplit, 0x0180, ANIM_TAG_PAIN_SPLIT},
{gBattleAnimSpriteGfx_Confetti, 0x0180, ANIM_TAG_CONFETTI},
#if B_NEW_MORNING_SUN_STAR_PARTICLE
{gBattleAnimSpriteGfx_NewGreenStar, 0x0200, ANIM_TAG_GREEN_STAR},
#else
{gBattleAnimSpriteGfx_GreenStar, 0x0200, ANIM_TAG_GREEN_STAR},
#endif
{gBattleAnimSpriteGfx_PinkCloud, 0x0200, ANIM_TAG_PINK_CLOUD},
{gBattleAnimSpriteGfx_SweatDrop, 0x0020, ANIM_TAG_SWEAT_DROP},
{gBattleAnimSpriteGfx_GuardRing, 0x0400, ANIM_TAG_GUARD_RING},
@ -1300,7 +1348,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_GoldRing, 0x0100, ANIM_TAG_BLUE_RING_2},
{gBattleAnimSpriteGfx_WhiteStreak, 0x0200, ANIM_TAG_WHITE_STREAK},
{gBattleAnimSpriteGfx_PurpleJab, 0x0100, ANIM_TAG_PURPLE_JAB},
{gBattleAnimSpriteGfx_Spikes, 0x0080, ANIM_TAG_TOXIC_SPIKES},
#if B_NEW_SPIKES_PARTICLE
{gBattleAnimSpriteGfx_NewSpikes, 0x0080, ANIM_TAG_SPIKES},
#else
{gBattleAnimSpriteGfx_Spikes, 0x0080, ANIM_TAG_SPIKES},
#endif
{gBattleAnimSpriteGfx_EnergyBall, 0x0200, ANIM_TAG_ENERGY_BALL},
{gBattleAnimSpriteGfx_SeedBrown, 0x0080, ANIM_TAG_SEED_BROWN},
{gBattleAnimSpriteGfx_Feint, 0x0800, ANIM_TAG_FEINT},
@ -1415,8 +1467,16 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_Pencil, ANIM_TAG_PENCIL},
{gBattleAnimSpritePal_AirWave, ANIM_TAG_AIR_WAVE},
{gBattleAnimSpritePal_Orb, ANIM_TAG_ORB},
#if B_NEW_SWORD_PARTICLE
{gBattleAnimSpritePal_NewSword, ANIM_TAG_SWORD},
#else
{gBattleAnimSpritePal_Sword, ANIM_TAG_SWORD},
#endif
#if B_NEW_LEECH_SEED_PARTICLE
{gBattleAnimSpritePal_NewLeechSeed, ANIM_TAG_SEED},
#else
{gBattleAnimSpritePal_Seed, ANIM_TAG_SEED},
#endif
{gBattleAnimSpritePal_Explosion6, ANIM_TAG_EXPLOSION_6},
{gBattleAnimSpritePal_PinkOrb, ANIM_TAG_PINK_ORB},
{gBattleAnimSpritePal_Gust, ANIM_TAG_GUST},
@ -1430,7 +1490,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_BlackSmoke, ANIM_TAG_BLACK_BALL},
{gBattleAnimSpritePal_Conversion, ANIM_TAG_CONVERSION},
{gBattleAnimSpritePal_Glass, ANIM_TAG_GLASS},
#if B_NEW_HORN_ATTACK_PARTICLE
{gBattleAnimSpritePal_NewHornHit, ANIM_TAG_HORN_HIT},
#else
{gBattleAnimSpritePal_HornHit, ANIM_TAG_HORN_HIT},
#endif
{gBattleAnimSpritePal_Hit, ANIM_TAG_HIT},
{gBattleAnimSpritePal_Hit2, ANIM_TAG_HIT_2},
{gBattleAnimSpritePal_BlueShards, ANIM_TAG_BLUE_SHARDS},
@ -1439,7 +1503,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_HitDuplicate, ANIM_TAG_HIT_DUPLICATE},
{gBattleAnimSpritePal_Leer, ANIM_TAG_LEER},
{gBattleAnimSpritePal_BlueBurst, ANIM_TAG_BLUE_BURST},
#if B_NEW_EMBER_PARTICLES
{gBattleAnimSpritePal_NewEmbers, ANIM_TAG_SMALL_EMBER},
#else
{gBattleAnimSpritePal_SmallEmber, ANIM_TAG_SMALL_EMBER},
#endif
{gBattleAnimSpritePal_GraySmoke, ANIM_TAG_GRAY_SMOKE},
{gBattleAnimSpritePal_BlueStar, ANIM_TAG_BLUE_STAR},
{gBattleAnimSpritePal_BubbleBurst, ANIM_TAG_BUBBLE_BURST},
@ -1468,12 +1536,20 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_HumanoidFoot, ANIM_TAG_RED_FIST},
{gBattleAnimSpritePal_SlamHit, ANIM_TAG_SLAM_HIT},
{gBattleAnimSpritePal_Ring, ANIM_TAG_RING},
#if B_NEW_ROCKS_PARTICLE == TRUE
{gBattleAnimSpritePal_NewRocks, ANIM_TAG_ROCKS},
#else
{gBattleAnimSpritePal_Rocks, ANIM_TAG_ROCKS},
#endif
{gBattleAnimSpritePal_Z, ANIM_TAG_Z},
{gBattleAnimSpritePal_YellowUnk2, ANIM_TAG_YELLOW_UNK_2},
{gBattleAnimSpritePal_AirSlash, ANIM_TAG_AIR_SLASH},
{gBattleAnimSpritePal_SpinningGreenOrbs, ANIM_TAG_SPINNING_GREEN_ORBS},
#if B_NEW_LEAF_PARTICLE
{gBattleAnimSpritePal_NewLeaf, ANIM_TAG_LEAF},
#else
{gBattleAnimSpritePal_Leaf, ANIM_TAG_LEAF},
#endif
{gBattleAnimSpritePal_Finger, ANIM_TAG_FINGER},
{gBattleAnimSpritePal_PoisonPowder, ANIM_TAG_POISON_POWDER},
{gBattleAnimSpritePal_BrownTriangle, ANIM_TAG_BROWN_TRIANGLE},
@ -1545,15 +1621,27 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_Tongue, ANIM_TAG_TONGUE},
{gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE},
{gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE_2},
#if B_NEW_IMPACT_PALETTE
{gBattleAnimSpritePal_NewImpact, ANIM_TAG_IMPACT},
#else
{gBattleAnimSpritePal_Impact, ANIM_TAG_IMPACT},
#endif
{gBattleAnimSpritePal_CircleImpact, ANIM_TAG_CIRCLE_IMPACT},
{gBattleAnimSpritePal_Impact, ANIM_TAG_SCRATCH},
{gBattleAnimSpritePal_Impact, ANIM_TAG_CUT},
#if B_NEW_TEETH_PARTICLE
{gBattleAnimSpritePal_NewTeeth, ANIM_TAG_SHARP_TEETH},
#else
{gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_SHARP_TEETH},
#endif
{gBattleAnimSpritePal_RainbowRings, ANIM_TAG_RAINBOW_RINGS},
{gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_CRYSTALS},
{gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_SPIKES},
#if B_NEW_HANDS_FEET_PARTICLE
{gBattleAnimSpritePal_NewHandsAndFeet, ANIM_TAG_HANDS_AND_FEET},
#else
{gBattleAnimSpritePal_HandsAndFeet, ANIM_TAG_HANDS_AND_FEET},
#endif
{gBattleAnimSpritePal_MistCloud, ANIM_TAG_MIST_CLOUD},
{gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_CLAMP},
{gBattleAnimSpritePal_RainDrops, ANIM_TAG_BUBBLE},
@ -1562,11 +1650,19 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_WaterImpact, ANIM_TAG_WATER_ORB},
{gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_POISON_BUBBLE},
{gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_TOXIC_BUBBLE},
#if B_NEW_SPIKES_PARTICLE
{gBattleAnimSpritePal_NewSpikes, ANIM_TAG_SPIKES},
#else
{gBattleAnimSpritePal_Spikes, ANIM_TAG_SPIKES},
#endif
{gBattleAnimSpritePal_HornHit2, ANIM_TAG_HORN_HIT_2},
{gBattleAnimSpritePal_AirWave2, ANIM_TAG_AIR_WAVE_2},
{gBattleAnimSpritePal_SmallBubbles, ANIM_TAG_SMALL_BUBBLES},
#if B_NEW_FLY_BUBBLE_PARTICLE
{gBattleAnimSpritePal_NewFly, ANIM_TAG_ROUND_SHADOW},
#else
{gBattleAnimSpritePal_RoundShadow, ANIM_TAG_ROUND_SHADOW},
#endif
{gBattleAnimSpritePal_Sunlight, ANIM_TAG_SUNLIGHT},
{gBattleAnimSpritePal_Spore, ANIM_TAG_SPORE},
{gBattleAnimSpritePal_Flower, ANIM_TAG_FLOWER},
@ -1597,7 +1693,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_FocusEnergy, ANIM_TAG_FOCUS_ENERGY},
{gBattleAnimSpritePal_SphereToCube, ANIM_TAG_SPHERE_TO_CUBE},
{gBattleAnimSpritePal_Tendrils, ANIM_TAG_TENDRILS},
#if B_NEW_MEAN_LOOK_PARTICLE
{gBattleAnimSpritePal_NewEye, ANIM_TAG_EYE},
#else
{gBattleAnimSpritePal_Eye, ANIM_TAG_EYE},
#endif
{gBattleAnimSpritePal_WhiteShadow, ANIM_TAG_WHITE_SHADOW},
{gBattleAnimSpritePal_TealAlert, ANIM_TAG_TEAL_ALERT},
{gBattleAnimSpritePal_OpeningEye, ANIM_TAG_OPENING_EYE},
@ -1636,7 +1736,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_Roots, ANIM_TAG_ROOTS},
{gBattleAnimSpritePal_ItemBag, ANIM_TAG_ITEM_BAG},
{gBattleAnimSpritePal_JaggedMusicNote, ANIM_TAG_JAGGED_MUSIC_NOTE},
#if B_NEW_BATON_PASS_BALL_PARTICLE
{gBattleAnimSpritePal_NewPokeball, ANIM_TAG_POKEBALL},
#else
{gBattleAnimSpritePal_Pokeball, ANIM_TAG_POKEBALL},
#endif
{gBattleAnimSpritePal_Pokeball, ANIM_TAG_SPOTLIGHT},
{gBattleAnimSpritePal_LetterZ, ANIM_TAG_LETTER_Z},
{gBattleAnimSpritePal_RapidSpin, ANIM_TAG_RAPID_SPIN},
@ -1651,7 +1755,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_PinkPetal, ANIM_TAG_PINK_PETAL},
{gBattleAnimSpritePal_PainSplit, ANIM_TAG_PAIN_SPLIT},
{gBattleAnimSpritePal_Confetti, ANIM_TAG_CONFETTI},
#if B_NEW_MORNING_SUN_STAR_PARTICLE
{gBattleAnimSpritePal_NewGreenStar, ANIM_TAG_GREEN_STAR},
#else
{gBattleAnimSpritePal_GreenStar, ANIM_TAG_GREEN_STAR},
#endif
{gBattleAnimSpritePal_PinkCloud, ANIM_TAG_PINK_CLOUD},
{gBattleAnimSpritePal_SweatDrop, ANIM_TAG_SWEAT_DROP},
{gBattleAnimSpritePal_GuardRing, ANIM_TAG_GUARD_RING},

View File

@ -2,6 +2,7 @@
#include "gflib.h"
#include "quest_log.h"
#include "list_menu.h"
#include "load_save.h"
#include "debug.h"
#include "diploma.h"
#include "script.h"
@ -2620,3 +2621,47 @@ bool8 InPokemonCenter(void)
}
return FALSE;
}
static void PreparePartyForSkyBattle(void)
{
int i, participatingPokemonSlot = 0;
u8 partyCount = CalculatePlayerPartyCount();
FlagSet(B_FLAG_SKY_BATTLE);
SavePlayerParty();
for (i = 0; i < partyCount; i++)
{
struct Pokemon* pokemon = &gPlayerParty[i];
if (CanMonParticipateInSkyBattle(pokemon))
participatingPokemonSlot += 1 << i;
else
ZeroMonData(pokemon);
}
VarSet(B_VAR_SKY_BATTLE,participatingPokemonSlot);
CompactPartySlots();
}
void TrySkyBattle(void)
{
int i;
if (B_VAR_SKY_BATTLE == 0 || B_FLAG_SKY_BATTLE == 0)
{
LockPlayerFieldControls();
ScriptContext_SetupScript(Debug_FlagsAndVarNotSetBattleConfigMessage);
return;
}
for (i = 0; i < CalculatePlayerPartyCount(); i++)
{
struct Pokemon* pokemon = &gPlayerParty[i];
if (CanMonParticipateInSkyBattle(pokemon) && GetMonData(pokemon, MON_DATA_HP, NULL) > 0)
{
PreparePartyForSkyBattle();
gSpecialVar_Result = TRUE;
return;
}
}
gSpecialVar_Result = FALSE;
}

View File

@ -325,6 +325,31 @@ void Overworld_ResetStateAfterDigEscRope(void)
VarSet(VAR_QL_ENTRANCE, 0);
}
#if B_RESET_FLAGS_VARS_AFTER_WHITEOUT == TRUE
void Overworld_ResetBattleFlagsAndVars(void)
{
#if B_VAR_STARTING_STATUS != 0
VarSet(B_VAR_STARTING_STATUS, 0);
#endif
#if B_VAR_STARTING_STATUS_TIMER != 0
VarSet(B_VAR_STARTING_STATUS_TIMER, 0);
#endif
#if B_VAR_WILD_AI_FLAGS != 0
VarSet(B_VAR_WILD_AI_FLAGS,0);
#endif
FlagClear(B_FLAG_INVERSE_BATTLE);
FlagClear(B_FLAG_FORCE_DOUBLE_WILD);
FlagClear(B_SMART_WILD_AI_FLAG);
FlagClear(B_FLAG_NO_BAG_USE);
FlagClear(B_FLAG_NO_CATCHING);
FlagClear(B_FLAG_DYNAMAX_BATTLE);
FlagClear(B_FLAG_SKY_BATTLE);
}
#endif
static void Overworld_ResetStateAfterWhitingOut(void)
{
ResetInitialPlayerAvatarState();
@ -335,6 +360,8 @@ static void Overworld_ResetStateAfterWhitingOut(void)
VarSet(VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 0);
FlagClear(FLAG_SYS_USE_STRENGTH);
FlagClear(FLAG_SYS_FLASH_ACTIVE);
if (B_RESET_FLAGS_VARS_AFTER_WHITEOUT == TRUE)
Overworld_ResetBattleFlagsAndVars();
FlagClear(FLAG_SYS_QL_DEPARTED);
VarSet(VAR_QL_ENTRANCE, 0);
}

View File

@ -15,8 +15,11 @@
#include "constants/sound.h"
static void Task_DoPokeballSendOutAnim(u8 taskId);
static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite);
static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite);
static inline void DoPokeballSendOutSoundEffect(u32 battler);
static inline void *GetOpponentMonSendOutCallback(void);
static inline bool32 IsBattlerPlayer(u32 battler);
static void SpriteCB_MonSendOut_1(struct Sprite *sprite);
static void SpriteCB_MonSendOut_2(struct Sprite *sprite);
static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite);
static void SpriteCB_BallThrow(struct Sprite *sprite);
static void SpriteCB_BallThrow_ReachMon(struct Sprite *sprite);
@ -550,6 +553,8 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
bool8 notSendOut = FALSE;
s16 x, y;
u32 gender;
u32 throwXoffset = (B_ENEMY_THROW_BALLS >= GEN_6) ? 24 : 0;
s32 throwYoffset = (B_ENEMY_THROW_BALLS >= GEN_6) ? -16 : 24;
if (gTasks[taskId].tFrames == 0)
{
@ -596,14 +601,16 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
gBattlerTarget = battlerId;
gSprites[ballSpriteId].x = x;
gSprites[ballSpriteId].y = y;
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
gSprites[ballSpriteId].callback = SpriteCB_MonSendOut_1;
DoPokeballSendOutSoundEffect(battlerId);
break;
case POKEBALL_OPPONENT_SENDOUT:
gSprites[ballSpriteId].x = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X);
gSprites[ballSpriteId].y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 24;
gSprites[ballSpriteId].x = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X) + throwXoffset;
gSprites[ballSpriteId].y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + throwYoffset;
gBattlerTarget = battlerId;
gSprites[ballSpriteId].data[0] = 0;
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
gSprites[ballSpriteId].callback = GetOpponentMonSendOutCallback();
DoPokeballSendOutSoundEffect(battlerId);
break;
default:
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
@ -630,6 +637,22 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
PlaySE(SE_BALL_THROW);
}
static inline void DoPokeballSendOutSoundEffect(u32 battler)
{
if (IsBattlerPlayer(battler) && B_PLAYER_THROW_BALLS_SOUND < GEN_5)
return;
if (!IsBattlerPlayer(battler) && B_ENEMY_THROW_BALLS_SOUND < GEN_5)
return;
PlaySE(SE_BALL_THROW);
}
static inline void *GetOpponentMonSendOutCallback(void)
{
return (B_ENEMY_THROW_BALLS >= GEN_6) ? SpriteCB_MonSendOut_1 : SpriteCB_OpponentMonSendOut;
}
// This sequence of functions is very similar to those that get run when
// a Pokéball gets thrown at a wild Pokémon, starting at SpriteCB_Ball_Arc.
// These do not seem to get run.
@ -1123,23 +1146,33 @@ static void SpriteCB_BallThrow_CaptureMon(struct Sprite *sprite)
}
}
static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite)
static inline bool32 IsBattlerPlayer(u32 battler)
{
return (battler % B_POSITION_PLAYER_RIGHT) ? FALSE : TRUE;
}
static void SpriteCB_MonSendOut_1(struct Sprite *sprite)
{
bool32 isPlayer = IsBattlerPlayer(sprite->sBattler);
u32 coordX = (isPlayer) ? BATTLER_COORD_X_2 : BATTLER_COORD_X;
u32 coordY = (isPlayer) ? BATTLER_COORD_Y_PIC_OFFSET : BATTLER_COORD_Y;
sprite->data[0] = 25;
sprite->data[2] = GetBattlerSpriteCoord(sprite->sBattler, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, BATTLER_COORD_Y_PIC_OFFSET) + 24;
sprite->data[2] = GetBattlerSpriteCoord(sprite->sBattler, coordX);
sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, coordY) + 24;
sprite->data[5] = -30;
sprite->oam.affineParam = sprite->sBattler;
InitAnimArcTranslation(sprite);
sprite->callback = SpriteCB_PlayerMonSendOut_2;
sprite->callback = SpriteCB_MonSendOut_2;
}
#define HIBYTE(x) (((x) >> 8) & 0xFF)
static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
static void SpriteCB_MonSendOut_2(struct Sprite *sprite)
{
u32 r6;
u32 r7;
bool32 rightPosition = (IsBattlerPlayer(sprite->sBattler)) ? B_POSITION_PLAYER_RIGHT : B_POSITION_OPPONENT_RIGHT;
if (HIBYTE(sprite->data[7]) >= 35 && HIBYTE(sprite->data[7]) < 80)
{
@ -1182,7 +1215,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
sprite->data[0] = 0;
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->introAnimActive
&& sprite->sBattler == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))
&& sprite->sBattler == GetBattlerAtPosition(rightPosition))
sprite->callback = SpriteCB_ReleaseMon2FromBall;
else
sprite->callback = SpriteCB_ReleaseMonFromBall;

View File

@ -3164,7 +3164,8 @@ static void PokeSum_PrintSelectedMoveStats(void)
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
gMovesInfo[sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]].description);
ShowCategoryIcon(GetBattleMoveCategory(sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]));
if (B_SHOW_CATEGORY_ICON == TRUE)
ShowCategoryIcon(GetBattleMoveCategory(sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]));
}
}