Prevented debug binds from working with Discord (#34)

This commit is contained in:
Isaac 2022-03-17 18:20:56 +10:00 committed by GitHub
parent 0cd2a91e9c
commit 799e1e9f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 16 deletions

View File

@ -41,6 +41,7 @@
#include "pc/cheats.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
#include "pc/network/socket/socket.h"
#include "pc/logfile.h"
#ifdef BETTERCAMERA
#include "bettercamera.h"
@ -1517,10 +1518,12 @@ void update_mario_inputs(struct MarioState *m) {
/* Developer stuff */
#ifdef DEVELOPMENT
if (m->playerIndex == 0) {
if (m->action != ACT_DEBUG_FREE_MOVE && m->controller->buttonPressed & L_TRIG && m->controller->buttonDown & Z_TRIG) {
set_mario_action(m, ACT_DEBUG_FREE_MOVE, 0);
m->marioObj->oTimer = 0;
if (gNetworkSystem == &gNetworkSystemSocket) {
if (m->playerIndex == 0) {
if (m->action != ACT_DEBUG_FREE_MOVE && m->controller->buttonPressed & L_TRIG && m->controller->buttonDown & Z_TRIG) {
set_mario_action(m, ACT_DEBUG_FREE_MOVE, 0);
m->marioObj->oTimer = 0;
}
}
}
#endif

View File

@ -13,6 +13,7 @@
#ifdef DEBUG
#include "pc/lua/smlua.h"
#include "pc/network/socket/socket.h"
static bool sHoldingAlt = false;
@ -82,24 +83,28 @@ static void debug_spawn_object(void) {
}
void debug_keyboard_on_key_down(int scancode) {
switch (scancode & 0xFF) {
case SCANCODE_ALT: sHoldingAlt = true; break;
case SCANCODE_3: debug_breakpoint_here(); break;
if (gNetworkSystem == &gNetworkSystemSocket) {
switch (scancode & 0xFF) {
case SCANCODE_ALT: sHoldingAlt = true; break;
case SCANCODE_3: debug_breakpoint_here(); break;
#ifdef DEVELOPMENT
case SCANCODE_1: if (sHoldingAlt) { debug_warp_level1(); } break;
case SCANCODE_2: if (sHoldingAlt) { debug_warp_level2(); } break;
case SCANCODE_8: if (sHoldingAlt) { debug_spawn_object(); } break;
case SCANCODE_9: if (sHoldingAlt) { debug_warp_to(); } break;
case SCANCODE_0: if (sHoldingAlt) { debug_suicide(); } break;
case SCANCODE_F5: debug_reload_lua(); break;
case SCANCODE_1: if (sHoldingAlt) { debug_warp_level1(); } break;
case SCANCODE_2: if (sHoldingAlt) { debug_warp_level2(); } break;
case SCANCODE_8: if (sHoldingAlt) { debug_spawn_object(); } break;
case SCANCODE_9: if (sHoldingAlt) { debug_warp_to(); } break;
case SCANCODE_0: if (sHoldingAlt) { debug_suicide(); } break;
case SCANCODE_F5: debug_reload_lua(); break;
#endif
}
}
}
void debug_keyboard_on_key_up(int scancode) {
switch (scancode & 0xFF) {
case SCANCODE_ALT: sHoldingAlt = false; break;
if (gNetworkSystem == &gNetworkSystemSocket) {
switch (scancode & 0xFF) {
case SCANCODE_ALT: sHoldingAlt = false; break;
}
}
}
#endif
#endif