- replaced KEY_PRESSED globally

This was just a redundant name getting in the way.
This commit is contained in:
Christoph Oelckers 2019-10-28 07:01:01 +01:00
parent 065721c62b
commit c589a6ab82
11 changed files with 104 additions and 111 deletions

View file

@ -232,11 +232,6 @@ inline bool KB_UnBoundKeyPressed(int scan)
return (inputState.GetKeyStatus(scan) != 0 && !CONTROL_KeyBinds[scan].cmdstr); return (inputState.GetKeyStatus(scan) != 0 && !CONTROL_KeyBinds[scan].cmdstr);
} }
inline uint8_t KEY_PRESSED(int scan) // Shadow Warrior uses different names for many things.
{
return inputState.GetKeyStatus(scan);
}
inline void KB_ClearKeysDown(void) inline void KB_ClearKeysDown(void)
{ {
KB_LastScan = 0; KB_LastScan = 0;

View file

@ -333,7 +333,7 @@ playanm(short anim_num)
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;
break; break;
case ANIM_SERP: case ANIM_SERP:
if (KEY_PRESSED(KEYSC_ESC) || uinfo.button1 || quitevent) if (KB_KeyPressed(KEYSC_ESC) || uinfo.button1 || quitevent)
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;
break; break;
} }

View file

@ -399,9 +399,9 @@ void CheatInput(void)
if (!CheatInputMode) if (!CheatInputMode)
{ {
if (KEY_PRESSED(KEYSC_S)) if (KB_KeyPressed(KEYSC_S))
{ {
//KEY_PRESSED(KEYSC_S) = FALSE; //KB_KeyPressed(KEYSC_S) = FALSE;
CheatInputMode = TRUE; CheatInputMode = TRUE;
strcpy(CheatInputString,"s"); strcpy(CheatInputString,"s");
} }

View file

@ -457,23 +457,23 @@ DemoPlayBack(void)
// fast forward and slow mo // fast forward and slow mo
if (DemoEdit) if (DemoEdit)
{ {
if (KEY_PRESSED(KEYSC_F)) if (KB_KeyPressed(KEYSC_F))
{ {
if (KEY_PRESSED(KEYSC_LSHIFT) || KEY_PRESSED(KEYSC_RSHIFT)) if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
totalclock += synctics; totalclock += synctics;
else else
totalclock += synctics-1; totalclock += synctics-1;
} }
if (KEY_PRESSED(KEYSC_S)) if (KB_KeyPressed(KEYSC_S))
totalclock += 1-synctics; totalclock += 1-synctics;
} }
else else
{ {
#if DEBUG #if DEBUG
if (KEY_PRESSED(KEYSC_ALT) && KEY_PRESSED(KEYSC_CTRL) && KEY_PRESSED(KEYSC_S)) if (KB_KeyPressed(KEYSC_ALT) && KB_KeyPressed(KEYSC_CTRL) && KB_KeyPressed(KEYSC_S))
{ {
KEY_PRESSED(KEYSC_ALT) = KEY_PRESSED(KEYSC_CTRL) = KEY_PRESSED(KEYSC_S) = 0; KB_KeyPressed(KEYSC_ALT) = KB_KeyPressed(KEYSC_CTRL) = KB_KeyPressed(KEYSC_S) = 0;
saveboard("demosave.map", (vec3_t *)Player, &Player->pang, &Player->cursectnum); saveboard("demosave.map", (vec3_t *)Player, &Player->pang, &Player->cursectnum);
} }
#endif #endif
@ -489,15 +489,15 @@ DemoPlayBack(void)
} }
#if DEBUG #if DEBUG
if (KEY_PRESSED(KEYSC_RIGHT) || KEY_PRESSED(KEYSC_UP)) if (KB_KeyPressed(KEYSC_RIGHT) || KB_KeyPressed(KEYSC_UP))
{ {
if (KEY_PRESSED(KEYSC_LSHIFT) || KEY_PRESSED(KEYSC_RSHIFT)) if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
totalclock += synctics; totalclock += synctics;
else else
totalclock += synctics-1; totalclock += synctics-1;
} }
if (KEY_PRESSED(KEYSC_LEFT) || KEY_PRESSED(KEYSC_DOWN)) if (KB_KeyPressed(KEYSC_LEFT) || KB_KeyPressed(KEYSC_DOWN))
totalclock += 1-synctics; totalclock += 1-synctics;
#endif #endif
} }

View file

@ -1044,17 +1044,17 @@ ResizeView(PLAYERp pp)
if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6) if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6)
{ {
if (KEY_PRESSED(KEYSC_DASH)||KEY_PRESSED(KEYSC_GMINUS)) if (KB_KeyPressed(KEYSC_DASH)||KB_KeyPressed(KEYSC_GMINUS))
{ {
if ((zoom -= (zoom >> 4)) < 48) zoom = 48; if ((zoom -= (zoom >> 4)) < 48) zoom = 48;
} }
if (KEY_PRESSED(KEYSC_EQUAL)||KEY_PRESSED(KEYSC_GPLUS)) if (KB_KeyPressed(KEYSC_EQUAL)||KB_KeyPressed(KEYSC_GPLUS))
{ {
if ((zoom += (zoom >> 4)) > 4096) zoom = 4096; if ((zoom += (zoom >> 4)) > 4096) zoom = 4096;
} }
if (KEY_PRESSED(KEYSC_ESC)) if (KB_KeyPressed(KEYSC_ESC))
{ {
extern SWBOOL ScrollMode2D; extern SWBOOL ScrollMode2D;
@ -1671,11 +1671,11 @@ void ScreenCaptureKeys(void)
return; return;
// screen capture // screen capture
if (KEY_PRESSED(KEYSC_F12)) if (KB_KeyPressed(KEYSC_F12))
{ {
inputState.ClearKeyStatus(KEYSC_F12); inputState.ClearKeyStatus(KEYSC_F12);
PauseAction(); PauseAction();
videoCaptureScreenTGA("swcpxxxx.tga", KEY_PRESSED(KEYSC_LSHIFT) | KEY_PRESSED(KEYSC_RSHIFT)); videoCaptureScreenTGA("swcpxxxx.tga", KB_KeyPressed(KEYSC_LSHIFT) | KB_KeyPressed(KEYSC_RSHIFT));
ResumeAction(); ResumeAction();
PutStringInfo(Player + myconnectindex, "Screen Captured"); PutStringInfo(Player + myconnectindex, "Screen Captured");
} }
@ -1687,9 +1687,9 @@ void DrawCheckKeys(PLAYERp pp)
extern SWBOOL PauseKeySet; extern SWBOOL PauseKeySet;
/* JonoF: Who really needs this now? /* JonoF: Who really needs this now?
if (KEY_PRESSED(KEYSC_F5) && !(KEY_PRESSED(KEYSC_RSHIFT) || KEY_PRESSED(KEYSC_LSHIFT) || KEY_PRESSED(KEYSC_ALT) || KEY_PRESSED(KEYSC_RALT)) && !PauseKeySet) if (KB_KeyPressed(KEYSC_F5) && !(KB_KeyPressed(KEYSC_RSHIFT) || KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT)) && !PauseKeySet)
{ {
KEY_PRESSED(KEYSC_F5) = 0; KB_KeyPressed(KEYSC_F5) = 0;
ResChange(); ResChange();
} }
*/ */

View file

@ -1630,7 +1630,7 @@ KeyPressed(void)
for (i = 0; i < NUMKEYS; i++) for (i = 0; i < NUMKEYS; i++)
{ {
if (KEY_PRESSED(i)) if (KB_KeyPressed(i))
return TRUE; return TRUE;
} }
@ -1838,7 +1838,7 @@ CreditsLevel(void)
if (!SongIsPlaying()) if (!SongIsPlaying())
break; break;
if (KEY_PRESSED(KEYSC_ESC)) if (KB_KeyPressed(KEYSC_ESC))
break; break;
} }
@ -2504,7 +2504,7 @@ BonusScreen(PLAYERp pp)
CONTROL_GetUserInput(&uinfo); CONTROL_GetUserInput(&uinfo);
CONTROL_ClearUserInput(&uinfo); CONTROL_ClearUserInput(&uinfo);
if (KEY_PRESSED(KEYSC_SPACE) || KEY_PRESSED(KEYSC_ENTER) || uinfo.button0 || uinfo.button1) if (KB_KeyPressed(KEYSC_SPACE) || KB_KeyPressed(KEYSC_ENTER) || uinfo.button0 || uinfo.button1)
{ {
if (State >= s_BonusRest && State < &s_BonusRest[SIZ(s_BonusRest)]) if (State >= s_BonusRest && State < &s_BonusRest[SIZ(s_BonusRest)])
{ {
@ -2798,7 +2798,7 @@ StatScreen(PLAYERp mpp)
PlaySong(voc[DIGI_ENDLEV].name, 3, TRUE, TRUE); PlaySong(voc[DIGI_ENDLEV].name, 3, TRUE, TRUE);
} }
while (!KEY_PRESSED(KEYSC_SPACE) && !KEY_PRESSED(KEYSC_ENTER)) while (!KB_KeyPressed(KEYSC_SPACE) && !KB_KeyPressed(KEYSC_ENTER))
{ {
handleevents(); handleevents();
@ -4149,15 +4149,15 @@ SinglePlayInput(PLAYERp pp)
} }
} }
if (!(KEY_PRESSED(KEYSC_ALT) | KEY_PRESSED(KEYSC_RALT))) if (!(KB_KeyPressed(KEYSC_ALT) | KB_KeyPressed(KEYSC_RALT)))
return; return;
if (!SW_SHAREWARE && KEY_PRESSED(KEYSC_M)) if (!SW_SHAREWARE && KB_KeyPressed(KEYSC_M))
{ {
extern SWBOOL DebugActorFreeze; extern SWBOOL DebugActorFreeze;
KEY_PRESSED(KEYSC_M) = 0; KB_KeyPressed(KEYSC_M) = 0;
DebugActorFreeze++; DebugActorFreeze++;
if (DebugActorFreeze > 2) if (DebugActorFreeze > 2)
DebugActorFreeze = 0; DebugActorFreeze = 0;
@ -4192,10 +4192,10 @@ SinglePlayInput(PLAYERp pp)
// Insert a player // Insert a player
if (KEY_PRESSED(KEYSC_INS)) if (KB_KeyPressed(KEYSC_INS))
// player // player
{ {
KEY_PRESSED(KEYSC_INS) = 0; KB_KeyPressed(KEYSC_INS) = 0;
ManualPlayerInsert(pp); ManualPlayerInsert(pp);
// comes back looking through screenpeek // comes back looking through screenpeek
InitPlayerSprite(Player + screenpeek); InitPlayerSprite(Player + screenpeek);
@ -4205,21 +4205,21 @@ SinglePlayInput(PLAYERp pp)
// Delete a player // Delete a player
if (KEY_PRESSED(KEYSC_DEL)) if (KB_KeyPressed(KEYSC_DEL))
{ {
KEY_PRESSED(KEYSC_DEL) = 0; KB_KeyPressed(KEYSC_DEL) = 0;
ManualPlayerDelete(pp); ManualPlayerDelete(pp);
} }
// Move control to numbered player // Move control to numbered player
if ((kp = KeyPressedRange(&KEY_PRESSED(KEYSC_1), &KEY_PRESSED(KEYSC_9))) && numplayers > 1) if ((kp = KeyPressedRange(&KB_KeyPressed(KEYSC_1), &KB_KeyPressed(KEYSC_9))) && numplayers > 1)
{ {
short save_myconnectindex; short save_myconnectindex;
save_myconnectindex = myconnectindex; save_myconnectindex = myconnectindex;
myconnectindex = (intptr_t)kp - (intptr_t)(&KEY_PRESSED(KEYSC_1)); myconnectindex = (intptr_t)kp - (intptr_t)(&KB_KeyPressed(KEYSC_1));
if (myconnectindex >= numplayers) if (myconnectindex >= numplayers)
myconnectindex = save_myconnectindex; myconnectindex = save_myconnectindex;
@ -4236,22 +4236,22 @@ SinglePlayInput(PLAYERp pp)
DoPlayerNightVisionPalette(pp); DoPlayerNightVisionPalette(pp);
ResetKeyRange(&KEY_PRESSED(KEYSC_1), &KEY_PRESSED(KEYSC_9)); ResetKeyRange(&KB_KeyPressed(KEYSC_1), &KB_KeyPressed(KEYSC_9));
} }
#if 0 #if 0
if (KEY_PRESSED(KEYSC_T)) if (KB_KeyPressed(KEYSC_T))
{ {
KEY_PRESSED(KEYSC_T) = 0; KB_KeyPressed(KEYSC_T) = 0;
PlayerTrackingMode ^= 1; PlayerTrackingMode ^= 1;
} }
#endif #endif
if (KEY_PRESSED(KEYSC_H)) if (KB_KeyPressed(KEYSC_H))
{ {
short pnum; short pnum;
KEY_PRESSED(KEYSC_H) = 0; KB_KeyPressed(KEYSC_H) = 0;
TRAVERSE_CONNECT(pnum) TRAVERSE_CONNECT(pnum)
{ {
@ -4265,7 +4265,7 @@ DebugKeys(PLAYERp pp)
{ {
short w, h; short w, h;
if (!(KEY_PRESSED(KEYSC_ALT) || KEY_PRESSED(KEYSC_RALT))) if (!(KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT)))
return; return;
if (InputMode) if (InputMode)
@ -4278,9 +4278,9 @@ DebugKeys(PLAYERp pp)
// visiblity adjust // visiblity adjust
// //
if (KEY_PRESSED(KEYSC_L) > 0) if (KB_KeyPressed(KEYSC_L) > 0)
{ {
if (KEY_PRESSED(KEYSC_LSHIFT) | KEY_PRESSED(KEYSC_RSHIFT)) // SHIFT if (KB_KeyPressed(KEYSC_LSHIFT) | KB_KeyPressed(KEYSC_RSHIFT)) // SHIFT
{ {
g_visibility = g_visibility - (g_visibility >> 3); g_visibility = g_visibility - (g_visibility >> 3);
@ -4292,7 +4292,7 @@ DebugKeys(PLAYERp pp)
} }
else else
{ {
KEY_PRESSED(KEYSC_L) = 0; KB_KeyPressed(KEYSC_L) = 0;
g_visibility = g_visibility - (g_visibility >> 3); g_visibility = g_visibility - (g_visibility >> 3);
@ -4305,12 +4305,12 @@ DebugKeys(PLAYERp pp)
// parallax changes // parallax changes
// //
if (KEY_PRESSED(KEYSC_X)) if (KB_KeyPressed(KEYSC_X))
{ {
if (KEY_PRESSED(KEYSC_LSHIFT)) if (KB_KeyPressed(KEYSC_LSHIFT))
{ {
KEY_PRESSED(KEYSC_LSHIFT) = FALSE; KB_KeyPressed(KEYSC_LSHIFT) = FALSE;
KEY_PRESSED(KEYSC_X) = 0; KB_KeyPressed(KEYSC_X) = 0;
parallaxyoffs_override += 10; parallaxyoffs_override += 10;
@ -4319,7 +4319,7 @@ DebugKeys(PLAYERp pp)
} }
else else
{ {
KEY_PRESSED(KEYSC_X) = 0; KB_KeyPressed(KEYSC_X) = 0;
parallaxtype++; parallaxtype++;
if (parallaxtype > 2) if (parallaxtype > 2)
parallaxtype = 0; parallaxtype = 0;
@ -4336,11 +4336,11 @@ ConKey(void)
// Console Input Panel // Console Input Panel
if (!ConPanel && dimensionmode == 3) if (!ConPanel && dimensionmode == 3)
{ {
//if (KEY_PRESSED(KEYSC_TILDE) && KEY_PRESSED(KEYSC_LSHIFT)) //if (KB_KeyPressed(KEYSC_TILDE) && KB_KeyPressed(KEYSC_LSHIFT))
if (KEY_PRESSED(KEYSC_TILDE)) if (KB_KeyPressed(KEYSC_TILDE))
{ {
KEY_PRESSED(KEYSC_TILDE) = FALSE; KB_KeyPressed(KEYSC_TILDE) = FALSE;
//KEY_PRESSED(KEYSC_LSHIFT) = FALSE; //KB_KeyPressed(KEYSC_LSHIFT) = FALSE;
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
ConPanel = TRUE; ConPanel = TRUE;
InputMode = TRUE; InputMode = TRUE;
@ -4352,11 +4352,11 @@ ConKey(void)
} }
else if (ConPanel) else if (ConPanel)
{ {
//if (KEY_PRESSED(KEYSC_TILDE) && KEY_PRESSED(KEYSC_LSHIFT)) //if (KB_KeyPressed(KEYSC_TILDE) && KB_KeyPressed(KEYSC_LSHIFT))
if (KEY_PRESSED(KEYSC_TILDE)) if (KB_KeyPressed(KEYSC_TILDE))
{ {
KEY_PRESSED(KEYSC_TILDE) = FALSE; KB_KeyPressed(KEYSC_TILDE) = FALSE;
//KEY_PRESSED(KEYSC_LSHIFT) = FALSE; //KB_KeyPressed(KEYSC_LSHIFT) = FALSE;
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
ConPanel = FALSE; ConPanel = FALSE;
ConInputMode = FALSE; ConInputMode = FALSE;
@ -4380,18 +4380,18 @@ FunctionKeys(PLAYERp pp)
rts_delay++; rts_delay++;
if (KEY_PRESSED(sc_F1)) { fn_key = 1; } if (KB_KeyPressed(sc_F1)) { fn_key = 1; }
if (KEY_PRESSED(sc_F2)) { fn_key = 2; } if (KB_KeyPressed(sc_F2)) { fn_key = 2; }
if (KEY_PRESSED(sc_F3)) { fn_key = 3; } if (KB_KeyPressed(sc_F3)) { fn_key = 3; }
if (KEY_PRESSED(sc_F4)) { fn_key = 4; } if (KB_KeyPressed(sc_F4)) { fn_key = 4; }
if (KEY_PRESSED(sc_F5)) { fn_key = 5; } if (KB_KeyPressed(sc_F5)) { fn_key = 5; }
if (KEY_PRESSED(sc_F6)) { fn_key = 6; } if (KB_KeyPressed(sc_F6)) { fn_key = 6; }
if (KEY_PRESSED(sc_F7)) { fn_key = 7; } if (KB_KeyPressed(sc_F7)) { fn_key = 7; }
if (KEY_PRESSED(sc_F8)) { fn_key = 8; } if (KB_KeyPressed(sc_F8)) { fn_key = 8; }
if (KEY_PRESSED(sc_F9)) { fn_key = 9; } if (KB_KeyPressed(sc_F9)) { fn_key = 9; }
if (KEY_PRESSED(sc_F10)) { fn_key = 10; } if (KB_KeyPressed(sc_F10)) { fn_key = 10; }
if (KEY_PRESSED(KEYSC_ALT) || KEY_PRESSED(KEYSC_RALT)) if (KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT))
{ {
if (rts_delay > 16 && fn_key && CommEnabled && !adult_lockout && !Global_PLock) if (rts_delay > 16 && fn_key && CommEnabled && !adult_lockout && !Global_PLock)
{ {
@ -4416,7 +4416,7 @@ FunctionKeys(PLAYERp pp)
return; return;
} }
if (KEY_PRESSED(KEYSC_LSHIFT) || KEY_PRESSED(KEYSC_RSHIFT)) if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
{ {
if (fn_key && CommEnabled) if (fn_key && CommEnabled)
{ {
@ -4448,7 +4448,7 @@ FunctionKeys(PLAYERp pp)
if (numplayers <= 1) if (numplayers <= 1)
{ {
// F2 save menu // F2 save menu
if (KEY_PRESSED(KEYSC_F2)) if (KB_KeyPressed(KEYSC_F2))
{ {
inputState.ClearKeyStatus(KEYSC_F2); inputState.ClearKeyStatus(KEYSC_F2);
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))
@ -4459,7 +4459,7 @@ FunctionKeys(PLAYERp pp)
} }
// F3 load menu // F3 load menu
if (KEY_PRESSED(KEYSC_F3)) if (KB_KeyPressed(KEYSC_F3))
{ {
inputState.ClearKeyStatus(KEYSC_F3); inputState.ClearKeyStatus(KEYSC_F3);
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))
@ -4470,7 +4470,7 @@ FunctionKeys(PLAYERp pp)
} }
// F6 option menu // F6 option menu
if (KEY_PRESSED(KEYSC_F6)) if (KB_KeyPressed(KEYSC_F6))
{ {
extern SWBOOL QuickSaveMode; extern SWBOOL QuickSaveMode;
inputState.ClearKeyStatus(KEYSC_F6); inputState.ClearKeyStatus(KEYSC_F6);
@ -4483,7 +4483,7 @@ FunctionKeys(PLAYERp pp)
} }
// F9 quick load // F9 quick load
if (KEY_PRESSED(KEYSC_F9)) if (KB_KeyPressed(KEYSC_F9))
{ {
inputState.ClearKeyStatus(KEYSC_F9); inputState.ClearKeyStatus(KEYSC_F9);
@ -4506,7 +4506,7 @@ FunctionKeys(PLAYERp pp)
// F4 sound menu // F4 sound menu
if (KEY_PRESSED(KEYSC_F4)) if (KB_KeyPressed(KEYSC_F4))
{ {
inputState.ClearKeyStatus(KEYSC_F4); inputState.ClearKeyStatus(KEYSC_F4);
inputState.SetKeyStatus(sc_Escape); inputState.SetKeyStatus(sc_Escape);
@ -4515,11 +4515,11 @@ FunctionKeys(PLAYERp pp)
// F7 VIEW control // F7 VIEW control
if (KEY_PRESSED(KEYSC_F7)) if (KB_KeyPressed(KEYSC_F7))
{ {
inputState.ClearKeyStatus(KEYSC_F7); inputState.ClearKeyStatus(KEYSC_F7);
if (KEY_PRESSED(KEYSC_LSHIFT) || KEY_PRESSED(KEYSC_RSHIFT)) if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
{ {
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
pp->view_outside_dang = NORM_ANGLE(pp->view_outside_dang + 256); pp->view_outside_dang = NORM_ANGLE(pp->view_outside_dang + 256);
@ -4539,7 +4539,7 @@ FunctionKeys(PLAYERp pp)
} }
// F8 toggle messages // F8 toggle messages
if (KEY_PRESSED(KEYSC_F8)) if (KB_KeyPressed(KEYSC_F8))
{ {
inputState.ClearKeyStatus(KEYSC_F8); inputState.ClearKeyStatus(KEYSC_F8);
@ -4552,7 +4552,7 @@ FunctionKeys(PLAYERp pp)
} }
// F10 quit menu // F10 quit menu
if (KEY_PRESSED(KEYSC_F10)) if (KB_KeyPressed(KEYSC_F10))
{ {
inputState.ClearKeyStatus(KEYSC_F10); inputState.ClearKeyStatus(KEYSC_F10);
inputState.SetKeyStatus(sc_Escape); inputState.SetKeyStatus(sc_Escape);
@ -4560,7 +4560,7 @@ FunctionKeys(PLAYERp pp)
} }
// F11 gamma correction // F11 gamma correction
if (KEY_PRESSED(KEYSC_F11) > 0) if (KB_KeyPressed(KEYSC_F11) > 0)
{ {
inputState.ClearKeyStatus(KEYSC_F11); inputState.ClearKeyStatus(KEYSC_F11);
// Do this entirely in the video backend. // Do this entirely in the video backend.
@ -4574,7 +4574,7 @@ void PauseKey(PLAYERp pp)
extern short QuickLoadNum; extern short QuickLoadNum;
extern SWBOOL enabled; extern SWBOOL enabled;
if (KEY_PRESSED(sc_Pause) && !CommEnabled && !InputMode && !UsingMenus && !CheatInputMode && !ConPanel) if (KB_KeyPressed(sc_Pause) && !CommEnabled && !InputMode && !UsingMenus && !CheatInputMode && !ConPanel)
{ {
inputState.ClearKeyStatus(sc_Pause); inputState.ClearKeyStatus(sc_Pause);
@ -4828,10 +4828,10 @@ void GetHelpInput(PLAYERp pp)
{ {
extern SWBOOL GamePaused; extern SWBOOL GamePaused;
if (KEY_PRESSED(KEYSC_ALT) || KEY_PRESSED(KEYSC_RALT)) if (KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT))
return; return;
if (KEY_PRESSED(KEYSC_LSHIFT) || KEY_PRESSED(KEYSC_RSHIFT)) if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
return; return;
if (MessageInputMode || ConInputMode) if (MessageInputMode || ConInputMode)
@ -4840,7 +4840,7 @@ void GetHelpInput(PLAYERp pp)
// F1 help menu // F1 help menu
if (!HelpInputMode) if (!HelpInputMode)
{ {
if (KEY_PRESSED(KEYSC_F1)) if (KB_KeyPressed(KEYSC_F1))
{ {
inputState.ClearKeyStatus(KEYSC_F11); inputState.ClearKeyStatus(KEYSC_F11);
HelpPage = 0; HelpPage = 0;
@ -4853,7 +4853,7 @@ void GetHelpInput(PLAYERp pp)
} }
else if (HelpInputMode) else if (HelpInputMode)
{ {
if (KEY_PRESSED(KEYSC_ESC)) if (KB_KeyPressed(KEYSC_ESC))
{ {
inputState.ClearKeyStatus(sc_Escape); inputState.ClearKeyStatus(sc_Escape);
KB_ClearKeysDown(); KB_ClearKeysDown();
@ -4865,7 +4865,7 @@ void GetHelpInput(PLAYERp pp)
SetRedrawScreen(pp); SetRedrawScreen(pp);
} }
if (KEY_PRESSED(KEYSC_SPACE) || KEY_PRESSED(KEYSC_ENTER) || KEY_PRESSED(KEYSC_PGDN) || KEY_PRESSED(KEYSC_DOWN) || KEY_PRESSED(KEYSC_RIGHT) || KEY_PRESSED(sc_kpad_3) || KEY_PRESSED(sc_kpad_2) || KEY_PRESSED(sc_kpad_6)) if (KB_KeyPressed(KEYSC_SPACE) || KB_KeyPressed(KEYSC_ENTER) || KB_KeyPressed(KEYSC_PGDN) || KB_KeyPressed(KEYSC_DOWN) || KB_KeyPressed(KEYSC_RIGHT) || KB_KeyPressed(sc_kpad_3) || KB_KeyPressed(sc_kpad_2) || KB_KeyPressed(sc_kpad_6))
{ {
inputState.ClearKeyStatus(KEYSC_SPACE); inputState.ClearKeyStatus(KEYSC_SPACE);
inputState.ClearKeyStatus(KEYSC_ENTER); inputState.ClearKeyStatus(KEYSC_ENTER);
@ -4885,7 +4885,7 @@ void GetHelpInput(PLAYERp pp)
// CTW MODIFICATION END // CTW MODIFICATION END
} }
if (KEY_PRESSED(KEYSC_PGUP) || KEY_PRESSED(KEYSC_UP) || KEY_PRESSED(KEYSC_LEFT) || KEY_PRESSED(sc_kpad_9) || KEY_PRESSED(sc_kpad_8) || KEY_PRESSED(sc_kpad_4)) if (KB_KeyPressed(KEYSC_PGUP) || KB_KeyPressed(KEYSC_UP) || KB_KeyPressed(KEYSC_LEFT) || KB_KeyPressed(sc_kpad_9) || KB_KeyPressed(sc_kpad_8) || KB_KeyPressed(sc_kpad_4))
{ {
inputState.ClearKeyStatus(KEYSC_PGUP); inputState.ClearKeyStatus(KEYSC_PGUP);
inputState.ClearKeyStatus(KEYSC_UP); inputState.ClearKeyStatus(KEYSC_UP);
@ -5036,7 +5036,7 @@ getinput(SW_PACKET *loc)
if (MenuInputMode || UsingMenus || ScrollMode2D || InputMode) if (MenuInputMode || UsingMenus || ScrollMode2D || InputMode)
return; return;
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, ((!!KEY_PRESSED(KEYSC_SPACE)) | BUTTON(gamefunc_Open))); SET_LOC_KEY(loc->bits, SK_SPACE_BAR, ((!!KB_KeyPressed(KEYSC_SPACE)) | BUTTON(gamefunc_Open)));
running = G_CheckAutorun(BUTTON(gamefunc_Run)); running = G_CheckAutorun(BUTTON(gamefunc_Run));
@ -5164,9 +5164,9 @@ getinput(SW_PACKET *loc)
SET_LOC_KEY(loc->bits, SK_AUTO_AIM, TRUE); SET_LOC_KEY(loc->bits, SK_AUTO_AIM, TRUE);
} }
} }
else if (KEY_PRESSED(sc_Pause)) else if (KB_KeyPressed(sc_Pause))
{ {
SET_LOC_KEY(loc->bits, SK_PAUSE, KEY_PRESSED(sc_Pause)); SET_LOC_KEY(loc->bits, SK_PAUSE, KB_KeyPressed(sc_Pause));
inputState.ClearKeyStatus(sc_Pause); inputState.ClearKeyStatus(sc_Pause);
} }
@ -5300,7 +5300,7 @@ getinput(SW_PACKET *loc)
SET_LOC_KEY(loc->bits, SK_HIDE_WEAPON, BUTTON(gamefunc_Holster_Weapon)); SET_LOC_KEY(loc->bits, SK_HIDE_WEAPON, BUTTON(gamefunc_Holster_Weapon));
// need BUTTON // need BUTTON
SET_LOC_KEY(loc->bits, SK_CRAWL_LOCK, KEY_PRESSED(KEYSC_NUM)); SET_LOC_KEY(loc->bits, SK_CRAWL_LOCK, KB_KeyPressed(KEYSC_NUM));
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE) if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
{ {

View file

@ -303,8 +303,6 @@ extern char MessageOutputString[256];
#define PK_ZOOM_OUT 17 #define PK_ZOOM_OUT 17
#define PK_MESSAGE 18 #define PK_MESSAGE 18
// #define PKEY(num) KEY_PRESSED(keys[num])
#define MK_FIXED(msw,lsw) (((int32_t)(msw)<<16)|(lsw)) #define MK_FIXED(msw,lsw) (((int32_t)(msw)<<16)|(lsw))
#define FIXED(msw,lsw) MK_FIXED(msw,lsw) #define FIXED(msw,lsw) MK_FIXED(msw,lsw)
@ -500,7 +498,7 @@ int StdRandomRange(int range);
// just determine if the player is moving // just determine if the player is moving
#define PLAYER_MOVING(pp) ((pp)->xvect|(pp)->yvect) #define PLAYER_MOVING(pp) ((pp)->xvect|(pp)->yvect)
#define KEY_EXT(scan) (KEY_PRESSED(scan) | KEY_PRESSED(scan+128)) #define KEY_EXT(scan) (KB_KeyPressed(scan) | KB_KeyPressed(scan+128))
#define TEST_GOTSECTOR(sect_num) (TEST(gotsector[(sect_num) >> 3], 1 << ((sect_num) & 7))) #define TEST_GOTSECTOR(sect_num) (TEST(gotsector[(sect_num) >> 3], 1 << ((sect_num) & 7)))
#define RESET_GOTSECTOR(sect_num) (RESET(gotsector[(sect_num) >> 3], 1 << ((sect_num) & 7))) #define RESET_GOTSECTOR(sect_num) (RESET(gotsector[(sect_num) >> 3], 1 << ((sect_num) & 7)))

View file

@ -672,7 +672,7 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
short w, h = 8; short w, h = 8;
int i, j, y; int i, j, y;
if (KEY_PRESSED(KEYSC_ESC)) if (KB_KeyPressed(KEYSC_ESC))
{ {
KB_ClearKeyDown(sc_Escape); KB_ClearKeyDown(sc_Escape);
currentmode = 0; currentmode = 0;
@ -726,7 +726,7 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
UserInput inpt = {FALSE,FALSE,dir_None}; UserInput inpt = {FALSE,FALSE,dir_None};
CONTROL_GetUserInput(&inpt); CONTROL_GetUserInput(&inpt);
if (KEY_PRESSED(KEYSC_ESC) || inpt.button1) if (KB_KeyPressed(KEYSC_ESC) || inpt.button1)
{ {
inputState.ClearKeyStatus(sc_Escape); inputState.ClearKeyStatus(sc_Escape);
cust_callback = NULL; cust_callback = NULL;
@ -1574,7 +1574,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
CONTROL_GetUserInput(&tst_input); CONTROL_GetUserInput(&tst_input);
//order_input_buffered.dir = tst_input.dir; //order_input_buffered.dir = tst_input.dir;
// Support a few other keys too // Support a few other keys too
if (KEY_PRESSED(KEYSC_SPACE)||KEY_PRESSED(KEYSC_ENTER)) if (KB_KeyPressed(KEYSC_SPACE)||KB_KeyPressed(KEYSC_ENTER))
{ {
inputState.ClearKeyStatus(KEYSC_SPACE); inputState.ClearKeyStatus(KEYSC_SPACE);
inputState.ClearKeyStatus(KEYSC_ENTER); inputState.ClearKeyStatus(KEYSC_ENTER);
@ -1614,7 +1614,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
order_input_buffered.dir = tst_input.dir; order_input_buffered.dir = tst_input.dir;
} }
if (!KEY_PRESSED(KEYSC_ESC) && !order_input_buffered.button1) if (!KB_KeyPressed(KEYSC_ESC) && !order_input_buffered.button1)
{ {
cust_callback = MNU_OrderCustom; cust_callback = MNU_OrderCustom;
cust_callback_call = call; cust_callback_call = call;
@ -4372,7 +4372,7 @@ MNU_DoHotkey(void)
index = 0; index = 0;
for (item = currentmenu->items; item->type != mt_none; item++) for (item = currentmenu->items; item->type != mt_none; item++)
{ {
if (KEY_PRESSED(item->hotkey) && item->hotkey != 0) if (KB_KeyPressed(item->hotkey) && item->hotkey != 0)
{ {
MNU_SelectItem(currentmenu, index, FALSE); MNU_SelectItem(currentmenu, index, FALSE);
return TRUE; return TRUE;
@ -4563,7 +4563,7 @@ MNU_CheckForMenus(void)
} }
else else
{ {
if ((KEY_PRESSED(KEYSC_ESC)) && dimensionmode == 3 && !ConPanel) if ((KB_KeyPressed(KEYSC_ESC)) && dimensionmode == 3 && !ConPanel)
{ {
inputState.ClearKeyStatus(sc_Escape); inputState.ClearKeyStatus(sc_Escape);
KB_ClearKeysDown(); KB_ClearKeysDown();

View file

@ -637,7 +637,7 @@ waitforeverybody(void)
} }
#endif #endif
//KEY_PRESSED(KEYSC_ESC) = FALSE; //KB_KeyPressed(KEYSC_ESC) = FALSE;
Player[myconnectindex].playerreadyflag++; Player[myconnectindex].playerreadyflag++;
while (TRUE) while (TRUE)
@ -657,7 +657,7 @@ waitforeverybody(void)
if (quitevent || (wfe_ExitCallback && wfe_ExitCallback())) if (quitevent || (wfe_ExitCallback && wfe_ExitCallback()))
{ {
// allow exit // allow exit
//if (KEY_PRESSED(KEYSC_ESC)) //if (KB_KeyPressed(KEYSC_ESC))
{ {
short pnum; short pnum;
//TRAVERSE_CONNECT(pnum) //TRAVERSE_CONNECT(pnum)
@ -940,7 +940,7 @@ faketimerhandler(void)
extern SWBOOL BotMode; extern SWBOOL BotMode;
#if 0 #if 0
if (KEY_PRESSED(KEYSC_PERIOD)) if (KB_KeyPressed(KEYSC_PERIOD))
{ {
extern unsigned int MoveThingsCount; extern unsigned int MoveThingsCount;
MoveThingsCount++; MoveThingsCount++;

View file

@ -1580,17 +1580,17 @@ pSwordRest(PANEL_SPRITEp psp)
SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT);
#if 0 #if 0
if (KEY_PRESSED(KEYSC_SEMI)) if (KB_KeyPressed(KEYSC_SEMI))
{ {
KEY_PRESSED(KEYSC_SEMI) = 0; KB_KeyPressed(KEYSC_SEMI) = 0;
SwordAng -= 4; SwordAng -= 4;
//DSPRINTF(ds,"SwordAng %d", SwordAng); //DSPRINTF(ds,"SwordAng %d", SwordAng);
MONO_PRINT(ds); MONO_PRINT(ds);
} }
if (KEY_PRESSED(KEYSC_QUOTE)) if (KB_KeyPressed(KEYSC_QUOTE))
{ {
KEY_PRESSED(KEYSC_QUOTE) = 0; KB_KeyPressed(KEYSC_QUOTE) = 0;
SwordAng += 4; SwordAng += 4;
//DSPRINTF(ds,"SwordAng %d", SwordAng); //DSPRINTF(ds,"SwordAng %d", SwordAng);
MONO_PRINT(ds); MONO_PRINT(ds);

View file

@ -4116,7 +4116,7 @@ SWBOOL PlayerFlyKey(PLAYERp pp)
if (InputMode) if (InputMode)
return FALSE; return FALSE;
key = KEY_PRESSED(KEYSC_J); key = KB_KeyPressed(KEYSC_J);
if (key) if (key)
inputState.ClearKeyStatus(KEYSC_J); inputState.ClearKeyStatus(KEYSC_J);
@ -7398,7 +7398,7 @@ DoPlayerRun(PLAYERp pp)
} }
// Crawl lock // Crawl lock
// if (KEY_PRESSED(KEYSC_NUM)) // if (KB_KeyPressed(KEYSC_NUM))
if (TEST_SYNC_KEY(pp, SK_CRAWL_LOCK)) if (TEST_SYNC_KEY(pp, SK_CRAWL_LOCK))
{ {
if (FLAG_KEY_PRESSED(pp, SK_CRAWL_LOCK)) if (FLAG_KEY_PRESSED(pp, SK_CRAWL_LOCK))
@ -7983,9 +7983,9 @@ domovethings(void)
#if 0 #if 0
{ {
extern SWBOOL PauseKeySet; extern SWBOOL PauseKeySet;
if (KEY_PRESSED(KEYSC_F5) && !(KEY_PRESSED(KEYSC_ALT) || KEY_PRESSED(KEYSC_RALT)) && !PauseKeySet) if (KB_KeyPressed(KEYSC_F5) && !(KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT)) && !PauseKeySet)
{ {
KEY_PRESSED(KEYSC_F5) = 0; KB_KeyPressed(KEYSC_F5) = 0;
ResChange(); ResChange();
} }
} }