Incorporate feedback

This commit is contained in:
Phlosioneer 2019-02-26 22:04:44 -05:00
parent eca329f9c5
commit accea672f1
12 changed files with 32 additions and 38 deletions

View File

@ -4,5 +4,5 @@ gBGTilemapBuffers3
gHeldKeyCodeToSend gHeldKeyCodeToSend
gFieldCallback gFieldCallback
gFieldCallback2 gFieldCallback2
LocalLinkPlayerId gLocalLinkPlayerId
gFieldLinkPlayerCount gFieldLinkPlayerCount

View File

@ -46,7 +46,6 @@
], ],
"coord_events": [ "coord_events": [
{ {
"comment": "This is trade seat #1.",
"type": "trigger", "type": "trigger",
"x": 4, "x": 4,
"y": 5, "y": 5,

View File

@ -299,7 +299,7 @@ extern struct LinkPlayer gLocalLinkPlayer;
bool32 Link_AnyPartnersPlayingRubyOrSapphire(void); bool32 Link_AnyPartnersPlayingRubyOrSapphire(void);
bool32 sub_800A03C(void); bool32 sub_800A03C(void);
void SetLocalLinkPlayerId(u8); void SetgLocalLinkPlayerId(u8);
u8 GetSavedPlayerCount(void); u8 GetSavedPlayerCount(void);
void sub_8009FAC(void); void sub_8009FAC(void);
bool8 sub_800A4D8(u8 a0); bool8 sub_800A4D8(u8 a0);

View File

@ -48,7 +48,7 @@ extern u16 *gBGTilemapBuffers3;
extern u16 gHeldKeyCodeToSend; extern u16 gHeldKeyCodeToSend;
extern void (*gFieldCallback)(void); extern void (*gFieldCallback)(void);
extern bool8 (*gFieldCallback2)(void); extern bool8 (*gFieldCallback2)(void);
extern u8 LocalLinkPlayerId; extern u8 gLocalLinkPlayerId;
extern u8 gFieldLinkPlayerCount; extern u8 gFieldLinkPlayerCount;
// Exported ROM declarations // Exported ROM declarations

View File

@ -83,8 +83,8 @@ bool8 sub_8153380(void);
bool8 sub_81533AC(void); bool8 sub_81533AC(void);
u8 sub_81533E0(void); u8 sub_81533E0(void);
u8 sub_8153408(void); u8 sub_8153408(void);
u8 FullSaveGame(void); //FullSaveGame u8 FullSaveGame(void);
bool8 CheckSaveFile(void); //CheckSaveFile bool8 CheckSaveFile(void);
u8 Save_LoadGameData(u8 a1); u8 Save_LoadGameData(u8 a1);
u16 sub_815355C(void); u16 sub_815355C(void);
u8 sub_81534D0(u8); u8 sub_81534D0(u8);

View File

@ -34,6 +34,8 @@
#include "battle_records.h" #include "battle_records.h"
#include "graphics.h" #include "graphics.h"
#include "new_game.h" #include "new_game.h"
#include "save.h"
#include "link.h"
#define BLENDER_SCORE_BEST 0 #define BLENDER_SCORE_BEST 0
#define BLENDER_SCORE_GOOD 1 #define BLENDER_SCORE_GOOD 1
@ -140,15 +142,8 @@ extern const u8 gText_Space[];
extern const u8 gText_BlenderMaxSpeedRecord[]; extern const u8 gText_BlenderMaxSpeedRecord[];
extern const u8 gText_234Players[]; 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_81AABF0(void (*callback)(void));
extern void sub_800B4C0(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 // this file's functions
static void BerryBlender_SetBackgroundsPos(void); static void BerryBlender_SetBackgroundsPos(void);

View File

@ -352,7 +352,7 @@ static void sub_80B2918(u8 taskId)
else else
{ {
gFieldLinkPlayerCount = GetLinkPlayerCount_2(); gFieldLinkPlayerCount = GetLinkPlayerCount_2();
LocalLinkPlayerId = GetMultiplayerId(); gLocalLinkPlayerId = GetMultiplayerId();
sub_800AA04(gFieldLinkPlayerCount); sub_800AA04(gFieldLinkPlayerCount);
card = (struct TrainerCard *)gBlockSendBuffer; card = (struct TrainerCard *)gBlockSendBuffer;
TrainerCard_GenerateCardForPlayer(card); TrainerCard_GenerateCardForPlayer(card);
@ -399,7 +399,7 @@ static void sub_80B2A08(u8 taskId)
else else
{ {
gFieldLinkPlayerCount = GetLinkPlayerCount_2(); gFieldLinkPlayerCount = GetLinkPlayerCount_2();
LocalLinkPlayerId = GetMultiplayerId(); gLocalLinkPlayerId = GetMultiplayerId();
sub_800AA04(gFieldLinkPlayerCount); sub_800AA04(gFieldLinkPlayerCount);
card = (struct TrainerCard *)gBlockSendBuffer; card = (struct TrainerCard *)gBlockSendBuffer;
TrainerCard_GenerateCardForPlayer(card); TrainerCard_GenerateCardForPlayer(card);
@ -972,7 +972,7 @@ void sub_80B360C(void)
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2) if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2)
{ {
UpdatePlayerLinkBattleRecords(LocalLinkPlayerId ^ 1); UpdatePlayerLinkBattleRecords(gLocalLinkPlayerId ^ 1);
if (gWirelessCommType) if (gWirelessCommType)
{ {
switch (gBattleOutcome) switch (gBattleOutcome)
@ -1028,7 +1028,7 @@ static void sub_80B3728(u8 taskId)
if (IsFieldMessageBoxHidden()) if (IsFieldMessageBoxHidden())
{ {
sub_8087288(); sub_8087288();
SetLocalLinkPlayerId(gSpecialVar_0x8005); SetgLocalLinkPlayerId(gSpecialVar_0x8005);
task->data[0] = 2; task->data[0] = 2;
} }
break; break;

View File

@ -302,7 +302,7 @@ void LinkTestScreen(void)
SetMainCallback2(CB2_LinkTest); SetMainCallback2(CB2_LinkTest);
} }
void SetLocalLinkPlayerId(u8 playerId) void SetgLocalLinkPlayerId(u8 playerId)
{ {
gLocalLinkPlayer.id = playerId; gLocalLinkPlayer.id = playerId;
} }

View File

@ -203,7 +203,7 @@ u16 *gBGTilemapBuffers3;
u16 gHeldKeyCodeToSend; u16 gHeldKeyCodeToSend;
void (*gFieldCallback)(void); void (*gFieldCallback)(void);
bool8 (*gFieldCallback2)(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; u8 gFieldLinkPlayerCount;
// EWRAM vars // EWRAM vars
@ -2194,13 +2194,13 @@ static void sub_8086A80(void)
static void SetCameraToTrackGuestPlayer(void) static void SetCameraToTrackGuestPlayer(void)
{ {
InitCameraUpdateCallback(GetSpriteForLinkedPlayer(LocalLinkPlayerId)); InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLocalLinkPlayerId));
} }
// Duplicate function. // Duplicate function.
static void SetCameraToTrackGuestPlayer_2(void) static void SetCameraToTrackGuestPlayer_2(void)
{ {
InitCameraUpdateCallback(GetSpriteForLinkedPlayer(LocalLinkPlayerId)); InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLocalLinkPlayerId));
} }
static void sub_8086AE4(void) 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 // This is a hack of some kind; it's undone in sub_8086B14, which is called
// soon after this function. // soon after this function.
sub_8088B3C(x + LocalLinkPlayerId, y); sub_8088B3C(x + gLocalLinkPlayerId, y);
} }
static void sub_8086B14(void) static void sub_8086B14(void)
@ -2219,7 +2219,7 @@ static void sub_8086B14(void)
u16 x, y; u16 x, y;
GetCameraFocusCoords(&x, &y); GetCameraFocusCoords(&x, &y);
x -= LocalLinkPlayerId; x -= gLocalLinkPlayerId;
for (i = 0; i < gFieldLinkPlayerCount; i++) for (i = 0; i < gFieldLinkPlayerCount; i++)
{ {
@ -2242,7 +2242,7 @@ static void CB1_UpdateLinkState(void)
{ {
if (gWirelessCommType == 0 || !IsRfuRecvQueueEmpty() || !IsSendingKeysToLink()) if (gWirelessCommType == 0 || !IsRfuRecvQueueEmpty() || !IsSendingKeysToLink())
{ {
u8 selfId = LocalLinkPlayerId; u8 selfId = gLocalLinkPlayerId;
UpdateAllLinkPlayers(gLinkPartnersHeldKeys, selfId); UpdateAllLinkPlayers(gLinkPartnersHeldKeys, selfId);
// Note: Because guestId is between 0 and 4, while the smallest key code is // 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. // Returns true if all connected players are in tradingState.
static bool32 AreAllPlayersInState(u16 tradingState) static bool32 AreAllPlayersInTradingState(u16 tradingState)
{ {
s32 i; s32 i;
s32 count = gFieldLinkPlayerCount; s32 count = gFieldLinkPlayerCount;
@ -2307,7 +2307,7 @@ static bool32 AreAllPlayersInState(u16 tradingState)
return TRUE; return TRUE;
} }
static bool32 AreAnyPlayersInTradingState(u16 tradingState) static bool32 IsAnyPlayerInTradingState(u16 tradingState)
{ {
s32 i; s32 i;
s32 count = gFieldLinkPlayerCount; s32 count = gFieldLinkPlayerCount;
@ -2336,7 +2336,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
} }
return; return;
} }
if (AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) if (IsAnyPlayerInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE)
{ {
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isLocalPlayer) if (trainer->isLocalPlayer)
@ -2629,7 +2629,7 @@ static u16 KeyInterCB_WaitForPlayersToExit(u32 keyOrPlayerId)
// CB1_UpdateLinkState. // CB1_UpdateLinkState.
if (sPlayerTradingStates[keyOrPlayerId] != PLAYER_TRADING_STATE_EXITING_ROOM) if (sPlayerTradingStates[keyOrPlayerId] != PLAYER_TRADING_STATE_EXITING_ROOM)
CheckRfuKeepAliveTimer(); CheckRfuKeepAliveTimer();
if (AreAllPlayersInState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) if (AreAllPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE)
{ {
ScriptContext1_SetupScript(EventScript_DoLinkRoomExit); ScriptContext1_SetupScript(EventScript_DoLinkRoomExit);
SetKeyInterceptCallback(KeyInterCB_SendNothing); SetKeyInterceptCallback(KeyInterCB_SendNothing);
@ -2651,20 +2651,20 @@ static u16 KeyInterCB_SendNothing_2(u32 key)
u32 sub_8087214(void) u32 sub_8087214(void)
{ {
if (AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) if (IsAnyPlayerInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE)
return 2; 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; return 0;
if (sPlayerKeyInterceptCallback == KeyInterCB_DoNothingAndKeepAlive && sPlayerTradingStates[LocalLinkPlayerId] == PLAYER_TRADING_STATE_BUSY) if (sPlayerKeyInterceptCallback == KeyInterCB_DoNothingAndKeepAlive && sPlayerTradingStates[gLocalLinkPlayerId] == PLAYER_TRADING_STATE_BUSY)
return 2; return 2;
if (AreAllPlayersInState(PLAYER_TRADING_STATE_UNK_2) != FALSE) if (AreAllPlayersInTradingState(PLAYER_TRADING_STATE_UNK_2) != FALSE)
return 1; return 1;
return 0; return 0;
} }
bool32 sub_808727C(void) bool32 sub_808727C(void)
{ {
return AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM); return IsAnyPlayerInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM);
} }
u16 sub_8087288(void) u16 sub_8087288(void)

View File

@ -324,7 +324,7 @@ static void Task_RecordMixing_Main(u8 taskId)
case 0: // init case 0: // init
sSentRecord = malloc(sizeof(union PlayerRecords)); sSentRecord = malloc(sizeof(union PlayerRecords));
sReceivedRecords = malloc(sizeof(union PlayerRecords) * 4); sReceivedRecords = malloc(sizeof(union PlayerRecords) * 4);
SetLocalLinkPlayerId(gSpecialVar_0x8005); SetgLocalLinkPlayerId(gSpecialVar_0x8005);
VarSet(VAR_TEMP_0, 1); VarSet(VAR_TEMP_0, 1);
gUnknown_03001130 = FALSE; gUnknown_03001130 = FALSE;
PrepareExchangePacket(); PrepareExchangePacket();

View File

@ -188,7 +188,7 @@ extern u8 gUnknown_02022C3E;
extern u16 gUnknown_02022C3C; extern u16 gUnknown_02022C3C;
extern u8 gUnknown_02022C20[]; extern u8 gUnknown_02022C20[];
extern u8 gFieldLinkPlayerCount; extern u8 gFieldLinkPlayerCount;
extern u8 LocalLinkPlayerId; extern u8 gLocalLinkPlayerId;
// IWRAM vars // IWRAM vars
IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0; 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; gSpecialVar_0x8004 = arg4;
VarSet(VAR_0x4087, arg4); VarSet(VAR_0x4087, arg4);
gFieldLinkPlayerCount = GetLinkPlayerCount(); gFieldLinkPlayerCount = GetLinkPlayerCount();
LocalLinkPlayerId = GetMultiplayerId(); gLocalLinkPlayerId = GetMultiplayerId();
SetCableClubWarp(); SetCableClubWarp();
SetWarpDestination(mapGroup, mapNum, -1, x, y); SetWarpDestination(mapGroup, mapNum, -1, x, y);
WarpIntoMap(); WarpIntoMap();

View File

@ -84,7 +84,7 @@ EWRAM_DATA static bool8 sSavingComplete = FALSE;
EWRAM_DATA static u8 sSaveInfoWindowId = 0; EWRAM_DATA static u8 sSaveInfoWindowId = 0;
// Extern variables. // Extern variables.
extern u8 LocalLinkPlayerId; extern u8 gLocalLinkPlayerId;
// Extern functions in not decompiled files. // Extern functions in not decompiled files.
extern void sub_80AF688(void); extern void sub_80AF688(void);
@ -734,7 +734,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void)
{ {
PlayRainSoundEffect(); PlayRainSoundEffect();
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();
ShowTrainerCardInLink(LocalLinkPlayerId, CB2_ReturnToFieldWithOpenMenu); ShowTrainerCardInLink(gLocalLinkPlayerId, CB2_ReturnToFieldWithOpenMenu);
return TRUE; return TRUE;
} }