Clean up mistakes and bad formatting

This commit is contained in:
Phlosioneer 2019-02-18 01:03:44 -05:00
parent 327de0283d
commit 08579edbcd
19 changed files with 159 additions and 158 deletions

View File

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

View File

@ -1157,12 +1157,12 @@ EverGrandeCity_HallOfFame_EventScript_271851:: @ 8271851
setvar VAR_0x40D3, 1 setvar VAR_0x40D3, 1
return return
gEventScript_WhiteOut:: @ 8271857 EventScript_WhiteOut:: @ 8271857
call EverGrandeCity_HallOfFame_EventScript_2718CC call EverGrandeCity_HallOfFame_EventScript_2718CC
goto gEventScript_ResetMrBriney goto EventScript_ResetMrBriney
end end
gEventScript_ResetMrBriney:: @ 8271862 EventScript_ResetMrBriney:: @ 8271862
compare VAR_0x4096, 1 compare VAR_0x4096, 1
goto_if_eq EventScript_MoveMrBrineyToHouse goto_if_eq EventScript_MoveMrBrineyToHouse
compare VAR_0x4096, 2 compare VAR_0x4096, 2
@ -1610,7 +1610,7 @@ EventScript_271D5E:: @ 8271D5E
goto EventScript_271D89 goto EventScript_271D89
EventScript_271D83:: @ 8271D83 EventScript_271D83:: @ 8271D83
special EventScript_RecordMixingPlayerSpotTriggered special RecordMixingPlayerSpotTriggered
waitstate waitstate
lock lock
faceplayer faceplayer

View File

@ -52,7 +52,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_DoubleBattleColosseum_PlayerSpot0" "script": "EventScript_DoubleBattleColosseum_PlayerSpot0"
}, },
{ {
"type": "trigger", "type": "trigger",
@ -61,7 +61,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_DoubleBattleColosseum_PlayerSpot2" "script": "EventScript_DoubleBattleColosseum_PlayerSpot2"
}, },
{ {
"type": "trigger", "type": "trigger",
@ -70,7 +70,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_DoubleBattleColosseum_PlayerSpot1" "script": "EventScript_DoubleBattleColosseum_PlayerSpot1"
}, },
{ {
"type": "trigger", "type": "trigger",
@ -79,7 +79,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_DoubleBattleColosseum_PlayerSpot3" "script": "EventScript_DoubleBattleColosseum_PlayerSpot3"
} }
], ],
"bg_events": [] "bg_events": []

View File

@ -248,7 +248,7 @@ MossdeepCity_SpaceCenter_2F_EventScript_22400C:: @ 822400C
waitmovement 0 waitmovement 0
special SavePlayerParty special SavePlayerParty
fadescreen 1 fadescreen 1
special EventScript_ChooseHalfPartyForBattle special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_ne MossdeepCity_SpaceCenter_2F_EventScript_224032 goto_if_ne MossdeepCity_SpaceCenter_2F_EventScript_224032

View File

@ -66,7 +66,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_RecordCenter_Spot0" "script": "EventScript_RecordCenter_Spot0"
}, },
{ {
"type": "trigger", "type": "trigger",
@ -75,7 +75,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_RecordCenter_Spot2" "script": "EventScript_RecordCenter_Spot2"
}, },
{ {
"type": "trigger", "type": "trigger",
@ -84,7 +84,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_RecordCenter_Spot1" "script": "EventScript_RecordCenter_Spot1"
}, },
{ {
"type": "trigger", "type": "trigger",
@ -93,7 +93,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_RecordCenter_Spot3" "script": "EventScript_RecordCenter_Spot3"
} }
], ],
"bg_events": [] "bg_events": []

View File

@ -52,7 +52,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_SingleBattleColosseum_PlayerSpot0" "script": "EventScript_SingleBattleColosseum_PlayerSpot0"
}, },
{ {
"type": "trigger", "type": "trigger",
@ -61,7 +61,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_SingleBattleColosseum_PlayerSpot1" "script": "EventScript_SingleBattleColosseum_PlayerSpot1"
} }
], ],
"bg_events": [] "bg_events": []

View File

@ -129,7 +129,7 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_227AE2:: @ 8227AE2
SootopolisCity_MysteryEventsHouse_1F_EventScript_227AEF:: @ 8227AEF SootopolisCity_MysteryEventsHouse_1F_EventScript_227AEF:: @ 8227AEF
msgbox SootopolisCity_MysteryEventsHouse_1F_Text_227C84, MSGBOX_DEFAULT msgbox SootopolisCity_MysteryEventsHouse_1F_Text_227C84, MSGBOX_DEFAULT
fadescreen 1 fadescreen 1
special EventScript_ChooseHalfPartyForBattle special ChooseHalfPartyForBattle
waitstate waitstate
return return

View File

@ -53,7 +53,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_TradeCenter_Chair0" "script": "EventScript_TradeCenter_Chair0"
}, },
{ {
"comment": "This is trade seat #2.", "comment": "This is trade seat #2.",
@ -63,7 +63,7 @@
"elevation": 3, "elevation": 3,
"var": "VAR_TEMP_0", "var": "VAR_TEMP_0",
"var_value": 0, "var_value": 0,
"script": "gEventScript_TradeCenter_Chair1" "script": "EventScript_TradeCenter_Chair1"
} }
], ],
"bg_events": [] "bg_events": []

View File

@ -791,118 +791,118 @@ EventScript_CableBoxResults:: @ 8277365
releaseall releaseall
end end
gEventScript_SingleBattleColosseum_PlayerSpot0:: @ 8277374 EventScript_SingleBattleColosseum_PlayerSpot0:: @ 8277374
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special EventScript_ColosseumPlayerSpotTriggered special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gEventScript_SingleBattleColosseum_PlayerSpot1:: @ 827737E EventScript_SingleBattleColosseum_PlayerSpot1:: @ 827737E
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special EventScript_ColosseumPlayerSpotTriggered special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gEventScript_DoubleBattleColosseum_PlayerSpot0:: @ 8277388 EventScript_DoubleBattleColosseum_PlayerSpot0:: @ 8277388
fadescreen 1 fadescreen 1
special EventScript_ChooseHalfPartyForBattle special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq gEventScript_DoubleBattleColosseum_CancelSpotTrigger goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special EventScript_ColosseumPlayerSpotTriggered special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gEventScript_DoubleBattleColosseum_PlayerSpot1:: @ 82773A3 EventScript_DoubleBattleColosseum_PlayerSpot1:: @ 82773A3
fadescreen 1 fadescreen 1
special EventScript_ChooseHalfPartyForBattle special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq gEventScript_DoubleBattleColosseum_CancelSpotTrigger goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special EventScript_ColosseumPlayerSpotTriggered special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gEventScript_DoubleBattleColosseum_PlayerSpot2:: @ 82773BE EventScript_DoubleBattleColosseum_PlayerSpot2:: @ 82773BE
fadescreen 1 fadescreen 1
special EventScript_ChooseHalfPartyForBattle special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq gEventScript_DoubleBattleColosseum_CancelSpotTrigger goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 2 setvar VAR_0x8005, 2
special EventScript_ColosseumPlayerSpotTriggered special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gEventScript_DoubleBattleColosseum_PlayerSpot3:: @ 82773D9 EventScript_DoubleBattleColosseum_PlayerSpot3:: @ 82773D9
fadescreen 1 fadescreen 1
special EventScript_ChooseHalfPartyForBattle special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq gEventScript_DoubleBattleColosseum_CancelSpotTrigger goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 3 setvar VAR_0x8005, 3
special EventScript_ColosseumPlayerSpotTriggered special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gEventScript_DoubleBattleColosseum_CancelSpotTrigger:: @ 82773F4 EventScript_DoubleBattleColosseum_CancelSpotTrigger:: @ 82773F4
end end
gEventScript_TradeCenter_Chair0:: @ 82773F5 EventScript_TradeCenter_Chair0:: @ 82773F5
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special EventScript_PlayerEnteredTradeSeat special PlayerEnteredTradeSeat
waitstate waitstate
end end
gEventScript_TradeCenter_Chair1:: @ 82773FF EventScript_TradeCenter_Chair1:: @ 82773FF
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special EventScript_PlayerEnteredTradeSeat special PlayerEnteredTradeSeat
waitstate waitstate
end end
/* Never used */ /* Never used */
gEventScript_TradeCenter_Chair2:: @ 8277409 EventScript_TradeCenter_Chair2:: @ 8277409
setvar VAR_0x8005, 2 setvar VAR_0x8005, 2
special EventScript_PlayerEnteredTradeSeat special PlayerEnteredTradeSeat
waitstate waitstate
end end
/* Never used */ /* Never used */
gEventScript_TradeCenter_Chair3:: @ 8277413 EventScript_TradeCenter_Chair3:: @ 8277413
setvar VAR_0x8005, 3 setvar VAR_0x8005, 3
special EventScript_PlayerEnteredTradeSeat special PlayerEnteredTradeSeat
waitstate waitstate
end end
gEventScript_RecordCenter_Spot0:: @ 827741D EventScript_RecordCenter_Spot0:: @ 827741D
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special EventScript_RecordMixingPlayerSpotTriggered special RecordMixingPlayerSpotTriggered
waitstate waitstate
compare VAR_TEMP_1, 0 compare VAR_TEMP_1, 0
goto_if_ne RecordCorner_EventScript_277471 goto_if_ne RecordCorner_EventScript_277471
end end
gEventScript_RecordCenter_Spot1:: @ 8277432 EventScript_RecordCenter_Spot1:: @ 8277432
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special EventScript_RecordMixingPlayerSpotTriggered special RecordMixingPlayerSpotTriggered
waitstate waitstate
compare VAR_TEMP_1, 0 compare VAR_TEMP_1, 0
goto_if_ne RecordCorner_EventScript_277471 goto_if_ne RecordCorner_EventScript_277471
end end
gEventScript_RecordCenter_Spot2:: @ 8277447 EventScript_RecordCenter_Spot2:: @ 8277447
setvar VAR_0x8005, 2 setvar VAR_0x8005, 2
special EventScript_RecordMixingPlayerSpotTriggered special RecordMixingPlayerSpotTriggered
waitstate waitstate
compare VAR_TEMP_1, 0 compare VAR_TEMP_1, 0
goto_if_ne RecordCorner_EventScript_277471 goto_if_ne RecordCorner_EventScript_277471
end end
gEventScript_RecordCenter_Spot3:: @ 827745C EventScript_RecordCenter_Spot3:: @ 827745C
setvar VAR_0x8005, 3 setvar VAR_0x8005, 3
special EventScript_RecordMixingPlayerSpotTriggered special RecordMixingPlayerSpotTriggered
waitstate waitstate
compare VAR_TEMP_1, 0 compare VAR_TEMP_1, 0
goto_if_ne RecordCorner_EventScript_277471 goto_if_ne RecordCorner_EventScript_277471
@ -969,22 +969,22 @@ RecordCorner_EventScript_2774E0:: @ 82774E0
closemessage closemessage
end end
gEventScript_ConfirmLeaveTradeRoom:: @ 82774EF EventScript_ConfirmLeaveTradeRoom:: @ 82774EF
msgbox Text_TerminateLinkConfirmation, MSGBOX_YESNO msgbox Text_TerminateLinkConfirmation, MSGBOX_YESNO
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_if_eq gEventScript_TerminateLink goto_if_eq EventScript_TerminateLink
erasebox 0, 0, 29, 19 erasebox 0, 0, 29, 19
releaseall releaseall
end end
gEventScript_TerminateLink:: @ 8277509 EventScript_TerminateLink:: @ 8277509
messageautoscroll Text_TerminateLinkPleaseWait messageautoscroll Text_TerminateLinkPleaseWait
waitmessage waitmessage
special EventScript_ExitLinkRoom special ExitLinkRoom
end end
gEventScript_DoLinkRoomExit:: @ 8277513 EventScript_DoLinkRoomExit:: @ 8277513
special EventScript_CleanupLinkRoomState special CleanupLinkRoomState
special sub_80AF9F8 special sub_80AF9F8
waitstate waitstate
end end

View File

@ -12,8 +12,8 @@ gSpecials:: @ 81DBA64
def_special SetCableClubWarp def_special SetCableClubWarp
def_special sub_80AF948 def_special sub_80AF948
def_special sub_80AF9F8 def_special sub_80AF9F8
def_special EventScript_CleanupLinkRoomState def_special CleanupLinkRoomState
def_special EventScript_ExitLinkRoom def_special ExitLinkRoom
def_special sub_80E8E18 def_special sub_80E8E18
def_special sub_80E8BC8 def_special sub_80E8BC8
def_special sub_80E9068 def_special sub_80E9068
@ -35,14 +35,14 @@ gSpecials:: @ 81DBA64
def_special sub_80E91F8 def_special sub_80E91F8
def_special sub_80EA30C def_special sub_80EA30C
def_special DoSecretBasePCTurnOffEffect def_special DoSecretBasePCTurnOffEffect
def_special EventScript_RecordMixingPlayerSpotTriggered def_special RecordMixingPlayerSpotTriggered
def_special sub_80B2DA4 def_special sub_80B2DA4
def_special sub_80B2E4C def_special sub_80B2E4C
def_special sub_80B2E74 def_special sub_80B2E74
def_special sub_80B2EA8 def_special sub_80B2EA8
def_special CloseLink def_special CloseLink
def_special EventScript_ColosseumPlayerSpotTriggered def_special ColosseumPlayerSpotTriggered
def_special EventScript_PlayerEnteredTradeSeat def_special PlayerEnteredTradeSeat
def_special nullsub_37 def_special nullsub_37
def_special sub_80B3254 def_special sub_80B3254
def_special sub_80B2FD8 def_special sub_80B2FD8
@ -50,7 +50,7 @@ gSpecials:: @ 81DBA64
def_special SpawnLinkPartnerEventObject def_special SpawnLinkPartnerEventObject
def_special SavePlayerParty def_special SavePlayerParty
def_special LoadPlayerParty def_special LoadPlayerParty
def_special EventScript_ChooseHalfPartyForBattle def_special ChooseHalfPartyForBattle
def_special sp02A_crash_sound def_special sp02A_crash_sound
def_special EventObjectInteractionGetBerryTreeData def_special EventObjectInteractionGetBerryTreeData
def_special EventObjectInteractionGetBerryName def_special EventObjectInteractionGetBerryName

View File

@ -910,7 +910,7 @@ struct MapPosition
struct TradeRoomPlayer struct TradeRoomPlayer
{ {
u8 playerId; u8 playerId;
u8 isSelf; u8 isLocalPlayer;
u8 c; u8 c;
u8 facing; u8 facing;
struct MapPosition pos; struct MapPosition pos;

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 gLinkSelfPlayerId; extern u8 LocalLinkPlayerId;
extern u8 gFieldLinkPlayerCount; extern u8 gFieldLinkPlayerCount;
// Exported ROM declarations // Exported ROM declarations

View File

@ -7,7 +7,7 @@ struct PlayerHallRecords
struct RankingHall2P twoPlayers[2]; struct RankingHall2P twoPlayers[2];
}; };
void EventScript_RecordMixingPlayerSpotTriggered(void); void RecordMixingPlayerSpotTriggered(void);
void GetPlayerHallRecords(struct PlayerHallRecords *dst); void GetPlayerHallRecords(struct PlayerHallRecords *dst);
#endif //GUARD_RECORD_MIXING_H #endif //GUARD_RECORD_MIXING_H

View File

@ -352,7 +352,7 @@ static void sub_80B2918(u8 taskId)
else else
{ {
gFieldLinkPlayerCount = GetLinkPlayerCount_2(); gFieldLinkPlayerCount = GetLinkPlayerCount_2();
gLinkSelfPlayerId = GetMultiplayerId(); LocalLinkPlayerId = 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();
gLinkSelfPlayerId = GetMultiplayerId(); LocalLinkPlayerId = 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(gLinkSelfPlayerId ^ 1); UpdatePlayerLinkBattleRecords(LocalLinkPlayerId ^ 1);
if (gWirelessCommType) if (gWirelessCommType)
{ {
switch (gBattleOutcome) switch (gBattleOutcome)
@ -999,7 +999,7 @@ void sub_80B360C(void)
SetMainCallback2(sub_80A0514); SetMainCallback2(sub_80A0514);
} }
void EventScript_CleanupLinkRoomState(void) void CleanupLinkRoomState(void)
{ {
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2 || gSpecialVar_0x8004 == 5 || gSpecialVar_0x8004 == 9) if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2 || gSpecialVar_0x8004 == 5 || gSpecialVar_0x8004 == 9)
{ {
@ -1009,13 +1009,11 @@ void EventScript_CleanupLinkRoomState(void)
SetWarpDestinationToDynamicWarp(0x7F); SetWarpDestinationToDynamicWarp(0x7F);
} }
void EventScript_ExitLinkRoom(void) void ExitLinkRoom(void)
{ {
QueueExitLinkRoomKey(); QueueExitLinkRoomKey();
} }
// I can't find anything that would set data[0] to a value before this
// stask starts. Is it a bug?
static void sub_80B3728(u8 taskId) static void sub_80B3728(u8 taskId)
{ {
struct Task* task = &gTasks[taskId]; struct Task* task = &gTasks[taskId];
@ -1133,7 +1131,7 @@ static void sub_80B3894(u8 taskId)
} }
// Note: VAR_0x8005 is set to the ID of the trade seat. // Note: VAR_0x8005 is set to the ID of the trade seat.
void EventScript_PlayerEnteredTradeSeat(void) void PlayerEnteredTradeSeat(void)
{ {
if (gWirelessCommType != 0) if (gWirelessCommType != 0)
{ {
@ -1156,7 +1154,7 @@ void nullsub_37(void)
} }
// Note: VAR_0x8005 is set to the ID of the player spot. // Note: VAR_0x8005 is set to the ID of the player spot.
void EventScript_ColosseumPlayerSpotTriggered(void) void ColosseumPlayerSpotTriggered(void)
{ {
gLinkType = 0x2211; gLinkType = 0x2211;

View File

@ -82,26 +82,26 @@
#define FACING_FORCED_RIGHT 10 #define FACING_FORCED_RIGHT 10
// event scripts // event scripts
extern const u8 gEventScript_WhiteOut[]; extern const u8 EventScript_WhiteOut[];
extern const u8 gEventScript_ResetMrBriney[]; extern const u8 EventScript_ResetMrBriney[];
extern const u8 gEventScript_DoLinkRoomExit[]; extern const u8 EventScript_DoLinkRoomExit[];
extern const u8 gEventScript_TradeRoom_TooBusyToNotice[]; extern const u8 gEventScript_TradeRoom_TooBusyToNotice[];
extern const u8 gEventScript_TradeRoom_ReadTrainerCard_NoColor[]; extern const u8 gEventScript_TradeRoom_ReadTrainerCard_NoColor[];
extern const u8 gEventScript_TradeRoom_ReadTrainerCard_Normal[]; extern const u8 gEventScript_TradeRoom_ReadTrainerCard_Normal[];
extern const u8 gEventScript_DoubleBattleColosseum_PlayerSpot0[]; extern const u8 EventScript_DoubleBattleColosseum_PlayerSpot0[];
extern const u8 gEventScript_DoubleBattleColosseum_PlayerSpot1[]; extern const u8 EventScript_DoubleBattleColosseum_PlayerSpot1[];
extern const u8 gEventScript_DoubleBattleColosseum_PlayerSpot2[]; extern const u8 EventScript_DoubleBattleColosseum_PlayerSpot2[];
extern const u8 gEventScript_DoubleBattleColosseum_PlayerSpot3[]; extern const u8 EventScript_DoubleBattleColosseum_PlayerSpot3[];
extern const u8 gEventScript_RecordCenter_Spot0[]; extern const u8 EventScript_RecordCenter_Spot0[];
extern const u8 gEventScript_RecordCenter_Spot1[]; extern const u8 EventScript_RecordCenter_Spot1[];
extern const u8 gEventScript_RecordCenter_Spot2[]; extern const u8 EventScript_RecordCenter_Spot2[];
extern const u8 gEventScript_RecordCenter_Spot3[]; extern const u8 EventScript_RecordCenter_Spot3[];
extern const u8 gEventScript_SingleBattleColosseum_PlayerSpot0[]; extern const u8 EventScript_SingleBattleColosseum_PlayerSpot0[];
extern const u8 gEventScript_SingleBattleColosseum_PlayerSpot1[]; extern const u8 EventScript_SingleBattleColosseum_PlayerSpot1[];
extern const u8 gEventScript_TradeCenter_Chair1[]; extern const u8 EventScript_TradeCenter_Chair1[];
extern const u8 gEventScript_TradeCenter_Chair0[]; extern const u8 EventScript_TradeCenter_Chair0[];
extern const u8 gEventScript_ConfirmLeaveTradeRoom[]; extern const u8 EventScript_ConfirmLeaveTradeRoom[];
extern const u8 gEventScript_TerminateLink[]; extern const u8 EventScript_TerminateLink[];
extern const struct MapLayout *const gMapLayouts[]; extern const struct MapLayout *const gMapLayouts[];
extern const struct MapHeader *const *const gMapGroups[]; extern const struct MapHeader *const *const gMapGroups[];
@ -186,7 +186,7 @@ static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStr
static u16 GetCenterScreenMetatileBehavior(void); static u16 GetCenterScreenMetatileBehavior(void);
// IWRAM bss vars // IWRAM bss vars
IWRAM_DATA static void *sUnusedCallback; IWRAM_DATA static void *sUnusedOverworldCallback;
IWRAM_DATA static u8 sPlayerTradingStates[4]; IWRAM_DATA static u8 sPlayerTradingStates[4];
// This callback is called with a player's key code. It then returns an // This callback is called with a player's key code. It then returns an
// adjusted key code, effectively intercepting the input before anything // adjusted key code, effectively intercepting the input before anything
@ -203,7 +203,7 @@ u16 *gBGTilemapBuffers3;
u16 gHeldKeyCodeToSend; u16 gHeldKeyCodeToSend;
void (*gFieldCallback)(void); void (*gFieldCallback)(void);
bool8 (*gFieldCallback2)(void); bool8 (*gFieldCallback2)(void);
u8 gLinkSelfPlayerId; // This is our player id in a multiplayer mode. u8 LocalLinkPlayerId; // This is our player id in a multiplayer mode.
u8 gFieldLinkPlayerCount; u8 gFieldLinkPlayerCount;
// EWRAM vars // EWRAM vars
@ -383,7 +383,7 @@ static void (*const gMovementStatusHandler[])(struct LinkPlayerEventObject *, st
// code // code
void DoWhiteOut(void) void DoWhiteOut(void)
{ {
ScriptContext2_RunNewScript(gEventScript_WhiteOut); ScriptContext2_RunNewScript(EventScript_WhiteOut);
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2); SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
HealPlayerParty(); HealPlayerParty();
Overworld_ResetStateAfterWhiteOut(); Overworld_ResetStateAfterWhiteOut();
@ -409,7 +409,7 @@ void Overworld_ResetStateAfterTeleport(void)
FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_SAFARI_MODE);
FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_USE_STRENGTH);
FlagClear(FLAG_SYS_USE_FLASH); FlagClear(FLAG_SYS_USE_FLASH);
ScriptContext2_RunNewScript(gEventScript_ResetMrBriney); ScriptContext2_RunNewScript(EventScript_ResetMrBriney);
} }
void Overworld_ResetStateAfterDigEscRope(void) void Overworld_ResetStateAfterDigEscRope(void)
@ -1122,7 +1122,7 @@ u16 GetCurrLocationDefaultMusic(void)
} }
else else
{ {
if (gSaveBlock1Ptr->pos.x < LINK_KEY_CODE_START_BUTTON) if (gSaveBlock1Ptr->pos.x < 24)
return MUS_DOORO_X1; return MUS_DOORO_X1;
else else
return MUS_GRANROAD; return MUS_GRANROAD;
@ -1265,7 +1265,7 @@ static void PlayAmbientCry(void)
&& !MetatileBehavior_IsSurfableWaterOrUnderwater(MapGridGetMetatileBehaviorAt(x, y))) && !MetatileBehavior_IsSurfableWaterOrUnderwater(MapGridGetMetatileBehaviorAt(x, y)))
return; return;
pan = (Random() % 88) + 212; pan = (Random() % 88) + 212;
volume = (Random() % LINK_KEY_CODE_UNK_8) + 50; volume = (Random() % 30) + 50;
PlayCry2(sAmbientCrySpecies, pan, volume, 1); PlayCry2(sAmbientCrySpecies, pan, volume, 1);
} }
@ -1501,7 +1501,7 @@ void SetMainCallback1(MainCallback cb)
// This function is never called. // This function is never called.
void SetUnusedCallback(void *func) void SetUnusedCallback(void *func)
{ {
sUnusedCallback = func; sUnusedOverworldCallback = func;
} }
static bool8 map_post_load_hook_exec(void) static bool8 map_post_load_hook_exec(void)
@ -2194,13 +2194,13 @@ static void sub_8086A80(void)
static void SetCameraToTrackGuestPlayer(void) static void SetCameraToTrackGuestPlayer(void)
{ {
InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLinkSelfPlayerId)); InitCameraUpdateCallback(GetSpriteForLinkedPlayer(LocalLinkPlayerId));
} }
// Duplicate function. // Duplicate function.
static void SetCameraToTrackGuestPlayer_2(void) static void SetCameraToTrackGuestPlayer_2(void)
{ {
InitCameraUpdateCallback(GetSpriteForLinkedPlayer(gLinkSelfPlayerId)); InitCameraUpdateCallback(GetSpriteForLinkedPlayer(LocalLinkPlayerId));
} }
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 + gLinkSelfPlayerId, y); sub_8088B3C(x + LocalLinkPlayerId, 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 -= gLinkSelfPlayerId; x -= LocalLinkPlayerId;
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 = gLinkSelfPlayerId; u8 selfId = LocalLinkPlayerId;
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
@ -2307,7 +2307,7 @@ static bool32 AreAllPlayersInState(u16 tradingState)
return TRUE; return TRUE;
} }
static bool32 AreAnyPlayersInState(u16 tradingState) static bool32 AreAnyPlayersInTradingState(u16 tradingState)
{ {
s32 i; s32 i;
s32 count = gFieldLinkPlayerCount; s32 count = gFieldLinkPlayerCount;
@ -2329,17 +2329,17 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
{ {
*forceFacing = GetDirectionForEventScript(script); *forceFacing = GetDirectionForEventScript(script);
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isSelf) if (trainer->isLocalPlayer)
{ {
SetKeyInterceptCallback(KeyInterCB_DeferToEventScript); SetKeyInterceptCallback(KeyInterCB_DeferToEventScript);
sub_8087530(script); sub_8087530(script);
} }
return; return;
} }
if (AreAnyPlayersInState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) if (AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE)
{ {
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isSelf) if (trainer->isLocalPlayer)
{ {
SetKeyInterceptCallback(KeyInterCB_DeferToEventScript); SetKeyInterceptCallback(KeyInterCB_DeferToEventScript);
sub_8087584(); sub_8087584();
@ -2353,7 +2353,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
if (sub_8087340_2(trainer)) if (sub_8087340_2(trainer))
{ {
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isSelf) if (trainer->isLocalPlayer)
{ {
SetKeyInterceptCallback(KeyInterCB_DeferToEventScript); SetKeyInterceptCallback(KeyInterCB_DeferToEventScript);
InitLinkRoomStartMenuScript(); InitLinkRoomStartMenuScript();
@ -2364,7 +2364,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
if (PlayerIsAtSouthExit(trainer) == TRUE) if (PlayerIsAtSouthExit(trainer) == TRUE)
{ {
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isSelf) if (trainer->isLocalPlayer)
{ {
SetKeyInterceptCallback(KeyInterCB_DeferToEventScript); SetKeyInterceptCallback(KeyInterCB_DeferToEventScript);
CreateConfirmLeaveTradeRoomPrompt(); CreateConfirmLeaveTradeRoomPrompt();
@ -2376,7 +2376,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
if (script) if (script)
{ {
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isSelf) if (trainer->isLocalPlayer)
{ {
SetKeyInterceptCallback(KeyInterCB_DeferToEventScript); SetKeyInterceptCallback(KeyInterCB_DeferToEventScript);
InitMenuBasedScript(script); InitMenuBasedScript(script);
@ -2387,7 +2387,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
if (sub_8087340(trainer)) if (sub_8087340(trainer))
{ {
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isSelf) if (trainer->isLocalPlayer)
{ {
SetKeyInterceptCallback(KeyInterCB_DeferToRecvQueue); SetKeyInterceptCallback(KeyInterCB_DeferToRecvQueue);
sub_8087510(); sub_8087510();
@ -2398,7 +2398,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
if (sub_8087340(trainer)) if (sub_8087340(trainer))
{ {
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_BUSY;
if (trainer->isSelf) if (trainer->isLocalPlayer)
{ {
SetKeyInterceptCallback(KeyInterCB_DeferToSendQueue); SetKeyInterceptCallback(KeyInterCB_DeferToSendQueue);
sub_8087510(); sub_8087510();
@ -2418,7 +2418,7 @@ static void HandleLinkPlayerKeyInput(u32 playerId, u16 key, struct TradeRoomPlay
break; break;
case LINK_KEY_CODE_UNK_4: case LINK_KEY_CODE_UNK_4:
sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_IDLE; sPlayerTradingStates[playerId] = PLAYER_TRADING_STATE_IDLE;
if (trainer->isSelf) if (trainer->isLocalPlayer)
SetKeyInterceptCallback(KeyInterCB_SelfIdle); SetKeyInterceptCallback(KeyInterCB_SelfIdle);
break; break;
case LINK_KEY_CODE_UNK_7: case LINK_KEY_CODE_UNK_7:
@ -2631,7 +2631,7 @@ static u16 KeyInterCB_WaitForPlayersToExit(u32 keyOrPlayerId)
CheckRfuKeepAliveTimer(); CheckRfuKeepAliveTimer();
if (AreAllPlayersInState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) if (AreAllPlayersInState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE)
{ {
ScriptContext1_SetupScript(gEventScript_DoLinkRoomExit); ScriptContext1_SetupScript(EventScript_DoLinkRoomExit);
SetKeyInterceptCallback(KeyInterCB_SendNothing); SetKeyInterceptCallback(KeyInterCB_SendNothing);
} }
return LINK_KEY_CODE_EMPTY; return LINK_KEY_CODE_EMPTY;
@ -2651,11 +2651,11 @@ static u16 KeyInterCB_SendNothing_2(u32 key)
u32 sub_8087214(void) u32 sub_8087214(void)
{ {
if (AreAnyPlayersInState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE) if (AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM) == TRUE)
return 2; return 2;
if (sPlayerKeyInterceptCallback == sub_8087170 && sPlayerTradingStates[gLinkSelfPlayerId] != PLAYER_TRADING_STATE_UNK_2) if (sPlayerKeyInterceptCallback == sub_8087170 && sPlayerTradingStates[LocalLinkPlayerId] != PLAYER_TRADING_STATE_UNK_2)
return 0; return 0;
if (sPlayerKeyInterceptCallback == KeyInterCB_DoNothingAndKeepAlive && sPlayerTradingStates[gLinkSelfPlayerId] == PLAYER_TRADING_STATE_BUSY) if (sPlayerKeyInterceptCallback == KeyInterCB_DoNothingAndKeepAlive && sPlayerTradingStates[LocalLinkPlayerId] == PLAYER_TRADING_STATE_BUSY)
return 2; return 2;
if (AreAllPlayersInState(PLAYER_TRADING_STATE_UNK_2) != FALSE) if (AreAllPlayersInState(PLAYER_TRADING_STATE_UNK_2) != FALSE)
return 1; return 1;
@ -2664,7 +2664,7 @@ u32 sub_8087214(void)
bool32 sub_808727C(void) bool32 sub_808727C(void)
{ {
return AreAnyPlayersInState(PLAYER_TRADING_STATE_EXITING_ROOM); return AreAnyPlayersInTradingState(PLAYER_TRADING_STATE_EXITING_ROOM);
} }
u16 sub_8087288(void) u16 sub_8087288(void)
@ -2698,7 +2698,7 @@ static void LoadTradeRoomPlayer(s32 linkPlayerId, s32 myPlayerId, struct TradeRo
s16 x, y; s16 x, y;
trainer->playerId = linkPlayerId; trainer->playerId = linkPlayerId;
trainer->isSelf = (linkPlayerId == myPlayerId) ? 1 : 0; trainer->isLocalPlayer = (linkPlayerId == myPlayerId) ? 1 : 0;
trainer->c = gLinkPlayerEventObjects[linkPlayerId].movementMode; trainer->c = gLinkPlayerEventObjects[linkPlayerId].movementMode;
trainer->facing = GetLinkPlayerFacingDirection(linkPlayerId); trainer->facing = GetLinkPlayerFacingDirection(linkPlayerId);
GetLinkPlayerCoords(linkPlayerId, &x, &y); GetLinkPlayerCoords(linkPlayerId, &x, &y);
@ -2762,7 +2762,7 @@ static const u8 *TryInteractWithPlayer(struct TradeRoomPlayer *player)
if (linkPlayerId != 4) if (linkPlayerId != 4)
{ {
if (!player->isSelf) if (!player->isLocalPlayer)
return gEventScript_TradeRoom_TooBusyToNotice; return gEventScript_TradeRoom_TooBusyToNotice;
else if (sPlayerTradingStates[linkPlayerId] != PLAYER_TRADING_STATE_IDLE) else if (sPlayerTradingStates[linkPlayerId] != PLAYER_TRADING_STATE_IDLE)
return gEventScript_TradeRoom_TooBusyToNotice; return gEventScript_TradeRoom_TooBusyToNotice;
@ -2779,29 +2779,29 @@ static const u8 *TryInteractWithPlayer(struct TradeRoomPlayer *player)
// these event scripts runs. // these event scripts runs.
static u16 GetDirectionForEventScript(const u8 *script) static u16 GetDirectionForEventScript(const u8 *script)
{ {
if (script == gEventScript_DoubleBattleColosseum_PlayerSpot0) if (script == EventScript_DoubleBattleColosseum_PlayerSpot0)
return FACING_FORCED_RIGHT; return FACING_FORCED_RIGHT;
else if (script == gEventScript_DoubleBattleColosseum_PlayerSpot1) else if (script == EventScript_DoubleBattleColosseum_PlayerSpot1)
return FACING_FORCED_LEFT; return FACING_FORCED_LEFT;
else if (script == gEventScript_DoubleBattleColosseum_PlayerSpot2) else if (script == EventScript_DoubleBattleColosseum_PlayerSpot2)
return FACING_FORCED_RIGHT; return FACING_FORCED_RIGHT;
else if (script == gEventScript_DoubleBattleColosseum_PlayerSpot3) else if (script == EventScript_DoubleBattleColosseum_PlayerSpot3)
return FACING_FORCED_LEFT; return FACING_FORCED_LEFT;
else if (script == gEventScript_RecordCenter_Spot0) else if (script == EventScript_RecordCenter_Spot0)
return FACING_FORCED_RIGHT; return FACING_FORCED_RIGHT;
else if (script == gEventScript_RecordCenter_Spot1) else if (script == EventScript_RecordCenter_Spot1)
return FACING_FORCED_LEFT; return FACING_FORCED_LEFT;
else if (script == gEventScript_RecordCenter_Spot2) else if (script == EventScript_RecordCenter_Spot2)
return FACING_FORCED_RIGHT; return FACING_FORCED_RIGHT;
else if (script == gEventScript_RecordCenter_Spot3) else if (script == EventScript_RecordCenter_Spot3)
return FACING_FORCED_LEFT; return FACING_FORCED_LEFT;
else if (script == gEventScript_SingleBattleColosseum_PlayerSpot0) else if (script == EventScript_SingleBattleColosseum_PlayerSpot0)
return FACING_FORCED_RIGHT; return FACING_FORCED_RIGHT;
else if (script == gEventScript_SingleBattleColosseum_PlayerSpot1) else if (script == EventScript_SingleBattleColosseum_PlayerSpot1)
return FACING_FORCED_LEFT; return FACING_FORCED_LEFT;
else if (script == gEventScript_TradeCenter_Chair0) else if (script == EventScript_TradeCenter_Chair0)
return FACING_FORCED_RIGHT; return FACING_FORCED_RIGHT;
else if (script == gEventScript_TradeCenter_Chair1) else if (script == EventScript_TradeCenter_Chair1)
return FACING_FORCED_LEFT; return FACING_FORCED_LEFT;
else else
return FACING_NONE; return FACING_NONE;
@ -2829,7 +2829,7 @@ static void sub_8087530(const u8 *script)
static void CreateConfirmLeaveTradeRoomPrompt(void) static void CreateConfirmLeaveTradeRoomPrompt(void)
{ {
PlaySE(SE_WIN_OPEN); PlaySE(SE_WIN_OPEN);
ScriptContext1_SetupScript(gEventScript_ConfirmLeaveTradeRoom); ScriptContext1_SetupScript(EventScript_ConfirmLeaveTradeRoom);
ScriptContext2_Enable(); ScriptContext2_Enable();
} }
@ -2842,7 +2842,7 @@ static void InitMenuBasedScript(const u8 *script)
static void sub_8087584(void) static void sub_8087584(void)
{ {
ScriptContext1_SetupScript(gEventScript_TerminateLink); ScriptContext1_SetupScript(EventScript_TerminateLink);
ScriptContext2_Enable(); ScriptContext2_Enable();
} }
@ -3046,8 +3046,11 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing)
if (linkPlayerEventObj->active) if (linkPlayerEventObj->active)
{ {
if (facing > FACING_FORCED_RIGHT) if (facing > FACING_FORCED_RIGHT)
{
eventObj->triggerGroundEffectsOnMove = 1; eventObj->triggerGroundEffectsOnMove = 1;
else { }
else
{
// This is a hack to split this code onto two separate lines, without declaring a local variable. // This is a hack to split this code onto two separate lines, without declaring a local variable.
// C++ style inline variables would be nice here. // C++ style inline variables would be nice here.
#define TEMP gLinkPlayerMovementModes[linkPlayerEventObj->movementMode](linkPlayerEventObj, eventObj, facing) #define TEMP gLinkPlayerMovementModes[linkPlayerEventObj->movementMode](linkPlayerEventObj, eventObj, facing)
@ -3131,19 +3134,19 @@ static void MovementStatusHandler_TryAdvanceScript(struct LinkPlayerEventObject
// even for Left/Right codes. // even for Left/Right codes.
static u8 FlipVerticalAndClearForced(u8 newFacing, u8 oldFacing) static u8 FlipVerticalAndClearForced(u8 newFacing, u8 oldFacing)
{ {
switch (newFacing - 1) switch (newFacing)
{ {
case (FACING_UP - 1): case FACING_UP:
case (FACING_FORCED_UP - 1): case FACING_FORCED_UP:
return DIR_NORTH; return DIR_NORTH;
case (FACING_DOWN - 1): case FACING_DOWN:
case (FACING_FORCED_DOWN - 1): case FACING_FORCED_DOWN:
return DIR_SOUTH; return DIR_SOUTH;
case (FACING_LEFT - 1): case FACING_LEFT:
case (FACING_FORCED_LEFT - 1): case FACING_FORCED_LEFT:
return DIR_WEST; return DIR_WEST;
case (FACING_RIGHT - 1): case FACING_RIGHT:
case (FACING_FORCED_RIGHT - 1): case FACING_FORCED_RIGHT:
return DIR_EAST; return DIR_EAST;
} }
return oldFacing; return oldFacing;

View File

@ -171,7 +171,7 @@ static const u8 gUnknown_0858CFBE[3][4] =
#define BUFFER_CHUNK_SIZE 200 #define BUFFER_CHUNK_SIZE 200
// Note: VAR_0x8005 contains the spotId. // Note: VAR_0x8005 contains the spotId.
void EventScript_RecordMixingPlayerSpotTriggered(void) void RecordMixingPlayerSpotTriggered(void)
{ {
sub_80B37D4(Task_RecordMixing_Main); sub_80B37D4(Task_RecordMixing_Main);
} }
@ -984,7 +984,7 @@ static void Task_DoRecordMixing(u8 taskId)
DestroyTask(taskId); DestroyTask(taskId);
break; break;
// Mixing Emerald/FireRed/LeafGreen records. // Mixing Emerald records.
case 6: case 6:
if (!sub_801048C(FALSE)) if (!sub_801048C(FALSE))
{ {

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 gLinkSelfPlayerId; extern u8 LocalLinkPlayerId;
// 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();
gLinkSelfPlayerId = GetMultiplayerId(); LocalLinkPlayerId = GetMultiplayerId();
SetCableClubWarp(); SetCableClubWarp();
SetWarpDestination(mapGroup, mapNum, -1, x, y); SetWarpDestination(mapGroup, mapNum, -1, x, y);
WarpIntoMap(); WarpIntoMap();

View File

@ -641,9 +641,9 @@ void ScriptSetMonMoveSlot(u8 monIndex, u16 move, u8 slot)
SetMonMoveSlot(&gPlayerParty[monIndex], move, slot); SetMonMoveSlot(&gPlayerParty[monIndex], move, slot);
} }
// Note: When control returns to the event script, gSpecialVar_Result be // Note: When control returns to the event script, gSpecialVar_Result will be
// TRUE if the party selection was successful. // TRUE if the party selection was successful.
void EventScript_ChooseHalfPartyForBattle(void) void ChooseHalfPartyForBattle(void)
{ {
gMain.savedCallback = CB2_ReturnFromChooseHalfParty; gMain.savedCallback = CB2_ReturnFromChooseHalfParty;
VarSet(VAR_FRONTIER_FACILITY, FRONTIER_FACILITY_DOUBLE_COLOSSEUM); VarSet(VAR_FRONTIER_FACILITY, FRONTIER_FACILITY_DOUBLE_COLOSSEUM);

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 gLinkSelfPlayerId; extern u8 LocalLinkPlayerId;
// 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(gLinkSelfPlayerId, CB2_ReturnToFieldWithOpenMenu); ShowTrainerCardInLink(LocalLinkPlayerId, CB2_ReturnToFieldWithOpenMenu);
return TRUE; return TRUE;
} }