Merge pull request #551 from Phlosioneer/multiplayer-stuff

Document overworld.c and link stuff in general
This commit is contained in:
huderlem 2019-03-01 08:43:55 -06:00 committed by GitHub
commit 3b04cfa437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 774 additions and 655 deletions

View File

@ -6500,7 +6500,7 @@ _081D4F6C:
bne _081D4F88 bne _081D4F88
movs r0, 0x49 movs r0, 0x49
bl PlaySE bl PlaySE
bl sub_800A620 bl CheckShouldAdvanceLinkState
movs r0, 0 movs r0, 0
strh r0, [r5] strh r0, [r5]
b _081D4FE6 b _081D4FE6

View File

@ -1,8 +1,8 @@
gBGTilemapBuffers1 gBGTilemapBuffers1
gBGTilemapBuffers2 gBGTilemapBuffers2
gBGTilemapBuffers3 gBGTilemapBuffers3
gUnknown_03005DA8 gHeldKeyCodeToSend
gFieldCallback gFieldCallback
gFieldCallback2 gFieldCallback2
gUnknown_03005DB4 gLocalLinkPlayerId
gFieldLinkPlayerCount gFieldLinkPlayerCount

View File

@ -1146,19 +1146,19 @@ EverGrandeCity_HallOfFame_EventScript_271851:: @ 8271851
EventScript_WhiteOut:: @ 8271857 EventScript_WhiteOut:: @ 8271857
call EverGrandeCity_HallOfFame_EventScript_2718CC call EverGrandeCity_HallOfFame_EventScript_2718CC
goto EventScript_271862 goto EventScript_ResetMrBriney
end end
EventScript_271862:: @ 8271862 EventScript_ResetMrBriney:: @ 8271862
compare VAR_BRINEY_LOCATION, 1 compare VAR_BRINEY_LOCATION, 1
goto_if_eq EverGrandeCity_HallOfFame_EventScript_271884 goto_if_eq EventScript_MoveMrBrineyToHouse
compare VAR_BRINEY_LOCATION, 2 compare VAR_BRINEY_LOCATION, 2
goto_if_eq EverGrandeCity_HallOfFame_EventScript_27189A goto_if_eq EventScript_MoveMrBrineyToDewford
compare VAR_BRINEY_LOCATION, 3 compare VAR_BRINEY_LOCATION, 3
goto_if_eq EverGrandeCity_HallOfFame_EventScript_2718B3 goto_if_eq EventScript_MoveMrBrineyToRoute108
end end
EverGrandeCity_HallOfFame_EventScript_271884:: @ 8271884 EventScript_MoveMrBrineyToHouse:: @ 8271884
setflag FLAG_HIDE_MR_BRINEY_DEWFORD_TOWN setflag FLAG_HIDE_MR_BRINEY_DEWFORD_TOWN
setflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN setflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN
setflag FLAG_HIDE_ROUTE_108_MR_BRINEY setflag FLAG_HIDE_ROUTE_108_MR_BRINEY
@ -1168,7 +1168,7 @@ EverGrandeCity_HallOfFame_EventScript_271884:: @ 8271884
clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO
end end
EverGrandeCity_HallOfFame_EventScript_27189A:: @ 827189A EventScript_MoveMrBrineyToDewford:: @ 827189A
setflag FLAG_HIDE_ROUTE_108_MR_BRINEY setflag FLAG_HIDE_ROUTE_108_MR_BRINEY
setflag FLAG_HIDE_ROUTE_109_MR_BRINEY_BOAT setflag FLAG_HIDE_ROUTE_109_MR_BRINEY_BOAT
setflag FLAG_HIDE_ROUTE_104_MR_BRINEY setflag FLAG_HIDE_ROUTE_104_MR_BRINEY
@ -1179,7 +1179,7 @@ EverGrandeCity_HallOfFame_EventScript_27189A:: @ 827189A
clearflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN clearflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN
end end
EverGrandeCity_HallOfFame_EventScript_2718B3:: @ 82718B3 EventScript_MoveMrBrineyToRoute108:: @ 82718B3
setflag FLAG_HIDE_ROUTE_104_MR_BRINEY setflag FLAG_HIDE_ROUTE_104_MR_BRINEY
setflag FLAG_HIDE_ROUTE_104_MR_BRINEY_BOAT setflag FLAG_HIDE_ROUTE_104_MR_BRINEY_BOAT
setflag FLAG_HIDE_BRINEYS_HOUSE_MR_BRINEY setflag FLAG_HIDE_BRINEYS_HOUSE_MR_BRINEY
@ -1597,7 +1597,7 @@ EventScript_271D5E:: @ 8271D5E
goto EventScript_271D89 goto EventScript_271D89
EventScript_271D83:: @ 8271D83 EventScript_271D83:: @ 8271D83
special sub_80E6BE8 special RecordMixingPlayerSpotTriggered
waitstate waitstate
lock lock
faceplayer faceplayer

View File

@ -24,11 +24,11 @@ gUnref_82EC784:: @ 82EC784
.4byte 0x02000100 .4byte 0x02000100
.4byte 0x08000400 .4byte 0x08000400
gUnknown_82EC7C4:: @ 82EC7C4 gOverworldBackgroundLayerFlags:: @ 82EC7C4
.2byte 0x0100 .2byte 0x0100 /* BLDCNT_TGT2_BG0 */
.2byte 0x0200 .2byte 0x0200 /* BLDCNT_TGT2_BG1 */
.2byte 0x0400 .2byte 0x0400 /* BLDCNT_TGT2_BG2 */
.2byte 0x0800 .2byte 0x0800 /* BLDCNT_TGT2_BG3 */
gUnknown_82EC7CC:: @ 82EC7CC gUnknown_82EC7CC:: @ 82EC7CC
.2byte 0x0001 .2byte 0x0001

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": "gUnknown_08277388" "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": "gUnknown_082773BE" "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": "gUnknown_082773A3" "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": "gUnknown_082773D9" "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 sub_80F9438 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": "gUnknown_0827741D" "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": "gUnknown_08277447" "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": "gUnknown_08277432" "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": "gUnknown_0827745C" "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": "gUnknown_08277374" "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": "gUnknown_0827737E" "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 sub_80F9438 special ChooseHalfPartyForBattle
waitstate waitstate
return return

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": "gUnknown_082773F5" "script": "EventScript_TradeCenter_Chair0"
}, },
{ {
"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": "gUnknown_082773FF" "script": "EventScript_TradeCenter_Chair1"
} }
], ],
"bg_events": [] "bg_events": []

View File

@ -791,116 +791,118 @@ EventScript_CableBoxResults:: @ 8277365
releaseall releaseall
end end
gUnknown_08277374:: @ 8277374 EventScript_SingleBattleColosseum_PlayerSpot0:: @ 8277374
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special sub_80B3968 special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gUnknown_0827737E:: @ 827737E EventScript_SingleBattleColosseum_PlayerSpot1:: @ 827737E
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special sub_80B3968 special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gUnknown_08277388:: @ 8277388 EventScript_DoubleBattleColosseum_PlayerSpot0:: @ 8277388
fadescreen 1 fadescreen 1
special sub_80F9438 special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq DoubleBattleColosseum_EventScript_2773F4 goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special sub_80B3968 special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gUnknown_082773A3:: @ 82773A3 EventScript_DoubleBattleColosseum_PlayerSpot1:: @ 82773A3
fadescreen 1 fadescreen 1
special sub_80F9438 special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq DoubleBattleColosseum_EventScript_2773F4 goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special sub_80B3968 special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gUnknown_082773BE:: @ 82773BE EventScript_DoubleBattleColosseum_PlayerSpot2:: @ 82773BE
fadescreen 1 fadescreen 1
special sub_80F9438 special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq DoubleBattleColosseum_EventScript_2773F4 goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 2 setvar VAR_0x8005, 2
special sub_80B3968 special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
gUnknown_082773D9:: @ 82773D9 EventScript_DoubleBattleColosseum_PlayerSpot3:: @ 82773D9
fadescreen 1 fadescreen 1
special sub_80F9438 special ChooseHalfPartyForBattle
waitstate waitstate
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq DoubleBattleColosseum_EventScript_2773F4 goto_if_eq EventScript_DoubleBattleColosseum_CancelSpotTrigger
setvar VAR_0x8005, 3 setvar VAR_0x8005, 3
special sub_80B3968 special ColosseumPlayerSpotTriggered
waitstate waitstate
end end
DoubleBattleColosseum_EventScript_2773F4:: @ 82773F4 EventScript_DoubleBattleColosseum_CancelSpotTrigger:: @ 82773F4
end end
gUnknown_082773F5:: @ 82773F5 EventScript_TradeCenter_Chair0:: @ 82773F5
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special sub_80B3924 special PlayerEnteredTradeSeat
waitstate waitstate
end end
gUnknown_082773FF:: @ 82773FF EventScript_TradeCenter_Chair1:: @ 82773FF
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special sub_80B3924 special PlayerEnteredTradeSeat
waitstate waitstate
end end
gUnknown_08277409:: @ 8277409 /* Never used */
EventScript_TradeCenter_Chair2:: @ 8277409
setvar VAR_0x8005, 2 setvar VAR_0x8005, 2
special sub_80B3924 special PlayerEnteredTradeSeat
waitstate waitstate
end end
gUnknown_08277413:: @ 8277413 /* Never used */
EventScript_TradeCenter_Chair3:: @ 8277413
setvar VAR_0x8005, 3 setvar VAR_0x8005, 3
special sub_80B3924 special PlayerEnteredTradeSeat
waitstate waitstate
end end
gUnknown_0827741D:: @ 827741D EventScript_RecordCenter_Spot0:: @ 827741D
setvar VAR_0x8005, 0 setvar VAR_0x8005, 0
special sub_80E6BE8 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
gUnknown_08277432:: @ 8277432 EventScript_RecordCenter_Spot1:: @ 8277432
setvar VAR_0x8005, 1 setvar VAR_0x8005, 1
special sub_80E6BE8 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
gUnknown_08277447:: @ 8277447 EventScript_RecordCenter_Spot2:: @ 8277447
setvar VAR_0x8005, 2 setvar VAR_0x8005, 2
special sub_80E6BE8 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
gUnknown_0827745C:: @ 827745C EventScript_RecordCenter_Spot3:: @ 827745C
setvar VAR_0x8005, 3 setvar VAR_0x8005, 3
special sub_80E6BE8 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
@ -914,21 +916,21 @@ RecordCorner_EventScript_277471:: @ 8277471
releaseall releaseall
end end
EventScript_TradeRoom_ReadTrainerCard1:: @ 827747E gEventScript_TradeRoom_ReadTrainerCard_NoColor:: @ 827747E
msgbox Text_278452, MSGBOX_DEFAULT msgbox Text_278452, MSGBOX_DEFAULT
fadescreen 1 fadescreen 1
special sp02A_crash_sound special sp02A_crash_sound
waitstate waitstate
end end
EventScript_TradeRoom_ReadTrainerCard2:: @ 827748D gEventScript_TradeRoom_ReadTrainerCard_Normal:: @ 827748D
msgbox Text_27847B, MSGBOX_DEFAULT msgbox Text_27847B, MSGBOX_DEFAULT
fadescreen 1 fadescreen 1
special sp02A_crash_sound special sp02A_crash_sound
waitstate waitstate
end end
EventScript_TradeRoom_TooBusyToNotice:: @ 827749C gEventScript_TradeRoom_TooBusyToNotice:: @ 827749C
msgbox Text_27842E, MSGBOX_DEFAULT msgbox Text_27842E, MSGBOX_DEFAULT
closemessage closemessage
end end
@ -967,22 +969,22 @@ RecordCorner_EventScript_2774E0:: @ 82774E0
closemessage closemessage
end end
gUnknown_082774EF:: @ 82774EF EventScript_ConfirmLeaveTradeRoom:: @ 82774EF
msgbox Text_2783A8, MSGBOX_YESNO msgbox Text_TerminateLinkConfirmation, MSGBOX_YESNO
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_if_eq gUnknown_08277509 goto_if_eq EventScript_TerminateLink
erasebox 0, 0, 29, 19 erasebox 0, 0, 29, 19
releaseall releaseall
end end
gUnknown_08277509:: @ 8277509 EventScript_TerminateLink:: @ 8277509
messageautoscroll Text_2783E9 messageautoscroll Text_TerminateLinkPleaseWait
waitmessage waitmessage
special sub_80B371C special ExitLinkRoom
end end
EventScript_277513:: @ 8277513 EventScript_DoLinkRoomExit:: @ 8277513
special sub_80B36EC special CleanupLinkRoomState
special sub_80AF9F8 special sub_80AF9F8
waitstate waitstate
end end
@ -1736,11 +1738,11 @@ OldaleTown_PokemonCenter_2F_Text_278372: @ 8278372
.string "Please confirm the number of\n" .string "Please confirm the number of\n"
.string "players and start again.$" .string "players and start again.$"
Text_2783A8: @ 82783A8 Text_TerminateLinkConfirmation: @ 82783A8
.string "The link will be terminated if you\n" .string "The link will be terminated if you\n"
.string "leave the room. Is that okay?$" .string "leave the room. Is that okay?$"
Text_2783E9: @ 82783E9 Text_TerminateLinkPleaseWait: @ 82783E9
.string "Terminating link…\n" .string "Terminating link…\n"
.string "You will be escorted out of\l" .string "You will be escorted out of\l"
.string "the room. Please wait.$" .string "the room. Please wait.$"

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 sub_80B36EC def_special CleanupLinkRoomState
def_special sub_80B371C 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 sub_80E6BE8 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 sub_80B3968 def_special ColosseumPlayerSpotTriggered
def_special sub_80B3924 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 sub_80F9438 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

@ -15,6 +15,6 @@ void sub_80B360C(void);
bool32 sub_80B2AF4(u16 *arg0, u16 *arg1); bool32 sub_80B2AF4(u16 *arg0, u16 *arg1);
void sub_80B3AF8(u8 taskId); void sub_80B3AF8(u8 taskId);
void task00_08081A90(u8 taskId); void task00_08081A90(u8 taskId);
bool32 sub_80B39D4(u8 linkPlayerIndex); bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex);
#endif //GUARD_CABLE_CLUB_H #endif //GUARD_CABLE_CLUB_H

View File

@ -10,6 +10,8 @@
#define FRONTIER_FACILITY_PIKE 5 #define FRONTIER_FACILITY_PIKE 5
#define FRONTIER_FACILITY_PYRAMID 6 #define FRONTIER_FACILITY_PYRAMID 6
#define NUM_FRONTIER_FACILITIES 7 #define NUM_FRONTIER_FACILITIES 7
// The multiplayer battle colosseum rooms re-use VAR_FRONTIER_FACILITY.
#define FRONTIER_FACILITY_DOUBLE_COLOSSEUM 9
#define TENT_VERDANTURF 2 #define TENT_VERDANTURF 2
#define TENT_FALLARBOR 3 #define TENT_FALLARBOR 3

View File

@ -906,13 +906,13 @@ struct MapPosition
s8 height; s8 height;
}; };
struct UnkStruct_8054FF8 struct TradeRoomPlayer
{ {
u8 a; u8 playerId;
u8 b; u8 isLocalPlayer;
u8 c; u8 c;
u8 d; u8 facing;
struct MapPosition sub; struct MapPosition pos;
u16 field_C; u16 field_C;
}; };

View File

@ -244,7 +244,7 @@ bool8 IsLinkTaskFinished(void);
void CreateWirelessStatusIndicatorSprite(u8, u8); void CreateWirelessStatusIndicatorSprite(u8, u8);
void sub_800ADF8(void); void sub_800ADF8(void);
void sub_800B488(void); void sub_800B488(void);
void sub_800A620(void); void CheckShouldAdvanceLinkState(void);
void sub_8011BD0(void); void sub_8011BD0(void);
u8 IsLinkMaster(void); u8 IsLinkMaster(void);
void sub_800AC34(void); void sub_800AC34(void);
@ -299,8 +299,8 @@ extern struct LinkPlayer gLocalLinkPlayer;
bool32 Link_AnyPartnersPlayingRubyOrSapphire(void); bool32 Link_AnyPartnersPlayingRubyOrSapphire(void);
bool32 sub_800A03C(void); bool32 sub_800A03C(void);
void sub_8009628(u8); void SetLocalLinkPlayerId(u8);
u8 sub_800AA48(void); u8 GetSavedPlayerCount(void);
void sub_8009FAC(void); void sub_8009FAC(void);
bool8 sub_800A4D8(u8 a0); bool8 sub_800A4D8(u8 a0);
u8 sub_800A9D8(void); u8 sub_800A9D8(void);
@ -312,7 +312,7 @@ void sub_800AB18(void);
void sub_8009F18(void); void sub_8009F18(void);
bool8 sub_800AA60(void); bool8 sub_800AA60(void);
void sub_800ABF4(u16 a0); void sub_800ABF4(u16 a0);
bool32 sub_8009F3C(void); bool32 IsSendingKeysToLink(void);
u32 sub_800B4DC(void); u32 GetLinkRecvQueueLength(void);
#endif // GUARD_LINK_H #endif // GUARD_LINK_H

View File

@ -219,7 +219,7 @@ void sub_800E700(void);
void sub_800EDD4(void); void sub_800EDD4(void);
void sub_800F6FC(u8 who); void sub_800F6FC(u8 who);
void sub_800F728(u8 who); void sub_800F728(u8 who);
bool32 sub_800F7E4(void); bool32 IsSendingKeysToRfu(void);
void sub_800F804(void); void sub_800F804(void);
void sub_800F850(void); void sub_800F850(void);
u8 sub_800FCD8(void); u8 sub_800FCD8(void);
@ -238,8 +238,8 @@ void sub_800E6D0(void);
bool32 sub_8010EC0(void); bool32 sub_8010EC0(void);
bool32 sub_8010F1C(void); bool32 sub_8010F1C(void);
bool32 sub_8011A80(void); bool32 sub_8011A80(void);
bool32 sub_800F0B8(void); bool32 IsRfuRecvQueueEmpty(void);
u32 sub_80124D4(void); u32 GetRfuRecvQueueLength(void);
void RfuVSync(void); void RfuVSync(void);
void sub_80111B0(bool32 a0); void sub_80111B0(bool32 a0);
u8 sub_8011A74(void); u8 sub_8011A74(void);

View File

@ -1,6 +1,29 @@
#ifndef GUARD_OVERWORLD_H #ifndef GUARD_OVERWORLD_H
#define GUARD_OVERWORLD_H #define GUARD_OVERWORLD_H
#define LINK_KEY_CODE_NULL 0x00
#define LINK_KEY_CODE_EMPTY 0x11
#define LINK_KEY_CODE_DPAD_DOWN 0x12
#define LINK_KEY_CODE_DPAD_UP 0x13
#define LINK_KEY_CODE_DPAD_LEFT 0x14
#define LINK_KEY_CODE_DPAD_RIGHT 0x15
#define LINK_KEY_CODE_UNK_2 0x16
#define LINK_KEY_CODE_EXIT_ROOM 0x17
#define LINK_KEY_CODE_START_BUTTON 0x18
#define LINK_KEY_CODE_A_BUTTON 0x19
#define LINK_KEY_CODE_UNK_4 0x1A // I'd guess this is the B button?
// These two are a hack to stop user input until link stuff can be
// resolved.
#define LINK_KEY_CODE_HANDLE_RECV_QUEUE 0x1B
#define LINK_KEY_CODE_HANDLE_SEND_QUEUE 0x1C
#define LINK_KEY_CODE_UNK_7 0x1D
#define LINK_KEY_CODE_UNK_8 0x1E
#define MOVEMENT_MODE_FREE 0
#define MOVEMENT_MODE_FROZEN 1
#define MOVEMENT_MODE_SCRIPTED 2
struct InitialPlayerAvatarState struct InitialPlayerAvatarState
{ {
u8 transitionFlags; u8 transitionFlags;
@ -12,7 +35,7 @@ struct LinkPlayerEventObject
u8 active; u8 active;
u8 linkPlayerId; u8 linkPlayerId;
u8 eventObjId; u8 eventObjId;
u8 mode; u8 movementMode;
}; };
// Exported RAM declarations // Exported RAM declarations
@ -22,10 +45,10 @@ extern struct LinkPlayerEventObject gLinkPlayerEventObjects[4];
extern u16 *gBGTilemapBuffers1; extern u16 *gBGTilemapBuffers1;
extern u16 *gBGTilemapBuffers2; extern u16 *gBGTilemapBuffers2;
extern u16 *gBGTilemapBuffers3; extern u16 *gBGTilemapBuffers3;
extern u16 gUnknown_03005DA8; extern u16 gHeldKeyCodeToSend;
extern void (*gFieldCallback)(void); extern void (*gFieldCallback)(void);
extern bool8 (*gFieldCallback2)(void); extern bool8 (*gFieldCallback2)(void);
extern u8 gUnknown_03005DB4; extern u8 gLocalLinkPlayerId;
extern u8 gFieldLinkPlayerCount; extern u8 gFieldLinkPlayerCount;
// Exported ROM declarations // Exported ROM declarations
@ -103,12 +126,12 @@ u8 GetSavedWarpRegionMapSectionId(void);
u8 GetCurrentRegionMapSectionId(void); u8 GetCurrentRegionMapSectionId(void);
u8 GetCurrentMapBattleScene(void); u8 GetCurrentMapBattleScene(void);
void CleanupOverworldWindowsAndTilemaps(void); void CleanupOverworldWindowsAndTilemaps(void);
bool32 is_c1_link_related_active(void); bool32 IsUpdateLinkStateCBActive(void);
void CB1_Overworld(void); void CB1_Overworld(void);
void CB2_OverworldBasic(void); void CB2_OverworldBasic(void);
void CB2_Overworld(void); void CB2_Overworld(void);
void SetMainCallback1(void (*cb)(void)); void SetMainCallback1(void (*cb)(void));
void sub_8085E94(void *a0); void SetUnusedCallback(void *a0);
void CB2_NewGame(void); void CB2_NewGame(void);
void CB2_WhiteOut(void); void CB2_WhiteOut(void);
void CB2_LoadMap(void); void CB2_LoadMap(void);
@ -117,18 +140,18 @@ void sub_8086074(void);
void CB2_ReturnToField(void); void CB2_ReturnToField(void);
void CB2_ReturnToFieldLocal(void); void CB2_ReturnToFieldLocal(void);
void CB2_ReturnToFieldLink(void); void CB2_ReturnToFieldLink(void);
void c2_8056854(void); void CB2_ReturnToFieldFromMultiplayer(void);
void CB2_ReturnToFieldWithOpenMenu(void); void CB2_ReturnToFieldWithOpenMenu(void);
void CB2_ReturnToFieldContinueScript(void); void CB2_ReturnToFieldContinueScript(void);
void CB2_ReturnToFieldContinueScriptPlayMapMusic(void); void CB2_ReturnToFieldContinueScriptPlayMapMusic(void);
void sub_80861E8(void); void sub_80861E8(void);
void CB2_ContinueSavedGame(void); void CB2_ContinueSavedGame(void);
void sub_8086C2C(void); void ResetAllMultiplayerState(void);
u32 sub_8087214(void); u32 sub_8087214(void);
bool32 sub_808727C(void); bool32 sub_808727C(void);
u16 sub_8087288(void); u16 sub_8087288(void);
u16 sub_808729C(void); u16 sub_808729C(void);
u16 sub_80872B0(void); u16 QueueExitLinkRoomKey(void);
u16 sub_80872C4(void); u16 sub_80872C4(void);
bool32 sub_8087598(void); bool32 sub_8087598(void);
bool32 sub_80875C8(void); bool32 sub_80875C8(void);

View File

@ -85,7 +85,7 @@ u8 GetItemEffectType(u16 item);
void CB2_PartyMenuFromStartMenu(void); void CB2_PartyMenuFromStartMenu(void);
void sub_81B7F60(void); void sub_81B7F60(void);
void sub_81B8448(void); void sub_81B8448(void);
void sub_81B8518(u8 unused); void InitChooseHalfPartyForBattle(u8 unused);
void sub_81B8558(void); void sub_81B8558(void);
void sub_81B8904(u8 initArg, MainCallback callback); void sub_81B8904(u8 initArg, MainCallback callback);
void sub_81B892C(void); void sub_81B892C(void);

View File

@ -7,7 +7,7 @@ struct PlayerHallRecords
struct RankingHall2P twoPlayers[2]; struct RankingHall2P twoPlayers[2];
}; };
void sub_80E6BE8(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

@ -83,13 +83,11 @@ 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 sub_8153430(void); u8 FullSaveGame(void);
bool8 sub_8153474(void); 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);
u8 sub_8153430(void);
bool8 sub_8153474(void);
u32 TryCopySpecialSaveSection(u8 sector, u8* dst); u32 TryCopySpecialSaveSection(u8 sector, u8* dst);
u32 sub_8153634(u8 sector, u8* src); u32 sub_8153634(u8 sector, u8* src);
void sub_8153688(u8 taskId); void sub_8153688(u8 taskId);

View File

@ -43,7 +43,7 @@ struct TrainerCard
extern struct TrainerCard gTrainerCards[4]; extern struct TrainerCard gTrainerCards[4];
u32 CountPlayerTrainerStars(void); u32 CountPlayerTrainerStars(void);
u8 sub_80C4904(u8 cardId); u8 GetTrainerCardStars(u8 cardId);
void CopyTrainerCardData(struct TrainerCard *dst, u16 *src, u8 gameVersion); void CopyTrainerCardData(struct TrainerCard *dst, u16 *src, u8 gameVersion);
void ShowPlayerTrainerCard(void (*callback)(void)); void ShowPlayerTrainerCard(void (*callback)(void));
void ShowTrainerCardInLink(u8 arg0, void (*callback)(void)); void ShowTrainerCardInLink(u8 arg0, void (*callback)(void));

View File

@ -767,7 +767,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
{ {
if (IsLinkMaster()) if (IsLinkMaster())
{ {
sub_800A620(); CheckShouldAdvanceLinkState();
gTasks[taskId].data[11]++; gTasks[taskId].data[11]++;
} }
else else

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 sub_8153430(void);
extern bool8 sub_8153474(void);
extern void sub_80EECEC(void);
// this file's functions // this file's functions
static void BerryBlender_SetBackgroundsPos(void); static void BerryBlender_SetBackgroundsPos(void);
@ -2600,7 +2595,7 @@ static bool8 LinkPlayAgainHandleSaving(void)
} }
break; break;
case 2: case 2:
sub_8153430(); FullSaveGame();
sBerryBlenderData->field_1A0++; sBerryBlenderData->field_1A0++;
sBerryBlenderData->framesToWait = 0; sBerryBlenderData->framesToWait = 0;
break; break;
@ -2614,7 +2609,7 @@ static bool8 LinkPlayAgainHandleSaving(void)
case 4: case 4:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_8153474()) if (CheckSaveFile())
{ {
sBerryBlenderData->field_1A0 = 5; sBerryBlenderData->field_1A0 = 5;
} }

View File

@ -282,7 +282,7 @@ static void sub_80B2804(u8 taskId)
if (GetFieldMessageBoxMode() == FIELD_MESSAGE_BOX_HIDDEN) if (GetFieldMessageBoxMode() == FIELD_MESSAGE_BOX_HIDDEN)
{ {
if (sub_800AA48() != GetLinkPlayerCount_2()) if (GetSavedPlayerCount() != GetLinkPlayerCount_2())
{ {
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady); ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
gTasks[taskId].func = sub_80B270C; gTasks[taskId].func = sub_80B270C;
@ -295,7 +295,7 @@ static void sub_80B2804(u8 taskId)
else if (gMain.heldKeys & A_BUTTON) else if (gMain.heldKeys & A_BUTTON)
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
sub_800A620(); CheckShouldAdvanceLinkState();
gTasks[taskId].func = sub_80B28A8; gTasks[taskId].func = sub_80B28A8;
} }
} }
@ -310,7 +310,7 @@ static void sub_80B28A8(u8 taskId)
|| sub_80B2D6C(taskId) == TRUE) || sub_80B2D6C(taskId) == TRUE)
return; return;
if (GetLinkPlayerCount_2() != sub_800AA48()) if (GetLinkPlayerCount_2() != GetSavedPlayerCount())
{ {
gTasks[taskId].func = sub_80B2D2C; gTasks[taskId].func = sub_80B2D2C;
} }
@ -352,7 +352,7 @@ static void sub_80B2918(u8 taskId)
else else
{ {
gFieldLinkPlayerCount = GetLinkPlayerCount_2(); gFieldLinkPlayerCount = GetLinkPlayerCount_2();
gUnknown_03005DB4 = 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();
gUnknown_03005DB4 = GetMultiplayerId(); gLocalLinkPlayerId = GetMultiplayerId();
sub_800AA04(gFieldLinkPlayerCount); sub_800AA04(gFieldLinkPlayerCount);
card = (struct TrainerCard *)gBlockSendBuffer; card = (struct TrainerCard *)gBlockSendBuffer;
TrainerCard_GenerateCardForPlayer(card); TrainerCard_GenerateCardForPlayer(card);
@ -764,9 +764,9 @@ static void sub_80B3194(u8 taskId)
static void sub_80B31E8(u8 taskId) static void sub_80B31E8(u8 taskId)
{ {
if (sub_800AA48() == GetLinkPlayerCount_2()) if (GetSavedPlayerCount() == GetLinkPlayerCount_2())
{ {
sub_800A620(); CheckShouldAdvanceLinkState();
gTasks[taskId].func = sub_80B3220; gTasks[taskId].func = sub_80B3220;
} }
} }
@ -972,7 +972,7 @@ void sub_80B360C(void)
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2) if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2)
{ {
UpdatePlayerLinkBattleRecords(gUnknown_03005DB4 ^ 1); UpdatePlayerLinkBattleRecords(gLocalLinkPlayerId ^ 1);
if (gWirelessCommType) if (gWirelessCommType)
{ {
switch (gBattleOutcome) switch (gBattleOutcome)
@ -993,13 +993,13 @@ void sub_80B360C(void)
} }
else else
{ {
gMain.savedCallback = c2_8056854; gMain.savedCallback = CB2_ReturnToFieldFromMultiplayer;
} }
SetMainCallback2(sub_80A0514); SetMainCallback2(sub_80A0514);
} }
void sub_80B36EC(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,9 +1009,9 @@ void sub_80B36EC(void)
SetWarpDestinationToDynamicWarp(0x7F); SetWarpDestinationToDynamicWarp(0x7F);
} }
void sub_80B371C(void) void ExitLinkRoom(void)
{ {
sub_80872B0(); QueueExitLinkRoomKey();
} }
static void sub_80B3728(u8 taskId) static void sub_80B3728(u8 taskId)
@ -1028,7 +1028,7 @@ static void sub_80B3728(u8 taskId)
if (IsFieldMessageBoxHidden()) if (IsFieldMessageBoxHidden())
{ {
sub_8087288(); sub_8087288();
sub_8009628(gSpecialVar_0x8005); SetLocalLinkPlayerId(gSpecialVar_0x8005);
task->data[0] = 2; task->data[0] = 2;
} }
break; break;
@ -1130,7 +1130,8 @@ static void sub_80B3894(u8 taskId)
} }
} }
void sub_80B3924(void) // Note: VAR_0x8005 is set to the ID of the trade seat.
void PlayerEnteredTradeSeat(void)
{ {
if (gWirelessCommType != 0) if (gWirelessCommType != 0)
{ {
@ -1152,7 +1153,8 @@ void nullsub_37(void)
} }
void sub_80B3968(void) // Note: VAR_0x8005 is set to the ID of the player spot.
void ColosseumPlayerSpotTriggered(void)
{ {
gLinkType = 0x2211; gLinkType = 0x2211;
@ -1166,6 +1168,7 @@ void sub_80B3968(void)
} }
} }
// This function is never called.
static void sub_80B39A4(void) static void sub_80B39A4(void)
{ {
u8 taskId = CreateTask(sub_80B3728, 80); u8 taskId = CreateTask(sub_80B3728, 80);
@ -1177,14 +1180,16 @@ void sp02A_crash_sound(void)
ShowTrainerCardInLink(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic); ShowTrainerCardInLink(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic);
} }
bool32 sub_80B39D4(u8 linkPlayerIndex) // Returns FALSE if the player has no stars. Returns TRUE otherwise, and puts the name of the
// color into gStringVar2.
bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex)
{ {
u32 trainerCardColorIndex; u32 trainerCardColorIndex;
gSpecialVar_0x8006 = linkPlayerIndex; gSpecialVar_0x8006 = linkPlayerIndex;
StringCopy(gStringVar1, gLinkPlayers[linkPlayerIndex].name); StringCopy(gStringVar1, gLinkPlayers[linkPlayerIndex].name);
trainerCardColorIndex = sub_80C4904(linkPlayerIndex); trainerCardColorIndex = GetTrainerCardStars(linkPlayerIndex);
if (trainerCardColorIndex == 0) if (trainerCardColorIndex == 0)
return FALSE; return FALSE;
@ -1263,13 +1268,13 @@ void sub_80B3AF8(u8 taskId)
} }
break; break;
case 2: case 2:
if (GetLinkPlayerCount_2() >= sub_800AA48()) if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
{ {
if (IsLinkMaster()) if (IsLinkMaster())
{ {
if (++data[1] > 30) if (++data[1] > 30)
{ {
sub_800A620(); CheckShouldAdvanceLinkState();
data[0]++; data[0]++;
} }
} }

View File

@ -1114,7 +1114,7 @@ static void sub_811A2A4(u8 taskId, TaskFunc taskFunc)
static void sub_811A2C0(u8 taskId) static void sub_811A2C0(u8 taskId)
{ {
if (!is_c1_link_related_active()) if (!IsUpdateLinkStateCBActive())
{ {
while (sub_811A428(taskId)); while (sub_811A428(taskId));
} }

View File

@ -255,7 +255,7 @@ void sub_80AF2B4(u8 taskId)
break; break;
case 2: case 2:
sub_8009F18(); sub_8009F18();
sub_8086C2C(); ResetAllMultiplayerState();
ScriptContext2_Disable(); ScriptContext2_Disable();
DestroyTask(taskId); DestroyTask(taskId);
break; break;
@ -621,7 +621,7 @@ void sub_80AF948(void)
CreateTask(sub_80AF8E0, 10); CreateTask(sub_80AF8E0, 10);
} }
static void sub_80AF96C(u8 taskId) static void Task_ReturnToWorldFromLinkRoom(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
@ -654,7 +654,7 @@ static void sub_80AF96C(u8 taskId)
void sub_80AF9F8(void) void sub_80AF9F8(void)
{ {
CreateTask(sub_80AF96C, 10); CreateTask(Task_ReturnToWorldFromLinkRoom, 10);
} }
static void sub_80AFA0C(u8 taskId) static void sub_80AFA0C(u8 taskId)

View File

@ -28,7 +28,7 @@
#include "link.h" #include "link.h"
#include "link_rfu.h" #include "link_rfu.h"
extern u16 gUnknown_03005DA8; extern u16 gHeldKeyCodeToSend;
// Static type declarations // Static type declarations
@ -302,9 +302,9 @@ void LinkTestScreen(void)
SetMainCallback2(CB2_LinkTest); SetMainCallback2(CB2_LinkTest);
} }
void sub_8009628(u8 a0) void SetLocalLinkPlayerId(u8 playerId)
{ {
gLocalLinkPlayer.id = a0; gLocalLinkPlayer.id = playerId;
} }
static void InitLocalLinkPlayer(void) static void InitLocalLinkPlayer(void)
@ -695,12 +695,12 @@ static void BuildSendCmd(u16 command)
gSendCmd[0] = LINKCMD_0x5566; gSendCmd[0] = LINKCMD_0x5566;
break; break;
case LINKCMD_SEND_HELD_KEYS_2: case LINKCMD_SEND_HELD_KEYS_2:
if (gUnknown_03005DA8 == 0 || gLinkTransferringData) if (gHeldKeyCodeToSend == 0 || gLinkTransferringData)
{ {
break; break;
} }
gSendCmd[0] = LINKCMD_SEND_HELD_KEYS_2; gSendCmd[0] = LINKCMD_SEND_HELD_KEYS_2;
gSendCmd[1] = gUnknown_03005DA8; gSendCmd[1] = gHeldKeyCodeToSend;
break; break;
} }
} }
@ -714,11 +714,11 @@ void sub_8009F18(void)
gLinkCallback = sub_8009F70; gLinkCallback = sub_8009F70;
} }
bool32 sub_8009F3C(void) bool32 IsSendingKeysToLink(void)
{ {
if (gWirelessCommType) if (gWirelessCommType)
{ {
return sub_800F7E4(); return IsSendingKeysToRfu();
} }
if (gLinkCallback == sub_8009F70) if (gLinkCallback == sub_8009F70)
{ {
@ -1142,7 +1142,7 @@ void ResetBlockReceivedFlag(u8 who)
} }
} }
void sub_800A620(void) void CheckShouldAdvanceLinkState(void)
{ {
if ((gLinkStatus & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gLinkStatus) > 1) if ((gLinkStatus & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gLinkStatus) > 1)
{ {
@ -1327,7 +1327,9 @@ void sub_800AA04(u8 a0)
} }
} }
u8 sub_800AA48(void) // The number of players when trading began. This is frequently compared against the
// current number of connected players to check if anyone dropped out.
u8 GetSavedPlayerCount(void)
{ {
return gSavedLinkPlayerCount; return gSavedLinkPlayerCount;
} }
@ -1849,7 +1851,7 @@ bool8 HandleLinkConnection(void)
r5 = sub_8010F1C(); r5 = sub_8010F1C();
if (sub_808766C() == TRUE) if (sub_808766C() == TRUE)
{ {
if (r4 == TRUE || sub_800F0B8() || r5) if (r4 == TRUE || IsRfuRecvQueueEmpty() || r5)
{ {
return TRUE; return TRUE;
} }
@ -1882,18 +1884,18 @@ void sub_800B4C0(void)
} }
} }
u32 sub_800B4DC(void) u32 GetLinkRecvQueueLength(void)
{ {
if (gWirelessCommType != 0) if (gWirelessCommType != 0)
{ {
return sub_80124D4(); return GetRfuRecvQueueLength();
} }
return gLink.recvQueue.count; return gLink.recvQueue.count;
} }
bool8 sub_800B504(void) bool8 sub_800B504(void)
{ {
if (sub_800B4DC() > 2) if (GetLinkRecvQueueLength() > 2)
{ {
return TRUE; return TRUE;
} }

View File

@ -18,7 +18,7 @@
#include "constants/species.h" #include "constants/species.h"
#include "save.h" #include "save.h"
extern u16 gUnknown_03005DA8; extern u16 gHeldKeyCodeToSend;
extern void nullsub_89(u8 taskId); extern void nullsub_89(u8 taskId);
struct UnkRfuStruct_1 gUnknown_03004140; struct UnkRfuStruct_1 gUnknown_03004140;
@ -2991,7 +2991,7 @@ static void sub_800F048(void)
} }
} }
bool32 sub_800F0B8(void) bool32 IsRfuRecvQueueEmpty(void)
{ {
s32 i; s32 i;
s32 j; s32 j;
@ -3212,7 +3212,7 @@ bool32 sub_800F4F0(void)
for (i = 0; i < CMD_LENGTH - 1; i++) for (i = 0; i < CMD_LENGTH - 1; i++)
gSendCmd[i] = 0; gSendCmd[i] = 0;
} }
return sub_800F0B8(); return IsRfuRecvQueueEmpty();
} }
void sub_800F638(u8 unused, u32 flags) void sub_800F638(u8 unused, u32 flags)
@ -3272,10 +3272,12 @@ u8 sub_800F74C(const u8 *a0)
void rfu_func_080F97B8(void) void rfu_func_080F97B8(void)
{ {
if (gReceivedRemoteLinkPlayers && gUnknown_03005DA8 && gLinkTransferringData != 1) if (gReceivedRemoteLinkPlayers
&& gHeldKeyCodeToSend != LINK_KEY_CODE_NULL
&& gLinkTransferringData != TRUE)
{ {
gUnknown_03000D78[0]++; gUnknown_03000D78[0]++;
gUnknown_03005DA8 |= (gUnknown_03000D78[0] << 8); gHeldKeyCodeToSend |= (gUnknown_03000D78[0] << 8);
sub_800FD14(0xbe00); sub_800FD14(0xbe00);
} }
} }
@ -3285,7 +3287,7 @@ struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void)
return &gUnknown_02022B14; return &gUnknown_02022B14;
} }
bool32 sub_800F7E4(void) bool32 IsSendingKeysToRfu(void)
{ {
return gUnknown_03005000.unk_00 == rfu_func_080F97B8; return gUnknown_03005000.unk_00 == rfu_func_080F97B8;
} }
@ -3509,7 +3511,7 @@ void sub_800FD14(u16 command)
gSendCmd[1 + i] = gUnknown_03005000.unk_f2[i]; gSendCmd[1 + i] = gUnknown_03005000.unk_f2[i];
break; break;
case 0xbe00: case 0xbe00:
gSendCmd[1] = gUnknown_03005DA8; gSendCmd[1] = gHeldKeyCodeToSend;
break; break;
case 0xee00: case 0xee00:
break; break;
@ -3799,10 +3801,10 @@ bool32 sub_8010454(u32 a0)
u8 sub_801048C(bool32 a0) u8 sub_801048C(bool32 a0)
{ {
if (a0 == 0) if (a0 == FALSE)
return sub_800D550(0, 0); return sub_800D550(0, 0);
sub_800D550(1, 0x258); sub_800D550(1, 0x258);
return FALSE; return 0;
} }
void sub_80104B0(void) void sub_80104B0(void)
@ -5163,7 +5165,7 @@ u32 sub_80124C0(void)
return gUnknown_03005000.unk_9e8.unk_232; return gUnknown_03005000.unk_9e8.unk_232;
} }
u32 sub_80124D4(void) u32 GetRfuRecvQueueLength(void)
{ {
return gUnknown_03005000.unk_124.unk_8c2; return gUnknown_03005000.unk_124.unk_8c2;
} }

View File

@ -293,7 +293,7 @@ bool8 sub_8122148(u16 itemId)
bool8 itemid_80BF6D8_mail_related(u16 itemId) bool8 itemid_80BF6D8_mail_related(u16 itemId)
{ {
if (is_c1_link_related_active() != TRUE && InUnionRoom() != TRUE) if (IsUpdateLinkStateCBActive() != TRUE && InUnionRoom() != TRUE)
return TRUE; return TRUE;
else if (ItemIsMail(itemId) != TRUE) else if (ItemIsMail(itemId) != TRUE)
return TRUE; return TRUE;
@ -303,7 +303,7 @@ bool8 itemid_80BF6D8_mail_related(u16 itemId)
bool8 sub_81221AC(void) bool8 sub_81221AC(void)
{ {
if (is_c1_link_related_active() == TRUE || gReceivedRemoteLinkPlayers == 1) if (IsUpdateLinkStateCBActive() == TRUE || gReceivedRemoteLinkPlayers == 1)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;

View File

@ -179,7 +179,7 @@ static void CB2_MysteryEventMenu(void)
if (gMain.newKeys & A_BUTTON) if (gMain.newKeys & A_BUTTON)
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
sub_800A620(); CheckShouldAdvanceLinkState();
SetWindowBorderStyle(1, 1, 1, 0xD); SetWindowBorderStyle(1, 1, 1, 0xD);
PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0); PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0);
PutWindowTilemap(1); PutWindowTilemap(1);

File diff suppressed because it is too large Load Diff

View File

@ -6522,7 +6522,7 @@ static void sub_81B8474(u8 taskId)
gTasks[taskId].func = sub_81B8104; gTasks[taskId].func = sub_81B8104;
} }
void sub_81B8518(u8 unused) void InitChooseHalfPartyForBattle(u8 unused)
{ {
sub_81B8558(); sub_81B8558();
InitPartyMenu(4, 0, 0, 0, 0, sub_81B1370, gMain.savedCallback); InitPartyMenu(4, 0, 0, 0, 0, sub_81B1370, gMain.savedCallback);

View File

@ -388,7 +388,7 @@ u32 sub_81C7078(u32 (*func)(s32), u32 priority)
{ {
u16 taskId; u16 taskId;
if (!is_c1_link_related_active()) if (!IsUpdateLinkStateCBActive())
taskId = CreateTask(sub_81C7170, priority); taskId = CreateTask(sub_81C7170, priority);
else else
taskId = CreateTask(sub_81C71E4, priority); taskId = CreateTask(sub_81C71E4, priority);

View File

@ -106,7 +106,7 @@ static EWRAM_DATA union PlayerRecords *sSentRecord = NULL;
// Static ROM declarations // Static ROM declarations
static void Task_RecordMixing_Main(u8 taskId); static void Task_RecordMixing_Main(u8 taskId);
static void sub_80E7324(u8 taskId); static void Task_MixingRecordsRecv(u8 taskId);
static void Task_SendPacket(u8 taskId); static void Task_SendPacket(u8 taskId);
static void Task_CopyReceiveBuffer(u8 taskId); static void Task_CopyReceiveBuffer(u8 taskId);
static void Task_SendPacket_SwitchToReceive(u8 taskId); static void Task_SendPacket_SwitchToReceive(u8 taskId);
@ -120,7 +120,7 @@ static void ReceiveLilycoveLadyData(LilycoveLady *, size_t, u8);
static void sub_80E7B2C(const u8 *); static void sub_80E7B2C(const u8 *);
static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *, size_t, u8, TVShow *); static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *, size_t, u8, TVShow *);
static void ReceiveGiftItem(u16 *item, u8 which); static void ReceiveGiftItem(u16 *item, u8 which);
static void sub_80E7FF8(u8 taskId); static void Task_DoRecordMixing(u8 taskId);
static void sub_80E8110(struct Apprentice *arg0, struct Apprentice *arg1); static void sub_80E8110(struct Apprentice *arg0, struct Apprentice *arg1);
static void ReceiveApprenticeData(struct Apprentice *arg0, size_t arg1, u32 arg2); static void ReceiveApprenticeData(struct Apprentice *arg0, size_t arg1, u32 arg2);
static void ReceiveRankingHallRecords(struct PlayerHallRecords *hallRecords, size_t arg1, u32 arg2); static void ReceiveRankingHallRecords(struct PlayerHallRecords *hallRecords, size_t arg1, u32 arg2);
@ -170,7 +170,8 @@ static const u8 gUnknown_0858CFBE[3][4] =
#define BUFFER_CHUNK_SIZE 200 #define BUFFER_CHUNK_SIZE 200
void sub_80E6BE8(void) // Note: VAR_0x8005 contains the spotId.
void RecordMixingPlayerSpotTriggered(void)
{ {
sub_80B37D4(Task_RecordMixing_Main); sub_80B37D4(Task_RecordMixing_Main);
} }
@ -313,6 +314,7 @@ static void Task_RecordMixing_SoundEffect(u8 taskId)
#define tState data[0] #define tState data[0]
#define tSndEffTaskId data[15] #define tSndEffTaskId data[15]
// Note: Currently, special var 8005 contains the player's spot id.
static void Task_RecordMixing_Main(u8 taskId) static void Task_RecordMixing_Main(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
@ -322,16 +324,16 @@ 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);
sub_8009628(gSpecialVar_0x8005); SetLocalLinkPlayerId(gSpecialVar_0x8005);
VarSet(VAR_TEMP_0, 1); VarSet(VAR_TEMP_0, 1);
gUnknown_03001130 = FALSE; gUnknown_03001130 = FALSE;
PrepareExchangePacket(); PrepareExchangePacket();
CreateRecordMixingSprite(); CreateRecordMixingSprite();
tState = 1; tState = 1;
data[10] = CreateTask(sub_80E7324, 80); data[10] = CreateTask(Task_MixingRecordsRecv, 80);
tSndEffTaskId = CreateTask(Task_RecordMixing_SoundEffect, 81); tSndEffTaskId = CreateTask(Task_RecordMixing_SoundEffect, 81);
break; break;
case 1: // wait for sub_80E7324 case 1: // wait for Task_MixingRecordsRecv
if (!gTasks[data[10]].isActive) if (!gTasks[data[10]].isActive)
{ {
tState = 2; tState = 2;
@ -341,11 +343,11 @@ static void Task_RecordMixing_Main(u8 taskId)
} }
break; break;
case 2: case 2:
data[10] = CreateTask(sub_80E7FF8, 10); data[10] = CreateTask(Task_DoRecordMixing, 10);
tState = 3; tState = 3;
PlaySE(SE_W226); PlaySE(SE_W226);
break; break;
case 3: // wait for sub_80E7FF8 case 3: // wait for Task_DoRecordMixing
if (!gTasks[data[10]].isActive) if (!gTasks[data[10]].isActive)
{ {
tState = 4; tState = 4;
@ -381,7 +383,7 @@ static void Task_RecordMixing_Main(u8 taskId)
#undef tState #undef tState
#undef tSndEffTaskId #undef tSndEffTaskId
static void sub_80E7324(u8 taskId) static void Task_MixingRecordsRecv(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
@ -405,7 +407,7 @@ static void sub_80E7324(u8 taskId)
u8 players = GetLinkPlayerCount_2(); u8 players = GetLinkPlayerCount_2();
if (IsLinkMaster() == TRUE) if (IsLinkMaster() == TRUE)
{ {
if (players == sub_800AA48()) if (players == GetSavedPlayerCount())
{ {
PlaySE(SE_PIN); PlaySE(SE_PIN);
task->data[0] = 201; task->data[0] = 201;
@ -420,14 +422,15 @@ static void sub_80E7324(u8 taskId)
} }
break; break;
case 201: case 201:
if (sub_800AA48() == GetLinkPlayerCount_2() && ++task->data[12] > (GetLinkPlayerCount_2() * 30)) // We're the link master. Delay for 30 frames per connected player.
if (GetSavedPlayerCount() == GetLinkPlayerCount_2() && ++task->data[12] > (GetLinkPlayerCount_2() * 30))
{ {
sub_800A620(); CheckShouldAdvanceLinkState();
task->data[0] = 1; task->data[0] = 1;
} }
break; break;
case 301: case 301:
if (sub_800AA48() == GetLinkPlayerCount_2()) if (GetSavedPlayerCount() == GetLinkPlayerCount_2())
task->data[0] = 1; task->data[0] = 1;
break; break;
case 400: // wait 20 frames case 400: // wait 20 frames
@ -470,6 +473,7 @@ static void sub_80E7324(u8 taskId)
StorePtrInTaskData(sReceivedRecords, (u16 *)&gTasks[subTaskId].data[5]); StorePtrInTaskData(sReceivedRecords, (u16 *)&gTasks[subTaskId].data[5]);
sRecordStructSize = sizeof(struct PlayerRecordsEmerald); sRecordStructSize = sizeof(struct PlayerRecordsEmerald);
} }
// Note: This task is destroyed by Task_CopyReceiveBuffer when it's done.
} }
break; break;
case 5: // wait 60 frames case 5: // wait 60 frames
@ -938,7 +942,7 @@ static void ReceiveGiftItem(u16 *item, u8 which)
} }
} }
static void sub_80E7FF8(u8 taskId) static void Task_DoRecordMixing(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
@ -953,20 +957,22 @@ static void sub_80E7FF8(u8 taskId)
else else
task->data[0] = 6; task->data[0] = 6;
break; break;
// Mixing Ruby/Sapphire records.
case 2: case 2:
SetContinueGameWarpStatusToDynamicWarp(); SetContinueGameWarpStatusToDynamicWarp();
sub_8153430(); FullSaveGame();
task->data[0] ++; task->data[0] ++;
break; break;
case 3: case 3:
if (sub_8153474()) if (CheckSaveFile())
{ {
ClearContinueGameWarpStatus2(); ClearContinueGameWarpStatus2();
task->data[0] = 4; task->data[0] = 4;
task->data[1] = 0; task->data[1] = 0;
} }
break; break;
case 4: case 4: // Wait 10 frames
if (++task->data[1] > 10) if (++task->data[1] > 10)
{ {
sub_800AC34(); sub_800AC34();
@ -974,22 +980,24 @@ static void sub_80E7FF8(u8 taskId)
} }
break; break;
case 5: case 5:
if (gReceivedRemoteLinkPlayers == 0) if (gReceivedRemoteLinkPlayers == FALSE)
DestroyTask(taskId); DestroyTask(taskId);
break; break;
// Mixing Emerald records.
case 6: case 6:
if (!sub_801048C(0)) if (!sub_801048C(FALSE))
{ {
CreateTask(sub_8153688, 5); CreateTask(sub_8153688, 5);
task->data[0] ++; task->data[0] ++;
} }
break; break;
case 7: case 7: // wait for sub_8153688 to finish.
if (!FuncIsActiveTask(sub_8153688)) if (!FuncIsActiveTask(sub_8153688))
{ {
if (gWirelessCommType) if (gWirelessCommType)
{ {
sub_801048C(1); sub_801048C(TRUE);
task->data[0] = 8; task->data[0] = 8;
} }
else else

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 gUnknown_03005DB4; 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_CABLE_CLUB_STATE, arg4); VarSet(VAR_CABLE_CLUB_STATE, arg4);
gFieldLinkPlayerCount = GetLinkPlayerCount(); gFieldLinkPlayerCount = GetLinkPlayerCount();
gUnknown_03005DB4 = GetMultiplayerId(); gLocalLinkPlayerId = GetMultiplayerId();
SetCableClubWarp(); SetCableClubWarp();
SetWarpDestination(mapGroup, mapNum, -1, x, y); SetWarpDestination(mapGroup, mapNum, -1, x, y);
WarpIntoMap(); WarpIntoMap();
@ -1697,7 +1697,7 @@ void sub_801440C(u8 taskId)
case 81: case 81:
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();
gMain.savedCallback = sub_801AC54; gMain.savedCallback = sub_801AC54;
sub_81B8518(3); InitChooseHalfPartyForBattle(3);
break; break;
case 1: case 1:
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();

View File

@ -768,7 +768,7 @@ u8 sub_8153408(void) // trade.s save
return 0; return 0;
} }
u8 sub_8153430(void) u8 FullSaveGame(void)
{ {
if (gFlashMemoryPresent != TRUE) if (gFlashMemoryPresent != TRUE)
return 1; return 1;
@ -780,7 +780,7 @@ u8 sub_8153430(void)
return 0; return 0;
} }
bool8 sub_8153474(void) bool8 CheckSaveFile(void)
{ {
u8 retVal = FALSE; u8 retVal = FALSE;
u16 val = ++gUnknown_03006208; u16 val = ++gUnknown_03006208;

View File

@ -1203,7 +1203,7 @@ bool8 ScrCmd_turnvobject(struct ScriptContext *ctx)
bool8 ScrCmd_lockall(struct ScriptContext *ctx) bool8 ScrCmd_lockall(struct ScriptContext *ctx)
{ {
if (is_c1_link_related_active()) if (IsUpdateLinkStateCBActive())
{ {
return FALSE; return FALSE;
} }
@ -1217,7 +1217,7 @@ bool8 ScrCmd_lockall(struct ScriptContext *ctx)
bool8 ScrCmd_lock(struct ScriptContext *ctx) bool8 ScrCmd_lock(struct ScriptContext *ctx)
{ {
if (is_c1_link_related_active()) if (IsUpdateLinkStateCBActive())
{ {
return FALSE; return FALSE;
} }
@ -2182,7 +2182,7 @@ bool8 ScrCmd_cmdD8(struct ScriptContext *ctx)
bool8 ScrCmd_cmdD9(struct ScriptContext *ctx) bool8 ScrCmd_cmdD9(struct ScriptContext *ctx)
{ {
if (is_c1_link_related_active()) if (IsUpdateLinkStateCBActive())
{ {
return FALSE; return FALSE;
} }

View File

@ -29,6 +29,7 @@
#include "constants/items.h" #include "constants/items.h"
#include "constants/species.h" #include "constants/species.h"
#include "constants/vars.h" #include "constants/vars.h"
#include "constants/battle_frontier.h"
extern const u16 gEventObjectPalette8[]; extern const u16 gEventObjectPalette8[];
extern const u16 gEventObjectPalette17[]; extern const u16 gEventObjectPalette17[];
@ -40,7 +41,7 @@ static const u8 gUnknown_0858D8EC[] = { 3, 4, 5, 14 };
static void sub_80F8EE8(u8 taskId); static void sub_80F8EE8(u8 taskId);
static void sub_80F9088(u8 taskId); static void sub_80F9088(u8 taskId);
static void sub_80F9460(void); static void CB2_ReturnFromChooseHalfParty(void);
static void sub_80F94B8(void); static void sub_80F94B8(void);
void SetContestTrainerGfxIds(void) void SetContestTrainerGfxIds(void)
@ -640,22 +641,24 @@ void ScriptSetMonMoveSlot(u8 monIndex, u16 move, u8 slot)
SetMonMoveSlot(&gPlayerParty[monIndex], move, slot); SetMonMoveSlot(&gPlayerParty[monIndex], move, slot);
} }
void sub_80F9438(void) // Note: When control returns to the event script, gSpecialVar_Result will be
// TRUE if the party selection was successful.
void ChooseHalfPartyForBattle(void)
{ {
gMain.savedCallback = sub_80F9460; gMain.savedCallback = CB2_ReturnFromChooseHalfParty;
VarSet(VAR_FRONTIER_FACILITY, 9); // this isn't a valid frontier facility id (??) VarSet(VAR_FRONTIER_FACILITY, FRONTIER_FACILITY_DOUBLE_COLOSSEUM);
sub_81B8518(0); InitChooseHalfPartyForBattle(0);
} }
static void sub_80F9460(void) static void CB2_ReturnFromChooseHalfParty(void)
{ {
switch (gSelectedOrderFromParty[0]) switch (gSelectedOrderFromParty[0])
{ {
case 0: case 0:
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
break; break;
default: default:
gSpecialVar_Result = 1; gSpecialVar_Result = TRUE;
break; break;
} }
@ -665,7 +668,7 @@ static void sub_80F9460(void)
void sub_80F9490(void) void sub_80F9490(void)
{ {
gMain.savedCallback = sub_80F94B8; gMain.savedCallback = sub_80F94B8;
sub_81B8518(gSpecialVar_0x8004 + 1); InitChooseHalfPartyForBattle(gSpecialVar_0x8004 + 1);
} }
static void sub_80F94B8(void) static void sub_80F94B8(void)

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 gUnknown_03005DB4; 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);
@ -244,7 +244,7 @@ static void BuildStartMenuActions(void)
{ {
sNumStartMenuActions = 0; sNumStartMenuActions = 0;
if (is_c1_link_related_active() == TRUE) if (IsUpdateLinkStateCBActive() == TRUE)
{ {
BuildLinkModeStartMenu(); BuildLinkModeStartMenu();
} }
@ -547,7 +547,7 @@ void sub_809FA34(u8 taskId) // Referenced in field_screen.s and rom_8011DC0.s
void ShowStartMenu(void) // Called from overworld.c and field_control_avatar.s void ShowStartMenu(void) // Called from overworld.c and field_control_avatar.s
{ {
if (!is_c1_link_related_active()) if (!IsUpdateLinkStateCBActive())
{ {
FreezeEventObjects(); FreezeEventObjects();
sub_808B864(); sub_808B864();
@ -672,7 +672,7 @@ static bool8 StartMenuPlayerNameCallback(void)
RemoveExtraStartMenuWindows(); RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();
if (is_c1_link_related_active() || InUnionRoom()) if (IsUpdateLinkStateCBActive() || InUnionRoom())
ShowPlayerTrainerCard(CB2_ReturnToFieldWithOpenMenu); // Display trainer card ShowPlayerTrainerCard(CB2_ReturnToFieldWithOpenMenu); // Display trainer card
else if (FlagGet(FLAG_SYS_FRONTIER_PASS)) else if (FlagGet(FLAG_SYS_FRONTIER_PASS))
ShowFrontierPass(CB2_ReturnToFieldWithOpenMenu); // Display frontier pass ShowFrontierPass(CB2_ReturnToFieldWithOpenMenu); // Display frontier pass
@ -734,7 +734,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void)
{ {
PlayRainStoppingSoundEffect(); PlayRainStoppingSoundEffect();
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();
ShowTrainerCardInLink(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu); ShowTrainerCardInLink(gLocalLinkPlayerId, CB2_ReturnToFieldWithOpenMenu);
return TRUE; return TRUE;
} }
@ -1265,11 +1265,11 @@ static void sub_80A0550(u8 taskId)
break; break;
case 1: case 1:
SetContinueGameWarpStatusToDynamicWarp(); SetContinueGameWarpStatusToDynamicWarp();
sub_8153430(); FullSaveGame();
*step = 2; *step = 2;
break; break;
case 2: case 2:
if (sub_8153474()) if (CheckSaveFile())
{ {
ClearContinueGameWarpStatus2(); ClearContinueGameWarpStatus2();
*step = 3; *step = 3;

View File

@ -1507,13 +1507,13 @@ static void sub_80773D0(void)
} }
break; break;
case 3: case 3:
if (GetLinkPlayerCount_2() >= sub_800AA48()) if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
{ {
if (IsLinkMaster()) if (IsLinkMaster())
{ {
if (++gUnknown_0203229C->unk_A8 > 30) if (++gUnknown_0203229C->unk_A8 > 30)
{ {
sub_800A620(); CheckShouldAdvanceLinkState();
gMain.state++; gMain.state++;
} }
} }
@ -2762,7 +2762,7 @@ static void sub_80794CC(void)
Free(gUnknown_0203229C); Free(gUnknown_0203229C);
FreeAllWindowBuffers(); FreeAllWindowBuffers();
sub_800E084(); sub_800E084();
SetMainCallback2(c2_8056854); SetMainCallback2(CB2_ReturnToFieldFromMultiplayer);
} }
} }
else else
@ -2772,7 +2772,7 @@ static void sub_80794CC(void)
Free(gUnknown_02032184); Free(gUnknown_02032184);
Free(gUnknown_0203229C); Free(gUnknown_0203229C);
FreeAllWindowBuffers(); FreeAllWindowBuffers();
SetMainCallback2(c2_8056854); SetMainCallback2(CB2_ReturnToFieldFromMultiplayer);
} }
} }
} }
@ -4099,11 +4099,11 @@ void sub_807AE50(void)
case 3: case 3:
if (IsLinkMaster()) if (IsLinkMaster())
{ {
if (GetLinkPlayerCount_2() >= sub_800AA48()) if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
{ {
if (++gUnknown_020322A0->timer > 30) if (++gUnknown_020322A0->timer > 30)
{ {
sub_800A620(); CheckShouldAdvanceLinkState();
gMain.state++; gMain.state++;
} }
} }

View File

@ -1536,7 +1536,7 @@ static void sub_80C48C8(void)
} }
} }
u8 sub_80C4904(u8 cardId) u8 GetTrainerCardStars(u8 cardId)
{ {
struct TrainerCard* trainerCards = gTrainerCards; struct TrainerCard* trainerCards = gTrainerCards;
return trainerCards[cardId].stars; return trainerCards[cardId].stars;