mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Give fields in event_t better names
This commit is contained in:
parent
c2907b89f7
commit
5bc0ce7a62
16 changed files with 266 additions and 266 deletions
|
@ -458,7 +458,7 @@ boolean AM_Responder(event_t *ev)
|
|||
{
|
||||
if (!automapactive)
|
||||
{
|
||||
if (ev->type == ev_keydown && ev->data1 == AM_TOGGLEKEY)
|
||||
if (ev->type == ev_keydown && ev->key == AM_TOGGLEKEY)
|
||||
{
|
||||
//faB: prevent alt-tab in win32 version to activate automap just before
|
||||
// minimizing the app; doesn't do any harm to the DOS version
|
||||
|
@ -473,7 +473,7 @@ boolean AM_Responder(event_t *ev)
|
|||
else if (ev->type == ev_keydown)
|
||||
{
|
||||
rc = true;
|
||||
switch (ev->data1)
|
||||
switch (ev->key)
|
||||
{
|
||||
case AM_PANRIGHTKEY: // pan right
|
||||
if (!followplayer)
|
||||
|
@ -550,7 +550,7 @@ boolean AM_Responder(event_t *ev)
|
|||
else if (ev->type == ev_keyup)
|
||||
{
|
||||
rc = false;
|
||||
switch (ev->data1)
|
||||
switch (ev->key)
|
||||
{
|
||||
case AM_PANRIGHTKEY:
|
||||
if (!followplayer)
|
||||
|
|
|
@ -913,12 +913,12 @@ boolean CON_Responder(event_t *ev)
|
|||
// let go keyup events, don't eat them
|
||||
if (ev->type != ev_keydown && ev->type != ev_console)
|
||||
{
|
||||
if (ev->data1 == gamecontrol[gc_console][0] || ev->data1 == gamecontrol[gc_console][1])
|
||||
if (ev->key == gamecontrol[gc_console][0] || ev->key == gamecontrol[gc_console][1])
|
||||
consdown = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
key = ev->data1;
|
||||
key = ev->key;
|
||||
|
||||
// check for console toggle key
|
||||
if (ev->type != ev_console)
|
||||
|
|
|
@ -33,9 +33,9 @@ typedef enum
|
|||
typedef struct
|
||||
{
|
||||
evtype_t type;
|
||||
INT32 data1; // keys / mouse/joystick buttons
|
||||
INT32 data2; // mouse/joystick x move
|
||||
INT32 data3; // mouse/joystick y move
|
||||
INT32 key; // keys/mouse/joystick buttons
|
||||
INT32 x; // mouse/joystick x move
|
||||
INT32 y; // mouse/joystick y move
|
||||
boolean repeated; // key repeat
|
||||
} event_t;
|
||||
|
||||
|
|
14
src/d_main.c
14
src/d_main.c
|
@ -191,22 +191,22 @@ void D_ProcessEvents(void)
|
|||
if (ev->type == ev_keydown || ev->type == ev_keyup)
|
||||
{
|
||||
// Mouse buttons
|
||||
if ((UINT32)(ev->data1 - KEY_MOUSE1) < MOUSEBUTTONS)
|
||||
if ((UINT32)(ev->key - KEY_MOUSE1) < MOUSEBUTTONS)
|
||||
{
|
||||
if (ev->type == ev_keydown)
|
||||
mouse.buttons |= 1 << (ev->data1 - KEY_MOUSE1);
|
||||
mouse.buttons |= 1 << (ev->key - KEY_MOUSE1);
|
||||
else
|
||||
mouse.buttons &= ~(1 << (ev->data1 - KEY_MOUSE1));
|
||||
mouse.buttons &= ~(1 << (ev->key - KEY_MOUSE1));
|
||||
}
|
||||
else if ((UINT32)(ev->data1 - KEY_2MOUSE1) < MOUSEBUTTONS)
|
||||
else if ((UINT32)(ev->key - KEY_2MOUSE1) < MOUSEBUTTONS)
|
||||
{
|
||||
if (ev->type == ev_keydown)
|
||||
mouse2.buttons |= 1 << (ev->data1 - KEY_2MOUSE1);
|
||||
mouse2.buttons |= 1 << (ev->key - KEY_2MOUSE1);
|
||||
else
|
||||
mouse2.buttons &= ~(1 << (ev->data1 - KEY_2MOUSE1));
|
||||
mouse2.buttons &= ~(1 << (ev->key - KEY_2MOUSE1));
|
||||
}
|
||||
// Scroll (has no keyup event)
|
||||
else switch (ev->data1) {
|
||||
else switch (ev->key) {
|
||||
case KEY_MOUSEWHEELUP:
|
||||
mouse.buttons |= MB_SCROLLUP;
|
||||
break;
|
||||
|
|
|
@ -1011,7 +1011,7 @@ void F_IntroTicker(void)
|
|||
//
|
||||
boolean F_IntroResponder(event_t *event)
|
||||
{
|
||||
INT32 key = event->data1;
|
||||
INT32 key = event->key;
|
||||
|
||||
// remap virtual keys (mouse & joystick buttons)
|
||||
switch (key)
|
||||
|
@ -1397,7 +1397,7 @@ void F_CreditTicker(void)
|
|||
|
||||
boolean F_CreditResponder(event_t *event)
|
||||
{
|
||||
INT32 key = event->data1;
|
||||
INT32 key = event->key;
|
||||
|
||||
// remap virtual keys (mouse & joystick buttons)
|
||||
switch (key)
|
||||
|
@ -3821,7 +3821,7 @@ void F_ContinueTicker(void)
|
|||
|
||||
boolean F_ContinueResponder(event_t *event)
|
||||
{
|
||||
INT32 key = event->data1;
|
||||
INT32 key = event->key;
|
||||
|
||||
if (keypressed)
|
||||
return true;
|
||||
|
|
20
src/g_game.c
20
src/g_game.c
|
@ -1969,7 +1969,7 @@ boolean G_Responder(event_t *ev)
|
|||
if (gameaction == ga_nothing && !singledemo &&
|
||||
((demoplayback && !modeattacking && !titledemo) || gamestate == GS_TITLESCREEN))
|
||||
{
|
||||
if (ev->type == ev_keydown && ev->data1 != 301 && !(gamestate == GS_TITLESCREEN && finalecount < TICRATE))
|
||||
if (ev->type == ev_keydown && ev->key != 301 && !(gamestate == GS_TITLESCREEN && finalecount < TICRATE))
|
||||
{
|
||||
M_StartControlPanel();
|
||||
return true;
|
||||
|
@ -2045,7 +2045,7 @@ boolean G_Responder(event_t *ev)
|
|||
|
||||
// allow spy mode changes even during the demo
|
||||
if (gamestate == GS_LEVEL && ev->type == ev_keydown
|
||||
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
|
||||
&& (ev->key == KEY_F12 || ev->key == gamecontrol[gc_viewpoint][0] || ev->key == gamecontrol[gc_viewpoint][1]))
|
||||
{
|
||||
// ViewpointSwitch Lua hook.
|
||||
UINT8 canSwitchView = 0;
|
||||
|
@ -2118,13 +2118,13 @@ boolean G_Responder(event_t *ev)
|
|||
switch (ev->type)
|
||||
{
|
||||
case ev_keydown:
|
||||
if (ev->data1 == gamecontrol[gc_pause][0]
|
||||
|| ev->data1 == gamecontrol[gc_pause][1]
|
||||
|| ev->data1 == KEY_PAUSE)
|
||||
if (ev->key == gamecontrol[gc_pause][0]
|
||||
|| ev->key == gamecontrol[gc_pause][1]
|
||||
|| ev->key == KEY_PAUSE)
|
||||
{
|
||||
if (modeattacking && !demoplayback && (gamestate == GS_LEVEL))
|
||||
{
|
||||
pausebreakkey = (ev->data1 == KEY_PAUSE);
|
||||
pausebreakkey = (ev->key == KEY_PAUSE);
|
||||
if (menuactive || pausedelay < 0 || leveltime < 2)
|
||||
return true;
|
||||
|
||||
|
@ -2149,8 +2149,8 @@ boolean G_Responder(event_t *ev)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (ev->data1 == gamecontrol[gc_camtoggle][0]
|
||||
|| ev->data1 == gamecontrol[gc_camtoggle][1])
|
||||
if (ev->key == gamecontrol[gc_camtoggle][0]
|
||||
|| ev->key == gamecontrol[gc_camtoggle][1])
|
||||
{
|
||||
if (!camtoggledelay)
|
||||
{
|
||||
|
@ -2158,8 +2158,8 @@ boolean G_Responder(event_t *ev)
|
|||
CV_SetValue(&cv_chasecam, cv_chasecam.value ? 0 : 1);
|
||||
}
|
||||
}
|
||||
if (ev->data1 == gamecontrolbis[gc_camtoggle][0]
|
||||
|| ev->data1 == gamecontrolbis[gc_camtoggle][1])
|
||||
if (ev->key == gamecontrolbis[gc_camtoggle][0]
|
||||
|| ev->key == gamecontrolbis[gc_camtoggle][1])
|
||||
{
|
||||
if (!camtoggledelay2)
|
||||
{
|
||||
|
|
|
@ -115,54 +115,54 @@ void G_MapEventsToControls(event_t *ev)
|
|||
switch (ev->type)
|
||||
{
|
||||
case ev_keydown:
|
||||
if (ev->data1 < NUMINPUTS)
|
||||
gamekeydown[ev->data1] = 1;
|
||||
if (ev->key < NUMINPUTS)
|
||||
gamekeydown[ev->key] = 1;
|
||||
#ifdef PARANOIA
|
||||
else
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Bad downkey input %d\n",ev->data1);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Bad downkey input %d\n",ev->key);
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ev_keyup:
|
||||
if (ev->data1 < NUMINPUTS)
|
||||
gamekeydown[ev->data1] = 0;
|
||||
if (ev->key < NUMINPUTS)
|
||||
gamekeydown[ev->key] = 0;
|
||||
#ifdef PARANOIA
|
||||
else
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Bad upkey input %d\n",ev->data1);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Bad upkey input %d\n",ev->key);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ev_mouse: // buttons are virtual keys
|
||||
mouse.rdx = ev->data2;
|
||||
mouse.rdy = ev->data3;
|
||||
mouse.rdx = ev->x;
|
||||
mouse.rdy = ev->y;
|
||||
break;
|
||||
|
||||
case ev_joystick: // buttons are virtual keys
|
||||
i = ev->data1;
|
||||
i = ev->key;
|
||||
if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[i] = ev->data3;
|
||||
if (ev->x != INT32_MAX) joyxmove[i] = ev->x;
|
||||
if (ev->y != INT32_MAX) joyymove[i] = ev->y;
|
||||
break;
|
||||
|
||||
case ev_joystick2: // buttons are virtual keys
|
||||
i = ev->data1;
|
||||
i = ev->key;
|
||||
if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3;
|
||||
if (ev->x != INT32_MAX) joy2xmove[i] = ev->x;
|
||||
if (ev->y != INT32_MAX) joy2ymove[i] = ev->y;
|
||||
break;
|
||||
|
||||
case ev_mouse2: // buttons are virtual keys
|
||||
if (menuactive || CON_Ready() || chat_on)
|
||||
break;
|
||||
mouse2.rdx = ev->data2;
|
||||
mouse2.rdy = ev->data3;
|
||||
mouse2.rdx = ev->x;
|
||||
mouse2.rdy = ev->y;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1111,12 +1111,12 @@ boolean HU_Responder(event_t *ev)
|
|||
// (Unless if you're sharing a keyboard, since you probably establish when you start chatting that you have dibs on it...)
|
||||
// (Ahhh, the good ol days when I was a kid who couldn't afford an extra USB controller...)
|
||||
|
||||
if (ev->data1 >= KEY_MOUSE1)
|
||||
if (ev->key >= KEY_MOUSE1)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
{
|
||||
if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1)
|
||||
if (gamecontrol[i][0] == ev->key || gamecontrol[i][1] == ev->key)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1125,12 +1125,12 @@ boolean HU_Responder(event_t *ev)
|
|||
}*/ //We don't actually care about that unless we get splitscreen netgames. :V
|
||||
|
||||
#ifndef NONET
|
||||
c = (INT32)ev->data1;
|
||||
c = (INT32)ev->key;
|
||||
|
||||
if (!chat_on)
|
||||
{
|
||||
// enter chat mode
|
||||
if ((ev->data1 == gamecontrol[gc_talkkey][0] || ev->data1 == gamecontrol[gc_talkkey][1])
|
||||
if ((ev->key == gamecontrol[gc_talkkey][0] || ev->key == gamecontrol[gc_talkkey][1])
|
||||
&& netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
|
||||
{
|
||||
chat_on = true;
|
||||
|
@ -1140,7 +1140,7 @@ boolean HU_Responder(event_t *ev)
|
|||
typelines = 1;
|
||||
return true;
|
||||
}
|
||||
if ((ev->data1 == gamecontrol[gc_teamkey][0] || ev->data1 == gamecontrol[gc_teamkey][1])
|
||||
if ((ev->key == gamecontrol[gc_teamkey][0] || ev->key == gamecontrol[gc_teamkey][1])
|
||||
&& netgame && !OLD_MUTE)
|
||||
{
|
||||
chat_on = true;
|
||||
|
@ -1157,12 +1157,12 @@ boolean HU_Responder(event_t *ev)
|
|||
// Ignore modifier keys
|
||||
// Note that we do this here so users can still set
|
||||
// their chat keys to one of these, if they so desire.
|
||||
if (ev->data1 == KEY_LSHIFT || ev->data1 == KEY_RSHIFT
|
||||
|| ev->data1 == KEY_LCTRL || ev->data1 == KEY_RCTRL
|
||||
|| ev->data1 == KEY_LALT || ev->data1 == KEY_RALT)
|
||||
if (ev->key == KEY_LSHIFT || ev->key == KEY_RSHIFT
|
||||
|| ev->key == KEY_LCTRL || ev->key == KEY_RCTRL
|
||||
|| ev->key == KEY_LALT || ev->key == KEY_RALT)
|
||||
return true;
|
||||
|
||||
c = (INT32)ev->data1;
|
||||
c = (INT32)ev->key;
|
||||
|
||||
// I know this looks very messy but this works. If it ain't broke, don't fix it!
|
||||
// shift LETTERS to uppercase if we have capslock or are holding shift
|
||||
|
|
|
@ -184,9 +184,9 @@ static int keyevent_get(lua_State *L)
|
|||
I_Assert(event != NULL);
|
||||
|
||||
if (fastcmp(field,"name"))
|
||||
lua_pushstring(L, G_KeyNumToString(event->data1));
|
||||
lua_pushstring(L, G_KeyNumToString(event->key));
|
||||
else if (fastcmp(field,"num"))
|
||||
lua_pushinteger(L, event->data1);
|
||||
lua_pushinteger(L, event->key);
|
||||
else if (fastcmp(field,"repeated"))
|
||||
lua_pushboolean(L, event->repeated);
|
||||
else
|
||||
|
|
|
@ -203,11 +203,11 @@ boolean cht_Responder(event_t *ev)
|
|||
if (ev->type != ev_keydown)
|
||||
return false;
|
||||
|
||||
if (ev->data1 > 0xFF)
|
||||
if (ev->key > 0xFF)
|
||||
{
|
||||
// map some fake (joy) inputs into keys
|
||||
// map joy inputs into keys
|
||||
switch (ev->data1)
|
||||
switch (ev->key)
|
||||
{
|
||||
case KEY_JOY1:
|
||||
case KEY_JOY1 + 2:
|
||||
|
@ -231,7 +231,7 @@ boolean cht_Responder(event_t *ev)
|
|||
}
|
||||
}
|
||||
else
|
||||
ch = (UINT8)ev->data1;
|
||||
ch = (UINT8)ev->key;
|
||||
|
||||
ret += cht_CheckCheat(&cheat_ultimate, (char)ch);
|
||||
ret += cht_CheckCheat(&cheat_ultimate_joy, (char)ch);
|
||||
|
|
34
src/m_menu.c
34
src/m_menu.c
|
@ -3229,7 +3229,7 @@ boolean M_Responder(event_t *ev)
|
|||
if (ev->type == ev_keydown)
|
||||
{
|
||||
keydown++;
|
||||
ch = ev->data1;
|
||||
ch = ev->key;
|
||||
|
||||
// added 5-2-98 remap virtual keys (mouse & joystick buttons)
|
||||
switch (ch)
|
||||
|
@ -3262,44 +3262,44 @@ boolean M_Responder(event_t *ev)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime())
|
||||
else if (ev->type == ev_joystick && ev->key == 0 && joywait < I_GetTime())
|
||||
{
|
||||
const INT32 jdeadzone = (JOYAXISRANGE * cv_digitaldeadzone.value) / FRACUNIT;
|
||||
if (ev->data3 != INT32_MAX)
|
||||
if (ev->y != INT32_MAX)
|
||||
{
|
||||
if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone)
|
||||
if (Joystick.bGamepadStyle || abs(ev->y) > jdeadzone)
|
||||
{
|
||||
if (ev->data3 < 0 && pjoyy >= 0)
|
||||
if (ev->y < 0 && pjoyy >= 0)
|
||||
{
|
||||
ch = KEY_UPARROW;
|
||||
joywait = I_GetTime() + NEWTICRATE/7;
|
||||
}
|
||||
else if (ev->data3 > 0 && pjoyy <= 0)
|
||||
else if (ev->y > 0 && pjoyy <= 0)
|
||||
{
|
||||
ch = KEY_DOWNARROW;
|
||||
joywait = I_GetTime() + NEWTICRATE/7;
|
||||
}
|
||||
pjoyy = ev->data3;
|
||||
pjoyy = ev->y;
|
||||
}
|
||||
else
|
||||
pjoyy = 0;
|
||||
}
|
||||
|
||||
if (ev->data2 != INT32_MAX)
|
||||
if (ev->x != INT32_MAX)
|
||||
{
|
||||
if (Joystick.bGamepadStyle || abs(ev->data2) > jdeadzone)
|
||||
if (Joystick.bGamepadStyle || abs(ev->x) > jdeadzone)
|
||||
{
|
||||
if (ev->data2 < 0 && pjoyx >= 0)
|
||||
if (ev->x < 0 && pjoyx >= 0)
|
||||
{
|
||||
ch = KEY_LEFTARROW;
|
||||
joywait = I_GetTime() + NEWTICRATE/17;
|
||||
}
|
||||
else if (ev->data2 > 0 && pjoyx <= 0)
|
||||
else if (ev->x > 0 && pjoyx <= 0)
|
||||
{
|
||||
ch = KEY_RIGHTARROW;
|
||||
joywait = I_GetTime() + NEWTICRATE/17;
|
||||
}
|
||||
pjoyx = ev->data2;
|
||||
pjoyx = ev->x;
|
||||
}
|
||||
else
|
||||
pjoyx = 0;
|
||||
|
@ -3307,7 +3307,7 @@ boolean M_Responder(event_t *ev)
|
|||
}
|
||||
else if (ev->type == ev_mouse && mousewait < I_GetTime())
|
||||
{
|
||||
pmousey -= ev->data3;
|
||||
pmousey -= ev->y;
|
||||
if (pmousey < lasty-30)
|
||||
{
|
||||
ch = KEY_DOWNARROW;
|
||||
|
@ -3321,7 +3321,7 @@ boolean M_Responder(event_t *ev)
|
|||
pmousey = lasty += 30;
|
||||
}
|
||||
|
||||
pmousex += ev->data2;
|
||||
pmousex += ev->x;
|
||||
if (pmousex < lastx - 30)
|
||||
{
|
||||
ch = KEY_LEFTARROW;
|
||||
|
@ -3339,7 +3339,7 @@ boolean M_Responder(event_t *ev)
|
|||
keydown = 0;
|
||||
}
|
||||
else if (ev->type == ev_keydown) // Preserve event for other responders
|
||||
ch = ev->data1;
|
||||
ch = ev->key;
|
||||
|
||||
if (ch == -1)
|
||||
return false;
|
||||
|
@ -12859,7 +12859,7 @@ static void M_ChangecontrolResponse(event_t *ev)
|
|||
{
|
||||
INT32 control;
|
||||
INT32 found;
|
||||
INT32 ch = ev->data1;
|
||||
INT32 ch = ev->key;
|
||||
|
||||
// ESCAPE cancels; dummy out PAUSE
|
||||
if (ch != KEY_ESCAPE && ch != KEY_PAUSE)
|
||||
|
@ -12878,7 +12878,7 @@ static void M_ChangecontrolResponse(event_t *ev)
|
|||
// keypad arrows are converted for the menu in cursor arrows
|
||||
// so use the event instead of ch
|
||||
case ev_keydown:
|
||||
ch = ev->data1;
|
||||
ch = ev->key;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1631,7 +1631,7 @@ boolean M_ScreenshotResponder(event_t *ev)
|
|||
if (dedicated || ev->type != ev_keydown)
|
||||
return false;
|
||||
|
||||
ch = ev->data1;
|
||||
ch = ev->key;
|
||||
|
||||
if (ch >= KEY_MOUSE1 && menuactive) // If it's not a keyboard key, then don't allow it in the menus!
|
||||
return false;
|
||||
|
|
|
@ -572,7 +572,7 @@ void I_GetConsoleEvents(void)
|
|||
tty_con.buffer[tty_con.cursor] = '\0';
|
||||
tty_Back();
|
||||
}
|
||||
ev.data1 = KEY_BACKSPACE;
|
||||
ev.key = KEY_BACKSPACE;
|
||||
}
|
||||
else if (key < ' ') // check if this is a control char
|
||||
{
|
||||
|
@ -580,19 +580,19 @@ void I_GetConsoleEvents(void)
|
|||
{
|
||||
tty_Clear();
|
||||
tty_con.cursor = 0;
|
||||
ev.data1 = KEY_ENTER;
|
||||
ev.key = KEY_ENTER;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// push regular character
|
||||
ev.data1 = tty_con.buffer[tty_con.cursor] = key;
|
||||
ev.key = tty_con.buffer[tty_con.cursor] = key;
|
||||
tty_con.cursor++;
|
||||
// print the current line (this is differential)
|
||||
d = write(STDOUT_FILENO, &key, 1);
|
||||
}
|
||||
if (ev.data1) D_PostEvent(&ev);
|
||||
if (ev.key) D_PostEvent(&ev);
|
||||
//tty_FlushIn();
|
||||
(void)d;
|
||||
}
|
||||
|
@ -626,18 +626,18 @@ static void Impl_HandleKeyboardConsoleEvent(KEY_EVENT_RECORD evt, HANDLE co)
|
|||
{
|
||||
case VK_ESCAPE:
|
||||
case VK_TAB:
|
||||
event.data1 = KEY_NULL;
|
||||
event.key = KEY_NULL;
|
||||
break;
|
||||
case VK_RETURN:
|
||||
entering_con_command = false;
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
//event.data1 = MapVirtualKey(evt.wVirtualKeyCode,2); // convert in to char
|
||||
event.data1 = evt.uChar.AsciiChar;
|
||||
//event.key = MapVirtualKey(evt.wVirtualKeyCode,2); // convert in to char
|
||||
event.key = evt.uChar.AsciiChar;
|
||||
}
|
||||
if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t))
|
||||
{
|
||||
if (event.data1 && event.data1 != KEY_LSHIFT && event.data1 != KEY_RSHIFT)
|
||||
if (event.key && event.key != KEY_LSHIFT && event.key != KEY_RSHIFT)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
WriteConsole(co, &evt.uChar.UnicodeChar, 1, &t, NULL);
|
||||
|
@ -652,7 +652,7 @@ static void Impl_HandleKeyboardConsoleEvent(KEY_EVENT_RECORD evt, HANDLE co)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (event.data1) D_PostEvent(&event);
|
||||
if (event.key) D_PostEvent(&event);
|
||||
}
|
||||
|
||||
void I_GetConsoleEvents(void)
|
||||
|
@ -917,7 +917,7 @@ INT32 I_GetKey (void)
|
|||
ev = &events[eventtail];
|
||||
if (ev->type == ev_keydown || ev->type == ev_console)
|
||||
{
|
||||
rc = ev->data1;
|
||||
rc = ev->key;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -977,22 +977,22 @@ void I_ShutdownJoystick(void)
|
|||
INT32 i;
|
||||
event_t event;
|
||||
event.type=ev_keyup;
|
||||
event.data2 = 0;
|
||||
event.data3 = 0;
|
||||
event.x = 0;
|
||||
event.y = 0;
|
||||
|
||||
lastjoybuttons = lastjoyhats = 0;
|
||||
|
||||
// emulate the up of all joystick buttons
|
||||
for (i=0;i<JOYBUTTONS;i++)
|
||||
{
|
||||
event.data1=KEY_JOY1+i;
|
||||
event.key=KEY_JOY1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
// emulate the up of all joystick hats
|
||||
for (i=0;i<JOYHATS*4;i++)
|
||||
{
|
||||
event.data1=KEY_HAT1+i;
|
||||
event.key=KEY_HAT1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ void I_ShutdownJoystick(void)
|
|||
event.type = ev_joystick;
|
||||
for (i=0;i<JOYAXISSET; i++)
|
||||
{
|
||||
event.data1 = i;
|
||||
event.key = i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ void I_GetJoystickEvents(void)
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_JOY1 + i;
|
||||
event.key = KEY_JOY1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1080,7 +1080,7 @@ void I_GetJoystickEvents(void)
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_HAT1 + i;
|
||||
event.key = KEY_HAT1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1092,7 +1092,7 @@ void I_GetJoystickEvents(void)
|
|||
|
||||
for (i = JOYAXISSET - 1; i >= 0; i--)
|
||||
{
|
||||
event.data1 = i;
|
||||
event.key = i;
|
||||
if (i*2 + 1 <= JoyInfo.axises)
|
||||
axisx = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 0);
|
||||
else axisx = 0;
|
||||
|
@ -1110,15 +1110,15 @@ void I_GetJoystickEvents(void)
|
|||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (axisx < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (axisx > (JOYAXISRANGE/2))
|
||||
event.data2 = 1;
|
||||
else event.data2 = 0;
|
||||
event.x = 1;
|
||||
else event.x = 0;
|
||||
if (axisy < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (axisy > (JOYAXISRANGE/2))
|
||||
event.data3 = 1;
|
||||
else event.data3 = 0;
|
||||
event.y = 1;
|
||||
else event.y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1132,8 +1132,8 @@ void I_GetJoystickEvents(void)
|
|||
#endif
|
||||
|
||||
// analog control style , just send the raw data
|
||||
event.data2 = axisx; // x axis
|
||||
event.data3 = axisy; // y axis
|
||||
event.x = axisx; // x axis
|
||||
event.y = axisy; // y axis
|
||||
}
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
@ -1247,22 +1247,22 @@ void I_ShutdownJoystick2(void)
|
|||
INT32 i;
|
||||
event_t event;
|
||||
event.type = ev_keyup;
|
||||
event.data2 = 0;
|
||||
event.data3 = 0;
|
||||
event.x = 0;
|
||||
event.y = 0;
|
||||
|
||||
lastjoy2buttons = lastjoy2hats = 0;
|
||||
|
||||
// emulate the up of all joystick buttons
|
||||
for (i = 0; i < JOYBUTTONS; i++)
|
||||
{
|
||||
event.data1 = KEY_2JOY1 + i;
|
||||
event.key = KEY_2JOY1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
// emulate the up of all joystick hats
|
||||
for (i = 0; i < JOYHATS*4; i++)
|
||||
{
|
||||
event.data1 = KEY_2HAT1 + i;
|
||||
event.key = KEY_2HAT1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ void I_ShutdownJoystick2(void)
|
|||
event.type = ev_joystick2;
|
||||
for (i = 0; i < JOYAXISSET; i++)
|
||||
{
|
||||
event.data1 = i;
|
||||
event.key = i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ void I_GetJoystick2Events(void)
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2JOY1 + i;
|
||||
event.key = KEY_2JOY1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1352,7 +1352,7 @@ void I_GetJoystick2Events(void)
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2HAT1 + i;
|
||||
event.key = KEY_2HAT1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1364,7 +1364,7 @@ void I_GetJoystick2Events(void)
|
|||
|
||||
for (i = JOYAXISSET - 1; i >= 0; i--)
|
||||
{
|
||||
event.data1 = i;
|
||||
event.key = i;
|
||||
if (i*2 + 1 <= JoyInfo2.axises)
|
||||
axisx = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 0);
|
||||
else axisx = 0;
|
||||
|
@ -1380,17 +1380,17 @@ void I_GetJoystick2Events(void)
|
|||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (axisx < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (axisx > (JOYAXISRANGE/2))
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
else
|
||||
event.data2 = 0;
|
||||
event.x = 0;
|
||||
if (axisy < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (axisy > (JOYAXISRANGE/2))
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
else
|
||||
event.data3 = 0;
|
||||
event.y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1404,8 +1404,8 @@ void I_GetJoystick2Events(void)
|
|||
#endif
|
||||
|
||||
// analog control style , just send the raw data
|
||||
event.data2 = axisx; // x axis
|
||||
event.data3 = axisy; // y axis
|
||||
event.x = axisx; // x axis
|
||||
event.y = axisy; // y axis
|
||||
}
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
@ -1804,7 +1804,7 @@ void I_GetMouseEvents(void)
|
|||
if (!(button & (1<<j))) //keyup
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2MOUSE1+j;
|
||||
event.key = KEY_2MOUSE1+j;
|
||||
D_PostEvent(&event);
|
||||
om2b ^= 1 << j;
|
||||
}
|
||||
|
@ -1814,18 +1814,18 @@ void I_GetMouseEvents(void)
|
|||
if (button & (1<<j))
|
||||
{
|
||||
event.type = ev_keydown;
|
||||
event.data1 = KEY_2MOUSE1+j;
|
||||
event.key = KEY_2MOUSE1+j;
|
||||
D_PostEvent(&event);
|
||||
om2b ^= 1 << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
event.data2 = ((SINT8)mdata[1])+((SINT8)mdata[3]);
|
||||
event.data3 = ((SINT8)mdata[2])+((SINT8)mdata[4]);
|
||||
if (event.data2 && event.data3)
|
||||
event.x = ((SINT8)mdata[1])+((SINT8)mdata[3]);
|
||||
event.y = ((SINT8)mdata[2])+((SINT8)mdata[4]);
|
||||
if (event.x && event.y)
|
||||
{
|
||||
event.type = ev_mouse2;
|
||||
event.data1 = 0;
|
||||
event.key = 0;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1867,7 +1867,7 @@ static void I_ShutdownMouse2(void)
|
|||
for (i = 0; i < MOUSEBUTTONS; i++)
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2MOUSE1+i;
|
||||
event.key = KEY_2MOUSE1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -1958,7 +1958,7 @@ void I_GetMouseEvents(void)
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2MOUSE1+i;
|
||||
event.key = KEY_2MOUSE1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1966,10 +1966,10 @@ void I_GetMouseEvents(void)
|
|||
if (handlermouse2x != 0 || handlermouse2y != 0)
|
||||
{
|
||||
event.type = ev_mouse2;
|
||||
event.data1 = 0;
|
||||
// event.data1 = buttons; // not needed
|
||||
event.data2 = handlermouse2x << 1;
|
||||
event.data3 = handlermouse2y << 1;
|
||||
event.key = 0;
|
||||
// event.key = buttons; // not needed
|
||||
event.x = handlermouse2x << 1;
|
||||
event.y = handlermouse2y << 1;
|
||||
handlermouse2x = 0;
|
||||
handlermouse2y = 0;
|
||||
|
||||
|
|
|
@ -663,9 +663,9 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
|
|||
{
|
||||
return;
|
||||
}
|
||||
event.data1 = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode);
|
||||
event.key = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode);
|
||||
event.repeated = (evt.repeat != 0);
|
||||
if (event.data1) D_PostEvent(&event);
|
||||
if (event.key) D_PostEvent(&event);
|
||||
}
|
||||
|
||||
static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
||||
|
@ -743,15 +743,15 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
|
|||
}
|
||||
else return;
|
||||
if (evt.button == SDL_BUTTON_MIDDLE)
|
||||
event.data1 = KEY_MOUSE1+2;
|
||||
event.key = KEY_MOUSE1+2;
|
||||
else if (evt.button == SDL_BUTTON_RIGHT)
|
||||
event.data1 = KEY_MOUSE1+1;
|
||||
event.key = KEY_MOUSE1+1;
|
||||
else if (evt.button == SDL_BUTTON_LEFT)
|
||||
event.data1 = KEY_MOUSE1;
|
||||
event.key = KEY_MOUSE1;
|
||||
else if (evt.button == SDL_BUTTON_X1)
|
||||
event.data1 = KEY_MOUSE1+3;
|
||||
event.key = KEY_MOUSE1+3;
|
||||
else if (evt.button == SDL_BUTTON_X2)
|
||||
event.data1 = KEY_MOUSE1+4;
|
||||
event.key = KEY_MOUSE1+4;
|
||||
if (event.type == ev_keyup || event.type == ev_keydown)
|
||||
{
|
||||
D_PostEvent(&event);
|
||||
|
@ -767,17 +767,17 @@ static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt)
|
|||
|
||||
if (evt.y > 0)
|
||||
{
|
||||
event.data1 = KEY_MOUSEWHEELUP;
|
||||
event.key = KEY_MOUSEWHEELUP;
|
||||
event.type = ev_keydown;
|
||||
}
|
||||
if (evt.y < 0)
|
||||
{
|
||||
event.data1 = KEY_MOUSEWHEELDOWN;
|
||||
event.key = KEY_MOUSEWHEELDOWN;
|
||||
event.type = ev_keydown;
|
||||
}
|
||||
if (evt.y == 0)
|
||||
{
|
||||
event.data1 = 0;
|
||||
event.key = 0;
|
||||
event.type = ev_keyup;
|
||||
}
|
||||
if (event.type == ev_keyup || event.type == ev_keydown)
|
||||
|
@ -796,7 +796,7 @@ static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt)
|
|||
joyid[1] = SDL_JoystickInstanceID(JoyInfo2.dev);
|
||||
|
||||
evt.axis++;
|
||||
event.data1 = event.data2 = event.data3 = INT32_MAX;
|
||||
event.key = event.x = event.y = INT32_MAX;
|
||||
|
||||
if (evt.which == joyid[0])
|
||||
{
|
||||
|
@ -813,14 +813,14 @@ static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt)
|
|||
//vaule
|
||||
if (evt.axis%2)
|
||||
{
|
||||
event.data1 = evt.axis / 2;
|
||||
event.data2 = SDLJoyAxis(evt.value, event.type);
|
||||
event.key = evt.axis / 2;
|
||||
event.x = SDLJoyAxis(evt.value, event.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
evt.axis--;
|
||||
event.data1 = evt.axis / 2;
|
||||
event.data3 = SDLJoyAxis(evt.value, event.type);
|
||||
event.key = evt.axis / 2;
|
||||
event.y = SDLJoyAxis(evt.value, event.type);
|
||||
}
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
@ -840,11 +840,11 @@ static void Impl_HandleJoystickHatEvent(SDL_JoyHatEvent evt)
|
|||
|
||||
if (evt.which == joyid[0])
|
||||
{
|
||||
event.data1 = KEY_HAT1 + (evt.hat*4);
|
||||
event.key = KEY_HAT1 + (evt.hat*4);
|
||||
}
|
||||
else if (evt.which == joyid[1])
|
||||
{
|
||||
event.data1 = KEY_2HAT1 + (evt.hat*4);
|
||||
event.key = KEY_2HAT1 + (evt.hat*4);
|
||||
}
|
||||
else return;
|
||||
|
||||
|
@ -863,11 +863,11 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
|
|||
|
||||
if (evt.which == joyid[0])
|
||||
{
|
||||
event.data1 = KEY_JOY1;
|
||||
event.key = KEY_JOY1;
|
||||
}
|
||||
else if (evt.which == joyid[1])
|
||||
{
|
||||
event.data1 = KEY_2JOY1;
|
||||
event.key = KEY_2JOY1;
|
||||
}
|
||||
else return;
|
||||
if (type == SDL_JOYBUTTONUP)
|
||||
|
@ -881,7 +881,7 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
|
|||
else return;
|
||||
if (evt.button < JOYBUTTONS)
|
||||
{
|
||||
event.data1 += evt.button;
|
||||
event.key += evt.button;
|
||||
}
|
||||
else return;
|
||||
|
||||
|
@ -1085,9 +1085,9 @@ void I_GetEvent(void)
|
|||
SDL_GetWindowSize(window, &wwidth, &wheight);
|
||||
//SDL_memset(&event, 0, sizeof(event_t));
|
||||
event.type = ev_mouse;
|
||||
event.data1 = 0;
|
||||
event.data2 = (INT32)lround(mousemovex * ((float)wwidth / (float)realwidth));
|
||||
event.data3 = (INT32)lround(mousemovey * ((float)wheight / (float)realheight));
|
||||
event.key = 0;
|
||||
event.x = (INT32)lround(mousemovex * ((float)wwidth / (float)realwidth));
|
||||
event.y = (INT32)lround(mousemovey * ((float)wheight / (float)realheight));
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,11 +188,11 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
ev.type = ev_keydown;
|
||||
|
||||
handleKeyDoom:
|
||||
ev.data1 = 0;
|
||||
ev.key = 0;
|
||||
if (wParam == VK_PAUSE)
|
||||
// intercept PAUSE key
|
||||
{
|
||||
ev.data1 = KEY_PAUSE;
|
||||
ev.key = KEY_PAUSE;
|
||||
}
|
||||
else if (!keyboard_started)
|
||||
// post some keys during the game startup
|
||||
|
@ -201,14 +201,14 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_ESCAPE: ev.data1 = KEY_ESCAPE; break;
|
||||
case VK_RETURN: ev.data1 = KEY_ENTER; break;
|
||||
case VK_SHIFT: ev.data1 = KEY_LSHIFT; break;
|
||||
default: ev.data1 = MapVirtualKey((DWORD)wParam,2); // convert in to char
|
||||
case VK_ESCAPE: ev.key = KEY_ESCAPE; break;
|
||||
case VK_RETURN: ev.key = KEY_ENTER; break;
|
||||
case VK_SHIFT: ev.key = KEY_LSHIFT; break;
|
||||
default: ev.key = MapVirtualKey((DWORD)wParam,2); // convert in to char
|
||||
}
|
||||
}
|
||||
|
||||
if (ev.data1)
|
||||
if (ev.key)
|
||||
D_PostEvent (&ev);
|
||||
|
||||
return 0;
|
||||
|
@ -240,7 +240,7 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
if (nodinput)
|
||||
{
|
||||
ev.type = ev_keyup;
|
||||
ev.data1 = KEY_MOUSE1 + 3 + HIWORD(wParam);
|
||||
ev.key = KEY_MOUSE1 + 3 + HIWORD(wParam);
|
||||
D_PostEvent(&ev);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
if (nodinput)
|
||||
{
|
||||
ev.type = ev_keydown;
|
||||
ev.data1 = KEY_MOUSE1 + 3 + HIWORD(wParam);
|
||||
ev.key = KEY_MOUSE1 + 3 + HIWORD(wParam);
|
||||
D_PostEvent(&ev);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -258,9 +258,9 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
//I_OutputMsg("MW_WHEEL dispatched.\n");
|
||||
ev.type = ev_keydown;
|
||||
if ((INT16)HIWORD(wParam) > 0)
|
||||
ev.data1 = KEY_MOUSEWHEELUP;
|
||||
ev.key = KEY_MOUSEWHEELUP;
|
||||
else
|
||||
ev.data1 = KEY_MOUSEWHEELDOWN;
|
||||
ev.key = KEY_MOUSEWHEELDOWN;
|
||||
D_PostEvent(&ev);
|
||||
break;
|
||||
|
||||
|
@ -271,7 +271,7 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0); //to quit while in-game
|
||||
ev.data1 = KEY_ESCAPE; //to exit network synchronization
|
||||
ev.key = KEY_ESCAPE; //to exit network synchronization
|
||||
ev.type = ev_keydown;
|
||||
D_PostEvent (&ev);
|
||||
return 0;
|
||||
|
|
|
@ -322,20 +322,20 @@ static inline VOID I_GetConsoleEvents(VOID)
|
|||
{
|
||||
case VK_ESCAPE:
|
||||
case VK_TAB:
|
||||
ev.data1 = KEY_NULL;
|
||||
ev.key = KEY_NULL;
|
||||
break;
|
||||
case VK_SHIFT:
|
||||
ev.data1 = KEY_LSHIFT;
|
||||
ev.key = KEY_LSHIFT;
|
||||
break;
|
||||
case VK_RETURN:
|
||||
entering_con_command = false;
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
ev.data1 = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char
|
||||
ev.key = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char
|
||||
}
|
||||
if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t))
|
||||
{
|
||||
if (ev.data1 && ev.data1 != KEY_LSHIFT && ev.data1 != KEY_RSHIFT)
|
||||
if (ev.key && ev.key != KEY_LSHIFT && ev.key != KEY_RSHIFT)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL);
|
||||
|
@ -356,13 +356,13 @@ static inline VOID I_GetConsoleEvents(VOID)
|
|||
switch (input.Event.KeyEvent.wVirtualKeyCode)
|
||||
{
|
||||
case VK_SHIFT:
|
||||
ev.data1 = KEY_LSHIFT;
|
||||
ev.key = KEY_LSHIFT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ev.data1) D_PostEvent(&ev);
|
||||
if (ev.key) D_PostEvent(&ev);
|
||||
break;
|
||||
case MOUSE_EVENT:
|
||||
case WINDOW_BUFFER_SIZE_EVENT:
|
||||
|
@ -945,7 +945,7 @@ static void I_ShutdownMouse2(VOID)
|
|||
for (i = 0; i < MOUSEBUTTONS; i++)
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2MOUSE1 + i;
|
||||
event.key = KEY_2MOUSE1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -1135,14 +1135,14 @@ VOID I_GetSysMouseEvents(INT mouse_state)
|
|||
if ((mouse_state & (1 << i)) && !(old_mouse_state & (1 << i)))
|
||||
{
|
||||
event.type = ev_keydown;
|
||||
event.data1 = KEY_MOUSE1 + i;
|
||||
event.key = KEY_MOUSE1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
// check if button released
|
||||
if (!(mouse_state & (1 << i)) && (old_mouse_state & (1 << i)))
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_MOUSE1 + i;
|
||||
event.key = KEY_MOUSE1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1156,9 +1156,9 @@ VOID I_GetSysMouseEvents(INT mouse_state)
|
|||
if (xmickeys || ymickeys)
|
||||
{
|
||||
event.type = ev_mouse;
|
||||
event.data1 = 0;
|
||||
event.data2 = xmickeys;
|
||||
event.data3 = -ymickeys;
|
||||
event.key = 0;
|
||||
event.x = xmickeys;
|
||||
event.y = -ymickeys;
|
||||
D_PostEvent(&event);
|
||||
SetCursorPos(center_x, center_y);
|
||||
}
|
||||
|
@ -1240,7 +1240,7 @@ static void I_ShutdownMouse(void)
|
|||
for (i = 0; i < MOUSEBUTTONS; i++)
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_MOUSE1 + i;
|
||||
event.key = KEY_MOUSE1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
if (nodinput)
|
||||
|
@ -1281,7 +1281,7 @@ void I_GetMouseEvents(void)
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2MOUSE1 + i;
|
||||
event.key = KEY_2MOUSE1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -1289,9 +1289,9 @@ void I_GetMouseEvents(void)
|
|||
if (handlermouse2x || handlermouse2y)
|
||||
{
|
||||
event.type = ev_mouse2;
|
||||
event.data1 = 0;
|
||||
event.data2 = handlermouse2x<<1;
|
||||
event.data3 = -handlermouse2y<<1;
|
||||
event.key = 0;
|
||||
event.x = handlermouse2x<<1;
|
||||
event.y = -handlermouse2y<<1;
|
||||
handlermouse2x = 0;
|
||||
handlermouse2y = 0;
|
||||
|
||||
|
@ -1330,7 +1330,7 @@ getBufferedData:
|
|||
else
|
||||
event.type = ev_keyup; // Button up
|
||||
|
||||
event.data1 = rgdod[d].dwOfs - DIMOFS_BUTTON0 + KEY_MOUSE1;
|
||||
event.key = rgdod[d].dwOfs - DIMOFS_BUTTON0 + KEY_MOUSE1;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
else if (rgdod[d].dwOfs == DIMOFS_X)
|
||||
|
@ -1342,9 +1342,9 @@ getBufferedData:
|
|||
{
|
||||
// z-axes the wheel
|
||||
if ((int)rgdod[d].dwData > 0)
|
||||
event.data1 = KEY_MOUSEWHEELUP;
|
||||
event.key = KEY_MOUSEWHEELUP;
|
||||
else
|
||||
event.data1 = KEY_MOUSEWHEELDOWN;
|
||||
event.key = KEY_MOUSEWHEELDOWN;
|
||||
event.type = ev_keydown;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
@ -1354,9 +1354,9 @@ getBufferedData:
|
|||
if (xmickeys || ymickeys)
|
||||
{
|
||||
event.type = ev_mouse;
|
||||
event.data1 = 0;
|
||||
event.data2 = xmickeys;
|
||||
event.data3 = -ymickeys;
|
||||
event.key = 0;
|
||||
event.x = xmickeys;
|
||||
event.y = -ymickeys;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -2395,14 +2395,14 @@ static VOID I_ShutdownJoystick(VOID)
|
|||
// emulate the up of all joystick buttons
|
||||
for (i = 0;i < JOYBUTTONS;i++)
|
||||
{
|
||||
event.data1 = KEY_JOY1+i;
|
||||
event.key = KEY_JOY1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
// emulate the up of all joystick hats
|
||||
for (i = 0;i < JOYHATS*4;i++)
|
||||
{
|
||||
event.data1 = KEY_HAT1+i;
|
||||
event.key = KEY_HAT1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -2410,7 +2410,7 @@ static VOID I_ShutdownJoystick(VOID)
|
|||
event.type = ev_joystick;
|
||||
for (i = 0;i < JOYAXISSET; i++)
|
||||
{
|
||||
event.data1 = i;
|
||||
event.key = i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -2460,14 +2460,14 @@ static VOID I_ShutdownJoystick2(VOID)
|
|||
// emulate the up of all joystick buttons
|
||||
for (i = 0;i < JOYBUTTONS;i++)
|
||||
{
|
||||
event.data1 = KEY_2JOY1+i;
|
||||
event.key = KEY_2JOY1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
// emulate the up of all joystick hats
|
||||
for (i = 0;i < JOYHATS*4;i++)
|
||||
{
|
||||
event.data1 = KEY_2HAT1+i;
|
||||
event.key = KEY_2HAT1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -2475,7 +2475,7 @@ static VOID I_ShutdownJoystick2(VOID)
|
|||
event.type = ev_joystick2;
|
||||
for (i = 0;i < JOYAXISSET; i++)
|
||||
{
|
||||
event.data1 = i;
|
||||
event.key = i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
@ -2598,7 +2598,7 @@ acquire:
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_JOY1 + i;
|
||||
event.key = KEY_JOY1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -2618,7 +2618,7 @@ acquire:
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_HAT1 + i;
|
||||
event.key = KEY_HAT1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -2627,7 +2627,7 @@ acquire:
|
|||
|
||||
// send joystick axis positions
|
||||
event.type = ev_joystick;
|
||||
event.data1 = event.data2 = event.data3 = 0;
|
||||
event.key = event.x = event.y = 0;
|
||||
|
||||
if (Joystick.bGamepadStyle)
|
||||
{
|
||||
|
@ -2635,29 +2635,29 @@ acquire:
|
|||
if (JoyInfo.X)
|
||||
{
|
||||
if (js.lX < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.lX > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo.Y)
|
||||
{
|
||||
if (js.lY < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.lY > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo.X) event.data2 = js.lX; // x axis
|
||||
if (JoyInfo.Y) event.data3 = js.lY; // y axis
|
||||
if (JoyInfo.X) event.x = js.lX; // x axis
|
||||
if (JoyInfo.Y) event.y = js.lY; // y axis
|
||||
}
|
||||
|
||||
D_PostEvent(&event);
|
||||
#if JOYAXISSET > 1
|
||||
event.data1 = 1;
|
||||
event.data2 = event.data3 = 0;
|
||||
event.key = 1;
|
||||
event.x = event.y = 0;
|
||||
|
||||
if (Joystick.bGamepadStyle)
|
||||
{
|
||||
|
@ -2665,30 +2665,30 @@ acquire:
|
|||
if (JoyInfo.Z)
|
||||
{
|
||||
if (js.lZ < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.lZ > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo.Rx)
|
||||
{
|
||||
if (js.lRx < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.lRx > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo.Z) event.data2 = js.lZ; // z axis
|
||||
if (JoyInfo.Rx) event.data3 = js.lRx; // rx axis
|
||||
if (JoyInfo.Z) event.x = js.lZ; // z axis
|
||||
if (JoyInfo.Rx) event.y = js.lRx; // rx axis
|
||||
}
|
||||
|
||||
D_PostEvent(&event);
|
||||
#endif
|
||||
#if JOYAXISSET > 2
|
||||
event.data1 = 2;
|
||||
event.data2 = event.data3 = 0;
|
||||
event.key = 2;
|
||||
event.x = event.y = 0;
|
||||
|
||||
if (Joystick.bGamepadStyle)
|
||||
{
|
||||
|
@ -2696,53 +2696,53 @@ acquire:
|
|||
if (JoyInfo.Rx)
|
||||
{
|
||||
if (js.lRy < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.lRy > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo.Rz)
|
||||
{
|
||||
if (js.lRz < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.lRz > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo.Ry) event.data2 = js.lRy; // ry axis
|
||||
if (JoyInfo.Rz) event.data3 = js.lRz; // rz axis
|
||||
if (JoyInfo.Ry) event.x = js.lRy; // ry axis
|
||||
if (JoyInfo.Rz) event.y = js.lRz; // rz axis
|
||||
}
|
||||
|
||||
D_PostEvent(&event);
|
||||
#endif
|
||||
#if JOYAXISSET > 3
|
||||
event.data1 = 3;
|
||||
event.data2 = event.data3 = 0;
|
||||
event.key = 3;
|
||||
event.x = event.y = 0;
|
||||
if (Joystick.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (JoyInfo.U)
|
||||
{
|
||||
if (js.rglSlider[0] < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.rglSlider[0] > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo.V)
|
||||
{
|
||||
if (js.rglSlider[1] < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.rglSlider[1] > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo.U) event.data2 = js.rglSlider[0]; // U axis
|
||||
if (JoyInfo.V) event.data3 = js.rglSlider[1]; // V axis
|
||||
if (JoyInfo.U) event.x = js.rglSlider[0]; // U axis
|
||||
if (JoyInfo.V) event.y = js.rglSlider[1]; // V axis
|
||||
}
|
||||
D_PostEvent(&event);
|
||||
#endif
|
||||
|
@ -2842,7 +2842,7 @@ acquire:
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2JOY1 + i;
|
||||
event.key = KEY_2JOY1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -2862,7 +2862,7 @@ acquire:
|
|||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_2HAT1 + i;
|
||||
event.key = KEY_2HAT1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
@ -2871,7 +2871,7 @@ acquire:
|
|||
|
||||
// send joystick axis positions
|
||||
event.type = ev_joystick2;
|
||||
event.data1 = event.data2 = event.data3 = 0;
|
||||
event.key = event.x = event.y = 0;
|
||||
|
||||
if (Joystick2.bGamepadStyle)
|
||||
{
|
||||
|
@ -2879,29 +2879,29 @@ acquire:
|
|||
if (JoyInfo2.X)
|
||||
{
|
||||
if (js.lX < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.lX > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo2.Y)
|
||||
{
|
||||
if (js.lY < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.lY > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo2.X) event.data2 = js.lX; // x axis
|
||||
if (JoyInfo2.Y) event.data3 = js.lY; // y axis
|
||||
if (JoyInfo2.X) event.x = js.lX; // x axis
|
||||
if (JoyInfo2.Y) event.y = js.lY; // y axis
|
||||
}
|
||||
|
||||
D_PostEvent(&event);
|
||||
#if JOYAXISSET > 1
|
||||
event.data1 = 1;
|
||||
event.data2 = event.data3 = 0;
|
||||
event.key = 1;
|
||||
event.x = event.y = 0;
|
||||
|
||||
if (Joystick2.bGamepadStyle)
|
||||
{
|
||||
|
@ -2909,30 +2909,30 @@ acquire:
|
|||
if (JoyInfo2.Z)
|
||||
{
|
||||
if (js.lZ < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.lZ > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo2.Rx)
|
||||
{
|
||||
if (js.lRx < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.lRx > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo2.Z) event.data2 = js.lZ; // z axis
|
||||
if (JoyInfo2.Rx) event.data3 = js.lRx; // rx axis
|
||||
if (JoyInfo2.Z) event.x = js.lZ; // z axis
|
||||
if (JoyInfo2.Rx) event.y = js.lRx; // rx axis
|
||||
}
|
||||
|
||||
D_PostEvent(&event);
|
||||
#endif
|
||||
#if JOYAXISSET > 2
|
||||
event.data1 = 2;
|
||||
event.data2 = event.data3 = 0;
|
||||
event.key = 2;
|
||||
event.x = event.y = 0;
|
||||
|
||||
if (Joystick2.bGamepadStyle)
|
||||
{
|
||||
|
@ -2940,53 +2940,53 @@ acquire:
|
|||
if (JoyInfo2.Rx)
|
||||
{
|
||||
if (js.lRy < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.lRy > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo2.Rz)
|
||||
{
|
||||
if (js.lRz < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.lRz > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo2.Ry) event.data2 = js.lRy; // ry axis
|
||||
if (JoyInfo2.Rz) event.data3 = js.lRz; // rz axis
|
||||
if (JoyInfo2.Ry) event.x = js.lRy; // ry axis
|
||||
if (JoyInfo2.Rz) event.y = js.lRz; // rz axis
|
||||
}
|
||||
|
||||
D_PostEvent(&event);
|
||||
#endif
|
||||
#if JOYAXISSET > 3
|
||||
event.data1 = 3;
|
||||
event.data2 = event.data3 = 0;
|
||||
event.key = 3;
|
||||
event.x = event.y = 0;
|
||||
if (Joystick2.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (JoyInfo2.U)
|
||||
{
|
||||
if (js.rglSlider[0] < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
event.x = -1;
|
||||
else if (js.rglSlider[0] > JOYAXISRANGE/2)
|
||||
event.data2 = 1;
|
||||
event.x = 1;
|
||||
}
|
||||
if (JoyInfo2.V)
|
||||
{
|
||||
if (js.rglSlider[1] < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
event.y = -1;
|
||||
else if (js.rglSlider[1] > JOYAXISRANGE/2)
|
||||
event.data3 = 1;
|
||||
event.y = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// analog control style, just send the raw data
|
||||
if (JoyInfo2.U) event.data2 = js.rglSlider[0]; // U axis
|
||||
if (JoyInfo2.V) event.data3 = js.rglSlider[1]; // V axis
|
||||
if (JoyInfo2.U) event.x = js.rglSlider[0]; // U axis
|
||||
if (JoyInfo2.V) event.y = js.rglSlider[1]; // V axis
|
||||
}
|
||||
D_PostEvent(&event);
|
||||
#endif
|
||||
|
@ -3194,7 +3194,7 @@ INT32 I_GetKey(void)
|
|||
ev = &events[eventtail];
|
||||
eventtail = (eventtail+1) & (MAXEVENTS-1);
|
||||
if (ev->type == ev_keydown || ev->type == ev_console)
|
||||
return ev->data1;
|
||||
return ev->key;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
@ -3308,7 +3308,7 @@ static VOID I_GetKeyboardEvents(VOID)
|
|||
if (!appActive && RepeatKeyCode) // Stop when lost focus
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
event.data1 = RepeatKeyCode;
|
||||
event.key = RepeatKeyCode;
|
||||
D_PostEvent(&event);
|
||||
RepeatKeyCode = 0;
|
||||
}
|
||||
|
@ -3363,9 +3363,9 @@ getBufferedData:
|
|||
|
||||
ch = rgdod[d].dwOfs & 0xFF;
|
||||
if (ASCIINames[ch])
|
||||
event.data1 = ASCIINames[ch];
|
||||
event.key = ASCIINames[ch];
|
||||
else
|
||||
event.data1 = 0x80;
|
||||
event.key = 0x80;
|
||||
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
@ -3378,7 +3378,7 @@ getBufferedData:
|
|||
// delay is tripled for first repeating key
|
||||
RepeatKeyTics = hacktics + (KEY_REPEAT_DELAY*3);
|
||||
if (event.type == ev_keydown) // use the last event!
|
||||
RepeatKeyCode = event.data1;
|
||||
RepeatKeyCode = event.key;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3386,7 +3386,7 @@ getBufferedData:
|
|||
if (RepeatKeyCode && hacktics - RepeatKeyTics > KEY_REPEAT_DELAY)
|
||||
{
|
||||
event.type = ev_keydown;
|
||||
event.data1 = RepeatKeyCode;
|
||||
event.key = RepeatKeyCode;
|
||||
D_PostEvent(&event);
|
||||
|
||||
RepeatKeyTics = hacktics;
|
||||
|
|
Loading…
Reference in a new issue