Merge remote-tracking branch 'RHH_origin/master' into RHH/pr/configRefactor

# Conflicts:
#	include/constants/battle_config.h
This commit is contained in:
Eduardo Quezada 2022-09-06 15:20:54 -04:00
commit 3a6318f1d9
70 changed files with 403 additions and 371 deletions

View File

@ -435,11 +435,15 @@ AI_CGM_BetterWhenAudienceExcited:
AI_CGM_BetterWhenAudienceExcited_1stUp:
@ BUG: Should be if_appeal_num_eq 0
@ 1st up on 1st appeal excitement will always be 0
if_appeal_num_not_eq 0, AI_CGM_BetterWhenAudienceExcited_Not1stAppeal
.ifdef BUGFIX
if_appeal_num_eq 0, AI_CGM_BetterWhenAudienceExcited_1stAppeal
.else
if_appeal_num_not_eq 0, AI_CGM_BetterWhenAudienceExcited_1stAppeal
.endif
if_excitement_eq 4, AI_CGM_BetterWhenAudienceExcited_1AwayFromMax
if_excitement_eq 3, AI_CGM_BetterWhenAudienceExcited_2AwayFromMax
end
AI_CGM_BetterWhenAudienceExcited_Not1stAppeal:
AI_CGM_BetterWhenAudienceExcited_1stAppeal:
if_random_less_than 125, AI_CGM_End
score -15
end
@ -542,7 +546,11 @@ AI_CGM_TargetMonWithJudgesAttention:
end
AI_CGM_TargetMonWithJudgesAttention_CheckMon1:
if_cannot_participate MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2
.ifdef BUGFIX
if_not_used_combo_starter MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2
.else
if_used_combo_starter MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2
.endif
if_random_less_than 125, AI_CGM_TargetMonWithJudgesAttention_CheckMon2
score +2
if_not_completed_combo MON_1, AI_CGM_TargetMonWithJudgesAttention_CheckMon2
@ -551,7 +559,11 @@ AI_CGM_TargetMonWithJudgesAttention_CheckMon1:
AI_CGM_TargetMonWithJudgesAttention_CheckMon2:
if_user_order_eq MON_2, AI_CGM_End
if_cannot_participate MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3
.ifdef BUGFIX
if_not_used_combo_starter MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3
.else
if_used_combo_starter MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3
.endif
if_random_less_than 125, AI_CGM_TargetMonWithJudgesAttention_CheckMon3
score +2
if_not_completed_combo MON_2, AI_CGM_TargetMonWithJudgesAttention_CheckMon3
@ -560,7 +572,11 @@ AI_CGM_TargetMonWithJudgesAttention_CheckMon2:
AI_CGM_TargetMonWithJudgesAttention_CheckMon3:
if_user_order_eq MON_3, AI_CGM_End
if_cannot_participate MON_3, AI_CGM_End
.ifdef BUGFIX
if_not_used_combo_starter MON_3, AI_CGM_End
.else
if_used_combo_starter MON_3, AI_CGM_End
.endif
if_random_less_than 125, AI_CGM_End
score +2
if_not_completed_combo MON_3, AI_CGM_End

View File

@ -51,7 +51,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18",
"flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18"
"flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18"
},
{
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",

View File

@ -25,7 +25,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "AbandonedShip_Room_B1F_EventScript_ItemTM13",
"flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13"
"flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13"
}
],
"warp_events": [

View File

@ -25,7 +25,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "MeteorFalls_1F_1R_EventScript_ItemTM23",
"flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23"
"flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM23"
},
{
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",

View File

@ -25,7 +25,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "MeteorFalls_B1F_2R_EventScript_ItemTM02",
"flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02"
"flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02"
}
],
"warp_events": [

View File

@ -38,7 +38,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "MtPyre_6F_EventScript_ItemTM30",
"flag": "FLAG_ITEM_MT_PYRE_6F_TM_30"
"flag": "FLAG_ITEM_MT_PYRE_6F_TM30"
},
{
"graphics_id": "OBJ_EVENT_GFX_PSYCHIC_M",

View File

@ -38,7 +38,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "MtPyre_Exterior_EventScript_ItemTM48",
"flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48"
"flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM48"
}
],
"warp_events": [

View File

@ -262,7 +262,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "Route111_EventScript_ItemTM37",
"flag": "FLAG_ITEM_ROUTE_111_TM_37"
"flag": "FLAG_ITEM_ROUTE_111_TM37"
},
{
"graphics_id": "OBJ_EVENT_GFX_BERRY_TREE",

View File

@ -451,7 +451,7 @@
"y": 5,
"elevation": 3,
"item": "ITEM_TM32",
"flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM_32"
"flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM32"
},
{
"type": "hidden_item",

View File

@ -166,7 +166,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "Route115_EventScript_ItemTM01",
"flag": "FLAG_ITEM_ROUTE_115_TM_01"
"flag": "FLAG_ITEM_ROUTE_115_TM01"
},
{
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",

View File

@ -49,7 +49,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "SafariZone_Northwest_EventScript_ItemTM22",
"flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22"
"flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22"
}
],
"warp_events": [],

View File

@ -25,7 +25,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "ScorchedSlab_EventScript_ItemTM11",
"flag": "FLAG_ITEM_SCORCHED_SLAB_TM_11"
"flag": "FLAG_ITEM_SCORCHED_SLAB_TM11"
}
],
"warp_events": [

View File

@ -90,7 +90,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "SeafloorCavern_Room9_EventScript_ItemTM26",
"flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26"
"flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26"
},
{
"graphics_id": "OBJ_EVENT_GFX_KYOGRE_ASLEEP",

View File

@ -25,7 +25,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "ShoalCave_LowTideIceRoom_EventScript_ItemTM07",
"flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07"
"flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07"
},
{
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",

View File

@ -246,7 +246,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "VictoryRoad_B1F_EventScript_ItemTM29",
"flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM_29"
"flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM29"
},
{
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",

View File

@ -103,7 +103,7 @@ typedef void (*AffineAnimCmdFunc)(u8 matrixNum, struct Sprite *);
#define DUMMY_OAM_DATA \
{ \
.y = DISPLAY_HEIGHT, \
.affineMode = 0, \
.affineMode = ST_OAM_AFFINE_OFF, \
.objMode = 0, \
.mosaic = FALSE, \
.bpp = 0, \

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

@ -14,9 +14,8 @@
#include "pokeball.h"
#include "battle_debug.h"
#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
#define GET_BATTLER_SIDE2(battler) (gBattlerPositions[battler] & BIT_SIDE)
// Used to exclude moves learned temporarily by Transform or Mimic
#define MOVE_IS_PERMANENT(battler, moveSlot) \
@ -515,7 +514,7 @@ struct BattleStruct
u8 faintedActionsState;
u8 faintedActionsBattlerId;
u32 expValue;
u8 field_52;
u8 scriptPartyIdx; // for printing the nickname
u8 sentInPokes;
bool8 selectionScriptFinished[MAX_BATTLERS_COUNT];
u8 battlerPartyIndexes[MAX_BATTLERS_COUNT];
@ -764,7 +763,7 @@ struct BattleHealthboxInfo
u8 specialAnimActive:1; // x40
u8 triedShinyMonAnim:1;
u8 finishedShinyMonAnim:1;
u8 field_1_x1E:4;
u8 opponentDrawPartyStatusSummaryDelay:4;
u8 bgmRestored:1;
u8 waitForCry:1;
u8 healthboxSlideInStarted:1;

View File

@ -5,7 +5,7 @@
#define AI_IS_FASTER 0
#define AI_IS_SLOWER 1
#define FOE(battler) ((battler ^ BIT_SIDE) & BIT_SIDE)
#define FOE(battler) ((BATTLE_OPPOSITE(battler)) & BIT_SIDE)
bool32 AI_RandLessThan(u8 val);
void RecordLastUsedMoveByTarget(void);

View File

@ -208,9 +208,7 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
// emitters
void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck);
void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused
void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data);
void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused
void BtlController_EmitLoadMonSprite(u8 bufferId);
void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
void BtlController_EmitReturnMonToBall(u8 bufferId, bool8 skipAnim);
@ -218,10 +216,7 @@ void BtlController_EmitDrawTrainerPic(u8 bufferId);
void BtlController_EmitTrainerSlide(u8 bufferId);
void BtlController_EmitTrainerSlideBack(u8 bufferId);
void BtlController_EmitFaintAnimation(u8 bufferId);
void BtlController_EmitPaletteFade(u8 bufferId); // unused
void BtlController_EmitSuccessBallThrowAnim(u8 bufferId); // unused
void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId);
void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data); // unused
void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit);
void BtlController_EmitPrintString(u8 bufferId, u16 stringId);
void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId);
@ -230,24 +225,15 @@ void BtlController_EmitYesNoBox(u8 bufferId);
void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData);
void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder);
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u16 abilityId, u8 *data);
void BtlController_EmitCmd23(u8 bufferId); // unused
void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, s32 expPoints);
void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2);
void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
void BtlController_EmitStatusXor(u8 bufferId, u8 b); // unused
void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data);
void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused
void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data); // unused
void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data); // unused
void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u32 ret32);
void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder);
void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret);
void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret);
void BtlController_EmitClearUnkVar(u8 bufferId); // unused
void BtlController_EmitSetUnkVar(u8 bufferId, u8 b); // unused
void BtlController_EmitClearUnkFlag(u8 bufferId); // unused
void BtlController_EmitToggleUnkFlag(u8 bufferId); // unused
void BtlController_EmitHitAnimation(u8 bufferId);
void BtlController_EmitCantSwitch(u8 bufferId);
void BtlController_EmitPlaySE(u8 bufferId, u16 songId);

View File

@ -218,7 +218,7 @@ struct BattleMsgData
u16 lastItem;
u16 lastAbility;
u8 scrActive;
u8 unk1605E;
u8 bakScriptPartyIdx;
u8 hpScale;
u8 itemEffectBattler;
u8 moveType;
@ -309,7 +309,7 @@ extern const u8 gText_OpponentMon1Name[];
extern const u8 gText_Mind[];
extern const u8 gText_Skill[];
extern const u8 gText_Body[];
extern const u8 gText_Judgement[];
extern const u8 gText_Judgment[];
extern const u8 gText_EmptyString3[];
extern const u8 gText_RecordBattleToPass[];
extern const u8 gText_BattleRecordedOnPass[];

View File

@ -31,8 +31,8 @@
#define B_POSITION_OPPONENT_RIGHT 3
// These macros can be used with either battler ID or positions to get the partner or the opposite mon
#define BATTLE_OPPOSITE(id) ((id) ^ 1)
#define BATTLE_PARTNER(id) ((id) ^ 2)
#define BATTLE_OPPOSITE(id) ((id) ^ BIT_SIDE)
#define BATTLE_PARTNER(id) ((id) ^ BIT_FLANK)
#define B_SIDE_PLAYER 0
#define B_SIDE_OPPONENT 1
@ -460,8 +460,8 @@
#define ARENA_WIN_MIND 18
#define ARENA_WIN_SKILL 19
#define ARENA_WIN_BODY 20
#define ARENA_WIN_JUDGEMENT_TITLE 21
#define ARENA_WIN_JUDGEMENT_TEXT 22
#define ARENA_WIN_JUDGMENT_TITLE 21
#define ARENA_WIN_JUDGMENT_TEXT 22
// Flag for BattlePutTextOnWindow. Never set
#define B_WIN_COPYTOVRAM (1 << 7)

View File

@ -120,6 +120,7 @@
#define B_LURE_BALL_MODIFIER GEN_LATEST // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3.
#define B_HEAVY_BALL_MODIFIER GEN_LATEST // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow.
#define B_DREAM_BALL_MODIFIER GEN_LATEST // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose.
#define B_SPORT_BALL_MODIFIER GEN_LATEST // In Gen8, Sport Ball's catch multiplier was reduced from x1.5 to x1.
#define B_SERENE_GRACE_BOOST GEN_LATEST // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang.
// Flag settings

View File

@ -568,7 +568,7 @@
#define FLAG_HIDDEN_ITEM_LILYCOVE_CITY_HEART_SCALE (FLAG_HIDDEN_ITEMS_START + 0x1B)
#define FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET (FLAG_HIDDEN_ITEMS_START + 0x1C)
#define FLAG_HIDDEN_ITEM_MT_PYRE_EXTERIOR_ULTRA_BALL (FLAG_HIDDEN_ITEMS_START + 0x1D)
#define FLAG_HIDDEN_ITEM_ROUTE_113_TM_32 (FLAG_HIDDEN_ITEMS_START + 0x1E)
#define FLAG_HIDDEN_ITEM_ROUTE_113_TM32 (FLAG_HIDDEN_ITEMS_START + 0x1E)
#define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY (FLAG_HIDDEN_ITEMS_START + 0x1F)
#define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY (FLAG_HIDDEN_ITEMS_START + 0x20)
#define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY (FLAG_HIDDEN_ITEMS_START + 0x21)
@ -1053,7 +1053,7 @@
#define FLAG_ITEM_ROUTE_109_PP_UP 0x3ED
#define FLAG_ITEM_ROUTE_109_RARE_CANDY 0x3EE
#define FLAG_ITEM_ROUTE_110_DIRE_HIT 0x3EF
#define FLAG_ITEM_ROUTE_111_TM_37 0x3F0
#define FLAG_ITEM_ROUTE_111_TM37 0x3F0
#define FLAG_ITEM_ROUTE_111_STARDUST 0x3F1
#define FLAG_ITEM_ROUTE_111_HP_UP 0x3F2
#define FLAG_ITEM_ROUTE_112_NUGGET 0x3F3
@ -1062,7 +1062,7 @@
#define FLAG_ITEM_ROUTE_114_RARE_CANDY 0x3F6
#define FLAG_ITEM_ROUTE_114_PROTEIN 0x3F7
#define FLAG_ITEM_ROUTE_115_SUPER_POTION 0x3F8
#define FLAG_ITEM_ROUTE_115_TM_01 0x3F9
#define FLAG_ITEM_ROUTE_115_TM01 0x3F9
#define FLAG_ITEM_ROUTE_115_IRON 0x3FA
#define FLAG_ITEM_ROUTE_116_ETHER 0x3FB
#define FLAG_ITEM_ROUTE_116_REPEL 0x3FC
@ -1089,7 +1089,7 @@
#define FLAG_ITEM_RUSTBORO_CITY_X_DEFEND 0x411
#define FLAG_ITEM_LILYCOVE_CITY_MAX_REPEL 0x412
#define FLAG_ITEM_MOSSDEEP_CITY_NET_BALL 0x413
#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23 0x414
#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM23 0x414
#define FLAG_ITEM_METEOR_FALLS_1F_1R_FULL_HEAL 0x415
#define FLAG_ITEM_METEOR_FALLS_1F_1R_MOON_STONE 0x416
#define FLAG_ITEM_METEOR_FALLS_1F_1R_PP_UP 0x417
@ -1119,35 +1119,35 @@
#define FLAG_ITEM_AQUA_HIDEOUT_B1F_MAX_ELIXIR 0x42F
#define FLAG_ITEM_AQUA_HIDEOUT_B2F_NEST_BALL 0x430
#define FLAG_ITEM_MT_PYRE_EXTERIOR_MAX_POTION 0x431
#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48 0x432
#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM48 0x432
#define FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL 0x433
#define FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE 0x434
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL 0x435
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER 0x436
#define FLAG_ITEM_SCORCHED_SLAB_TM_11 0x437
#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02 0x438
#define FLAG_ITEM_SCORCHED_SLAB_TM11 0x437
#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02 0x438
#define FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL 0x439
#define FLAG_ITEM_SHOAL_CAVE_INNER_ROOM_RARE_CANDY 0x43A
#define FLAG_ITEM_SHOAL_CAVE_STAIRS_ROOM_ICE_HEAL 0x43B
#define FLAG_ITEM_VICTORY_ROAD_1F_MAX_ELIXIR 0x43C
#define FLAG_ITEM_VICTORY_ROAD_1F_PP_UP 0x43D
#define FLAG_ITEM_VICTORY_ROAD_B1F_TM_29 0x43E
#define FLAG_ITEM_VICTORY_ROAD_B1F_TM29 0x43E
#define FLAG_ITEM_VICTORY_ROAD_B1F_FULL_RESTORE 0x43F
#define FLAG_ITEM_VICTORY_ROAD_B2F_FULL_HEAL 0x440
#define FLAG_ITEM_MT_PYRE_6F_TM_30 0x441
#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26 0x442
#define FLAG_ITEM_MT_PYRE_6F_TM30 0x441
#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26 0x442
#define FLAG_ITEM_FIERY_PATH_TM06 0x443
#define FLAG_ITEM_ROUTE_124_RED_SHARD 0x444
#define FLAG_ITEM_ROUTE_124_BLUE_SHARD 0x445
#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22 0x446
#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22 0x446
#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_1F_HARBOR_MAIL 0x447
#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_ESCAPE_ROPE 0x448
#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_B1F_DIVE_BALL 0x449
#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13 0x44A
#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13 0x44A
#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_1F_REVIVE 0x44B
#define FLAG_ITEM_ABANDONED_SHIP_CAPTAINS_OFFICE_STORAGE_KEY 0x44C
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_3_WATER_STONE 0x44D
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18 0x44E
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18 0x44E
#define FLAG_ITEM_ROUTE_121_CARBOS 0x44F
#define FLAG_ITEM_ROUTE_123_ULTRA_BALL 0x450
#define FLAG_ITEM_ROUTE_126_GREEN_SHARD 0x451
@ -1157,7 +1157,7 @@
#define FLAG_ITEM_ROUTE_123_ELIXIR 0x455
#define FLAG_ITEM_NEW_MAUVILLE_THUNDER_STONE 0x456
#define FLAG_ITEM_FIERY_PATH_FIRE_STONE 0x457
#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07 0x458
#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07 0x458
#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_NEVER_MELT_ICE 0x459
#define FLAG_ITEM_ROUTE_103_GUARD_SPEC 0x45A
#define FLAG_ITEM_ROUTE_104_X_ACCURACY 0x45B

View File

@ -9010,8 +9010,8 @@ extern const u16 gTilesetAnims_BattleDomePals0_1[];
extern const u16 gTilesetAnims_BattleDomePals0_2[];
extern const u16 gTilesetAnims_BattleDomePals0_3[];
extern const u32 gBattleArenaJudgementSymbolsGfx[];
extern const u32 gBattleArenaJudgementSymbolsPalette[];
extern const u32 gBattleArenaJudgmentSymbolsGfx[];
extern const u32 gBattleArenaJudgmentSymbolsPalette[];
extern const u32 gBattleWindowTextPalette[];

View File

@ -142,7 +142,7 @@ struct PokemonSubstruct3
/* 0x02 */ u16 metLevel:7;
/* 0x02 */ u16 metGame:4;
/* 0x03 */ u16 unused3_3:4;
/* 0x03 */ u16 unused1:4;
/* 0x03 */ u16 otGender:1;
/* 0x04 */ u32 hpIV:5;
@ -152,6 +152,7 @@ struct PokemonSubstruct3
/* 0x05 */ u32 spAttackIV:5;
/* 0x06 */ u32 spDefenseIV:5;
/* 0x07 */ u32 isEgg:1;
/* 0x07 */ u32 unused2:1;
/* 0x08 */ u32 coolRibbon:3;
/* 0x08 */ u32 beautyRibbon:3;

View File

@ -488,7 +488,7 @@ static u8 ChooseMoveOrAction_Doubles(void)
bestMovePointsForTarget[i] = mostViableMovesScores[0];
// Don't use a move against ally if it has less than 100 points.
if (i == (sBattler_AI ^ BIT_FLANK) && bestMovePointsForTarget[i] < 100)
if (i == BATTLE_PARTNER(sBattler_AI) && bestMovePointsForTarget[i] < 100)
{
bestMovePointsForTarget[i] = -1;
mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match.

View File

@ -446,10 +446,10 @@ bool32 ShouldSwitch(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
battlerIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)])
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))])
battlerIn2 = gActiveBattler;
else
battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK);
battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)));
}
else
{
@ -537,7 +537,7 @@ void AI_TrySwitchOrUseItem(void)
else
{
battlerIn1 = GetBattlerAtPosition(battlerIdentity);
battlerIn2 = GetBattlerAtPosition(battlerIdentity ^ BIT_FLANK);
battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(battlerIdentity));
}
GetAIPartyIndexes(gActiveBattler, &firstId, &lastId);
@ -571,7 +571,7 @@ void AI_TrySwitchOrUseItem(void)
}
}
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8);
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, BATTLE_OPPOSITE(gActiveBattler) << 8);
}
// If there are two(or more) mons to choose from, always choose one that has baton pass
@ -719,10 +719,10 @@ u8 GetMostSuitableMonToSwitchInto(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
battlerIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)])
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))])
battlerIn2 = gActiveBattler;
else
battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK);
battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)));
opposingBattler = BATTLE_OPPOSITE(battlerIn1);
if (gAbsentBattlerFlags & gBitTable[opposingBattler])
@ -730,7 +730,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
}
else
{
opposingBattler = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_SIDE);
opposingBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler)));
battlerIn1 = gActiveBattler;
battlerIn2 = gActiveBattler;
}

View File

@ -3271,7 +3271,7 @@ s32 CountUsablePartyMons(u8 battlerId)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
battlerOnField1 = gBattlerPartyIndexes[battlerId];
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_FLANK)];
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battlerId)))];
}
else // In singles there's only one battlerId by side.
{

View File

@ -927,7 +927,7 @@ static void Cmd_clearmonbg(void)
if (sMonAnimTaskIdArray[0] != TASK_NONE)
gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE;
if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != TASK_NONE)
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE;
gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE;
else
animBattlerId = 0;
@ -1034,8 +1034,8 @@ static void Cmd_clearmonbg_static(void)
if (IsBattlerSpriteVisible(battlerId))
gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE;
if (animBattlerId > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE;
if (animBattlerId > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId)))
gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battlerId)]].invisible = FALSE;
else
animBattlerId = 0;
@ -1061,7 +1061,7 @@ static void Task_ClearMonBgStatic(u8 taskId)
if (IsBattlerSpriteVisible(battlerId))
ResetBattleAnimBg(toBG_2);
if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(BATTLE_PARTNER(battlerId)))
ResetBattleAnimBg(toBG_2 ^ 1);
DestroyTask(taskId);

View File

@ -199,7 +199,7 @@ static void AnimMegahornHorn(struct Sprite *sprite)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
}
else if (!GetBattlerSide(gBattleAnimTarget))
else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
StartSpriteAffineAnim(sprite, 1);
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
@ -226,7 +226,7 @@ static void AnimLeechLifeNeedle(struct Sprite *sprite)
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
StartSpriteAffineAnim(sprite, 2);
}
else if (!GetBattlerSide(gBattleAnimTarget))
else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
@ -297,7 +297,7 @@ static void AnimStringWrap(struct Sprite *sprite)
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
if (!GetBattlerSide(gBattleAnimTarget))
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
sprite->y += 8;
sprite->callback = AnimStringWrap_Step;

View File

@ -859,8 +859,8 @@ void AnimTask_InitMementoShadow(u8 taskId)
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
{
MoveBattlerSpriteToBG(gBattleAnimAttacker ^ 2, toBG2 ^ 1, TRUE);
gSprites[gBattlerSpriteIds[gBattleAnimAttacker ^ 2]].invisible = FALSE;
MoveBattlerSpriteToBG(BATTLE_PARTNER(gBattleAnimAttacker), toBG2 ^ 1, TRUE);
gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].invisible = FALSE;
}
DestroyAnimVisualTask(taskId);

View File

@ -1703,7 +1703,7 @@ void AnimTask_AirCutterProjectile(u8 taskId)
}
else
{
if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER)
if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER)
{
gTasks[taskId].data[4] = 1;
gBattleAnimArgs[0] = -gBattleAnimArgs[0];

View File

@ -564,7 +564,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
if (Random2() & 1)
y *= -1;
if ((gBattlerPositions[battler] & BIT_SIDE) == B_SIDE_PLAYER)
if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER)
y += 0xFFF0;
sprite->x += x;

View File

@ -1008,7 +1008,7 @@ static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 activeSpritesId
u16 y = GetEruptionLaunchRockInitialYPos(spriteId);
u16 x = gSprites[spriteId].x;
if(!GetBattlerSide(gBattleAnimAttacker))
if(GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
{
x -= 12;
sign = 1;
@ -1310,7 +1310,7 @@ void AnimTask_MoveHeatWaveTargets(u8 taskId)
struct Task *task = &gTasks[taskId];
task->data[12] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1;
task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ BIT_FLANK) + 1;
task->data[13] = IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)) + 1;
task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET);
task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER);

View File

@ -906,8 +906,8 @@ static void AnimWhirlwindLine(struct Sprite * sprite)
else
InitSpritePosToAnimTarget(sprite, FALSE);
if ((gBattleAnimArgs[2] == ANIM_ATTACKER && !GetBattlerSide(gBattleAnimAttacker))
|| (gBattleAnimArgs[2] == ANIM_TARGET && !GetBattlerSide(gBattleAnimTarget)))
if ((gBattleAnimArgs[2] == ANIM_ATTACKER && GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|| (gBattleAnimArgs[2] == ANIM_TARGET && GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER))
{
sprite->x += 8;
}

View File

@ -880,7 +880,7 @@ void AnimTask_DestinyBondWhiteShadow(u8 taskId)
for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
{
if (battler != gBattleAnimAttacker
&& battler != (gBattleAnimAttacker ^ 2)
&& battler != BATTLE_PARTNER(gBattleAnimAttacker)
&& IsBattlerSpriteVisible(battler))
{
if (gAnimMoveIndex == MOVE_DARK_VOID

View File

@ -1276,12 +1276,12 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite)
if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2))
sprite->data[7] = 0x8000;
if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER)
if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER)
{
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
if ((sprite->data[7] & 0x8000) && (gBattlerPositions[gBattleAnimAttacker] & BIT_SIDE) == B_SIDE_PLAYER)
if ((sprite->data[7] & 0x8000) && GET_BATTLER_SIDE2(gBattleAnimAttacker) == B_SIDE_PLAYER)
sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
sprite->data[6] = 1;
@ -1541,7 +1541,7 @@ static void AnimHailBegin(struct Sprite *sprite)
sprite->data[3], sprite->data[4], sprite->subpriority);
sprite->data[0] = spriteId;
if (spriteId != 64)
if (spriteId != MAX_SPRITES)
{
gSprites[sprite->data[0]].callback = AnimHailContinue;
gSprites[sprite->data[0]].data[6] = sprite->data[6];

View File

@ -898,11 +898,11 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId)
{
if (gBattleAnimArgs[2] == ANIM_ATTACKER)
{
gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker);
gTasks[taskId].data[7] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER;
}
else
{
gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimTarget);
gTasks[taskId].data[7] = GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER;
}
}
if (gTasks[taskId].data[7])

View File

@ -896,7 +896,7 @@ u8 GetBattlerSide(u8 battlerId)
u8 GetBattlerPosition(u8 battlerId)
{
return GET_BATTLER_POSITION(battlerId);
return gBattlerPositions[battlerId];
}
u8 GetBattlerAtPosition(u8 position)
@ -2534,7 +2534,7 @@ void AnimWeatherBallUp(struct Sprite *sprite)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
if (!GetBattlerSide(gBattleAnimAttacker))
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
sprite->data[0] = 5;
else
sprite->data[0] = -10;
@ -2560,7 +2560,7 @@ void AnimWeatherBallDown(struct Sprite *sprite)
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[2] = sprite->x + gBattleAnimArgs[4];
sprite->data[4] = sprite->y + gBattleAnimArgs[5];
if (!GetBattlerSide(gBattleAnimTarget))
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
x = (u16)gBattleAnimArgs[4] + 30;
sprite->x += x;

View File

@ -6523,7 +6523,7 @@ const struct SpriteTemplate gSoulStealZStarSpriteTemplate =
//general
void AnimTask_IsTargetPartner(u8 taskId)
{
if (gBattleAnimTarget == (gBattleAnimAttacker ^ BIT_FLANK))
if (gBattleAnimTarget == BATTLE_PARTNER(gBattleAnimAttacker))
gBattleAnimArgs[0] = 1;
else
gBattleAnimArgs[0] = 0;

View File

@ -687,7 +687,7 @@ static void AnimDefensiveWall_Step5(struct Sprite *sprite)
if (IsBattlerSpriteVisible(battler))
ResetBattleAnimBg(toBG2);
battler = battlerCopy ^ 2;
battler = BATTLE_PARTNER(battlerCopy);
if (IsBattlerSpriteVisible(battler))
ResetBattleAnimBg(toBG2 ^ var0);
}
@ -1035,7 +1035,7 @@ static void AnimTask_SkillSwap_Step(u8 taskId)
{
task->data[1] = 0;
spriteId = CreateSprite(&gSkillSwapOrbSpriteTemplate, task->data[11], task->data[12], 0);
if (spriteId != 64)
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = 16;
gSprites[spriteId].data[2] = task->data[13];

View File

@ -38,9 +38,9 @@ static void BufferArenaOpponentName(void);
static void SpriteCB_JudgmentIcon(struct Sprite *sprite);
static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler);
#define JUDGEMENT_STATE_FINISHED 8
#define JUDGMENT_STATE_FINISHED 8
#define TAG_JUDGEMENT_ICON 1000
#define TAG_JUDGMENT_ICON 1000
enum {
ANIM_ICON_X, // Player lost
@ -275,7 +275,7 @@ static const s8 sMindRatings[MOVES_COUNT] =
[MOVE_PSYCHO_BOOST] = 1,
};
static const struct OamData sOam_JudgementIcon =
static const struct OamData sOam_JudgmentIcon =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -292,52 +292,52 @@ static const struct OamData sOam_JudgementIcon =
.affineParam = 0
};
static const union AnimCmd sAnim_JudgementIcon_X[] =
static const union AnimCmd sAnim_JudgmentIcon_X[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END
};
static const union AnimCmd sAnim_JudgementIcon_Triangle[] =
static const union AnimCmd sAnim_JudgmentIcon_Triangle[] =
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END
};
static const union AnimCmd sAnim_JudgementIcon_Circle[] =
static const union AnimCmd sAnim_JudgmentIcon_Circle[] =
{
ANIMCMD_FRAME(8, 1),
ANIMCMD_END
};
static const union AnimCmd sAnim_JudgementIcon_Line[] =
static const union AnimCmd sAnim_JudgmentIcon_Line[] =
{
ANIMCMD_FRAME(12, 1),
ANIMCMD_END
};
static const union AnimCmd *const sAnims_JudgementIcon[] =
static const union AnimCmd *const sAnims_JudgmentIcon[] =
{
[ANIM_ICON_X] = sAnim_JudgementIcon_X,
[ANIM_ICON_TRIANGLE] = sAnim_JudgementIcon_Triangle,
[ANIM_ICON_CIRCLE] = sAnim_JudgementIcon_Circle,
[ANIM_ICON_LINE] = sAnim_JudgementIcon_Line,
[ANIM_ICON_X] = sAnim_JudgmentIcon_X,
[ANIM_ICON_TRIANGLE] = sAnim_JudgmentIcon_Triangle,
[ANIM_ICON_CIRCLE] = sAnim_JudgmentIcon_Circle,
[ANIM_ICON_LINE] = sAnim_JudgmentIcon_Line,
};
static const struct SpriteTemplate sSpriteTemplate_JudgmentIcon =
{
.tileTag = TAG_JUDGEMENT_ICON,
.tileTag = TAG_JUDGMENT_ICON,
.paletteTag = TAG_NONE,
.oam = &sOam_JudgementIcon,
.anims = sAnims_JudgementIcon,
.oam = &sOam_JudgmentIcon,
.anims = sAnims_JudgmentIcon,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_JudgmentIcon,
};
static const struct CompressedSpriteSheet sBattleArenaJudgementSymbolsSpriteSheet[] =
static const struct CompressedSpriteSheet sBattleArenaJudgmentSymbolsSpriteSheet[] =
{
{gBattleArenaJudgementSymbolsGfx, 0x200, TAG_JUDGEMENT_ICON},
{gBattleArenaJudgmentSymbolsGfx, 0x200, TAG_JUDGMENT_ICON},
{0}
};
@ -389,8 +389,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
case 0:
BeginNormalPaletteFade(0x7FFFFF1C, 4, 0, 8, RGB_BLACK);
SetGpuReg(REG_OFFSET_WININ, (WININ_WIN0_ALL & ~WININ_WIN0_BG0) | WININ_WIN1_ALL);
LoadCompressedSpriteSheet(sBattleArenaJudgementSymbolsSpriteSheet);
LoadCompressedPalette(gBattleArenaJudgementSymbolsPalette, 0x1F0, 0x20);
LoadCompressedSpriteSheet(sBattleArenaJudgmentSymbolsSpriteSheet);
LoadCompressedPalette(gBattleArenaJudgmentSymbolsPalette, 0x1F0, 0x20);
gBattle_WIN0H = 0xFF;
gBattle_WIN0V = 0x70;
(*state)++;
@ -417,8 +417,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
BattlePutTextOnWindow(gText_Mind, ARENA_WIN_MIND);
BattlePutTextOnWindow(gText_Skill, ARENA_WIN_SKILL);
BattlePutTextOnWindow(gText_Body, ARENA_WIN_BODY);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE);
(*state)++;
}
break;
@ -441,8 +441,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
PlaySE(SE_ARENA_TIMEUP1);
ShowJudgmentSprite(80, 40, ARENA_CATEGORY_MIND, B_POSITION_PLAYER_LEFT);
ShowJudgmentSprite(160, 40, ARENA_CATEGORY_MIND, B_POSITION_OPPONENT_LEFT);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE);
(*state)++;
result = ARENA_RESULT_STEP_DONE;
break;
@ -450,8 +450,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
PlaySE(SE_ARENA_TIMEUP1);
ShowJudgmentSprite(80, 56, ARENA_CATEGORY_SKILL, B_POSITION_PLAYER_LEFT);
ShowJudgmentSprite(160, 56, ARENA_CATEGORY_SKILL, B_POSITION_OPPONENT_LEFT);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE);
(*state)++;
result = ARENA_RESULT_STEP_DONE;
break;
@ -459,8 +459,8 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
PlaySE(SE_ARENA_TIMEUP1);
ShowJudgmentSprite(80, 72, ARENA_CATEGORY_BODY, B_POSITION_PLAYER_LEFT);
ShowJudgmentSprite(160, 72, ARENA_CATEGORY_BODY, B_POSITION_OPPONENT_LEFT);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TITLE);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgment);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TITLE);
(*state)++;
result = ARENA_RESULT_STEP_DONE;
break;
@ -482,11 +482,11 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
}
(*state)++;
break;
case JUDGEMENT_STATE_FINISHED:
// Finishing this state is the indicator to SpriteCB_JudgmentIcon that its safe to destroy the judgement icon sprites
case JUDGMENT_STATE_FINISHED:
// Finishing this state is the indicator to SpriteCB_JudgmentIcon that its safe to destroy the judgment icon sprites
(*state)++;
break;
case JUDGEMENT_STATE_FINISHED + 1:
case JUDGMENT_STATE_FINISHED + 1:
SetGpuReg(REG_OFFSET_WININ, (WININ_WIN0_ALL & ~WININ_WIN0_BG0) | WININ_WIN1_ALL);
HandleBattleWindow(5, 0, 24, 13, WINDOW_CLEAR);
CopyBgTilemapBufferToVram(0);
@ -494,11 +494,11 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
BeginNormalPaletteFade(0x7FFFFF1C, 4, 8, 0, RGB_BLACK);
(*state)++;
break;
case JUDGEMENT_STATE_FINISHED + 2:
case JUDGMENT_STATE_FINISHED + 2:
if (!gPaletteFade.active)
{
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL);
FreeSpriteTilesByTag(TAG_JUDGEMENT_ICON);
FreeSpriteTilesByTag(TAG_JUDGMENT_ICON);
result = ARENA_RESULT_STEP_DONE;
(*state)++;
}
@ -562,7 +562,7 @@ static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler)
static void SpriteCB_JudgmentIcon(struct Sprite *sprite)
{
if (gBattleCommunication[0] > JUDGEMENT_STATE_FINISHED)
if (gBattleCommunication[0] > JUDGMENT_STATE_FINISHED)
DestroySprite(sprite);
}

View File

@ -575,7 +575,7 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] =
.paletteNum = 5,
.baseBlock = 0x013c,
},
[ARENA_WIN_JUDGEMENT_TITLE] = {
[ARENA_WIN_JUDGMENT_TITLE] = {
.bg = 0,
.tilemapLeft = 8,
.tilemapTop = 11,
@ -584,7 +584,7 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] =
.paletteNum = 5,
.baseBlock = 0x0148,
},
[ARENA_WIN_JUDGEMENT_TEXT] = {
[ARENA_WIN_JUDGMENT_TEXT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,

View File

@ -370,9 +370,7 @@ static void TryShinyAnimAfterMonAnim(void)
{
TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]);
}
else
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim)
else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE;
@ -382,7 +380,6 @@ static void TryShinyAnimAfterMonAnim(void)
}
}
}
}
static void CompleteOnHealthbarDone(void)
{
@ -1752,14 +1749,14 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void)
if (gBattleResources->bufferA[gActiveBattler][2] != 0)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++;
return;
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0;
}
}

View File

@ -219,7 +219,7 @@ static void Intro_WaitForHealthbox(void)
else
{
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
{
finished = TRUE;
}
@ -238,7 +238,7 @@ static void Intro_WaitForHealthbox(void)
static void Intro_ShowHealthbox(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive
&& gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1)
@ -247,10 +247,10 @@ static void Intro_ShowHealthbox(void)
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]);
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
}
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);

View File

@ -226,7 +226,7 @@ static void Intro_DelayAndEnd(void)
static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active.
{
return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battlerId ^ BIT_FLANK]]));
return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]]));
}
static void Intro_WaitForShinyAnimAndHealthbox(void)
@ -244,25 +244,25 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
else
{
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
healthboxAnimDone = TRUE;
twoMons = TRUE;
}
gBattleControllerOpponentHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler];
gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK];
gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)];
if (healthboxAnimDone)
{
if (twoMons == TRUE)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
&& gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE;
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
}
@ -273,8 +273,8 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
{
if (GetBattlerPosition(gActiveBattler) == 3)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim)
{
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
@ -308,20 +308,20 @@ static void Intro_TryShinyAnimShowHealthbox(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
&& (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)
&& twoMons
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]);
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim)
TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted)
{
if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT))
{
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
}
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler);
@ -332,7 +332,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry
&& !IsCryPlayingOrClearCrySongs())
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored)
@ -361,8 +361,8 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
{
battlerAnimsDone = TRUE;
}
@ -372,8 +372,8 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{
if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT))
{
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES));
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES));
}
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
@ -1974,14 +1974,14 @@ static void OpponentHandleDrawPartyStatusSummary(void)
if (gBattleResources->bufferA[gActiveBattler][2] != 0)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++;
return;
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0;
}
}

View File

@ -630,7 +630,7 @@ static void HandleInputChooseMove(void)
if (moveTarget & MOVE_TARGET_USER)
gMultiUsePlayerCursor = gActiveBattler;
else
gMultiUsePlayerCursor = GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE);
gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler)));
if (!gBattleResources->bufferA[gActiveBattler][1]) // not a double battle
{
@ -1161,7 +1161,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
healthboxAnimDone = TRUE;
}
else
@ -1172,20 +1172,20 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
// If healthbox and shiny anim are done
if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
&& gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim)
{
// Reset shiny anim (even if it didn't occur)
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE;
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
if (TwoIntroMons(gActiveBattler))
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK);
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3;
gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd;
@ -1203,21 +1203,21 @@ static void Intro_TryShinyAnimShowHealthbox(void)
TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]);
// Start shiny animation if applicable for 2nd pokemon
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]);
if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]);
// Show healthbox after ball anim
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted)
{
if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
}
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler);
@ -1229,7 +1229,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
// Restore bgm after cry has played and healthbox anim is started
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry
&& !IsCryPlayingOrClearCrySongs())
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored)
@ -1248,8 +1248,8 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
{
battlerAnimsDone = TRUE;
}
@ -1267,7 +1267,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
if (bgmRestored && battlerAnimsDone)
{
if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
gBattleSpritesDataPtr->animationData->introAnimActive = FALSE;
@ -1400,7 +1400,7 @@ static void Task_GiveExpToMon(u8 taskId)
gActiveBattler = savedActiveBattler;
if (IsDoubleBattle() == TRUE
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]))
gTasks[taskId].func = Task_LaunchLvlUpAnim;
else
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
@ -1495,7 +1495,7 @@ static void Task_LaunchLvlUpAnim(u8 taskId)
u8 battlerId = gTasks[taskId].tExpTask_battler;
u8 monIndex = gTasks[taskId].tExpTask_monId;
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])
battlerId ^= BIT_FLANK;
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
@ -1512,8 +1512,8 @@ static void Task_UpdateLvlInHealthbox(u8 taskId)
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value.
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL);
else
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL);

View File

@ -233,7 +233,7 @@ static void Intro_WaitForHealthbox(void)
else
{
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
{
finished = TRUE;
}
@ -252,7 +252,7 @@ static void Intro_WaitForHealthbox(void)
static void Intro_ShowHealthbox(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive
&& gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1)
@ -261,10 +261,10 @@ static void Intro_ShowHealthbox(void)
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]);
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
}
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
@ -340,7 +340,7 @@ static void Task_GiveExpToMon(u8 taskId)
gActiveBattler = savedActiveBank;
if (IsDoubleBattle() == TRUE
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]))
gTasks[taskId].func = Task_LaunchLvlUpAnim;
else
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
@ -435,7 +435,7 @@ static void Task_LaunchLvlUpAnim(u8 taskId)
u8 battlerId = gTasks[taskId].tExpTask_bank;
u8 monIndex = gTasks[taskId].tExpTask_monId;
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])
battlerId ^= BIT_FLANK;
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
@ -452,8 +452,8 @@ static void Task_UpdateLvlInHealthbox(u8 taskId)
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL);
else
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL);

View File

@ -228,9 +228,9 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
else
{
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded
&& gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].animEnded)
&& gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].animEnded)
healthboxAnimDone = TRUE;
}
@ -240,13 +240,13 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim)
return;
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim)
return;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE;
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
}
@ -265,19 +265,19 @@ static void Intro_TryShinyAnimShowHealthbox(void)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]);
if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted)
{
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
}
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler);
@ -288,7 +288,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry
&& !IsCryPlayingOrClearCrySongs())
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored)
@ -319,8 +319,8 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
{
battlerAnimsDone = TRUE;
}
@ -330,8 +330,8 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES));
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES));
}
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
@ -1692,14 +1692,14 @@ static void RecordedOpponentHandleDrawPartyStatusSummary(void)
if (gBattleResources->bufferA[gActiveBattler][2] != 0)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E < 2)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E++;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++;
return;
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1E = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0;
}
}

View File

@ -215,27 +215,27 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
else
{
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
{
healthboxAnimDone = TRUE;
}
}
if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
&& gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE;
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
if (IsDoubleBattle())
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK);
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3;
gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd;
@ -251,7 +251,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
else
{
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
{
healthboxAnimDone = TRUE;
}
@ -278,21 +278,21 @@ static void Intro_TryShinyAnimShowHealthbox(void)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]);
if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]);
}
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted)
{
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
}
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler);
@ -303,7 +303,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry
&& !IsCryPlayingOrClearCrySongs())
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored)
@ -327,7 +327,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
{
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
gBattleSpritesDataPtr->animationData->introAnimActive = FALSE;

View File

@ -291,21 +291,21 @@ static void Intro_TryShinyAnimShowHealthbox(void)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]);
if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive)
TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive
&& gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
{
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]);
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
}
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL);
@ -326,13 +326,13 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
healthboxAnimDone = TRUE;
if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
&& gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE;
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);

View File

@ -9,7 +9,6 @@
#include "link.h"
#include "link_rfu.h"
#include "party_menu.h"
#include "pokemon.h"
#include "recorded_battle.h"
#include "task.h"
#include "util.h"
@ -923,7 +922,8 @@ void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes)
// Unused
static void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes)
{
sBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA;
sBattleBuffersTransferData[1] = monId;
@ -944,7 +944,8 @@ void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 b
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 3 + bytes);
}
void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data)
// Unused
static void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data)
{
s32 i;
@ -1017,7 +1018,8 @@ void BtlController_EmitFaintAnimation(u8 bufferId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitPaletteFade(u8 bufferId)
// Unused
static void BtlController_EmitPaletteFade(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE;
sBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE;
@ -1026,7 +1028,8 @@ void BtlController_EmitPaletteFade(u8 bufferId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitSuccessBallThrowAnim(u8 bufferId)
// Unused
static void BtlController_EmitSuccessBallThrowAnim(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM;
sBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM;
@ -1042,7 +1045,8 @@ void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data)
// Unused
static void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data)
{
s32 i;
@ -1099,7 +1103,7 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
stringInfo->lastItem = gLastUsedItem;
stringInfo->lastAbility = gLastUsedAbility;
stringInfo->scrActive = gBattleScripting.battler;
stringInfo->unk1605E = gBattleStruct->field_52;
stringInfo->bakScriptPartyIdx = gBattleStruct->scriptPartyIdx;
stringInfo->hpScale = gBattleStruct->hpScale;
stringInfo->itemEffectBattler = gPotentialItemEffectBattler;
stringInfo->moveType = gBattleMoves[gCurrentMove].type;
@ -1131,7 +1135,7 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
stringInfo->lastItem = gLastUsedItem;
stringInfo->lastAbility = gLastUsedAbility;
stringInfo->scrActive = gBattleScripting.battler;
stringInfo->unk1605E = gBattleStruct->field_52;
stringInfo->bakScriptPartyIdx = gBattleStruct->scriptPartyIdx;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
stringInfo->abilities[i] = gBattleMons[i].ability;
@ -1202,7 +1206,8 @@ void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u16 abil
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // Only 7 bytes were written.
}
void BtlController_EmitCmd23(u8 bufferId)
// Unused
static void BtlController_EmitCmd23(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_23;
sBattleBuffersTransferData[1] = CONTROLLER_23;
@ -1257,7 +1262,8 @@ void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6);
}
void BtlController_EmitStatusXor(u8 bufferId, u8 b)
// Unused
static void BtlController_EmitStatusXor(u8 bufferId, u8 b)
{
sBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR;
sBattleBuffersTransferData[1] = b;
@ -1277,7 +1283,8 @@ void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 4);
}
void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data)
// Unused
static void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data)
{
s32 i;
@ -1294,7 +1301,7 @@ void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data
}
// Unused
void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data)
static void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data)
{
s32 i;
@ -1309,7 +1316,8 @@ void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, songId + 3);
}
void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data)
// Unused
static void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data)
{
s32 i;
@ -1361,7 +1369,8 @@ void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitClearUnkVar(u8 bufferId)
// Unused
static void BtlController_EmitClearUnkVar(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKVAR;
sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKVAR;
@ -1370,14 +1379,16 @@ void BtlController_EmitClearUnkVar(u8 bufferId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitSetUnkVar(u8 bufferId, u8 b)
// Unused
static void BtlController_EmitSetUnkVar(u8 bufferId, u8 b)
{
sBattleBuffersTransferData[0] = CONTROLLER_SETUNKVAR;
sBattleBuffersTransferData[1] = b;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitClearUnkFlag(u8 bufferId)
// Unused
static void BtlController_EmitClearUnkFlag(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKFLAG;
sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKFLAG;
@ -1386,7 +1397,8 @@ void BtlController_EmitClearUnkFlag(u8 bufferId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitToggleUnkFlag(u8 bufferId)
// Unused
static void BtlController_EmitToggleUnkFlag(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_TOGGLEUNKFLAG;
sBattleBuffersTransferData[1] = CONTROLLER_TOGGLEUNKFLAG;

View File

@ -259,7 +259,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
else if (moveTarget == MOVE_TARGET_SELECTED)
chosenMoveId |= GetBattlePalaceTarget();
else
chosenMoveId |= (GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE) << 8);
chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))) << 8);
return chosenMoveId;
}
@ -315,7 +315,7 @@ static u16 GetBattlePalaceTarget(void)
}
if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp)
return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8;
switch (gBattlePalaceNatureToMoveTarget[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)])
{
@ -330,11 +330,11 @@ static u16 GetBattlePalaceTarget(void)
else
return opposing2 << 8;
case PALACE_TARGET_RANDOM:
return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8;
}
}
return (gActiveBattler ^ BIT_SIDE) << 8;
return BATTLE_OPPOSITE(gActiveBattler) << 8;
}
// Wait for the pokemon to finish appearing out from the pokeball on send out
@ -1019,7 +1019,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId)
{
if (!gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong)
{
if (!gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong)
if (!gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong)
PlaySE(SE_LOW_HEALTH);
gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong = 1;
}
@ -1032,7 +1032,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId)
m4aSongNumStop(SE_LOW_HEALTH);
return;
}
if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong)
if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong)
{
m4aSongNumStop(SE_LOW_HEALTH);
return;
@ -1046,7 +1046,7 @@ void BattleStopLowHpSound(void)
gBattleSpritesDataPtr->battlerData[playerBattler].lowHpSong = 0;
if (IsDoubleBattle())
gBattleSpritesDataPtr->battlerData[playerBattler ^ BIT_FLANK].lowHpSong = 0;
gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(playerBattler)].lowHpSong = 0;
m4aSongNumStop(SE_LOW_HEALTH);
}

View File

@ -4271,7 +4271,7 @@ static void HandleTurnActionSelectionState(void)
if (((gBattleTypeFlags & BATTLE_TYPE_MULTI) || !(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|| (position & BIT_FLANK) != B_FLANK_LEFT
|| (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(position ^ BIT_FLANK)]))
|| (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(position))]))
{
BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i);
}
@ -4391,9 +4391,9 @@ static void UpdateBattlerPartyOrdersOnSwitch(void)
*(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0);
*(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[gActiveBattler][3];
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0);
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4;
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3];
*((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0);
*((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4;
*((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3];
}
}

View File

@ -1947,7 +1947,7 @@ const u8 gText_OpponentMon1Name[] = _("{B_OPPONENT_MON1_NAME}");
const u8 gText_Mind[] = _("Mind");
const u8 gText_Skill[] = _("Skill");
const u8 gText_Body[] = _("Body");
const u8 gText_Judgement[] = _("{B_BUFF1}{CLEAR 13}Judgment{CLEAR 13}{B_BUFF2}");
const u8 gText_Judgment[] = _("{B_BUFF1}{CLEAR 13}Judgment{CLEAR 13}{B_BUFF2}");
static const u8 sText_TwoTrainersSentPkmn[] = _("{B_TRAINER1_CLASS} {B_TRAINER1_NAME} sent\nout {B_OPPONENT_MON1_NAME}!\p{B_TRAINER2_CLASS} {B_TRAINER2_NAME} sent\nout {B_OPPONENT_MON2_NAME}!");
static const u8 sText_Trainer2SentOutPkmn[] = _("{B_TRAINER2_CLASS} {B_TRAINER2_NAME} sent\nout {B_BUFF1}!");
static const u8 sText_TwoTrainersWantToBattle[] = _("{B_TRAINER1_CLASS} {B_TRAINER1_NAME} and\n{B_TRAINER2_CLASS} {B_TRAINER2_NAME}\lwant to battle!\p");
@ -2600,7 +2600,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
},
[ARENA_WIN_JUDGEMENT_TITLE] = {
[ARENA_WIN_JUDGMENT_TITLE] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
@ -2612,7 +2612,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
},
[ARENA_WIN_JUDGEMENT_TEXT] = {
[ARENA_WIN_JUDGMENT_TEXT] = {
.fillValue = PIXEL_FILL(0x1),
.fontId = FONT_NORMAL,
.x = 0,
@ -2643,7 +2643,7 @@ void BufferStringBattle(u16 stringID)
gLastUsedItem = gBattleMsgDataPtr->lastItem;
gLastUsedAbility = gBattleMsgDataPtr->lastAbility;
gBattleScripting.battler = gBattleMsgDataPtr->scrActive;
gBattleStruct->field_52 = gBattleMsgDataPtr->unk1605E;
gBattleStruct->scriptPartyIdx = gBattleMsgDataPtr->bakScriptPartyIdx;
gBattleStruct->hpScale = gBattleMsgDataPtr->hpScale;
gPotentialItemEffectBattler = gBattleMsgDataPtr->itemEffectBattler;
gBattleStruct->stringMoveType = gBattleMsgDataPtr->moveType;
@ -2703,7 +2703,7 @@ void BufferStringBattle(u16 stringID)
{
if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY)
stringPtr = sText_LegendaryPkmnAppeared;
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) // interesting, looks like they had something planned for wild double battles
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) // interesting, looks like they had something planned for wild double battles
stringPtr = sText_TwoWildPkmnAppeared;
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
stringPtr = sText_WildPkmnAppearedPause;
@ -2714,7 +2714,7 @@ void BufferStringBattle(u16 stringID)
case STRINGID_INTROSENDOUT: // poke first send-out
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]))
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]))
{
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
stringPtr = sText_InGamePartnerSentOutZGoN;
@ -2732,7 +2732,7 @@ void BufferStringBattle(u16 stringID)
}
else
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]))
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]))
{
if (BATTLE_TWO_VS_ONE_OPPONENT)
stringPtr = sText_Trainer1SentOutTwoPkmn;
@ -3403,11 +3403,11 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
dstID++;
toCpy++;
}
GetMonData(&gEnemyParty[gBattleStruct->field_52], MON_DATA_NICKNAME, text);
GetMonData(&gEnemyParty[gBattleStruct->scriptPartyIdx], MON_DATA_NICKNAME, text);
}
else
{
GetMonData(&gPlayerParty[gBattleStruct->field_52], MON_DATA_NICKNAME, text);
GetMonData(&gPlayerParty[gBattleStruct->scriptPartyIdx], MON_DATA_NICKNAME, text);
}
StringGet_Nickname(text);
toCpy = text;
@ -3851,7 +3851,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
printerTemplate.x = printerTemplate.currentX = alignX;
}
if (windowId == ARENA_WIN_JUDGEMENT_TEXT)
if (windowId == ARENA_WIN_JUDGMENT_TEXT)
gTextFlags.useAlternateDownArrow = FALSE;
else
gTextFlags.useAlternateDownArrow = TRUE;
@ -3861,7 +3861,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
else
gTextFlags.autoScroll = FALSE;
if (windowId == B_WIN_MSG || windowId == ARENA_WIN_JUDGEMENT_TEXT)
if (windowId == B_WIN_MSG || windowId == ARENA_WIN_JUDGMENT_TEXT)
{
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK))
speed = 1;

View File

@ -1404,20 +1404,20 @@ void TryStoreHeldItemsInPyramidBag(void)
{
u8 i;
struct Pokemon *party = gPlayerParty;
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
u16 heldItem;
memcpy(newItems, gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(newQuantities, gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(newItems, gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(newQuantities, gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
heldItem = GetMonData(&party[i], MON_DATA_HELD_ITEM);
if (heldItem != ITEM_NONE && !AddBagItem(heldItem, 1))
{
// Cant store party held items in pyramid bag because bag is full
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
Free(newItems);
Free(newQuantities);
gSpecialVar_Result = 1;

View File

@ -6340,7 +6340,7 @@ static void Cmd_openpartyscreen(void)
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]);
BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBattler ^ 2)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]);
BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + BATTLE_PARTNER(gActiveBattler)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr += 6;
@ -6361,7 +6361,7 @@ static void Cmd_openpartyscreen(void)
}
else
{
gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_SIDE);
gActiveBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battlerId)));
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
gActiveBattler ^= BIT_FLANK;
@ -6417,9 +6417,9 @@ static void Cmd_switchhandleorder(void)
*(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0);
*(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[gActiveBattler][3];
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0);
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4;
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3];
*((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0);
*((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4;
*((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3];
}
else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{
@ -6559,7 +6559,7 @@ static void Cmd_switchineffects(void)
else
{
// There is a hack here to ensure the truant counter will be 0 when the battler's next turn starts.
// The truant counter is not updated in the case where a mon switches in after a lost judgement in the battle arena.
// The truant counter is not updated in the case where a mon switches in after a lost judgment in the battle arena.
if (GetBattlerAbility(gActiveBattler) == ABILITY_TRUANT
&& gCurrentActionFuncId != B_ACTION_USE_MOVE
&& !gDisableStructs[gActiveBattler].truantSwitchInHack)
@ -7588,7 +7588,7 @@ static void Cmd_hpthresholds(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
opposingBattler = gActiveBattler ^ BIT_SIDE;
opposingBattler = BATTLE_OPPOSITE(gActiveBattler);
result = gBattleMons[opposingBattler].hp * 100 / gBattleMons[opposingBattler].maxHP;
if (result == 0)
@ -7616,7 +7616,7 @@ static void Cmd_hpthresholds2(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
opposingBattler = gActiveBattler ^ BIT_SIDE;
opposingBattler = BATTLE_OPPOSITE(gActiveBattler);
hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBattler));
result = (hpSwitchout - gBattleMons[opposingBattler].hp) * 100 / hpSwitchout;
@ -8160,7 +8160,7 @@ static void Cmd_various(void)
case VARIOUS_SET_MAGIC_COAT_TARGET:
gBattleStruct->attackerBeforeBounce = gActiveBattler;
gBattlerAttacker = gBattlerTarget;
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove))
gBattlerTarget = gSideTimers[side].followmeTarget;
else
@ -8269,10 +8269,10 @@ static void Cmd_various(void)
break;
case VARIOUS_ARENA_JUDGMENT_STRING:
BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGEMENT_TEXT);
BattlePutTextOnWindow(gDisplayedStringBattle, ARENA_WIN_JUDGMENT_TEXT);
break;
case VARIOUS_ARENA_WAIT_STRING:
if (IsTextPrinterActive(ARENA_WIN_JUDGEMENT_TEXT))
if (IsTextPrinterActive(ARENA_WIN_JUDGMENT_TEXT))
return;
break;
case VARIOUS_WAIT_CRY:
@ -10789,7 +10789,7 @@ static void Cmd_forcerandomswitch(void)
monsCount = 6;
minNeeded = 2;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)];
}
else if ((gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_LINK)
|| (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)
@ -10808,7 +10808,7 @@ static void Cmd_forcerandomswitch(void)
monsCount = PARTY_SIZE / 2;
minNeeded = 1;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)];
}
else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|| (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK))
@ -10826,7 +10826,7 @@ static void Cmd_forcerandomswitch(void)
monsCount = PARTY_SIZE / 2;
minNeeded = 1;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)];
}
else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
{
@ -10853,7 +10853,7 @@ static void Cmd_forcerandomswitch(void)
minNeeded = 1;
}
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)];
}
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
@ -10862,7 +10862,7 @@ static void Cmd_forcerandomswitch(void)
monsCount = PARTY_SIZE;
minNeeded = 2;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)];
}
else
{
@ -10915,7 +10915,7 @@ static void Cmd_forcerandomswitch(void)
|| (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
SwitchPartyOrderLinkMulti(gBattlerTarget, i, 0);
SwitchPartyOrderLinkMulti(gBattlerTarget ^ BIT_FLANK, i, 1);
SwitchPartyOrderLinkMulti(BATTLE_PARTNER(gBattlerTarget), i, 1);
}
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
@ -11291,7 +11291,7 @@ static void Cmd_updatestatusicon(void)
}
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK);
gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker)));
if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler]))
{
BtlController_EmitStatusIconUpdate(BUFFER_A, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2);
@ -11935,7 +11935,7 @@ static void Cmd_healpartystatus(void)
gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_ATTACKER;
}
gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK);
gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker)));
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBattlerFlags & gBitTable[gActiveBattler]))
@ -11985,7 +11985,7 @@ static void Cmd_healpartystatus(void)
gBattleMons[gBattlerAttacker].status1 = 0;
gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE;
gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK);
gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker)));
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBattlerFlags & gBitTable[gActiveBattler]))
{
@ -12024,7 +12024,7 @@ static void Cmd_cursetarget(void)
static void Cmd_trysetspikes(void)
{
u8 targetSide = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
u8 targetSide = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (gSideTimers[targetSide].spikesAmount == 3)
{
@ -12732,7 +12732,7 @@ static void Cmd_settaunt(void)
static void Cmd_trysethelpinghand(void)
{
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK);
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker)));
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBattlerFlags & gBitTable[gBattlerTarget])
@ -13646,7 +13646,7 @@ static void Cmd_settypetoterrain(void)
// Unused
static void Cmd_pursuitdoubles(void)
{
gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK);
gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker)));
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBattlerFlags & gBitTable[gActiveBattler])
@ -13776,10 +13776,14 @@ static void Cmd_handleballthrow(void)
{
case ITEM_ULTRA_BALL:
ballMultiplier = 20;
break;
#if B_SPORT_BALL_MODIFIER <= GEN_7
case ITEM_SPORT_BALL:
#endif
case ITEM_GREAT_BALL:
case ITEM_SAFARI_BALL:
case ITEM_SPORT_BALL:
ballMultiplier = 15;
break;
case ITEM_NET_BALL:
if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG))
#if B_NET_BALL_MODIFIER >= GEN_7

View File

@ -316,7 +316,7 @@ void HandleAction_UseMove(void)
GET_MOVE_TYPE(gChosenMove, moveType);
// choose target
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove)
&& moveTarget == MOVE_TARGET_SELECTED
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget))
@ -382,13 +382,13 @@ void HandleAction_UseMove(void)
{
if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
{
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
}
else
{
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE);
gBattlerTarget = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker)));
if (!IsBattlerAlive(gBattlerTarget))
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
}
}
}
@ -427,7 +427,7 @@ void HandleAction_UseMove(void)
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
{
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
}
}
else if (moveTarget == MOVE_TARGET_ALLY)
@ -455,13 +455,13 @@ void HandleAction_UseMove(void)
{
if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
{
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
}
else
{
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE);
gBattlerTarget = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker)));
if (!IsBattlerAlive(gBattlerTarget))
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
}
}
}
@ -3254,7 +3254,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
BattleScriptExecute(BattleScript_MonTookFutureAttack);
if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0
&& gWishFutureKnock.futureSightCounter[gActiveBattler ^ BIT_FLANK] == 0)
&& gWishFutureKnock.futureSightCounter[BATTLE_PARTNER(gActiveBattler)] == 0)
{
gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)] &= ~SIDE_STATUS_FUTUREATTACK;
}
@ -5848,7 +5848,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
{
if (gBattleMons[i].ability == ABILITY_TRACE && (gBattleResources->flags->flags[i] & RESOURCE_FLAG_TRACED))
{
u8 side = (GetBattlerPosition(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon
u8 side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon
u8 target1 = GetBattlerAtPosition(side);
u8 target2 = GetBattlerAtPosition(side + BIT_FLANK);
@ -7595,7 +7595,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget)
switch (moveTarget)
{
case MOVE_TARGET_SELECTED:
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (IsAffectedByFollowMe(gBattlerAttacker, side, move))
{
targetBattler = gSideTimers[side].followmeTarget;
@ -7625,18 +7625,18 @@ u32 GetMoveTarget(u16 move, u8 setTarget)
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
case MOVE_TARGET_OPPONENTS_FIELD:
targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker)));
if (!IsBattlerAlive(targetBattler))
targetBattler ^= BIT_FLANK;
break;
case MOVE_TARGET_RANDOM:
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (IsAffectedByFollowMe(gBattlerAttacker, side, move))
targetBattler = gSideTimers[side].followmeTarget;
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM)
targetBattler = SetRandomTarget(gBattlerAttacker);
else
targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker)));
break;
case MOVE_TARGET_USER_OR_SELECTED:
case MOVE_TARGET_USER:

View File

@ -202,7 +202,7 @@ static const struct OamData sOam_Cable =
.paletteNum = 0,
};
static const struct SpriteTemplate sSpriteTemplate_CableCar[] =
static const struct SpriteTemplate sSpriteTemplates_CableCar[] =
{
{
.tileTag = TAG_CABLE_CAR,
@ -224,7 +224,8 @@ static const struct SpriteTemplate sSpriteTemplate_CableCar[] =
},
};
static const struct SpriteTemplate sSpriteTemplate_Cable = {
static const struct SpriteTemplate sSpriteTemplate_Cable =
{
.tileTag = TAG_CABLE,
.paletteTag = TAG_CABLE_CAR,
.oam = &sOam_Cable,
@ -836,12 +837,12 @@ static void CreateCableCarSprites(void)
gSprites[spriteId].sYPos = 73;
}
// Create car sprite
spriteId = CreateSprite(&sSpriteTemplate_CableCar[0], 176, 43, 0x67);
spriteId = CreateSprite(&sSpriteTemplates_CableCar[0], 176, 43, 0x67);
gSprites[spriteId].x2 = gSprites[spriteId].y2 = 32;
gSprites[spriteId].sXPos = 176;
gSprites[spriteId].sYPos = 43;
// Create door sprite
spriteId = CreateSprite(&sSpriteTemplate_CableCar[1], 200, 99, 0x65);
spriteId = CreateSprite(&sSpriteTemplates_CableCar[1], 200, 99, 0x65);
gSprites[spriteId].x2 = 8;
gSprites[spriteId].y2 = 4;
gSprites[spriteId].sXPos = 200;
@ -864,12 +865,12 @@ static void CreateCableCarSprites(void)
gSprites[spriteId].sYPos = 39;
}
// Create car sprite
spriteId = CreateSprite(&sSpriteTemplate_CableCar[0], 104, 9, 0x67);
spriteId = CreateSprite(&sSpriteTemplates_CableCar[0], 104, 9, 0x67);
gSprites[spriteId].x2 = gSprites[spriteId].y2 = 32;
gSprites[spriteId].sXPos = 104;
gSprites[spriteId].sYPos = 9;
// Create door sprite
spriteId = CreateSprite(&sSpriteTemplate_CableCar[1], 128, 65, 0x65);
spriteId = CreateSprite(&sSpriteTemplates_CableCar[1], 128, 65, 0x65);
gSprites[spriteId].x2 = 8;
gSprites[spriteId].y2 = 4;
gSprites[spriteId].sXPos = 128;

View File

@ -944,7 +944,8 @@ static const struct OamData sOamData_TriangleCursor = {
.affineParam = 0,
};
static const struct SpriteTemplate sSpriteTemplate_TriangleCursor = {
static const struct SpriteTemplate sSpriteTemplate_TriangleCursor =
{
.tileTag = PALTAG_TRIANGLE_CURSOR,
.paletteTag = GFXTAG_TRIANGLE_CURSOR,
.oam = &sOamData_TriangleCursor,
@ -1005,7 +1006,8 @@ static const union AnimCmd *const sAnims_RectangleCursor[] = {
[RECTCURSOR_ANIM_ON_LETTER] = sAnim_RectangleCursor_OnLetter,
};
static const struct SpriteTemplate sSpriteTemplate_RectangleCursor = {
static const struct SpriteTemplate sSpriteTemplate_RectangleCursor =
{
.tileTag = GFXTAG_RECTANGLE_CURSOR,
.paletteTag = PALTAG_RECTANGLE_CURSOR,
.oam = &sOamData_RectangleCursor,
@ -1075,7 +1077,8 @@ static const union AnimCmd *const sAnims_ModeWindow[] = {
[MODEWINDOW_ANIM_TRANSITION] = sAnim_ModeWindow_Transition,
};
static const struct SpriteTemplate sSpriteTemplate_ModeWindow = {
static const struct SpriteTemplate sSpriteTemplate_ModeWindow =
{
.tileTag = GFXTAG_MODE_WINDOW,
.paletteTag = PALTAG_MISC_UI,
.oam = &sOamData_ModeWindow,
@ -1101,7 +1104,8 @@ static const struct OamData sOamData_ButtonWindow = {
.affineParam = 0,
};
static const struct SpriteTemplate sSpriteTemplate_ButtonWindow = {
static const struct SpriteTemplate sSpriteTemplate_ButtonWindow =
{
.tileTag = GFXTAG_BUTTON_WINDOW,
.paletteTag = PALTAG_MISC_UI,
.oam = &sOamData_ButtonWindow,
@ -1159,7 +1163,8 @@ static const union AnimCmd *const sAnims_TwoFrame[] = {
sAnim_Frame1,
};
static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = {
static const struct SpriteTemplate sSpriteTemplate_StartSelectButton =
{
.tileTag = GFXTAG_START_SELECT_BUTTONS,
.paletteTag = PALTAG_MISC_UI,
.oam = &sOamData_StartSelectButton,
@ -1169,7 +1174,8 @@ static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = {
.callback = SpriteCallbackDummy,
};
static const struct SpriteTemplate sSpriteTemplate_ScrollIndicator = {
static const struct SpriteTemplate sSpriteTemplate_ScrollIndicator =
{
.tileTag = GFXTAG_SCROLL_INDICATOR,
.paletteTag = PALTAG_MISC_UI,
.oam = &sOamData_ScrollIndicator,

View File

@ -3766,7 +3766,8 @@ static const union AnimCmd *const sAnims_DeoxysRockFragment[] = {
sAnim_RockFragment_BottomRight,
};
static const struct SpriteTemplate sSpriteTemplate_DeoxysRockFragment = {
static const struct SpriteTemplate sSpriteTemplate_DeoxysRockFragment =
{
.tileTag = TAG_NONE,
.paletteTag = 4378,
.oam = &sOam_8x8,

View File

@ -1284,8 +1284,8 @@ const u32 gDomeTourneyTree_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney.
const u32 gDomeTourneyTreeButtons_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.gbapal.lz");
const u32 gDomeTourneyMatchCardBg_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_match_card_bg.gbapal.lz");
const u32 gBattleArenaJudgementSymbolsGfx[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.4bpp.lz");
const u32 gBattleArenaJudgementSymbolsPalette[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.gbapal.lz");
const u32 gBattleArenaJudgmentSymbolsGfx[] = INCBIN_U32("graphics/battle_frontier/arena_judgment_symbols.4bpp.lz");
const u32 gBattleArenaJudgmentSymbolsPalette[] = INCBIN_U32("graphics/battle_frontier/arena_judgment_symbols.gbapal.lz");
const u32 gBattleWindowTextPalette[] = INCBIN_U32("graphics/battle_interface/text.gbapal.lz");
const u16 gPPTextPalette[] = INCBIN_U16("graphics/battle_interface/text_pp.gbapal");

View File

@ -2933,7 +2933,7 @@ static void SpriteCB_WaterDrop_ReachLeafEnd(struct Sprite *sprite)
SetOamMatrix(sprite->data[1], sprite->data[6] + 64, 0, 0, sprite->data[6] + 64);
SetOamMatrix(sprite->data[1] + 1, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64);
SetOamMatrix(sprite->data[1] + 2, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64);
if (sprite->data[4] != 64)
if (sprite->data[4] != MAX_SPRITES)
{
u16 sinIdx;
sprite->data[4] -= 8;

View File

@ -740,11 +740,11 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count)
u16 *items = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode];
u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode];
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
{
@ -792,8 +792,8 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count)
if (count == 0)
{
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*items));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities));
Free(newItems);
Free(newQuantities);
return TRUE;
@ -823,11 +823,11 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count)
}
else
{
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
{
@ -854,8 +854,8 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count)
if (count == 0)
{
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*items));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities));
Free(newItems);
Free(newQuantities);
return TRUE;

View File

@ -201,7 +201,8 @@ static const struct OamData sOamData_CeilingCrumbleSmall =
.affineParam = 0,
};
static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleSmall = {
static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleSmall =
{
.tileTag = TAG_CEILING_CRUMBLE,
.paletteTag = TAG_NONE,
.oam = &sOamData_CeilingCrumbleSmall,
@ -239,7 +240,8 @@ static const struct OamData sOamData_CeilingCrumbleLarge =
.affineParam = 0,
};
static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleLarge = {
static const struct SpriteTemplate sSpriteTemplate_CeilingCrumbleLarge =
{
.tileTag = TAG_CEILING_CRUMBLE,
.paletteTag = TAG_NONE,
.oam = &sOamData_CeilingCrumbleLarge,

View File

@ -162,7 +162,8 @@ static const struct SpritePalette sSpritePalettes_StampShadow[] = {
{sStampShadowPal8, TAG_STAMP_SHADOW}
};
static const struct SpriteTemplate sSpriteTemplate_StampShadow = {
static const struct SpriteTemplate sSpriteTemplate_StampShadow =
{
.tileTag = TAG_STAMP_SHADOW,
.paletteTag = TAG_STAMP_SHADOW,
.oam = &gOamData_AffineOff_ObjNormal_32x16,

View File

@ -4199,7 +4199,7 @@ u8 CountAliveMonsInBattle(u8 caseId)
u8 GetDefaultMoveTarget(u8 battlerId)
{
u8 opposing = BATTLE_OPPOSITE(GetBattlerPosition(battlerId) & BIT_SIDE);
u8 opposing = BATTLE_OPPOSITE(GET_BATTLER_SIDE(battlerId));
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
return GetBattlerAtPosition(opposing);

View File

@ -2662,7 +2662,7 @@ static const struct SpriteTemplate sSpriteTemplates_ColorHeaders[NUM_BOARD_COLOR
}
};
static const struct SpriteTemplate sSpriteTemplate_GridIcons[NUM_BOARD_POKES] =
static const struct SpriteTemplate sSpriteTemplates_GridIcons[NUM_BOARD_POKES] =
{
{
.tileTag = GFXTAG_GRID_ICONS,
@ -3537,7 +3537,7 @@ static void CreateGridSprites(void)
u8 y = i * 24;
for (j = 0; j < NUM_BOARD_POKES; j++)
{
spriteId = sRoulette->spriteIds[(i * NUM_BOARD_POKES) + SPR_GRID_ICONS + j] = CreateSprite(&sSpriteTemplate_GridIcons[j], (j * 24) + 148, y + 92, 30);
spriteId = sRoulette->spriteIds[(i * NUM_BOARD_POKES) + SPR_GRID_ICONS + j] = CreateSprite(&sSpriteTemplates_GridIcons[j], (j * 24) + 148, y + 92, 30);
gSprites[spriteId].animPaused = TRUE;
y += 24;
if (y >= 72)

View File

@ -793,7 +793,8 @@ static const union AnimCmd *const sAnims_KeyboardCursor[] = {
sAnim_KeyboardCursorWide_Closed
};
static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor = {
static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor =
{
.tileTag = GFXTAG_KEYBOARD_CURSOR,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_KeyboardCursor,
@ -809,7 +810,8 @@ static const struct OamData sOam_TextEntrySprite = {
.priority = 2
};
static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = {
static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor =
{
.tileTag = GFXTAG_TEXT_ENTRY_CURSOR,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_TextEntrySprite,
@ -819,7 +821,8 @@ static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = {
.callback = SpriteCB_TextEntryCursor
};
static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow = {
static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow =
{
.tileTag = GFXTAG_TEXT_ENTRY_ARROW,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_TextEntrySprite,
@ -868,7 +871,8 @@ static const union AnimCmd *const sAnims_RButtonLabels[] = {
sAnim_RegisterIcon
};
static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = {
static const struct SpriteTemplate sSpriteTemplate_RButtonIcon =
{
.tileTag = GFXTAG_RBUTTON_ICON,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_RButtonIcon,
@ -878,7 +882,8 @@ static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = {
.callback = SpriteCallbackDummy
};
static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = {
static const struct SpriteTemplate sSpriteTemplate_RButtonLabels =
{
.tileTag = GFXTAG_RBUTTON_LABELS,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_RButtonLabel,