mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-21 11:21:14 +00:00
Merge pull request #83 from Peter0x44/main
CLIENT: Track held duration for all positive gamepad constants
This commit is contained in:
commit
fb31ead6cb
3 changed files with 69 additions and 2 deletions
|
@ -225,6 +225,7 @@ float stopwatch_round_starttime;
|
|||
|
||||
*/
|
||||
float GPActive[32];
|
||||
float GPButtonHeldBeginTime[24];
|
||||
|
||||
string build_datetime;
|
||||
#define VERSION_STRING "v1.0"
|
||||
|
@ -303,4 +304,4 @@ screenres_s screen_resolution_21x9[] =
|
|||
{
|
||||
{2560, 1080},
|
||||
{3840, 1440}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -923,6 +923,71 @@ void(float button, string key) setToBind =
|
|||
|
||||
noref float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent =
|
||||
{
|
||||
if (evtype == IE_KEYDOWN) {
|
||||
switch (scanx) {
|
||||
case K_GP_A:
|
||||
case K_GP_B:
|
||||
case K_GP_X:
|
||||
case K_GP_Y:
|
||||
case K_GP_LSHOULDER:
|
||||
case K_GP_RSHOULDER:
|
||||
case K_GP_LTRIGGER:
|
||||
case K_GP_RTRIGGER:
|
||||
case K_GP_BACK:
|
||||
case K_GP_START:
|
||||
case K_GP_LTHUMB:
|
||||
case K_GP_RTHUMB:
|
||||
case K_GP_DPAD_UP:
|
||||
case K_GP_DPAD_DOWN:
|
||||
case K_GP_DPAD_LEFT:
|
||||
case K_GP_DPAD_RIGHT:
|
||||
case K_GP_LTHUMB_UP:
|
||||
case K_GP_LTHUMB_DOWN:
|
||||
case K_GP_LTHUMB_LEFT:
|
||||
case K_GP_LTHUMB_RIGHT:
|
||||
case K_GP_RTHUMB_UP:
|
||||
case K_GP_RTHUMB_DOWN:
|
||||
case K_GP_RTHUMB_LEFT:
|
||||
case K_GP_RTHUMB_RIGHT:
|
||||
if (!GPButtonHeldBeginTime[scanx-816])
|
||||
GPButtonHeldBeginTime[scanx-816] = cltime;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (evtype == IE_KEYUP) {
|
||||
switch (scanx) {
|
||||
case K_GP_A:
|
||||
case K_GP_B:
|
||||
case K_GP_X:
|
||||
case K_GP_Y:
|
||||
case K_GP_LSHOULDER:
|
||||
case K_GP_RSHOULDER:
|
||||
case K_GP_LTRIGGER:
|
||||
case K_GP_RTRIGGER:
|
||||
case K_GP_BACK:
|
||||
case K_GP_START:
|
||||
case K_GP_LTHUMB:
|
||||
case K_GP_RTHUMB:
|
||||
case K_GP_DPAD_UP:
|
||||
case K_GP_DPAD_DOWN:
|
||||
case K_GP_DPAD_LEFT:
|
||||
case K_GP_DPAD_RIGHT:
|
||||
case K_GP_LTHUMB_UP:
|
||||
case K_GP_LTHUMB_DOWN:
|
||||
case K_GP_LTHUMB_LEFT:
|
||||
case K_GP_LTHUMB_RIGHT:
|
||||
case K_GP_RTHUMB_UP:
|
||||
case K_GP_RTHUMB_DOWN:
|
||||
case K_GP_RTHUMB_LEFT:
|
||||
case K_GP_RTHUMB_RIGHT:
|
||||
//print(sprintf("Key: %f Duration: %f\n", scanx, cltime-GPButtonHeldBeginTime[scanx-816]));
|
||||
GPButtonHeldBeginTime[scanx-816] = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
switch(evtype)
|
||||
{
|
||||
case IE_KEYDOWN:
|
||||
|
@ -1052,6 +1117,7 @@ noref float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent
|
|||
cursor_pos_y = chary;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
|
|
|
@ -26,4 +26,4 @@ echo "Compiling FTE SSQC.."
|
|||
echo "Compiling Standard/Id SSQC.."
|
||||
./$FTEQCC -O3 -srcfile ../progs/ssqc.src | grep -E -i "warning |error |defined |not |unknown |branches"
|
||||
|
||||
echo "End of script."
|
||||
echo "End of script."
|
||||
|
|
Loading…
Reference in a new issue