mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-26 14:03:01 +00:00
fix player connected spam on joining a game (#284)
This commit is contained in:
parent
eac1683754
commit
ea8e7b75d8
2 changed files with 5 additions and 1 deletions
|
@ -193,6 +193,7 @@ void network_player_update(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool gCurrentlyJoining;
|
||||||
u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 modelIndex, const struct PlayerPalette* palette, char *name) {
|
u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 modelIndex, const struct PlayerPalette* palette, char *name) {
|
||||||
// translate globalIndex to localIndex
|
// translate globalIndex to localIndex
|
||||||
u8 localIndex = globalIndex;
|
u8 localIndex = globalIndex;
|
||||||
|
@ -288,7 +289,7 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
|
||||||
}
|
}
|
||||||
|
|
||||||
// display connected popup
|
// display connected popup
|
||||||
if (type != NPT_SERVER && (gNetworkType != NT_SERVER || type != NPT_LOCAL)) {
|
if (!gCurrentlyJoining && type != NPT_SERVER && (gNetworkType != NT_SERVER || type != NPT_LOCAL)) {
|
||||||
char *playerColorString = network_get_player_text_color_string(np->localIndex);
|
char *playerColorString = network_get_player_text_color_string(np->localIndex);
|
||||||
char popupMsg[128] = { 0 };
|
char popupMsg[128] = { 0 };
|
||||||
snprintf(popupMsg, 128, "%s%s\\#dcdcdc\\ connected", playerColorString, np->name);
|
snprintf(popupMsg, 128, "%s%s\\#dcdcdc\\ connected", playerColorString, np->name);
|
||||||
|
|
|
@ -28,6 +28,7 @@ static u8 eeprom[512] = { 0 };
|
||||||
static u8 sJoinRequestPlayerModel;
|
static u8 sJoinRequestPlayerModel;
|
||||||
static struct PlayerPalette sJoinRequestPlayerPalette;
|
static struct PlayerPalette sJoinRequestPlayerPalette;
|
||||||
static char sJoinRequestPlayerName[MAX_PLAYER_STRING];
|
static char sJoinRequestPlayerName[MAX_PLAYER_STRING];
|
||||||
|
bool gCurrentlyJoining = false;
|
||||||
|
|
||||||
void network_send_join_request(void) {
|
void network_send_join_request(void) {
|
||||||
SOFT_ASSERT(gNetworkType == NT_CLIENT);
|
SOFT_ASSERT(gNetworkType == NT_CLIENT);
|
||||||
|
@ -133,6 +134,7 @@ void network_receive_join(struct Packet* p) {
|
||||||
SOFT_ASSERT(gNetworkType == NT_CLIENT);
|
SOFT_ASSERT(gNetworkType == NT_CLIENT);
|
||||||
if (gNetworkPlayerLocal != NULL) { return; }
|
if (gNetworkPlayerLocal != NULL) { return; }
|
||||||
LOG_INFO("received join packet");
|
LOG_INFO("received join packet");
|
||||||
|
gCurrentlyJoining = true;
|
||||||
|
|
||||||
gOverrideEeprom = eeprom;
|
gOverrideEeprom = eeprom;
|
||||||
|
|
||||||
|
@ -241,4 +243,5 @@ void network_receive_join(struct Packet* p) {
|
||||||
|
|
||||||
extern s16 gChangeLevel;
|
extern s16 gChangeLevel;
|
||||||
gChangeLevel = gLevelValues.entryLevel;
|
gChangeLevel = gLevelValues.entryLevel;
|
||||||
|
gCurrentlyJoining = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue