Merge pull request #12 from cawtds/battle-configs

Implement remaining battle configs
This commit is contained in:
cawtds 2024-07-24 21:44:10 +02:00 committed by GitHub
commit 3372ecb1f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 1118 additions and 74 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::

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

View File

@ -72,6 +72,7 @@
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
#define B_ACTION_DEBUG 20
#define B_ACTION_THROW_BALL 21 // R to throw last used ball
#define B_ACTION_NONE 0xFF
@ -1077,6 +1078,7 @@ extern bool8 gHasFetchedBall;
extern u8 gLastUsedBall;
extern u16 gLastThrownBall;
extern u16 gBallToDisplay;
extern bool8 gLastUsedBallMenuPresent;
extern struct QueuedStatBoost gQueuedStatBoosts[MAX_BATTLERS_COUNT];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern u8 gAbsentBattlerFlags;

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

@ -140,4 +140,13 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle);
void DestroyAbilityPopUp(u8 battlerId);
void UpdateAbilityPopup(u8 battlerId);
bool32 CanThrowLastUsedBall(void);
void TryHideLastUsedBall(void);
void TryRestoreLastUsedBall(void);
void TryAddLastUsedBallItemSprites(void);
void SwapBallToDisplay(bool32 sameBall);
void ArrowsChangeColorLastBallCycle(bool32 showArrows);
void CategoryIcons_LoadSpritesGfx(void);
#endif // GUARD_BATTLE_INTERFACE_H

View File

@ -482,6 +482,7 @@
#define B_WIN_VS_OUTCOME_LEFT 22
#define B_WIN_VS_OUTCOME_RIGHT 23
#define B_WIN_OAK_OLD_MAN 24
#define B_WIN_MOVE_DESCRIPTION 25
#define B_TEXT_FLAG_NPC_CONTEXT_FONT (1 << 6)
#define B_TEXT_FLAG_WINDOW_CLEAR (1 << 7)

View File

@ -10,12 +10,12 @@
#define POCKET_BERRIES 5
#define NUM_BAG_POCKETS 5
// #define ITEMS_POCKET 0
// #define BALLS_POCKET 1
// #define TMHM_POCKET 2
// #define BERRIES_POCKET 3
// #define KEYITEMS_POCKET 4
// #define POCKETS_COUNT 5
#define ITEMS_POCKET 0
#define KEYITEMS_POCKET 1
#define BALLS_POCKET 2
#define TMHM_POCKET 3
#define BERRIES_POCKET 4
#define POCKETS_COUNT 5
#define REPEL_LURE_MASK (1 << 15)
#define IS_LAST_USED_LURE(var) (var & REPEL_LURE_MASK)

View File

@ -57,6 +57,7 @@ enum {
BALL_THROW_UNABLE_DISABLED_FLAG,
};
bool32 CanThrowBall(void);
bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon);
#endif //GUARD_ITEM_USE_H

View File

@ -3,6 +3,11 @@
#include "main.h"
extern const u8 gNotDoneYetDescription[];
extern const struct CompressedSpriteSheet gSpriteSheet_CategoryIcons;
extern const struct SpritePalette gSpritePal_CategoryIcons;
extern const struct SpriteTemplate gSpriteTemplate_CategoryIcons;
void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16);
u8 GetMoveSlotToReplace(void);
void SummaryScreen_SetUnknownTaskId(u8 a0);

View File

@ -220,12 +220,14 @@ extern const u8 gText_WhatWillPlayerThrow[];
// battle_controller_player
extern const u8 gText_BattleSwitchWhich[];
extern const u8 gText_BattleSwitchWhich5[];
extern const u8 gText_MoveInterfaceDynamicColors[];
extern const u8 gText_MoveInterfacePP[];
extern const u8 gText_MoveInterfaceType[];
extern const u8 gText_LinkStandby[];
extern const u8 gText_BattleMenu[];
extern const u8 gText_WhatWillPkmnDo[];
extern const u8 gText_NewLine[];
// battle_controller_oak_old_man
extern const u8 gText_ForPetesSake[];

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"
@ -356,6 +358,15 @@ static const struct WindowTemplate sStandardBattleWindowTemplates[] = {
.paletteNum = 7,
.baseBlock = 0x090
},
[B_WIN_MOVE_DESCRIPTION] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 47,
.width = 18,
.height = 6,
.paletteNum = 5,
.baseBlock = 0x0350,
},
DUMMY_WIN_TEMPLATE
};
@ -464,7 +475,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 +873,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

@ -6,6 +6,7 @@
#include "item_menu.h"
#include "link.h"
#include "m4a.h"
#include "new_menu_helpers.h"
#include "party_menu.h"
#include "pokeball.h"
#include "strings.h"
@ -20,10 +21,12 @@
#include "battle_script_commands.h"
#include "battle_z_move.h"
#include "battle_gimmick.h"
#include "pokemon_summary_screen.h"
#include "recorded_battle.h"
#include "reshow_battle_screen.h"
#include "test_runner.h"
#include "constants/battle_anim.h"
#include "constants/battle_move_effects.h"
#include "constants/battle_partner.h"
#include "constants/items.h"
#include "constants/moves.h"
@ -68,6 +71,7 @@ static void MoveSelectionDisplayPpNumber(u32 battler);
static void MoveSelectionDisplayPpString(void);
static void MoveSelectionDisplayMoveType(u32 battler);
static void MoveSelectionDisplayMoveNames(u32 battler);
static void MoveSelectionDisplayMoveDescription(u32 battler);
static void HandleMoveSwitching(u32 battler);
static void WaitForMonSelection(u32 battler);
static void CompleteWhenChoseItem(u32 battler);
@ -185,12 +189,115 @@ static void CompleteOnBattlerSpritePosX_0(u32 battler)
PlayerBufferExecCompleted(battler);
}
static u16 GetPrevBall(u16 ballId)
{
u16 ballPrev;
s32 i, j;
SortAndCompactBagPocket(&gBagPockets[BALLS_POCKET]);
for (i = 0; i < gBagPockets[BALLS_POCKET].capacity; i++)
{
if (ballId == gBagPockets[BALLS_POCKET].itemSlots[i].itemId)
{
if (i <= 0)
{
for (j = gBagPockets[BALLS_POCKET].capacity - 1; j >= 0; j--)
{
ballPrev = gBagPockets[BALLS_POCKET].itemSlots[j].itemId;
if (ballPrev != ITEM_NONE)
return ballPrev;
}
}
i--;
break;
}
}
return gBagPockets[BALLS_POCKET].itemSlots[i].itemId;
}
static u32 GetNextBall(u32 ballId)
{
u32 ballNext = ITEM_NONE;
s32 i;
SortAndCompactBagPocket(&gBagPockets[BALLS_POCKET]);
for (i = 1; i < gBagPockets[BALLS_POCKET].capacity; i++)
{
if (ballId == gBagPockets[BALLS_POCKET].itemSlots[i-1].itemId)
{
ballNext = gBagPockets[BALLS_POCKET].itemSlots[i].itemId;
break;
}
}
if (ballNext == ITEM_NONE)
return gBagPockets[BALLS_POCKET].itemSlots[0].itemId; // Zeroth slot
else
return ballNext;
}
static void HandleInputChooseAction(u32 battler)
{
u16 itemId = gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8);
DoBounceEffect(battler, BOUNCE_HEALTHBOX, 7, 1);
DoBounceEffect(battler, BOUNCE_MON, 7, 1);
if (B_LAST_USED_BALL == TRUE && B_LAST_USED_BALL_CYCLE == TRUE)
{
if (!gLastUsedBallMenuPresent)
{
gBattleStruct->ackBallUseBtn = FALSE;
}
else if (JOY_NEW(B_LAST_USED_BALL_BUTTON))
{
gBattleStruct->ackBallUseBtn = TRUE;
gBattleStruct->ballSwapped = FALSE;
ArrowsChangeColorLastBallCycle(TRUE);
}
if (gBattleStruct->ackBallUseBtn)
{
if (JOY_HELD(B_LAST_USED_BALL_BUTTON) && (JOY_NEW(DPAD_DOWN) || JOY_NEW(DPAD_RIGHT)))
{
bool32 sameBall = FALSE;
u32 nextBall = GetNextBall(gBallToDisplay);
gBattleStruct->ballSwapped = TRUE;
if (gBallToDisplay == nextBall)
sameBall = TRUE;
else
gBallToDisplay = nextBall;
SwapBallToDisplay(sameBall);
PlaySE(SE_SELECT);
}
else if (JOY_HELD(B_LAST_USED_BALL_BUTTON) && (JOY_NEW(DPAD_UP) || JOY_NEW(DPAD_LEFT)))
{
bool32 sameBall = FALSE;
u32 prevBall = GetPrevBall(gBallToDisplay);
gBattleStruct->ballSwapped = TRUE;
if (gBallToDisplay == prevBall)
sameBall = TRUE;
else
gBallToDisplay = prevBall;
SwapBallToDisplay(sameBall);
PlaySE(SE_SELECT);
}
else if (JOY_NEW(B_BUTTON) || (!JOY_HELD(B_LAST_USED_BALL_BUTTON) && gBattleStruct->ballSwapped))
{
gBattleStruct->ackBallUseBtn = FALSE;
gBattleStruct->ballSwapped = FALSE;
ArrowsChangeColorLastBallCycle(FALSE);
}
else if (!JOY_HELD(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall())
{
gBattleStruct->ackBallUseBtn = FALSE;
PlaySE(SE_SELECT);
ArrowsChangeColorLastBallCycle(FALSE);
TryHideLastUsedBall();
BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_THROW_BALL, 0);
PlayerBufferExecCompleted(battler);
}
return;
}
}
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
@ -268,18 +375,34 @@ 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))
{
SwapHpBarsWithHpText();
}
#if DEBUG_BATTLE_MENU == TRUE
else if (JOY_NEW(SELECT_BUTTON))
else if (DEBUG_BATTLE_MENU == TRUE && JOY_NEW(SELECT_BUTTON))
{
BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_DEBUG, 0);
PlayerBufferExecCompleted(battler);
}
#endif
else if (B_LAST_USED_BALL == TRUE && B_LAST_USED_BALL_CYCLE == FALSE
&& JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall())
{
PlaySE(SE_SELECT);
TryHideLastUsedBall();
BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_THROW_BALL, 0);
PlayerBufferExecCompleted(battler);
}
}
static void HandleInputChooseTarget(u32 battler)
@ -647,8 +770,8 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
@ -663,8 +786,8 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
@ -678,8 +801,8 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
@ -694,12 +817,12 @@ void HandleInputChooseMove(u32 battler)
MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
// if (gBattleStruct->descriptionSubmenu)
// MoveSelectionDisplayMoveDescription(battler);
if (gBattleStruct->descriptionSubmenu)
MoveSelectionDisplayMoveDescription(battler);
TryChangeZTrigger(battler, gMoveSelectionCursor[battler]);
}
}
else if (JOY_NEW(SELECT_BUTTON) && !gBattleStruct->zmove.viewing)
else if (JOY_NEW(SELECT_BUTTON) && !gBattleStruct->zmove.viewing && !gBattleStruct->descriptionSubmenu)
{
if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK))
{
@ -715,6 +838,30 @@ void HandleInputChooseMove(u32 battler)
gBattlerControllerFuncs[battler] = HandleMoveSwitching;
}
}
else if (gBattleStruct->descriptionSubmenu)
{
if (JOY_NEW(B_MOVE_DESCRIPTION_BUTTON) || JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{
gBattleStruct->descriptionSubmenu = FALSE;
if (gCategoryIconSpriteId != 0xFF)
{
DestroySprite(&gSprites[gCategoryIconSpriteId]);
gCategoryIconSpriteId = 0xFF;
}
FillWindowPixelBuffer(B_WIN_MOVE_DESCRIPTION, PIXEL_FILL(0));
ClearStdWindowAndFrame(B_WIN_MOVE_DESCRIPTION, FALSE);
CopyWindowToVram(B_WIN_MOVE_DESCRIPTION, COPYWIN_GFX);
PlaySE(SE_SELECT);
MoveSelectionDisplayPpNumber(battler);
MoveSelectionDisplayMoveType(battler);
}
}
else if (JOY_NEW(B_MOVE_DESCRIPTION_BUTTON) && B_MOVE_DESCRIPTION_BUTTON != B_LAST_USED_BALL_BUTTON)
{
gBattleStruct->descriptionSubmenu = TRUE;
MoveSelectionDisplayMoveDescription(battler);
}
else if (JOY_NEW(START_BUTTON))
{
if (gBattleStruct->gimmick.usableGimmick[battler] != GIMMICK_NONE)
@ -1546,6 +1693,54 @@ static void MoveSelectionDisplayMoveType(u32 battler)
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE);
}
static void MoveSelectionDisplayMoveDescription(u32 battler)
{
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleResources->bufferA[battler][4]);
u16 move = moveInfo->moves[gMoveSelectionCursor[battler]];
u16 pwr = gMovesInfo[move].power;
u16 acc = gMovesInfo[move].accuracy;
u8 cat = gMovesInfo[move].category;
u8 pwr_num[3], acc_num[3];
u8 cat_desc[7] = _("CAT: ");
u8 pwr_desc[7] = _("PWR: ");
u8 acc_desc[7] = _("ACC: ");
u8 cat_start[] = _("{CLEAR_TO 0x03}");
u8 pwr_start[] = _("{CLEAR_TO 0x38}");
u8 acc_start[] = _("{CLEAR_TO 0x6D}");
LoadStdWindowFrameGfx();
DrawStdWindowFrame(B_WIN_MOVE_DESCRIPTION, FALSE);
if (pwr < 2)
StringCopy(pwr_num, gText_BattleSwitchWhich5);
else
ConvertIntToDecimalStringN(pwr_num, pwr, STR_CONV_MODE_LEFT_ALIGN, 3);
if (acc < 2)
StringCopy(acc_num, gText_BattleSwitchWhich5);
else
ConvertIntToDecimalStringN(acc_num, acc, STR_CONV_MODE_LEFT_ALIGN, 3);
StringCopy(gDisplayedStringBattle, cat_start);
StringAppend(gDisplayedStringBattle, cat_desc);
StringAppend(gDisplayedStringBattle, pwr_start);
StringAppend(gDisplayedStringBattle, pwr_desc);
StringAppend(gDisplayedStringBattle, pwr_num);
StringAppend(gDisplayedStringBattle, acc_start);
StringAppend(gDisplayedStringBattle, acc_desc);
StringAppend(gDisplayedStringBattle, acc_num);
StringAppend(gDisplayedStringBattle, gText_NewLine);
if (gMovesInfo[move].effect == EFFECT_PLACEHOLDER)
StringAppend(gDisplayedStringBattle, gNotDoneYetDescription);
else
StringAppend(gDisplayedStringBattle, gMovesInfo[move].description);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_DESCRIPTION);
if (gCategoryIconSpriteId == 0xFF)
gCategoryIconSpriteId = CreateSprite(&gSpriteTemplate_CategoryIcons, 38, 64, 1);
StartSpriteAnim(&gSprites[gCategoryIconSpriteId], cat);
CopyWindowToVram(B_WIN_MOVE_DESCRIPTION, COPYWIN_FULL);
}
void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1)
{
u16 src[2];
@ -1765,8 +1960,11 @@ static void PlayerHandleChooseAction(u32 battler)
gBattlerControllerFuncs[battler] = HandleChooseActionAfterDma3;
BattlePutTextOnWindow(gText_BattleMenu, B_WIN_ACTION_MENU);
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
TryRestoreLastUsedBall();
ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0);
PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, battler, gBattlerPartyIndexes[battler]);
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo);

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

@ -487,6 +487,7 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]);
LoadIndicatorSpritesGfx();
CategoryIcons_LoadSpritesGfx();
}
else if (!IsDoubleBattle())
{

View File

@ -7,6 +7,9 @@
#include "battle_z_move.h"
#include "decompress.h"
#include "graphics.h"
#include "item.h"
#include "item_menu_icons.h"
#include "item_use.h"
#include "menu.h"
#include "pokedex.h"
#include "pokemon_summary_screen.h"
@ -85,6 +88,9 @@ static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 windowWi
static void SpriteCb_AbilityPopUp(struct Sprite *);
static void Task_FreeAbilityPopUpGfx(u8);
static void SpriteCB_LastUsedBall(struct Sprite *);
static void SpriteCB_LastUsedBallWin(struct Sprite *);
static const struct OamData sOamData_Healthbox = {
.shape = SPRITE_SHAPE(64x32),
.size = SPRITE_SIZE(64x32),
@ -544,6 +550,9 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
CreateIndicatorSprite(battlerId);
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
return healthboxSpriteId;
}
@ -2618,3 +2627,349 @@ static void Task_FreeAbilityPopUpGfx(u8 taskId)
DestroyTask(taskId);
}
}
// last used ball
#define LAST_BALL_WINDOW_TAG 0xD721
static const struct OamData sOamData_LastUsedBall =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = (B_LAST_USED_BALL_CYCLE == TRUE ? SPRITE_SHAPE(32x64) : SPRITE_SHAPE(32x32)),
.x = 0,
.matrixNum = 0,
.size = (B_LAST_USED_BALL_CYCLE == TRUE ? SPRITE_SIZE(32x64) : SPRITE_SIZE(32x32)),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow =
{
.tileTag = LAST_BALL_WINDOW_TAG,
.paletteTag = ABILITY_POP_UP_TAG,
.oam = &sOamData_LastUsedBall,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_LastUsedBallWin
};
#if B_LAST_USED_BALL_BUTTON == R_BUTTON && B_LAST_USED_BALL_CYCLE == TRUE
static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r_cycle.4bpp");
#elif B_LAST_USED_BALL_CYCLE == TRUE
static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l_cycle.4bpp");
#elif B_LAST_USED_BALL_BUTTON == R_BUTTON
static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp");
#else
static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l.4bpp");
#endif
static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow =
{
sLastUsedBallWindowGfx, sizeof(sLastUsedBallWindowGfx), LAST_BALL_WINDOW_TAG
};
#define LAST_USED_BALL_X_F 14
#define LAST_USED_BALL_X_0 -14
#define LAST_USED_BALL_Y ((IsDoubleBattle()) ? 78 : 68)
#define LAST_USED_BALL_Y_BNC ((IsDoubleBattle()) ? 76 : 66)
#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 0)
#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 0)
#define LAST_USED_WIN_Y (LAST_USED_BALL_Y - 8)
#define sHide data[0]
#define sTimer data[1]
#define sMoving data[2]
#define sBounce data[3] // 0 = Bounce down; 1 = Bounce up
#define sState data[0]
#define sSameBall data[1]
bool32 CanThrowLastUsedBall(void)
{
if (B_LAST_USED_BALL == FALSE)
return FALSE;
if (!CanThrowBall())
return FALSE;
if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FRONTIER))
return FALSE;
if (!CheckBagHasItem(gBallToDisplay, 1))
return FALSE;
return TRUE;
}
void TryAddLastUsedBallItemSprites(void)
{
if (B_LAST_USED_BALL == FALSE)
return;
if (gLastThrownBall == 0
|| (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1)))
{
// we're out of the last used ball, so just set it to the first ball in the bag
u16 firstBall;
// we have to compact the bag first bc it is typically only compacted when you open it
SortAndCompactBagPocket(&gBagPockets[BALLS_POCKET]);
firstBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId;
if (firstBall > ITEM_NONE)
gBallToDisplay = firstBall;
}
if (!CanThrowLastUsedBall())
return;
// ball
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
{
gBattleStruct->ballSpriteIds[0] = AddItemIconObject(102, 102, gBallToDisplay);
gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_0;
gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y;
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
gLastUsedBallMenuPresent = TRUE;
gSprites[gBattleStruct->ballSpriteIds[0]].callback = SpriteCB_LastUsedBall;
}
// window
LoadSpritePalette(&sSpritePalette_AbilityPopUp);
if (GetSpriteTileStartByTag(LAST_BALL_WINDOW_TAG) == 0xFFFF)
LoadSpriteSheet(&sSpriteSheet_LastUsedBallWindow);
if (gBattleStruct->ballSpriteIds[1] == MAX_SPRITES)
{
gBattleStruct->ballSpriteIds[1] = CreateSprite(&sSpriteTemplate_LastUsedBallWindow,
LAST_BALL_WIN_X_0,
LAST_USED_WIN_Y, 5);
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore
gLastUsedBallMenuPresent = TRUE;
}
if (B_LAST_USED_BALL_CYCLE == TRUE)
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
}
static void DestroyLastUsedBallWinGfx(struct Sprite *sprite)
{
FreeSpriteTilesByTag(LAST_BALL_WINDOW_TAG);
FreeSpritePaletteByTag(ABILITY_POP_UP_TAG);
DestroySprite(sprite);
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
}
static void DestroyLastUsedBallGfx(struct Sprite *sprite)
{
FreeSpriteTilesByTag(102);
FreeSpritePaletteByTag(102);
DestroySprite(sprite);
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
}
static void SpriteCB_LastUsedBallWin(struct Sprite *sprite)
{
if (sprite->sHide)
{
if (sprite->x != LAST_BALL_WIN_X_0)
sprite->x--;
if (sprite->x == LAST_BALL_WIN_X_0)
DestroyLastUsedBallWinGfx(sprite);
}
else
{
if (sprite->x != LAST_BALL_WIN_X_F)
sprite->x++;
}
}
static void SpriteCB_LastUsedBall(struct Sprite *sprite)
{
if (sprite->sHide)
{
if (sprite->y < LAST_USED_BALL_Y) // Used to recover from an incomplete bounce before hiding the window
sprite->y++;
if (sprite->x != LAST_USED_BALL_X_0)
sprite->x--;
if (sprite->x == LAST_USED_BALL_X_0)
DestroyLastUsedBallGfx(sprite);
}
else
{
if (sprite->x != LAST_USED_BALL_X_F)
sprite->x++;
}
}
static void TryHideOrRestoreLastUsedBall(u8 caseId)
{
if (B_LAST_USED_BALL == FALSE)
return;
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
return;
switch (caseId)
{
case 0: // hide
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = TRUE; // hide
if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES)
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = TRUE; // hide
gLastUsedBallMenuPresent = FALSE;
break;
case 1: // restore
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES)
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore
gLastUsedBallMenuPresent = TRUE;
break;
}
if (B_LAST_USED_BALL_CYCLE == TRUE)
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
}
void TryHideLastUsedBall(void)
{
if (B_LAST_USED_BALL == TRUE)
TryHideOrRestoreLastUsedBall(0);
}
void TryRestoreLastUsedBall(void)
{
if (B_LAST_USED_BALL == FALSE)
return;
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
TryHideOrRestoreLastUsedBall(1);
else
TryAddLastUsedBallItemSprites();
}
static void SpriteCB_LastUsedBallBounce(struct Sprite *sprite)
{
if ((sprite->sTimer++ % 4) != 0) // Change the image every 4 frame
return;
if (sprite->sBounce)
{
if (sprite->y > LAST_USED_BALL_Y_BNC)
sprite->y--;
else
sprite->sMoving = FALSE;
}
else
{
if (sprite->y < LAST_USED_BALL_Y)
sprite->y++;
else
sprite->sMoving = FALSE;
}
}
static void Task_BounceBall(u8 taskId)
{
struct Sprite *sprite = &gSprites[gBattleStruct->ballSpriteIds[0]];
struct Task *task = &gTasks[taskId];
switch(task->sState)
{
case 0: // Bounce up
sprite->sBounce = TRUE;
sprite->sMoving = TRUE;
sprite->callback = SpriteCB_LastUsedBallBounce;
if (task->sSameBall)
task->sState = 3;
else
task->sState = 1;
break;
case 1: // Destroy Icon
if (!sprite->sMoving)
{
DestroyLastUsedBallGfx(sprite);
task->sState++;
} // Passthrough
case 2: //Create New Icon
if (!sprite->inUse)
{
gBattleStruct->ballSpriteIds[0] = AddItemIconObject(102, 102, gBallToDisplay);
gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_F;
gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y_BNC;
task->sState++;
} // Fallthrough
case 3: // Bounce Down
if (!sprite->sMoving)
{
sprite->sBounce = FALSE;
sprite->sMoving = TRUE;
sprite->callback = SpriteCB_LastUsedBallBounce; //Show and bounce down
task->sState++;
}
break;
case 4: // Destroy Task
if(!sprite->sMoving)
{
sprite->callback = SpriteCB_LastUsedBall;
DestroyTask(taskId);
}
}
if (!gLastUsedBallMenuPresent)
{
// Used to check if the R button was released before the animation was complete
sprite->callback = SpriteCB_LastUsedBall;
DestroyTask(taskId);
}
}
void SwapBallToDisplay(bool32 sameBall)
{
u8 taskId;
taskId = CreateTask(Task_BounceBall, 10);
gTasks[taskId].sSameBall = sameBall;
}
void ArrowsChangeColorLastBallCycle(bool32 showArrows)
{
#if B_LAST_USED_BALL == TRUE && B_LAST_USED_BALL_CYCLE == TRUE
u16 paletteNum = 16 + gSprites[gBattleStruct->ballSpriteIds[1]].oam.paletteNum;
struct PlttData *defaultPlttArrow;
struct PlttData *defaultPlttOutline;
struct PlttData *pltArrow;
struct PlttData *pltOutline;
if (gBattleStruct->ballSpriteIds[1] == MAX_SPRITES)
return;
paletteNum *= 16;
pltArrow = (struct PlttData *)&gPlttBufferFaded[paletteNum + 9]; // Arrow color is in idx 9
pltOutline = (struct PlttData *)&gPlttBufferFaded[paletteNum + 8]; // Arrow outline is in idx 8
if (!showArrows) //Make invisible
{
defaultPlttArrow = (struct PlttData *)&gPlttBufferFaded[paletteNum + 13]; // Background color is idx 13
pltArrow->r = defaultPlttArrow->r;
pltArrow->g = defaultPlttArrow->g;
pltArrow->b = defaultPlttArrow->b;
pltOutline->r = defaultPlttArrow->r;
pltOutline->g = defaultPlttArrow->g;
pltOutline->b = defaultPlttArrow->b;
}
else // Make gray
{
defaultPlttArrow = (struct PlttData *)&gPlttBufferFaded[paletteNum + 11]; // Grey color is idx 11
defaultPlttOutline = (struct PlttData *)&gPlttBufferFaded[paletteNum + 10]; //Light grey color for outline is idx 10
pltArrow->r = defaultPlttArrow->r;
pltArrow->g = defaultPlttArrow->g;
pltArrow->b = defaultPlttArrow->b;
pltOutline->r = defaultPlttOutline->r;
pltOutline->g = defaultPlttOutline->g;
pltOutline->b = defaultPlttOutline->b;
}
#endif
}
void CategoryIcons_LoadSpritesGfx(void)
{
LoadCompressedSpriteSheet(&gSpriteSheet_CategoryIcons);
LoadSpritePalette(&gSpritePal_CategoryIcons);
}

View File

@ -199,6 +199,7 @@ EWRAM_DATA bool8 gHasFetchedBall = FALSE;
EWRAM_DATA u8 gLastUsedBall = 0;
EWRAM_DATA u16 gLastThrownBall = 0;
EWRAM_DATA u16 gBallToDisplay = 0;
EWRAM_DATA bool8 gLastUsedBallMenuPresent = FALSE;
EWRAM_DATA struct QueuedStatBoost gQueuedStatBoosts[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u8 sTriedEvolving = 0;
EWRAM_DATA u8 gCategoryIconSpriteId = 0;
@ -263,14 +264,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 +284,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 +300,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 +331,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 +348,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 +363,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),
@ -388,6 +389,7 @@ static void (*const sTurnActionsFuncsTable[])(void) =
[B_ACTION_TRY_FINISH] = HandleAction_TryFinish,
[B_ACTION_FINISHED] = HandleAction_ActionFinished,
[B_ACTION_NOTHING_FAINTED] = HandleAction_NothingIsFainted,
[B_ACTION_THROW_BALL] = HandleAction_ThrowBall,
};
static void (*const sEndTurnFuncsTable[])(void) =
@ -3506,6 +3508,10 @@ static void HandleTurnActionSelectionState(void)
return;
}
break;
case B_ACTION_THROW_BALL:
gBattleStruct->throwingPokeBall = TRUE;
gBattleCommunication[battler]++;
break;
case B_ACTION_CANCEL_PARTNER:
gBattleCommunication[battler] = STATE_WAIT_SET_BEFORE_ACTION;
gBattleCommunication[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))] = STATE_BEFORE_ACTION_CHOSEN;
@ -4113,7 +4119,8 @@ static void SetActionsAndBattlersTurnOrder(void)
for (battler = 0; battler < gBattlersCount; battler++)
{
if (gChosenActionByBattler[battler] == B_ACTION_USE_ITEM
|| gChosenActionByBattler[battler] == B_ACTION_SWITCH)
|| gChosenActionByBattler[battler] == B_ACTION_SWITCH
|| gChosenActionByBattler[battler] == B_ACTION_THROW_BALL)
{
gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[battler];
gBattlerByTurnOrder[turnOrderId] = battler;
@ -4123,7 +4130,8 @@ static void SetActionsAndBattlersTurnOrder(void)
for (battler = 0; battler < gBattlersCount; battler++)
{
if (gChosenActionByBattler[battler] != B_ACTION_USE_ITEM
&& gChosenActionByBattler[battler] != B_ACTION_SWITCH)
&& gChosenActionByBattler[battler] != B_ACTION_SWITCH
&& gChosenActionByBattler[battler] != B_ACTION_THROW_BALL)
{
gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[battler];
gBattlerByTurnOrder[turnOrderId] = battler;
@ -4142,7 +4150,9 @@ static void SetActionsAndBattlersTurnOrder(void)
if (gActionsByTurnOrder[i] != B_ACTION_USE_ITEM
&& gActionsByTurnOrder[j] != B_ACTION_USE_ITEM
&& gActionsByTurnOrder[i] != B_ACTION_SWITCH
&& gActionsByTurnOrder[j] != B_ACTION_SWITCH)
&& gActionsByTurnOrder[j] != B_ACTION_SWITCH
&& gActionsByTurnOrder[i] != B_ACTION_THROW_BALL
&& gActionsByTurnOrder[j] != B_ACTION_THROW_BALL)
{
if (GetWhichBattlerFaster(battler1, battler2, FALSE) == -1)
SwapTurnOrder(i, j);

View File

@ -3767,7 +3767,19 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = {
.fgColor = 2,
.bgColor = 1,
.shadowColor = 3,
}
},
[B_WIN_MOVE_DESCRIPTION] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
},
};
static const u8 sNpcTextColorToFont[] =

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

@ -560,16 +560,16 @@ void HandleAction_SafariZoneBallThrow(void)
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
}
// void HandleAction_ThrowBall(void)
// {
// gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
// gBattle_BG0_X = 0;
// gBattle_BG0_Y = 0;
// gLastUsedItem = gBallToDisplay;
// RemoveBagItem(gLastUsedItem, 1);
// gBattlescriptCurrInstr = BattleScript_BallThrow;
// gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
// }
void HandleAction_ThrowBall(void)
{
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gLastUsedItem = gBallToDisplay;
RemoveBagItem(gLastUsedItem, 1);
gBattlescriptCurrInstr = BattleScript_BallThrow;
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
}
void HandleAction_ThrowBait(void)
{

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

@ -18,7 +18,6 @@
EWRAM_DATA struct BagPocket gBagPockets[NUM_BAG_POCKETS] = {};
void SortAndCompactBagPocket(struct BagPocket * pocket);
static const u8 *ItemId_GetPluralName(u16);
static bool32 DoesItemHavePluralName(u16);

View File

@ -936,6 +936,11 @@ static u32 GetBallThrowableState(void)
return BALL_THROW_ABLE;
}
bool32 CanThrowBall(void)
{
return (GetBallThrowableState() == BALL_THROW_ABLE);
}
static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two Pokémon out there!\p");
static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p");
static const u8 sText_CantThrowPokeBall_Disabled[] = _("POKé BALLS cannot be used\nright now!\p");

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

@ -36,6 +36,7 @@
#include "battle_interface.h"
#include "mon_markings.h"
#include "pokemon_storage_system.h"
#include "constants/battle_move_effects.h"
#include "constants/sound.h"
// needs conflicting header to match (curIndex is s8 in the function, but has to be defined as u8 here)
@ -3158,13 +3159,21 @@ static void PokeSum_PrintSelectedMoveStats(void)
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
sMonSummaryScreen->summary.moveAccuracyStrBufs[sMoveSelectionCursorPos]);
AddTextPrinterParameterized4(sMonSummaryScreen->windowIds[POKESUM_WIN_TRAINER_MEMO], FONT_NORMAL,
7, 42,
0, 0,
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
gMovesInfo[sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]].description);
if (gMovesInfo[sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]].effect != EFFECT_PLACEHOLDER)
AddTextPrinterParameterized4(sMonSummaryScreen->windowIds[POKESUM_WIN_TRAINER_MEMO], FONT_NORMAL,
7, 42,
0, 0,
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
gMovesInfo[sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]].description);
else
AddTextPrinterParameterized4(sMonSummaryScreen->windowIds[POKESUM_WIN_TRAINER_MEMO], FONT_NORMAL,
7, 42,
0, 0,
sLevelNickTextColors[0], TEXT_SKIP_DRAW,
gNotDoneYetDescription);
ShowCategoryIcon(GetBattleMoveCategory(sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]));
if (B_SHOW_CATEGORY_ICON == TRUE)
ShowCategoryIcon(GetBattleMoveCategory(sMonSummaryScreen->moveIds[sMoveSelectionCursorPos]));
}
}