Move water level syncing from level packets to area packets

This commit is contained in:
MysterD 2021-08-05 00:40:43 -07:00
parent cbb7eb419c
commit dafa5536a1
2 changed files with 3 additions and 2 deletions

View file

@ -5,6 +5,7 @@
#include "game/level_update.h" #include "game/level_update.h"
#include "game/area.h" #include "game/area.h"
#include "game/object_helpers.h" #include "game/object_helpers.h"
#include "game/object_list_processor.h"
#include "behavior_table.h" #include "behavior_table.h"
#include "object_constants.h" #include "object_constants.h"
#include "object_fields.h" #include "object_fields.h"
@ -46,6 +47,7 @@ void network_send_area(struct NetworkPlayer* toNp) {
// area variables // area variables
packet_write(&p, &gNetworkAreaTimer, sizeof(u32)); packet_write(&p, &gNetworkAreaTimer, sizeof(u32));
packet_write(&p, gEnvironmentLevels, sizeof(s32));
// write sync id removals // write sync id removals
packet_write(&p, &sRemoveSyncIdsIndex, sizeof(u8)); packet_write(&p, &sRemoveSyncIdsIndex, sizeof(u8));
@ -142,6 +144,7 @@ void network_receive_area(struct Packet* p) {
// read area variables // read area variables
packet_read(p, &gNetworkAreaTimer, sizeof(u32)); packet_read(p, &gNetworkAreaTimer, sizeof(u32));
gNetworkAreaTimerClock = clock_elapsed_ticks() - gNetworkAreaTimer; gNetworkAreaTimerClock = clock_elapsed_ticks() - gNetworkAreaTimer;
packet_read(p, gEnvironmentLevels, sizeof(s32));
// read removed sync ids // read removed sync ids
area_remove_sync_ids_clear(); area_remove_sync_ids_clear();

View file

@ -29,7 +29,6 @@ void network_send_level(struct NetworkPlayer* toNp, bool sendArea) {
packet_write(&p, &gPssSlideStarted, sizeof(u8)); packet_write(&p, &gPssSlideStarted, sizeof(u8));
packet_write(&p, &gHudDisplay.timer, sizeof(u16)); packet_write(&p, &gHudDisplay.timer, sizeof(u16));
packet_write(&p, &gTTCSpeedSetting, sizeof(s16)); packet_write(&p, &gTTCSpeedSetting, sizeof(s16));
packet_write(&p, gEnvironmentLevels, sizeof(s32));
// send level packet // send level packet
network_send_to(toNp->localIndex, &p); network_send_to(toNp->localIndex, &p);
@ -75,7 +74,6 @@ void network_receive_level(struct Packet* p) {
packet_read(p, &gPssSlideStarted, sizeof(u8)); packet_read(p, &gPssSlideStarted, sizeof(u8));
packet_read(p, &gHudDisplay.timer, sizeof(u16)); packet_read(p, &gHudDisplay.timer, sizeof(u16));
packet_read(p, &gTTCSpeedSetting, sizeof(s16)); // likely doesn't work after level load.. but it could packet_read(p, &gTTCSpeedSetting, sizeof(s16)); // likely doesn't work after level load.. but it could
packet_read(p, gEnvironmentLevels, sizeof(s32));
// hacky way to override red coins collected // hacky way to override red coins collected
gRedCoinsCollected = redCoinsCollected; gRedCoinsCollected = redCoinsCollected;