Make the join process a bit smoother

This commit is contained in:
MysterD 2021-08-11 00:39:11 -07:00
parent b50cca937d
commit b12fcbec0c
2 changed files with 7 additions and 1 deletions

View File

@ -213,6 +213,9 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
snprintf(np->name, MAX_PLAYER_STRING, "%s", name); snprintf(np->name, MAX_PLAYER_STRING, "%s", name);
network_player_update_model(0); network_player_update_model(0);
for (int j = 0; j < MAX_RX_SEQ_IDS; j++) { np->rxSeqIds[j] = 0; }
np->onRxSeqId = 0;
gNetworkPlayerLocal = np; gNetworkPlayerLocal = np;
if (gNetworkType == NT_SERVER) { if (gNetworkType == NT_SERVER) {
@ -231,7 +234,7 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
np->lastReceived = clock_elapsed(); np->lastReceived = clock_elapsed();
np->lastSent = clock_elapsed(); np->lastSent = clock_elapsed();
np->modelIndex = modelIndex; np->modelIndex = modelIndex;
np->paletteIndex = paletteIndex; //np->paletteIndex = paletteIndex; // do not set here, we already know their palette!
np->localLevelMatch = (np->currCourseNum == gCurrCourseNum && np->currActNum == gCurrActStarNum && np->currLevelNum == gCurrLevelNum); np->localLevelMatch = (np->currCourseNum == gCurrCourseNum && np->currActNum == gCurrActStarNum && np->currLevelNum == gCurrLevelNum);
snprintf(np->name, MAX_PLAYER_STRING, "%s", name); snprintf(np->name, MAX_PLAYER_STRING, "%s", name);
network_player_update_model(i); network_player_update_model(i);
@ -268,6 +271,8 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
network_player_update_model(i); network_player_update_model(i);
if (gNetworkType == NT_SERVER || type == NPT_SERVER) { gNetworkSystem->save_id(i, 0); } if (gNetworkType == NT_SERVER || type == NPT_SERVER) { gNetworkSystem->save_id(i, 0); }
for (int j = 0; j < MAX_SYNC_OBJECTS; j++) { gSyncObjects[j].rxEventId[i] = 0; } for (int j = 0; j < MAX_SYNC_OBJECTS; j++) { gSyncObjects[j].rxEventId[i] = 0; }
for (int j = 0; j < MAX_RX_SEQ_IDS; j++) { np->rxSeqIds[j] = 0; }
np->onRxSeqId = 0;
if (type == NPT_SERVER) { if (type == NPT_SERVER) {
gNetworkPlayerServer = np; gNetworkPlayerServer = np;
} else { } else {

View File

@ -115,6 +115,7 @@ void network_send_join(struct Packet* joinRequestPacket) {
void network_receive_join(struct Packet* p) { void network_receive_join(struct Packet* p) {
assert(gNetworkType == NT_CLIENT); assert(gNetworkType == NT_CLIENT);
if (gNetworkPlayerLocal != NULL) { return; }
LOG_INFO("received join packet"); LOG_INFO("received join packet");
gOverrideEeprom = eeprom; gOverrideEeprom = eeprom;