document frontier related

This commit is contained in:
DizzyEggg 2018-07-01 11:15:42 +02:00
parent 2d0be91217
commit d2e47323fe
30 changed files with 402 additions and 376 deletions

View File

@ -19871,8 +19871,8 @@ _081A4C84:
.pool
thumb_func_end sub_81A4C30
thumb_func_start sub_81A4CB0
sub_81A4CB0: @ 81A4CB0
thumb_func_start GetFrontierBrainTrainerPicIndex
GetFrontierBrainTrainerPicIndex: @ 81A4CB0
push {lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
@ -19905,7 +19905,7 @@ _081A4CDA:
pop {r1}
bx r1
.pool
thumb_func_end sub_81A4CB0
thumb_func_end GetFrontierBrainTrainerPicIndex
thumb_func_start GetFrontierBrainTrainerClass
GetFrontierBrainTrainerClass: @ 81A4D00

View File

@ -1353,7 +1353,7 @@ _08162AD0:
ldr r0, =0x000003fe
cmp r4, r0
bne _08162AE4
bl sub_81A4CB0
bl GetFrontierBrainTrainerPicIndex
lsls r0, 24
lsrs r0, 24
b _08162BCA

View File

@ -3382,11 +3382,11 @@ AI_Safari_Flee:
flee
AI_FirstBattle:
if_hp_equal AI_TARGET, 20, BattleAIScript_82DE34D
if_hp_less_than AI_TARGET, 20, BattleAIScript_82DE34D
if_hp_equal AI_TARGET, 20, AI_FirstBattle_Flee
if_hp_less_than AI_TARGET, 20, AI_FirstBattle_Flee
end
BattleAIScript_82DE34D:
AI_FirstBattle_Flee:
flee
AI_Ret:

View File

@ -4862,7 +4862,3 @@ gUnknown_0831ACC4:: @ 831ACC4
.align 2
gUnknown_0831ACDC:: @ 831ACDC
.4byte gUnknown_0831ACC4
.align 2
gUnknown_0831ACE0:: @ 831ACE0
.byte 0xe0, 0xf0, 0xf0, 0xe0, 0xe0, 0x00, 0x00, 0x00

View File

@ -16,12 +16,6 @@
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
#define TRAINER_OPPONENT_3FE 0x3FE
#define TRAINER_OPPONENT_C00 0xC00
#define TRAINER_OPPONENT_800 0x800
#define STEVEN_PARTNER_ID 0xC03
#define SECRET_BASE_OPPONENT 0x400
// Battle Actions
// These determine what each battler will do in a turn
#define B_ACTION_USE_MOVE 0
@ -429,7 +423,7 @@ struct BattleTv_Mon
struct BattleTv
{
struct BattleTv_Mon mon[2][6]; // [side][partyId]
struct BattleTv_Mon mon[2][PARTY_SIZE]; // [side][partyId]
struct BattleTv_Position pos[2][2]; // [side][flank]
struct BattleTv_Side side[2]; // [side]
};
@ -479,10 +473,10 @@ struct BattleStruct
u8 runTries;
u8 caughtMonNick[11];
u8 field_78;
u8 field_79;
u8 field_7A;
u8 field_7B;
u8 field_7C;
u8 safariGoNearCounter;
u8 safariPkblThrowCounter;
u8 safariEscapeFactor;
u8 safariCatchFactor;
u8 field_7D;
u8 field_7E;
u8 formToChangeInto;
@ -526,7 +520,7 @@ struct BattleStruct
u8 AI_itemFlags[2];
u16 choicedMove[MAX_BATTLERS_COUNT];
u16 changedItems[MAX_BATTLERS_COUNT];
u8 intimidateBank;
u8 intimidateBattler;
u8 switchInItemsCounter;
u8 field_DA;
u8 turnSideTracker;
@ -611,18 +605,6 @@ struct BattleScripting
u8 multiplayerId;
};
enum
{
BACK_PIC_BRENDAN,
BACK_PIC_MAY,
BACK_PIC_RED,
BACK_PIC_LEAF,
BACK_PIC_RS_BRENDAN,
BACK_PIC_RS_MAY,
BACK_PIC_WALLY,
BACK_PIC_STEVEN
};
// rom_80A5C6C
u8 GetBattlerSide(u8 battler);
u8 GetBattlerPosition(u8 bank);

View File

@ -21,11 +21,11 @@
#define ABILITYEFFECT_INTIMIDATE2 0xA
#define ABILITYEFFECT_TRACE 0xB
#define ABILITYEFFECT_CHECK_OTHER_SIDE 0xC
#define ABILITYEFFECT_CHECK_BANK_SIDE 0xD
#define ABILITYEFFECT_CHECK_BATTLER_SIDE 0xD
#define ABILITYEFFECT_FIELD_SPORT 0xE
#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK 0xF
#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER 0xF
#define ABILITYEFFECT_COUNT_OTHER_SIDE 0x10
#define ABILITYEFFECT_COUNT_BANK_SIDE 0x11
#define ABILITYEFFECT_COUNT_BATTLER_SIDE 0x11
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
@ -39,15 +39,6 @@
#define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK)))
#define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK)))
#define BS_GET_TARGET 0
#define BS_GET_ATTACKER 1
#define BS_GET_EFFECT_BANK 2
#define BS_GET_SCRIPTING_BANK 10
#define BS_GET_PLAYER1 11
#define BS_GET_OPPONENT1 12
#define BS_GET_PLAYER2 13
#define BS_GET_OPPONENT2 14
u8 GetBattlerForBattleScript(u8 caseId);
void PressurePPLose(u8 bankDef, u8 bankAtk, u16 move);
void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
@ -74,7 +65,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void);
bool8 HandleFaintedMonActions(void);
void TryClearRageStatuses(void);
u8 AtkCanceller_UnableToUseMove(void);
bool8 sub_80423F4(u8 battlerId, u8 r1, u8 r2);
bool8 HasNoMonsToSwitch(u8 battlerId, u8 r1, u8 r2);
u8 CastformDataTypeChange(u8 battlerId);
u8 AbilityBattleEffects(u8 caseID, u8 battlerId, u8 ability, u8 special, u16 moveArg);
void BattleScriptExecute(const u8* BS_ptr);

View File

@ -80,4 +80,6 @@
#define ABILITY_CACOPHONY 76
#define ABILITY_AIR_LOCK 77
#define ABILITIES_COUNT 78
#endif // GUARD_CONSTANTS_ABILITIES_H

View File

@ -130,7 +130,7 @@
#define STATUS2_TORMENT 0x80000000
// Seems like per-battler statuses. Not quite sure how to categorize these
#define STATUS3_LEECHSEED_BANK 0x3
#define STATUS3_LEECHSEED_BATTLER 0x3
#define STATUS3_LEECHSEED 0x4
#define STATUS3_ALWAYS_HITS 0x18 // two bits
#define STATUS3_PERISH_SONG 0x20

View File

@ -0,0 +1,13 @@
#ifndef GUARD_CONSTANTS_BATTLE_FRONTIER_H
#define GUARD_CONSTANTS_BATTLE_FRONTIER_H
// Battle Frontier facility ids.
#define FRONTIER_FACILITY_TOWER 0
#define FRONTIER_FACILITY_DOME 1
#define FRONTIER_FACILITY_PALACE 2
#define FRONTIER_FACILITY_ARENA 3
#define FRONTIER_FACILITY_FACTORY 4
#define FRONTIER_FACILITY_PIKE 5
#define FRONTIER_FACILITY_PYRAMID 6
#endif // GUARD_CONSTANTS_BATTLE_FRONTIER_H

View File

@ -37,7 +37,7 @@
#define BS_ATTACKER 1
#define BS_EFFECT_BATTLER 2
#define BS_FAINTED 3
#define BS_BANK_0 7
#define BS_BATTLER_0 7
#define BS_ATTACKER_WITH_PARTNER 4 // for atk98_status_icon_update
#define BS_ATTACKER_SIDE 8 // for atk1E_jumpifability
#define BS_NOT_ATTACKER_SIDE 9 // for atk1E_jumpifability

View File

@ -357,6 +357,6 @@
#define MOVE_DOOM_DESIRE 353
#define MOVE_PSYCHO_BOOST 354
#define LAST_MOVE_INDEX MOVE_PSYCHO_BOOST
#define MOVES_COUNT 355
#endif // GUARD_CONSTANTS_MOVES_H

View File

@ -857,7 +857,14 @@
#define TRAINER_BRENDAN_16 853
#define TRAINER_MAY_16 854
#define NO_OF_TRAINERS 854
#define TRAINERS_COUNT 855
// Special Trainer Ids.
#define TRAINER_FRONTIER_BRAIN 1022
#define TRAINER_SECRET_BASE 1024
#define TRAINER_LINK_OPPONENT 0x800
#define TRAINER_OPPONENT_C00 0xC00
#define TRAINER_STEVEN_PARTNER 0xC03
#define TRAINER_PIC_HIKER 0
#define TRAINER_PIC_AQUA_GRUNT_M 1
@ -953,6 +960,15 @@
#define TRAINER_PIC_RUBY_SAPPHIRE_BRENDAN 91
#define TRAINER_PIC_RUBY_SAPPHIRE_MAY 92
#define TRAINER_BACK_PIC_BRENDAN 0
#define TRAINER_BACK_PIC_MAY 1
#define TRAINER_BACK_PIC_RED 2
#define TRAINER_BACK_PIC_LEAF 3
#define TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN 4
#define TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY 5
#define TRAINER_BACK_PIC_WALLY 6
#define TRAINER_BACK_PIC_STEVEN 7
#define FACILITY_CLASS_HIKER 0x0
#define FACILITY_CLASS_TEAM_AQUA_1 0x1
#define FACILITY_CLASS_PKMN_BREEDER_1 0x2

View File

@ -1,7 +1,7 @@
#ifndef GUARD_DATA_BATTLE_MOVES
#define GUARD_DATA_BATTLE_MOVES
const struct BattleMove gBattleMoves[LAST_MOVE_INDEX + 1] =
const struct BattleMove gBattleMoves[MOVES_COUNT] =
{
{ // MOVE_NONE
.effect = EFFECT_HIT,

View File

@ -80,7 +80,7 @@ static const u8 gShellArmorAbilityDescription[] = _("Blocks critical hits.");
static const u8 gCacophonyAbilityDescription[] = _("Avoids sound-based moves.");
static const u8 gAirLockAbilityDescription[] = _("Negates weather effects.");
const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1] =
const u8 gAbilityNames[ABILITIES_COUNT][ABILITY_NAME_LENGTH + 1] =
{
_("-------"),
_("STENCH"),
@ -162,7 +162,7 @@ const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1] =
_("AIR LOCK"),
};
const u8 *const gAbilityDescriptionPointers[] =
const u8 *const gAbilityDescriptionPointers[ABILITIES_COUNT] =
{
gNoneAbilityDescription,
gStenchAbilityDescription,

View File

@ -556,7 +556,7 @@ void sub_806D544(u16 species, u32 personality, u8 *dest);
void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4);
void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
bool8 sub_806D7EC(void);
bool16 sub_806D82C(u8 id);
bool16 GetLinkTrainerFlankId(u8 id);
s32 GetBattlerMultiplayerId(u16 a1);
u8 GetTrainerEncounterMusicId(u16 trainerOpponentId);
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex);

View File

@ -16,7 +16,7 @@ void sub_81851A8(u8 *arg0);
bool32 CanCopyRecordedBattleSaveData(void);
u32 MoveRecordedBattleToSaveData(void);
void PlayRecordedBattle(void (*CB2_After)(void));
u8 sub_8185EA0(void);
u8 GetRecordedBattleFrontierFacility(void);
u8 sub_8185EAC(void);
void RecordedBattle_SaveParties(void);
u8 GetActiveBattlerLinkPlayerGender(void);

View File

@ -1969,7 +1969,7 @@ static void BattleAICmd_flee(void)
static void BattleAICmd_if_random_safari_flee(void)
{
u8 safariFleeRate = gBattleStruct->field_7B * 5; // Safari flee rate, from 0-20.
u8 safariFleeRate = gBattleStruct->safariEscapeFactor * 5; // Safari flee rate, from 0-20.
if ((u8)(Random() % 100) < safariFleeRate)
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);

View File

@ -12,6 +12,7 @@
#include "util.h"
#include "main.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "sound.h"
#include "window.h"
#include "m4a.h"
@ -1133,12 +1134,12 @@ static void LinkPartnerHandleDrawTrainerPic(void)
if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{
@ -1545,12 +1546,12 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void)
if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{

View File

@ -16,6 +16,7 @@
#include "constants/songs.h"
#include "sound.h"
#include "constants/moves.h"
#include "constants/trainers.h"
#include "window.h"
#include "m4a.h"
#include "palette.h"
@ -39,7 +40,7 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void sub_81A57E4(u8 battlerId, u16 stringId);
extern u8 sub_81A4CB0(void);
extern u8 GetFrontierBrainTrainerPicIndex(void);
extern u8 sub_81D5588(u16 trainerId);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
extern u8 GetEreaderTrainerFrontSpriteId(void);
@ -1234,7 +1235,7 @@ static void OpponentHandleDrawTrainerPic(void)
}
else if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
{
trainerPicId = sub_81A4CB0();
trainerPicId = GetFrontierBrainTrainerPicIndex();
}
else if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
{
@ -1318,7 +1319,7 @@ static void OpponentHandleTrainerSlide(void)
}
else if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
{
trainerPicId = sub_81A4CB0();
trainerPicId = GetFrontierBrainTrainerPicIndex();
}
else if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
{

View File

@ -13,6 +13,7 @@
#include "util.h"
#include "main.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "sound.h"
#include "window.h"
#include "m4a.h"

View File

@ -1082,14 +1082,14 @@ void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 m
void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
{
s32 i;
struct StringInfoBattle* stringInfo;
struct BattleMsgData* stringInfo;
sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRING;
sBattleBuffersTransferData[1] = gBattleOutcome;
sBattleBuffersTransferData[2] = stringID;
sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]);
stringInfo = (struct BattleMsgData*)(&sBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
@ -1097,7 +1097,7 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
stringInfo->scrActive = gBattleScripting.battler;
stringInfo->unk1605E = gBattleStruct->field_52;
stringInfo->hpScale = gBattleStruct->hpScale;
stringInfo->StringBank = gPotentialItemEffectBattler;
stringInfo->itemEffectBattler = gPotentialItemEffectBattler;
stringInfo->moveType = gBattleMoves[gCurrentMove].type;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
@ -1108,20 +1108,20 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
stringInfo->textBuffs[1][i] = gBattleTextBuff2[i];
stringInfo->textBuffs[2][i] = gBattleTextBuff3[i];
}
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct BattleMsgData) + 4);
}
void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
{
s32 i;
struct StringInfoBattle *stringInfo;
struct BattleMsgData *stringInfo;
sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY;
sBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY;
sBattleBuffersTransferData[2] = stringID;
sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]);
stringInfo = (struct BattleMsgData*)(&sBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
@ -1137,7 +1137,7 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
stringInfo->textBuffs[1][i] = gBattleTextBuff2[i];
stringInfo->textBuffs[2][i] = gBattleTextBuff3[i];
}
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct BattleMsgData) + 4);
}
void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2)

View File

@ -70,45 +70,45 @@ static void Task_ClearBitWhenSpecialAnimDone(u8 taskId);
static void ClearSpritesBattlerHealthboxAnimData(void);
// const rom data
static const struct CompressedSpriteSheet gUnknown_0832C0D0 =
static const struct CompressedSpriteSheet sSpriteSheet_SinglesPlayerHealthbox =
{
gUnknown_08C1F1C8, 0x1000, TAG_HEALTHBOX_PLAYER1_TILE
};
static const struct CompressedSpriteSheet gUnknown_0832C0D8 =
static const struct CompressedSpriteSheet sSpriteSheet_SinglesOpponentHealthbox =
{
gUnknown_08C1F46C, 0x1000, TAG_HEALTHBOX_OPPONENT1_TILE
};
static const struct CompressedSpriteSheet gUnknown_0832C0E0[2] =
static const struct CompressedSpriteSheet sSpriteSheets_DoublesPlayerHealthbox[2] =
{
{gUnknown_08C1F5E8, 0x800, TAG_HEALTHBOX_PLAYER1_TILE},
{gUnknown_08C1F5E8, 0x800, TAG_HEALTHBOX_PLAYER2_TILE}
};
static const struct CompressedSpriteSheet gUnknown_0832C0F0[2] =
static const struct CompressedSpriteSheet sSpriteSheets_DoublesOpponentHealthbox[2] =
{
{gUnknown_08C1F76C, 0x800, TAG_HEALTHBOX_OPPONENT1_TILE},
{gUnknown_08C1F76C, 0x800, TAG_HEALTHBOX_OPPONENT2_TILE}
};
static const struct CompressedSpriteSheet gUnknown_0832C100 =
static const struct CompressedSpriteSheet sSpriteSheet_SafariHealthbox =
{
gUnknown_08C1F8E8, 0x1000, TAG_HEALTHBOX_SAFARI_TILE
};
static const struct CompressedSpriteSheet gUnknown_0832C108[MAX_BATTLERS_COUNT] =
static const struct CompressedSpriteSheet sSpriteSheets_HealthBar[MAX_BATTLERS_COUNT] =
{
{gBlankGfxCompressed, 0x0100, 0xd704},
{gBlankGfxCompressed, 0x0120, 0xd705},
{gBlankGfxCompressed, 0x0100, 0xd706},
{gBlankGfxCompressed, 0x0120, 0xd707}
{gBlankGfxCompressed, 0x0100, TAG_HEALTHBAR_PLAYER1_TILE},
{gBlankGfxCompressed, 0x0120, TAG_HEALTHBAR_OPPONENT1_TILE},
{gBlankGfxCompressed, 0x0100, TAG_HEALTHBAR_PLAYER2_TILE},
{gBlankGfxCompressed, 0x0120, TAG_HEALTHBAR_OPPONENT2_TILE}
};
static const struct SpritePalette gUnknown_0832C128[2] =
static const struct SpritePalette sSpritePalettes_HealthBoxHealthBar[2] =
{
{gBattleInterface_BallStatusBarPal, TAG_HEALTHBOX_PAL},
{gBattleInterface_BallDisplayPal, 0xd704}
{gBattleInterface_BallDisplayPal, TAG_HEALTHBAR_PAL}
};
// code
@ -499,7 +499,7 @@ static void Task_ClearBitWhenSpecialAnimDone(u8 taskId)
#undef tBattlerId
// great function to include newly added moves that don't have animation yet
// Great function to include newly added moves that don't have animation yet.
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn)
{
return FALSE;
@ -679,29 +679,30 @@ void FreeTrainerFrontPicPalette(u16 frontPicId)
FreeSpritePaletteByTag(gTrainerFrontPicPaletteTable[frontPicId].tag);
}
void sub_805DFFC(void)
// Unused.
void BattleLoadAllHealthBoxesGfxAtOnce(void)
{
u8 numberOfBattlers = 0;
u8 i;
LoadSpritePalette(&gUnknown_0832C128[0]);
LoadSpritePalette(&gUnknown_0832C128[1]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]);
if (!IsDoubleBattle())
{
LoadCompressedObjectPic(&gUnknown_0832C0D0);
LoadCompressedObjectPic(&gUnknown_0832C0D8);
LoadCompressedObjectPic(&sSpriteSheet_SinglesPlayerHealthbox);
LoadCompressedObjectPic(&sSpriteSheet_SinglesOpponentHealthbox);
numberOfBattlers = 2;
}
else
{
LoadCompressedObjectPic(&gUnknown_0832C0E0[0]);
LoadCompressedObjectPic(&gUnknown_0832C0E0[1]);
LoadCompressedObjectPic(&gUnknown_0832C0F0[0]);
LoadCompressedObjectPic(&gUnknown_0832C0F0[1]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[1]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[1]);
numberOfBattlers = 4;
}
for (i = 0; i < numberOfBattlers; i++)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[i]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[i]]);
}
bool8 BattleLoadAllHealthBoxesGfx(u8 state)
@ -712,45 +713,45 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
{
if (state == 1)
{
LoadSpritePalette(&gUnknown_0832C128[0]);
LoadSpritePalette(&gUnknown_0832C128[1]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]);
}
else if (!IsDoubleBattle())
{
if (state == 2)
{
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
LoadCompressedObjectPic(&gUnknown_0832C100);
LoadCompressedObjectPic(&sSpriteSheet_SafariHealthbox);
else
LoadCompressedObjectPic(&gUnknown_0832C0D0);
LoadCompressedObjectPic(&sSpriteSheet_SinglesPlayerHealthbox);
}
else if (state == 3)
LoadCompressedObjectPic(&gUnknown_0832C0D8);
LoadCompressedObjectPic(&sSpriteSheet_SinglesOpponentHealthbox);
else if (state == 4)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[0]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[0]]);
else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[1]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[1]]);
else
retVal = TRUE;
}
else
{
if (state == 2)
LoadCompressedObjectPic(&gUnknown_0832C0E0[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[0]);
else if (state == 3)
LoadCompressedObjectPic(&gUnknown_0832C0E0[1]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[1]);
else if (state == 4)
LoadCompressedObjectPic(&gUnknown_0832C0F0[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[0]);
else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C0F0[1]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[1]);
else if (state == 6)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[0]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[0]]);
else if (state == 7)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[1]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[1]]);
else if (state == 8)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[2]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[2]]);
else if (state == 9)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[3]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[3]]);
else
retVal = TRUE;
}

View File

@ -1350,7 +1350,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
}
}
// Prints mon's nature and flee rate. Probably used to test pokeblock feeders.
// Prints mon's nature, catch and flee rate. Probably used to test pokeblock-related features.
static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon)
{
u8 text[20];
@ -1391,8 +1391,8 @@ static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon)
}
healthBarSpriteId = gSprites[healthboxSpriteId].hMain_HealthBarSpriteId;
ConvertIntToDecimalStringN(text + 6, gBattleStruct->field_7C, STR_CONV_MODE_RIGHT_ALIGN, 2);
ConvertIntToDecimalStringN(text + 9, gBattleStruct->field_7B, STR_CONV_MODE_RIGHT_ALIGN, 2);
ConvertIntToDecimalStringN(text + 6, gBattleStruct->safariCatchFactor, STR_CONV_MODE_RIGHT_ALIGN, 2);
ConvertIntToDecimalStringN(text + 9, gBattleStruct->safariEscapeFactor, STR_CONV_MODE_RIGHT_ALIGN, 2);
text[5] = CHAR_SPACE;
text[8] = CHAR_SLASH;
RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text);

View File

@ -85,7 +85,6 @@ extern u8 gUnknown_0203CF00[];
extern const u16 gBattleTextboxPalette[];
extern const struct BgTemplate gBattleBgTemplates[];
extern const struct WindowTemplate *const gBattleWindowTemplates[];
extern const u8 gUnknown_0831ACE0[];
extern const u8 *const gBattleScriptsForMoveEffects[];
extern const u8 *const gBattlescriptsForBallThrow[];
extern const u8 *const gBattlescriptsForRunningByItem[];
@ -308,6 +307,9 @@ u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
// 10 is ×1.0 TYPE_MUL_NORMAL
// 05 is ×0.5 TYPE_MUL_NOT_EFFECTIVE
// 00 is ×0.0 TYPE_MUL_NO_EFFECT
static const s8 gUnknown_0831ACE0[] ={-32, -16, -16, -32, -32, 0, 0, 0};
const u8 gTypeEffectiveness[336] =
{
TYPE_NORMAL, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
@ -561,9 +563,9 @@ const u8 * const gStatusConditionStringsTable[7][2] =
{gStatusConditionString_LoveJpn, gText_Love}
};
static const u8 sUnknown_0831BCE0[][3] = {{0, 0, 0}, {3, 5, 0}, {2, 3, 0}, {1, 2, 0}, {1, 1, 0}};
static const u8 sUnknown_0831BCEF[] = {4, 3, 2, 1};
static const u8 sUnknown_0831BCF3[] = {4, 4, 4, 4};
static const u8 sPkblToEscapeFactor[][3] = {{0, 0, 0}, {3, 5, 0}, {2, 3, 0}, {1, 2, 0}, {1, 1, 0}};
static const u8 sGoNearCounterToCatchFactor[] = {4, 3, 2, 1};
static const u8 sGoNearCounterToEscapeFactor[] = {4, 4, 4, 4};
// code
void CB2_InitBattle(void)
@ -1805,7 +1807,7 @@ static void CB2_HandleStartMultiBattle(void)
SetMainCallback2(BattleMainCB2);
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
gTrainerBattleOpponent_A = TRAINER_OPPONENT_800;
gTrainerBattleOpponent_A = TRAINER_LINK_OPPONENT;
gBattleTypeFlags |= BATTLE_TYPE_20;
}
}
@ -3051,10 +3053,10 @@ static void BattleStartClearSetData(void)
gLeveledUpInBattle = 0;
gAbsentBattlerFlags = 0;
gBattleStruct->runTries = 0;
gBattleStruct->field_79 = 0;
gBattleStruct->field_7A = 0;
*(&gBattleStruct->field_7C) = gBaseStats[GetMonData(&gEnemyParty[0], MON_DATA_SPECIES)].catchRate * 100 / 1275;
gBattleStruct->field_7B = 3;
gBattleStruct->safariGoNearCounter = 0;
gBattleStruct->safariPkblThrowCounter = 0;
*(&gBattleStruct->safariCatchFactor) = gBaseStats[GetMonData(&gEnemyParty[0], MON_DATA_SPECIES)].catchRate * 100 / 1275;
gBattleStruct->safariEscapeFactor = 3;
gBattleStruct->wildVictorySong = 0;
gBattleStruct->moneyMultiplier = 1;
@ -5746,14 +5748,14 @@ static void HandleAction_ThrowPokeblock(void)
if (gBattleResults.pokeblockThrows < 0xFF)
gBattleResults.pokeblockThrows++;
if (gBattleStruct->field_7A < 3)
gBattleStruct->field_7A++;
if (gBattleStruct->field_7B > 1)
if (gBattleStruct->safariPkblThrowCounter < 3)
gBattleStruct->safariPkblThrowCounter++;
if (gBattleStruct->safariEscapeFactor > 1)
{
if (gBattleStruct->field_7B < sUnknown_0831BCE0[gBattleStruct->field_7A][gBattleCommunication[MULTISTRING_CHOOSER]])
gBattleStruct->field_7B = 1;
if (gBattleStruct->safariEscapeFactor < sPkblToEscapeFactor[gBattleStruct->safariPkblThrowCounter][gBattleCommunication[MULTISTRING_CHOOSER]])
gBattleStruct->safariEscapeFactor = 1;
else
gBattleStruct->field_7B -= sUnknown_0831BCE0[gBattleStruct->field_7A][gBattleCommunication[MULTISTRING_CHOOSER]];
gBattleStruct->safariEscapeFactor -= sPkblToEscapeFactor[gBattleStruct->safariPkblThrowCounter][gBattleCommunication[MULTISTRING_CHOOSER]];
}
gBattlescriptCurrInstr = gBattlescriptsForSafariActions[2];
@ -5766,22 +5768,22 @@ static void HandleAction_GoNear(void)
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattleStruct->field_7C += sUnknown_0831BCEF[gBattleStruct->field_79];
if (gBattleStruct->field_7C > 20)
gBattleStruct->field_7C = 20;
gBattleStruct->safariCatchFactor += sGoNearCounterToCatchFactor[gBattleStruct->safariGoNearCounter];
if (gBattleStruct->safariCatchFactor > 20)
gBattleStruct->safariCatchFactor = 20;
gBattleStruct->field_7B +=sUnknown_0831BCF3[gBattleStruct->field_79];
if (gBattleStruct->field_7B > 20)
gBattleStruct->field_7B = 20;
gBattleStruct->safariEscapeFactor += sGoNearCounterToEscapeFactor[gBattleStruct->safariGoNearCounter];
if (gBattleStruct->safariEscapeFactor > 20)
gBattleStruct->safariEscapeFactor = 20;
if (gBattleStruct->field_79 < 3)
if (gBattleStruct->safariGoNearCounter < 3)
{
gBattleStruct->field_79++;
gBattleStruct->safariGoNearCounter++;
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gBattleCommunication[MULTISTRING_CHOOSER] = 1; // Can't get closer.
}
gBattlescriptCurrInstr = gBattlescriptsForSafariActions[1];
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;

View File

@ -6,6 +6,7 @@
#include "text.h"
#include "string_util.h"
#include "constants/items.h"
#include "constants/trainers.h"
#include "event_data.h"
#include "link.h"
#include "item.h"
@ -2074,7 +2075,7 @@ void BufferStringBattle(u16 stringID)
}
else
{
if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_800 || gBattleTypeFlags & BATTLE_TYPE_x2000000)
if (gTrainerBattleOpponent_A == TRAINER_LINK_OPPONENT || gBattleTypeFlags & BATTLE_TYPE_x2000000)
{
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
stringPtr = sText_LinkTrainer2WithdrewPkmn;

View File

@ -3111,7 +3111,7 @@ static void atk1E_jumpifability(void)
if (gBattlescriptCurrInstr[1] == BS_ATTACKER_SIDE)
{
battlerId = AbilityBattleEffects(ABILITYEFFECT_CHECK_BANK_SIDE, gBattlerAttacker, ability, 0, 0);
battlerId = AbilityBattleEffects(ABILITYEFFECT_CHECK_BATTLER_SIDE, gBattlerAttacker, ability, 0, 0);
if (battlerId)
{
gLastUsedAbility = ability;
@ -5033,7 +5033,7 @@ static void atk4F_jumpifcantswitch(void)
party = gPlayerParty;
i = 0;
if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
i = 3;
}
else
@ -5054,7 +5054,7 @@ static void atk4F_jumpifcantswitch(void)
party = gPlayerParty;
i = 0;
if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
i = 3;
}
@ -5166,7 +5166,7 @@ static void atk50_openpartyscreen(void)
{
if (gHitMarker & HITMARKER_FAINTED(gActiveBattler))
{
if (sub_80423F4(gActiveBattler, 6, 6))
if (HasNoMonsToSwitch(gActiveBattler, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5195,7 +5195,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[0] & hitmarkerFaintBits)
{
gActiveBattler = 0;
if (sub_80423F4(0, 6, 6))
if (HasNoMonsToSwitch(0, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5217,7 +5217,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[2] & hitmarkerFaintBits && !(gBitTable[0] & hitmarkerFaintBits))
{
gActiveBattler = 2;
if (sub_80423F4(2, 6, 6))
if (HasNoMonsToSwitch(2, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5238,7 +5238,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[1] & hitmarkerFaintBits)
{
gActiveBattler = 1;
if (sub_80423F4(1, 6, 6))
if (HasNoMonsToSwitch(1, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5260,7 +5260,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[3] & hitmarkerFaintBits && !(gBitTable[1] & hitmarkerFaintBits))
{
gActiveBattler = 3;
if (sub_80423F4(3, 6, 6))
if (HasNoMonsToSwitch(3, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5323,7 +5323,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits)
{
gActiveBattler = 2;
if (sub_80423F4(2, gBattleBufferB[0][1], 6))
if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5339,7 +5339,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[3] & hitmarkerFaintBits && hitmarkerFaintBits & gBitTable[1])
{
gActiveBattler = 3;
if (sub_80423F4(3, gBattleBufferB[1][1], 6))
if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5391,7 +5391,7 @@ static void atk50_openpartyscreen(void)
{
gBattlescriptCurrInstr += 6;
}
else if (sub_80423F4(battlerId, 6, 6))
else if (HasNoMonsToSwitch(battlerId, 6, 6))
{
gActiveBattler = battlerId;
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
@ -7506,7 +7506,7 @@ static void atk8F_forcerandomswitch(void)
else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|| (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000))
{
if (sub_806D82C(GetBattlerMultiplayerId(gBattlerTarget)) == 1)
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gBattlerTarget)) == 1)
{
firstMonId = 3;
lastMonId = 6;
@ -9044,7 +9044,7 @@ static void atkBE_rapidspinfree(void)
else if (gStatuses3[gBattlerAttacker] & STATUS3_LEECHSEED)
{
gStatuses3[gBattlerAttacker] &= ~(STATUS3_LEECHSEED);
gStatuses3[gBattlerAttacker] &= ~(STATUS3_LEECHSEED_BANK);
gStatuses3[gBattlerAttacker] &= ~(STATUS3_LEECHSEED_BATTLER);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_LeechSeedFree;
}
@ -9760,7 +9760,7 @@ static void atkE1_trygetintimidatetarget(void)
{
u8 side;
gBattleScripting.battler = gBattleStruct->intimidateBank;
gBattleScripting.battler = gBattleStruct->intimidateBattler;
side = GetBattlerSide(gBattleScripting.battler);
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gBattleMons[gBattleScripting.battler].ability)
@ -10115,7 +10115,7 @@ static void atkEF_handleballthrow(void)
u8 catchRate;
if (gLastUsedItem == ITEM_SAFARI_BALL)
catchRate = gBattleStruct->field_7C * 1275 / 100;
catchRate = gBattleStruct->safariCatchFactor * 1275 / 100;
else
catchRate = gBaseStats[gBattleMons[gBattlerTarget].species].catchRate;

View File

@ -796,8 +796,8 @@ void TryPutLinkBattleTvShowOnAir(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
if ((playerBestMonId < 3 && !sub_806D82C(gBattleScripting.multiplayerId))
|| (playerBestMonId >= 3 && sub_806D82C(gBattleScripting.multiplayerId)))
if ((playerBestMonId < 3 && !GetLinkTrainerFlankId(gBattleScripting.multiplayerId))
|| (playerBestMonId >= 3 && GetLinkTrainerFlankId(gBattleScripting.multiplayerId)))
{
j = (opponentBestMonId < 3) ? 0 : 1;
PutBattleUpdateOnTheAir(sub_806EF84(j, gBattleScripting.multiplayerId), moveId, playerBestSpecies, opponentBestSpecies);
@ -1078,7 +1078,7 @@ _0817E5C8:\n\
ldr r0, =gBattleScripting\n\
adds r0, 0x25\n\
ldrb r0, [r0]\n\
bl sub_806D82C\n\
bl GetLinkTrainerFlankId\n\
lsls r0, 16\n\
cmp r0, 0\n\
beq _0817E630\n\
@ -1088,7 +1088,7 @@ _0817E620:\n\
ldr r0, =gBattleScripting\n\
adds r0, 0x25\n\
ldrb r0, [r0]\n\
bl sub_806D82C\n\
bl GetLinkTrainerFlankId\n\
lsls r0, 16\n\
cmp r0, 0\n\
beq _0817E670\n\

View File

@ -46,7 +46,7 @@ u8 GetBattlerForBattleScript(u8 caseId)
case BS_EFFECT_BATTLER:
ret = gEffectBattler;
break;
case BS_BANK_0:
case BS_BATTLER_0:
ret = 0;
break;
case BS_SCRIPTING:
@ -453,7 +453,7 @@ bool8 AreAllMovesUnusable(void)
u8 unusable;
unusable = CheckMoveLimitations(gActiveBattler, 0, 0xFF);
if (unusable == 0xF) // all moves are unusable
if (unusable == 0xF) // All moves are unusable.
{
gProtectStructs[gActiveBattler].onlyStruggle = 1;
gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft;
@ -470,11 +470,11 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
{
s32 i;
u8 imprisionedMoves = 0;
u8 bankSide = GetBattlerSide(battlerId);
u8 BattlerSide = GetBattlerSide(battlerId);
for (i = 0; i < gBattlersCount; i++)
{
if (bankSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
if (BattlerSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
{
s32 j;
for (j = 0; j < 4; j++)
@ -504,7 +504,7 @@ u8 UpdateTurnCounters(void)
do
{
u8 sideBank;
u8 side;
switch (gBattleStruct->turnCountersTracker)
{
@ -533,13 +533,13 @@ u8 UpdateTurnCounters(void)
case 1:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].reflectBattlerId;
if (gSideStatuses[sideBank] & SIDE_STATUS_REFLECT)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].reflectBattlerId;
if (gSideStatuses[side] & SIDE_STATUS_REFLECT)
{
if (--gSideTimers[sideBank].reflectTimer == 0)
if (--gSideTimers[side].reflectTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_REFLECT;
gSideStatuses[side] &= ~SIDE_STATUS_REFLECT;
BattleScriptExecute(BattleScript_SideStatusWoreOff);
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_REFLECT);
effect++;
@ -558,15 +558,15 @@ u8 UpdateTurnCounters(void)
case 2:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].lightscreenBattlerId;
if (gSideStatuses[sideBank] & SIDE_STATUS_LIGHTSCREEN)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].lightscreenBattlerId;
if (gSideStatuses[side] & SIDE_STATUS_LIGHTSCREEN)
{
if (--gSideTimers[sideBank].lightscreenTimer == 0)
if (--gSideTimers[side].lightscreenTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_LIGHTSCREEN;
gSideStatuses[side] &= ~SIDE_STATUS_LIGHTSCREEN;
BattleScriptExecute(BattleScript_SideStatusWoreOff);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleCommunication[MULTISTRING_CHOOSER] = side;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_LIGHT_SCREEN);
effect++;
}
@ -584,14 +584,14 @@ u8 UpdateTurnCounters(void)
case 3:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].mistBattlerId;
if (gSideTimers[sideBank].mistTimer != 0
&& --gSideTimers[sideBank].mistTimer == 0)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].mistBattlerId;
if (gSideTimers[side].mistTimer != 0
&& --gSideTimers[side].mistTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_MIST;
gSideStatuses[side] &= ~SIDE_STATUS_MIST;
BattleScriptExecute(BattleScript_SideStatusWoreOff);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleCommunication[MULTISTRING_CHOOSER] = side;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_MIST);
effect++;
}
@ -608,13 +608,13 @@ u8 UpdateTurnCounters(void)
case 4:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].safeguardBattlerId;
if (gSideStatuses[sideBank] & SIDE_STATUS_SAFEGUARD)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].safeguardBattlerId;
if (gSideStatuses[side] & SIDE_STATUS_SAFEGUARD)
{
if (--gSideTimers[sideBank].safeguardTimer == 0)
if (--gSideTimers[side].safeguardTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_SAFEGUARD;
gSideStatuses[side] &= ~SIDE_STATUS_SAFEGUARD;
BattleScriptExecute(BattleScript_SafeguardEnds);
effect++;
}
@ -795,10 +795,10 @@ u8 TurnBasedEffects(void)
break;
case 3: // leech seed
if ((gStatuses3[gActiveBattler] & STATUS3_LEECHSEED)
&& gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BANK].hp != 0
&& gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER].hp != 0
&& gBattleMons[gActiveBattler].hp != 0)
{
gBattlerTarget = gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BANK; //funny how the 'target' is actually the battlerId that receives HP
gBattlerTarget = gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER; // Notice gBattlerTarget is actually the HP receiver.
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
@ -848,8 +848,8 @@ u8 TurnBasedEffects(void)
case 7: // spooky nightmares
if ((gBattleMons[gActiveBattler].status2 & STATUS2_NIGHTMARE) && gBattleMons[gActiveBattler].hp != 0)
{
// R/S does not perform this sleep check, which causes the nighmare effect to
// persist even after the affected Pokemon has been awakened by Shed Skin
// R/S does not perform this sleep check, which causes the nightmare effect to
// persist even after the affected Pokemon has been awakened by Shed Skin.
if (gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
{
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 4;
@ -983,7 +983,7 @@ u8 TurnBasedEffects(void)
case 12: // disable
if (gDisableStructs[gActiveBattler].disableTimer1 != 0)
{
int i;
s32 i;
for (i = 0; i < 4; i++)
{
if (gDisableStructs[gActiveBattler].disabledMove == gBattleMons[gActiveBattler].moves[i])
@ -1184,7 +1184,7 @@ bool8 HandleFaintedMonActions(void)
return FALSE;
do
{
int i;
s32 i;
switch (gBattleStruct->faintedActionsState)
{
case 0:
@ -1192,7 +1192,7 @@ bool8 HandleFaintedMonActions(void)
gBattleStruct->faintedActionsState++;
for (i = 0; i < gBattlersCount; i++)
{
if (gAbsentBattlerFlags & gBitTable[i] && !sub_80423F4(i, 6, 6))
if (gAbsentBattlerFlags & gBitTable[i] && !HasNoMonsToSwitch(i, 6, 6))
gAbsentBattlerFlags &= ~(gBitTable[i]);
}
// fall through
@ -1256,7 +1256,7 @@ bool8 HandleFaintedMonActions(void)
void TryClearRageStatuses(void)
{
int i;
s32 i;
for (i = 0; i < gBattlersCount; i++)
{
if ((gBattleMons[i].status2 & STATUS2_RAGE) && gChosenMoveByBattler[i] != MOVE_RAGE)
@ -1467,7 +1467,9 @@ u8 AtkCanceller_UnableToUseMove(void)
{
gBattleScripting.battler = CountTrailingZeroBits((gBattleMons[gBattlerAttacker].status2 & STATUS2_INFATUATION) >> 0x10);
if (Random() & 1)
{
BattleScriptPushCursor();
}
else
{
BattleScriptPush(BattleScript_MoveUsedIsParalyzedCantAttack);
@ -1485,7 +1487,9 @@ u8 AtkCanceller_UnableToUseMove(void)
{
gBattleMons[gBattlerAttacker].status2 -= 0x100;
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE)
{
gBattlescriptCurrInstr = BattleScript_BideStoringEnergy;
}
else
{
// This is removed in Emerald for some reason
@ -1500,8 +1504,10 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattlescriptCurrInstr = BattleScript_BideAttack;
}
else
{
gBattlescriptCurrInstr = BattleScript_BideNoEnergyToAttack;
}
}
effect = 1;
}
gBattleStruct->atkCancellerTracker++;
@ -1535,29 +1541,31 @@ u8 AtkCanceller_UnableToUseMove(void)
return effect;
}
bool8 sub_80423F4(u8 battler, u8 r1, u8 r2)
bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
{
struct Pokemon *party;
u8 r7;
u8 r6;
u8 id1, id2;
s32 i;
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
r6 = ((battler & 2) / 2);
for (i = r6 * 3; i < r6 * 3 + 3; i++)
id1 = ((battler & BIT_FLANK) / 2);
for (i = id1 * 3; i < id1 * 3 + 3; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == r6 * 3 + 3);
return (i == id1 * 3 + 3);
}
else if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
@ -1566,12 +1574,12 @@ bool8 sub_80423F4(u8 battler, u8 r1, u8 r2)
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
{
party = gPlayerParty;
r7 = GetBattlerMultiplayerId(battler);
r6 = sub_806D82C(r7);
id2 = GetBattlerMultiplayerId(battler);
id1 = GetLinkTrainerFlankId(id2);
}
else
{
// FIXME: Compiler insists on moving r4 into r1 before doing the eor
// FIXME: Compiler insists on moving r4 into r1 before doing the eor.
#ifndef NONMATCHING
register u32 var asm("r1");
#else
@ -1579,73 +1587,82 @@ bool8 sub_80423F4(u8 battler, u8 r1, u8 r2)
#endif // NONMATCHING
party = gEnemyParty;
var = battler ^ 1;
r6 = (var != 0) ? 1 : 0;
var = battler ^ BIT_SIDE;
if (var == 0)
id1 = 0;
else
id1 = 1;
}
}
else
{
r7 = GetBattlerMultiplayerId(battler);
id2 = GetBattlerMultiplayerId(battler);
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
r6 = sub_806D82C(r7);
id1 = GetLinkTrainerFlankId(id2);
}
for (i = r6 * 3; i < r6 * 3 + 3; i++)
for (i = id1 * 3; i < id1 * 3 + 3; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == r6 * 3 + 3);
return (i == id1 * 3 + 3);
}
else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
party = gEnemyParty;
if (battler == 1)
r6 = 0;
id1 = 0;
else
r6 = 3;
for (i = r6; i < r6 + 3; i++)
id1 = 3;
for (i = id1; i < id1 + 3; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == r6 + 3);
return (i == id1 + 3);
}
else
{
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
r7 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
r6 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
id2 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
id1 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
party = gEnemyParty;
}
else
{
r7 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
r6 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
id2 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
id1 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
party = gPlayerParty;
}
if (r1 == 6)
r1 = gBattlerPartyIndexes[r7];
if (r2 == 6)
r2 = gBattlerPartyIndexes[r6];
for (i = 0; i < 6; i++)
if (partyIdBattlerOn1 == PARTY_SIZE)
partyIdBattlerOn1 = gBattlerPartyIndexes[id2];
if (partyIdBattlerOn2 == PARTY_SIZE)
partyIdBattlerOn2 = gBattlerPartyIndexes[id1];
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG
// FIXME: Using index[array] instead of array[index] is BAD!
&& i != r1 && i != r2 && i != r7[gBattleStruct->monToSwitchIntoId] && i != r6[gBattleStruct->monToSwitchIntoId])
&& i != partyIdBattlerOn1 && i != partyIdBattlerOn2
&& i != *(gBattleStruct->monToSwitchIntoId + id2) && i != id1[gBattleStruct->monToSwitchIntoId])
break;
}
return (i == 6);
return (i == PARTY_SIZE);
}
}
@ -1706,6 +1723,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if (gBattlerAttacker >= gBattlersCount)
gBattlerAttacker = battler;
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
pokeAtk = &gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]];
else
@ -1713,6 +1731,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if (gBattlerTarget >= gBattlersCount)
gBattlerTarget = battler;
if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER)
pokeDef = &gPlayerParty[gBattlerPartyIndexes[gBattlerTarget]];
else
@ -1724,7 +1743,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
speciesDef = GetMonData(pokeDef, MON_DATA_SPECIES);
pidDef = GetMonData(pokeDef, MON_DATA_PERSONALITY);
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) // why isn't that check done at the beginning?
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) // Why isn't that check done at the beginning?
{
u8 moveType;
s32 i;
@ -2271,7 +2290,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gLastUsedAbility = ABILITY_INTIMIDATE;
gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES);
BattleScriptPushCursorAndCallback(BattleScript_82DB4B8);
gBattleStruct->intimidateBank = i;
gBattleStruct->intimidateBattler = i;
effect++;
break;
}
@ -2343,7 +2362,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_82DB4C1;
gBattleStruct->intimidateBank = i;
gBattleStruct->intimidateBattler = i;
effect++;
break;
}
@ -2360,7 +2379,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
}
}
break;
case ABILITYEFFECT_CHECK_BANK_SIDE: // 13
case ABILITYEFFECT_CHECK_BATTLER_SIDE: // 13
side = GetBattlerSide(battler);
for (i = 0; i < gBattlersCount; i++)
{
@ -2410,7 +2429,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
}
}
break;
case ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK: // 15
case ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER: // 15
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleMons[i].ability == ability && i != battler)
@ -2431,7 +2450,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
}
}
break;
case ABILITYEFFECT_COUNT_BANK_SIDE: // 17
case ABILITYEFFECT_COUNT_BATTLER_SIDE: // 17
side = GetBattlerSide(battler);
for (i = 0; i < gBattlersCount; i++)
{
@ -2492,20 +2511,20 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
int i = 0;
u8 effect = ITEM_NO_EFFECT;
u8 changedPP = 0;
u8 bankHoldEffect, atkHoldEffect, defHoldEffect;
u8 bankQuality, atkQuality, defQuality;
u8 BattlerHoldEffect, atkHoldEffect, defHoldEffect;
u8 BattlerQuality, atkQuality, defQuality;
u16 atkItem, defItem;
gLastUsedItem = gBattleMons[battlerId].item;
if (gLastUsedItem == ITEM_ENIGMA_BERRY)
{
bankHoldEffect = gEnigmaBerries[battlerId].holdEffect;
bankQuality = gEnigmaBerries[battlerId].holdEffectParam;
BattlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
BattlerQuality = gEnigmaBerries[battlerId].holdEffectParam;
}
else
{
bankHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
bankQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
BattlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
BattlerQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
}
atkItem = gBattleMons[gBattlerAttacker].item;
@ -2536,7 +2555,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
switch (caseID)
{
case ITEMEFFECT_ON_SWITCH_IN:
switch (bankHoldEffect)
switch (BattlerHoldEffect)
{
case HOLD_EFFECT_DOUBLE_PRIZE:
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
@ -2564,13 +2583,13 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
case 1:
if (gBattleMons[battlerId].hp)
{
switch (bankHoldEffect)
switch (BattlerHoldEffect)
{
case HOLD_EFFECT_RESTORE_HP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn)
{
gBattleMoveDamage = bankQuality;
if (gBattleMons[battlerId].hp + bankQuality > gBattleMons[battlerId].maxHP)
gBattleMoveDamage = BattlerQuality;
if (gBattleMons[battlerId].hp + BattlerQuality > gBattleMons[battlerId].maxHP)
gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp;
gBattleMoveDamage *= -1;
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
@ -2599,10 +2618,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
if (i != 4)
{
u8 maxPP = CalculatePPWithBonus(move, ppBonuses, i);
if (changedPP + bankQuality > maxPP)
if (changedPP + BattlerQuality > maxPP)
changedPP = maxPP;
else
changedPP = changedPP + bankQuality;
changedPP = changedPP + BattlerQuality;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, move);
@ -2641,7 +2660,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gBattleMoveDamage *= -1;
BattleScriptExecute(BattleScript_ItemHealHP_End2);
effect = ITEM_HP_CHANGE;
RecordItemEffectBattle(battlerId, bankHoldEffect);
RecordItemEffectBattle(battlerId, BattlerHoldEffect);
}
break;
// nice copy/paste there gamefreak, making a function for confuse berries was too much eh?
@ -2650,7 +2669,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SPICY);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2668,7 +2687,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_DRY);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2686,7 +2705,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SWEET);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2704,7 +2723,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_BITTER);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2722,7 +2741,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SOUR);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2737,7 +2756,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
break;
// copy/paste again, smh
case HOLD_EFFECT_ATTACK_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
@ -2751,7 +2770,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_DEFENSE_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF);
@ -2764,7 +2783,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_SPEED_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED);
@ -2777,7 +2796,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_SP_ATTACK_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK);
@ -2790,7 +2809,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_SP_DEFENSE_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF);
@ -2803,7 +2822,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_CRITICAL_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
{
gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY;
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
@ -2811,7 +2830,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RANDOM_STAT_UP:
if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality)
if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality)
{
for (i = 0; i < 5; i++)
{
@ -2977,15 +2996,15 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gLastUsedItem = gBattleMons[battlerId].item;
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
{
bankHoldEffect = gEnigmaBerries[battlerId].holdEffect;
bankQuality = gEnigmaBerries[battlerId].holdEffectParam;
BattlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
BattlerQuality = gEnigmaBerries[battlerId].holdEffectParam;
}
else
{
bankHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
bankQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
BattlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
BattlerQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
}
switch (bankHoldEffect)
switch (BattlerHoldEffect)
{
case HOLD_EFFECT_CURE_PAR:
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
@ -3180,7 +3199,7 @@ void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands
u8 GetMoveTarget(u16 move, u8 setTarget)
{
u8 targetBank = 0;
u8 targetBattler = 0;
u8 moveTarget;
u8 side;
@ -3194,21 +3213,21 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
case MOVE_TARGET_SELECTED:
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
targetBank = gSideTimers[side].followmeTarget;
targetBattler = gSideTimers[side].followmeTarget;
else
{
side = GetBattlerSide(gBattlerAttacker);
do
{
targetBank = Random() % gBattlersCount;
} while (targetBank == gBattlerAttacker || side == GetBattlerSide(targetBank) || gAbsentBattlerFlags & gBitTable[targetBank]);
targetBattler = Random() % gBattlersCount;
} while (targetBattler == gBattlerAttacker || side == GetBattlerSide(targetBattler) || gAbsentBattlerFlags & gBitTable[targetBattler]);
if (gBattleMoves[move].type == TYPE_ELECTRIC
&& AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattlerAttacker, ABILITY_LIGHTNING_ROD, 0, 0)
&& gBattleMons[targetBank].ability != ABILITY_LIGHTNING_ROD)
&& gBattleMons[targetBattler].ability != ABILITY_LIGHTNING_ROD)
{
targetBank ^= BIT_FLANK;
RecordAbilityBattle(targetBank, gBattleMons[targetBank].ability);
gSpecialStatuses[targetBank].lightningRodRedirected = 1;
targetBattler ^= BIT_FLANK;
RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability);
gSpecialStatuses[targetBattler].lightningRodRedirected = 1;
}
}
break;
@ -3216,45 +3235,45 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
case MOVE_TARGET_OPPONENTS_FIELD:
targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
if (gAbsentBattlerFlags & gBitTable[targetBank])
targetBank ^= BIT_FLANK;
targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
if (gAbsentBattlerFlags & gBitTable[targetBattler])
targetBattler ^= BIT_FLANK;
break;
case MOVE_TARGET_RANDOM:
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
targetBank = gSideTimers[side].followmeTarget;
targetBattler = gSideTimers[side].followmeTarget;
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM)
{
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
{
if (Random() & 1)
targetBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
targetBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
else
targetBank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
targetBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
}
else
{
if (Random() & 1)
targetBank = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
targetBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
else
targetBank = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
targetBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
}
if (gAbsentBattlerFlags & gBitTable[targetBank])
targetBank ^= BIT_FLANK;
if (gAbsentBattlerFlags & gBitTable[targetBattler])
targetBattler ^= BIT_FLANK;
}
else
targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
break;
case MOVE_TARGET_USER_OR_SELECTED:
case MOVE_TARGET_USER:
targetBank = gBattlerAttacker;
targetBattler = gBattlerAttacker;
break;
}
*(gBattleStruct->moveTarget + gBattlerAttacker) = targetBank;
*(gBattleStruct->moveTarget + gBattlerAttacker) = targetBattler;
return targetBank;
return targetBattler;
}
static bool32 HasObedientBitSet(u8 battlerId)

View File

@ -1964,11 +1964,11 @@ void CalculateMonStats(struct Pokemon *mon)
SetMonData(mon, MON_DATA_MAX_HP, &newMaxHP);
CALC_STAT(baseAttack, attackIV, attackEV, 1, MON_DATA_ATK)
CALC_STAT(baseDefense, defenseIV, defenseEV, 2, MON_DATA_DEF)
CALC_STAT(baseSpeed, speedIV, speedEV, 3, MON_DATA_SPEED)
CALC_STAT(baseSpAttack, spAttackIV, spAttackEV, 4, MON_DATA_SPATK)
CALC_STAT(baseSpDefense, spDefenseIV, spDefenseEV, 5, MON_DATA_SPDEF)
CALC_STAT(baseAttack, attackIV, attackEV, STAT_ATK, MON_DATA_ATK)
CALC_STAT(baseDefense, defenseIV, defenseEV, STAT_DEF, MON_DATA_DEF)
CALC_STAT(baseSpeed, speedIV, speedEV, STAT_SPEED, MON_DATA_SPEED)
CALC_STAT(baseSpAttack, spAttackIV, spAttackEV, STAT_SPATK, MON_DATA_SPATK)
CALC_STAT(baseSpDefense, spDefenseIV, spDefenseEV, STAT_SPDEF, MON_DATA_SPDEF)
if (species == SPECIES_SHEDINJA)
{
@ -4819,21 +4819,21 @@ bool8 sub_806D7EC(void)
return retVal;
}
bool16 sub_806D82C(u8 id)
u16 GetLinkTrainerFlankId(u8 linkPlayerId)
{
bool16 retVal = FALSE;
switch (gLinkPlayers[id].lp_field_18)
u16 flankId = 0;
switch (gLinkPlayers[linkPlayerId].lp_field_18)
{
case 0:
case 3:
retVal = FALSE;
flankId = 0;
break;
case 1:
case 2:
retVal = TRUE;
flankId = 1;
break;
}
return retVal;
return flankId;
}
s32 GetBattlerMultiplayerId(u16 a1)

View File

@ -79,19 +79,19 @@ EWRAM_DATA static u16 sUnknown_0203C79C[4] = {0};
EWRAM_DATA static u16 sUnknown_0203C7A4[4] = {0};
EWRAM_DATA static u8 sUnknown_0203C7AC = 0;
EWRAM_DATA static u8 sUnknown_0203C7AD = 0;
EWRAM_DATA static u8 sRecordedBattle_FrontierFacility = 0;
EWRAM_DATA static u8 sFrontierFacility = 0;
EWRAM_DATA static u8 sUnknown_0203C7AF = 0;
EWRAM_DATA static MainCallback sCallback2_AfterRecordedBattle = NULL;
EWRAM_DATA u8 gUnknown_0203C7B4 = 0;
EWRAM_DATA static u8 sUnknown_0203C7B5 = 0;
EWRAM_DATA static u8 sRecordedBattle_BattleStyle = 0;
EWRAM_DATA static u8 sRecordedBattle_TextSpeed = 0;
EWRAM_DATA static u32 sRecordedBattle_BattleFlags = 0;
EWRAM_DATA static u32 sRecordedBattle_AI_Scripts = 0;
EWRAM_DATA static u8 sBattleStyle = 0;
EWRAM_DATA static u8 sTextSpeed = 0;
EWRAM_DATA static u32 sBattleFlags = 0;
EWRAM_DATA static u32 sAI_Scripts = 0;
EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0};
EWRAM_DATA static u16 sRecordedBattle_PlayerMonMoves[2][4] = {0};
EWRAM_DATA static struct PlayerInfo sRecordedBattle_Players[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u16 sPlayerMonMoves[2][4] = {0};
EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u8 sUnknown_0203CCD0 = 0;
EWRAM_DATA static u8 sUnknown_0203CCD1[8] = {0};
EWRAM_DATA static u8 sUnknown_0203CCD9 = 0;
@ -126,8 +126,8 @@ void sub_8184DA4(u8 arg0)
{
sBattleRecords[i][j] |= 0xFF;
}
sRecordedBattle_BattleFlags = gBattleTypeFlags;
sRecordedBattle_AI_Scripts = gBattleResources->ai->aiFlags;
sBattleFlags = gBattleTypeFlags;
sAI_Scripts = gBattleResources->ai->aiFlags;
}
}
}
@ -139,7 +139,7 @@ void sub_8184E58(void)
if (sUnknown_0203C7AC == 1)
{
gRecordedBattleRngSeed = gRngValue;
sRecordedBattle_FrontierFacility = VarGet(VAR_FRONTIER_FACILITY);
sFrontierFacility = VarGet(VAR_FRONTIER_FACILITY);
sUnknown_0203C7AF = sub_81A513C();
}
else if (sUnknown_0203C7AC == 2)
@ -157,37 +157,37 @@ void sub_8184E58(void)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
sRecordedBattle_Players[i].trainerId = gLinkPlayers[i].trainerId;
sRecordedBattle_Players[i].gender = gLinkPlayers[i].gender;
sRecordedBattle_Players[i].battlerId = gLinkPlayers[i].lp_field_18;
sRecordedBattle_Players[i].language = gLinkPlayers[i].language;
sPlayers[i].trainerId = gLinkPlayers[i].trainerId;
sPlayers[i].gender = gLinkPlayers[i].gender;
sPlayers[i].battlerId = gLinkPlayers[i].lp_field_18;
sPlayers[i].language = gLinkPlayers[i].language;
if (i < linkPlayersCount)
{
StringCopy(text, gLinkPlayers[i].name);
StripExtCtrlCodes(text);
StringCopy(sRecordedBattle_Players[i].name, text);
StringCopy(sPlayers[i].name, text);
}
else
{
for (j = 0; j < PLAYER_NAME_LENGTH; j++)
sRecordedBattle_Players[i].name[j] = gLinkPlayers[i].name[j];
sPlayers[i].name[j] = gLinkPlayers[i].name[j];
}
}
}
else
{
sRecordedBattle_Players[0].trainerId = (gSaveBlock2Ptr->playerTrainerId[0])
sPlayers[0].trainerId = (gSaveBlock2Ptr->playerTrainerId[0])
| (gSaveBlock2Ptr->playerTrainerId[1] << 8)
| (gSaveBlock2Ptr->playerTrainerId[2] << 16)
| (gSaveBlock2Ptr->playerTrainerId[3] << 24);
sRecordedBattle_Players[0].gender = gSaveBlock2Ptr->playerGender;
sRecordedBattle_Players[0].battlerId = 0;
sRecordedBattle_Players[0].language = gGameLanguage;
sPlayers[0].gender = gSaveBlock2Ptr->playerGender;
sPlayers[0].battlerId = 0;
sPlayers[0].language = gGameLanguage;
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
sRecordedBattle_Players[0].name[i] = gSaveBlock2Ptr->playerName[i];
sPlayers[0].name[i] = gSaveBlock2Ptr->playerName[i];
}
}
@ -214,7 +214,7 @@ void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear)
u8 RecordedBattle_GetBattlerAction(u8 battlerId)
{
// trying to read past array or invalid action byte, battle is over
// Trying to read past array or invalid action byte, battle is over.
if (sRecordedBytesNo[battlerId] >= BATTLER_RECORD_SIZE || sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == 0xFF)
{
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; // hah
@ -345,37 +345,37 @@ u32 MoveRecordedBattleToSaveData(void)
{
for (j = 0; j < PLAYER_NAME_LENGTH; j++)
{
battleSave->playersName[i][j] = sRecordedBattle_Players[i].name[j];
battleSave->playersName[i][j] = sPlayers[i].name[j];
}
battleSave->playersGender[i] = sRecordedBattle_Players[i].gender;
battleSave->playersLanguage[i] = sRecordedBattle_Players[i].language;
battleSave->playersBattlers[i] = sRecordedBattle_Players[i].battlerId;
battleSave->playersTrainerId[i] = sRecordedBattle_Players[i].trainerId;
battleSave->playersGender[i] = sPlayers[i].gender;
battleSave->playersLanguage[i] = sPlayers[i].language;
battleSave->playersBattlers[i] = sPlayers[i].battlerId;
battleSave->playersTrainerId[i] = sPlayers[i].trainerId;
}
battleSave->rngSeed = gRecordedBattleRngSeed;
if (sRecordedBattle_BattleFlags & BATTLE_TYPE_LINK)
if (sBattleFlags & BATTLE_TYPE_LINK)
{
battleSave->battleFlags = (sRecordedBattle_BattleFlags & ~(BATTLE_TYPE_LINK | BATTLE_TYPE_20));
battleSave->battleFlags = (sBattleFlags & ~(BATTLE_TYPE_LINK | BATTLE_TYPE_20));
battleSave->battleFlags |= BATTLE_TYPE_x2000000;
if (sRecordedBattle_BattleFlags & BATTLE_TYPE_WILD)
if (sBattleFlags & BATTLE_TYPE_WILD)
{
battleSave->battleFlags |= BATTLE_TYPE_x80000000;
}
else if (sRecordedBattle_BattleFlags & BATTLE_TYPE_MULTI)
else if (sBattleFlags & BATTLE_TYPE_MULTI)
{
switch (sRecordedBattle_Players[0].battlerId)
switch (sPlayers[0].battlerId)
{
case 0:
case 2:
if (!(sRecordedBattle_Players[gUnknown_0203C7B4].battlerId & 1))
if (!(sPlayers[gUnknown_0203C7B4].battlerId & 1))
battleSave->battleFlags |= BATTLE_TYPE_x80000000;
break;
case 1:
case 3:
if ((sRecordedBattle_Players[gUnknown_0203C7B4].battlerId & 1))
if ((sPlayers[gUnknown_0203C7B4].battlerId & 1))
battleSave->battleFlags |= BATTLE_TYPE_x80000000;
break;
}
@ -383,7 +383,7 @@ u32 MoveRecordedBattleToSaveData(void)
}
else
{
battleSave->battleFlags = sRecordedBattle_BattleFlags;
battleSave->battleFlags = sBattleFlags;
}
battleSave->opponentA = gTrainerBattleOpponent_A;
@ -391,11 +391,11 @@ u32 MoveRecordedBattleToSaveData(void)
battleSave->partnerId = gPartnerTrainerId;
battleSave->field_4FA = gUnknown_0203C7B4;
battleSave->field_4FC = gSaveBlock2Ptr->field_CA9_b;
battleSave->field_4FD = sRecordedBattle_FrontierFacility;
battleSave->field_4FD = sFrontierFacility;
battleSave->field_4FE = sUnknown_0203C7AF;
battleSave->battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
battleSave->textSpeed = gSaveBlock2Ptr->optionsTextSpeed;
battleSave->AI_scripts = sRecordedBattle_AI_Scripts;
battleSave->AI_scripts = sAI_Scripts;
/* Can't match it without proper knowledge of the Saveblock 2.
if (gTrainerBattleOpponent_A >= 300 && gTrainerBattleOpponent_A <= 399)
@ -525,7 +525,7 @@ _0818535E:\n\
lsls r3, 3\n\
adds r3, r7, r3\n\
str r3, [sp, 0x8]\n\
ldr r5, =sRecordedBattle_Players\n\
ldr r5, =sPlayers\n\
mov r8, r6\n\
mov r12, r6\n\
movs r4, 0x96\n\
@ -536,7 +536,7 @@ _0818535E:\n\
adds r4, r7, r0\n\
_081853AC:\n\
lsls r1, r6, 3\n\
ldr r0, =sRecordedBattle_Players\n\
ldr r0, =sPlayers\n\
adds r0, 0x4\n\
mov r3, r8\n\
adds r2, r3, r0\n\
@ -578,7 +578,7 @@ _081853BA:\n\
ldr r5, =gRecordedBattleRngSeed\n\
ldr r0, [r5]\n\
str r0, [r1]\n\
ldr r0, =sRecordedBattle_BattleFlags\n\
ldr r0, =sBattleFlags\n\
ldr r2, [r0]\n\
movs r0, 0x2\n\
ands r0, r2\n\
@ -608,7 +608,7 @@ _08185454:\n\
ands r2, r0\n\
cmp r2, 0\n\
beq _081854E2\n\
ldr r2, =sRecordedBattle_Players\n\
ldr r2, =sPlayers\n\
ldrh r0, [r2, 0xE]\n\
cmp r0, 0x1\n\
beq _081854A8\n\
@ -630,7 +630,7 @@ _0818547E:\n\
lsls r0, r1, 2\n\
adds r0, r1\n\
lsls r0, 2\n\
ldr r4, =sRecordedBattle_Players\n\
ldr r4, =sPlayers\n\
adds r0, r4\n\
ldrh r1, [r0, 0xE]\n\
movs r0, 0x1\n\
@ -647,7 +647,7 @@ _081854A8:\n\
lsls r0, r1, 2\n\
adds r0, r1\n\
lsls r0, 2\n\
ldr r1, =sRecordedBattle_Players\n\
ldr r1, =sPlayers\n\
adds r0, r1\n\
ldrh r1, [r0, 0xE]\n\
movs r0, 0x1\n\
@ -700,7 +700,7 @@ _081854E2:\n\
ldr r5, =0x000004fc\n\
adds r1, r7, r5\n\
strb r0, [r1]\n\
ldr r0, =sRecordedBattle_FrontierFacility\n\
ldr r0, =sFrontierFacility\n\
ldrb r1, [r0]\n\
adds r2, 0x3\n\
adds r0, r7, r2\n\
@ -735,7 +735,7 @@ _081854E2:\n\
movs r2, 0xA0\n\
lsls r2, 3\n\
adds r1, r7, r2\n\
ldr r3, =sRecordedBattle_AI_Scripts\n\
ldr r3, =sAI_Scripts\n\
ldr r0, [r3]\n\
str r0, [r1]\n\
ldr r4, =0xfffffed4\n\
@ -1354,11 +1354,11 @@ static void SetRecordedBattleVarsFromSave(struct RecordedBattleSave *src)
gPartnerTrainerId = src->partnerId;
gUnknown_0203C7B4 = src->field_4FA;
sUnknown_0203C7AD = gSaveBlock2Ptr->frontierChosenLvl;
sRecordedBattle_FrontierFacility = src->field_4FD;
sFrontierFacility = src->field_4FD;
sUnknown_0203C7AF = src->field_4FE;
sRecordedBattle_BattleStyle = src->battleStyle;
sRecordedBattle_TextSpeed = src->textSpeed;
sRecordedBattle_AI_Scripts = src->AI_scripts;
sBattleStyle = src->battleStyle;
sTextSpeed = src->textSpeed;
sAI_Scripts = src->AI_scripts;
for (i = 0; i < 8; i++)
{
@ -1417,7 +1417,7 @@ static void CB2_RecordedBattle(void)
u8 GetRecordedBattleFrontierFacility(void)
{
return sRecordedBattle_FrontierFacility;
return sFrontierFacility;
}
u8 sub_8185EAC(void)
@ -1480,12 +1480,12 @@ u8 sub_8185FAC(void)
u8 GetBattleStyleInRecordedBattle(void)
{
return sRecordedBattle_BattleStyle;
return sBattleStyle;
}
u8 GetTextSpeedInRecordedBattle(void)
{
return sRecordedBattle_TextSpeed;
return sTextSpeed;
}
void RecordedBattle_CopyBattlerMoves(void)
@ -1501,7 +1501,7 @@ void RecordedBattle_CopyBattlerMoves(void)
for (i = 0; i < 4; i++)
{
sRecordedBattle_PlayerMonMoves[gActiveBattler / 2][i] = gBattleMons[gActiveBattler].moves[i];
sPlayerMonMoves[gActiveBattler / 2][i] = gBattleMons[gActiveBattler].moves[i];
}
}
@ -1522,7 +1522,7 @@ void sub_818603C(u8 arg0)
{
for (j = 0; j < 4; j++)
{
if (gBattleMons[battlerId].moves[j] != sRecordedBattle_PlayerMonMoves[battlerId / 2][j])
if (gBattleMons[battlerId].moves[j] != sPlayerMonMoves[battlerId / 2][j])
break;
}
if (j != 4) // player's mon's move has been changed
@ -1532,7 +1532,7 @@ void sub_818603C(u8 arg0)
{
for (k = 0; k < 4; k++)
{
if (gBattleMons[battlerId].moves[j] == sRecordedBattle_PlayerMonMoves[battlerId / 2][k])
if (gBattleMons[battlerId].moves[j] == sPlayerMonMoves[battlerId / 2][k])
{
RecordedBattle_SetBattlerAction(battlerId, k);
break;
@ -1612,7 +1612,7 @@ void sub_818603C(u8 arg0)
u32 GetAiScriptsInRecordedBattle(void)
{
return sRecordedBattle_AI_Scripts;
return sAI_Scripts;
}
void sub_8186444(void)