mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[nq] Sort out some of the issues with keydest
Switches to "game" properly when starting a new game after playing menus. Of course, basic bindings are still broken in "demo".
This commit is contained in:
parent
5f93c115ff
commit
dac9166339
4 changed files with 27 additions and 22 deletions
|
@ -653,6 +653,12 @@ void Key_SetBinding (imt_t *imt, knum_t keynum, const char *binding);
|
|||
*/
|
||||
void Key_SetKeyDest(keydest_t kd);
|
||||
|
||||
/** Get the current keydest target.
|
||||
|
||||
\return The current keydest target.
|
||||
*/
|
||||
keydest_t Key_GetKeyDest(void) __attribute__((pure));
|
||||
|
||||
/** keydest callback signature.
|
||||
|
||||
\param kd The new current keydest target.
|
||||
|
|
|
@ -81,6 +81,7 @@ static cvar_t *confirm_quit;
|
|||
|
||||
static progs_t menu_pr_state;
|
||||
static menu_item_t *menu;
|
||||
static keydest_t menu_keydest;
|
||||
static hashtab_t *menu_hash;
|
||||
static func_t menu_init;
|
||||
static func_t menu_quit;
|
||||
|
@ -375,11 +376,7 @@ bi_Menu_SelectMenu (progs_t *pr)
|
|||
} else {
|
||||
if (name && *name)
|
||||
Sys_Printf ("no menu \"%s\"\n", name);
|
||||
if (con_data.force_commandline) {
|
||||
Key_SetKeyDest (key_console);
|
||||
} else {
|
||||
Key_SetKeyDest (key_game);
|
||||
}
|
||||
Key_SetKeyDest (menu_keydest);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,11 +461,7 @@ bi_Menu_Leave (progs_t *pr)
|
|||
}
|
||||
menu = menu->parent;
|
||||
if (!menu) {
|
||||
if (con_data.force_commandline) {
|
||||
Key_SetKeyDest (key_console);
|
||||
} else {
|
||||
Key_SetKeyDest (key_game);
|
||||
}
|
||||
Key_SetKeyDest (menu_keydest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -792,13 +785,16 @@ Menu_Enter ()
|
|||
Key_SetKeyDest (key_console);
|
||||
return;
|
||||
}
|
||||
Key_SetKeyDest (key_menu);
|
||||
menu = Hash_Find (menu_hash, top_menu);
|
||||
if (menu && menu->enter_hook) {
|
||||
if (menu) {
|
||||
menu_keydest = Key_GetKeyDest ();
|
||||
Key_SetKeyDest (key_menu);
|
||||
if (menu->enter_hook) {
|
||||
run_menu_pre ();
|
||||
PR_ExecuteProgram (&menu_pr_state, menu->enter_hook);
|
||||
run_menu_post ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -812,11 +808,7 @@ Menu_Leave ()
|
|||
}
|
||||
menu = menu->parent;
|
||||
if (!menu) {
|
||||
if (con_data.force_commandline) {
|
||||
Key_SetKeyDest (key_console);
|
||||
} else {
|
||||
Key_SetKeyDest (key_game);
|
||||
}
|
||||
Key_SetKeyDest (menu_keydest);
|
||||
}
|
||||
}
|
||||
r_data->vid->recalc_refdef = true;
|
||||
|
|
|
@ -1352,12 +1352,19 @@ VISIBLE void
|
|||
Key_SetKeyDest(keydest_t kd)
|
||||
{
|
||||
if ((int) kd < key_unfocused || kd >= key_last) {
|
||||
Sys_Error ("Bad key_dest");
|
||||
Sys_Error ("Bad key_dest: %d", kd);
|
||||
}
|
||||
Sys_MaskPrintf (SYS_input, "Key_SetKeyDest: %s\n", keydest_names[kd]);
|
||||
key_dest = kd;
|
||||
Key_CallDestCallbacks (key_dest);
|
||||
}
|
||||
|
||||
VISIBLE keydest_t
|
||||
Key_GetKeyDest (void)
|
||||
{
|
||||
return key_dest;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Key_KeydestCallback (keydest_callback_t *callback)
|
||||
{
|
||||
|
|
|
@ -126,6 +126,7 @@ CL_StopPlayback (void)
|
|||
|
||||
Qclose (cls.demofile);
|
||||
cls.demofile = NULL;
|
||||
cls.key_dest = key_game;
|
||||
CL_SetState (ca_disconnected);
|
||||
cls.demo_capture = 0;
|
||||
cls.demoplayback = 0;
|
||||
|
@ -479,7 +480,6 @@ CL_StartDemo (void)
|
|||
CL_SetState (ca_connected);
|
||||
cls.forcetrack = 0;
|
||||
cls.key_dest = key_demo;
|
||||
Key_SetKeyDest (key_demo);
|
||||
|
||||
while ((c = Qgetc (cls.demofile)) != '\n')
|
||||
if (c == '-')
|
||||
|
|
Loading…
Reference in a new issue