Interpret controller buttons as known keynums in Quake III Arena

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5987 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Eukara 2021-07-22 07:17:30 +00:00
parent 42b6d60115
commit de522617e7
3 changed files with 101 additions and 1 deletions

View file

@ -682,8 +682,17 @@ ifeq ($(COMPILE_SYS),Darwin)
endif
endif
PROFILE_CFLAGS=-pg
# Statically link everything but SDL/AL for the SDL target,
# this assumes makelibs; but we don't really care. These are portable builds
# that can only make one assumption: SDL/AL are installed.
# Dependencies like libjpeg9 don't exist everywhere.
ifeq ($(FTE_TARGET),SDL2)
IMAGELDFLAGS:= libs-$(ARCH)/libpng.a libs-$(ARCH)/libjpeg.a
OGGVORBISLDFLAGS:= libs-$(ARCH)/libvorbisfile.a libs-$(ARCH)/libvorbis.a libs-$(ARCH)/libogg.a
BASE_CFLAGS+=-DLIBJPEG_STATIC -DLIBJPEG_STATIC -DLIBPNG_STATIC -DOPUS_STATIC -DSPEEX_STATIC -DFREETYPE_STATIC -DLIBVORBISFILE_STATIC
endif
PROFILE_CFLAGS=-pg
DX7SDK=-I./libs/dxsdk7/include/
GLCFLAGS?=-DGLQUAKE

View file

@ -1397,6 +1397,52 @@ qboolean CG_KeyPress(int key, int unicode, int down)
int catcher = Q3_GetKeyCatcher();
if (!cgvm || !(catcher&8))
return false;
/* if you change this here, it'll have to be changed in cl_cg.c too */
switch (key)
{
/* all these get interpreted as enter in Q3's UI... */
case K_JOY1:
case K_JOY2:
case K_JOY3:
case K_JOY4:
case K_AUX1:
case K_AUX2:
case K_AUX3:
case K_AUX4:
case K_AUX5:
case K_AUX6:
case K_AUX7:
case K_AUX8:
case K_AUX9:
case K_AUX10:
case K_AUX11:
case K_AUX14:
case K_AUX15:
case K_AUX16:
return true;
break;
/* Q3 doesn't know about these keys, remap them */
case K_GP_START:
key = K_ESCAPE;
break;
case K_GP_DPAD_UP:
key = K_UPARROW;
break;
case K_GP_DPAD_DOWN:
key = K_DOWNARROW;
break;
case K_GP_DPAD_LEFT:
key = K_LEFTARROW;
break;
case K_GP_DPAD_RIGHT:
key = K_RIGHTARROW;
break;
case K_GP_A:
key = K_ENTER;
break;
}
return VM_Call(cgvm, CG_KEY_EVENT, key, down);
}

View file

@ -1775,6 +1775,51 @@ qboolean UI_KeyPress(struct menu_s *m, qboolean isdown, unsigned int devid, int
return false;
}
/* if you change this here, it'll have to be changed in cl_cg.c too */
switch (key)
{
/* all these get interpreted as enter in Q3's UI... */
case K_JOY1:
case K_JOY2:
case K_JOY3:
case K_JOY4:
case K_AUX1:
case K_AUX2:
case K_AUX3:
case K_AUX4:
case K_AUX5:
case K_AUX6:
case K_AUX7:
case K_AUX8:
case K_AUX9:
case K_AUX10:
case K_AUX11:
case K_AUX14:
case K_AUX15:
case K_AUX16:
return true;
break;
/* Q3 doesn't know about these keys, remap them */
case K_GP_START:
key = K_ESCAPE;
break;
case K_GP_DPAD_UP:
key = K_UPARROW;
break;
case K_GP_DPAD_DOWN:
key = K_DOWNARROW;
break;
case K_GP_DPAD_LEFT:
key = K_LEFTARROW;
break;
case K_GP_DPAD_RIGHT:
key = K_RIGHTARROW;
break;
case K_GP_A:
key = K_ENTER;
break;
}
if (key && key < 1024)
/*result = */VM_Call(uivm, UI_KEY_EVENT, key, isdown);
if (unicode && unicode < 1024)