mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-25 13:51:36 +00:00
[console] Hook up new input system
This has smashed the keydest handling for many things, and bindings, but seems to be a good start with the new input system: the console in qw-client-x11 is usable (keyboard-only). The button and axis values have been removed from the knum_t enum as mouse events are separate from key events, and other button and axis inputs will be handled separately. keys.c has been disabled in the build as it is obsolute (thus much of the breakage).
This commit is contained in:
parent
6dc90c5497
commit
4898a44263
28 changed files with 459 additions and 323 deletions
|
@ -60,6 +60,12 @@ typedef struct {
|
|||
int cur_line; // current line
|
||||
} con_buffer_t;
|
||||
|
||||
typedef enum {
|
||||
con_inactive,
|
||||
con_active,
|
||||
con_fullscreen,
|
||||
} con_state_t;
|
||||
|
||||
extern int con_linewidth;
|
||||
extern struct plugin_s *con_module;
|
||||
extern struct console_data_s con_data;
|
||||
|
@ -73,7 +79,7 @@ void Con_DrawConsole (void);
|
|||
|
||||
void Con_Printf (const char *fmt, ...) __attribute__((format(PRINTF, 1, 2)));
|
||||
void Con_Print (const char *fmt, va_list args) __attribute__((format(PRINTF, 1, 0)));
|
||||
void Con_ToggleConsole_f (void);
|
||||
void Con_SetState (con_state_t state);
|
||||
|
||||
struct inputline_s;
|
||||
// wrapper function to attempt to either complete the command line
|
||||
|
|
|
@ -88,6 +88,8 @@ typedef enum {
|
|||
ie_key,
|
||||
ie_axis,
|
||||
ie_button,
|
||||
|
||||
ie_event_count
|
||||
} IE_event_type;
|
||||
|
||||
#define IE_broadcast_events (0 \
|
||||
|
@ -113,5 +115,6 @@ int IE_Send_Event (const IE_event_t *event);
|
|||
int IE_Add_Handler (ie_handler_t *event_handler, void *data);
|
||||
void IE_Remove_Handler (int handle);
|
||||
void IE_Set_Focus (int handle);
|
||||
int IE_Get_Focus (void);
|
||||
|
||||
#endif//__QF_in_event_h
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#ifndef __QFCC__
|
||||
|
||||
#include "QF/darray.h"
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
#include "QF/input/binding.h"
|
||||
|
||||
|
@ -71,16 +72,20 @@ typedef struct in_context_s {
|
|||
imt_t **imt_tail;
|
||||
imt_t *active_imt;
|
||||
imt_t *default_imt;
|
||||
struct cbuf_s *cbuf;
|
||||
} in_context_t;
|
||||
|
||||
int IMT_GetAxisBlock (const char *device, int num_axes);
|
||||
int IMT_GetButtonBlock (const char *device, int num_buttons);
|
||||
int IMT_CreateContext (void);
|
||||
int IMT_GetContext (void);
|
||||
void IMT_SetContext (int ctx);
|
||||
void IMT_SetContextCbuf (int ctx, struct cbuf_s *cbuf);
|
||||
imt_t *IMT_FindIMT (const char *name);
|
||||
int IMT_CreateIMT (int context, const char *imt_name,
|
||||
const char *chain_imt_name);
|
||||
void IMT_ProcessAxis (int axis, int value);
|
||||
void IMT_ProcessButton (int button, int state);
|
||||
qboolean IMT_ProcessAxis (int axis, int value);
|
||||
qboolean IMT_ProcessButton (int button, int state);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
///@{
|
||||
|
||||
/// these are the key numbers that should be passed to Key_Event
|
||||
/// FIXME clashes with actual inicode and OS keys
|
||||
typedef enum {
|
||||
/* The keyboard syms have been cleverly chosen to map to ASCII */
|
||||
QFK_UNKNOWN = 0,
|
||||
|
@ -375,148 +376,6 @@ typedef enum {
|
|||
QFK_BACK,
|
||||
QFK_FORWARD,
|
||||
|
||||
/* Add any other keys here */
|
||||
|
||||
//
|
||||
// mouse buttons generate virtual keys
|
||||
//
|
||||
QFM_BUTTON1,
|
||||
QFM_BUTTON2,
|
||||
QFM_BUTTON3,
|
||||
QFM_WHEEL_UP,
|
||||
QFM_WHEEL_DOWN,
|
||||
QFM_BUTTON6,
|
||||
QFM_BUTTON7,
|
||||
QFM_BUTTON8,
|
||||
QFM_BUTTON9,
|
||||
QFM_BUTTON10,
|
||||
QFM_BUTTON11,
|
||||
QFM_BUTTON12,
|
||||
QFM_BUTTON13,
|
||||
QFM_BUTTON14,
|
||||
QFM_BUTTON15,
|
||||
QFM_BUTTON16,
|
||||
QFM_BUTTON17,
|
||||
QFM_BUTTON18,
|
||||
QFM_BUTTON19,
|
||||
QFM_BUTTON20,
|
||||
QFM_BUTTON21,
|
||||
QFM_BUTTON22,
|
||||
QFM_BUTTON23,
|
||||
QFM_BUTTON24,
|
||||
QFM_BUTTON25,
|
||||
QFM_BUTTON26,
|
||||
QFM_BUTTON27,
|
||||
QFM_BUTTON28,
|
||||
QFM_BUTTON29,
|
||||
QFM_BUTTON30,
|
||||
QFM_BUTTON31,
|
||||
QFM_BUTTON32,
|
||||
|
||||
//
|
||||
// joystick buttons
|
||||
//
|
||||
QFJ_BUTTON1,
|
||||
QFJ_BUTTON2,
|
||||
QFJ_BUTTON3,
|
||||
QFJ_BUTTON4,
|
||||
QFJ_BUTTON5,
|
||||
QFJ_BUTTON6,
|
||||
QFJ_BUTTON7,
|
||||
QFJ_BUTTON8,
|
||||
QFJ_BUTTON9,
|
||||
QFJ_BUTTON10,
|
||||
QFJ_BUTTON11,
|
||||
QFJ_BUTTON12,
|
||||
QFJ_BUTTON13,
|
||||
QFJ_BUTTON14,
|
||||
QFJ_BUTTON15,
|
||||
QFJ_BUTTON16,
|
||||
QFJ_BUTTON17,
|
||||
QFJ_BUTTON18,
|
||||
QFJ_BUTTON19,
|
||||
QFJ_BUTTON20,
|
||||
QFJ_BUTTON21,
|
||||
QFJ_BUTTON22,
|
||||
QFJ_BUTTON23,
|
||||
QFJ_BUTTON24,
|
||||
QFJ_BUTTON25,
|
||||
QFJ_BUTTON26,
|
||||
QFJ_BUTTON27,
|
||||
QFJ_BUTTON28,
|
||||
QFJ_BUTTON29,
|
||||
QFJ_BUTTON30,
|
||||
QFJ_BUTTON31,
|
||||
QFJ_BUTTON32,
|
||||
QFJ_BUTTON33,
|
||||
QFJ_BUTTON34,
|
||||
QFJ_BUTTON35,
|
||||
QFJ_BUTTON36,
|
||||
QFJ_BUTTON37,
|
||||
QFJ_BUTTON38,
|
||||
QFJ_BUTTON39,
|
||||
QFJ_BUTTON40,
|
||||
QFJ_BUTTON41,
|
||||
QFJ_BUTTON42,
|
||||
QFJ_BUTTON43,
|
||||
QFJ_BUTTON44,
|
||||
QFJ_BUTTON45,
|
||||
QFJ_BUTTON46,
|
||||
QFJ_BUTTON47,
|
||||
QFJ_BUTTON48,
|
||||
QFJ_BUTTON49,
|
||||
QFJ_BUTTON50,
|
||||
QFJ_BUTTON51,
|
||||
QFJ_BUTTON52,
|
||||
QFJ_BUTTON53,
|
||||
QFJ_BUTTON54,
|
||||
QFJ_BUTTON55,
|
||||
QFJ_BUTTON56,
|
||||
QFJ_BUTTON57,
|
||||
QFJ_BUTTON58,
|
||||
QFJ_BUTTON59,
|
||||
QFJ_BUTTON60,
|
||||
QFJ_BUTTON61,
|
||||
QFJ_BUTTON62,
|
||||
QFJ_BUTTON63,
|
||||
QFJ_BUTTON64,
|
||||
|
||||
//
|
||||
// joystick axes (for button emulation without consuming buttons)
|
||||
//
|
||||
QFJ_AXIS1,
|
||||
QFJ_AXIS2,
|
||||
QFJ_AXIS3,
|
||||
QFJ_AXIS4,
|
||||
QFJ_AXIS5,
|
||||
QFJ_AXIS6,
|
||||
QFJ_AXIS7,
|
||||
QFJ_AXIS8,
|
||||
QFJ_AXIS9,
|
||||
QFJ_AXIS10,
|
||||
QFJ_AXIS11,
|
||||
QFJ_AXIS12,
|
||||
QFJ_AXIS13,
|
||||
QFJ_AXIS14,
|
||||
QFJ_AXIS15,
|
||||
QFJ_AXIS16,
|
||||
QFJ_AXIS17,
|
||||
QFJ_AXIS18,
|
||||
QFJ_AXIS19,
|
||||
QFJ_AXIS20,
|
||||
QFJ_AXIS21,
|
||||
QFJ_AXIS22,
|
||||
QFJ_AXIS23,
|
||||
QFJ_AXIS24,
|
||||
QFJ_AXIS25,
|
||||
QFJ_AXIS26,
|
||||
QFJ_AXIS27,
|
||||
QFJ_AXIS28,
|
||||
QFJ_AXIS29,
|
||||
QFJ_AXIS30,
|
||||
QFJ_AXIS31,
|
||||
QFJ_AXIS32,
|
||||
|
||||
QFK_LAST
|
||||
} knum_t;
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <QF/console.h>
|
||||
#include <QF/plugin.h>
|
||||
#include <QF/qtypes.h>
|
||||
|
||||
typedef struct console_funcs_s {
|
||||
void (*init) (void);
|
||||
|
@ -40,6 +40,7 @@ typedef struct console_funcs_s {
|
|||
void (*draw_console) (void);
|
||||
void (*check_resize) (void);
|
||||
void (*new_map) (void);
|
||||
void (*set_state) (con_state_t state);
|
||||
} console_funcs_t;
|
||||
|
||||
typedef struct console_data_s {
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
#include "QF/va.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "QF/input/event.h"
|
||||
|
||||
#include "QF/plugin/general.h"
|
||||
#include "QF/plugin/console.h"
|
||||
#include "QF/plugin/vid_render.h"
|
||||
|
@ -89,6 +91,9 @@ static float con_times[NUM_CON_TIMES]; // realtime time the line was generated
|
|||
// for transparent notify lines
|
||||
|
||||
static int con_totallines; // total lines in console scrollback
|
||||
static con_state_t con_state;
|
||||
static int con_event_id;
|
||||
static int con_saved_focos;
|
||||
|
||||
static qboolean con_debuglog;
|
||||
static qboolean chat_team;
|
||||
|
@ -107,7 +112,7 @@ static view_t *hud_view;
|
|||
static qboolean con_initialized;
|
||||
|
||||
static keydest_t con_curr_keydest;
|
||||
static keydest_t con_prev_keydest;
|
||||
//static keydest_t con_prev_keydest;
|
||||
|
||||
static void
|
||||
ClearNotify (void)
|
||||
|
@ -118,19 +123,33 @@ ClearNotify (void)
|
|||
con_times[i] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
C_SetState (con_state_t state)
|
||||
{
|
||||
con_state = state;
|
||||
if (con_state == con_inactive) {
|
||||
IE_Set_Focus (con_saved_focos);
|
||||
} else {
|
||||
con_saved_focos = IE_Get_Focus ();
|
||||
IE_Set_Focus (con_event_id);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ToggleConsole_f (void)
|
||||
{
|
||||
Con_ClearTyping (input_line, 0);
|
||||
|
||||
if (con_curr_keydest == key_console && !con_data.force_commandline) {
|
||||
Key_SetKeyDest (con_prev_keydest);
|
||||
} else {
|
||||
con_prev_keydest = Key_GetKeyDest ();
|
||||
Key_SetKeyDest (key_console);
|
||||
switch (con_state) {
|
||||
case con_inactive:
|
||||
C_SetState (con_active);
|
||||
break;
|
||||
case con_active:
|
||||
C_SetState (con_inactive);
|
||||
break;
|
||||
case con_fullscreen:
|
||||
break;
|
||||
}
|
||||
|
||||
ClearNotify ();
|
||||
}
|
||||
|
||||
|
@ -140,9 +159,9 @@ ToggleChat_f (void)
|
|||
Con_ClearTyping (input_line, 0);
|
||||
|
||||
if (con_curr_keydest == key_console && !con_data.force_commandline) {
|
||||
Key_SetKeyDest (key_game);
|
||||
//Key_SetKeyDest (key_game);
|
||||
} else {
|
||||
Key_SetKeyDest (key_console);
|
||||
//Key_SetKeyDest (key_console);
|
||||
}
|
||||
|
||||
ClearNotify ();
|
||||
|
@ -164,7 +183,7 @@ MessageMode_f (void)
|
|||
if (con_data.force_commandline)
|
||||
return;
|
||||
chat_team = false;
|
||||
Key_SetKeyDest (key_message);
|
||||
//Key_SetKeyDest (key_message);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -173,7 +192,7 @@ MessageMode2_f (void)
|
|||
if (con_data.force_commandline)
|
||||
return;
|
||||
chat_team = true;
|
||||
Key_SetKeyDest (key_message);
|
||||
//Key_SetKeyDest (key_message);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -330,7 +349,7 @@ C_Say (inputline_t *il)
|
|||
Cbuf_AddText (con_data.cbuf, "say \"");
|
||||
Cbuf_AddText (con_data.cbuf, line);
|
||||
Cbuf_AddText (con_data.cbuf, "\"\n");
|
||||
Key_SetKeyDest (key_game);
|
||||
//Key_SetKeyDest (key_game);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -343,7 +362,7 @@ C_SayTeam (inputline_t *il)
|
|||
Cbuf_AddText (con_data.cbuf, "say_team \"");
|
||||
Cbuf_AddText (con_data.cbuf, line);
|
||||
Cbuf_AddText (con_data.cbuf, "\"\n");
|
||||
Key_SetKeyDest (key_game);
|
||||
//Key_SetKeyDest (key_game);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -447,79 +466,6 @@ C_Print (const char *fmt, va_list args)
|
|||
fputs (buffer->str + 1, stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
C_KeyEvent (knum_t key, short unicode, qboolean down, void *data)
|
||||
{
|
||||
inputline_t *il;
|
||||
|
||||
if (!down)
|
||||
return;
|
||||
|
||||
if (con_curr_keydest == key_menu) {
|
||||
Menu_KeyEvent (key, unicode, down);
|
||||
return;
|
||||
}
|
||||
|
||||
if (down) {
|
||||
if (key == key_toggleconsole) {
|
||||
ToggleConsole_f ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (con_curr_keydest == key_message) {
|
||||
if (chat_team) {
|
||||
il = say_team_line;
|
||||
} else {
|
||||
il = say_line;
|
||||
}
|
||||
} else {
|
||||
switch (key) {
|
||||
case QFK_PAGEUP:
|
||||
if (keydown[QFK_RCTRL] || keydown[QFK_LCTRL])
|
||||
con->display = 0;
|
||||
else
|
||||
con->display -= 10;
|
||||
if (con->display < con->current - con->numlines)
|
||||
con->display = con->current - con->numlines;
|
||||
return;
|
||||
case QFK_PAGEDOWN:
|
||||
if (keydown[QFK_RCTRL] || keydown[QFK_LCTRL])
|
||||
con->display = con->current;
|
||||
else
|
||||
con->display += 10;
|
||||
if (con->display > con->current)
|
||||
con->display = con->current;
|
||||
return;
|
||||
case QFM_WHEEL_UP:
|
||||
con->display -= 3;
|
||||
if (con->display < con->current - con->numlines)
|
||||
con->display = con->current - con->numlines;
|
||||
return;
|
||||
case QFM_WHEEL_DOWN:
|
||||
con->display += 3;
|
||||
if (con->display > con->current)
|
||||
con->display = con->current;
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
il = input_line;
|
||||
}
|
||||
//FIXME should this translation be here?
|
||||
if ((unicode==0x0A) && (key==QFK_RETURN)) {
|
||||
Con_ProcessInputLine (il, key);
|
||||
}
|
||||
if ((unicode==0x7F) && (key==QFK_BACKSPACE)) {
|
||||
Con_ProcessInputLine (il, key);
|
||||
}
|
||||
if (unicode!=0) {
|
||||
Con_ProcessInputLine (il, key >= 256 ? (int) key : unicode);
|
||||
} else {
|
||||
Con_ProcessInputLine (il, key);
|
||||
}
|
||||
}
|
||||
|
||||
/* DRAWING */
|
||||
|
||||
static void
|
||||
|
@ -551,8 +497,8 @@ C_DrawInputLine (inputline_t *il)
|
|||
static void
|
||||
draw_input (view_t *view)
|
||||
{
|
||||
if (con_curr_keydest != key_console)// && !con_data.force_commandline)
|
||||
return; // don't draw anything (always draw if not active)
|
||||
if (con_state == con_inactive)// && !con_data.force_commandline)
|
||||
return;
|
||||
|
||||
DrawInputLine (view->xabs + 8, view->yabs, 1, input_line);
|
||||
}
|
||||
|
@ -641,7 +587,7 @@ draw_console (view_t *view)
|
|||
{
|
||||
byte alpha;
|
||||
|
||||
if (con_data.force_commandline) {
|
||||
if (con_state == con_fullscreen) {
|
||||
alpha = 255;
|
||||
} else {
|
||||
float y = r_data->vid->conview->ylen * con_size->value;
|
||||
|
@ -704,12 +650,17 @@ setup_console (void)
|
|||
{
|
||||
float lines;
|
||||
|
||||
if (con_data.force_commandline) {
|
||||
lines = con_data.lines = r_data->vid->conview->ylen;
|
||||
} else if (con_curr_keydest == key_console) {
|
||||
lines = r_data->vid->conview->ylen * bound (0.2, con_size->value, 1);
|
||||
} else {
|
||||
lines = 0;
|
||||
switch (con_state) {
|
||||
case con_inactive:
|
||||
lines = 0;
|
||||
break;
|
||||
case con_active:
|
||||
lines = r_data->vid->conview->ylen * bound (0.2, con_size->value,
|
||||
1);
|
||||
break;
|
||||
case con_fullscreen:
|
||||
lines = con_data.lines = r_data->vid->conview->ylen;
|
||||
break;
|
||||
}
|
||||
|
||||
if (con_speed->value) {
|
||||
|
@ -776,13 +727,13 @@ exec_line (inputline_t *il)
|
|||
{
|
||||
Con_ExecLine (il->line);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
con_end_message (void *line)
|
||||
{
|
||||
Key_PopEscape ();
|
||||
//Key_PopEscape ();
|
||||
Con_ClearTyping (line, 1);
|
||||
Key_SetKeyDest (key_game);
|
||||
//Key_SetKeyDest (key_game);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -798,7 +749,7 @@ con_keydest_callback (keydest_t kd, void *data)
|
|||
return;
|
||||
}
|
||||
if (kd != key_console && con_curr_keydest == key_console) {
|
||||
Key_PopEscape ();
|
||||
//Key_PopEscape ();
|
||||
}
|
||||
switch (kd) {
|
||||
case key_last:
|
||||
|
@ -808,11 +759,11 @@ con_keydest_callback (keydest_t kd, void *data)
|
|||
case key_menu:
|
||||
break;
|
||||
case key_message:
|
||||
Key_PushEscape (con_end_message,
|
||||
chat_team ? say_team_line : say_line);
|
||||
//Key_PushEscape (con_end_message,
|
||||
// chat_team ? say_team_line : say_line);
|
||||
break;
|
||||
case key_console:
|
||||
Key_PushEscape (con_leave_console, 0);
|
||||
//Key_PushEscape (con_leave_console, 0);
|
||||
break;
|
||||
}
|
||||
con_curr_keydest = kd;
|
||||
|
@ -823,6 +774,108 @@ con_enter_menu (void *data)
|
|||
{
|
||||
Menu_Enter ();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
con_key_event (const IE_event_t *event)
|
||||
{
|
||||
inputline_t *il;
|
||||
__auto_type key = &event->key;
|
||||
|
||||
#if 0
|
||||
if (con_curr_keydest == key_menu) {
|
||||
Menu_KeyEvent (key, unicode, down);
|
||||
return;
|
||||
}
|
||||
|
||||
if (down) {
|
||||
if (key == key_toggleconsole) {
|
||||
ToggleConsole_f ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
if (con_curr_keydest == key_message) {
|
||||
if (chat_team) {
|
||||
il = say_team_line;
|
||||
} else {
|
||||
il = say_line;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
switch (key->code) {
|
||||
case QFK_PAGEUP:
|
||||
if (key->shift & ies_control)
|
||||
con->display = 0;
|
||||
else
|
||||
con->display -= 10;
|
||||
if (con->display < con->current - con->numlines)
|
||||
con->display = con->current - con->numlines;
|
||||
return;
|
||||
case QFK_PAGEDOWN:
|
||||
if (key->shift & ies_control)
|
||||
con->display = con->current;
|
||||
else
|
||||
con->display += 10;
|
||||
if (con->display > con->current)
|
||||
con->display = con->current;
|
||||
return;
|
||||
#if 0
|
||||
case QFM_WHEEL_UP:
|
||||
con->display -= 3;
|
||||
if (con->display < con->current - con->numlines)
|
||||
con->display = con->current - con->numlines;
|
||||
return;
|
||||
case QFM_WHEEL_DOWN:
|
||||
con->display += 3;
|
||||
if (con->display > con->current)
|
||||
con->display = con->current;
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
il = input_line;
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
//FIXME should this translation be here?
|
||||
if ((unicode==0x0A) && (key==QFK_RETURN)) {
|
||||
Con_ProcessInputLine (il, key);
|
||||
}
|
||||
if ((unicode==0x7F) && (key==QFK_BACKSPACE)) {
|
||||
Con_ProcessInputLine (il, key);
|
||||
}
|
||||
#endif
|
||||
if (key->unicode) {
|
||||
Con_ProcessInputLine (il, key->code >= 256 ? (int) key->code
|
||||
: key->unicode);
|
||||
} else {
|
||||
Con_ProcessInputLine (il, key->code);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
con_mouse_event (const IE_event_t *event)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
con_event_handler (const IE_event_t *ie_event, void *data)
|
||||
{
|
||||
static void (*handlers[ie_event_count]) (const IE_event_t *ie_event) = {
|
||||
[ie_key] = con_key_event,
|
||||
[ie_mouse] = con_mouse_event,
|
||||
};
|
||||
if (ie_event->type < 0 || ie_event->type >= ie_event_count
|
||||
|| !handlers[ie_event->type]) {
|
||||
return 0;
|
||||
}
|
||||
handlers[ie_event->type] (ie_event);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
C_Init (void)
|
||||
|
@ -833,11 +886,13 @@ C_Init (void)
|
|||
setlocale (LC_ALL, "C-TRADITIONAL");
|
||||
#endif
|
||||
|
||||
Key_PushEscape (con_enter_menu, 0);
|
||||
Key_KeydestCallback (con_keydest_callback, 0);
|
||||
Key_SetKeyEvent (key_message, C_KeyEvent, 0);
|
||||
Key_SetKeyEvent (key_menu, C_KeyEvent, 0);
|
||||
Key_SetKeyEvent (key_console, C_KeyEvent, 0);
|
||||
con_event_id = IE_Add_Handler (con_event_handler, 0);
|
||||
|
||||
//Key_PushEscape (con_enter_menu, 0);
|
||||
//Key_KeydestCallback (con_keydest_callback, 0);
|
||||
//Key_SetKeyEvent (key_message, C_KeyEvent, 0);
|
||||
//Key_SetKeyEvent (key_menu, C_KeyEvent, 0);
|
||||
//Key_SetKeyEvent (key_console, C_KeyEvent, 0);
|
||||
Menu_Init ();
|
||||
|
||||
con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL,
|
||||
|
@ -966,6 +1021,7 @@ static console_funcs_t plugin_info_console_funcs = {
|
|||
.draw_console = C_DrawConsole,
|
||||
.check_resize = C_CheckResize,
|
||||
.new_map = C_NewMap,
|
||||
.set_state = C_SetState,
|
||||
};
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
|
|
|
@ -157,6 +157,14 @@ Con_Print (const char *fmt, va_list args)
|
|||
vfprintf (stdout, fmt, args);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Con_SetState (con_state_t state)
|
||||
{
|
||||
if (con_module) {
|
||||
con_module->functions->console->set_state (state);
|
||||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Con_ProcessInput (void)
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ static cvar_t *confirm_quit;
|
|||
|
||||
static progs_t menu_pr_state;
|
||||
static menu_item_t *menu;
|
||||
static keydest_t menu_keydest;
|
||||
//static keydest_t menu_keydest;
|
||||
static hashtab_t *menu_hash;
|
||||
static func_t menu_init;
|
||||
static func_t menu_quit;
|
||||
|
@ -358,13 +358,13 @@ bi_Menu_TopMenu (progs_t *pr)
|
|||
free ((char *) top_menu);
|
||||
top_menu = strdup (name);
|
||||
}
|
||||
|
||||
/*
|
||||
static void
|
||||
menu_leave (void *data)
|
||||
{
|
||||
Menu_Leave ();
|
||||
}
|
||||
|
||||
*/
|
||||
static void
|
||||
bi_Menu_SelectMenu (progs_t *pr)
|
||||
{
|
||||
|
@ -374,11 +374,11 @@ bi_Menu_SelectMenu (progs_t *pr)
|
|||
if (name && *name)
|
||||
menu = Hash_Find (menu_hash, name);
|
||||
if (menu) {
|
||||
if (Key_GetKeyDest () != key_menu) {
|
||||
/*if (Key_GetKeyDest () != key_menu) {
|
||||
menu_keydest = Key_GetKeyDest ();
|
||||
Key_PushEscape (menu_leave, 0);
|
||||
Key_SetKeyDest (key_menu);
|
||||
}
|
||||
}*/
|
||||
if (menu->enter_hook) {
|
||||
run_menu_pre ();
|
||||
PR_ExecuteProgram (&menu_pr_state, menu->enter_hook);
|
||||
|
@ -387,8 +387,8 @@ bi_Menu_SelectMenu (progs_t *pr)
|
|||
} else {
|
||||
if (name && *name)
|
||||
Sys_Printf ("no menu \"%s\"\n", name);
|
||||
Key_PopEscape ();
|
||||
Key_SetKeyDest (menu_keydest);
|
||||
//Key_PopEscape ();
|
||||
//Key_SetKeyDest (menu_keydest);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,8 +473,8 @@ bi_Menu_Leave (progs_t *pr)
|
|||
}
|
||||
menu = menu->parent;
|
||||
if (!menu) {
|
||||
Key_PopEscape ();
|
||||
Key_SetKeyDest (menu_keydest);
|
||||
//Key_PopEscape ();
|
||||
//Key_SetKeyDest (menu_keydest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -775,15 +775,15 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
|
|||
return 0;
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
// case QFM_WHEEL_DOWN:
|
||||
bi_Menu_Next (&menu_pr_state);
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
// case QFM_WHEEL_UP:
|
||||
bi_Menu_Prev (&menu_pr_state);
|
||||
return 1;
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
// case QFM_BUTTON1:
|
||||
bi_Menu_Enter (&menu_pr_state);
|
||||
return 1;
|
||||
default:
|
||||
|
@ -795,14 +795,14 @@ void
|
|||
Menu_Enter ()
|
||||
{
|
||||
if (!top_menu) {
|
||||
Key_SetKeyDest (key_console);
|
||||
//Key_SetKeyDest (key_console);
|
||||
return;
|
||||
}
|
||||
menu = Hash_Find (menu_hash, top_menu);
|
||||
if (menu) {
|
||||
menu_keydest = Key_GetKeyDest ();
|
||||
Key_PushEscape (menu_leave, 0);
|
||||
Key_SetKeyDest (key_menu);
|
||||
//menu_keydest = Key_GetKeyDest ();
|
||||
//Key_PushEscape (menu_leave, 0);
|
||||
//Key_SetKeyDest (key_menu);
|
||||
if (menu->enter_hook) {
|
||||
run_menu_pre ();
|
||||
PR_ExecuteProgram (&menu_pr_state, menu->enter_hook);
|
||||
|
@ -822,8 +822,8 @@ Menu_Leave ()
|
|||
}
|
||||
menu = menu->parent;
|
||||
if (!menu) {
|
||||
Key_PopEscape ();
|
||||
Key_SetKeyDest (menu_keydest);
|
||||
//Key_PopEscape ();
|
||||
//Key_SetKeyDest (menu_keydest);
|
||||
}
|
||||
}
|
||||
r_data->vid->recalc_refdef = true;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
static void
|
||||
Key_GIB_Bind_Get_f (void)
|
||||
{
|
||||
#if 0
|
||||
const char *key, *cmd;
|
||||
imt_t *imt;
|
||||
int k;
|
||||
|
@ -68,6 +69,7 @@ Key_GIB_Bind_Get_f (void)
|
|||
GIB_Return ("");
|
||||
else
|
||||
GIB_Return (cmd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,7 +18,6 @@ libs_input_libQFinput_la_LDFLAGS= $(lib_ldflags)
|
|||
libs_input_libQFinput_la_LIBADD= $(input_deps)
|
||||
libs_input_libQFinput_la_DEPENDENCIES= $(input_deps)
|
||||
libs_input_libQFinput_la_SOURCES= \
|
||||
libs/input/keys.c \
|
||||
libs/input/old_keys.c \
|
||||
libs/input/in_axis.c \
|
||||
libs/input/in_binding.c \
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
typedef struct DARRAY_TYPE (in_devbindings_t) in_devbindingset_t;
|
||||
|
||||
static in_devbindingset_t devbindings = DARRAY_STATIC_INIT (8);
|
||||
static int in_binding_handler;
|
||||
|
||||
static void
|
||||
in_binding_add_device (const IE_event_t *ie_event)
|
||||
|
@ -133,13 +134,13 @@ in_binding_button (const IE_event_t *ie_event)
|
|||
static int
|
||||
in_binding_event_handler (const IE_event_t *ie_event, void *unused)
|
||||
{
|
||||
static void (*handlers[]) (const IE_event_t *ie_event) = {
|
||||
static void (*handlers[ie_event_count]) (const IE_event_t *ie_event) = {
|
||||
[ie_add_device] = in_binding_add_device,
|
||||
[ie_remove_device] = in_binding_remove_device,
|
||||
[ie_axis] = in_binding_axis,
|
||||
[ie_button] = in_binding_button,
|
||||
};
|
||||
if (ie_event->type < 0 || ie_event->type > ie_button
|
||||
if (ie_event->type < 0 || ie_event->type >= ie_event_count
|
||||
|| !handlers[ie_event->type]) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -147,8 +148,105 @@ in_binding_event_handler (const IE_event_t *ie_event, void *unused)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
in_bind_f (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
in_unbind_f (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
in_clear_f (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
in_devices_f (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
keyhelp_f (void)
|
||||
{
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
xcommand_t func;
|
||||
const char *desc;
|
||||
} bindcmd_t;
|
||||
|
||||
static bindcmd_t in_binding_commands[] = {
|
||||
{ "in_bind", in_bind_f,
|
||||
"Assign a command or a set of commands to a key.\n"
|
||||
"Note: To bind multiple commands to a key, enclose the "
|
||||
"commands in quotes and separate with semi-colons."
|
||||
},
|
||||
{ "in_unbind", in_unbind_f,
|
||||
"Remove the bind from the the selected key"
|
||||
},
|
||||
{ "in_clear", in_clear_f,
|
||||
"Remove all binds from the specified imts"
|
||||
},
|
||||
{ "in_devices", in_devices_f,
|
||||
"List the known devices and their status."
|
||||
},
|
||||
{ "keyhelp", keyhelp_f,
|
||||
"Identify the next active input axis or button.\n"
|
||||
"The identification includes the device binding name, axis or button "
|
||||
"number, and (if known) the name of the axis or button. Axes and "
|
||||
"buttons can always be bound by number, so even those for which a "
|
||||
"name is not known, but" PACKAGE_NAME " sees, can be bound."
|
||||
},
|
||||
{ }
|
||||
#if 0
|
||||
{ "bindlist", Key_Bindlist_f,
|
||||
"list all of the key bindings"
|
||||
},
|
||||
{ "unbindall", Key_Unbindall_f,
|
||||
"Remove all binds (USE CAUTIOUSLY!!!"
|
||||
},
|
||||
{ "unbind", Key_Unbind_f,
|
||||
"wrapper for in_unbind that uses in_bind_imt for the imt "
|
||||
"parameter"
|
||||
},
|
||||
{ "bind", Key_Bind_f,
|
||||
"wrapper for in_bind that uses "
|
||||
"in_bind_imt for the imt parameter"
|
||||
},
|
||||
{ "imt", Key_InputMappingTable_f,
|
||||
""
|
||||
},
|
||||
{ "imt_keydest", Key_IMT_Keydest_f,
|
||||
""
|
||||
},
|
||||
{ "imt_create", Key_IMT_Create_f,
|
||||
"create a new imt table:\n"
|
||||
" imt_create <keydest> <imt_name> [chain_name]\n"
|
||||
"\n"
|
||||
"The new table will be attached to the specified keydest\n"
|
||||
"imt_name must not already exist.\n"
|
||||
"If given, chain_name must already exist and be on "
|
||||
"keydest.\n"
|
||||
},
|
||||
{ "imt_drop_all", Key_IMT_Drop_All_f,
|
||||
"delete all imt tables\n"
|
||||
},
|
||||
{ "in_type", Key_In_Type_f,
|
||||
"Send the given string as simulated key presses."
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
IN_Binding_Init (void)
|
||||
{
|
||||
IE_Add_Handler (in_binding_event_handler, 0);
|
||||
in_binding_handler = IE_Add_Handler (in_binding_event_handler, 0);
|
||||
|
||||
for (bindcmd_t *cmd = in_binding_commands; cmd->name; cmd++) {
|
||||
Cmd_AddCommand (cmd->name, cmd->func, cmd->desc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,3 +108,9 @@ IE_Set_Focus (int handle)
|
|||
IE_Send_Event (&event);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
IE_Get_Focus (void)
|
||||
{
|
||||
return focus;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "QF/cmd.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "QF/input/imt.h"
|
||||
|
||||
|
@ -56,6 +57,7 @@ static imt_blockset_t axis_blocks = DARRAY_STATIC_INIT (8);
|
|||
static imt_blockset_t button_blocks = DARRAY_STATIC_INIT (8);
|
||||
|
||||
static in_contextset_t in_contexts = DARRAY_STATIC_INIT (8);
|
||||
static size_t imt_current_context;
|
||||
|
||||
static imt_block_t * __attribute__((pure))
|
||||
imt_find_block (imt_blockset_t *blockset, const char *device)
|
||||
|
@ -149,6 +151,30 @@ IMT_CreateContext (void)
|
|||
return ctx - in_contexts.a;
|
||||
}
|
||||
|
||||
int
|
||||
IMT_GetContext (void)
|
||||
{
|
||||
return imt_current_context;
|
||||
}
|
||||
|
||||
void
|
||||
IMT_SetContext (int ctx)
|
||||
{
|
||||
if ((size_t) ctx >= in_contexts.size) {
|
||||
Sys_Error ("IMT_SetContext: invalid context %d", ctx);
|
||||
}
|
||||
imt_current_context = ctx;
|
||||
}
|
||||
|
||||
void
|
||||
IMT_SetContextCbuf (int ctx, cbuf_t *cbuf)
|
||||
{
|
||||
if ((size_t) ctx >= in_contexts.size) {
|
||||
Sys_Error ("IMT_SetContextCbuf: invalid context %d", ctx);
|
||||
}
|
||||
in_contexts.a[imt_current_context].cbuf = cbuf;
|
||||
}
|
||||
|
||||
static imt_t * __attribute__ ((pure))
|
||||
imt_find_imt (in_context_t *ctx, const char *name)
|
||||
{
|
||||
|
@ -227,12 +253,64 @@ IMT_CreateIMT (int context, const char *imt_name, const char *chain_imt_name)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
qboolean
|
||||
IMT_ProcessAxis (int axis, int value)
|
||||
{
|
||||
imt_t *imt = in_contexts.a[imt_current_context].active_imt;
|
||||
|
||||
while (imt) {
|
||||
in_axisbinding_t *a = imt->axis_bindings.a[axis];
|
||||
if (a) {
|
||||
return true;
|
||||
}
|
||||
imt = imt->chain;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
process_binding (int button, int state, const char *cmd)
|
||||
{
|
||||
cbuf_t *cbuf = in_contexts.a[imt_current_context].cbuf;
|
||||
|
||||
if (!cbuf) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd[0] == '+') {
|
||||
if (state) {
|
||||
Cbuf_AddText (cbuf, va (0, "%s %d\n", cmd, button));
|
||||
} else {
|
||||
Cbuf_AddText (cbuf, va (0, "-%s %d\n", cmd + 1, button));
|
||||
}
|
||||
} else {
|
||||
if (state) {
|
||||
Cbuf_AddText (cbuf, va (0, "%s\n", cmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qboolean
|
||||
IMT_ProcessButton (int button, int state)
|
||||
{
|
||||
imt_t *imt = in_contexts.a[imt_current_context].active_imt;
|
||||
|
||||
Sys_Printf ("IMT_ProcessButton: %d %d\n", button, state);
|
||||
while (imt) {
|
||||
in_buttonbinding_t *b = imt->button_bindings.a[button];
|
||||
if (b) {
|
||||
switch (b->type) {
|
||||
case inb_button:
|
||||
IN_ButtonAction (b->button, button, state);
|
||||
break;
|
||||
case inb_command:
|
||||
//FIXME avoid repeat
|
||||
process_binding (button, state, b->command);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
imt = imt->chain;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,10 @@
|
|||
static void
|
||||
bi_Key_keydown (progs_t *pr)
|
||||
{
|
||||
#if 0
|
||||
int keynum = P_INT (pr, 0);
|
||||
R_INT (pr) = keydown[keynum];
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -55,6 +57,7 @@ bi_Key_keydown (progs_t *pr)
|
|||
static void
|
||||
bi_Key_SetBinding (progs_t *pr)
|
||||
{
|
||||
#if 0
|
||||
const char *imt_name = P_GSTRING (pr, 0);
|
||||
int keynum = P_INT (pr, 1);
|
||||
const char *binding = P_GSTRING (pr, 2);
|
||||
|
@ -68,6 +71,7 @@ bi_Key_SetBinding (progs_t *pr)
|
|||
if (imt) {
|
||||
Key_SetBinding (imt, keynum, binding);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -78,6 +82,7 @@ bi_Key_SetBinding (progs_t *pr)
|
|||
static void
|
||||
bi_Key_LookupBinding (progs_t *pr)
|
||||
{
|
||||
#if 0
|
||||
const char *imt_name = P_GSTRING (pr, 0);
|
||||
int bindnum = P_INT (pr, 1);
|
||||
const char *binding = P_GSTRING (pr, 2);
|
||||
|
@ -89,7 +94,7 @@ bi_Key_LookupBinding (progs_t *pr)
|
|||
imt = Key_FindIMT (imt_name);
|
||||
if (imt) {
|
||||
for (i = 0; i < QFK_LAST; i++) {
|
||||
//XXX keybind = imt->button_bindings.a[i].str;
|
||||
keybind = imt->button_bindings.a[i].str;
|
||||
if (keybind == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
@ -104,7 +109,8 @@ bi_Key_LookupBinding (progs_t *pr)
|
|||
}
|
||||
|
||||
R_INT (pr) = keynum;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
bi_Key_CountBinding
|
||||
|
@ -114,6 +120,7 @@ bi_Key_LookupBinding (progs_t *pr)
|
|||
static void
|
||||
bi_Key_CountBinding (progs_t *pr)
|
||||
{
|
||||
#if 0
|
||||
const char *imt_name = P_GSTRING (pr, 0);
|
||||
const char *binding = P_GSTRING (pr, 1);
|
||||
int i, res = 0;
|
||||
|
@ -123,7 +130,7 @@ bi_Key_CountBinding (progs_t *pr)
|
|||
imt = Key_FindIMT (imt_name);
|
||||
if (imt) {
|
||||
for (i = 0; i < QFK_LAST; i++) {
|
||||
//XXX keybind = imt->button_bindings.a[i].str;
|
||||
keybind = imt->button_bindings.a[i].str;
|
||||
if (keybind == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
@ -134,7 +141,8 @@ bi_Key_CountBinding (progs_t *pr)
|
|||
}
|
||||
|
||||
R_INT (pr) = res;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
@ -145,16 +153,20 @@ bi_Key_CountBinding (progs_t *pr)
|
|||
static void
|
||||
bi_Key_KeynumToString (progs_t *pr)
|
||||
{
|
||||
#if 0
|
||||
int keynum = P_INT (pr, 0);
|
||||
|
||||
RETURN_STRING (pr, Key_KeynumToString (keynum));
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Key_StringToKeynum (progs_t *pr)
|
||||
{
|
||||
#if 0
|
||||
const char *keyname = P_GSTRING (pr, 0);
|
||||
R_INT (pr) = Key_StringToKeynum (keyname);
|
||||
#endif
|
||||
}
|
||||
|
||||
static builtin_t builtins[] = {
|
||||
|
|
|
@ -807,7 +807,9 @@ event_key (XEvent *event)
|
|||
|
||||
x11_key.shift = event->xmotion.state & 0xff;
|
||||
XLateKey (&event->xkey, &x11_key.code, &x11_key.unicode);
|
||||
in_x11_send_key_event ();
|
||||
if (event->type == KeyPress) {
|
||||
in_x11_send_key_event ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -114,7 +114,7 @@ CL_WriteConfiguration (void)
|
|||
return;
|
||||
}
|
||||
|
||||
Key_WriteBindings (f);
|
||||
//Key_WriteBindings (f);
|
||||
Cvar_WriteVariables (f);
|
||||
|
||||
Qclose (f);
|
||||
|
@ -321,7 +321,7 @@ CL_EstablishConnection (const char *host)
|
|||
|
||||
cls.demonum = -1; // not in the demo loop now
|
||||
CL_SetState (ca_connected);
|
||||
Key_SetKeyDest (cls.key_dest);
|
||||
//Key_SetKeyDest (cls.key_dest);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -497,7 +497,7 @@ CL_SetState (cactive_t state)
|
|||
if (old_state != state) {
|
||||
if (old_state == ca_active) {
|
||||
// leaving active state
|
||||
Key_SetKeyDest (key_console);
|
||||
//Key_SetKeyDest (key_console);
|
||||
S_AmbientOff ();
|
||||
}
|
||||
switch (state) {
|
||||
|
@ -512,14 +512,14 @@ CL_SetState (cactive_t state)
|
|||
cls.signon = so_none; // need all the signon messages
|
||||
// before playing
|
||||
cl.loading = true;
|
||||
Key_SetKeyDest (cls.key_dest);
|
||||
//Key_SetKeyDest (cls.key_dest);
|
||||
IN_ClearStates ();
|
||||
VID_SetCaption ("Connected");
|
||||
break;
|
||||
case ca_active:
|
||||
// entering active state
|
||||
cl.loading = false;
|
||||
Key_SetKeyDest (cls.key_dest);
|
||||
//Key_SetKeyDest (cls.key_dest);
|
||||
IN_ClearStates ();
|
||||
VID_SetCaption ("");
|
||||
S_AmbientOn ();
|
||||
|
|
|
@ -847,13 +847,13 @@ Host_Init_Memory (void)
|
|||
|
||||
Sys_Printf ("%4.1f megabyte heap\n", host_mem_size->value);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
host_keydest_callback (keydest_t kd, void *data)
|
||||
{
|
||||
host_in_game = kd == key_game;
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
Host_Init (void)
|
||||
{
|
||||
|
@ -888,7 +888,7 @@ Host_Init (void)
|
|||
|
||||
Mod_Init ();
|
||||
|
||||
Key_KeydestCallback (host_keydest_callback, 0);
|
||||
//Key_KeydestCallback (host_keydest_callback, 0);
|
||||
|
||||
SV_Init ();
|
||||
|
||||
|
|
|
@ -1642,13 +1642,13 @@ Sbar_GIB_Print_Center_f (void)
|
|||
} else
|
||||
Sbar_CenterPrint (GIB_Argv(1));
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
sbar_keydest_callback (keydest_t kd, void *data)
|
||||
{
|
||||
overlay_view->visible = kd == key_game;
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
Sbar_Init (void)
|
||||
{
|
||||
|
@ -1656,7 +1656,7 @@ Sbar_Init (void)
|
|||
|
||||
init_views ();
|
||||
|
||||
Key_KeydestCallback (sbar_keydest_callback, 0);
|
||||
//Key_KeydestCallback (sbar_keydest_callback, 0);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
sb_nums[0][i] = r_funcs->Draw_PicFromWad (va (0, "num_%i", i));
|
||||
|
|
|
@ -237,7 +237,7 @@ CL_Chat_Flush_Ignores (void)
|
|||
{
|
||||
llist_flush (ignore_list);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
CL_ChatInfo (int val)
|
||||
{
|
||||
|
@ -268,6 +268,7 @@ cl_chat_keydest (keydest_t keydest, void *data)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
CL_Chat_Init (void)
|
||||
|
@ -277,5 +278,5 @@ CL_Chat_Init (void)
|
|||
|
||||
Cmd_AddCommand ("ignore", CL_Ignore_f, "Ignores chat and name-change messages from a user.");
|
||||
Cmd_AddCommand ("unignore", CL_Unignore_f, "Removes a previously ignored user from the ignore list.");
|
||||
Key_KeydestCallback (cl_chat_keydest, 0);
|
||||
//Key_KeydestCallback (cl_chat_keydest, 0);
|
||||
}
|
||||
|
|
|
@ -1014,7 +1014,7 @@ CL_StartDemo (void)
|
|||
Sys_Printf ("Playing demo from %s.\n", name->str);
|
||||
|
||||
cls.demoplayback = true;
|
||||
Key_SetKeyDest (key_demo);
|
||||
//Key_SetKeyDest (key_demo);
|
||||
net_blocksend = 1;
|
||||
if (type == 2) {
|
||||
cls.demoplayback2 = true;
|
||||
|
|
|
@ -1146,7 +1146,7 @@ CL_SetState (cactive_t state)
|
|||
if (old_state == ca_active) {
|
||||
// leaving active state
|
||||
IN_ClearStates ();
|
||||
Key_SetKeyDest (key_console);
|
||||
//Key_SetKeyDest (key_console);
|
||||
|
||||
// Auto demo recorder stops here
|
||||
if (cl_autorecord->int_val && cls.demorecording)
|
||||
|
@ -1155,7 +1155,7 @@ CL_SetState (cactive_t state)
|
|||
// entering active state
|
||||
VID_SetCaption (cls.servername->str);
|
||||
IN_ClearStates ();
|
||||
Key_SetKeyDest (key_game);
|
||||
//Key_SetKeyDest (key_game);
|
||||
|
||||
// Auto demo recorder starts here
|
||||
if (cl_autorecord->int_val && !cls.demoplayback
|
||||
|
@ -1163,8 +1163,7 @@ CL_SetState (cactive_t state)
|
|||
CL_Record (0, -1);
|
||||
}
|
||||
}
|
||||
if (con_module)
|
||||
con_module->data->console->force_commandline = (state != ca_active);
|
||||
Con_SetState (state == ca_active ? con_inactive : con_fullscreen);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1512,7 +1511,7 @@ Host_WriteConfiguration (void)
|
|||
return;
|
||||
}
|
||||
|
||||
Key_WriteBindings (f);
|
||||
//Key_WriteBindings (f);
|
||||
Cvar_WriteVariables (f);
|
||||
|
||||
Qclose (f);
|
||||
|
|
|
@ -1939,13 +1939,13 @@ Sbar_GIB_Print_Center_f (void)
|
|||
} else
|
||||
Sbar_CenterPrint (GIB_Argv(1));
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
sbar_keydest_callback (keydest_t kd, void *data)
|
||||
{
|
||||
overlay_view->visible = kd == key_game;
|
||||
}
|
||||
|
||||
#endif
|
||||
void
|
||||
Sbar_Init (void)
|
||||
{
|
||||
|
@ -1953,7 +1953,7 @@ Sbar_Init (void)
|
|||
|
||||
init_views ();
|
||||
|
||||
Key_KeydestCallback (sbar_keydest_callback, 0);
|
||||
//Key_KeydestCallback (sbar_keydest_callback, 0);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
sb_nums[0][i] = r_funcs->Draw_PicFromWad (va (0, "num_%i", i));
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
{
|
||||
switch (key) {
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
//case QFM_BUTTON1:
|
||||
[self next];
|
||||
return 1;
|
||||
default:
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
{
|
||||
switch (key) {
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
//case QFM_BUTTON1:
|
||||
[self toggle];
|
||||
return 1;
|
||||
default:
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
if (!ret) {
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
//case QFM_WHEEL_DOWN:
|
||||
[self next];
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
//case QFM_WHEEL_UP:
|
||||
[self prev];
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -47,11 +47,11 @@ menu_key_sound =
|
|||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
//case QFM_WHEEL_DOWN:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
break;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
//case QFM_WHEEL_UP:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
break;
|
||||
}
|
||||
|
@ -231,19 +231,19 @@ int (int key, int unicode, int down) load_quickbup_keyevent =
|
|||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
//case QFM_WHEEL_DOWN:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
load_cursor++;
|
||||
load_cursor %= MAX_QUICK;
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
//case QFM_WHEEL_UP:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
load_cursor += MAX_QUICK - 1;
|
||||
load_cursor %= MAX_QUICK;
|
||||
return 1;
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
//case QFM_BUTTON1:
|
||||
if (loadable[load_cursor]) {
|
||||
S_LocalSound ("misc/menu2.wav");
|
||||
Menu_SelectMenu (nil);
|
||||
|
@ -259,19 +259,19 @@ int (int key, int unicode, int down) load_keyevent =
|
|||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
//case QFM_WHEEL_DOWN:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
load_cursor++;
|
||||
load_cursor %= MAX_SAVEGAMES + 1;
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
//case QFM_WHEEL_UP:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
load_cursor += MAX_SAVEGAMES;
|
||||
load_cursor %= MAX_SAVEGAMES + 1;
|
||||
return 1;
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
//case QFM_BUTTON1:
|
||||
if (load_cursor == MAX_SAVEGAMES) {
|
||||
load_cursor = 0;
|
||||
scan_saves (1);
|
||||
|
@ -290,19 +290,19 @@ int (int key, int unicode, int down) save_keyevent =
|
|||
{
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
//case QFM_WHEEL_DOWN:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
save_cursor++;
|
||||
save_cursor %= MAX_SAVEGAMES;
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
//case QFM_WHEEL_UP:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
save_cursor += MAX_SAVEGAMES - 1;
|
||||
save_cursor %= MAX_SAVEGAMES;
|
||||
return 1;
|
||||
case QFK_RETURN:
|
||||
case QFM_BUTTON1:
|
||||
//case QFM_BUTTON1:
|
||||
Menu_SelectMenu (nil);
|
||||
Cbuf_AddText (sprintf ("save s%i.sav\n", save_cursor));
|
||||
return 1;
|
||||
|
@ -494,7 +494,7 @@ int (int key, int unicode, int down) lanconfig_keyevent =
|
|||
[input_active processInput:(key >= 256 ? key : unicode)];
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
//case QFM_WHEEL_DOWN:
|
||||
if (!input_active) {
|
||||
S_LocalSound ("misc/menu2.wav");
|
||||
lanConfig_cursor ++;
|
||||
|
@ -502,7 +502,7 @@ int (int key, int unicode, int down) lanconfig_keyevent =
|
|||
}
|
||||
return 1;
|
||||
case QFK_UP:
|
||||
case QFM_WHEEL_UP:
|
||||
//case QFM_WHEEL_UP:
|
||||
if (!input_active) {
|
||||
S_LocalSound ("misc/menu2.wav");
|
||||
lanConfig_cursor += NUM_LANCONFIG_CMDS - 1;
|
||||
|
|
|
@ -526,6 +526,7 @@ qwaq_input_event_handler (const IE_event_t *ie_event, void *_res)
|
|||
event.when = ie_event->when * 1e-6 + Sys_DoubleTimeBase ();
|
||||
|
||||
switch (ie_event->type) {
|
||||
case ie_event_count:
|
||||
case ie_none:
|
||||
case ie_gain_focus:
|
||||
case ie_lose_focus:
|
||||
|
|
|
@ -205,7 +205,7 @@ BI_Init (progs_t *pr)
|
|||
con_module->data->console->quit = quit_f;
|
||||
con_module->data->console->cbuf = qwaq_cbuf;
|
||||
}
|
||||
Key_SetKeyDest (key_game);
|
||||
//Key_SetKeyDest (key_game);
|
||||
|
||||
S_Init (0, &con_frametime);
|
||||
//CDAudio_Init ();
|
||||
|
|
Loading…
Reference in a new issue