diff --git a/src/pc/controller/controller_keyboard.c b/src/pc/controller/controller_keyboard.c index 3d60980c..9923b582 100644 --- a/src/pc/controller/controller_keyboard.c +++ b/src/pc/controller/controller_keyboard.c @@ -55,6 +55,9 @@ bool keyboard_on_key_down(int scancode) { } bool keyboard_on_key_up(int scancode) { +#ifdef DEBUG + debug_keyboard_on_key_up(scancode); +#endif djui_interactable_on_key_up(scancode); int mapped = keyboard_map_scancode(scancode); diff --git a/src/pc/controller/controller_keyboard_debug.c b/src/pc/controller/controller_keyboard_debug.c index 8decf14d..b465f0d5 100644 --- a/src/pc/controller/controller_keyboard_debug.c +++ b/src/pc/controller/controller_keyboard_debug.c @@ -14,6 +14,8 @@ #ifdef DEBUG #include "pc/lua/smlua.h" + +static bool sHoldingAlt = false; static u8 warpToLevel = LEVEL_BOB; static u8 warpToArea = 27; // warpToArea: 26 = basement @@ -31,6 +33,7 @@ static u8 warpToArea = 27; #define SCANCODE_8 0x09 #define SCANCODE_9 0x0A #define SCANCODE_F5 0x3f +#define SCANCODE_ALT 0x38 static void debug_breakpoint_here(void) { // create easy breakpoint position for debugging @@ -151,18 +154,24 @@ static void debug_spawn_object(void) { } void debug_keyboard_on_key_down(int scancode) { - scancode = scancode; switch (scancode & 0xFF) { + case SCANCODE_ALT: sHoldingAlt = true; break; case SCANCODE_3: debug_breakpoint_here(); break; #ifdef DEVELOPMENT - case SCANCODE_6: debug_warp_level(warpToLevel); break; - case SCANCODE_7: debug_warp_area(); break; - case SCANCODE_8: debug_spawn_object(); break; - case SCANCODE_9: debug_warp_to(); break; - case SCANCODE_0: debug_suicide(); break; + case SCANCODE_6: if (sHoldingAlt) { debug_warp_level(warpToLevel); } break; + case SCANCODE_7: if (sHoldingAlt) { debug_warp_area(); } 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; + } +} + #endif \ No newline at end of file diff --git a/src/pc/controller/controller_keyboard_debug.h b/src/pc/controller/controller_keyboard_debug.h index ad0458e0..99735458 100644 --- a/src/pc/controller/controller_keyboard_debug.h +++ b/src/pc/controller/controller_keyboard_debug.h @@ -3,6 +3,7 @@ #ifdef DEBUG void debug_keyboard_on_key_down(int scancode); +void debug_keyboard_on_key_up(int scancode); #endif #endif