|
1 | 1 | #include <stdio.h> |
| 2 | +#include <stddef.h> |
2 | 3 | #include "../network.h" |
3 | 4 | #include "object_fields.h" |
4 | 5 | #include "object_constants.h" |
@@ -244,6 +245,18 @@ void network_receive_player(struct Packet* p) { |
244 | 245 | struct MarioState* m = &gMarioStates[np->localIndex]; |
245 | 246 | if (m == NULL || m->marioObj == NULL) { return; } |
246 | 247 |
|
| 248 | + if (gNetworkType == NT_SERVER && *((u32*)(p->buffer + p->cursor + offsetof(struct PacketPlayerData, action))) == ACT_DEBUG_FREE_MOVE) { |
| 249 | +#ifdef DEVELOPMENT |
| 250 | + if (m->action != ACT_DEBUG_FREE_MOVE) { |
| 251 | + construct_player_popup(np, DLANG(NOTIF, DEBUG_FLY), NULL); |
| 252 | + } |
| 253 | +#else |
| 254 | + network_send_kick(np->localIndex, EKT_KICKED); |
| 255 | + network_player_disconnected(np->localIndex); |
| 256 | + return; |
| 257 | +#endif |
| 258 | + } |
| 259 | + |
247 | 260 | // prevent receiving player from other area |
248 | 261 | bool levelAreaMismatch = ((gNetworkPlayerLocal == NULL) |
249 | 262 | || np->currCourseNum != gNetworkPlayerLocal->currCourseNum |
@@ -395,19 +408,6 @@ void network_receive_player(struct Packet* p) { |
395 | 408 | // Player's position is valid since it's updated and in the same area as the local player |
396 | 409 | np->currPositionValid = true; |
397 | 410 |
|
398 | | -#ifndef DEVELOPMENT |
399 | | - if (gNetworkType == NT_SERVER) { |
400 | | - if (m->action == ACT_DEBUG_FREE_MOVE) { |
401 | | - network_send_kick(np->localIndex, EKT_CLOSE_CONNECTION); |
402 | | - network_player_disconnected(np->localIndex); |
403 | | - } |
404 | | - } |
405 | | -#else |
406 | | - if (m->action == ACT_DEBUG_FREE_MOVE && oldData.action != ACT_DEBUG_FREE_MOVE) { |
407 | | - construct_player_popup(np, DLANG(NOTIF, DEBUG_FLY), NULL); |
408 | | - } |
409 | | -#endif |
410 | | - |
411 | 411 | if (np->currLevelNum == LEVEL_BOWSER_3 && m->action == ACT_JUMBO_STAR_CUTSCENE && gMarioStates[0].action != ACT_JUMBO_STAR_CUTSCENE) { |
412 | 412 | set_mario_action((struct MarioState*) &gMarioStates[0], ACT_JUMBO_STAR_CUTSCENE, 0); |
413 | 413 | } |
|
0 commit comments