From 57a4e746cfbc2b6fad6037e6503cecadd9357787 Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 18 Aug 2020 18:46:54 -0700 Subject: [PATCH] Synchronized underwater koopa shell --- src/game/behaviors/koopa_shell.inc.c | 1 + src/game/behaviors/koopa_shell_underwater.inc.c | 4 ++++ src/pc/network/packets/packet_player.c | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/behaviors/koopa_shell.inc.c b/src/game/behaviors/koopa_shell.inc.c index d62f103e..73bd19ab 100644 --- a/src/game/behaviors/koopa_shell.inc.c +++ b/src/game/behaviors/koopa_shell.inc.c @@ -88,6 +88,7 @@ void bhv_koopa_shell_loop(void) { koopa_shell_spawn_sparkles(10.0f); o->oFaceAngleYaw = player->oMoveAngleYaw; if (o->oInteractStatus & INT_STATUS_STOP_RIDING) { + o->heldByPlayerIndex = 0; obj_mark_for_deletion(o); spawn_mist_particles(); o->oAction = 0; diff --git a/src/game/behaviors/koopa_shell_underwater.inc.c b/src/game/behaviors/koopa_shell_underwater.inc.c index ff0eef70..45f411f7 100644 --- a/src/game/behaviors/koopa_shell_underwater.inc.c +++ b/src/game/behaviors/koopa_shell_underwater.inc.c @@ -17,6 +17,9 @@ void set_koopa_shell_underwater_hitbox(void) { } void bhv_koopa_shell_underwater_loop(void) { + if (o->oSyncID == 0) { + network_init_object(o, 500.0f); + } switch (o->oHeldState) { case HELD_FREE: set_koopa_shell_underwater_hitbox(); @@ -26,6 +29,7 @@ void bhv_koopa_shell_underwater_loop(void) { break; case HELD_THROWN: case HELD_DROPPED: + o->heldByPlayerIndex = 0; obj_mark_for_deletion(o); spawn_mist_particles(); break; diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c index 2f20c2fa..6c319754 100644 --- a/src/pc/network/packets/packet_player.c +++ b/src/pc/network/packets/packet_player.c @@ -56,7 +56,10 @@ void network_receive_player(struct Packet* p) { if (heldSyncID != NULL && syncObjects[heldSyncID].o != NULL) { // TODO: do we have to move graphics nodes around to make this visible? gMarioStates[1].heldObj = syncObjects[heldSyncID].o; - gMarioStates[1].heldObj->heldByPlayerIndex = 1; + if (gMarioStates[1].heldObj != NULL) { + gMarioStates[1].heldObj->oHeldState = HELD_HELD; + gMarioStates[1].heldObj->heldByPlayerIndex = 1; + } } else { gMarioStates[1].heldObj = NULL; }