From 9190af73b7ebe690be7204c023d4c14d0241af29 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 3 Jun 2020 15:28:29 -0400 Subject: [PATCH] Label union room battle trainer --- include/constants/trainers.h | 2 +- include/pokemon.h | 4 ++-- src/battle_controller_link_opponent.c | 4 ++-- src/battle_controller_recorded_opponent.c | 4 ++-- src/battle_main.c | 2 +- src/battle_message.c | 14 +++++++------- src/pokemon.c | 4 ++-- src/union_room.c | 2 +- src/union_room_battle.c | 10 +++++----- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/constants/trainers.h b/include/constants/trainers.h index 541b131ca..3f22c7cef 100644 --- a/include/constants/trainers.h +++ b/include/constants/trainers.h @@ -13,7 +13,7 @@ #define TRAINER_PLAYER 1023 #define TRAINER_SECRET_BASE 1024 #define TRAINER_LINK_OPPONENT 2048 -#define TRAINER_OPPONENT_C00 3072 +#define TRAINER_UNION_ROOM 3072 #define TRAINER_STEVEN_PARTNER 3075 #define TRAINER_PIC_HIKER 0 diff --git a/include/pokemon.h b/include/pokemon.h index 7ac65d36b..69ef7a142 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -279,8 +279,8 @@ void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest); void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); bool8 sub_80688F8(u8 caseId, u8 battlerId); void SetDeoxysStats(void); -u16 sub_8068B48(void); -u16 sub_8068BB0(void); +u16 GetUnionRoomTrainerPic(void); +u16 GetUnionRoomTrainerClass(void); void CreateObedientEnemyMon(void); void CalculateMonStats(struct Pokemon *mon); void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest); diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 6604fa142..ce22c605f 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -1267,9 +1267,9 @@ static void LinkOpponentHandleDrawTrainerPic(void) else { xPos = 176; - if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) { - trainerPicId = sub_8068B48(); + trainerPicId = GetUnionRoomTrainerPic(); } else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_FIRE_RED || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN) diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 7c1bff64a..35383611b 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1229,9 +1229,9 @@ static void RecordedOpponentHandleDrawTrainerPic(void) else { xPos = 176; - if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) { - trainerPicId = sub_8068B48(); + trainerPicId = GetUnionRoomTrainerPic(); } else { diff --git a/src/battle_main.c b/src/battle_main.c index e3eea60d0..dd31e12d5 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -995,7 +995,7 @@ static void CB2_HandleStartBattle(void) sub_8036A5C(); SetPlayerBerryDataInBattleStruct(); - if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) { gLinkPlayers[0].id = 0; gLinkPlayers[1].id = 1; diff --git a/src/battle_message.c b/src/battle_message.c index efa4500c8..693058e2f 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1981,7 +1981,7 @@ void BufferStringBattle(u16 stringID) } else { - if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) stringPtr = sText_Trainer1WantsToBattle; else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) stringPtr = sText_LinkTrainerWantsToBattlePause; @@ -2049,7 +2049,7 @@ void BufferStringBattle(u16 stringID) { if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) stringPtr = sText_Trainer1SentOutPkmn; - else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) stringPtr = sText_Trainer1SentOutPkmn; else stringPtr = sText_LinkTrainerSentOutPkmn; @@ -2110,7 +2110,7 @@ void BufferStringBattle(u16 stringID) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) stringPtr = sText_LinkTrainerMultiSentOutPkmn; - else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) stringPtr = sText_Trainer1SentOutPkmn2; else stringPtr = sText_LinkTrainerSentOutPkmn2; @@ -2180,7 +2180,7 @@ void BufferStringBattle(u16 stringID) break; } } - else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) { switch (gBattleTextBuff1[0]) { @@ -2495,8 +2495,8 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) case B_TXT_TRAINER1_CLASS: // trainer class name if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) toCpy = gTrainerClassNames[GetSecretBaseTrainerClass()]; - else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) - toCpy = gTrainerClassNames[sub_8068BB0()]; + else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) + toCpy = gTrainerClassNames[GetUnionRoomTrainerClass()]; else if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN) toCpy = gTrainerClassNames[GetFrontierBrainTrainerClass()]; else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) @@ -2517,7 +2517,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) ConvertInternationalString(text, gBattleResources->secretBase->language); toCpy = text; } - else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) { toCpy = gLinkPlayers[multiplayerId ^ BIT_SIDE].name; } diff --git a/src/pokemon.c b/src/pokemon.c index 87ea2551f..a6128572f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2725,7 +2725,7 @@ void SetDeoxysStats(void) } } -u16 sub_8068B48(void) +u16 GetUnionRoomTrainerPic(void) { u8 linkId; u32 arrId; @@ -2740,7 +2740,7 @@ u16 sub_8068B48(void) return FacilityClassToPicIndex(gLinkPlayerFacilityClasses[arrId]); } -u16 sub_8068BB0(void) +u16 GetUnionRoomTrainerClass(void) { u8 linkId; u32 arrId; diff --git a/src/union_room.c b/src/union_room.c index 9687502b4..a13f57c79 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -4302,7 +4302,7 @@ static void ViewURoomPartnerTrainerCard(u8 *unused, struct WirelessLink_URoom *d DynamicPlaceholderTextUtil_Reset(); - StringCopy(data->field_C0[0], gTrainerClassNames[sub_8068BB0()]); + StringCopy(data->field_C0[0], gTrainerClassNames[GetUnionRoomTrainerClass()]); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, data->field_C0[0]); DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, trainerCard->playerName); diff --git a/src/union_room_battle.c b/src/union_room_battle.c index bb8d536ae..773f77b11 100644 --- a/src/union_room_battle.c +++ b/src/union_room_battle.c @@ -1,5 +1,4 @@ #include "global.h" -#include "defines.h" #include "battle.h" #include "task.h" #include "text.h" @@ -19,6 +18,7 @@ #include "link.h" #include "union_room.h" #include "union_room_battle.h" +#include "constants/rgb.h" #include "constants/trainers.h" struct UnionRoomBattle @@ -69,7 +69,7 @@ static void CB2_SetUpPartiesAndStartBattle(void) } IncrementGameStat(GAME_STAT_NUM_UNION_ROOM_BATTLES); CalculatePlayerPartyCount(); - gTrainerBattleOpponent_A = TRAINER_OPPONENT_C00; + gTrainerBattleOpponent_A = TRAINER_UNION_ROOM; SetMainCallback2(CB2_InitBattle); } @@ -150,7 +150,7 @@ void CB2_UnionRoomBattle(void) case 3: if (!UpdatePaletteFade()) { - memset(gBlockSendBuffer, 0, sizeof(gBlockSendBuffer)); + memset(gBlockSendBuffer, 0, 0x20); if (gSelectedOrderFromParty[0] == -gSelectedOrderFromParty[1]) { gBlockSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM; @@ -159,7 +159,7 @@ void CB2_UnionRoomBattle(void) { gBlockSendBuffer[0] = ACTIVITY_ACCEPT | IN_UNION_ROOM; } - SendBlock(0, gBlockSendBuffer, sizeof(gBlockSendBuffer)); + SendBlock(0, gBlockSendBuffer, 0x20); gMain.state++; } break; @@ -175,7 +175,7 @@ void CB2_UnionRoomBattle(void) else { sub_800AC34(); - if (gBlockRecvBuffer[GetMultiplayerId()][0] == (ACTIVITY_DECLINE | IN_UNION_ROOM))) + if (gBlockRecvBuffer[GetMultiplayerId()][0] == (ACTIVITY_DECLINE | IN_UNION_ROOM)) { gMain.state = 6; }