1
0
Fork 0
forked from fte/fteqw

Remove the 'weapon' command and a few others in q2/q3. Never reset pending input angles to 0 (makes mods that use input_angles instead of view_angles work a bit better). Some c++ tweaks for the bullet plugin.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5521 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-08-19 16:15:31 +00:00
parent b497142fa7
commit eeba6c912e
7 changed files with 79 additions and 25 deletions

View file

@ -359,7 +359,7 @@ static void IN_DoPostSelect(void)
}
//The weapon command autoselects a prioritised weapon like multi-arg impulse does.
//however, it potentially makes the switch only on the next +attack.
static void IN_Weapon (void)
void IN_Weapon (void)
{
int newimp;
int pnum = CL_TargettedSplit(false);
@ -412,7 +412,7 @@ static void IN_Weapon (void)
//+fire 8 7 [keycode]
//does impulse 8 or 7 (according to held weapons) along with a +attack
static void IN_FireDown(void)
void IN_FireDown(void)
{
int pnum = CL_TargettedSplit(false);
int k;
@ -460,7 +460,7 @@ static void IN_DoWeaponHide(void)
}
}
//-fire should trigger an impulse 1 or something.
static void IN_FireUp(void)
void IN_FireUp(void)
{
int k;
int impulse;
@ -813,6 +813,16 @@ void CL_GatherButtons (usercmd_t *cmd, int pnum)
cmd->buttons |= bits;
}
void CL_ClearPendingCommands(void)
{
size_t seat, i;
memset(&cl_pendingcmd, 0, sizeof(cl_pendingcmd));
for (seat = 0; seat < countof(cl_pendingcmd); seat++)
{
for (i=0 ; i<3 ; i++)
cl_pendingcmd[seat].angles[i] = ((int)(cl.playerview[seat].viewangles[i]*65536.0/360)&65535);
}
}
/*
================
CL_AdjustAngles
@ -1331,8 +1341,8 @@ void CLNQ_SendCmd(sizebuf_t *buf)
#ifdef CSQC_DAT
CSQC_Input_Frame(seat, cmd);
#endif
memset(&cl_pendingcmd[seat], 0, sizeof(cl_pendingcmd[seat]));
}
CL_ClearPendingCommands();
//inputs are only sent once we receive an entity.
if (cls.signon == 4)
@ -1761,7 +1771,6 @@ qboolean CLQ2_SendCmd (sizebuf_t *buf)
cl.outframes[i].senttime = realtime;
cl.outframes[i].latency = -1;
memset(&cl_pendingcmd[seat], 0, sizeof(cl_pendingcmd[seat]));
if (cmd->buttons)
cmd->buttons |= 128; //fixme: this isn't really what's meant by the anykey.
@ -1776,6 +1785,7 @@ qboolean CLQ2_SendCmd (sizebuf_t *buf)
seq_hash);
}
}
CL_ClearPendingCommands();
if (cl.sendprespawn || !cls.protocol_q2)
buf->cursize = 0; //tastyspleen.net is alergic.
@ -1843,8 +1853,8 @@ qboolean CLQW_SendCmd (sizebuf_t *buf, qboolean actuallysend)
if (!runningindepphys)
CSQC_Input_Frame(plnum, cmd);
#endif
memset(&cl_pendingcmd[plnum], 0, sizeof(cl_pendingcmd[plnum]));
}
CL_ClearPendingCommands();
cmd = &cl.outframes[curframe].cmd[0];
if (cmd->cursor_screen[0] || cmd->cursor_screen[1] || cmd->cursor_entitynumber ||
@ -2369,7 +2379,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
case CP_QUAKE3:
msecs -= (double)msecstouse;
CLQ3_SendCmd(&cl_pendingcmd[0]);
memset(&cl_pendingcmd[0], 0, sizeof(cl_pendingcmd[0]));
CL_ClearPendingCommands();
//don't bank too much, because that results in banking speedcheats
if (msecs > 200)
@ -2590,13 +2600,6 @@ void CL_InitInput (void)
Cmd_AddCommand ("-mlook", IN_MLookUp);
#ifdef QUAKESTATS
//for pseudo-compat with ezquake.
//this stuff is kinda hacky and exploits instand weapon switching to basically try to cheat.
//for some reason this crap is standard, so not a cheat, despite obviously being a cheat.
Cmd_AddCommandD("weapon", IN_Weapon, "Configures weapon priorities for the next +attack as an alternative for the impulse command");
Cmd_AddCommandD("+fire", IN_FireDown, "'+fire 8 7' will fire lg if you have it and fall back on rl if you don't, and just fire your current weapon if neither are held. Releasing fire will then switch away to exploit a bug in most mods to deny your weapon upgrades to your killer.");
Cmd_AddCommand ("-fire", IN_FireUp);
Cvar_Register (&cl_weaponhide, inputnetworkcvargroup);
Cvar_Register (&cl_weaponhide_preference, inputnetworkcvargroup);
Cvar_Register (&cl_weaponpreselect, inputnetworkcvargroup);

View file

@ -1604,6 +1604,54 @@ void CL_ResetFog(int ftype)
*/
}
static void CL_ReconfigureCommands(int newgame)
{
static int oldgame;
extern void SCR_SizeUp_f (void); //cl_screen
extern void SCR_SizeDown_f (void); //cl_screen
extern void IN_Weapon (void); //cl_input
extern void IN_FireDown (void); //cl_input
extern void IN_FireUp (void); //cl_input
extern void CL_Say_f (void);
extern void CL_SayTeam_f (void);
static const struct
{
const char *name;
void (*func) (void);
const char *description;
unsigned int problemgames; //1<<CP_*
} problemcmds[] =
#define Q1 ((1u<<CP_QUAKEWORLD)|(1u<<CP_NETQUAKE))
#define Q2 (1u<<CP_QUAKE2)
#define Q3 (1u<<CP_QUAKE3)
{
{"sizeup", SCR_SizeUp_f, "Increase viewsize", Q3},
{"sizedown", SCR_SizeDown_f, "Decrease viewsize", Q3},
{"weapon", IN_Weapon, "Configures weapon priorities for the next +attack as an alternative for the impulse command", ~Q1},
{"+fire", IN_FireDown, "'+fire 8 7' will fire lg if you have it and fall back on rl if you don't, and just fire your current weapon if neither are held. Releasing fire will then switch away to exploit a bug in most mods to deny your weapon upgrades to your killer.", ~Q1},
{"-fire", IN_FireUp, NULL, ~Q1},
{"say", CL_Say_f, NULL, Q3},
{"say_team", CL_SayTeam_f, NULL, Q3},
};
#undef Q1
#undef Q2
#undef Q3
size_t i;
newgame = 1<<newgame;
for (i = 0; i < countof(problemcmds); i++)
{
if ((problemcmds[i].problemgames & newgame) && !(problemcmds[i].problemgames & oldgame))
Cmd_RemoveCommand(problemcmds[i].name);
if (!(problemcmds[i].problemgames & newgame) && (problemcmds[i].problemgames & oldgame))
Cmd_AddCommandD(problemcmds[i].name, problemcmds[i].func, problemcmds[i].description);
}
oldgame = newgame;
}
/*
=====================
CL_ClearState
@ -1625,6 +1673,8 @@ void CL_ClearState (qboolean gamestart)
#define SV_UnspawnServer()
#endif
CL_ReconfigureCommands(cls.protocol);
CL_UpdateWindowTitle();
CL_AllowIndependantSendCmd(false); //model stuff could be a problem.

View file

@ -180,7 +180,11 @@ cvar_t r_hdr_irisadaptation_minvalue = CVAR ("r_hdr_irisadaptation_minvalue", "
cvar_t r_hdr_irisadaptation_maxvalue = CVAR ("r_hdr_irisadaptation_maxvalue", "4");
cvar_t r_hdr_irisadaptation_fade_down = CVAR ("r_hdr_irisadaptation_fade_down", "0.5");
cvar_t r_hdr_irisadaptation_fade_up = CVAR ("r_hdr_irisadaptation_fade_up", "0.1");
cvar_t r_loadlits = CVARF ("r_loadlit", "1", CVAR_ARCHIVE);
#ifdef RUNTIMELIGHTING
cvar_t r_loadlits = CVARFD("r_loadlit", "1", CVAR_ARCHIVE, "Whether to load lit files.\n0: Do not load external rgb lightmap data.\n1: Load but don't generate.\n2: Generate ldr lighting (if none found).\n3: Generate hdr lighting (if none found).\nNote that regeneration of lightmap data may be unreliable if the map was made for more advanced lighting tools.\nDeluxemap information will also be generated, as appropriate.");
#else
cvar_t r_loadlits = CVARFD("r_loadlit", "1", CVAR_ARCHIVE, "Whether to load lit files.");
#endif
cvar_t r_menutint = CVARF ("r_menutint", "0.68 0.4 0.13",
CVAR_RENDERERCALLBACK);
cvar_t r_netgraph = CVARD ("r_netgraph", "0", "Displays a graph of packet latency. A value of 2 will give additional info about what sort of data is being received from the server.");

View file

@ -115,12 +115,12 @@ typedef unsigned char qbyte;
#ifdef __cplusplus
typedef enum {qfalse, qtrue} qboolean;//false and true are forcivly defined.
//#define true qtrue
//#define false qfalse
#else
typedef enum {qfalse, qtrue} qboolean;
#define true qtrue
#define false qfalse
#else
typedef enum {false, true} qboolean;
#define qtrue true
#define qfalse false
#endif
#define STRINGIFY2(s) #s

View file

@ -150,7 +150,7 @@ void *Sys_CreateMutexNamed(char *file, int line);
#else
#ifdef __GNUC__ //gcc complains about if (true) when these are maros. msvc complains about static not being called in headers. gah.
static inline qboolean Sys_MutexStub(void) {return true;}
static inline qboolean Sys_MutexStub(void) {return qtrue;}
static inline void *Sys_CreateMutex(void) {return NULL;}
#define Sys_IsMainThread() Sys_MutexStub()
#define Sys_DestroyMutex(m) Sys_MutexStub()

View file

@ -2095,7 +2095,7 @@ void Mod_LoadLighting (model_t *loadmodel, bspx_header_t *bspx, qbyte *mod_base,
#ifdef RUNTIMELIGHTING
if ((loadmodel->type == mod_brush && loadmodel->fromgame == fg_quake) || loadmodel->type == mod_heightmap)
{ //we only support a couple of formats. :(
if (!lightmodel && r_loadlits.value == 2 && ((!litdata&&!expdata) || (!luxdata && r_deluxemapping)))
if (!lightmodel && r_loadlits.value >= 2 && ((!litdata&&!expdata) || (!luxdata && r_deluxemapping)))
{
writelitfile = !litdata&&!expdata;
numlightdata = l->filelen;

View file

@ -168,10 +168,7 @@ int Q_vsnprintf(char *buffer, size_t maxlen, const char *format, va_list vargs);
#endif
#ifdef FTEPLUGIN
#define qfalse false
#define qtrue true
#else
#ifndef FTEPLUGIN
#ifdef __cplusplus
typedef enum {qfalse, qtrue} qboolean;
#else