17 Sep 2015
This commit is contained in:
parent
733b2e6b3b
commit
a4177669ae
|
@ -1,3 +1,10 @@
|
|||
build 3145
|
||||
|
||||
Engine: add support for studiomodels with fixed texcoords multiplier (a studiomodel format extension)
|
||||
Engine: first experimental implementation of client movement predicting code (thx SovietCoder)
|
||||
Engine: first experimental implementation of client movement interpolation code (thx SovietCoder)
|
||||
Engine: some small bugfixes
|
||||
|
||||
build 3030
|
||||
|
||||
Client: remove demoheader.tmp while engine is shutting down
|
||||
|
|
|
@ -35,7 +35,7 @@ qboolean CL_IsPlayerIndex( int idx )
|
|||
|
||||
qboolean CL_IsPredicted( void )
|
||||
{
|
||||
if( !cl_predict->integer || !cl.frame.valid )
|
||||
if( !cl_predict->integer || !cl.frame.valid || cl.background )
|
||||
return false;
|
||||
|
||||
if(( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged ) >= ( CL_UPDATE_BACKUP - 1 ))
|
||||
|
@ -64,6 +64,115 @@ FRAME PARSING
|
|||
|
||||
=========================================================================
|
||||
*/
|
||||
qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, position_history_t **ph0, position_history_t **ph1, int *ph0Index )
|
||||
{
|
||||
qboolean extrapolate;
|
||||
int i, i0, i1, imod;
|
||||
float at;
|
||||
|
||||
imod = ent->current_position - 1;
|
||||
i0 = (imod + 1) & HISTORY_MASK;
|
||||
i1 = imod & HISTORY_MASK;
|
||||
|
||||
extrapolate = true;
|
||||
|
||||
if( ent->ph[i0].animtime >= targettime )
|
||||
{
|
||||
for( i = 0; i < HISTORY_MAX - 2; i++ )
|
||||
{
|
||||
at = ent->ph[imod & HISTORY_MASK].animtime;
|
||||
if( at == 0.0f ) break;
|
||||
|
||||
if( at < targettime )
|
||||
{
|
||||
i0 = (imod + 1) & HISTORY_MASK;
|
||||
i1 = imod & HISTORY_MASK;
|
||||
extrapolate = false;
|
||||
break;
|
||||
}
|
||||
imod--;
|
||||
}
|
||||
}
|
||||
|
||||
if( ph0 != NULL ) *ph0 = &ent->ph[i0];
|
||||
if( ph1 != NULL ) *ph1 = &ent->ph[i1];
|
||||
if( ph0Index != NULL ) *ph0Index = i0;
|
||||
|
||||
return extrapolate;
|
||||
}
|
||||
|
||||
int CL_InterpolateModel( cl_entity_t *e )
|
||||
{
|
||||
position_history_t *ph0, *ph1;
|
||||
vec3_t origin, angles, delta;
|
||||
float t, t1, t2, frac;
|
||||
int i;
|
||||
|
||||
VectorCopy( e->curstate.origin, e->origin );
|
||||
VectorCopy( e->curstate.angles, e->angles );
|
||||
|
||||
if( e->model == NULL )
|
||||
return 1;
|
||||
|
||||
t = cl.time - cl_interp->value;
|
||||
|
||||
if( !CL_FindInterpolationUpdates( e, t, &ph0, &ph1, NULL ))
|
||||
return 0;
|
||||
|
||||
if( ph0 == NULL || ph1 == NULL )
|
||||
return 0;
|
||||
|
||||
t1 = ph0->animtime;
|
||||
t2 = ph1->animtime;
|
||||
|
||||
if( t - t2 < 0.0f )
|
||||
return 0;
|
||||
|
||||
if( t2 == 0.0f || VectorIsNull( ph1->origin ) && !VectorIsNull( ph0->origin ))
|
||||
{
|
||||
VectorCopy( ph0->origin, e->origin );
|
||||
VectorCopy( ph0->angles, e->angles );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( t2 == t1 )
|
||||
{
|
||||
VectorCopy( ph0->origin, e->origin );
|
||||
VectorCopy( ph0->angles, e->angles );
|
||||
return 1;
|
||||
}
|
||||
|
||||
VectorSubtract( ph0->origin, ph1->origin, delta );
|
||||
frac = (t - t2) / (t1 - t2);
|
||||
|
||||
if( frac < 0.0f )
|
||||
return 0;
|
||||
|
||||
if( frac > 1.0f )
|
||||
frac = 1.0f;
|
||||
|
||||
VectorMA( ph1->origin, frac, delta, origin );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
float d, ang1, ang2;
|
||||
|
||||
ang1 = ph0->angles[i];
|
||||
ang2 = ph1->angles[i];
|
||||
d = ang1 - ang2;
|
||||
|
||||
if( d > 180.0f ) d -= 360.0f;
|
||||
else if( d < -180.0f ) d += 360.0f;
|
||||
|
||||
angles[i] = ang2 + d * frac;
|
||||
}
|
||||
|
||||
VectorCopy( origin, e->origin );
|
||||
VectorCopy( angles, e->angles );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CL_UpdateEntityFields( cl_entity_t *ent )
|
||||
{
|
||||
// parametric rockets code
|
||||
|
@ -80,12 +189,11 @@ void CL_UpdateEntityFields( cl_entity_t *ent )
|
|||
VectorAngles( dir, ent->curstate.angles ); // re-aim projectile
|
||||
}
|
||||
|
||||
VectorCopy( ent->curstate.origin, ent->origin );
|
||||
VectorCopy( ent->curstate.angles, ent->angles );
|
||||
|
||||
ent->model = Mod_Handle( ent->curstate.modelindex );
|
||||
ent->curstate.msg_time = cl.time;
|
||||
|
||||
CL_InterpolateModel( ent );
|
||||
|
||||
if( ent->player && RP_LOCALCLIENT( ent )) // stupid Half-Life bug
|
||||
ent->angles[PITCH] = -ent->angles[PITCH] / 3.0f;
|
||||
|
||||
|
@ -523,6 +631,26 @@ void CL_UpdateBmodelVars( cl_entity_t *ent, entity_state_t *newstate, qboolean n
|
|||
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_UpdatePositions
|
||||
|
||||
Store another position into interpolation circular buffer
|
||||
==================
|
||||
*/
|
||||
void CL_UpdatePositions( cl_entity_t *ent )
|
||||
{
|
||||
position_history_t *ph;
|
||||
|
||||
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
||||
|
||||
ph = &ent->ph[ent->current_position];
|
||||
|
||||
VectorCopy( ent->curstate.origin, ph->origin );
|
||||
VectorCopy( ent->curstate.angles, ph->angles );
|
||||
ph->animtime = ent->curstate.animtime;
|
||||
}
|
||||
|
||||
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean unchanged )
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
|
@ -593,6 +721,8 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||
|
||||
// set right current state
|
||||
ent->curstate = *state;
|
||||
|
||||
CL_UpdatePositions( ent );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -36,7 +36,6 @@ void V_SetupRefDef( void )
|
|||
clent = CL_GetLocalPlayer ();
|
||||
|
||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||
VectorCopy( cl.frame.local.client.punchangle, cl.refdef.punchangle );
|
||||
clgame.viewent.curstate.modelindex = cl.frame.local.client.viewmodel;
|
||||
clgame.viewent.model = Mod_Handle( clgame.viewent.curstate.modelindex );
|
||||
clgame.viewent.curstate.number = cl.playernum + 1;
|
||||
|
@ -91,16 +90,18 @@ void V_SetupRefDef( void )
|
|||
V_AdjustFov( &cl.refdef.fov_x, &cl.refdef.fov_y, cl.refdef.viewport[2], cl.refdef.viewport[3], false );
|
||||
|
||||
if( CL_IsPredicted( ) && !cl.refdef.demoplayback )
|
||||
{
|
||||
{
|
||||
VectorCopy( cl.predicted_origin, cl.refdef.simorg );
|
||||
VectorCopy( cl.predicted_velocity, cl.refdef.simvel );
|
||||
VectorCopy( cl.predicted_viewofs, cl.refdef.viewheight );
|
||||
VectorCopy( cl.predicted_punchangle, cl.refdef.punchangle );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy( cl.frame.local.client.origin, cl.refdef.simorg );
|
||||
VectorCopy( cl.frame.local.client.view_ofs, cl.refdef.viewheight );
|
||||
VectorCopy( cl.frame.local.client.velocity, cl.refdef.simvel );
|
||||
VectorCopy( cl.frame.local.client.punchangle, cl.refdef.punchangle );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2107,6 +2107,8 @@ static void R_StudioDrawPoints( void )
|
|||
|
||||
if( g_nFaceFlags & STUDIO_NF_CHROME || ( g_nForceFaceFlags & STUDIO_NF_CHROME ))
|
||||
pglTexCoord2f( g_chrome[ptricmds[1]][0] * s, g_chrome[ptricmds[1]][1] * t );
|
||||
else if( g_nFaceFlags & STUDIO_NF_UV_COORDS )
|
||||
pglTexCoord2f( ptricmds[2] * (1.0f / 32768.0f), ptricmds[3] * (1.0f / 32768.0f));
|
||||
else pglTexCoord2f( ptricmds[2] * s, ptricmds[3] * t );
|
||||
|
||||
if(!( g_nForceFaceFlags & STUDIO_NF_CHROME ))
|
||||
|
|
|
@ -23,7 +23,7 @@ static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|||
int Q_buildnum( void )
|
||||
{
|
||||
// do not touch this! Only author of Xash3D can increase buildnumbers!
|
||||
#if 1
|
||||
#if 0
|
||||
int m = 0, d = 0, y = 0;
|
||||
static int b = 0;
|
||||
|
||||
|
@ -48,6 +48,6 @@ int Q_buildnum( void )
|
|||
|
||||
return b;
|
||||
#else
|
||||
return 3030;
|
||||
return 3145;
|
||||
#endif
|
||||
}
|
|
@ -632,6 +632,7 @@ void Host_WriteOpenGLConfig( void );
|
|||
void Host_WriteVideoConfig( void );
|
||||
void Host_WriteConfig( void );
|
||||
qboolean Host_IsLocalGame( void );
|
||||
qboolean Host_IsLocalClient( void );
|
||||
void Host_ShutdownServer( void );
|
||||
void Host_Print( const char *txt );
|
||||
void Host_Error( const char *error, ... );
|
||||
|
|
|
@ -296,6 +296,14 @@ qboolean Host_IsLocalGame( void )
|
|||
return false;
|
||||
}
|
||||
|
||||
qboolean Host_IsLocalClient( void )
|
||||
{
|
||||
// only the local client have the active server
|
||||
if( CL_Active() && SV_Active())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Host_RegisterDecal
|
||||
|
|
|
@ -431,7 +431,7 @@ pmtrace_t PM_PlayerTraceExt( playermove_t *pmove, vec3_t start, vec3_t end, int
|
|||
else if( pe->solid == SOLID_CUSTOM )
|
||||
{
|
||||
// run custom sweep callback
|
||||
if( pmove->server || Host_IsLocalGame( ))
|
||||
if( pmove->server || Host_IsLocalClient( ))
|
||||
SV_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox );
|
||||
else CL_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox );
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ int PM_TestPlayerPosition( playermove_t *pmove, vec3_t pos, pmtrace_t *ptrace, p
|
|||
trace.fraction = 1.0f;
|
||||
|
||||
// run custom sweep callback
|
||||
if( pmove->server || Host_IsLocalGame( ))
|
||||
if( pmove->server || Host_IsLocalClient( ))
|
||||
SV_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace );
|
||||
else CL_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace );
|
||||
|
||||
|
|
|
@ -1529,7 +1529,18 @@ edict_t* pfnFindClientInPVS( edict_t *pEdict )
|
|||
|
||||
mod = Mod_Handle( pEdict->v.modelindex );
|
||||
|
||||
VectorAdd( pEdict->v.origin, pEdict->v.view_ofs, view );
|
||||
// portals & monitors
|
||||
// NOTE: this specific break "radiaton tick" in normal half-life. use only as feature
|
||||
if(( host.features & ENGINE_TRANSFORM_TRACE_AABB ) && mod && mod->type == mod_brush && !( mod->flags & MODEL_HAS_ORIGIN ))
|
||||
{
|
||||
// handle PVS origin for bmodels
|
||||
VectorAverage( pEdict->v.mins, pEdict->v.maxs, view );
|
||||
VectorAdd( view, pEdict->v.origin, view );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorAdd( pEdict->v.origin, pEdict->v.view_ofs, view );
|
||||
}
|
||||
|
||||
if( pEdict->v.effects & EF_INVLIGHT )
|
||||
view[2] -= 1.0f; // HACKHACK for barnacle
|
||||
|
|
|
@ -71,6 +71,7 @@ Studio models are position independent, so the cache manager can move them.
|
|||
#define STUDIO_NF_NORMALMAP 0x0080 // indexed normalmap
|
||||
#define STUDIO_NF_GLOSSMAP 0x0100 // heightmap that can be used for parallax or normalmap
|
||||
#define STUDIO_NF_GLOSSPOWER 0x0200 // glossmap
|
||||
#define STUDIO_NF_UV_COORDS (1<<31) // using fixed coords instead of ST
|
||||
|
||||
// motion flags
|
||||
#define STUDIO_X 0x0001
|
||||
|
|
|
@ -864,7 +864,7 @@ bool UI_StartBackGroundMap( void )
|
|||
first = FALSE;
|
||||
|
||||
// some map is already running
|
||||
if( !uiStatic.bgmapcount || CVAR_GET_FLOAT( "host_serverstate" ) || gpGlobals->demoplayback )
|
||||
if( !uiStatic.bgmapcount || CL_IsActive() || gpGlobals->demoplayback )
|
||||
return FALSE;
|
||||
|
||||
int bgmapid = RANDOM_LONG( 0, uiStatic.bgmapcount - 1 );
|
||||
|
|
Reference in New Issue