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
This commit is contained in:
Spoike 2017-08-16 02:14:07 +00:00
parent bc0dd0492c
commit 7c6eb18a76
27 changed files with 397 additions and 213 deletions

View file

@ -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)

View file

@ -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
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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 ; i<K_MOUSE10 ; i++)
{
consolekeys[i] = true;
@ -2663,28 +2671,55 @@ void Key_Event (unsigned int devid, int key, unsigned int unicode, qboolean down
bl = bindcmdlevel[key][modifierstate];
}
//simulate singular shift+alt+ctrl for binds (no left/right). really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
if (key == K_RALT && (!dc || !*dc))
bkey = key;
if (!dc || !*dc)
{
bkey = K_LALT;
dc = keybindings[bkey][modifierstate];
bl = bindcmdlevel[bkey][modifierstate];
}
else if (key == K_RCTRL && (!dc || !*dc))
{
bkey = K_LCTRL;
dc = keybindings[bkey][modifierstate];
bl = bindcmdlevel[bkey][modifierstate];
}
else if (key == K_RSHIFT && (!dc || !*dc))
{
bkey = K_LSHIFT;
dc = keybindings[bkey][modifierstate];
bl = bindcmdlevel[bkey][modifierstate];
}
else
bkey = key;
bl = RESTRICT_LOCAL;
//I've split some keys in the past. Some keys won't be known to csqc/menuqc/configs or whatever so we instead remap them to something else to prevent them from being dead-by-default.
//csqc key codes may even have no standard keycode so cannot easily be bound from qc.
switch(key)
{
//left+right alts got split
case K_RALT:
bkey = K_LALT;
break;
case K_RCTRL:
bkey = K_LCTRL;
break;
case K_RSHIFT:
bkey = K_LSHIFT;
break;
//gamepad buttons should get fallbacks out of the box, even if they're not initially listed on the binds menu.
//these may be redefined later...
case K_GP_START: dc = "togglemenu"; goto defaultedbind;
case K_GP_A: dc = "+button4"; goto defaultedbind;
case K_GP_B: dc = "+button3"; goto defaultedbind;
case K_GP_LEFT_SHOULDER:
case K_GP_X: dc = "+attack"; goto defaultedbind;
case K_GP_RIGHT_SHOULDER:
case K_GP_Y: dc = "+jump"; goto defaultedbind;
case K_GP_BACK: dc = "impulse 10"; goto defaultedbind;
case K_GP_DPAD_UP: dc = "+forward"; goto defaultedbind;
case K_GP_DPAD_DOWN: dc = "+back"; goto defaultedbind;
case K_GP_DPAD_LEFT: dc = "+moveleft"; goto defaultedbind;
case K_GP_DPAD_RIGHT: dc = "+moveright"; goto defaultedbind;
case K_GP_LEFT_TRIGGER: dc = "+left"; goto defaultedbind;
case K_GP_RIGHT_TRIGGER: dc = "+right"; goto defaultedbind;
case K_GP_LEFT_THUMB: dc = "toggleconsole"; goto defaultedbind;
case K_GP_UNKNOWN:
case K_GP_RIGHT_THUMB:
case K_GP_GUIDE: dc = "togglemenu"; goto defaultedbind;
default:
break;
}
dc = keybindings[bkey][modifierstate];
bl = bindcmdlevel[bkey][modifierstate];
}
defaultedbind:
if (key == K_MOUSE1 && IN_MouseDevIsTouch(devid))
{
char *button = SCR_ShowPics_ClickCommand(mousecursor_x, mousecursor_y);

View file

@ -36,28 +36,6 @@ enum
#define GPAXIS_RT_TRIGGER GPAXIS_RT_AUX
};
#if 1
//gamepad alises, because I'm too lazy to define actual keys that are distinct from joysticks
#define K_GP_A K_JOY2
#define K_GP_B K_JOY4
#define K_GP_X K_JOY1
#define K_GP_Y K_JOY3
#define K_GP_LEFT_SHOULDER K_AUX1
#define K_GP_RIGHT_SHOULDER K_AUX2
#define K_GP_LEFT_TRIGGER K_AUX9
#define K_GP_RIGHT_TRIGGER K_AUX10
#define K_GP_BACK K_AUX6
#define K_GP_START K_AUX5
#define K_GP_LEFT_THUMB K_AUX3
#define K_GP_RIGHT_THUMB K_AUX4
#define K_GP_DPAD_UP K_UPARROW
#define K_GP_DPAD_DOWN K_DOWNARROW
#define K_GP_DPAD_LEFT K_LEFTARROW
#define K_GP_DPAD_RIGHT K_RIGHTARROW
#define K_GP_GUIDE K_AUX7
#define K_GP_UNKNOWN K_AUX8
#endif
//
// these are the key numbers that should be passed to Key_Event
//
@ -145,7 +123,6 @@ K_MOUSE10,
K_MWHEELUP,
K_MWHEELDOWN, // 189
#ifndef K_GP_A
K_GP_A = 190,
K_GP_B = 191,
K_GP_X = 192,
@ -159,7 +136,6 @@ K_GP_START = 199,
K_GP_LEFT_THUMB = 200,
K_GP_RIGHT_THUMB = 201,
K_GP_GUIDE = 202,
#endif
//
// joystick buttons
@ -220,13 +196,11 @@ K_PRINTSCREEN = 248,
//K_UNUSED = 249,
//K_UNUSED = 250,
#ifndef K_GP_DPAD_UP
K_GP_DPAD_UP = 251,
K_GP_DPAD_DOWN = 252,
K_GP_DPAD_LEFT = 253,
K_GP_DPAD_RIGHT = 254,
K_GP_UNKNOWN = 255,
#endif
K_MM_BACK,
K_MM_FAVORITES,

View file

@ -2950,7 +2950,7 @@ static qboolean MD_Key (struct menucustom_s *c, struct menu_s *m, int key, unsig
if (c->dint != 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;

View file

@ -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(&currentmenu->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(&currentmenu->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;

View file

@ -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;

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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)

View file

@ -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

View file

@ -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;

View file

@ -23,7 +23,7 @@
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="cd $(InputDir)\.. &amp;&amp; vcify make droid-dbg ANDROID_HOME=C:/Games/tools/android-sdk ANDROID_NDK_ROOT=C:/Games/tools/android-ndk-r8e ANT=C:/Games/tools/apache-ant-1.8.2/bin/ant JAVATOOL=&quot;C:/Program\ Files/Java/jdk1.7.0_02/bin/&quot; -j8 DROID_ARCH=&quot;arm x86&quot;"
BuildCommandLine="cd $(InputDir)\.. &amp;&amp; vcify make droid-dbg ANDROID_HOME=C:/Games/tools/android-sdk ANDROID_NDK_ROOT=C:/Games/tools/android-ndk-r8e ANT=C:/Games/tools/apache-ant-1.8.2/bin/ant JAVATOOL=&quot;C:/Program\ Files/Java/jdk1.7.0_02/bin/&quot; -j8 DROID_ARCH=&quot;armeabi x86&quot;"
ReBuildCommandLine=""
CleanCommandLine="cd $(InputDir)\.. &amp;&amp; vcify make clean -j8"
Output=""

View file

@ -646,8 +646,8 @@ public class FTEDroidActivity extends Activity
private static final int K_SEARCH = 242;
private static final int K_VOLUP = 243;
private static final int K_VOLDOWN = 244;
private static final int K_JOY1 = 203;
/* private static final int K_JOY1 = 203;
private static final int K_JOY2 = 204;
private static final int K_JOY3 = 205;
private static final int K_JOY4 = 206;
@ -655,19 +655,40 @@ public class FTEDroidActivity extends Activity
private static final int K_AUX2 = 208;
private static final int K_AUX3 = 209;
private static final int K_AUX4 = 210;
private static final int K_AUX5 = 211;
*/
private static final int K_GP_A = 190;
private static final int K_GP_B = 191;
private static final int K_GP_X = 192;
private static final int K_GP_Y = 193;
private static final int K_GP_LEFT_SHOULDER = 194;
private static final int K_GP_RIGHT_SHOULDER= 195;
private static final int K_GP_LEFT_TRIGGER = 196;
private static final int K_GP_RIGHT_TRIGGER = 197;
private static final int K_GP_BACK = 198;
private static final int K_GP_START = 199;
private static final int K_GP_LEFT_THUMB = 200;
private static final int K_GP_RIGHT_THUMB = 201;
private static final int K_GP_DPAD_UP = 251;
private static final int K_GP_DPAD_DOWN = 252;
private static final int K_GP_DPAD_LEFT = 253;
private static final int K_GP_DPAD_RIGHT = 254;
private static final int K_GP_GUIDE = 202;
private static final int K_GP_UNKNOWN = 255;
private int mapKey(int acode, int unicode)
{
switch(acode)
{
case KeyEvent.KEYCODE_DPAD_UP:
case 280/*KeyEvent.KEYCODE_SYSTEM_NAVIGATION_UP*/:
return K_UPARROW;
case KeyEvent.KEYCODE_DPAD_DOWN:
case 281/*KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN*/:
return K_DOWNARROW;
case KeyEvent.KEYCODE_DPAD_LEFT:
case 282/*KeyEvent.KEYCODE_SYSTEM_NAVIGATION_LEFT*/:
return K_LEFTARROW;
case KeyEvent.KEYCODE_DPAD_RIGHT:
case 283/*KeyEvent.KEYCODE_SYSTEM_NAVIGATION_RIGHT*/:
return K_RIGHTARROW;
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
return K_ENTER;
@ -685,23 +706,47 @@ public class FTEDroidActivity extends Activity
return K_VOLDOWN; //"voldown"
case KeyEvent.KEYCODE_VOLUME_UP:
return K_VOLUP; //"volup"
case 99/*KeyEvent.KEYCODE_BUTTON_X*/:
return K_JOY1;
case KeyEvent.KEYCODE_DPAD_UP:
return K_GP_DPAD_UP;
case KeyEvent.KEYCODE_DPAD_DOWN:
return K_GP_DPAD_DOWN;
case KeyEvent.KEYCODE_DPAD_LEFT:
return K_GP_DPAD_LEFT;
case KeyEvent.KEYCODE_DPAD_RIGHT:
return K_GP_DPAD_RIGHT;
case 96/*KeyEvent.KEYCODE_BUTTON_A*/:
return K_JOY2;
case 100/*KeyEvent.KEYCODE_BUTTON_Y*/:
return K_JOY3;
return K_GP_A;
case 97/*KeyEvent.KEYCODE_BUTTON_B*/:
return K_JOY4;
return K_GP_B;
// case 98/*KeyEvent.KEYCODE_BUTTON_C*/:
// return K_GP_C;
case 99/*KeyEvent.KEYCODE_BUTTON_X*/:
return K_GP_X;
case 100/*KeyEvent.KEYCODE_BUTTON_Y*/:
return K_GP_Y;
// case 101/*KeyEvent.KEYCODE_BUTTON_Z*/:
// return K_GP_Z;
case 102/*KeyEvent.KEYCODE_BUTTON_L1*/:
return K_AUX1;
return K_GP_LEFT_SHOULDER;
case 103/*KeyEvent.KEYCODE_BUTTON_R1*/:
return K_AUX2;
return K_GP_RIGHT_SHOULDER;
case 104/*KeyEvent.KEYCODE_BUTTON_L2*/:
return K_GP_LEFT_TRIGGER;
case 105/*KeyEvent.KEYCODE_BUTTON_R2*/:
return K_GP_RIGHT_TRIGGER;
case 106/*KeyEvent.KEYCODE_BUTTON_THUMBL*/:
return K_AUX3;
return K_GP_LEFT_THUMB;
case 107/*KeyEvent.KEYCODE_BUTTON_THUMBR*/:
return K_AUX4;
return K_GP_RIGHT_THUMB;
case 108/*KeyEvent.KEYCODE_BUTTON_START*/:
return K_GP_START;
case 109/*KeyEvent.KEYCODE_BUTTON_SELECT*/:
return K_GP_BACK;
case 110/*KeyEvent.KEYCODE_BUTTON_MODE*/:
return K_GP_GUIDE;
// case KeyEvent.KEYCODE_BUTTON_OTHER:
// return K_GP_UNKNOWN;
default:
if (unicode < 128)

View file

@ -3191,6 +3191,10 @@ retry:
externs->memfree(basictypetable);
}
break;
case PST_QTEST: //not likely to need this
case PST_KKQWSV: //fixme...
case PST_FTE32: //fingers crossed...
break;
}
}

View file

@ -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);

View file

@ -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.");

View file

@ -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;

View file

@ -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

View file

@ -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;
}