diff --git a/src/game/behaviors/wdw_water_level.inc.c b/src/game/behaviors/wdw_water_level.inc.c index 866038df8..ff4d479f3 100644 --- a/src/game/behaviors/wdw_water_level.inc.c +++ b/src/game/behaviors/wdw_water_level.inc.c @@ -26,7 +26,6 @@ void bhv_water_level_diamond_loop(void) { network_init_object_field(o, &o->oAngleVelYaw); network_init_object_field(o, &o->oFaceAngleYaw); network_init_object_field(o, &gWDWWaterLevelChanging); - } if (gEnvironmentRegions != NULL) { @@ -43,6 +42,9 @@ void bhv_water_level_diamond_loop(void) { o->oAction++; // Sets to WATER_LEVEL_DIAMOND_ACT_CHANGE_WATER_LEVEL gWDWWaterLevelChanging = 1; network_send_object(o); + if (o->oSyncID != 0 && gSyncObjects[o->oSyncID].behavior == o->behavior) { + gSyncObjects[o->oSyncID].lastReliablePacketIsStale = false; + } } } break; @@ -73,6 +75,10 @@ void bhv_water_level_diamond_loop(void) { gWDWWaterLevelChanging = 0; o->oAction = WATER_LEVEL_DIAMOND_ACT_IDLE; o->oAngleVelYaw = 0; + if (o->oSyncID != 0 && gSyncObjects[o->oSyncID].behavior == o->behavior) { + gSyncObjects[o->oSyncID].lastReliablePacketIsStale = true; + } + } break; } diff --git a/src/pc/controller/controller_keyboard_debug.c b/src/pc/controller/controller_keyboard_debug.c index 960496adb..cafd1ead7 100644 --- a/src/pc/controller/controller_keyboard_debug.c +++ b/src/pc/controller/controller_keyboard_debug.c @@ -14,7 +14,7 @@ #ifdef DEBUG #include "pc/lua/smlua.h" -static u8 warpToLevel = LEVEL_BOB; +static u8 warpToLevel = LEVEL_WDW; static u8 warpToArea = 27; // warpToArea: 26 = basement // warpToArea: 27 = upstairs diff --git a/src/pc/network/network.h b/src/pc/network/network.h index fbfd719e8..b8c5a020b 100644 --- a/src/pc/network/network.h +++ b/src/pc/network/network.h @@ -76,6 +76,8 @@ struct SyncObject { void (*override_ownership)(u8* shouldOverride, u8* shouldOwn); void (*on_forget)(void); void* extraFields[MAX_SYNC_OBJECT_FIELDS]; + bool rememberLastReliablePacket; + bool lastReliablePacketIsStale; }; enum PlayerInteractions { diff --git a/src/pc/network/packets/packet_area.c b/src/pc/network/packets/packet_area.c index b43c6f9c8..24843b27e 100644 --- a/src/pc/network/packets/packet_area.c +++ b/src/pc/network/packets/packet_area.c @@ -118,6 +118,7 @@ void network_send_area(struct NetworkPlayer* toNp) { for (int i = 0; i < MAX_SYNC_OBJECTS; i++) { struct SyncObject* so = &gSyncObjects[i]; if (so == NULL || so->o == NULL) { continue; } + if (so->lastReliablePacketIsStale) { continue; } struct Packet* entPacket = get_last_sync_ent_reliable_packet(i); if (entPacket->error) { continue; } struct Packet p2 = { 0 }; diff --git a/src/pc/network/packets/packet_object.c b/src/pc/network/packets/packet_object.c index c7cf6b15e..eb2508e08 100644 --- a/src/pc/network/packets/packet_object.c +++ b/src/pc/network/packets/packet_object.c @@ -121,6 +121,8 @@ struct SyncObject* network_init_object(struct Object *o, float maxSyncDistance) so->owned = false; so->clockSinceUpdate = clock_elapsed(); so->extraFieldCount = 0; + so->lastReliablePacketIsStale = false; + so->rememberLastReliablePacket = true; so->behavior = (BehaviorScript*)o->behavior; for (int i = 0; i < MAX_PLAYERS; i++) { so->rxEventId[i] = 0; @@ -520,7 +522,7 @@ void network_send_object_reliability(struct Object* o, bool reliable) { } else { network_send_reservation_release(syncId); } - } else { + } else if (so->rememberLastReliablePacket) { // remember packet packet_duplicate(&p, &sLastSyncEntReliablePacket[syncId]); }