From c6cc2396a598187497a1118ed2524e6d8c240948 Mon Sep 17 00:00:00 2001 From: Isaac <62234577+Isaac0-dev@users.noreply.github.com> Date: Sun, 27 Mar 2022 15:46:32 +1000 Subject: [PATCH] Improvements to debug move (#44) --- src/game/mario_actions_cutscene.c | 12 ++++++++++++ src/pc/network/packets/packet_player.c | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index d8e4fa56..337e0746 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -608,6 +608,18 @@ s32 act_debug_free_move(struct MarioState *m) { f32 speed; u32 action; +#ifndef DEVELOPMENT + if (gNetworkType == NT_SERVER && configEnableCheats == 0 && m->action == ACT_DEBUG_FREE_MOVE) { + if (m->pos[1] <= m->waterLevel - 100) { + action = ACT_WATER_IDLE; + } else { + action = ACT_FREEFALL; + } + set_mario_action(m, action, 0); + return FALSE; + } +#endif + // integer immediates, generates convert instructions for some reason speed = gPlayer1Controller->buttonDown & B_BUTTON ? 1 : 4; diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c index 37108f7e..351ecae5 100644 --- a/src/pc/network/packets/packet_player.c +++ b/src/pc/network/packets/packet_player.c @@ -360,7 +360,20 @@ void network_receive_player(struct Packet* p) { vec3f_copy(m->marioObj->header.gfx.pos, m->pos); vec3s_copy(m->marioObj->header.gfx.angle, m->faceAngle); } + +#ifndef DEVELOPMENT + if (gNetworkType == NT_SERVER && configEnableCheats == 0) { + for (int i = 0; i < MAX_PLAYERS; i++) { + struct NetworkPlayer* np = &gNetworkPlayers[i]; + struct MarioState* m = &gMarioStates[np->localIndex]; + if (m->action == ACT_DEBUG_FREE_MOVE) { + network_send_kick(np->localIndex, EKT_CLOSE_CONNECTION); + network_player_disconnected(np->localIndex); + } + } + } } +#endif void network_update_player(void) { if (!network_player_any_connected()) { return; }