diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bf8ab19c1..1c3f3ea5b 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2860,7 +2860,7 @@ BattleScript_FaintedMonTryChooseAnother:: switchhandleorder BS_FAINTED, 0x2 jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother - jumpifbattletype BATTLE_TYPE_x2000000, BattleScript_FaintedMonChooseAnother + jumpifbattletype BATTLE_TYPE_RECORDED_LINK, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother @@ -2978,7 +2978,7 @@ BattleScript_LocalBattleLostPrintTrainersWinText:: trainerslidein BS_ATTACKER waitstate printstring STRINGID_TRAINER1WINTEXT - jumpifbattletype BATTLE_TYPE_x800000, BattleScript_LocalBattleLostDoTrainer2WinText + jumpifbattletype BATTLE_TYPE_TOWER_LINK_MULTI, BattleScript_LocalBattleLostDoTrainer2WinText jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleLostEnd_ BattleScript_LocalBattleLostDoTrainer2WinText:: trainerslideout B_POSITION_OPPONENT_LEFT diff --git a/include/constants/battle.h b/include/constants/battle.h index fa8f422c4..e6ebc85e4 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -44,38 +44,38 @@ #define BIT_FLANK 2 // Battle Type Flags -#define BATTLE_TYPE_DOUBLE (1 << 0) -#define BATTLE_TYPE_LINK (1 << 1) -#define BATTLE_TYPE_IS_MASTER (1 << 2) // In not-link battles, it's always set. -#define BATTLE_TYPE_TRAINER (1 << 3) -#define BATTLE_TYPE_FIRST_BATTLE (1 << 4) -#define BATTLE_TYPE_20 (1 << 5) -#define BATTLE_TYPE_MULTI (1 << 6) -#define BATTLE_TYPE_SAFARI (1 << 7) -#define BATTLE_TYPE_BATTLE_TOWER (1 << 8) -#define BATTLE_TYPE_WALLY_TUTORIAL (1 << 9) -#define BATTLE_TYPE_ROAMER (1 << 10) -#define BATTLE_TYPE_EREADER_TRAINER (1 << 11) -#define BATTLE_TYPE_KYOGRE_GROUDON (1 << 12) -#define BATTLE_TYPE_LEGENDARY (1 << 13) -#define BATTLE_TYPE_REGI (1 << 14) -#define BATTLE_TYPE_TWO_OPPONENTS (1 << 15) -#define BATTLE_TYPE_DOME (1 << 16) -#define BATTLE_TYPE_PALACE (1 << 17) -#define BATTLE_TYPE_ARENA (1 << 18) -#define BATTLE_TYPE_FACTORY (1 << 19) -#define BATTLE_TYPE_PIKE (1 << 20) -#define BATTLE_TYPE_PYRAMID (1 << 21) -#define BATTLE_TYPE_INGAME_PARTNER (1 << 22) -#define BATTLE_TYPE_x800000 (1 << 23) -#define BATTLE_TYPE_RECORDED (1 << 24) -#define BATTLE_TYPE_x2000000 (1 << 25) -#define BATTLE_TYPE_TRAINER_HILL (1 << 26) -#define BATTLE_TYPE_SECRET_BASE (1 << 27) -#define BATTLE_TYPE_GROUDON (1 << 28) -#define BATTLE_TYPE_KYOGRE (1 << 29) -#define BATTLE_TYPE_RAYQUAZA (1 << 30) -#define BATTLE_TYPE_x80000000 (1 << 31) +#define BATTLE_TYPE_DOUBLE (1 << 0) +#define BATTLE_TYPE_LINK (1 << 1) +#define BATTLE_TYPE_IS_MASTER (1 << 2) // In not-link battles, it's always set. +#define BATTLE_TYPE_TRAINER (1 << 3) +#define BATTLE_TYPE_FIRST_BATTLE (1 << 4) +#define BATTLE_TYPE_LINK_IN_BATTLE (1 << 5) // Set on battle entry, cleared on exit. Checked rarely +#define BATTLE_TYPE_MULTI (1 << 6) +#define BATTLE_TYPE_SAFARI (1 << 7) +#define BATTLE_TYPE_BATTLE_TOWER (1 << 8) +#define BATTLE_TYPE_WALLY_TUTORIAL (1 << 9) +#define BATTLE_TYPE_ROAMER (1 << 10) +#define BATTLE_TYPE_EREADER_TRAINER (1 << 11) +#define BATTLE_TYPE_KYOGRE_GROUDON (1 << 12) +#define BATTLE_TYPE_LEGENDARY (1 << 13) +#define BATTLE_TYPE_REGI (1 << 14) +#define BATTLE_TYPE_TWO_OPPONENTS (1 << 15) +#define BATTLE_TYPE_DOME (1 << 16) +#define BATTLE_TYPE_PALACE (1 << 17) +#define BATTLE_TYPE_ARENA (1 << 18) +#define BATTLE_TYPE_FACTORY (1 << 19) +#define BATTLE_TYPE_PIKE (1 << 20) +#define BATTLE_TYPE_PYRAMID (1 << 21) +#define BATTLE_TYPE_INGAME_PARTNER (1 << 22) +#define BATTLE_TYPE_TOWER_LINK_MULTI (1 << 23) +#define BATTLE_TYPE_RECORDED (1 << 24) +#define BATTLE_TYPE_RECORDED_LINK (1 << 25) +#define BATTLE_TYPE_TRAINER_HILL (1 << 26) +#define BATTLE_TYPE_SECRET_BASE (1 << 27) +#define BATTLE_TYPE_GROUDON (1 << 28) +#define BATTLE_TYPE_KYOGRE (1 << 29) +#define BATTLE_TYPE_RAYQUAZA (1 << 30) +#define BATTLE_TYPE_RECORDED_IS_MASTER (1 << 31) #define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID) #define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE) diff --git a/include/recorded_battle.h b/include/recorded_battle.h index 252b25502..55353a6d1 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -3,7 +3,7 @@ extern u32 gRecordedBattleRngSeed; extern u32 gBattlePalaceMoveSelectionRngValue; -extern u8 gUnknown_0203C7B4; +extern u8 gRecordedBattleMultiplayerId; void sub_8184DA4(u8 arg0); void sub_8184E58(void); diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index b7679429c..10eb013fe 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -293,7 +293,7 @@ void BattleAI_HandleItemUseBeforeAISetup(u8 defaultScoreMoves) if ((gBattleTypeFlags & BATTLE_TYPE_TRAINER) && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_SAFARI | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_FRONTIER - | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_x2000000) + | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_RECORDED_LINK) ) ) { diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 1663c2561..263c1e7cc 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -62,7 +62,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) } // Get party information. - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) firstId = 0, lastId = 3; @@ -158,7 +158,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) if (gBattleMons[gActiveBattler].ability == absorbingTypeAbility) return FALSE; - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) firstId = 0, lastId = 3; @@ -353,7 +353,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) battlerIn2 = gActiveBattler; } - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == 0) firstId = 0, lastId = 3; @@ -464,7 +464,7 @@ static bool8 ShouldSwitch(void) battlerIn2 = *activeBattlerPtr; } - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) firstId = 0, lastId = 3; @@ -555,7 +555,7 @@ void AI_TrySwitchOrUseItem(void) battlerIn2 = GetBattlerAtPosition(battlerIdentity ^ BIT_FLANK); } - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) firstId = 0, lastId = 3; @@ -661,7 +661,7 @@ u8 GetMostSuitableMonToSwitchInto(void) battlerIn2 = gActiveBattler; } - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT) firstId = 0, lastId = 3; diff --git a/src/battle_bg.c b/src/battle_bg.c index 7c9b05b25..ad992f7b3 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -759,7 +759,7 @@ void LoadBattleMenuWindowGfx(void) void DrawMainBattleBackground(void) { - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK)) { LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); @@ -1140,7 +1140,7 @@ void DrawBattleEntryBackground(void) gBattle_BG2_Y = 0xFF5C; LoadCompressedSpriteSheetUsingHeap(&sVsLettersSpriteSheet); } - else if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER)) + else if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_EREADER_TRAINER)) { if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || gPartnerTrainerId == TRAINER_STEVEN_PARTNER) { @@ -1221,7 +1221,7 @@ bool8 LoadChosenBattleElement(u8 caseId) LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40); break; case 3: - if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER)) + if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_EREADER_TRAINER)) { LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); } @@ -1280,7 +1280,7 @@ bool8 LoadChosenBattleElement(u8 caseId) } break; case 4: - if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER)) + if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_EREADER_TRAINER)) { LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); } @@ -1342,7 +1342,7 @@ bool8 LoadChosenBattleElement(u8 caseId) } break; case 5: - if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER)) + if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_EREADER_TRAINER)) { LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60); } diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 9fe8caf63..2f1153612 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1260,7 +1260,7 @@ static void OpponentHandleDrawTrainerPic(void) } else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) { - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if (gActiveBattler == 1) trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); @@ -1344,7 +1344,7 @@ static void OpponentHandleTrainerSlide(void) } else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) { - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if (gActiveBattler == 1) trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); @@ -1632,7 +1632,7 @@ static void OpponentHandleChoosePokemon(void) battler2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); } - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { if (gActiveBattler == 1) firstId = 0, lastId = 3; diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 63e1ff7a0..895ca6b39 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1236,7 +1236,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void) } else { - trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[gUnknown_0203C7B4 ^ BIT_SIDE].gender); + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[gRecordedBattleMultiplayerId ^ BIT_SIDE].gender); } } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 3d4faf0cd..86e4f8809 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1187,12 +1187,12 @@ static void RecordedPlayerHandleDrawTrainerPic(void) s16 xPos, yPos; u32 trainerPicId; - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) trainerPicId = GetActiveBattlerLinkPlayerGender(); else - trainerPicId = gLinkPlayers[gUnknown_0203C7B4].gender; + trainerPicId = gLinkPlayers[gRecordedBattleMultiplayerId].gender; } else { @@ -1666,7 +1666,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; else trainerPicId = gSaveBlock2Ptr->playerGender; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 297a8b577..20e638777 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -174,9 +174,9 @@ static void InitSinglePlayerBtlControllers(void) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) { - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - if (gBattleTypeFlags & BATTLE_TYPE_x80000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) { gBattleMainFunc = BeginBattleIntro; @@ -259,9 +259,9 @@ static void InitSinglePlayerBtlControllers(void) } else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - u8 var; // multiplayer Id in a recorded battle? + u8 multiplayerId; - for (var = gUnknown_0203C7B4, i = 0; i < MAX_BATTLERS_COUNT; i++) + for (multiplayerId = gRecordedBattleMultiplayerId, i = 0; i < MAX_BATTLERS_COUNT; i++) { switch (gLinkPlayers[i].id) { @@ -275,7 +275,7 @@ static void InitSinglePlayerBtlControllers(void) break; } - if (i == var) + if (i == multiplayerId) { gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].id) @@ -292,8 +292,8 @@ static void InitSinglePlayerBtlControllers(void) break; } } - else if ((!(gLinkPlayers[i].id & 1) && !(gLinkPlayers[var].id & 1)) - || ((gLinkPlayers[i].id & 1) && (gLinkPlayers[var].id & 1))) + else if ((!(gLinkPlayers[i].id & 1) && !(gLinkPlayers[multiplayerId].id & 1)) + || ((gLinkPlayers[i].id & 1) && (gLinkPlayers[multiplayerId].id & 1))) { gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].id) @@ -337,7 +337,7 @@ static void InitSinglePlayerBtlControllers(void) gBattlerControllerFuncs[2] = SetControllerToRecordedPlayer; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { gBattlerControllerFuncs[1] = SetControllerToRecordedOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; @@ -362,7 +362,7 @@ static void InitSinglePlayerBtlControllers(void) gBattlerControllerFuncs[3] = SetControllerToRecordedPlayer; gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT; - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { gBattlerControllerFuncs[0] = SetControllerToRecordedOpponent; gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; @@ -825,7 +825,7 @@ void sub_8033648(void) s32 j; u8 *recvBuffer; - if (gReceivedRemoteLinkPlayers != 0 && (gBattleTypeFlags & BATTLE_TYPE_20)) + if (gReceivedRemoteLinkPlayers != 0 && (gBattleTypeFlags & BATTLE_TYPE_LINK_IN_BATTLE)) { DestroyTask_RfuIdle(); for (i = 0; i < GetLinkPlayerCount(); i++) diff --git a/src/battle_intro.c b/src/battle_intro.c index 36ff325f5..2d5e602d1 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -357,7 +357,7 @@ static void BattleIntroSlide3(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 8)); SetGpuReg(REG_OFFSET_BLDY, 0); gTasks[taskId].data[4] = BLDALPHA_BLEND(8, 8); - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { gTasks[taskId].data[2] = 16; gTasks[taskId].data[0]++; diff --git a/src/battle_main.c b/src/battle_main.c index df56dccf9..7e8966597 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1109,7 +1109,7 @@ static void CB2_HandleStartBattle(void) SetMainCallback2(BattleMainCB2); if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - gBattleTypeFlags |= BATTLE_TYPE_20; + gBattleTypeFlags |= BATTLE_TYPE_LINK_IN_BATTLE; } } break; @@ -1363,7 +1363,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) SetMainCallback2(BattleMainCB2); if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - gBattleTypeFlags |= BATTLE_TYPE_20; + gBattleTypeFlags |= BATTLE_TYPE_LINK_IN_BATTLE; } } break; @@ -1816,7 +1816,7 @@ static void CB2_HandleStartMultiBattle(void) if (gBattleTypeFlags & BATTLE_TYPE_LINK) { gTrainerBattleOpponent_A = TRAINER_LINK_OPPONENT; - gBattleTypeFlags |= BATTLE_TYPE_20; + gBattleTypeFlags |= BATTLE_TYPE_LINK_IN_BATTLE; } } break; @@ -2180,7 +2180,7 @@ void sub_8038D64(void) SetHBlankCallback(NULL); SetVBlankCallback(NULL); - gBattleTypeFlags &= ~(BATTLE_TYPE_20); + gBattleTypeFlags &= ~(BATTLE_TYPE_LINK_IN_BATTLE); if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) { @@ -2803,7 +2803,7 @@ void SpriteCb_OpponentMonFromBall(struct Sprite *sprite) { if (sprite->affineAnimEnded) { - if (!(gHitMarker & HITMARKER_NO_ANIMATIONS) || gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (!(gHitMarker & HITMARKER_NO_ANIMATIONS) || gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { if (HasTwoFramesAnimation(sprite->sSpeciesId)) StartSpriteAnim(sprite, 1); @@ -3041,7 +3041,7 @@ static void BattleStartClearSetData(void) if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && gSaveBlock2Ptr->optionsBattleSceneOff == TRUE) gHitMarker |= HITMARKER_NO_ANIMATIONS; } - else if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) && GetBattleSceneInRecordedBattle()) + else if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) && GetBattleSceneInRecordedBattle()) gHitMarker |= HITMARKER_NO_ANIMATIONS; gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; @@ -3396,7 +3396,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL))) { HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); @@ -3409,7 +3409,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) if (!(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL))) { HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); @@ -3544,9 +3544,9 @@ static void BattleIntroPrintOpponentSendsOut(void) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) position = B_POSITION_OPPONENT_LEFT; - else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - if (gBattleTypeFlags & BATTLE_TYPE_x80000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) position = B_POSITION_OPPONENT_LEFT; else position = B_POSITION_PLAYER_LEFT; @@ -3564,9 +3564,9 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) position = B_POSITION_OPPONENT_RIGHT; - else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - if (gBattleTypeFlags & BATTLE_TYPE_x80000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) position = B_POSITION_OPPONENT_RIGHT; else position = B_POSITION_PLAYER_RIGHT; @@ -3592,9 +3592,9 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) { - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - if (gBattleTypeFlags & BATTLE_TYPE_x80000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) position = B_POSITION_OPPONENT_LEFT; else position = B_POSITION_PLAYER_LEFT; @@ -3635,7 +3635,7 @@ static void BattleIntroRecordMonsToDex(void) && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL))) { HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); @@ -3659,9 +3659,9 @@ static void BattleIntroPrintPlayerSendsOut(void) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) position = B_POSITION_PLAYER_LEFT; - else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - if (gBattleTypeFlags & BATTLE_TYPE_x80000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) position = B_POSITION_PLAYER_LEFT; else position = B_POSITION_OPPONENT_LEFT; @@ -3682,9 +3682,9 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) position = B_POSITION_PLAYER_RIGHT; - else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - if (gBattleTypeFlags & BATTLE_TYPE_x80000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) position = B_POSITION_PLAYER_RIGHT; else position = B_POSITION_OPPONENT_RIGHT; @@ -3714,9 +3714,9 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) position = B_POSITION_PLAYER_LEFT; - else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { - if (gBattleTypeFlags & BATTLE_TYPE_x80000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER) position = B_POSITION_PLAYER_LEFT; else position = B_POSITION_OPPONENT_LEFT; @@ -4155,7 +4155,7 @@ static void HandleTurnActionSelectionState(void) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER_NO_PYRAMID | BATTLE_TYPE_EREADER_TRAINER - | BATTLE_TYPE_x2000000)) + | BATTLE_TYPE_RECORDED_LINK)) { RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; @@ -4263,7 +4263,7 @@ static void HandleTurnActionSelectionState(void) return; } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER - && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) && gBattleBufferB[gActiveBattler][1] == B_ACTION_RUN) { BattleScriptExecute(BattleScript_PrintCantRunFromTrainer); @@ -4574,7 +4574,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) } // badge boost - if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER)) + if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) && FlagGet(FLAG_BADGE03_GET) && GetBattlerSide(battler1) == B_SIDE_PLAYER) { @@ -4608,7 +4608,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) } // badge boost - if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER)) + if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) && FlagGet(FLAG_BADGE03_GET) && GetBattlerSide(battler2) == B_SIDE_PLAYER) { @@ -4892,7 +4892,7 @@ static void HandleEndTurn_BattleWon(void) { gCurrentActionFuncId = 0; - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { gSpecialVar_Result = gBattleOutcome; gBattleTextBuff1[0] = gBattleOutcome; @@ -4950,7 +4950,7 @@ static void HandleEndTurn_BattleLost(void) { gCurrentActionFuncId = 0; - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) { @@ -5031,7 +5031,7 @@ static void HandleEndTurn_FinishBattle(void) if (gCurrentActionFuncId == B_ACTION_TRY_FINISH || gCurrentActionFuncId == B_ACTION_FINISHED) { if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_EREADER_TRAINER @@ -5058,7 +5058,7 @@ static void HandleEndTurn_FinishBattle(void) } if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI diff --git a/src/battle_message.c b/src/battle_message.c index 0f5ec507d..3f886c196 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2009,9 +2009,9 @@ void BufferStringBattle(u16 stringID) case STRINGID_INTROMSG: // first battle msg if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { - if (gBattleTypeFlags & BATTLE_TYPE_x800000) + if (gBattleTypeFlags & BATTLE_TYPE_TOWER_LINK_MULTI) { stringPtr = sText_TwoTrainersWantToBattle; } @@ -2079,18 +2079,18 @@ void BufferStringBattle(u16 stringID) { if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) stringPtr = sText_TwoTrainersSentPkmn; - else if (gBattleTypeFlags & BATTLE_TYPE_x800000) + else if (gBattleTypeFlags & BATTLE_TYPE_TOWER_LINK_MULTI) stringPtr = sText_TwoTrainersSentPkmn; else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) stringPtr = sText_TwoLinkTrainersSentOutPkmn; - else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) stringPtr = sText_LinkTrainerSentOutTwoPkmn; else stringPtr = sText_Trainer1SentOutTwoPkmn; } else { - if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) + if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK))) stringPtr = sText_Trainer1SentOutPkmn; else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) stringPtr = sText_Trainer1SentOutPkmn; @@ -2113,7 +2113,7 @@ void BufferStringBattle(u16 stringID) } else { - if (gTrainerBattleOpponent_A == TRAINER_LINK_OPPONENT || gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gTrainerBattleOpponent_A == TRAINER_LINK_OPPONENT || gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) stringPtr = sText_LinkTrainer2WithdrewPkmn; @@ -2140,9 +2140,9 @@ void BufferStringBattle(u16 stringID) } else { - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { - if (gBattleTypeFlags & BATTLE_TYPE_x800000) + if (gBattleTypeFlags & BATTLE_TYPE_TOWER_LINK_MULTI) { if (gBattleScripting.battler == 1) stringPtr = sText_Trainer1SentOutPkmn2; @@ -2210,7 +2210,7 @@ void BufferStringBattle(u16 stringID) switch (gBattleTextBuff1[0]) { case B_OUTCOME_WON: - if (gBattleTypeFlags & BATTLE_TYPE_x800000) + if (gBattleTypeFlags & BATTLE_TYPE_TOWER_LINK_MULTI) stringPtr = sText_TwoInGameTrainersDefeated; else stringPtr = sText_TwoLinkTrainersDefeated; @@ -2336,8 +2336,8 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) u8 multiplayerId; s32 i; - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) - multiplayerId = gUnknown_0203C7B4; + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) + multiplayerId = gRecordedBattleMultiplayerId; else multiplayerId = GetMultiplayerId(); @@ -2477,7 +2477,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) toCpy = gMoveNames[gBattleMsgDataPtr->originallyUsedMove]; break; case B_TXT_LAST_ITEM: // last used item - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { if (gLastUsedItem == ITEM_ENIGMA_BERRY) { @@ -2858,7 +2858,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) break; case B_BUFF_ITEM: // item name hword = T1_READ_16(&src[srcID + 1]); - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { if (hword == ITEM_ENIGMA_BERRY) { @@ -3018,7 +3018,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) if (windowId == 0 || windowId == 0x16) { - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) speed = 1; else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) speed = sRecordedBattleTextSpeeds[GetTextSpeedInRecordedBattle()]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6ec9d16b1..f6546ab25 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2713,7 +2713,7 @@ void SetMoveEffect(bool8 primary, u8 certain) (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE))) { gBattlescriptCurrInstr++; @@ -2722,7 +2722,7 @@ void SetMoveEffect(bool8 primary, u8 certain) (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE)) && (gWishFutureKnock.knockedOffMons[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]])) { @@ -3228,7 +3228,7 @@ static void Cmd_getexp(void) case 0: // check if should receive exp at all if (GetBattlerSide(gBattlerFainted) != B_SIDE_OPPONENT || (gBattleTypeFlags & (BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SAFARI @@ -3533,7 +3533,7 @@ static void Cmd_unknown_24(void) if (HP_count == 0) gBattleOutcome |= B_OUTCOME_WON; - if (gBattleOutcome == 0 && (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) + if (gBattleOutcome == 0 && (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK))) { s32 foundPlayer = 0; s32 foundOpponent; @@ -4634,7 +4634,7 @@ static void Cmd_switchinanim(void) if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL | BATTLE_TYPE_FRONTIER))) HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); @@ -4691,7 +4691,7 @@ static void Cmd_jumpifcantswitch(void) } else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if (gBattleTypeFlags & BATTLE_TYPE_x800000) + if (gBattleTypeFlags & BATTLE_TYPE_TOWER_LINK_MULTI) { if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { @@ -7137,7 +7137,7 @@ static void Cmd_forcerandomswitch(void) party = gEnemyParty; if ((gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_LINK) - || (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_x2000000) + || (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) || (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)) { if ((gBattlerTarget & BIT_FLANK) != 0) @@ -7156,7 +7156,7 @@ static void Cmd_forcerandomswitch(void) battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK]; } else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) - || (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000)) + || (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)) { if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gBattlerTarget)) == 1) { @@ -7256,8 +7256,8 @@ static void Cmd_forcerandomswitch(void) if ((gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) || (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI) - || (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) - || (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_MULTI)) + || (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + || (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)) { SwitchPartyOrderLinkMulti(gBattlerTarget, i, 0); SwitchPartyOrderLinkMulti(gBattlerTarget ^ BIT_FLANK, i, 1); @@ -7337,7 +7337,7 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to static void Cmd_givepaydaymoney(void) { - if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) && gPaydayMoney != 0) + if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) && gPaydayMoney != 0) { u32 bonusMoney = gPaydayMoney * gBattleStruct->moneyMultiplier; AddMoney(&gSaveBlock1Ptr->money, bonusMoney); @@ -9044,7 +9044,7 @@ static void Cmd_tryswapitems(void) // trick | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SECRET_BASE - | BATTLE_TYPE_x2000000)))) + | BATTLE_TYPE_RECORDED_LINK)))) { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } @@ -9058,7 +9058,7 @@ static void Cmd_tryswapitems(void) // trick | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SECRET_BASE - | BATTLE_TYPE_x2000000)) + | BATTLE_TYPE_RECORDED_LINK)) && (gWishFutureKnock.knockedOffMons[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]] || gWishFutureKnock.knockedOffMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]])) { diff --git a/src/battle_tower.c b/src/battle_tower.c index 218c3ef70..51d695f9b 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -2024,7 +2024,7 @@ void DoSpecialTrainerBattle(void) gBattleTypeFlags |= BATTLE_TYPE_DOUBLE | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS; break; case FRONTIER_MODE_LINK_MULTIS: - gBattleTypeFlags |= BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_MULTI | BATTLE_TYPE_x800000; + gBattleTypeFlags |= BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_MULTI | BATTLE_TYPE_TOWER_LINK_MULTI; FillFrontierTrainersParties(FRONTIER_MULTI_PARTY_SIZE); break; } @@ -3521,7 +3521,7 @@ bool32 ValidateBattleTowerRecord(u8 recordId) // unused void TrySetLinkBattleTowerEnemyPartyLevel(void) { - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { s32 i; u8 enemyLevel = SetFacilityPtrsGetLevel(); diff --git a/src/battle_tv.c b/src/battle_tv.c index 7e311fdab..7aac51d4f 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -1065,7 +1065,7 @@ static void TrySetBattleSeminarShow(void) u16 powerOverride; u16 currMoveSaved; - if (gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return; else if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) return; diff --git a/src/battle_util.c b/src/battle_util.c index e929de091..7ea4566d2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -452,7 +452,7 @@ void HandleAction_Run(void) { gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { gCurrentTurnActionNumber = gBattlersCount; @@ -2245,7 +2245,7 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) } else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if (gBattleTypeFlags & BATTLE_TYPE_x800000) + if (gBattleTypeFlags & BATTLE_TYPE_TOWER_LINK_MULTI) { if (GetBattlerSide(battler) == B_SIDE_PLAYER) { @@ -3966,7 +3966,7 @@ u8 IsMonDisobedient(void) s32 calc; u8 obedienceLevel = 0; - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return 0; if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) return 0; diff --git a/src/cable_club.c b/src/cable_club.c index f02683c9d..64bc9187a 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -993,7 +993,7 @@ static void CB2_ReturnFromUnionRoomBattle(void) void CB2_ReturnFromCableClubBattle(void) { - gBattleTypeFlags &= ~BATTLE_TYPE_20; + gBattleTypeFlags &= ~BATTLE_TYPE_LINK_IN_BATTLE; Overworld_ResetMapMusic(); LoadPlayerParty(); SavePlayerBag(); diff --git a/src/link.c b/src/link.c index 9fd35a10b..dffb5b4cd 100644 --- a/src/link.c +++ b/src/link.c @@ -1489,7 +1489,7 @@ static void LinkCB_WaitCloseLink(void) if (count == linkPlayerCount) { // All ready, close link - gBattleTypeFlags &= ~BATTLE_TYPE_20; + gBattleTypeFlags &= ~BATTLE_TYPE_LINK_IN_BATTLE; gLinkVSyncDisabled = TRUE; CloseLink(); gLinkCallback = NULL; @@ -1551,7 +1551,7 @@ static void LinkCB_WaitCloseLinkWithJP(void) if (count == linkPlayerCount) { // All ready, close link - gBattleTypeFlags &= ~BATTLE_TYPE_20; + gBattleTypeFlags &= ~BATTLE_TYPE_LINK_IN_BATTLE; gLinkVSyncDisabled = TRUE; CloseLink(); gLinkCallback = NULL; diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index 5e0ef0aa4..b7713fa3f 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -1380,7 +1380,7 @@ static void WaitAllReadyToCloseLink(void) if (count == playerCount) { // All ready, close link - gBattleTypeFlags &= ~BATTLE_TYPE_20; + gBattleTypeFlags &= ~BATTLE_TYPE_LINK_IN_BATTLE; if (Rfu.parentChild == MODE_CHILD) { Rfu.errorState = 3; diff --git a/src/pokemon.c b/src/pokemon.c index b9264c4c2..5829bbd0a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2685,7 +2685,7 @@ static u16 GetDeoxysStat(struct Pokemon *mon, s32 statId) u16 statValue = 0; u8 nature; - if (gBattleTypeFlags & BATTLE_TYPE_20 || GetMonData(mon, MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS) + if (gBattleTypeFlags & BATTLE_TYPE_LINK_IN_BATTLE || GetMonData(mon, MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS) return 0; ivVal = GetMonData(mon, MON_DATA_HP_IV + statId, NULL); @@ -2729,8 +2729,8 @@ u16 GetUnionRoomTrainerPic(void) u8 linkId; u32 arrId; - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) - linkId = gUnknown_0203C7B4 ^ 1; + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) + linkId = gRecordedBattleMultiplayerId ^ 1; else linkId = GetMultiplayerId() ^ 1; @@ -2744,8 +2744,8 @@ u16 GetUnionRoomTrainerClass(void) u8 linkId; u32 arrId; - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) - linkId = gUnknown_0203C7B4 ^ 1; + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) + linkId = gRecordedBattleMultiplayerId ^ 1; else linkId = GetMultiplayerId() ^ 1; @@ -3367,7 +3367,7 @@ u8 CountAliveMonsInBattle(u8 caseId) static bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) { - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) return FALSE; else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) return FALSE; @@ -6267,7 +6267,7 @@ u16 GetBattleBGM(void) return MUS_VS_KYOGRE_GROUDON; else if (gBattleTypeFlags & BATTLE_TYPE_REGI) return MUS_VS_REGI; - else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return MUS_VS_TRAINER; else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { @@ -6627,7 +6627,7 @@ static void Task_PokemonSummaryAnimateAfterDelay(u8 taskId) void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3) { - if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) + if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK))) DoMonFrontSpriteAnimation(sprite, species, noCry, arg3 | 0x80); else DoMonFrontSpriteAnimation(sprite, species, noCry, arg3); @@ -6705,7 +6705,7 @@ void StopPokemonAnimationDelayTask(void) void BattleAnimateBackSprite(struct Sprite* sprite, u16 species) { - if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) + if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK))) { sprite->callback = SpriteCallbackDummy; } diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 881c2d3ec..6fcbe04f1 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -55,7 +55,7 @@ struct RecordedBattleSave u16 opponentA; u16 opponentB; u16 partnerId; - u16 field_4FA; + u16 multiplayerId; u8 lvlMode; u8 frontierFacility; u8 frontierBrainSymbol; @@ -83,7 +83,7 @@ EWRAM_DATA static u8 sLvlMode = 0; EWRAM_DATA static u8 sFrontierFacility = 0; EWRAM_DATA static u8 sFrontierBrainSymbol = 0; EWRAM_DATA static MainCallback sCallback2_AfterRecordedBattle = NULL; -EWRAM_DATA u8 gUnknown_0203C7B4 = 0; +EWRAM_DATA u8 gRecordedBattleMultiplayerId = 0; EWRAM_DATA static u8 sUnknown_0203C7B5 = 0; EWRAM_DATA static u8 sBattleScene = 0; EWRAM_DATA static u8 sTextSpeed = 0; @@ -154,7 +154,7 @@ void sub_8184E58(void) u8 linkPlayersCount; u8 text[30]; - gUnknown_0203C7B4 = GetMultiplayerId(); + gRecordedBattleMultiplayerId = GetMultiplayerId(); linkPlayersCount = GetLinkPlayerCount(); for (i = 0; i < MAX_BATTLERS_COUNT; i++) @@ -362,11 +362,14 @@ bool32 MoveRecordedBattleToSaveData(void) if (sBattleFlags & BATTLE_TYPE_LINK) { - battleSave->battleFlags = (sBattleFlags & ~(BATTLE_TYPE_LINK | BATTLE_TYPE_20)) | BATTLE_TYPE_x2000000; + battleSave->battleFlags = (sBattleFlags & ~(BATTLE_TYPE_LINK | BATTLE_TYPE_LINK_IN_BATTLE)) | BATTLE_TYPE_RECORDED_LINK; + // BATTLE_TYPE_RECORDED_IS_MASTER set indicates battle will play + // out from player's perspective (i.e. player with back to camera) + // Otherwise player will appear on "opponent" side if (sBattleFlags & BATTLE_TYPE_IS_MASTER) { - battleSave->battleFlags |= BATTLE_TYPE_x80000000; + battleSave->battleFlags |= BATTLE_TYPE_RECORDED_IS_MASTER; } else if (sBattleFlags & BATTLE_TYPE_MULTI) { @@ -374,13 +377,13 @@ bool32 MoveRecordedBattleToSaveData(void) { case 0: case 2: - if (!(sPlayers[gUnknown_0203C7B4].battlerId & 1)) - battleSave->battleFlags |= BATTLE_TYPE_x80000000; + if (!(sPlayers[gRecordedBattleMultiplayerId].battlerId & 1)) + battleSave->battleFlags |= BATTLE_TYPE_RECORDED_IS_MASTER; break; case 1: case 3: - if ((sPlayers[gUnknown_0203C7B4].battlerId & 1)) - battleSave->battleFlags |= BATTLE_TYPE_x80000000; + if ((sPlayers[gRecordedBattleMultiplayerId].battlerId & 1)) + battleSave->battleFlags |= BATTLE_TYPE_RECORDED_IS_MASTER; break; } } @@ -393,7 +396,7 @@ bool32 MoveRecordedBattleToSaveData(void) battleSave->opponentA = gTrainerBattleOpponent_A; battleSave->opponentB = gTrainerBattleOpponent_B; battleSave->partnerId = gPartnerTrainerId; - battleSave->field_4FA = gUnknown_0203C7B4; + battleSave->multiplayerId = gRecordedBattleMultiplayerId; battleSave->lvlMode = gSaveBlock2Ptr->frontier.lvlMode; battleSave->frontierFacility = sFrontierFacility; battleSave->frontierBrainSymbol = sFrontierBrainSymbol; @@ -573,7 +576,7 @@ static void SetVariablesForRecordedBattle(struct RecordedBattleSave *src) gTrainerBattleOpponent_A = src->opponentA; gTrainerBattleOpponent_B = src->opponentB; gPartnerTrainerId = src->partnerId; - gUnknown_0203C7B4 = src->field_4FA; + gRecordedBattleMultiplayerId = src->multiplayerId; sLvlMode = gSaveBlock2Ptr->frontier.lvlMode; sFrontierFacility = src->frontierFacility; sFrontierBrainSymbol = src->frontierBrainSymbol; @@ -715,7 +718,7 @@ void RecordedBattle_CopyBattlerMoves(void) if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) return; - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return; if (sUnknown_0203C7AC == 2) return; @@ -732,7 +735,7 @@ void sub_818603C(u8 arg0) { s32 battlerId, j, k; - if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return; for (battlerId = 0; battlerId < gBattlersCount; battlerId++)