From 673bd16299b23b1b5af819ab286a9d1ec4a40d7a Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 16 Aug 2019 00:20:52 +0000 Subject: [PATCH] Input: Separate everything in AdvanceTrigger into a new TextSubmit except Space so it doesn't submit text fields such as savegames git-svn-id: https://svn.eduke32.com/eduke32@8025 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/input.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/source/duke3d/src/input.cpp b/source/duke3d/src/input.cpp index 2199d794c..c2e3fa633 100644 --- a/source/duke3d/src/input.cpp +++ b/source/duke3d/src/input.cpp @@ -54,12 +54,11 @@ void I_ClearAllInput(void) } -int32_t I_AdvanceTrigger(void) +int32_t I_TextSubmit(void) { return KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) - || KB_KeyPressed(sc_Space) #if !defined EDUKE32_TOUCH_DEVICES || MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE) #endif @@ -70,10 +69,9 @@ int32_t I_AdvanceTrigger(void) ; } -void I_AdvanceTriggerClear(void) +void I_TextSubmitClear(void) { KB_FlushKeyboardQueue(); - KB_ClearKeyDown(sc_Space); KB_ClearKeyDown(sc_kpad_Enter); KB_ClearKeyDown(sc_Enter); MOUSE_ClearButton(LEFT_MOUSE); @@ -83,6 +81,19 @@ void I_AdvanceTriggerClear(void) #endif } +int32_t I_AdvanceTrigger(void) +{ + return + I_TextSubmit() + || KB_KeyPressed(sc_Space); +} + +void I_AdvanceTriggerClear(void) +{ + I_TextSubmitClear(); + KB_ClearKeyDown(sc_Space); +} + int32_t I_ReturnTrigger(void) { return @@ -377,9 +388,9 @@ int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags) } } - if (I_AdvanceTrigger()) + if (I_TextSubmit()) { - I_AdvanceTriggerClear(); + I_TextSubmitClear(); return 1; } if (I_ReturnTrigger())