Fix desync caused by players not knowing each others sync status

This commit is contained in:
MysterD 2022-11-11 19:01:51 -08:00
parent b4ea13f57d
commit e5d282fb82
1 changed files with 13 additions and 0 deletions

View File

@ -68,6 +68,9 @@ struct PacketPlayerData {
u32 interactSyncID;
u32 usedSyncID;
u32 platformSyncID;
u8 levelSyncValid;
u8 areaSyncValid;
};
#pragma pack()
@ -131,6 +134,10 @@ static void read_packet_data(struct PacketPlayerData* data, struct MarioState* m
data->interactSyncID = interactSyncID;
data->usedSyncID = usedSyncID;
data->platformSyncID = platformSyncID;
struct NetworkPlayer* np = &gNetworkPlayers[m->playerIndex];
data->areaSyncValid = np->currAreaSyncValid;
data->levelSyncValid = np->currLevelSyncValid;
}
static void write_packet_data(struct PacketPlayerData* data, struct MarioState* m,
@ -187,6 +194,12 @@ static void write_packet_data(struct PacketPlayerData* data, struct MarioState*
*interactSyncID = data->interactSyncID;
*usedSyncID = data->usedSyncID;
*platformSyncID = data->platformSyncID;
if (gNetworkType != NT_SERVER) {
struct NetworkPlayer* np = &gNetworkPlayers[m->playerIndex];
np->currAreaSyncValid = data->areaSyncValid;
np->currLevelSyncValid = data->levelSyncValid;
}
}
void network_send_player(u8 localIndex) {