mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-10 14:12:04 +08:00
engine: use vector initializer macros
This commit is contained in:
@@ -2313,7 +2313,6 @@ static edict_t *SV_GetCrossEnt( edict_t *player )
|
||||
vec3_t vecLOS;
|
||||
vec3_t vecOrigin;
|
||||
float flDot, traceLen;
|
||||
vec3_t boxSize;
|
||||
trace_t trace;
|
||||
vec3_t vecTrace;
|
||||
|
||||
@@ -2339,7 +2338,7 @@ static edict_t *SV_GetCrossEnt( edict_t *player )
|
||||
if( traceLen > maxLen )
|
||||
continue;
|
||||
|
||||
VectorCopy( ent->v.size, boxSize);
|
||||
vec3_t boxSize = Vec3( ent->v.size );
|
||||
VectorScale( boxSize, 0.5, boxSize );
|
||||
|
||||
if ( vecLOS[0] > boxSize[0] )
|
||||
|
||||
@@ -1854,13 +1854,12 @@ int GAME_EXPORT pfnDropToFloor( edict_t *e )
|
||||
{
|
||||
qboolean monsterClip;
|
||||
trace_t trace;
|
||||
vec3_t end;
|
||||
|
||||
if( !SV_IsValidEdict( e ))
|
||||
return 0;
|
||||
|
||||
monsterClip = FBitSet( e->v.flags, FL_MONSTERCLIP ) ? true : false;
|
||||
VectorCopy( e->v.origin, end );
|
||||
vec3_t end = Vec3( e->v.origin );
|
||||
end[2] -= 256.0f;
|
||||
|
||||
trace = SV_Move( e->v.origin, e->v.mins, e->v.maxs, end, MOVE_NORMAL, e, monsterClip );
|
||||
@@ -1887,8 +1886,6 @@ pfnWalkMove
|
||||
*/
|
||||
static int GAME_EXPORT pfnWalkMove( edict_t *ent, float yaw, float dist, int iMode )
|
||||
{
|
||||
vec3_t move;
|
||||
|
||||
if( !SV_IsValidEdict( ent ))
|
||||
return 0;
|
||||
|
||||
@@ -1896,7 +1893,7 @@ static int GAME_EXPORT pfnWalkMove( edict_t *ent, float yaw, float dist, int iMo
|
||||
return 0;
|
||||
|
||||
yaw = DEG2RAD( yaw );
|
||||
VectorSet( move, cos( yaw ) * dist, sin( yaw ) * dist, 0.0f );
|
||||
vec3_t move = { cos( yaw ) * dist, sin( yaw ) * dist, 0.0f };
|
||||
|
||||
switch( iMode )
|
||||
{
|
||||
|
||||
@@ -409,11 +409,10 @@ static qboolean SV_StepDirection( edict_t *ent, float yaw, float dist )
|
||||
{
|
||||
int ret;
|
||||
float cSin, cCos;
|
||||
vec3_t move;
|
||||
|
||||
yaw = yaw * M_PI2 / 360.0f;
|
||||
SinCos( yaw, &cSin, &cCos );
|
||||
VectorSet( move, cCos * dist, cSin * dist, 0.0f );
|
||||
vec3_t move = { cCos * dist, cSin * dist, 0.0f };
|
||||
|
||||
ret = SV_MoveStep( ent, move, false );
|
||||
SV_LinkEdict( ent, true );
|
||||
@@ -519,9 +518,7 @@ static void SV_NewChaseDir( edict_t *actor, vec3_t destination, float dist )
|
||||
|
||||
void SV_MoveToOrigin( edict_t *ent, const vec3_t pflGoal, float dist, int iMoveType )
|
||||
{
|
||||
vec3_t vecDist;
|
||||
|
||||
VectorCopy( pflGoal, vecDist );
|
||||
vec3_t vecDist = Vec3( pflGoal );
|
||||
|
||||
if( ent->v.flags & ( FL_FLY|FL_SWIM|FL_ONGROUND ))
|
||||
{
|
||||
|
||||
@@ -397,13 +397,12 @@ recursively recalculating the middle
|
||||
*/
|
||||
static float SV_RecursiveWaterLevel( vec3_t origin, float out, float in, int count )
|
||||
{
|
||||
vec3_t point;
|
||||
float offset;
|
||||
|
||||
offset = ((out - in) * 0.5f) + in;
|
||||
if( ++count > 5 ) return offset;
|
||||
|
||||
VectorSet( point, origin[0], origin[1], origin[2] + offset );
|
||||
vec3_t point = { origin[0], origin[1], origin[2] + offset };
|
||||
|
||||
if( SV_PointContents( point ) == CONTENTS_WATER )
|
||||
return SV_RecursiveWaterLevel( origin, out, offset, count );
|
||||
@@ -420,7 +419,6 @@ determine how deep the entity is
|
||||
static float SV_Submerged( edict_t *ent )
|
||||
{
|
||||
float start, bottom;
|
||||
vec3_t point;
|
||||
vec3_t center;
|
||||
|
||||
VectorAverage( ent->v.absmin, ent->v.absmax, center );
|
||||
@@ -432,10 +430,12 @@ static float SV_Submerged( edict_t *ent )
|
||||
bottom = SV_RecursiveWaterLevel( center, 0.0f, start, 0 );
|
||||
return bottom - start;
|
||||
case 3:
|
||||
VectorSet( point, center[0], center[1], ent->v.absmax[2] );
|
||||
{
|
||||
vec3_t point = { center[0], center[1], ent->v.absmax[2] };
|
||||
svs.groupmask = ent->v.groupinfo;
|
||||
if( SV_PointContents( point ) == CONTENTS_WATER )
|
||||
return (ent->v.maxs[2] - ent->v.mins[2]);
|
||||
}
|
||||
// intentionally fallthrough
|
||||
case 2:
|
||||
bottom = SV_RecursiveWaterLevel( center, ent->v.absmax[2] - center[2], 0.0f, 0 );
|
||||
@@ -587,15 +587,14 @@ static int SV_FlyMove( edict_t *ent, float time, trace_t *steptrace )
|
||||
{
|
||||
int i, j, numplanes, blocked;
|
||||
vec3_t dir, end, planes[MAX_CLIP_PLANES];
|
||||
vec3_t primal_velocity, original_velocity, new_velocity;
|
||||
float time_left, allFraction;
|
||||
qboolean monsterClip = FBitSet( ent->v.flags, FL_MONSTERCLIP ) ? true : false;
|
||||
trace_t trace;
|
||||
|
||||
blocked = 0;
|
||||
VectorCopy( ent->v.velocity, original_velocity );
|
||||
VectorCopy( ent->v.velocity, primal_velocity );
|
||||
VectorClear( new_velocity );
|
||||
vec3_t original_velocity = Vec3( ent->v.velocity );
|
||||
vec3_t primal_velocity = Vec3( ent->v.velocity );
|
||||
vec3_t new_velocity = { 0 };
|
||||
numplanes = 0;
|
||||
|
||||
allFraction = 0.0f;
|
||||
|
||||
@@ -971,11 +971,9 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed )
|
||||
}
|
||||
else
|
||||
{
|
||||
vec3_t oldvel;
|
||||
|
||||
// link into place and touch triggers
|
||||
SV_LinkEdict( clent, true );
|
||||
VectorCopy( clent->v.velocity, oldvel ); // save velocity
|
||||
vec3_t oldvel = Vec3( clent->v.velocity ); // save velocity
|
||||
|
||||
// touch other objects
|
||||
for( int i = 0; i < svgame.pmove->numtouch; i++ )
|
||||
|
||||
@@ -1105,15 +1105,14 @@ static void RestoreDecal( SAVERESTOREDATA *pSaveData, decallist_t *entry, qboole
|
||||
// this can happens if brush entity from previous level was turned into world geometry
|
||||
if( adjacent && entry->entityIndex != 0 && !SV_IsValidEdict( pEdict ))
|
||||
{
|
||||
vec3_t testspot, testend;
|
||||
trace_t tr;
|
||||
|
||||
Con_Printf( S_ERROR "RestoreDecal: couldn't restore entity index %i\n", entry->entityIndex );
|
||||
|
||||
VectorCopy( entry->position, testspot );
|
||||
vec3_t testspot = Vec3( entry->position );
|
||||
VectorMA( testspot, 5.0f, entry->impactPlaneNormal, testspot );
|
||||
|
||||
VectorCopy( entry->position, testend );
|
||||
vec3_t testend = Vec3( entry->position );
|
||||
VectorMA( testend, -5.0f, entry->impactPlaneNormal, testend );
|
||||
|
||||
tr = SV_Move( testspot, vec3_origin, vec3_origin, testend, MOVE_NOMONSTERS, NULL, false );
|
||||
|
||||
+17
-30
@@ -108,7 +108,7 @@ static qboolean SV_CheckSphereIntersection( edict_t *ent, const vec3_t start, co
|
||||
{
|
||||
int sequence;
|
||||
float radiusSquared;
|
||||
vec3_t traceOrg, traceDir;
|
||||
vec3_t traceDir;
|
||||
studiohdr_t *pstudiohdr;
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
model_t *mod;
|
||||
@@ -128,7 +128,7 @@ static qboolean SV_CheckSphereIntersection( edict_t *ent, const vec3_t start, co
|
||||
|
||||
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + sequence;
|
||||
|
||||
VectorCopy( start, traceOrg );
|
||||
vec3_t traceOrg = Vec3( start );
|
||||
VectorSubtract( end, start, traceDir );
|
||||
radiusSquared = 0.0f;
|
||||
|
||||
@@ -324,12 +324,11 @@ static hull_t *SV_HullForStudioModel( edict_t *ent, vec3_t mins, vec3_t maxs, ve
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
byte controller[4];
|
||||
byte blending[2];
|
||||
vec3_t angles;
|
||||
int iBlend;
|
||||
|
||||
pstudio = Mod_StudioExtradata( mod );
|
||||
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudio + pstudio->seqindex) + ent->v.sequence;
|
||||
VectorCopy( ent->v.angles, angles );
|
||||
vec3_t angles = Vec3( ent->v.angles );
|
||||
|
||||
SV_StudioPlayerBlend( pseqdesc, &iBlend, &angles[PITCH] );
|
||||
|
||||
@@ -421,8 +420,6 @@ static areanode_t *SV_CreateAreaNode( int depth, vec3_t mins, vec3_t maxs )
|
||||
{
|
||||
areanode_t *anode;
|
||||
vec3_t size;
|
||||
vec3_t mins1, maxs1;
|
||||
vec3_t mins2, maxs2;
|
||||
|
||||
anode = &sv_areanodes[sv_numareanodes++];
|
||||
|
||||
@@ -443,10 +440,10 @@ static areanode_t *SV_CreateAreaNode( int depth, vec3_t mins, vec3_t maxs )
|
||||
else anode->axis = 1;
|
||||
|
||||
anode->dist = 0.5f * ( maxs[anode->axis] + mins[anode->axis] );
|
||||
VectorCopy( mins, mins1 );
|
||||
VectorCopy( mins, mins2 );
|
||||
VectorCopy( maxs, maxs1 );
|
||||
VectorCopy( maxs, maxs2 );
|
||||
vec3_t mins1 = Vec3( mins );
|
||||
vec3_t mins2 = Vec3( mins );
|
||||
vec3_t maxs1 = Vec3( maxs );
|
||||
vec3_t maxs2 = Vec3( maxs );
|
||||
|
||||
maxs1[anode->axis] = mins2[anode->axis] = anode->dist;
|
||||
anode->children[0] = SV_CreateAreaNode( depth+1, mins2, maxs2 );
|
||||
@@ -939,10 +936,8 @@ void SV_ClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
vec3_t temp;
|
||||
|
||||
// transform plane
|
||||
VectorCopy( trace->plane.normal, temp );
|
||||
vec3_t temp = Vec3( trace->plane.normal );
|
||||
Matrix4x4_TransformPositivePlane( matrix, temp, trace->plane.dist, trace->plane.normal, &trace->plane.dist );
|
||||
}
|
||||
else
|
||||
@@ -1321,8 +1316,7 @@ trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end,
|
||||
if( clip.trace.fraction != 0.0f )
|
||||
{
|
||||
const float trace_fraction = clip.trace.fraction;
|
||||
vec3_t trace_endpos;
|
||||
VectorCopy( clip.trace.endpos, trace_endpos );
|
||||
vec3_t trace_endpos = Vec3( clip.trace.endpos );
|
||||
|
||||
clip.trace.fraction = 1.0f;
|
||||
clip.start = start;
|
||||
@@ -1369,16 +1363,14 @@ SV_MoveNoEnts
|
||||
trace_t GAME_EXPORT SV_MoveNoEnts( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e )
|
||||
{
|
||||
moveclip_t clip;
|
||||
vec3_t trace_endpos;
|
||||
float trace_fraction;
|
||||
|
||||
memset( &clip, 0, sizeof( moveclip_t ));
|
||||
SV_ClipMoveToEntity( SV_EdictNum( 0 ), start, mins, maxs, end, &clip.trace );
|
||||
|
||||
if( clip.trace.fraction != 0.0f )
|
||||
{
|
||||
VectorCopy( clip.trace.endpos, trace_endpos );
|
||||
trace_fraction = clip.trace.fraction;
|
||||
vec3_t trace_endpos = Vec3( clip.trace.endpos );
|
||||
float trace_fraction = clip.trace.fraction;
|
||||
clip.trace.fraction = 1.0f;
|
||||
clip.start = start;
|
||||
clip.end = trace_endpos;
|
||||
@@ -1468,16 +1460,12 @@ trace_t SV_MoveToss( edict_t *tossent, edict_t *ignore )
|
||||
{
|
||||
float gravity;
|
||||
vec3_t move, end;
|
||||
vec3_t original_origin;
|
||||
vec3_t original_velocity;
|
||||
vec3_t original_angles;
|
||||
vec3_t original_avelocity;
|
||||
trace_t trace;
|
||||
|
||||
VectorCopy( tossent->v.origin, original_origin );
|
||||
VectorCopy( tossent->v.velocity, original_velocity );
|
||||
VectorCopy( tossent->v.angles, original_angles );
|
||||
VectorCopy( tossent->v.avelocity, original_avelocity );
|
||||
vec3_t original_origin = Vec3( tossent->v.origin );
|
||||
vec3_t original_velocity = Vec3( tossent->v.velocity );
|
||||
vec3_t original_angles = Vec3( tossent->v.angles );
|
||||
vec3_t original_avelocity = Vec3( tossent->v.avelocity );
|
||||
gravity = tossent->v.gravity * sv_gravity.value * 0.05f;
|
||||
|
||||
for( int i = 0; i < 200; i++ )
|
||||
@@ -1639,7 +1627,6 @@ grab the ambient lighting color for current point
|
||||
int SV_LightForEntity( edict_t *pEdict )
|
||||
{
|
||||
vec3_t point_color = { 1.0f, 1.0f, 1.0f };
|
||||
vec3_t start, end;
|
||||
|
||||
if( !SV_IsValidEdict( pEdict ))
|
||||
return -1;
|
||||
@@ -1651,8 +1638,8 @@ int SV_LightForEntity( edict_t *pEdict )
|
||||
if( FBitSet( pEdict->v.flags, FL_CLIENT ))
|
||||
return pEdict->v.light_level;
|
||||
|
||||
VectorCopy( pEdict->v.origin, start );
|
||||
VectorCopy( pEdict->v.origin, end );
|
||||
vec3_t start = Vec3( pEdict->v.origin );
|
||||
vec3_t end = Vec3( pEdict->v.origin );
|
||||
|
||||
if( FBitSet( pEdict->v.effects, EF_INVLIGHT ))
|
||||
end[2] = start[2] + world.size[2];
|
||||
|
||||
Reference in New Issue
Block a user