21 Sep 2018

This commit is contained in:
g-cont 2018-09-21 00:00:00 +03:00 committed by Alibek Omarov
parent 1c17ae3387
commit 64d52e493b
9 changed files with 89 additions and 16 deletions

View File

@ -1060,7 +1060,8 @@ void CL_LinkPacketEntities( frame_t *frame )
continue;
}
// ent->curstate = *state;
// animtime must keep an actual
ent->curstate.animtime = state->animtime;
interpolate = false;
if( !ent->model ) continue;

View File

@ -160,7 +160,7 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg )
char sentenceName[32];
if( flags & SND_SEQUENCE )
Q_snprintf( sentenceName, sizeof( sentenceName ), "!#%i", sound + MAX_SOUNDS );
Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound + MAX_SOUNDS );
else Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
handle = S_RegisterSound( sentenceName );

View File

@ -140,6 +140,8 @@ R_AddEfrags
*/
void R_AddEfrags( cl_entity_t *ent )
{
matrix3x4 transform;
vec3_t outmins, outmaxs;
int i;
if( !ent->model )
@ -149,10 +151,14 @@ void R_AddEfrags( cl_entity_t *ent )
lastlink = &ent->efrag;
r_pefragtopnode = NULL;
// handle entity rotation for right bbox expanding
Matrix3x4_CreateFromEntity( transform, ent->angles, vec3_origin, 1.0f );
Matrix3x4_TransformAABB( transform, ent->model->mins, ent->model->maxs, outmins, outmaxs );
for( i = 0; i < 3; i++ )
{
r_emins[i] = ent->origin[i] + ent->model->mins[i];
r_emaxs[i] = ent->origin[i] + ent->model->maxs[i];
r_emins[i] = ent->origin[i] + outmins[i];
r_emaxs[i] = ent->origin[i] + outmaxs[i];
}
R_SplitEntityOnNode( cl.worldmodel->nodes );
@ -197,7 +203,6 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount )
ppefrag = &pefrag->leafnext;
break;
default:
Host_Error( "R_StoreEfrags: bad entity type %d\n", clmodel->type );
break;
}
}

View File

@ -379,7 +379,7 @@ R_LightVec
check bspmodels to get light from
=================
*/
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot, vec3_t lvec )
colorVec R_LightVecInternal( const vec3_t start, const vec3_t end, vec3_t lspot, vec3_t lvec )
{
float last_fraction;
int i, maxEnts = 1;
@ -452,6 +452,27 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot, vec3_t
return light;
}
/*
=================
R_LightVec
check bspmodels to get light from
=================
*/
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot, vec3_t lvec )
{
colorVec light = R_LightVecInternal( start, end, lspot, lvec );
if( CVAR_TO_BOOL( r_lighting_extended ) && lspot != NULL && lvec != NULL )
{
// trying to get light from ceiling (but ignore gradient analyze)
if(( light.r + light.g + light.b ) == 0 )
return R_LightVecInternal( end, start, lspot, lvec );
}
return light;
}
/*
=================
R_LightPoint

View File

@ -33,7 +33,7 @@ GNU General Public License for more details.
#define MAXDLY (STEREODLY + 1)
#define MAXLP 10
#define MAXPRESETS ARRAYSIZE( rgsxpre )
#define MAXPRESETS 29
typedef struct sx_preset_s
{
@ -79,7 +79,7 @@ typedef struct dly_s
int *lpdelayline;
} dly_t;
const sx_preset_t rgsxpre[] =
const sx_preset_t rgsxpre[MAXPRESETS] =
{
// -------reverb-------- -------delay--------
// lp mod size refl rvblp delay feedback dlylp left
@ -609,16 +609,15 @@ int RVB_DoReverbForOneDly( dly_t *dly, const int vlr, const portable_samplepair_
if( dly->xfade || delay || samplepair->left || samplepair->right )
{
// modulate delay rate
if( !dly->mod )
if( !dly->xfade && !dly->modcur && dly->mod )
{
dly->idelayoutputxf = dly->idelayoutput + ((COM_RandomLong( 0, 255 ) * delay) >> 9 );
if( dly->idelayoutputxf >= dly->cdelaysamplesmax )
dly->idelayoutputxf -= dly->cdelaysamplesmax;
dly->xfade = REVERB_XFADE;
//dly->xfade = 32;
}
dly->idelayoutputxf %= dly->cdelaysamplesmax;
if( dly->xfade )
{
samplexf = (dly->lpdelayline[dly->idelayoutputxf] * (REVERB_XFADE - dly->xfade)) / REVERB_XFADE;
@ -819,6 +818,9 @@ void CheckNewDspPresets( void )
idsp_room = roomwater_type->value;
else idsp_room = room_type->value;
// don't pass invalid presets
idsp_room = bound( 0, idsp_room, MAXPRESETS - 1 );
if( FBitSet( hisound->flags, FCVAR_CHANGED ))
{
sxhires = hisound->value;

View File

@ -132,9 +132,10 @@ void RoundUpHullSize( vec3_t size )
qboolean negative = false;
float result, value;
value = result = size[i];
value = size[i];
if( value < 0.0f ) negative = true;
value = Q_ceil( fabs( value ));
result = Q_ceil( size[i] );
// lookup hull table to find nearest supposed value
for( j = 0; j < NUM_HULL_ROUNDS; j++ )

View File

@ -69,7 +69,7 @@ GNU General Public License for more details.
#define Q_recip( a ) ((float)(1.0f / (float)(a)))
#define Q_floor( a ) ((float)(long)(a))
#define Q_ceil( a ) ((float)(long)((a) + 1))
#define Q_round( x, y ) (floor( x / y + 0.5 ) * y )
#define Q_rint(x) ((x) < 0 ? ((int)((x)-0.5f)) : ((int)((x)+0.5f)))
#define IS_NAN(x) (((*(int *)&x) & (255<<23)) == (255<<23))
@ -167,10 +167,12 @@ void Matrix3x4_ConcatTransforms( matrix3x4 out, const matrix3x4 in1, const matri
void Matrix3x4_FromOriginQuat( matrix3x4 out, const vec4_t quaternion, const vec3_t origin );
void Matrix3x4_CreateFromEntity( matrix3x4 out, const vec3_t angles, const vec3_t origin, float scale );
void Matrix3x4_TransformPositivePlane( const matrix3x4 in, const vec3_t normal, float d, vec3_t out, float *dist );
void Matrix3x4_TransformAABB( const matrix3x4 world, const vec3_t mins, const vec3_t maxs, vec3_t absmin, vec3_t absmax );
void Matrix3x4_SetOrigin( matrix3x4 out, float x, float y, float z );
void Matrix3x4_Invert_Simple( matrix3x4 out, const matrix3x4 in1 );
void Matrix3x4_OriginFromMatrix( const matrix3x4 in, float *out );
void Matrix3x4_AnglesFromMatrix( const matrix3x4 in, vec3_t out );
void Matrix3x4_Transpose( matrix3x4 out, const matrix3x4 in1 );
#define Matrix4x4_LoadIdentity( mat ) Matrix4x4_Copy( mat, matrix4x4_identity )
#define Matrix4x4_Copy( out, in ) memcpy( out, in, sizeof( matrix4x4 ))

View File

@ -251,6 +251,47 @@ void Matrix3x4_Invert_Simple( matrix3x4 out, const matrix3x4 in1 )
out[2][3] = -(in1[0][3] * out[2][0] + in1[1][3] * out[2][1] + in1[2][3] * out[2][2]);
}
void Matrix3x4_Transpose( matrix3x4 out, const matrix3x4 in1 )
{
// transpose only rotational component
out[0][0] = in1[0][0];
out[0][1] = in1[1][0];
out[0][2] = in1[2][0];
out[1][0] = in1[0][1];
out[1][1] = in1[1][1];
out[1][2] = in1[2][1];
out[2][0] = in1[0][2];
out[2][1] = in1[1][2];
out[2][2] = in1[2][2];
// copy origin
out[0][3] = in1[0][3];
out[1][3] = in1[1][3];
out[2][3] = in1[2][3];
}
/*
==================
Matrix3x4_TransformAABB
==================
*/
void Matrix3x4_TransformAABB( const matrix3x4 world, const vec3_t mins, const vec3_t maxs, vec3_t absmin, vec3_t absmax )
{
vec3_t localCenter, localExtents;
vec3_t worldCenter, worldExtents;
VectorAverage( mins, maxs, localCenter );
VectorSubtract( maxs, localCenter, localExtents );
Matrix3x4_VectorTransform( world, localCenter, worldCenter );
worldExtents[0] = DotProductAbs( localExtents, world[0] ); // auto-transposed!
worldExtents[1] = DotProductAbs( localExtents, world[1] );
worldExtents[2] = DotProductAbs( localExtents, world[2] );
VectorSubtract( worldCenter, worldExtents, absmin );
VectorAdd( worldCenter, worldExtents, absmax );
}
const matrix4x4 matrix4x4_identity =
{
{ 1, 0, 0, 0 }, // PITCH

View File

@ -138,7 +138,7 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
}
// if we are full, silently discard entities
if( ents->num_entities < MAX_VISIBLE_PACKET )
if( ents->num_entities < ( MAX_VISIBLE_PACKET - 1 ))
{
ents->num_entities++; // entity accepted
c_fullsend++; // debug counter