25 Aug 2017

This commit is contained in:
g-cont 2017-08-25 00:00:00 +03:00 committed by Alibek Omarov
parent 3f4827918e
commit e608c11e81
10 changed files with 121 additions and 15 deletions

View File

@ -428,7 +428,9 @@ int CL_InterpolateModel( cl_entity_t *e )
if( cl.local.moving && cl.local.onground == e->index )
return 1;
t = cl.time - cl_interp->value;
if( cl.maxclients <= 1 && FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
t = cl.time - cl_serverframetime();
else t = cl.time - cl_interp->value;
CL_FindInterpolationUpdates( e, t, &ph0, &ph1 );
@ -441,7 +443,7 @@ int CL_InterpolateModel( cl_entity_t *e )
if( t - t1 < 0.0f )
return 0;
if( t1 == 0.0f || ( VectorIsNull( ph1->origin ) && !VectorIsNull( ph0->origin )))
if( t1 == 0.0f )
{
VectorCopy( ph0->origin, e->origin );
VectorCopy( ph0->angles, e->angles );

View File

@ -396,9 +396,76 @@ void CL_UpdateFrameLerp( void )
return;
// compute last interpolation amount
cl.commands[(cls.netchan.outgoing_sequence - 1) & CL_UPDATE_MASK].frame_lerp = CL_LerpPoint();
cl.lerpFrac = CL_LerpPoint();
cl.commands[(cls.netchan.outgoing_sequence - 1) & CL_UPDATE_MASK].frame_lerp = cl.lerpFrac;
}
void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t **prev, pred_viewangle_t **next )
{
int i, i0, i1, imod;
float at;
imod = cl.angle_position - 1;
i0 = (imod + 1) & ANGLE_MASK;
i1 = (imod + 0) & ANGLE_MASK;
if( cl.predicted_angle[i0].starttime >= t )
{
for( i = 0; i < ANGLE_BACKUP - 2; i++ )
{
at = cl.predicted_angle[imod & ANGLE_MASK].starttime;
if( at == 0.0f ) break;
if( at < t )
{
i0 = (imod + 1) & ANGLE_MASK;
i1 = (imod + 0) & ANGLE_MASK;
break;
}
imod--;
}
}
*next = &cl.predicted_angle[i0];
*prev = &cl.predicted_angle[i1];
// avoid division by zero (probably this should never happens)
if((*prev)->starttime == (*next)->starttime )
{
*prev = *next;
*frac = 0.0f;
return;
}
// time spans the two entries
*frac = ( t - (*prev)->starttime ) / ((*next)->starttime - (*prev)->starttime );
*frac = bound( 0.0f, *frac, 1.0f );
}
void CL_ApplyAddAngle( void )
{
float curtime = cl.time - cl_serverframetime();
pred_viewangle_t *prev = NULL, *next = NULL;
float addangletotal = 0.0f;
float amove, frac = 0.0f;
CL_FindInterpolatedAddAngle( curtime, &frac, &prev, &next );
if( prev && next )
addangletotal = prev->total + frac * ( next->total - prev->total );
else addangletotal = cl.prevaddangletotal;
amove = addangletotal - cl.prevaddangletotal;
// update input angles
cl.viewangles[YAW] += amove;
// remember last total
cl.prevaddangletotal = addangletotal;
}
/*
=======================================================================
@ -555,6 +622,7 @@ void CL_CreateCmd( void )
pcmd->processedfuncs = false;
pcmd->heldback = false;
pcmd->sendsize = 0;
CL_ApplyAddAngle();
}
active = ( cls.state == ca_active && !cl.paused && !cls.demoplayback );

View File

@ -1037,10 +1037,27 @@ add the view angle yaw
*/
void CL_ParseAddAngle( sizebuf_t *msg )
{
float add_angle;
pred_viewangle_t *a;
float delta_yaw;
add_angle = MSG_ReadBitAngle( msg, 16 );
cl.viewangles[YAW] += add_angle;
delta_yaw = MSG_ReadBitAngle( msg, 16 );
if( cl.maxclients <= 1 && !FBitSet( host.features, ENGINE_FIXED_FRAMERATE ))
{
cl.viewangles[YAW] += delta_yaw;
return;
}
// update running counter
cl.addangletotal += delta_yaw;
// select entry into circular buffer
cl.angle_position = (cl.angle_position + 1) & ANGLE_MASK;
a = &cl.predicted_angle[cl.angle_position];
// record update
a->starttime = cl.mtime[0];
a->total = cl.addangletotal;
}
/*

View File

@ -248,7 +248,7 @@ void CL_CheckPredictionError( void )
// save for error interpolation
VectorCopy( delta, cl.local.prediction_error );
if(( dist > MIN_CORRECTION_DISTANCE ) && ( cl.maxclients > 1 ))
if(( dist > MIN_CORRECTION_DISTANCE ) && (( cl.maxclients > 1 ) || FBitSet( host.features, ENGINE_FIXED_FRAMERATE )))
cls.correction_time = cl_smoothtime->value;
}
}
@ -1329,7 +1329,7 @@ void CL_PredictMovement( qboolean repredicting )
VectorCopy( to->client.velocity, cl.simvel );
VectorCopy( to->playerstate.origin, cl.simorg );
VectorCopy( to->client.punchangle, cl.punchangle );
VectorCopy( to->client.view_ofs, cl.viewheight) ;
VectorCopy( to->client.view_ofs, cl.viewheight );
}
else
{

View File

@ -99,6 +99,13 @@ typedef struct runcmd_s
int sendsize;
} runcmd_t;
// add angles
typedef struct
{
float starttime;
float total;
} pred_viewangle_t;
#define ANGLE_BACKUP 16
#define ANGLE_MASK (ANGLE_BACKUP - 1)
@ -176,6 +183,7 @@ typedef struct
int delta_sequence; // acknowledged sequence number
double mtime[2]; // the timestamp of the last two messages
float lerpFrac;
int last_command_ack;
int last_incoming_sequence;
@ -216,6 +224,11 @@ typedef struct
int intermission; // don't change view angle, full screen, et
vec3_t crosshairangle;
pred_viewangle_t predicted_angle[ANGLE_BACKUP];// accumulate angles from server
int angle_position;
float addangletotal;
float prevaddangletotal;
// predicted origin and velocity
vec3_t simorg;
vec3_t simvel;

View File

@ -1178,7 +1178,7 @@ static qboolean GL_UploadTexture( gltexture_t *tex, rgbdata_t *pic )
if( !ImageDXT( pic->type ) && !FBitSet( tex->flags, TF_NOMIPMAP|TF_SKYSIDE ))
data = GL_ApplyGamma( data, tex->width * tex->height * tex->depth, FBitSet( tex->flags, TF_NORMALMAP ));
if( !ImageDXT( pic->type ) && FBitSet( tex->flags, TF_HAS_ALPHA ))
if( !ImageDXT( pic->type ) && FBitSet( pic->flags, IMAGE_ONEBIT_ALPHA ))
data = GL_ApplyFilter( data, tex->width, tex->height );
// mips will be auto-generated if desired

View File

@ -1247,7 +1247,7 @@ void R_RocketTrail( vec3_t start, vec3_t end, int type )
VectorMAMAM( 1.0f, start, s, right, c, up, p->org );
VectorSubtract( start, p->org, p->vel );
VectorScale( p->vel, 2.0f, p->vel );
VectorMA( p->vel, COM_RandomFloat( 96, 111 ), vec, p->vel );
VectorMA( p->vel, COM_RandomFloat( 96.0f, 111.0f ), vec, p->vel );
p->ramp = COM_RandomLong( 0, 3 );
p->color = ramp3[(int)p->ramp];
p->type = pt_explode2;
@ -1474,6 +1474,7 @@ void R_TracerEffect( const vec3_t start, const vec3_t end )
{
vec3_t pos, vel, dir;
float len, speed;
float offset;
speed = Q_max( tracerspeed->value, 3.0f );
@ -1482,7 +1483,8 @@ void R_TracerEffect( const vec3_t start, const vec3_t end )
if( len == 0.0f ) return;
VectorScale( dir, 1.0f / len, dir ); // normalize
VectorScale( dir, COM_RandomFloat( -10.0f, 9.0f ) + traceroffset->value, vel );
offset = COM_RandomFloat( -10.0f, 9.0f ) + traceroffset->value;
VectorScale( dir, offset, vel );
VectorAdd( start, vel, pos );
VectorScale( dir, speed, vel );

View File

@ -485,6 +485,7 @@ typedef enum
IMAGE_QUAKESKY = BIT(6), // it's a quake sky double layered clouds (so keep it as 8 bit)
IMAGE_DDS_FORMAT = BIT(7), // a hint for GL loader
IMAGE_MULTILAYER = BIT(8), // to differentiate from 3D texture
IMAGE_ONEBIT_ALPHA = BIT(9), // binary alpha
// Image_Process manipulation flags
IMAGE_FLIP_X = BIT(16), // flip the image by width

View File

@ -163,7 +163,7 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
byte *pal = fin + pixels;
Image_GetPaletteLMP( pal, LUMP_MASKED );
image.flags |= IMAGE_HAS_ALPHA;
image.flags |= IMAGE_HAS_ALPHA|IMAGE_ONEBIT_ALPHA;
}
else Image_GetPaletteLMP( fin + pixels, LUMP_NORMAL );
}
@ -229,8 +229,9 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize )
// detect alpha-channel by palette type
switch( image.d_rendermode )
{
case LUMP_GRADIENT:
case LUMP_MASKED:
SetBits( image.flags, IMAGE_ONEBIT_ALPHA );
case LUMP_GRADIENT:
case LUMP_QUAKE1:
SetBits( image.flags, IMAGE_HAS_ALPHA );
break;
@ -384,6 +385,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
if(( !host.decal_loading ) || ( pal[765] == 0 && pal[766] == 0 && pal[767] == 255 ))
{
rendermode = LUMP_MASKED;
image.flags |= IMAGE_ONEBIT_ALPHA;
}
else
{
@ -454,6 +456,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
{
if( fin[i] == 255 )
{
// don't set ONEBIT_ALPHA flag for some reasons
image.flags |= IMAGE_HAS_ALPHA;
break;
}

View File

@ -6,7 +6,7 @@
--------------------Configuration: engine - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\WINDOWS\TEMP\RSP6975.bat" with contents
Creating temporary file "C:\WINDOWS\TEMP\RSP75B3.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Xash3D\xash.dll"
@ -14,7 +14,7 @@ copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Paranoia2\xash.dll"
copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Area51\xash.dll"
copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Quake\xash.dll"
]
Creating command line "C:\WINDOWS\TEMP\RSP6975.bat"
Creating command line "C:\WINDOWS\TEMP\RSP75B3.bat"
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\engine\!release\xash.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.