From accea672f16cb74b0ec16e0e740cf9f67a651dfb Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 26 Feb 2019 22:04:44 -0500 Subject: [PATCH] Incorporate feedback --- common_syms/overworld.txt | 2 +- data/maps/TradeCenter/map.json | 1 - include/link.h | 2 +- include/overworld.h | 2 +- include/save.h | 4 ++-- src/berry_blender.c | 9 ++------- src/cable_club.c | 8 ++++---- src/link.c | 2 +- src/overworld.c | 30 +++++++++++++++--------------- src/record_mixing.c | 2 +- src/rom_8011DC0.c | 4 ++-- src/start_menu.c | 4 ++-- 12 files changed, 32 insertions(+), 38 deletions(-) diff --git a/common_syms/overworld.txt b/common_syms/overworld.txt index 1ba43d7cf..e136f5444 100644 --- a/common_syms/overworld.txt +++ b/common_syms/overworld.txt @@ -4,5 +4,5 @@ gBGTilemapBuffers3 gHeldKeyCodeToSend gFieldCallback gFieldCallback2 -LocalLinkPlayerId +gLocalLinkPlayerId gFieldLinkPlayerCount diff --git a/data/maps/TradeCenter/map.json b/data/maps/TradeCenter/map.json index 9d196c762..3e47ca41b 100644 --- a/data/maps/TradeCenter/map.json +++ b/data/maps/TradeCenter/map.json @@ -46,7 +46,6 @@ ], "coord_events": [ { - "comment": "This is trade seat #1.", "type": "trigger", "x": 4, "y": 5, diff --git a/include/link.h b/include/link.h index 83deab88f..182ee68f4 100644 --- a/include/link.h +++ b/include/link.h @@ -299,7 +299,7 @@ extern struct LinkPlayer gLocalLinkPlayer; bool32 Link_AnyPartnersPlayingRubyOrSapphire(void); bool32 sub_800A03C(void); -void SetLocalLinkPlayerId(u8); +void SetgLocalLinkPlayerId(u8); u8 GetSavedPlayerCount(void); void sub_8009FAC(void); bool8 sub_800A4D8(u8 a0); diff --git a/include/overworld.h b/include/overworld.h index ea361e25b..bf1d93901 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -48,7 +48,7 @@ extern u16 *gBGTilemapBuffers3; extern u16 gHeldKeyCodeToSend; extern void (*gFieldCallback)(void); extern bool8 (*gFieldCallback2)(void); -extern u8 LocalLinkPlayerId; +extern u8 gLocalLinkPlayerId; extern u8 gFieldLinkPlayerCount; // Exported ROM declarations diff --git a/include/save.h b/include/save.h index de2dd5129..7ce86de70 100644 --- a/include/save.h +++ b/include/save.h @@ -83,8 +83,8 @@ bool8 sub_8153380(void); bool8 sub_81533AC(void); u8 sub_81533E0(void); u8 sub_8153408(void); -u8 FullSaveGame(void); //FullSaveGame -bool8 CheckSaveFile(void); //CheckSaveFile +u8 FullSaveGame(void); +bool8 CheckSaveFile(void); u8 Save_LoadGameData(u8 a1); u16 sub_815355C(void); u8 sub_81534D0(u8); diff --git a/src/berry_blender.c b/src/berry_blender.c index dd8117f08..87d24e717 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -34,6 +34,8 @@ #include "battle_records.h" #include "graphics.h" #include "new_game.h" +#include "save.h" +#include "link.h" #define BLENDER_SCORE_BEST 0 #define BLENDER_SCORE_GOOD 1 @@ -140,15 +142,8 @@ extern const u8 gText_Space[]; extern const u8 gText_BlenderMaxSpeedRecord[]; extern const u8 gText_234Players[]; -extern void sub_800A418(void); -extern u8 sub_800A9D8(void); extern void sub_81AABF0(void (*callback)(void)); extern void sub_800B4C0(void); -extern void ClearLinkCallback(void); -extern void sub_8009F8C(void); -extern void FullSaveGame(void); -extern bool8 CheckSaveFile(void); -extern void sub_80EECEC(void); // this file's functions static void BerryBlender_SetBackgroundsPos(void); diff --git a/src/cable_club.c b/src/cable_club.c index 83e1e55dd..f504ad8a8 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -352,7 +352,7 @@ static void sub_80B2918(u8 taskId) else { gFieldLinkPlayerCount = GetLinkPlayerCount_2(); - LocalLinkPlayerId = GetMultiplayerId(); + gLocalLinkPlayerId = GetMultiplayerId(); sub_800AA04(gFieldLinkPlayerCount); card = (struct TrainerCard *)gBlockSendBuffer; TrainerCard_GenerateCardForPlayer(card); @@ -399,7 +399,7 @@ static void sub_80B2A08(u8 taskId) else { gFieldLinkPlayerCount = GetLinkPlayerCount_2(); - LocalLinkPlayerId = GetMultiplayerId(); + gLocalLinkPlayerId = GetMultiplayerId(); sub_800AA04(gFieldLinkPlayerCount); card = (struct TrainerCard *)gBlockSendBuffer; TrainerCard_GenerateCardForPlayer(card); @@ -972,7 +972,7 @@ void sub_80B360C(void) if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2) { - UpdatePlayerLinkBattleRecords(LocalLinkPlayerId ^ 1); + UpdatePlayerLinkBattleRecords(gLocalLinkPlayerId ^ 1); if (gWirelessCommType) { switch (gBattleOutcome) @@ -1028,7 +1028,7 @@ static void sub_80B3728(u8 taskId) if (IsFieldMessageBoxHidden()) { sub_8087288(); - SetLocalLinkPlayerId(gSpecialVar_0x8005); + SetgLocalLinkPlayerId(gSpecialVar_0x8005); task->data[0] = 2; } break; diff --git a/src/link.c b/src/link.c index 72ac3e878..cf06e4958 100644 --- a/src/link.c +++ b/src/link.c @@ -302,7 +302,7 @@ void LinkTestScreen(void) SetMainCallback2(CB2_LinkTest); } -void SetLocalLinkPlayerId(u8 playerId) +void SetgLocalLinkPlayerId(u8 playerId) { gLocalLinkPlayer.id = playerId; } diff --git a/src/overworld.c b/src/overworld.c index 95766805c..63143b7b4 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -203,7 +203,7 @@ u16 *gBGTilemapBuffers3; u16 gHeldKeyCodeToSend; void (*gFieldCallback)(void); bool8 (*gFieldCallback2)(void); -u8 LocalLinkPlayerId; // This is our player id in a multiplayer mode. +u8 gLocalLinkPlayerId; // This is our player id in a multiplayer mode. u8 gFieldLinkPlayerCount; // EWRAM vars @@ -2194,13 +2194,13 @@ static void sub_8086A80(void) static void SetCameraToTrackGuestPlayer(void) { - InitCameraUpdateCallback(GetSpriteForLinkedPlayer(LocalLinkPlayerId)); + InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLocalLinkPlayerId)); } // Duplicate function. static void SetCameraToTrackGuestPlayer_2(void) { - InitCameraUpdateCallback(GetSpriteForLinkedPlayer(LocalLinkPlayerId)); + InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLocalLinkPlayerId)); } static void sub_8086AE4(void) @@ -2210,7 +2210,7 @@ static void sub_8086AE4(void) // This is a hack of some kind; it's undone in sub_8086B14, which is called // soon after this function. - sub_8088B3C(x + LocalLinkPlayerId, y); + sub_8088B3C(x + gLocalLinkPlayerId, y); } static void sub_8086B14(void) @@ -2219,7 +2219,7 @@ static void sub_8086B14(void) u16 x, y; GetCameraFocusCoords(&x, &y); - x -= LocalLinkPlayerId; + x -= gLocalLinkPlayerId; for (i = 0; i < gFieldLinkPlayerCount; i++) { @@ -2242,7 +2242,7 @@ static void CB1_UpdateLinkState(void) { if (gWirelessCommType == 0 || !IsRfuRecvQueueEmpty() || !IsSendingKeysToLink()) { - u8 selfId = LocalLinkPlayerId; + u8 selfId = gLocalLinkPlayerId; UpdateAllLinkPlayers(gLinkPartnersHeldKeys, selfId); // Note: Because guestId is between 0 and 4, while the smallest key code is @@ -2296,7 +2296,7 @@ static void ResetAllTradingStates(void) } // Returns true if all connected players are in tradingState. -static bool32 AreAllPlayersInState(u16 tradingState) +static bool32 AreAllPlayersInTradingState(u16 tradingState) { s32 i; s32 count = gFieldLinkPlayerCount; @@ -2307,7 +2307,7 @@ static bool32 AreAllPlayersInState(u16 tradingState) return TRUE; } -static bool32 AreAnyPlayersInTradingState(u16 tradingState) +static bool32 IsAnyPlayerInTradingState(u16 tradingState) { s32 i; s32 count = gFieldLinkPlayerCount; @@ -2336,7 +2336,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay } return; } - if (AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) + if (IsAnyPlayerInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) { sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; if (trainer->isLocalPlayer) @@ -2629,7 +2629,7 @@ static u16 KeyInterCB_WaitForPlayersToExit(u32 keyOrPlayerId) // CB1_UpdateLinkState. if (sPlayerTradingStates[keyOrPlayerId] != PLAYER_TRADING_STATE_EXITING_ROOM) CheckRfuKeepAliveTimer(); - if (AreAllPlayersInState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) + if (AreAllPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) { ScriptContext1_SetupScript(EventScript_DoLinkRoomExit); SetKeyInterceptCallback(KeyInterCB_SendNothing); @@ -2651,20 +2651,20 @@ static u16 KeyInterCB_SendNothing_2(u32 key) u32 sub_8087214(void) { - if (AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) + if (IsAnyPlayerInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) return 2; - if (sPlayerKeyInterceptCallback == sub_8087170 && sPlayerTradingStates[LocalLinkPlayerId] != PLAYER_TRADING_STATE_UNK_2) + if (sPlayerKeyInterceptCallback == sub_8087170 && sPlayerTradingStates[gLocalLinkPlayerId] != PLAYER_TRADING_STATE_UNK_2) return 0; - if (sPlayerKeyInterceptCallback == KeyInterCB_DoNothingAndKeepAlive && sPlayerTradingStates[LocalLinkPlayerId] == PLAYER_TRADING_STATE_BUSY) + if (sPlayerKeyInterceptCallback == KeyInterCB_DoNothingAndKeepAlive && sPlayerTradingStates[gLocalLinkPlayerId] == PLAYER_TRADING_STATE_BUSY) return 2; - if (AreAllPlayersInState(PLAYER_TRADING_STATE_UNK_2) != FALSE) + if (AreAllPlayersInTradingState(PLAYER_TRADING_STATE_UNK_2) != FALSE) return 1; return 0; } bool32 sub_808727C(void) { - return AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM); + return IsAnyPlayerInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM); } u16 sub_8087288(void) diff --git a/src/record_mixing.c b/src/record_mixing.c index aafd7284b..e58fdcc4e 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -324,7 +324,7 @@ static void Task_RecordMixing_Main(u8 taskId) case 0: // init sSentRecord = malloc(sizeof(union PlayerRecords)); sReceivedRecords = malloc(sizeof(union PlayerRecords) * 4); - SetLocalLinkPlayerId(gSpecialVar_0x8005); + SetgLocalLinkPlayerId(gSpecialVar_0x8005); VarSet(VAR_TEMP_0, 1); gUnknown_03001130 = FALSE; PrepareExchangePacket(); diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index 0f3ebe633..3d85a9d1d 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -188,7 +188,7 @@ extern u8 gUnknown_02022C3E; extern u16 gUnknown_02022C3C; extern u8 gUnknown_02022C20[]; extern u8 gFieldLinkPlayerCount; -extern u8 LocalLinkPlayerId; +extern u8 gLocalLinkPlayerId; // IWRAM vars IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0; @@ -1641,7 +1641,7 @@ void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4) gSpecialVar_0x8004 = arg4; VarSet(VAR_0x4087, arg4); gFieldLinkPlayerCount = GetLinkPlayerCount(); - LocalLinkPlayerId = GetMultiplayerId(); + gLocalLinkPlayerId = GetMultiplayerId(); SetCableClubWarp(); SetWarpDestination(mapGroup, mapNum, -1, x, y); WarpIntoMap(); diff --git a/src/start_menu.c b/src/start_menu.c index 352f94bff..fb94fb3f7 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -84,7 +84,7 @@ EWRAM_DATA static bool8 sSavingComplete = FALSE; EWRAM_DATA static u8 sSaveInfoWindowId = 0; // Extern variables. -extern u8 LocalLinkPlayerId; +extern u8 gLocalLinkPlayerId; // Extern functions in not decompiled files. extern void sub_80AF688(void); @@ -734,7 +734,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void) { PlayRainSoundEffect(); CleanupOverworldWindowsAndTilemaps(); - ShowTrainerCardInLink(LocalLinkPlayerId, CB2_ReturnToFieldWithOpenMenu); + ShowTrainerCardInLink(gLocalLinkPlayerId, CB2_ReturnToFieldWithOpenMenu); return TRUE; }