From a0807c762f71fd537d85767947e0b8cadea03479 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 27 Aug 2002 08:33:21 +0000 Subject: [PATCH] fix the handling of escape when in the console before ever connecting --- nq/source/cl_main.c | 33 ++++++++++++++++++--------------- qw/source/cl_main.c | 12 +++++------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 3b34a4d2b..35b68d565 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -717,23 +717,26 @@ CL_SendCmd (void) void CL_SetState (cactive_t state) { + cactive_t old_state = cls.state; cls.state = state; - if (cls.state == ca_active) { - r_active = true; - game_target = IMT_0; - key_dest = key_game; - IN_ClearStates (); - VID_SetCaption (""); - if (con_module) - con_module->data->console->force_commandline = 0; - } else { - r_active = false; - game_target = IMT_CONSOLE; - key_dest = key_console; - VID_SetCaption ("Disconnected"); - if (con_module) - con_module->data->console->force_commandline = 1; + if (old_state != state) { + if (state == ca_active) { + // entering active state + r_active = true; + game_target = IMT_0; + key_dest = key_game; + IN_ClearStates (); + VID_SetCaption (""); + } else if (old_state == ca_active) { + // leaving active state + r_active = false; + game_target = IMT_CONSOLE; + key_dest = key_console; + VID_SetCaption ("Disconnected"); + } } + if (con_module) + con_module->data->console->force_commandline = (state != ca_active); } void diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index e661cb90c..b806c3c44 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1133,10 +1133,9 @@ CL_SetState (cactive_t state) r_active = false; game_target = IMT_CONSOLE; key_dest = key_console; - if (con_module) - con_module->data->console->force_commandline = 1; + // Auto demo recorder stops here - if(cl_autorecord->int_val && cls.demorecording) + if (cl_autorecord->int_val && cls.demorecording) CL_Stop_f (); } else if (state == ca_active) { // entering active state @@ -1146,15 +1145,14 @@ CL_SetState (cactive_t state) game_target = IMT_0; key_dest = key_game; - if (con_module) - con_module->data->console->force_commandline = 0; - // Auto demo recorder starts here - if(cl_autorecord->int_val && !cls.demoplayback + if (cl_autorecord->int_val && !cls.demoplayback && !cls.demorecording) CL_Record (0); } } + if (con_module) + con_module->data->console->force_commandline = (state != ca_active); } void