24 Nov 2016

This commit is contained in:
g-cont 2016-11-24 00:00:00 +03:00 committed by Alibek Omarov
parent 1c1721b183
commit 474fc7f123
5 changed files with 55 additions and 23 deletions

View File

@ -32,7 +32,7 @@ TEMPENTS MANAGEMENT
==============================================================
*/
#define MAX_MUZZLEFLASH 4
#define MAX_MUZZLEFLASH 3
#define SHARD_VOLUME 12.0f // on shard ever n^3 units
#define SF_FUNNEL_REVERSE 1
@ -65,7 +65,6 @@ void CL_RegisterMuzzleFlashes( void )
cl_muzzleflash[0] = CL_FindModelIndex( "sprites/muzzleflash1.spr" );
cl_muzzleflash[1] = CL_FindModelIndex( "sprites/muzzleflash2.spr" );
cl_muzzleflash[2] = CL_FindModelIndex( "sprites/muzzleflash3.spr" );
cl_muzzleflash[3] = CL_FindModelIndex( "sprites/muzzleflash.spr" );
// update registration for shellchrome
cls.hChromeSprite = pfnSPR_Load( "sprites/shellchrome.spr" );
@ -760,8 +759,8 @@ void CL_MuzzleFlash( const vec3_t pos, int type )
int index, modelIndex, frameCount;
float scale;
index = bound( 0, type % 5, MAX_MUZZLEFLASH - 1 );
scale = (type / 5) * 0.1f;
index = ( type % 10 ) % MAX_MUZZLEFLASH;
scale = ( type / 10 ) * 0.1f;
if( scale == 0.0f ) scale = 0.5f;
modelIndex = cl_muzzleflash[index];

View File

@ -520,18 +520,19 @@ between frames where are we lerping
float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe, mspriteframe_t **curframe )
{
msprite_t *psprite;
float lerpFrac = 0.0f, frame;
float frametime = (1.0f / 10.0f);
float lerpFrac = 1.0f, frame;
int m_fDoInterp, oldf, newf;
float frametime = 0.0f;
int i, j, iframe;
psprite = ent->model->cache.data;
frame = Q_max( 0.0f, ent->curstate.frame );
iframe = (int)ent->curstate.frame;
if( ent->curstate.framerate > 0.0f )
if( ent->curstate.framerate > 0.0f )
frametime = (1.0f / ent->curstate.framerate);
frame = Q_max( 0.0f, ent->curstate.frame - host.frametime * ent->curstate.framerate );
iframe = (int)frame;
// misc info
if( r_sprite_lerping->integer && psprite->numframes > 1 )
m_fDoInterp = (ent->curstate.effects & EF_NOINTERP) ? false : true;
@ -573,7 +574,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
lerpFrac = 1.0f; // reset lerp
}
if( ent->latched.prevanimtime != 0.0f && ent->latched.prevanimtime >= cl.time )
if( ent->latched.prevanimtime != 0.0f && ent->latched.prevanimtime > cl.time )
lerpFrac = (ent->latched.prevanimtime - cl.time) * ent->curstate.framerate;
// compute lerp factor

View File

@ -257,6 +257,18 @@ convar_t *Cvar_Get( const char *var_name, const char *var_value, int flags, cons
else cvar_vars = var;
var->next = find;
if( var->flags & CVAR_USERINFO )
userinfo->modified = true; // transmit at next oportunity
if( var->flags & CVAR_PHYSICINFO )
physinfo->modified = true; // transmit at next oportunity
if( var->flags & CVAR_SERVERINFO )
serverinfo->modified = true; // transmit at next oportunity
if( var->flags & CVAR_RENDERINFO )
renderinfo->modified = true; // transmit at next oportunity
return var;
}
@ -335,6 +347,18 @@ void Cvar_RegisterVariable( cvar_t *var )
else cvar_vars = (convar_t *)var;
var->next = (cvar_t *)find;
}
if( var->flags & CVAR_USERINFO )
userinfo->modified = true; // transmit at next oportunity
if( var->flags & CVAR_PHYSICINFO )
physinfo->modified = true; // transmit at next oportunity
if( var->flags & CVAR_SERVERINFO )
serverinfo->modified = true; // transmit at next oportunity
if( var->flags & CVAR_RENDERINFO )
renderinfo->modified = true; // transmit at next oportunity
}
/*

View File

@ -251,7 +251,8 @@ gotnewcl:
newcl->delta_sequence = -1;
// parse some info from the info strings (this can override cl_updaterate)
SV_UserinfoChanged( newcl, userinfo );
Q_strncpy( newcl->userinfo, userinfo, sizeof( newcl->userinfo ));
SV_UserinfoChanged( newcl, newcl->userinfo );
newcl->next_messagetime = host.realtime + newcl->cl_updaterate;
@ -358,7 +359,9 @@ edict_t *SV_FakeConnect( const char *netname )
}
// parse some info from the info strings
SV_UserinfoChanged( newcl, userinfo );
Q_strncpy( newcl->userinfo, userinfo, sizeof( newcl->userinfo ));
SV_UserinfoChanged( newcl, newcl->userinfo );
SetBits( cl->flags, FCL_RESEND_USERINFO );
MsgDev( D_NOTE, "Bot %i connecting with challenge %p\n", i, -1 );
@ -366,7 +369,6 @@ edict_t *SV_FakeConnect( const char *netname )
newcl->state = cs_spawned;
newcl->lastmessage = host.realtime; // don't timeout
newcl->lastconnect = host.realtime;
SetBits( newcl->flags, FCL_RESEND_USERINFO );
return ent;
}
@ -952,6 +954,9 @@ void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg )
char info[MAX_INFO_STRING];
int i;
// process userinfo before updating
SV_UserinfoChanged( cl, cl->userinfo );
i = cl - svs.clients;
MSG_WriteByte( msg, svc_updateuserinfo );
@ -1140,6 +1145,9 @@ void SV_PutClientInServer( sv_client_t *cl )
else cl->pViewEntity = NULL;
}
// refresh the userinfo
SetBits( cl->flags, FCL_RESEND_USERINFO );
// reset client times
cl->last_cmdtime = 0.0;
cl->last_movetime = 0.0;
@ -1227,9 +1235,6 @@ void SV_New_f( sv_client_t *cl )
MSG_WriteString( &cl->netchan.message, GI->gamefolder );
MSG_WriteLong( &cl->netchan.message, host.features );
// refresh userinfo on spawn
SV_RefreshUserinfo();
// game server
if( sv.state == ss_active )
{
@ -1792,8 +1797,6 @@ void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo )
if( !userinfo || !userinfo[0] ) return; // ignored
Q_strncpy( cl->userinfo, userinfo, sizeof( cl->userinfo ));
val = Info_ValueForKey( cl->userinfo, "name" );
Q_strncpy( name2, val, sizeof( name2 ));
COM_TrimSpace( name2, name1 );
@ -1901,9 +1904,10 @@ void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo )
// call prog code to allow overrides
svgame.dllFuncs.pfnClientUserInfoChanged( cl->edict, cl->userinfo );
ent->v.netname = MAKE_STRING( cl->name );
if( cl->state >= cs_connected ) SetBits( cl->flags, FCL_RESEND_USERINFO ); // needs for update client info
val = Info_ValueForKey( userinfo, "name" );
Q_strncpy( cl->name, val, sizeof( cl->name ));
ent->v.netname = MAKE_STRING( cl->name );
}
/*
@ -1913,7 +1917,10 @@ SV_UpdateUserinfo_f
*/
static void SV_UpdateUserinfo_f( sv_client_t *cl )
{
SV_UserinfoChanged( cl, Cmd_Argv( 1 ));
Q_strncpy( cl->userinfo, Cmd_Argv( 1 ), sizeof( cl->userinfo ));
if( cl->state >= cs_connected )
SetBits( cl->flags, FCL_RESEND_USERINFO ); // needs for update client info
}
/*
@ -2416,7 +2423,9 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg )
case clc_nop:
break;
case clc_userinfo:
SV_UserinfoChanged( cl, MSG_ReadString( msg ));
Q_strncpy( cl->userinfo, MSG_ReadString( msg ), sizeof( cl->userinfo ));
if( cl->state >= cs_connected )
SetBits( cl->flags, FCL_RESEND_USERINFO ); // needs for update client info
break;
case clc_delta:
cl->delta_sequence = MSG_ReadByte( msg );

View File

@ -304,7 +304,6 @@ void SV_ActivateServer( void )
return;
// custom muzzleflashes
pfnPrecacheModel( "sprites/muzzleflash.spr" );
pfnPrecacheModel( "sprites/muzzleflash1.spr" );
pfnPrecacheModel( "sprites/muzzleflash2.spr" );
pfnPrecacheModel( "sprites/muzzleflash3.spr" );