Q2 choke info works, so netgraphs are now sane. Q2 has its own gunkick cvar, so the default doesn't make q2 seem broken. Changed Q1 dlight flickering behaviour - pick a new value no more than 20 times a second (500 updates without vsync was horrible).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3774 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-04-20 03:38:59 +00:00
parent cea945ad5e
commit b59935e30f
5 changed files with 34 additions and 8 deletions

View file

@ -1727,6 +1727,8 @@ void CL_LinkPacketEntities (void)
dlight_t *dl; dlight_t *dl;
vec3_t angles; vec3_t angles;
qboolean nolerp; qboolean nolerp;
static int flickertime;
static int flicker;
float servertime; float servertime;
@ -1751,6 +1753,10 @@ void CL_LinkPacketEntities (void)
servertime = realtime; servertime = realtime;
*/ */
i = servertime*20;
if (flickertime != i)
flicker = rand();
autorotate = anglemod(100*servertime); autorotate = anglemod(100*servertime);
#ifdef CSQC_DAT #ifdef CSQC_DAT
@ -1825,7 +1831,7 @@ void CL_LinkPacketEntities (void)
if (radius) if (radius)
{ {
radius += r_lightflicker.value?(rand()&31):0; radius += r_lightflicker.value?((flicker + state->number)&31):0;
CL_NewDlightRGB(state->number, state->origin, radius, 0.1, colour[0], colour[1], colour[2]); CL_NewDlightRGB(state->number, state->origin, radius, 0.1, colour[0], colour[1], colour[2]);
} }
} }
@ -2664,6 +2670,8 @@ void CL_LinkPlayers (void)
vec3_t angles; vec3_t angles;
qboolean predictplayers; qboolean predictplayers;
model_t *model; model_t *model;
static int flickertime;
static int flicker;
if (!cl.worldmodel || cl.worldmodel->needload) if (!cl.worldmodel || cl.worldmodel->needload)
return; return;
@ -2751,13 +2759,23 @@ void CL_LinkPlayers (void)
vec3_t org; vec3_t org;
VectorCopy(state->origin, org); VectorCopy(state->origin, org);
for (pnum = 0; pnum < cl.splitclients; pnum++) for (pnum = 0; pnum < cl.splitclients; pnum++)
if (cl.playernum[pnum] == j)
VectorCopy(cl.simorg[pnum], org); VectorCopy(cl.simorg[pnum], org);
if (model) if (model)
{ {
org[2] += model->mins[2]; org[2] += model->mins[2];
org[2] += 32; org[2] += 32;
} }
radius += r_lightflicker.value?(rand()&31):0; if (r_lightflicker.value)
{
pnum = realtime*20;
if (flickertime != pnum)
{
flickertime = pnum;
flicker = rand();
}
radius += (flicker+j)&31;
}
CL_NewDlightRGB(j+1, org, radius, 0.1, colour[0], colour[1], colour[2])->flags &= ~LFLAG_ALLOW_FLASH; CL_NewDlightRGB(j+1, org, radius, 0.1, colour[0], colour[1], colour[2])->flags &= ~LFLAG_ALLOW_FLASH;
} }
} }

View file

@ -624,7 +624,6 @@ typedef struct
char q2statusbar[1024]; char q2statusbar[1024];
char q2layout[1024]; char q2layout[1024];
int parse_entities; int parse_entities;
int surpressCount;
float lerpfrac; float lerpfrac;
vec3_t predicted_origin; vec3_t predicted_origin;
vec3_t predicted_angles; vec3_t predicted_angles;

View file

@ -1153,6 +1153,7 @@ void CLQ2_ParseFrame (void)
int cmd; int cmd;
int len; int len;
q2frame_t *old; q2frame_t *old;
int i,j;
memset (&cl.q2frame, 0, sizeof(cl.q2frame)); memset (&cl.q2frame, 0, sizeof(cl.q2frame));
@ -1164,7 +1165,10 @@ void CLQ2_ParseFrame (void)
cl.q2frame.deltaframe = MSG_ReadLong (); cl.q2frame.deltaframe = MSG_ReadLong ();
cl.q2frame.servertime = cl.q2frame.serverframe*100; cl.q2frame.servertime = cl.q2frame.serverframe*100;
cl.surpressCount = MSG_ReadByte (); i = MSG_ReadByte ();
for (j=0 ; j<i ; j++)
cl.frames[ (cls.netchan.incoming_acknowledged-1-j)&UPDATE_MASK ].receivedtime = -2;
if (cl_shownet.value == 3) if (cl_shownet.value == 3)
Con_Printf (" frame:%i delta:%i\n", cl.q2frame.serverframe, Con_Printf (" frame:%i delta:%i\n", cl.q2frame.serverframe,
@ -1951,7 +1955,7 @@ Sets r_refdef view values
*/ */
void CLQ2_CalcViewValues (void) void CLQ2_CalcViewValues (void)
{ {
extern cvar_t v_gunkick; extern cvar_t v_gunkick_q2;
int i; int i;
float lerp, backlerp; float lerp, backlerp;
q2centity_t *ent; q2centity_t *ent;
@ -2019,7 +2023,7 @@ void CLQ2_CalcViewValues (void)
} }
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
r_refdef.viewangles[i] += v_gunkick.value * LerpAngle (ops->kick_angles[i], ps->kick_angles[i], lerp); r_refdef.viewangles[i] += v_gunkick_q2.value * LerpAngle (ops->kick_angles[i], ps->kick_angles[i], lerp);
VectorCopy(r_refdef.vieworg, cl.simorg[0]); VectorCopy(r_refdef.vieworg, cl.simorg[0]);
VectorCopy(r_refdef.viewangles, cl.simangles[0]); VectorCopy(r_refdef.viewangles, cl.simangles[0]);

View file

@ -115,6 +115,9 @@ typedef enum
VF_AFOV = 203, //aproximate fov (match what the engine would normally use for the fov cvar). p0=fov, p1=zoom VF_AFOV = 203, //aproximate fov (match what the engine would normally use for the fov cvar). p0=fov, p1=zoom
} viewflags; } viewflags;
/*FIXME: this should be changed*/
#define CSQC_API_VERSION 1.0f
#define CSQCRF_VIEWMODEL 1 //Not drawn in mirrors #define CSQCRF_VIEWMODEL 1 //Not drawn in mirrors
#define CSQCRF_EXTERNALMODEL 2 //drawn ONLY in mirrors #define CSQCRF_EXTERNALMODEL 2 //drawn ONLY in mirrors
#define CSQCRF_DEPTHHACK 4 //fun depthhack #define CSQCRF_DEPTHHACK 4 //fun depthhack
@ -5311,7 +5314,7 @@ qboolean CSQC_Init (unsigned int checksum)
if (csqcg.init_function) if (csqcg.init_function)
{ {
void *pr_globals = PR_globals(csqcprogs, PR_CURRENT); void *pr_globals = PR_globals(csqcprogs, PR_CURRENT);
G_FLOAT(OFS_PARM0) = 1.0; //api version G_FLOAT(OFS_PARM0) = CSQC_API_VERSION; //api version
(((string_t *)pr_globals)[OFS_PARM1] = PR_TempString(csqcprogs, FULLENGINENAME)); (((string_t *)pr_globals)[OFS_PARM1] = PR_TempString(csqcprogs, FULLENGINENAME));
G_FLOAT(OFS_PARM2) = version_number(); G_FLOAT(OFS_PARM2) = version_number();
PR_ExecuteProgram(csqcprogs, csqcg.init_function); PR_ExecuteProgram(csqcprogs, csqcg.init_function);

View file

@ -91,6 +91,7 @@ cvar_t v_suitcshift = SCVAR("v_suitcshift", "1");
cvar_t v_ringcshift = SCVAR("v_ringcshift", "1"); cvar_t v_ringcshift = SCVAR("v_ringcshift", "1");
cvar_t v_pentcshift = SCVAR("v_pentcshift", "1"); cvar_t v_pentcshift = SCVAR("v_pentcshift", "1");
cvar_t v_gunkick = SCVAR("v_gunkick", "0"); cvar_t v_gunkick = SCVAR("v_gunkick", "0");
cvar_t v_gunkick_q2 = SCVAR("v_gunkick_q2", "1");
cvar_t v_viewheight = SCVAR("v_viewheight", "0"); cvar_t v_viewheight = SCVAR("v_viewheight", "0");
@ -1533,6 +1534,7 @@ void V_Init (void)
Cvar_Register (&v_ringcshift, VIEWVARS); Cvar_Register (&v_ringcshift, VIEWVARS);
Cvar_Register (&v_pentcshift, VIEWVARS); Cvar_Register (&v_pentcshift, VIEWVARS);
Cvar_Register (&v_gunkick, VIEWVARS); Cvar_Register (&v_gunkick, VIEWVARS);
Cvar_Register (&v_gunkick_q2, VIEWVARS);
Cvar_Register (&v_bonusflash, VIEWVARS); Cvar_Register (&v_bonusflash, VIEWVARS);