From 7c6eb18a76a1a94e536e1626fc2eaae502655b88 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 16 Aug 2017 02:14:07 +0000 Subject: [PATCH] in_xinput 1 is now default. because we can. android gets a couple more gamepad buttons. gamepads now have separate keybindings. I've created some default binds for mods that are unaware of gamepad buttons. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5142 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 41 +++++---- engine/client/cl_parse.c | 52 +++++++++-- engine/client/cl_tent.c | 14 --- engine/client/in_win.c | 3 +- engine/client/keys.c | 89 +++++++++++++------ engine/client/keys.h | 26 ------ engine/client/m_download.c | 12 +-- engine/client/m_items.c | 25 +++--- engine/client/m_master.c | 16 ++-- engine/client/m_mp3.c | 16 ++-- engine/client/m_multi.c | 12 +-- engine/client/m_options.c | 30 +++---- engine/client/m_single.c | 4 + engine/client/menu.c | 7 ++ engine/client/pr_clcmd.c | 3 - engine/client/pr_csqc.c | 6 +- engine/client/textedit.c | 8 ++ engine/common/pmove.c | 56 ++++++++---- engine/common/pmove.h | 11 +++ engine/dotnet2005/droid.vcproj | 2 +- .../droid/src/com/fteqw/FTEDroidActivity.java | 81 +++++++++++++---- engine/qclib/pr_edict.c | 4 + engine/server/pr_cmds.c | 4 +- engine/server/sv_main.c | 2 +- engine/server/sv_phys.c | 16 ++-- engine/server/sv_send.c | 61 +++++++++---- plugins/ezhud/hud_editor.c | 9 ++ 27 files changed, 397 insertions(+), 213 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 7c9a8573c..e2f4ba761 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -2093,24 +2093,33 @@ void CL_CheckServerInfo(void) cls.allow_cheats = false; } - cls.maxfps = atof(Info_ValueForKey(cl.serverinfo, "maxfps")); - if (cls.maxfps < 20) - cls.maxfps = 72; - cls.z_ext = atoi(Info_ValueForKey(cl.serverinfo, "*z_ext")); - // movement vars for prediction - cl.bunnyspeedcap = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_bunnyspeedcap")); - movevars.slidefix = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_slidefix")) != 0); - movevars.airstep = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_airstep")) != 0); - movevars.walljump = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_walljump"))); - movevars.ktjump = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_ktjump")); - s = Info_ValueForKey(cl.serverinfo, "pm_stepheight"); - movevars.stepheight = *s?Q_atof(s):PM_DEFAULTSTEPHEIGHT; - s = Info_ValueForKey(cl.serverinfo, "pm_watersinkspeed"); - movevars.watersinkspeed = *s?Q_atof(s):60; - s = Info_ValueForKey(cl.serverinfo, "pm_flyfriction"); - movevars.flyfriction = *s?Q_atof(s):4; +#ifdef NQPROT + if (cls.protocol == CP_NETQUAKE && CPNQ_IS_DP) + { + //movevars come from stats. + } + else +#endif + { + cls.maxfps = atof(Info_ValueForKey(cl.serverinfo, "maxfps")); + if (cls.maxfps < 20) + cls.maxfps = 72; + + // movement vars for prediction + cl.bunnyspeedcap = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_bunnyspeedcap")); + movevars.slidefix = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_slidefix")) != 0); + movevars.airstep = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_airstep")) != 0); + movevars.walljump = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_walljump"))); + movevars.ktjump = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_ktjump")); + s = Info_ValueForKey(cl.serverinfo, "pm_stepheight"); + movevars.stepheight = *s?Q_atof(s):PM_DEFAULTSTEPHEIGHT; + s = Info_ValueForKey(cl.serverinfo, "pm_watersinkspeed"); + movevars.watersinkspeed = *s?Q_atof(s):60; + s = Info_ValueForKey(cl.serverinfo, "pm_flyfriction"); + movevars.flyfriction = *s?Q_atof(s):4; + } // Initialize cl.maxpitch & cl.minpitch if (cls.protocol == CP_QUAKEWORLD || cls.protocol == CP_NETQUAKE) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 317a14e66..c4abb820b 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -463,11 +463,10 @@ void CL_AckedInputFrame(int inseq, int outseq, qboolean worldstateokay) unsigned int newmod; outframe_t *frame; - newmod = outseq & UPDATE_MASK; - //calc the latency for this frame, but only if its not a dupe ack. we want the youngest, not the oldest, so we can calculate network latency rather than simply packet frequency if (outseq != cl.lastackedmovesequence) { + newmod = outseq & UPDATE_MASK; frame = &cl.outframes[newmod]; // calculate latency frame->latency = realtime - frame->senttime; @@ -5172,10 +5171,53 @@ static void CL_SetStat_Internal (int pnum, int stat, int ivalue, float fvalue) } #ifdef NQPROT -static void CL_SetStatMovevar(int pnum, int stat, float value) +static void CL_SetStatMovevar(int pnum, int stat, int ivalue, float value) { switch(stat) { + case STAT_FRAGLIMIT: + if (cls.protocol == CP_NETQUAKE && CPNQ_IS_DP) + Info_SetValueForKey(cl.serverinfo, "fraglimit", va("%g", value), sizeof(cl.serverinfo)); + break; + case STAT_TIMELIMIT: + if (cls.protocol == CP_NETQUAKE && CPNQ_IS_DP) + Info_SetValueForKey(cl.serverinfo, "timelimit", va("%g", value), sizeof(cl.serverinfo)); + break; + case STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR: //0 + case STAT_MOVEVARS_AIRCONTROL_PENALTY: //0 + case STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW: //0 + case STAT_MOVEVARS_AIRSTRAFEACCEL_QW: //0 + case STAT_MOVEVARS_AIRCONTROL_POWER: //2 + case STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL: //0 + case STAT_MOVEVARS_WARSOWBUNNY_ACCEL: //0 + case STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED: //0 + case STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL: //0 + case STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO: //0 + case STAT_MOVEVARS_AIRSTOPACCELERATE: //0 + case STAT_MOVEVARS_AIRSTRAFEACCELERATE: //0 + case STAT_MOVEVARS_MAXAIRSTRAFESPEED: //0 + case STAT_MOVEVARS_AIRCONTROL: //0 + case STAT_MOVEVARS_WALLFRICTION: //0 + case STAT_MOVEVARS_TIMESCALE: //sv_gamespeed + case STAT_MOVEVARS_JUMPVELOCITY: //270 + case STAT_MOVEVARS_EDGEFRICTION: //2 + case STAT_MOVEVARS_MAXAIRSPEED: //30 + case STAT_MOVEVARS_AIRACCEL_QW: //1 + case STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION: //0 + break; + + case STAT_MOVEVARS_STEPHEIGHT: //18 + movevars.stepheight = value; + break; + case STAT_MOVEVARS_TICRATE: //cl_maxfps limiter hint + if (value <= 0) + cls.maxfps = 1.0/value; + else + cls.maxfps = 72; + break; + case STAT_MOVEFLAGS: +// movevars.flags = ivalue; + break; case STAT_MOVEVARS_GRAVITY: movevars.gravity = value; break; @@ -5259,9 +5301,9 @@ static void CL_SetStatNumeric (int pnum, int stat, int ivalue, float fvalue) if (cls.protocol == CP_NETQUAKE && CPNQ_IS_DP) { if (cls.fteprotocolextensions2 & PEXT2_PREDINFO) - CL_SetStatMovevar(pnum, stat, fvalue); + CL_SetStatMovevar(pnum, stat, ivalue, fvalue); else - CL_SetStatMovevar(pnum, stat, *(float*)&ivalue); //DP sucks. + CL_SetStatMovevar(pnum, stat, ivalue, *(float*)&ivalue); //DP sucks. } #endif } diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 4454f1f07..0bcb565e2 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -2479,20 +2479,6 @@ void CLQ2_ParseSteam(void) Con_Printf("FIXME: CLQ2_ParseSteam: stub\n"); } -static struct{ - qbyte colour; - char *name; -} q2splash_info[] = -{ - {0x00, "q2part.te_splashunknown"}, - {0xe0, "q2part.te_splashsparks"}, - {0xb0, "q2part.te_splashbluewater"}, - {0x50, "q2part.te_splashbrownwater"}, - {0xd0, "q2part.te_splashslime"}, - {0xe0, "q2part.te_splashlava"}, - {0xe8, "q2part.te_splashblood"} -}; - void CLQ2_ParseTEnt (void) { beam_t *b; diff --git a/engine/client/in_win.c b/engine/client/in_win.c index 7bdbf5844..a5ac089a9 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -98,7 +98,7 @@ HRESULT (WINAPI *pDirectInputCreate)(HINSTANCE hinst, DWORD dwVersion, // mouse variables static cvar_t in_dinput = CVARFD("in_dinput","0", CVAR_ARCHIVE, "Enables the use of dinput for mouse movements"); -static cvar_t in_xinput = CVARFD("in_xinput","0", CVAR_ARCHIVE, "Enables the use of xinput for controllers.\nNote that if you have a headset plugged in, that headset will be used for audio playback if no specific audio device is configured."); +static cvar_t in_xinput = CVARFD("in_xinput","1", CVAR_ARCHIVE, "Enables the use of xinput for controllers.\nNote that if you have a headset plugged in, that headset will be used for audio playback if no specific audio device is configured."); static cvar_t in_builtinkeymap = CVARF("in_builtinkeymap", "0", CVAR_ARCHIVE); static cvar_t in_simulatemultitouch = CVAR("in_simulatemultitouch", "0"); static cvar_t in_nonstandarddeadkeys = CVARD("in_nonstandarddeadkeys", "1", "Discard input events that result in multiple keys. Only the last key will be used. This results in behaviour that differs from eg notepad. To use a dead key, press it twice instead of the dead key followed by space."); @@ -2280,6 +2280,7 @@ static int MapKey (int vkey) } if (key == 0) Con_DPrintf("key 0x%02x has no translation\n", key); + return key; } diff --git a/engine/client/keys.c b/engine/client/keys.c index 5d8cc13b6..ddde43b07 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -205,7 +205,7 @@ keyname_t keynames[] = {"POWER", K_POWER}, {"VOLUP", K_VOLUP}, {"VOLDOWN", K_VOLDOWN}, - + {"JOY1", K_JOY1}, {"JOY2", K_JOY2}, {"JOY3", K_JOY3}, @@ -1203,7 +1203,7 @@ qboolean Key_EntryLine(unsigned char **line, int lineoffset, int *linepos, int k qboolean shift = keydown[K_LSHIFT] || keydown[K_RSHIFT]; char utf8[8]; - if (key == K_LEFTARROW || key == K_KP_LEFTARROW) + if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT) { if (ctrl) { @@ -1560,7 +1560,7 @@ qboolean Key_Console (console_t *con, unsigned int unicode, int key) return false; } - if (key == K_ENTER || key == K_KP_ENTER) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START) { // backslash text are commands, else chat int oldl = edit_line; @@ -1626,7 +1626,7 @@ qboolean Key_Console (console_t *con, unsigned int unicode, int key) if (key != K_CTRL && key != K_SHIFT && con_commandmatch) con_commandmatch=1; - if (key == K_UPARROW || key == K_KP_UPARROW) + if (key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP) { do { @@ -1644,7 +1644,7 @@ qboolean Key_Console (console_t *con, unsigned int unicode, int key) return true; } - if (key == K_DOWNARROW || key == K_KP_DOWNARROW) + if (key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN) { if (history_line == edit_line) { @@ -1697,7 +1697,7 @@ void Key_Message (int key, int unicode) chat_bufferpos = 0; } - if (key == K_ENTER || key == K_KP_ENTER) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START) { if (chat_buffer && chat_buffer[0]) { //send it straight into the command. @@ -1727,7 +1727,7 @@ void Key_Message (int key, int unicode) return; } - if (key == K_ESCAPE) + if (key == K_ESCAPE || key == K_GP_BACK) { Key_Dest_Remove(kdm_message); chat_bufferpos = 0; @@ -2254,6 +2254,14 @@ void Key_Init (void) consolekeys['`'] = false; consolekeys['~'] = false; + //most gamepad keys are not console keys, just because. + consolekeys[K_GP_DPAD_UP] = true; + consolekeys[K_GP_DPAD_DOWN] = true; + consolekeys[K_GP_DPAD_LEFT] = true; + consolekeys[K_GP_DPAD_RIGHT] = true; + consolekeys[K_GP_START] = true; + consolekeys[K_GP_BACK] = true; + for (i=K_MOUSE1 ; idint != downloadablessequence) return false; //probably stale p = c->dptr; - if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { if (p->alternative && (p->flags & DPF_HIDDEN)) p = p->alternative; @@ -3054,7 +3054,7 @@ static void MD_AutoUpdate_Draw (int x, int y, struct menucustom_s *c, struct men } static qboolean MD_AutoUpdate_Key (struct menucustom_s *c, struct menu_s *m, int key, unsigned int unicode) { - if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { char nv[8] = "0"; if (pm_autoupdate.ival < UPD_TESTING && pm_autoupdate.ival >= 0) @@ -3069,7 +3069,7 @@ static qboolean MD_AutoUpdate_Key (struct menucustom_s *c, struct menu_s *m, int qboolean MD_PopMenu (union menuoption_s *mo,struct menu_s *m,int key) { - if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { M_RemoveMenu(m); return true; @@ -3079,7 +3079,7 @@ qboolean MD_PopMenu (union menuoption_s *mo,struct menu_s *m,int key) static qboolean MD_ApplyDownloads (union menuoption_s *mo,struct menu_s *m,int key) { - if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { PM_PromptApplyChanges(); return true; @@ -3089,7 +3089,7 @@ static qboolean MD_ApplyDownloads (union menuoption_s *mo,struct menu_s *m,int k static qboolean MD_MarkUpdatesButton (union menuoption_s *mo,struct menu_s *m,int key) { - if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { PM_MarkUpdates(); return true; @@ -3098,7 +3098,7 @@ static qboolean MD_MarkUpdatesButton (union menuoption_s *mo,struct menu_s *m,in } static qboolean MD_RevertUpdates (union menuoption_s *mo,struct menu_s *m,int key) { - if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { PM_RevertChanges(); return true; diff --git a/engine/client/m_items.c b/engine/client/m_items.c index 146c32ca8..312cc9048 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -1366,7 +1366,7 @@ void MC_Slider_Key(menuslider_t *option, int key) else delta = 0.1; - if (key == K_LEFTARROW || key == K_MWHEELDOWN) + if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT || key == K_MWHEELDOWN) { range -= delta; if (option->min > option->max) @@ -1375,7 +1375,7 @@ void MC_Slider_Key(menuslider_t *option, int key) range = bound(option->min, range, option->max); option->current = range; } - else if (key == K_RIGHTARROW || key == K_MWHEELUP) + else if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT || key == K_MWHEELUP) { range += delta; if (option->min > option->max) @@ -1394,7 +1394,7 @@ void MC_Slider_Key(menuslider_t *option, int key) range = bound(option->min, range, option->max); option->current = range; } - else if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + else if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { if (range == option->max) range = option->min; @@ -1422,7 +1422,7 @@ void MC_Slider_Key(menuslider_t *option, int key) void MC_CheckBox_Key(menucheck_t *option, menu_t *menu, int key) { - if (key != K_ENTER && key != K_KP_ENTER && key != K_LEFTARROW && key != K_RIGHTARROW && key != K_MWHEELUP && key != K_MWHEELDOWN && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_LEFTARROW && key != K_KP_LEFTARROW && key != K_GP_DPAD_LEFT && key != K_RIGHTARROW && key != K_KP_LEFTARROW && key != K_GP_DPAD_RIGHT && key != K_MWHEELUP && key != K_MWHEELDOWN && key != K_MOUSE1) return; if (option->func) option->func(option, menu, CHK_TOGGLE); @@ -1488,7 +1488,7 @@ void MC_EditBox_Key(menuedit_t *edit, int key, unsigned int unicode) void MC_Combo_Key(menucombo_t *combo, int key) { - if (key == K_ENTER || key == K_KP_ENTER || key == K_RIGHTARROW || key == K_MWHEELDOWN || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT || key == K_MWHEELDOWN || key == K_MOUSE1) { combo->selectedoption++; if (combo->selectedoption >= combo->numoptions) @@ -1499,7 +1499,7 @@ changed: Cvar_Set(combo->cvar, (char *)combo->values[combo->selectedoption]); S_LocalSound ("misc/menu2.wav"); } - else if (key == K_LEFTARROW || key == K_MWHEELUP) + else if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT || key == K_MWHEELUP) { combo->selectedoption--; if (combo->selectedoption < 0) @@ -1738,7 +1738,7 @@ void M_Complex_Key(int key, int unicode) if (currentmenu->key(key, currentmenu)) return; - if (currentmenu->selecteditem && currentmenu->selecteditem->common.type == mt_custom && (key == K_DOWNARROW || key == K_UPARROW || key == K_TAB)) + if (currentmenu->selecteditem && currentmenu->selecteditem->common.type == mt_custom && (key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN || key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP || key == K_TAB)) if (currentmenu->selecteditem->custom.key) if (currentmenu->selecteditem->custom.key(¤tmenu->selecteditem->custom, currentmenu, key, unicode)) return; @@ -1786,6 +1786,7 @@ void M_Complex_Key(int key, int unicode) { case K_MOUSE2: case K_ESCAPE: + case K_GP_BACK: //remove M_RemoveMenu(currentmenu); #ifdef HEXEN2 @@ -1797,6 +1798,8 @@ void M_Complex_Key(int key, int unicode) break; case K_TAB: case K_DOWNARROW: + case K_KP_DOWNARROW: + case K_GP_DPAD_DOWN: currentmenu->selecteditem = M_NextSelectableItem(currentmenu, currentmenu->selecteditem); if (currentmenu->selecteditem) @@ -1813,6 +1816,8 @@ void M_Complex_Key(int key, int unicode) } break; case K_UPARROW: + case K_KP_UPARROW: + case K_GP_DPAD_UP: currentmenu->selecteditem = M_PrevSelectableItem(currentmenu, currentmenu->selecteditem); if (currentmenu->selecteditem) @@ -1876,7 +1881,7 @@ void M_Complex_Key(int key, int unicode) case mt_qbuttonbigfont: if (!currentmenu->selecteditem->button.command) currentmenu->selecteditem->button.key(currentmenu->selecteditem, currentmenu, key); - else if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + else if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { Cbuf_AddText(currentmenu->selecteditem->button.command, RESTRICT_LOCAL); #ifdef HEXEN2 @@ -1898,7 +1903,7 @@ void M_Complex_Key(int key, int unicode) MC_Combo_Key(¤tmenu->selecteditem->combo, key); break; case mt_bind: - if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) bindingactive = true; else if (key == K_BACKSPACE || key == K_DEL) M_UnbindCommand (currentmenu->selecteditem->bind.command); @@ -1915,7 +1920,7 @@ void M_Complex_Key(int key, int unicode) extern int m_save_demonum; qboolean MC_Main_Key (int key, menu_t *menu) //here purly to restart demos. { - if (key == K_ESCAPE || key == K_MOUSE2) + if (key == K_ESCAPE || key == K_GP_BACK || key == K_MOUSE2) { extern cvar_t con_stayhidden; diff --git a/engine/client/m_master.c b/engine/client/m_master.c index 7d20f8c6f..8579d563f 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -356,7 +356,7 @@ static qboolean SL_ServerKey (menucustom_t *ths, menu_t *menu, int key, unsigned } } - else if (key == K_ENTER || key == K_KP_ENTER || (ctrl && (key == 's' || key == 'j')) || key == K_SPACE) + else if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || (ctrl && (key == 's' || key == 'j')) || key == K_SPACE) { server = Master_SortedServer(info->selectedpos); if (server) @@ -735,7 +735,7 @@ static qboolean SL_Key (int key, menu_t *menu) extern qboolean keydown[]; qboolean ctrldown = keydown[K_LCTRL] || keydown[K_RCTRL]; - if (key == K_ESCAPE || key == K_MOUSE2) + if (key == K_ESCAPE || key == K_GP_BACK || key == K_MOUSE2) { serverpreview = false; return true; @@ -766,7 +766,7 @@ static qboolean SL_Key (int key, menu_t *menu) serverpreview = ((serverpreview==3)?1:3); return true; } - else if (key == K_LEFTARROW) + else if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT) { if (--serverpreview < 1) serverpreview = 4; @@ -775,7 +775,7 @@ static qboolean SL_Key (int key, menu_t *menu) Master_FindRoute(server->adr); return true; } - else if (key == K_RIGHTARROW) + else if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT) { if (++serverpreview > 4) serverpreview = 1; @@ -789,7 +789,7 @@ static qboolean SL_Key (int key, menu_t *menu) Master_FindRoute(server->adr); serverpreview = 4; } - else if (key == 'b' || key == 'o' || key == 'j' || key == K_ENTER || key == K_KP_ENTER) //join + else if (key == 'b' || key == 'o' || key == 'j' || key == K_ENTER || key == K_KP_ENTER || key != K_GP_START) //join { if (key == 's' || key == 'o') { @@ -847,7 +847,7 @@ dojoin: return true; } //eat (nearly) all keys - else if (!(key == K_UPARROW || key == K_DOWNARROW)) + else if (!(key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP || key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN)) return true; } if (key == K_HOME) @@ -864,9 +864,9 @@ dojoin: info->selectedpos += 10; else if (key == K_PGUP) info->selectedpos -= 10; - else if (key == K_DOWNARROW) + else if (key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN) info->selectedpos += 1; - else if (key == K_UPARROW) + else if (key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP) info->selectedpos -= 1; else if (key == K_MWHEELUP) info->selectedpos -= 3; diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index c0dabe970..3431718c9 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -1123,13 +1123,13 @@ void Com_CompleateOSFileName(char *name) qboolean M_Media_Key (int key, menu_t *menu) { int dir; - if (key == K_ESCAPE) + if (key == K_ESCAPE || key == K_GP_BACK || key == K_MOUSE2) { return false; } - else if (key == K_RIGHTARROW || key == K_LEFTARROW) + else if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT || key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT) { - if (key == K_RIGHTARROW) + if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT) dir = 1; else dir = -1; switch(selectedoption) @@ -1151,7 +1151,7 @@ qboolean M_Media_Key (int key, menu_t *menu) break; } } - else if (key == K_DOWNARROW) + else if (key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN) { selectedoption++; if (selectedoption>=numtracks) @@ -1163,7 +1163,7 @@ qboolean M_Media_Key (int key, menu_t *menu) if (selectedoption>=numtracks) selectedoption = numtracks-1; } - else if (key == K_UPARROW) + else if (key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP) { selectedoption--; if (selectedoption < MEDIA_MIN) @@ -1203,7 +1203,7 @@ qboolean M_Media_Key (int key, menu_t *menu) } } } - else if (key == K_ENTER || key == K_KP_ENTER || key == K_MOUSE1) + else if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { if (key == K_MOUSE1) { @@ -2706,9 +2706,9 @@ void Media_Send_KeyEvent(cin_t *cin, int button, int unicode, int event) { Media_Send_Reset(cin); } - else if (button == K_LEFTARROW && !event) + else if ((button == K_LEFTARROW || button == K_KP_LEFTARROW || button == K_GP_DPAD_LEFT) && !event) cin->filmstarttime += (cin->playstate == CINSTATE_PAUSE)?-10:10; - else if (button == K_RIGHTARROW && !event) + else if ((button == K_RIGHTARROW || button == K_KP_RIGHTARROW || button == K_GP_DPAD_RIGHT) && !event) cin->filmstarttime -= (cin->playstate == CINSTATE_PAUSE)?-10:10; } void Media_Send_MouseMove(cin_t *cin, float x, float y) diff --git a/engine/client/m_multi.c b/engine/client/m_multi.c index 3e307888b..792ae8779 100644 --- a/engine/client/m_multi.c +++ b/engine/client/m_multi.c @@ -132,7 +132,7 @@ qboolean ApplySetupMenu (union menuoption_s *option,struct menu_s *menu, int key { char bot[64], top[64]; setupmenu_t *info = menu->data; - if (key != K_ENTER && key != K_KP_ENTER) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START) return false; Cvar_Set(&name, info->nameedit->text); Cvar_Set(&team, info->teamedit->text); @@ -225,7 +225,7 @@ qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int ke //but we give the top free reign. //unless they hold shift, in which case it switches around //this allows for whatever you want - if (key == K_ENTER || key == K_KP_ENTER || key == K_RIGHTARROW) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT) { if ((keydown[K_LSHIFT] || keydown[K_RSHIFT]) ^ (ptr == &info->topcolour)) { @@ -249,7 +249,7 @@ qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int ke S_LocalSound ("misc/menu2.wav"); return true; } - if (key == K_LEFTARROW) + if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT) { if ((keydown[K_LSHIFT] || keydown[K_RSHIFT]) ^ (ptr == &info->topcolour)) { @@ -312,13 +312,13 @@ qboolean MSetupQ2_ChangeSkin (struct menucustom_s *option,struct menu_s *menu, i setupmenu_t *info = menu->data; q2skinsearch_t *s = Z_Malloc(sizeof(*s)); COM_EnumerateFiles(va("players/%s/*_i.*", info->modeledit->values[info->modeledit->selectedoption]), q2skin_enumerate, s); - if (key == K_ENTER || key == K_KP_ENTER || key == K_RIGHTARROW) + if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT) { s->match ++; if (s->match>=s->entries) s->match=0; } - else if (key == K_LEFTARROW) + else if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT) { s->match --; if (s->match<=0) @@ -563,7 +563,7 @@ static const char *numplayeroptions[] = { qboolean MultiBeginGame (union menuoption_s *option,struct menu_s *menu, int key) { newmultimenu_t *info = menu->data; - if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_MOUSE1) return false; if (cls.state) diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 728ba37a7..a78b8826a 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -320,19 +320,19 @@ qboolean M_Audio_Key (int key, struct menu_s *menu) } - if (key == K_DOWNARROW) + if (key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN) { info->testsoundsource->common.posy+=10; } - if (key == K_UPARROW) + if (key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP) { info->testsoundsource->common.posy-=10; } - if (key == K_RIGHTARROW) + if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT) { info->testsoundsource->common.posx+=10; } - if (key == K_LEFTARROW) + if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT) { info->testsoundsource->common.posx-=10; } @@ -1000,7 +1000,7 @@ qboolean M_PresetApply (union menuoption_s *op, struct menu_s *menu, int key) { fpsmenuinfo_t *info = (fpsmenuinfo_t*)menu->data; - if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_MOUSE1) return false; Cbuf_AddText("fps_preset ", RESTRICT_LOCAL); @@ -1242,7 +1242,7 @@ qboolean M_VideoApplyShadowLighting (union menuoption_s *op,struct menu_s *menu, { lightingmenuinfo_t *info = (lightingmenuinfo_t*)menu->data; - if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_MOUSE1) return false; #ifdef RTLIGHTS @@ -1672,7 +1672,7 @@ qboolean M_Apply_SP_Cheats (union menuoption_s *op,struct menu_s *menu,int key) { singleplayerinfo_t *info = menu->data; - if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_MOUSE1) return false; switch(info->skillcombo->selectedoption) @@ -1791,7 +1791,7 @@ qboolean M_Apply_SP_Cheats_Q2 (union menuoption_s *op,struct menu_s *menu,int ke { singleplayerq2info_t *info = menu->data; - if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_MOUSE1) return false; switch(info->skillcombo->selectedoption) @@ -1914,7 +1914,7 @@ qboolean M_Apply_SP_Cheats_H2 (union menuoption_s *op,struct menu_s *menu,int ke { singleplayerh2info_t *info = menu->data; - if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_MOUSE1) return false; switch(info->skillcombo->selectedoption) @@ -2395,7 +2395,7 @@ qboolean M_VideoApply (union menuoption_s *op, struct menu_s *menu, int key) extern cvar_t vid_desktopsettings; videomenuinfo_t *info = (videomenuinfo_t*)menu->data; - if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1) + if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_MOUSE1) return false; // force update display options @@ -3385,13 +3385,13 @@ static qboolean M_ModelViewerKey(struct menucustom_s *c, struct menu_s *m, int k mods->boneidx--; else if (key == ']') mods->boneidx++; - else if (key == K_UPARROW) + else if (key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP) mods->pitch += 5; - else if (key == K_DOWNARROW) + else if (key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN) mods->pitch -= 5; - else if (key == K_LEFTARROW) + else if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT) mods->yaw -= 5; - else if (key == K_RIGHTARROW) + else if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT) mods->yaw += 5; else if (key == K_END) { @@ -3646,7 +3646,7 @@ static qboolean Installer_Go(menuoption_t *opt, menu_t *menu, int key) { struct installermenudata *md = menu->data; - if (key == K_MOUSE1 || key == K_ENTER) + if (key == K_MOUSE1 || key == K_ENTER || key == K_GP_START) { extern int startuppending; vfsfile_t *f; diff --git a/engine/client/m_single.c b/engine/client/m_single.c index 4ee3b5f25..88fd9b5ba 100644 --- a/engine/client/m_single.c +++ b/engine/client/m_single.c @@ -643,11 +643,15 @@ static qboolean M_DemoKey(menucustom_t *control, menu_t *menu, int key, unsigned { case K_MWHEELUP: case K_UPARROW: + case K_KP_UPARROW: + case K_GP_DPAD_UP: if (info->selected && info->selected->prev) info->selected = info->selected->prev; break; case K_MWHEELDOWN: case K_DOWNARROW: + case K_KP_DOWNARROW: + case K_GP_DPAD_DOWN: if (info->selected && info->selected->next) info->selected = info->selected->next; break; diff --git a/engine/client/menu.c b/engine/client/menu.c index 1f5e4f16b..d7071350a 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -667,12 +667,15 @@ qboolean M_Help_Key (int key, menu_t *m) switch (key) { case K_ESCAPE: + case K_GP_BACK: case K_MOUSE2: M_Menu_Main_f (); return true; case K_UPARROW: case K_RIGHTARROW: + case K_KP_RIGHTARROW: + case K_GP_DPAD_RIGHT: case K_MOUSE1: S_LocalSound ("misc/menu2.wav"); if (++help_page >= num_help_pages) @@ -681,6 +684,8 @@ qboolean M_Help_Key (int key, menu_t *m) case K_DOWNARROW: case K_LEFTARROW: + case K_KP_LEFTARROW: + case K_GP_DPAD_LEFT: S_LocalSound ("misc/menu2.wav"); if (--help_page < 0) help_page = num_help_pages-1; @@ -991,6 +996,7 @@ qboolean MC_Quit_Key (int key, menu_t *menu) switch (key) { case K_ESCAPE: + case K_GP_BACK: case 'n': case 'N': M_RemoveMenu(menu); @@ -1021,6 +1027,7 @@ qboolean MC_SaveQuit_Key (int key, menu_t *menu) case 'o': case 'O': case K_ESCAPE: + case K_GP_BACK: case K_MOUSE2: M_RemoveMenu(menu); break; diff --git a/engine/client/pr_clcmd.c b/engine/client/pr_clcmd.c index 0ca71b360..cdbc521e8 100644 --- a/engine/client/pr_clcmd.c +++ b/engine/client/pr_clcmd.c @@ -140,7 +140,6 @@ int MP_TranslateFTEtoQCCodes(int code) case K_AUX31: return 814; case K_AUX32: return 815; -#ifndef K_GP_DPAD_UP // these are probably just aliases, so dupe cases. left for completeness. case K_GP_DPAD_UP: return 816; case K_GP_DPAD_DOWN: return 817; case K_GP_DPAD_LEFT: return 818; @@ -157,7 +156,6 @@ int MP_TranslateFTEtoQCCodes(int code) case K_GP_Y: return 829; case K_GP_LEFT_TRIGGER: return 830; case K_GP_RIGHT_TRIGGER:return 831; -#endif case K_VOLUP: return -code; case K_VOLDOWN: return -code; @@ -294,7 +292,6 @@ int MP_TranslateQCtoFTECodes(int code) case 814: return K_AUX31; case 815: return K_AUX32; - //WARNING: these are currently aliases in FTE. case 816: return K_GP_DPAD_UP; case 817: return K_GP_DPAD_DOWN; case 818: return K_GP_DPAD_LEFT; diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index f22b3ec65..bcab0fd3a 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -5321,14 +5321,14 @@ static void QCBUILTIN PF_cs_getplayerstat(pubprogfuncs_t *prinst, struct globalv static void QCBUILTIN PF_V_CalcRefdef(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { //this function is essentially an overcomplicated way to shirk from defining your own view bobbing. csqcedict_t *ent = (csqcedict_t*)G_EDICT(prinst, OFS_PARM0); - enum + /*enum { TELEPORTED, JUMPING, DEAD, INTERMISSION - } flags = G_FLOAT(OFS_PARM1); - csqc_deprecated("V_CalcRefdef is so lame. man up and define your own behaviour.\n"); + } flags = G_FLOAT(OFS_PARM1);*/ + csqc_deprecated("V_CalcRefdef has too much undefined behaviour.\n"); // if (ent->xv->entnum >= 1 && ent->xv->entnum <= MAX_CLIENTS) // CSQC_ChangeLocalPlayer(ent->xv->entnum-1); diff --git a/engine/client/textedit.c b/engine/client/textedit.c index 0368706a3..b3b29c1c3 100644 --- a/engine/client/textedit.c +++ b/engine/client/textedit.c @@ -465,6 +465,8 @@ qboolean Con_Editor_Key(console_t *con, unsigned int unicode, int key) Con_EditorMoveCursor(con, con->userline, con->userline->length, shiftdown, false); return true; case K_UPARROW: + case K_KP_UPARROW: + case K_GP_DPAD_UP: if (con->userline->older) { if (con->useroffset > con->userline->older->length) @@ -474,6 +476,8 @@ qboolean Con_Editor_Key(console_t *con, unsigned int unicode, int key) } return true; case K_DOWNARROW: + case K_KP_DOWNARROW: + case K_GP_DPAD_DOWN: if (con->userline->newer) { if (con->useroffset > con->userline->newer->length) @@ -483,6 +487,8 @@ qboolean Con_Editor_Key(console_t *con, unsigned int unicode, int key) } return true; case K_LEFTARROW: + case K_KP_LEFTARROW: + case K_GP_DPAD_LEFT: if (con->useroffset == 0) { if (con->userline->older) @@ -492,6 +498,8 @@ qboolean Con_Editor_Key(console_t *con, unsigned int unicode, int key) Con_EditorMoveCursor(con, con->userline, con->useroffset-1, shiftdown, true); return true; case K_RIGHTARROW: + case K_KP_RIGHTARROW: + case K_GP_DPAD_RIGHT: if (con->useroffset == con->userline->length) { if (con->userline->newer) diff --git a/engine/common/pmove.c b/engine/common/pmove.c index 2e03d91c5..649a8e0fc 100644 --- a/engine/common/pmove.c +++ b/engine/common/pmove.c @@ -23,6 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. movevars_t movevars; playermove_t pmove; +#define movevars_dpflags MOVEFLAG_QWCOMPAT +#define movevars_edgefriction 2 +#define movevars_maxairspeed 30 +#define movevars_jumpspeed 270 + float frametime; vec3_t forward, right, up; @@ -294,8 +299,8 @@ int PM_SlideMove (void) && Length(pmove.velocity)>200 && pmove.cmd.buttons & 2 && !pmove.jump_held && !pmove.waterjumptime) { PM_ClipVelocity (original_velocity, planes[i], pmove.velocity, 2); - if (pmove.velocity[2] < 270) - pmove.velocity[2] = 270; + if (pmove.velocity[2] < movevars_jumpspeed) + pmove.velocity[2] = movevars_jumpspeed; pmove.jump_msec = pmove.cmd.msec; pmove.jump_held = true; pmove.waterjumptime = 0; @@ -503,18 +508,31 @@ void PM_Friction (void) else if (pmove.onground) { // apply ground friction friction = movevars.friction; - - // if the leading edge is over a dropoff, increase friction - start[0] = stop[0] = pmove.origin[0] + pmove.velocity[0]/speed*16; - start[1] = stop[1] = pmove.origin[1] + pmove.velocity[1]/speed*16; - //FIXME: gravitydir. - //id bug: this is a tracebox, NOT a traceline. - start[2] = pmove.origin[2] + pmove.player_mins[2]; - stop[2] = start[2] - 34; - trace = PM_PlayerTrace (start, stop, MASK_PLAYERSOLID); - if (trace.fraction == 1 && !trace.startsolid) - friction *= 2; - + if (movevars_edgefriction != 1.0) + { + // if the leading edge is over a dropoff, increase friction + start[0] = stop[0] = pmove.origin[0] + pmove.velocity[0]/speed*16; + start[1] = stop[1] = pmove.origin[1] + pmove.velocity[1]/speed*16; + //FIXME: gravitydir. + //id quirk: this is a tracebox, NOT a traceline, yet still starts BELOW the player. + start[2] = pmove.origin[2] + pmove.player_mins[2]; + stop[2] = start[2] - 34; + if (movevars_dpflags & MOVEFLAG_QWEDGEBOX) //quirky qw behaviour uses a tracebox, which + trace = PM_PlayerTrace (start, stop, MASK_PLAYERSOLID); + else + { + vec3_t min, max; + VectorCopy(pmove.player_mins, min); + VectorCopy(pmove.player_maxs, max); + VectorClear(pmove.player_mins); + VectorClear(pmove.player_maxs); + trace = PM_PlayerTrace (start, stop, MASK_PLAYERSOLID); + VectorCopy(min, pmove.player_mins); + VectorCopy(max, pmove.player_maxs); + } + if (trace.fraction == 1 && !trace.startsolid) + friction *= movevars_edgefriction; + } control = speed < movevars.stopspeed ? movevars.stopspeed : speed; drop = control*friction*frametime; } @@ -581,8 +599,8 @@ void PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) else originalspeed = 0; //shh compiler. - if (wishspd > 30) - wishspd = 30; + if (wishspd > movevars_maxairspeed) + wishspd = movevars_maxairspeed; currentspeed = DotProduct (pmove.velocity, wishdir); addspeed = wishspd - currentspeed; if (addspeed <= 0) @@ -1070,15 +1088,15 @@ void PM_CheckJump (void) } pmove.onground = false; - VectorMA(pmove.velocity, -270, pmove.gravitydir, pmove.velocity); + VectorMA(pmove.velocity, -movevars_jumpspeed, pmove.gravitydir, pmove.velocity); if (movevars.ktjump > 0 && pmove.pm_type != PM_WALLWALK) { if (movevars.ktjump > 1) movevars.ktjump = 1; - if (pmove.velocity[2] < 270) + if (pmove.velocity[2] < movevars_jumpspeed) pmove.velocity[2] = pmove.velocity[2] * (1 - movevars.ktjump) - + 270 * movevars.ktjump; + + movevars_jumpspeed * movevars.ktjump; } pmove.jump_held = true; // don't jump again until released diff --git a/engine/common/pmove.h b/engine/common/pmove.h index 977339776..9780be5d7 100644 --- a/engine/common/pmove.h +++ b/engine/common/pmove.h @@ -96,6 +96,7 @@ typedef struct } playermove_t; typedef struct { + //standard quakeworld float gravity; float stopspeed; float maxspeed; @@ -107,6 +108,8 @@ typedef struct { float waterfriction; float flyfriction; float entgravity; + + //extended stuff, sent via serverinfo float bunnyspeedcap; float watersinkspeed; float ktjump; @@ -115,8 +118,16 @@ typedef struct { qboolean airstep; qboolean slidyslopes; int stepheight; + + unsigned int flags; } movevars_t; +#define MOVEFLAG_VALID 0x80000000 //to signal that these are actually known. otherwise reserved. +#define MOVEFLAG_Q2AIRACCELERATE 0x00000001 +#define MOVEFLAG_NOGRAVITYONGROUND 0x00000002 //no slope sliding +#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE 0x00000004 //apply half-gravity both before AND after the move, which better matches the curve +#define MOVEFLAG_QWEDGEBOX 0x00010000 //calculate edgefriction using tracebox and a buggy start pos +#define MOVEFLAG_QWCOMPAT (MOVEFLAG_VALID|MOVEFLAG_NOGRAVITYONGROUND|MOVEFLAG_QWEDGEBOX) extern movevars_t movevars; extern playermove_t pmove; diff --git a/engine/dotnet2005/droid.vcproj b/engine/dotnet2005/droid.vcproj index 484aac299..bb21b60c6 100644 --- a/engine/dotnet2005/droid.vcproj +++ b/engine/dotnet2005/droid.vcproj @@ -23,7 +23,7 @@ > memfree(basictypetable); } break; + case PST_QTEST: //not likely to need this + case PST_KKQWSV: //fixme... + case PST_FTE32: //fingers crossed... + break; } } diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index ade84f5e9..39be7a3f1 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -1509,7 +1509,7 @@ static void PDECL PR_DoSpawnInitialEntity(pubprogfuncs_t *progfuncs, struct edic if (ctx->SV_OnEntityPreSpawnFunction) { - void *pr_globals = PR_globals(progfuncs, PR_CURRENT); +// void *pr_globals = PR_globals(progfuncs, PR_CURRENT); *sv.world.g.self = EDICT_TO_PROG(progfuncs, ed); PR_ExecuteProgram(progfuncs, ctx->SV_OnEntityPreSpawnFunction); if (ed->ereftype == ER_FREE) @@ -1613,7 +1613,7 @@ static void PDECL PR_DoSpawnInitialEntity(pubprogfuncs_t *progfuncs, struct edic if (ctx->SV_OnEntityPostSpawnFunction) { - void *pr_globals = PR_globals(progfuncs, PR_CURRENT); +// void *pr_globals = PR_globals(progfuncs, PR_CURRENT); if (ed->ereftype == ER_FREE) return; *sv.world.g.self = EDICT_TO_PROG(progfuncs, ed); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 5fdfe77bb..e75be8980 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -70,7 +70,7 @@ cvar_t sv_mintic = CVARD("sv_mintic","0.013", "The minimum interval between #else cvar_t sv_mintic = CVARD("sv_mintic","0", "The minimum interval between running physics frames."); //client builds can think as often as they want. #endif -cvar_t sv_maxtic = CVARD("sv_maxtic","0.1", "The maximum interval between running physics frames. If the value is too low, multiple physics interations might be run at a time (based upon sv_limittics). Set identical to sv_mintic for fixed-interval ticks, which may be required if ODE is used.");//never run a tick slower than this +cvar_t sv_maxtic = CVARD("sv_maxtic","0.1", "The maximum interval between running physics frames. If the value is too low, multiple physics interations might be run at a time (based upon sv_limittics). Set to 0 for fixed-interval ticks, which may be required if ODE is used.");//never run a tick slower than this cvar_t sv_limittics = CVARD("sv_limittics","3", "The maximum number of ticks that may be run within a frame, to allow the server to catch up if it stalled or if sv_maxtic is too low.");// cvar_t sv_nailhack = CVARD("sv_nailhack","0", "If set to 1, disables the nail entity networking optimisation. This hack was popularised by qizmo which recommends it for better compression. Also allows clients to interplate nail positions and add trails."); diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 3fdca2561..62bd8ce2f 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -2408,6 +2408,9 @@ qboolean SV_Physics (void) qboolean moved = false; int maxtics; double trueframetime = host_frametime; + double maxtic = sv_maxtic.value; + if (maxtic < sv_mintic.value) + maxtic = sv_mintic.value; //keep gravity tracking the cvar properly movevars.gravity = sv_gravity.value; @@ -2418,6 +2421,9 @@ qboolean SV_Physics (void) #endif ) //make tics multiples of sv_maxtic (defaults to 0.1) { + if (svs.gametype == GT_QUAKE2) + maxtic = 0.1; //fucking fuckity fuck. we should warn about this. + host_frametime = sv.time - sv.world.physicstime; if (host_frametime<0) { @@ -2426,14 +2432,14 @@ qboolean SV_Physics (void) host_frametime = 0; } if (svs.gametype != GT_QUAKE3) - if (host_frametime < sv_maxtic.value && realtime) + if (host_frametime < maxtic && realtime) { // sv.time+=host_frametime; host_frametime = trueframetime; return false; //don't bother with the whole server thing for a bit longer } - if (host_frametime > sv_maxtic.value) - host_frametime = sv_maxtic.value; + if (host_frametime > maxtic) + host_frametime = maxtic; sv.world.physicstime = sv.time; switch(svs.gametype) @@ -2520,7 +2526,7 @@ qboolean SV_Physics (void) } if (host_frametime <= 0 || host_frametime < sv_mintic.value) break; - if (host_frametime > sv_maxtic.value) + if (host_frametime > maxtic) { if (maxtics-- <= 0) { @@ -2528,7 +2534,7 @@ qboolean SV_Physics (void) sv.world.physicstime = sv.time; break; } - host_frametime = sv_maxtic.value; + host_frametime = maxtic; } if (!host_frametime) continue; diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index 693f73f0e..26fec5b2f 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -2256,30 +2256,53 @@ void SV_CalcClientStats(client_t *client, int statsi[MAX_CL_STATS], float statsf #ifdef NQPROT if (client->protocol == SCP_DARKPLACES7 || (client->fteprotocolextensions2 & PEXT2_PREDINFO)) { + extern cvar_t sv_stepheight; float *statsfi; if (client->fteprotocolextensions2 & PEXT2_PREDINFO) statsfi = statsf; else + { statsfi = (float*)statsi; /*dp requires a union of ints and floats, which is rather hideous...*/ - // statsfi[STAT_MOVEVARS_WALLFRICTION] = sv_wall - statsfi[STAT_MOVEVARS_FRICTION] = sv_friction.value; - statsfi[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value; - statsfi[STAT_MOVEVARS_TICRATE] = 72; - statsfi[STAT_MOVEVARS_TIMESCALE] = sv_gamespeed.value; - statsfi[STAT_MOVEVARS_GRAVITY] = sv_gravity.value; - statsfi[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value; - statsfi[STAT_MOVEVARS_MAXSPEED] = client->maxspeed; - statsfi[STAT_MOVEVARS_SPECTATORMAXSPEED] = sv_spectatormaxspeed.value; - statsfi[STAT_MOVEVARS_ACCELERATE] = sv_accelerate.value; - statsfi[STAT_MOVEVARS_AIRACCELERATE] = sv_airaccelerate.value; - statsfi[STAT_MOVEVARS_WATERACCELERATE] = sv_wateraccelerate.value; - statsfi[STAT_MOVEVARS_ENTGRAVITY] = client->entgravity/sv_gravity.value; - statsfi[STAT_MOVEVARS_JUMPVELOCITY] = 270;//sv_jumpvelocity.value; //bah - statsfi[STAT_MOVEVARS_EDGEFRICTION] = sv_edgefriction.value; - statsfi[STAT_MOVEVARS_MAXAIRSPEED] = client->maxspeed; - statsfi[STAT_MOVEVARS_STEPHEIGHT] = 18; - statsfi[STAT_MOVEVARS_AIRACCEL_QW] = 1; - statsfi[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = sv_gravity.value; + + statsfi[STAT_FRAGLIMIT] = fraglimit.value; + statsfi[STAT_TIMELIMIT] = timelimit.value; + } +//commented out things are basically for xonotic's use. they're not implemented by the server's movement stuff, not in dp, not in fte. +//that's not to say the client shouldn't support them (when mods have hacked up velocity stuff and no willingness to implement the same thing in csqc too). +// statsfi[STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR] = 0; +// statsfi[STAT_MOVEVARS_AIRCONTROL_PENALTY] = 0; +// statsfi[STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW] = 0; +// statsfi[STAT_MOVEVARS_AIRSTRAFEACCEL_QW] = 0; +// statsfi[STAT_MOVEVARS_AIRCONTROL_POWER] = 2; + statsi [STAT_MOVEFLAGS] = MOVEFLAG_QWCOMPAT; +// statsfi[STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL] = 0; +// statsfi[STAT_MOVEVARS_WARSOWBUNNY_ACCEL] = 0; +// statsfi[STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED] = 0; +// statsfi[STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL] = 0; +// statsfi[STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO] = 0; +// statsfi[STAT_MOVEVARS_AIRSTOPACCELERATE] = 0; +// statsfi[STAT_MOVEVARS_AIRSTRAFEACCELERATE] = 0; +// statsfi[STAT_MOVEVARS_MAXAIRSTRAFESPEED] = 0; +// statsfi[STAT_MOVEVARS_AIRCONTROL] = 0; +// statsfi[STAT_MOVEVARS_WALLFRICTION] = 0; + statsfi[STAT_MOVEVARS_FRICTION] = sv_friction.value; + statsfi[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value; + statsfi[STAT_MOVEVARS_TICRATE] = sv_mintic.value?sv_mintic.value:(1.0/72); + statsfi[STAT_MOVEVARS_TIMESCALE] = sv_gamespeed.value; + statsfi[STAT_MOVEVARS_GRAVITY] = sv_gravity.value; + statsfi[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value; + statsfi[STAT_MOVEVARS_MAXSPEED] = client->maxspeed; + statsfi[STAT_MOVEVARS_SPECTATORMAXSPEED] = sv_spectatormaxspeed.value; + statsfi[STAT_MOVEVARS_ACCELERATE] = sv_accelerate.value; + statsfi[STAT_MOVEVARS_AIRACCELERATE] = sv_airaccelerate.value; + statsfi[STAT_MOVEVARS_WATERACCELERATE] = sv_wateraccelerate.value; + statsfi[STAT_MOVEVARS_ENTGRAVITY] = client->entgravity/sv_gravity.value; + statsfi[STAT_MOVEVARS_JUMPVELOCITY] = 270;//sv_jumpvelocity.value; //bah + statsfi[STAT_MOVEVARS_EDGEFRICTION] = sv_edgefriction.value; + statsfi[STAT_MOVEVARS_MAXAIRSPEED] = 30; //max speed before airaccel cuts out. this is hardcoded in qw pmove + statsfi[STAT_MOVEVARS_STEPHEIGHT] = *sv_stepheight.string?sv_stepheight.value:PM_DEFAULTSTEPHEIGHT; + statsfi[STAT_MOVEVARS_AIRACCEL_QW] = 1; //we're a quakeworld engine... + statsfi[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = 0; } #endif diff --git a/plugins/ezhud/hud_editor.c b/plugins/ezhud/hud_editor.c index 024714b06..1d35349f7 100644 --- a/plugins/ezhud/hud_editor.c +++ b/plugins/ezhud/hud_editor.c @@ -2530,6 +2530,7 @@ void HUD_Editor_Key(int key, int unichar, qbool down) switch (key) { case K_ESCAPE: + case K_GP_BACK: HUD_Editor_Toggle_f(); break; case 'p' : @@ -2562,15 +2563,23 @@ void HUD_Editor_Key(int key, int unichar, qbool down) Cvar_SetValue(hud_editor_allowplace, !hud_editor_allowplace->value); break; case K_UPARROW : + case K_KP_UPARROW: + case K_GP_DPAD_UP: // TODO : Add "nudging" in hud editor. break; case K_DOWNARROW : + case K_KP_DOWNARROW: + case K_GP_DPAD_DOWN: // TODO : Add "nudging" in hud editor. break; case K_LEFTARROW : + case K_KP_LEFTARROW: + case K_GP_DPAD_LEFT: // TODO : Add "nudging" in hud editor. break; case K_RIGHTARROW : + case K_KP_RIGHTARROW: + case K_GP_DPAD_RIGHT: // TODO : Add "nudging" in hud editor. break; }