Improvements to debug move (#44)

This commit is contained in:
Isaac 2022-03-27 15:46:32 +10:00 committed by GitHub
parent ed749285c6
commit c6cc2396a5
2 changed files with 25 additions and 0 deletions

View File

@ -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;

View File

@ -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; }