summaryrefslogtreecommitdiff
path: root/src/battle_script_commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle_script_commands.c')
-rw-r--r--src/battle_script_commands.c70
1 files changed, 33 insertions, 37 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index d399cddbb..2490d6e13 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -46,22 +46,18 @@
#include "battle_arena.h"
#include "battle_pike.h"
#include "battle_pyramid.h"
+#include "field_specials.h"
+#include "pokemon_summary_screen.h"
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern const u8* const gBattleScriptsForMoveEffects[];
// functions
-extern void ShowSelectMovePokemonSummaryScreen(struct Pokemon* party, u8 monPartyId, u8 monCount, void (*callback)(void), u16 move); // pokemon summary screen
-extern u8 sub_81C1B94(void); // pokemon summary screen
extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokenav.s
extern void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s
extern void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s
-extern u8* GetMonNickname(struct Pokemon* mon, u8* dst); // party_menu
-extern void sub_81B8E80(u8 battlerId, u8, u8); // party menu
-extern bool8 IsMultiBattle(void); // ?
extern u8 sub_813B21C(void);
-extern u16 get_unknown_box_id(void);
#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED))
@@ -4603,12 +4599,12 @@ static void atk49_moveend(void)
*choicedMoveAtk = gChosenMove;
LOOP:
{
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerAttacker].moves[i] == *choicedMoveAtk)
break;
}
- if (i == 4)
+ if (i == MAX_MON_MOVES)
*choicedMoveAtk = 0;
gBattleScripting.atk49_state++;
@@ -5961,7 +5957,7 @@ static void atk5E(void)
{
s32 i;
struct BattlePokemon *bufferPoke = (struct BattlePokemon*) &gBattleBufferB[gActiveBattler][4];
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
gBattleMons[gActiveBattler].moves[i] = bufferPoke->moves[i];
gBattleMons[gActiveBattler].pp[i] = bufferPoke->pp[i];
@@ -6241,7 +6237,7 @@ static void atk6C_drawlvlupbox(void)
{
case 1:
gBattle_BG2_Y = 0x60;
- SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, 0);
+ SetBgAttribute(2, BG_ATTR_PRIORITY, 0);
ShowBg(2);
sub_804F17C();
gBattleScripting.atk6C_state = 2;
@@ -6253,8 +6249,8 @@ static void atk6C_drawlvlupbox(void)
case 3:
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0x100;
- SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 1);
- SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 0);
+ SetBgAttribute(0, BG_ATTR_PRIORITY, 1);
+ SetBgAttribute(1, BG_ATTR_PRIORITY, 0);
ShowBg(0);
ShowBg(1);
HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80);
@@ -6300,7 +6296,7 @@ static void atk6C_drawlvlupbox(void)
ClearWindowTilemap(13);
CopyWindowToVram(13, 1);
- SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, 2);
+ SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
ShowBg(2);
gBattleScripting.atk6C_state = 10;
@@ -6309,8 +6305,8 @@ static void atk6C_drawlvlupbox(void)
case 10:
if (!IsDma3ManagerBusyWithBgCopy())
{
- SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 0);
- SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 1);
+ SetBgAttribute(0, BG_ATTR_PRIORITY, 0);
+ SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
ShowBg(0);
ShowBg(1);
gBattlescriptCurrInstr++;
@@ -6656,12 +6652,12 @@ static void atk76_various(void)
choicedMove = &gBattleStruct->choicedMove[gActiveBattler];
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gActiveBattler].moves[i] == *choicedMove)
break;
}
- if (i == 4)
+ if (i == MAX_MON_MOVES)
*choicedMove = 0;
}
break;
@@ -7637,7 +7633,7 @@ static void atk90_tryconversiontypechange(void) // randomly changes user's type
u8 moveChecked;
u8 moveType;
- while (validMoves < 4)
+ while (validMoves < MAX_MON_MOVES)
{
if (gBattleMons[gBattlerAttacker].moves[validMoves] == 0)
break;
@@ -8035,7 +8031,7 @@ static void atk9B_transformdataexecution(void)
for (i = 0; i < offsetof(struct BattlePokemon, pp); i++)
battleMonAttacker[i] = battleMonTarget[i];
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMoves[gBattleMons[gBattlerAttacker].moves[i]].pp < 5)
gBattleMons[gBattlerAttacker].pp[i] = gBattleMoves[gBattleMons[gBattlerAttacker].moves[i]].pp;
@@ -8101,13 +8097,13 @@ static void atk9D_mimicattackcopy(void)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerAttacker].moves[i] == gLastMoves[gBattlerTarget])
break;
}
- if (i == 4)
+ if (i == MAX_MON_MOVES)
{
gBattleMons[gBattlerAttacker].moves[gCurrMovePos] = gLastMoves[gBattlerTarget];
if (gBattleMoves[gLastMoves[gBattlerTarget]].pp < 5)
@@ -8138,7 +8134,7 @@ static void atk9E_metronome(void)
if (gCurrentMove >= MOVES_COUNT)
continue;
- for (i = 0; i < 4; i++); // ?
+ for (i = 0; i < MAX_MON_MOVES; i++); // ?
i = -1;
while (1)
@@ -8229,13 +8225,13 @@ static void atkA3_disablelastusedattack(void)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerTarget].moves[i] == gLastMoves[gBattlerTarget])
break;
}
if (gDisableStructs[gBattlerTarget].disabledMove == 0
- && i != 4 && gBattleMons[gBattlerTarget].pp[i] != 0)
+ && i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] != 0)
{
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i])
@@ -8254,7 +8250,7 @@ static void atkA4_trysetencore(void)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerTarget].moves[i] == gLastMoves[gBattlerTarget])
break;
@@ -8386,7 +8382,7 @@ static void atkA8_copymovepermanently(void) // sketch
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerAttacker].moves[i] == MOVE_SKETCH)
continue;
@@ -8394,7 +8390,7 @@ static void atkA8_copymovepermanently(void) // sketch
break;
}
- if (i != 4)
+ if (i != MAX_MON_MOVES)
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}
@@ -8406,7 +8402,7 @@ static void atkA8_copymovepermanently(void) // sketch
gBattleMons[gBattlerAttacker].pp[gCurrMovePos] = gBattleMoves[gLastPrintedMoves[gBattlerTarget]].pp;
gActiveBattler = gBattlerAttacker;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
movePpData.moves[i] = gBattleMons[gBattlerAttacker].moves[i];
movePpData.pp[i] = gBattleMons[gBattlerAttacker].pp[i];
@@ -8474,7 +8470,7 @@ static void atkA9_trychoosesleeptalkmove(void)
s32 i;
u8 unusableMovesBits = 0;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (IsInvalidForSleepTalkOrAssist(gBattleMons[gBattlerAttacker].moves[i])
|| gBattleMons[gBattlerAttacker].moves[i] == MOVE_FOCUS_PUNCH
@@ -8554,13 +8550,13 @@ static void atkAD_tryspiteppreduce(void)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gLastMoves[gBattlerTarget] == gBattleMons[gBattlerTarget].moves[i])
break;
}
- if (i != 4 && gBattleMons[gBattlerTarget].pp[i] > 1)
+ if (i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] > 1)
{
s32 ppToDeduct = (Random() & 3) + 2;
if (gBattleMons[gBattlerTarget].pp[i] < ppToDeduct)
@@ -9630,19 +9626,19 @@ static void atkDB_tryimprision(void)
if (sideAttacker != GetBattlerSide(battlerId))
{
s32 attackerMoveId;
- for (attackerMoveId = 0; attackerMoveId < 4; attackerMoveId++)
+ for (attackerMoveId = 0; attackerMoveId < MAX_MON_MOVES; attackerMoveId++)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerAttacker].moves[attackerMoveId] == gBattleMons[battlerId].moves[i]
&& gBattleMons[gBattlerAttacker].moves[attackerMoveId] != MOVE_NONE)
break;
}
- if (i != 4)
+ if (i != MAX_MON_MOVES)
break;
}
- if (attackerMoveId != 4)
+ if (attackerMoveId != MAX_MON_MOVES)
{
gStatuses3[gBattlerAttacker] |= STATUS3_IMPRISONED_OTHERS;
gBattlescriptCurrInstr += 5;
@@ -9706,7 +9702,7 @@ static void atkDE_asistattackselect(void)
if (GetMonData(&party[monId], MON_DATA_SPECIES2) == SPECIES_EGG)
continue;
- for (moveId = 0; moveId < 4; moveId++)
+ for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
{
s32 i = 0;
u16 move = GetMonData(&party[monId], MON_DATA_MOVE1 + moveId);
@@ -10142,7 +10138,7 @@ static void atkEF_handleballthrow(void)
ballMultiplier = 10;
break;
case ITEM_DIVE_BALL:
- if (Overworld_GetMapTypeOfSaveblockLocation() == MAP_TYPE_UNDERWATER)
+ if (GetCurrentMapType() == MAP_TYPE_UNDERWATER)
ballMultiplier = 35;
else
ballMultiplier = 10;