diff options
author | /dev/humancontroller <devhc@example.com> | 2015-02-02 17:06:50 +0100 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:14 +0100 |
commit | 572719119e7f727d8eb91ed50fec15b71ea4117d (patch) | |
tree | eb3c7b779ca639a12a01729dc10b2474a9252d3a | |
parent | e52255589bcd37a841cf275e13ae1abf427c7c79 (diff) |
drop the use of the origin and angles fields of entityState_t in the game module
clear the r.currentAngles field for brushmodel-related entities using the ''angle'' spawn var
-rw-r--r-- | src/game/g_active.c | 7 | ||||
-rw-r--r-- | src/game/g_buildable.c | 114 | ||||
-rw-r--r-- | src/game/g_client.c | 42 | ||||
-rw-r--r-- | src/game/g_cmds.c | 10 | ||||
-rw-r--r-- | src/game/g_combat.c | 10 | ||||
-rw-r--r-- | src/game/g_main.c | 10 | ||||
-rw-r--r-- | src/game/g_misc.c | 18 | ||||
-rw-r--r-- | src/game/g_missile.c | 2 | ||||
-rw-r--r-- | src/game/g_mover.c | 71 | ||||
-rw-r--r-- | src/game/g_spawn.c | 16 | ||||
-rw-r--r-- | src/game/g_target.c | 16 | ||||
-rw-r--r-- | src/game/g_trigger.c | 18 | ||||
-rw-r--r-- | src/game/g_utils.c | 5 | ||||
-rw-r--r-- | src/game/g_weapon.c | 36 |
14 files changed, 181 insertions, 194 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index e17f3806..e22ecb1f 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -482,7 +482,8 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) Pmove( &pm ); // Save results of pmove - VectorCopy( client->ps.origin, ent->s.origin ); + VectorCopy( client->ps.origin, ent->s.pos.trBase ); + VectorCopy( client->ps.origin, ent->r.currentOrigin ); G_TouchTriggers( ent ); trap_UnlinkEntity( ent ); @@ -1408,7 +1409,7 @@ void ClientThink_real( gentity_t *ent ) { gentity_t *boost = &g_entities[ entityList[ i ] ]; - if( Distance( client->ps.origin, boost->s.origin ) > REGEN_BOOST_RANGE ) + if( Distance( client->ps.origin, boost->r.currentOrigin ) > REGEN_BOOST_RANGE ) continue; if( modifier < BOOSTER_REGEN_MOD && boost->s.eType == ET_BUILDABLE && @@ -1639,7 +1640,7 @@ void ClientThink_real( gentity_t *ent ) // NOTE: now copy the exact origin over otherwise clients can be snapped into solid VectorCopy( ent->client->ps.origin, ent->r.currentOrigin ); - VectorCopy( ent->client->ps.origin, ent->s.origin ); + VectorCopy( ent->client->ps.origin, ent->s.pos.trBase ); // save results of triggers and client events if( ent->client->ps.eventSequence != oldEventSequence ) diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index e0ca2162..1425e539 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -158,7 +158,7 @@ qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned ) if( ( ent->s.modelindex == BA_H_REACTOR || ent->s.modelindex == BA_H_REPEATER ) && ( searchUnspawned || ent->spawned ) && ent->powered && ent->health > 0 ) { - VectorSubtract( self->s.origin, ent->s.origin, temp_v ); + VectorSubtract( self->r.currentOrigin, ent->r.currentOrigin, temp_v ); distance = VectorLength( temp_v ); // Always prefer a reactor if there is one in range @@ -276,7 +276,7 @@ gentity_t *G_PowerEntityForPoint( const vec3_t origin ) dummy.parentNode = NULL; dummy.buildableTeam = TEAM_HUMANS; dummy.s.modelindex = BA_NONE; - VectorCopy( origin, dummy.s.origin ); + VectorCopy( origin, dummy.r.currentOrigin ); if( G_FindPower( &dummy, qfalse ) ) return dummy.parentNode; @@ -438,7 +438,7 @@ gentity_t *G_InPowerZone( gentity_t *self ) if( ( ent->s.modelindex == BA_H_REACTOR || ent->s.modelindex == BA_H_REPEATER ) && ent->spawned && ent->powered ) { - VectorSubtract( self->s.origin, ent->s.origin, temp_v ); + VectorSubtract( self->r.currentOrigin, ent->r.currentOrigin, temp_v ); distance = VectorLength( temp_v ); if( ent->s.modelindex == BA_H_REACTOR && distance <= REACTOR_BASESIZE ) @@ -478,7 +478,7 @@ int G_FindDCC( gentity_t *self ) //if entity is a dcc calculate the distance to it if( ent->s.modelindex == BA_H_DCC && ent->spawned ) { - VectorSubtract( self->s.origin, ent->s.origin, temp_v ); + VectorSubtract( self->r.currentOrigin, ent->r.currentOrigin, temp_v ); distance = VectorLength( temp_v ); if( distance < DC_RANGE && ent->powered ) { @@ -599,7 +599,7 @@ qboolean G_FindCreep( gentity_t *self ) ent->s.modelindex == BA_A_OVERMIND ) && ent->spawned && ent->health > 0 ) { - VectorSubtract( self->s.origin, ent->s.origin, temp_v ); + VectorSubtract( self->r.currentOrigin, ent->r.currentOrigin, temp_v ); distance = VectorLength( temp_v ); if( distance < minDistance ) { @@ -641,7 +641,7 @@ static qboolean G_IsCreepHere( vec3_t origin ) dummy.parentNode = NULL; dummy.s.modelindex = BA_NONE; - VectorCopy( origin, dummy.s.origin ); + VectorCopy( origin, dummy.r.currentOrigin ); return G_FindCreep( &dummy ); } @@ -665,8 +665,8 @@ static void G_CreepSlow( gentity_t *self ) VectorSet( range, creepSize, creepSize, creepSize ); - VectorAdd( self->s.origin, range, maxs ); - VectorSubtract( self->s.origin, range, mins ); + VectorAdd( self->r.currentOrigin, range, maxs ); + VectorSubtract( self->r.currentOrigin, range, mins ); //find humans num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); @@ -868,7 +868,7 @@ void ASpawn_Think( gentity_t *self ) //only suicide if at rest if( self->s.groundEntityNum != ENTITYNUM_NONE ) { - if( ( ent = G_CheckSpawnPoint( self->s.number, self->s.origin, + if( ( ent = G_CheckSpawnPoint( self->s.number, self->r.currentOrigin, self->s.origin2, BA_A_SPAWN, NULL ) ) != NULL ) { // If the thing blocking the spawn is a buildable, kill it. @@ -1072,8 +1072,8 @@ void ABarricade_Shrink( gentity_t *self, qboolean shrink ) trace_t tr; int anim; - trap_Trace( &tr, self->s.origin, self->r.mins, self->r.maxs, - self->s.origin, self->s.number, MASK_PLAYERSOLID ); + trap_Trace( &tr, self->r.currentOrigin, self->r.mins, self->r.maxs, + self->r.currentOrigin, self->s.number, MASK_PLAYERSOLID ); if ( tr.startsolid || tr.fraction < 1.0f ) { self->r.maxs[ 2 ] = (int)( self->r.maxs[ 2 ] * BARRICADE_SHRINKPROP ); @@ -1143,8 +1143,8 @@ void ABarricade_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) // Client must be high enough to pass over. Note that STEPSIZE (18) is // hardcoded here because we don't include bg_local.h! - client_z = other->s.origin[ 2 ] + other->r.mins[ 2 ]; - min_z = self->s.origin[ 2 ] - 18 + + client_z = other->r.currentOrigin[ 2 ] + other->r.mins[ 2 ]; + min_z = self->r.currentOrigin[ 2 ] - 18 + (int)( self->r.maxs[ 2 ] * BARRICADE_SHRINKPROP ); if( client_z < min_z ) return; @@ -1173,8 +1173,8 @@ void AAcidTube_Think( gentity_t *self ) AGeneric_Think( self ); - VectorAdd( self->s.origin, range, maxs ); - VectorSubtract( self->s.origin, range, mins ); + VectorAdd( self->r.currentOrigin, range, maxs ); + VectorSubtract( self->r.currentOrigin, range, mins ); // attack nearby humans if( self->spawned && self->health > 0 && self->powered ) @@ -1237,7 +1237,7 @@ static qboolean AHive_CheckTarget( gentity_t *self, gentity_t *enemy ) // Check if the tip of the hive can see the target VectorMA( self->s.pos.trBase, self->r.maxs[ 2 ], self->s.origin2, tip_origin ); - if( Distance( tip_origin, enemy->s.origin ) > HIVE_SENSE_RANGE ) + if( Distance( tip_origin, enemy->r.currentOrigin ) > HIVE_SENSE_RANGE ) return qfalse; trap_Trace( &trace, tip_origin, NULL, NULL, enemy->s.pos.trBase, @@ -1283,8 +1283,8 @@ void AHive_Think( gentity_t *self ) vec3_t mins, maxs, range = { HIVE_SENSE_RANGE, HIVE_SENSE_RANGE, HIVE_SENSE_RANGE }; - VectorAdd( self->s.origin, range, maxs ); - VectorSubtract( self->s.origin, range, mins ); + VectorAdd( self->r.currentOrigin, range, maxs ); + VectorSubtract( self->r.currentOrigin, range, mins ); num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); @@ -1688,7 +1688,7 @@ void HSpawn_Think( gentity_t *self ) //only suicide if at rest if( self->s.groundEntityNum != ENTITYNUM_NONE ) { - if( ( ent = G_CheckSpawnPoint( self->s.number, self->s.origin, + if( ( ent = G_CheckSpawnPoint( self->s.number, self->r.currentOrigin, self->s.origin2, BA_H_SPAWN, NULL ) ) != NULL ) { // If the thing blocking the spawn is a buildable, kill it. @@ -1856,13 +1856,13 @@ void HReactor_Think( gentity_t *self ) if( self->dcc ) { - VectorAdd( self->s.origin, dccrange, maxs ); - VectorSubtract( self->s.origin, dccrange, mins ); + VectorAdd( self->r.currentOrigin, dccrange, maxs ); + VectorSubtract( self->r.currentOrigin, dccrange, mins ); } else { - VectorAdd( self->s.origin, range, maxs ); - VectorSubtract( self->s.origin, range, mins ); + VectorAdd( self->r.currentOrigin, range, maxs ); + VectorSubtract( self->r.currentOrigin, range, mins ); } if( self->spawned && ( self->health > 0 ) ) @@ -2046,8 +2046,8 @@ void HMedistat_Think( gentity_t *self ) if( self->spawned ) { - VectorAdd( self->s.origin, self->r.maxs, maxs ); - VectorAdd( self->s.origin, self->r.mins, mins ); + VectorAdd( self->r.currentOrigin, self->r.maxs, maxs ); + VectorAdd( self->r.currentOrigin, self->r.mins, mins ); mins[ 2 ] += fabs( self->r.mins[ 2 ] ) + self->r.maxs[ 2 ]; maxs[ 2 ] += 60; //player height @@ -2265,8 +2265,8 @@ void HMGTurret_FindEnemy( gentity_t *self ) // Look for targets in a box around the turret VectorSet( range, MGTURRET_RANGE, MGTURRET_RANGE, MGTURRET_RANGE ); - VectorAdd( self->s.origin, range, maxs ); - VectorSubtract( self->s.origin, range, mins ); + VectorAdd( self->r.currentOrigin, range, maxs ); + VectorSubtract( self->r.currentOrigin, range, mins ); num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); if( num == 0 ) @@ -2460,7 +2460,7 @@ void HTeslaGen_Think( gentity_t *self ) self->s.eFlags &= ~EF_FIRING; // Move the muzzle from the entity origin up a bit to fire over turrets - VectorMA( self->s.origin, self->r.maxs[ 2 ], self->s.origin2, origin ); + VectorMA( self->r.currentOrigin, self->r.maxs[ 2 ], self->s.origin2, origin ); VectorSet( range, TESLAGEN_RANGE, TESLAGEN_RANGE, TESLAGEN_RANGE ); VectorAdd( origin, range, maxs ); @@ -2645,16 +2645,16 @@ void G_BuildableTouchTriggers( gentity_t *ent ) BG_BuildableBoundingBox( ent->s.modelindex, bmins, bmaxs ); - VectorAdd( ent->s.origin, bmins, mins ); - VectorAdd( ent->s.origin, bmaxs, maxs ); + VectorAdd( ent->r.currentOrigin, bmins, mins ); + VectorAdd( ent->r.currentOrigin, bmaxs, maxs ); VectorSubtract( mins, range, mins ); VectorAdd( maxs, range, maxs ); num = trap_EntitiesInBox( mins, maxs, touch, MAX_GENTITIES ); - VectorAdd( ent->s.origin, bmins, mins ); - VectorAdd( ent->s.origin, bmaxs, maxs ); + VectorAdd( ent->r.currentOrigin, bmins, mins ); + VectorAdd( ent->r.currentOrigin, bmaxs, maxs ); for( i = 0; i < num; i++ ) { @@ -2897,9 +2897,9 @@ static int G_CompareBuildablesForRemoval( const void *a, const void *b ) // Prefer the one that collides with the thing we're building aMatches = G_BuildablesIntersect( cmpBuildable, cmpOrigin, - buildableA->s.modelindex, buildableA->s.origin ); + buildableA->s.modelindex, buildableA->r.currentOrigin ); bMatches = G_BuildablesIntersect( cmpBuildable, cmpOrigin, - buildableB->s.modelindex, buildableB->s.origin ); + buildableB->s.modelindex, buildableB->r.currentOrigin ); if( aMatches && !bMatches ) return -1; else if( !aMatches && bMatches ) @@ -3115,7 +3115,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, if( ent->s.eType != ET_BUILDABLE ) continue; - if( G_BuildablesIntersect( buildable, origin, ent->s.modelindex, ent->s.origin ) ) + if( G_BuildablesIntersect( buildable, origin, ent->s.modelindex, ent->r.currentOrigin ) ) return IBE_NOROOM; } @@ -3131,7 +3131,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, if( ent->s.eType != ET_BUILDABLE ) continue; - collision = G_BuildablesIntersect( buildable, origin, ent->s.modelindex, ent->s.origin ); + collision = G_BuildablesIntersect( buildable, origin, ent->s.modelindex, ent->r.currentOrigin ); if( collision ) { @@ -3151,7 +3151,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, // Check if this is a repeater and it's in range if( buildable == BA_H_REPEATER && buildable == ent->s.modelindex && - Distance( ent->s.origin, origin ) < REPEATER_BASESIZE ) + Distance( ent->r.currentOrigin, origin ) < REPEATER_BASESIZE ) { repeaterInRange = qtrue; repeaterInRangeCount++; @@ -3707,8 +3707,10 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, // set turret angles VectorCopy( builder->s.angles2, built->s.angles2 ); - VectorCopy( angles, built->s.angles ); - built->s.angles[ PITCH ] = 0.0f; + VectorCopy( angles, built->s.apos.trBase ); + VectorCopy( angles, built->r.currentAngles ); + built->s.apos.trBase[ PITCH ] = 0.0f; + built->r.currentAngles[ PITCH ] = 0.0f; built->s.angles2[ YAW ] = angles[ YAW ]; built->s.angles2[ PITCH ] = MGTURRET_VERTICALCAP; built->physicsBounce = BG_Buildable( buildable )->bounce; @@ -3873,8 +3875,8 @@ static gentity_t *G_FinishSpawningBuildable( gentity_t *ent, qboolean force ) else VectorSet( normal, 0.0f, 0.0f, 1.0f ); - built = G_Build( ent, buildable, ent->s.pos.trBase, - normal, ent->s.angles, ENTITYNUM_NONE ); + built = G_Build( ent, buildable, ent->r.currentOrigin, + normal, ent->r.currentAngles, ENTITYNUM_NONE ); built->takedamage = qtrue; built->spawned = qtrue; //map entities are already spawned @@ -3883,14 +3885,14 @@ static gentity_t *G_FinishSpawningBuildable( gentity_t *ent, qboolean force ) // drop towards normal surface VectorScale( built->s.origin2, -4096.0f, dest ); - VectorAdd( dest, built->s.origin, dest ); + VectorAdd( dest, built->r.currentOrigin, dest ); - trap_Trace( &tr, built->s.origin, built->r.mins, built->r.maxs, dest, built->s.number, built->clipmask ); + trap_Trace( &tr, built->r.currentOrigin, built->r.mins, built->r.maxs, dest, built->s.number, built->clipmask ); if( tr.startsolid && !force ) { G_Printf( S_COLOR_YELLOW "G_FinishSpawningBuildable: %s startsolid at %s\n", - built->classname, vtos( built->s.origin ) ); + built->classname, vtos( built->r.currentOrigin ) ); G_RemoveRangeMarkerFrom( built ); G_FreeEntity( built ); return NULL; @@ -3981,12 +3983,12 @@ void G_LayoutSave( char *name ) s = va( "%s %f %f %f %f %f %f %f %f %f %f %f %f\n", BG_Buildable( ent->s.modelindex )->name, - ent->s.pos.trBase[ 0 ], - ent->s.pos.trBase[ 1 ], - ent->s.pos.trBase[ 2 ], - ent->s.angles[ 0 ], - ent->s.angles[ 1 ], - ent->s.angles[ 2 ], + ent->r.currentOrigin[ 0 ], + ent->r.currentOrigin[ 1 ], + ent->r.currentOrigin[ 2 ], + ent->r.currentAngles[ 0 ], + ent->r.currentAngles[ 1 ], + ent->r.currentAngles[ 2 ], ent->s.origin2[ 0 ], ent->s.origin2[ 1 ], ent->s.origin2[ 2 ], @@ -4141,8 +4143,8 @@ static void G_LayoutBuildItem( buildable_t buildable, vec3_t origin, gentity_t *builder; builder = G_Spawn( ); - VectorCopy( origin, builder->s.pos.trBase ); - VectorCopy( angles, builder->s.angles ); + VectorCopy( origin, builder->r.currentOrigin ); + VectorCopy( angles, builder->r.currentAngles ); VectorCopy( origin2, builder->s.origin2 ); VectorCopy( angles2, builder->s.angles2 ); G_SpawnBuildable( builder, buildable ); @@ -4264,8 +4266,8 @@ void G_BuildLogSet( buildLog_t *log, gentity_t *ent ) log->deconstruct = ent->deconstruct; log->deconstructTime = ent->deconstructTime; log->builtBy = ent->builtBy; - VectorCopy( ent->s.pos.trBase, log->origin ); - VectorCopy( ent->s.angles, log->angles ); + VectorCopy( ent->r.currentOrigin, log->origin ); + VectorCopy( ent->r.currentAngles, log->angles ); VectorCopy( ent->s.origin2, log->origin2 ); VectorCopy( ent->s.angles2, log->angles2 ); log->powerSource = ent->parentNode ? ent->parentNode->s.modelindex : BA_NONE; @@ -4371,8 +4373,8 @@ void G_BuildLogRevert( int id ) { gentity_t *builder = G_Spawn(); - VectorCopy( log->origin, builder->s.pos.trBase ); - VectorCopy( log->angles, builder->s.angles ); + VectorCopy( log->origin, builder->r.currentOrigin ); + VectorCopy( log->angles, builder->r.currentAngles ); VectorCopy( log->origin2, builder->s.origin2 ); VectorCopy( log->angles2, builder->s.angles2 ); builder->s.modelindex = log->modelindex; diff --git a/src/game/g_client.c b/src/game/g_client.c index b8439312..b8fb8055 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -134,8 +134,8 @@ qboolean SpotWouldTelefrag( gentity_t *spot ) gentity_t *hit; vec3_t mins, maxs; - VectorAdd( spot->s.origin, playerMins, mins ); - VectorAdd( spot->s.origin, playerMaxs, maxs ); + VectorAdd( spot->r.currentOrigin, playerMins, mins ); + VectorAdd( spot->r.currentOrigin, playerMaxs, maxs ); num = trap_EntitiesInBox( mins, maxs, touch, MAX_GENTITIES ); for( i = 0; i < num; i++ ) @@ -174,7 +174,7 @@ static gentity_t *G_SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t o if( SpotWouldTelefrag( spot ) ) continue; - VectorSubtract( spot->s.origin, avoidPoint, delta ); + VectorSubtract( spot->r.currentOrigin, avoidPoint, delta ); dist = VectorLength( delta ); for( i = 0; i < numSpots; i++ ) @@ -216,18 +216,18 @@ static gentity_t *G_SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t o if( !spot ) G_Error( "Couldn't find a spawn point" ); - VectorCopy( spot->s.origin, origin ); + VectorCopy( spot->r.currentOrigin, origin ); origin[ 2 ] += 9; - VectorCopy( spot->s.angles, angles ); + VectorCopy( spot->r.currentAngles, angles ); return spot; } // select a random spot from the spawn points furthest away rnd = random( ) * ( numSpots / 2 ); - VectorCopy( list_spot[ rnd ]->s.origin, origin ); + VectorCopy( list_spot[ rnd ]->r.currentOrigin, origin ); origin[ 2 ] += 9; - VectorCopy( list_spot[ rnd ]->s.angles, angles ); + VectorCopy( list_spot[ rnd ]->r.currentAngles, angles ); return list_spot[ rnd ]; } @@ -262,12 +262,12 @@ static gentity_t *G_SelectSpawnBuildable( vec3_t preference, buildable_t buildab if( search->clientSpawnTime > 0 ) continue; - if( G_CheckSpawnPoint( search->s.number, search->s.origin, + if( G_CheckSpawnPoint( search->s.number, search->r.currentOrigin, search->s.origin2, buildable, NULL ) != NULL ) continue; - if( !spot || DistanceSquared( preference, search->s.origin ) < - DistanceSquared( preference, spot->s.origin ) ) + if( !spot || DistanceSquared( preference, search->r.currentOrigin ) < + DistanceSquared( preference, spot->r.currentOrigin ) ) spot = search; } @@ -318,11 +318,11 @@ gentity_t *G_SelectTremulousSpawnPoint( team_t team, vec3_t preference, vec3_t o return NULL; if( team == TEAM_ALIENS ) - G_CheckSpawnPoint( spot->s.number, spot->s.origin, spot->s.origin2, BA_A_SPAWN, origin ); + G_CheckSpawnPoint( spot->s.number, spot->r.currentOrigin, spot->s.origin2, BA_A_SPAWN, origin ); else if( team == TEAM_HUMANS ) - G_CheckSpawnPoint( spot->s.number, spot->s.origin, spot->s.origin2, BA_H_SPAWN, origin ); + G_CheckSpawnPoint( spot->s.number, spot->r.currentOrigin, spot->s.origin2, BA_H_SPAWN, origin ); - VectorCopy( spot->s.angles, angles ); + VectorCopy( spot->r.currentAngles, angles ); angles[ ROLL ] = 0; return spot; @@ -365,8 +365,8 @@ gentity_t *G_SelectAlienLockSpawnPoint( vec3_t origin, vec3_t angles ) if( !spot ) return G_SelectSpectatorSpawnPoint( origin, angles ); - VectorCopy( spot->s.origin, origin ); - VectorCopy( spot->s.angles, angles ); + VectorCopy( spot->r.currentOrigin, origin ); + VectorCopy( spot->r.currentAngles, angles ); return spot; } @@ -390,8 +390,8 @@ gentity_t *G_SelectHumanLockSpawnPoint( vec3_t origin, vec3_t angles ) if( !spot ) return G_SelectSpectatorSpawnPoint( origin, angles ); - VectorCopy( spot->s.origin, origin ); - VectorCopy( spot->s.angles, angles ); + VectorCopy( spot->r.currentOrigin, origin ); + VectorCopy( spot->r.currentAngles, angles ); return spot; } @@ -461,7 +461,8 @@ static void SpawnCorpse( gentity_t *ent ) body = G_Spawn( ); - VectorCopy( ent->s.apos.trBase, body->s.angles ); + VectorCopy( ent->s.apos.trBase, body->s.apos.trBase ); + VectorCopy( ent->s.apos.trBase, body->r.currentAngles ); body->s.eFlags = EF_DEAD; body->s.eType = ET_CORPSE; body->timestamp = level.time; @@ -563,8 +564,9 @@ void G_SetClientViewAngle( gentity_t *ent, vec3_t angle ) ent->client->ps.delta_angles[ i ] = cmdAngle - ent->client->pers.cmd.angles[ i ]; } - VectorCopy( angle, ent->s.angles ); - VectorCopy( ent->s.angles, ent->client->ps.viewangles ); + VectorCopy( angle, ent->s.apos.trBase ); + VectorCopy( angle, ent->r.currentAngles ); + VectorCopy( angle, ent->client->ps.viewangles ); } /* diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 2371e89a..3df9adab 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -974,8 +974,8 @@ static void Cmd_SayArea_f( gentity_t *ent ) G_LogPrintf( "SayArea: %d \"%s" S_COLOR_WHITE "\": " S_COLOR_BLUE "%s\n", (int)( ent - g_entities ), ent->client->pers.netname, msg ); - VectorAdd( ent->s.origin, range, maxs ); - VectorSubtract( ent->s.origin, range, mins ); + VectorAdd( ent->r.currentOrigin, range, maxs ); + VectorSubtract( ent->r.currentOrigin, range, mins ); num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); for( i = 0; i < num; i++ ) @@ -1149,8 +1149,8 @@ void Cmd_Where_f( gentity_t *ent ) return; trap_SendServerCommand( ent - g_entities, va( "print \"origin: %f %f %f\n\"", - ent->s.origin[ 0 ], ent->s.origin[ 1 ], - ent->s.origin[ 2 ] ) ); + ent->r.currentOrigin[ 0 ], ent->r.currentOrigin[ 1 ], + ent->r.currentOrigin[ 2 ] ) ); } /* @@ -3074,7 +3074,7 @@ void Cmd_Damage_f( gentity_t *ent ) dz = atof( arg ); nonloc = qfalse; } - VectorCopy( ent->s.origin, point ); + VectorCopy( ent->r.currentOrigin, point ); point[ 0 ] += dx; point[ 1 ] += dy; point[ 2 ] += dz; diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 0b61ce59..29a1af3d 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -339,7 +339,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int ScoreboardMessage( g_entities + i ); } - VectorCopy( self->s.origin, self->client->pers.lastDeathLocation ); + VectorCopy( self->r.currentOrigin, self->client->pers.lastDeathLocation ); self->takedamage = qfalse; // can still be gibbed @@ -349,13 +349,11 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int else self->r.contents = CONTENTS_CORPSE; - self->s.angles[ PITCH ] = 0; - self->s.angles[ ROLL ] = 0; - self->s.angles[ YAW ] = self->s.apos.trBase[ YAW ]; + self->client->ps.viewangles[ PITCH ] = 0; // zomg + self->client->ps.viewangles[ YAW ] = self->s.apos.trBase[ YAW ]; + self->client->ps.viewangles[ ROLL ] = 0; LookAtKiller( self, inflictor, attacker ); - VectorCopy( self->s.angles, self->client->ps.viewangles ); - self->s.loopSound = 0; self->r.maxs[ 2 ] = -8; diff --git a/src/game/g_main.c b/src/game/g_main.c index b150a95d..6bd86887 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1530,8 +1530,10 @@ void MoveClientToIntermission( gentity_t *ent ) G_StopFollowing( ent ); // move to the spot - VectorCopy( level.intermission_origin, ent->s.origin ); + VectorCopy( level.intermission_origin, ent->s.pos.trBase ); + VectorCopy( level.intermission_origin, ent->r.currentOrigin ); VectorCopy( level.intermission_origin, ent->client->ps.origin ); + VectorCopy( level.intermission_angle, ent->s.apos.trBase ); VectorCopy( level.intermission_angle, ent->client->ps.viewangles ); ent->client->ps.pm_type = PM_INTERMISSION; @@ -1567,8 +1569,8 @@ void FindIntermissionPoint( void ) } else { - VectorCopy( ent->s.origin, level.intermission_origin ); - VectorCopy( ent->s.angles, level.intermission_angle ); + VectorCopy( ent->r.currentOrigin, level.intermission_origin ); + VectorCopy( ent->r.currentAngles, level.intermission_angle ); // if it has a target, look towards it if( ent->target ) { @@ -1576,7 +1578,7 @@ void FindIntermissionPoint( void ) if( target ) { - VectorSubtract( target->s.origin, level.intermission_origin, dir ); + VectorSubtract( target->r.currentOrigin, level.intermission_origin, dir ); vectoangles( dir, level.intermission_angle ); } } diff --git a/src/game/g_misc.c b/src/game/g_misc.c index 3f7b132b..87b13c7a 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -44,7 +44,7 @@ target_position does the same thing */ void SP_info_notnull( gentity_t *self ) { - G_SetOrigin( self, self->s.origin ); + G_SetOrigin( self, self->r.currentOrigin ); } @@ -136,8 +136,7 @@ void SP_misc_model( gentity_t *ent ) VectorSet (ent->maxs, 16, 16, 16); trap_LinkEntity (ent); - G_SetOrigin( ent, ent->s.origin ); - VectorCopy( ent->s.angles, ent->s.apos.trBase ); + G_SetOrigin( ent, ent->r.currentOrigin ); #else G_FreeEntity( ent ); #endif @@ -178,17 +177,17 @@ void locateCamera( gentity_t *ent ) // clientNum holds the rotate offset ent->s.clientNum = owner->s.clientNum; - VectorCopy( owner->s.origin, ent->s.origin2 ); + VectorCopy( owner->r.currentOrigin, ent->s.origin2 ); // see if the portal_camera has a target target = G_PickTarget( owner->target ); if( target ) { - VectorSubtract( target->s.origin, owner->s.origin, dir ); + VectorSubtract( target->r.currentOrigin, owner->r.currentOrigin, dir ); VectorNormalize( dir ); } else - G_SetMovedir( owner->s.angles, dir ); + G_SetMovedir( owner->r.currentAngles, dir ); ent->s.eventParm = DirToByte( dir ); } @@ -208,7 +207,7 @@ void SP_misc_portal_surface( gentity_t *ent ) if( !ent->target ) { - VectorCopy( ent->s.origin, ent->s.origin2 ); + VectorCopy( ent->r.currentOrigin, ent->s.origin2 ); } else { @@ -280,8 +279,7 @@ void SP_misc_particle_system( gentity_t *self ) { char *s; - G_SetOrigin( self, self->s.origin ); - VectorCopy( self->s.angles, self->s.apos.trBase ); + G_SetOrigin( self, self->r.currentOrigin ); G_SpawnString( "psName", "", &s ); G_SpawnFloat( "wait", "0", &self->wait ); @@ -428,7 +426,7 @@ void SP_misc_light_flare( gentity_t *self ) //try to find a spot near to the flare which is empty. This //is used to facilitate visibility testing - findEmptySpot( self->s.origin, 8.0f, self->s.angles2 ); + findEmptySpot( self->r.currentOrigin, 8.0f, self->s.angles2 ); self->use = SP_use_light_flare; diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 7ec9ee09..05ed45a1 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -197,7 +197,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) if( VectorLength( velocity ) == 0 ) velocity[ 2 ] = 1; // stepped on a grenade - G_Damage( other, ent, attacker, velocity, ent->s.origin, ent->damage, + G_Damage( other, ent, attacker, velocity, ent->r.currentOrigin, ent->damage, DAMAGE_NO_LOCDAMAGE, ent->methodOfDeath ); } } diff --git a/src/game/g_mover.c b/src/game/g_mover.c index 64f68f5c..81284460 100644 --- a/src/game/g_mover.c +++ b/src/game/g_mover.c @@ -1239,8 +1239,8 @@ static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_ axis = ent->count; VectorClear( dir ); - if( fabs( other->s.origin[ axis ] - ent->r.absmax[ axis ] ) < - fabs( other->s.origin[ axis ] - ent->r.absmin[ axis ] ) ) + if( fabs( other->r.currentOrigin[ axis ] - ent->r.absmax[ axis ] ) < + fabs( other->r.currentOrigin[ axis ] - ent->r.absmin[ axis ] ) ) { origin[ axis ] = ent->r.absmin[ axis ] - 20; dir[ axis ] = -1; @@ -1507,11 +1507,13 @@ void SP_func_door( gentity_t *ent ) G_SpawnInt( "dmg", "2", &ent->damage ); // first position at start - VectorCopy( ent->s.origin, ent->pos1 ); + VectorCopy( ent->r.currentOrigin, ent->pos1 ); + G_SetMovedir( ent->r.currentAngles, ent->movedir ); + VectorClear( ent->s.apos.trBase ); + VectorClear( ent->r.currentOrigin ); // calculate second position trap_SetBrushModel( ent, ent->model ); - G_SetMovedir( ent->s.angles, ent->movedir ); abs_movedir[ 0 ] = fabs( ent->movedir[ 0 ] ); abs_movedir[ 1 ] = fabs( ent->movedir[ 1 ] ); abs_movedir[ 2 ] = fabs( ent->movedir[ 2 ] ); @@ -1525,7 +1527,7 @@ void SP_func_door( gentity_t *ent ) vec3_t temp; VectorCopy( ent->pos2, temp ); - VectorCopy( ent->s.origin, ent->pos2 ); + VectorCopy( ent->r.currentOrigin, ent->pos2 ); VectorCopy( temp, ent->pos1 ); } @@ -1601,7 +1603,8 @@ void SP_func_door_rotating( gentity_t *ent ) // set the axis of rotation VectorClear( ent->movedir ); - VectorClear( ent->s.angles ); + VectorClear( ent->s.apos.trBase ); + VectorClear( ent->r.currentAngles ); if( ent->spawnflags & 32 ) ent->movedir[ 2 ] = 1.0; @@ -1619,12 +1622,12 @@ void SP_func_door_rotating( gentity_t *ent ) if( !ent->rotatorAngle ) { G_Printf( "%s at %s with no rotatorAngle set.\n", - ent->classname, vtos( ent->s.origin ) ); + ent->classname, vtos( ent->r.currentOrigin ) ); ent->rotatorAngle = 90.0; } - VectorCopy( ent->s.angles, ent->pos1 ); + VectorCopy( ent->r.currentAngles, ent->pos1 ); trap_SetBrushModel( ent, ent->model ); VectorMA( ent->pos1, ent->rotatorAngle, ent->movedir, ent->pos2 ); @@ -1634,15 +1637,11 @@ void SP_func_door_rotating( gentity_t *ent ) vec3_t temp; VectorCopy( ent->pos2, temp ); - VectorCopy( ent->s.angles, ent->pos2 ); + VectorCopy( ent->pos1, ent->pos2 ); VectorCopy( temp, ent->pos1 ); VectorNegate( ent->movedir, ent->movedir ); } - // set origin - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin ); - InitRotator( ent ); ent->nextthink = level.time + FRAMETIME; @@ -1717,7 +1716,7 @@ void SP_func_door_model( gentity_t *ent ) VectorCopy( clipBrush->r.mins, ent->r.mins ); VectorCopy( clipBrush->r.maxs, ent->r.maxs ); - G_SpawnVector( "modelOrigin", "0 0 0", ent->s.origin ); + G_SpawnVector( "modelOrigin", "0 0 0", ent->r.currentOrigin ); G_SpawnVector( "scale", "1 1 1", ent->s.origin2 ); @@ -1763,12 +1762,10 @@ void SP_func_door_model( gentity_t *ent ) ent->moverState = MODEL_POS1; ent->s.eType = ET_MODELDOOR; - VectorCopy( ent->s.origin, ent->s.pos.trBase ); ent->s.pos.trType = TR_STATIONARY; ent->s.pos.trTime = 0; ent->s.pos.trDuration = 0; VectorClear( ent->s.pos.trDelta ); - VectorCopy( ent->s.angles, ent->s.apos.trBase ); ent->s.apos.trType = TR_STATIONARY; ent->s.apos.trTime = 0; ent->s.apos.trDuration = 0; @@ -1917,7 +1914,8 @@ void SP_func_plat( gentity_t *ent ) G_SpawnString( "soundPos1", "sound/movers/plats/pt1_end.wav", &s ); ent->soundPos1 = G_SoundIndex( s ); - VectorClear( ent->s.angles ); + VectorClear( ent->s.apos.trBase ); + VectorClear( ent->r.currentAngles ); G_SpawnFloat( "speed", "200", &ent->speed ); G_SpawnInt( "dmg", "2", &ent->damage ); @@ -1933,7 +1931,7 @@ void SP_func_plat( gentity_t *ent ) height = ( ent->r.maxs[ 2 ] - ent->r.mins[ 2 ] ) - lip; // pos1 is the rest (bottom) position, pos2 is the top - VectorCopy( ent->s.origin, ent->pos2 ); + VectorCopy( ent->r.currentOrigin, ent->pos2 ); VectorCopy( ent->pos2, ent->pos1 ); ent->pos1[ 2 ] -= height; @@ -2010,14 +2008,16 @@ void SP_func_button( gentity_t *ent ) ent->wait *= 1000; // first position - VectorCopy( ent->s.origin, ent->pos1 ); + VectorCopy( ent->r.currentOrigin, ent->pos1 ); + G_SetMovedir( ent->r.currentAngles, ent->movedir ); + VectorClear( ent->s.apos.trBase ); + VectorClear( ent->r.currentAngles ); // calculate second position trap_SetBrushModel( ent, ent->model ); G_SpawnFloat( "lip", "4", &lip ); - G_SetMovedir( ent->s.angles, ent->movedir ); abs_movedir[ 0 ] = fabs( ent->movedir[ 0 ] ); abs_movedir[ 1 ] = fabs( ent->movedir[ 1 ] ); abs_movedir[ 2 ] = fabs( ent->movedir[ 2 ] ); @@ -2088,8 +2088,8 @@ void Reached_Train( gentity_t *ent ) // set the new trajectory ent->nextTrain = next->nextTrain; - VectorCopy( next->s.origin, ent->pos1 ); - VectorCopy( next->nextTrain->s.origin, ent->pos2 ); + VectorCopy( next->r.currentOrigin, ent->pos1 ); + VectorCopy( next->nextTrain->r.currentOrigin, ent->pos2 ); // if the path_corner has a speed, use that if( next->speed ) @@ -2230,7 +2230,7 @@ void Think_SetupTrainTargets( gentity_t *ent ) if( !path->target ) { G_Printf( "Train corner at %s without a target\n", - vtos( path->s.origin ) ); + vtos( path->r.currentOrigin ) ); return; } @@ -2245,7 +2245,7 @@ void Think_SetupTrainTargets( gentity_t *ent ) if( !next ) { G_Printf( "Train corner at %s without a target path_corner\n", - vtos( path->s.origin ) ); + vtos( path->r.currentOrigin ) ); return; } } while( strcmp( next->classname, "path_corner" ) ); @@ -2269,7 +2269,7 @@ void SP_path_corner( gentity_t *self ) { if( !self->targetname ) { - G_Printf( "path_corner with no targetname at %s\n", vtos( self->s.origin ) ); + G_Printf( "path_corner with no targetname at %s\n", vtos( self->r.currentOrigin ) ); G_FreeEntity( self ); return; } @@ -2304,13 +2304,13 @@ void Blocked_Train( gentity_t *self, gentity_t *other ) if( other->buildableTeam == TEAM_ALIENS ) { VectorCopy( other->s.origin2, dir ); - tent = G_TempEntity( other->s.origin, EV_ALIEN_BUILDABLE_EXPLOSION ); + tent = G_TempEntity( other->r.currentOrigin, EV_ALIEN_BUILDABLE_EXPLOSION ); tent->s.eventParm = DirToByte( dir ); } else if( other->buildableTeam == TEAM_HUMANS ) { VectorSet( dir, 0.0f, 0.0f, 1.0f ); - tent = G_TempEntity( other->s.origin, EV_HUMAN_BUILDABLE_EXPLOSION ); + tent = G_TempEntity( other->r.currentOrigin, EV_HUMAN_BUILDABLE_EXPLOSION ); tent->s.eventParm = DirToByte( dir ); } } @@ -2341,7 +2341,8 @@ The train spawns at the first target it is pointing at. */ void SP_func_train( gentity_t *self ) { - VectorClear( self->s.angles ); + VectorClear( self->s.apos.trBase ); + VectorClear( self->r.currentAngles ); if( self->spawnflags & TRAIN_BLOCK_STOPS ) self->damage = 0; @@ -2390,8 +2391,6 @@ void SP_func_static( gentity_t *ent ) { trap_SetBrushModel( ent, ent->model ); InitMover( ent ); - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - VectorCopy( ent->s.origin, ent->r.currentOrigin ); } @@ -2436,10 +2435,6 @@ void SP_func_rotating( gentity_t *ent ) trap_SetBrushModel( ent, ent->model ); InitMover( ent ); - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin ); - VectorCopy( ent->s.apos.trBase, ent->r.currentAngles ); - trap_LinkEntity( ent ); } @@ -2476,9 +2471,6 @@ void SP_func_bobbing( gentity_t *ent ) trap_SetBrushModel( ent, ent->model ); InitMover( ent ); - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - VectorCopy( ent->s.origin, ent->r.currentOrigin ); - ent->s.pos.trDuration = ent->speed * 1000; ent->s.pos.trTime = ent->s.pos.trDuration * phase; ent->s.pos.trType = TR_SINE; @@ -2537,11 +2529,6 @@ void SP_func_pendulum( gentity_t *ent ) InitMover( ent ); - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - VectorCopy( ent->s.origin, ent->r.currentOrigin ); - - VectorCopy( ent->s.angles, ent->s.apos.trBase ); - ent->s.apos.trDuration = 1000 / freq; ent->s.apos.trTime = ent->s.apos.trDuration * phase; ent->s.apos.trType = TR_SINE; diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 69dcbabd..aa30da91 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -113,8 +113,8 @@ field_t fields[ ] = { {"acceleration", FOFS(acceleration), F_VECTOR}, {"alpha", FOFS(pos1), F_VECTOR}, - {"angle", FOFS(s.angles), F_ANGLEHACK}, - {"angles", FOFS(s.angles), F_VECTOR}, + {"angle", FOFS(s.apos.trBase), F_ANGLEHACK}, + {"angles", FOFS(s.apos.trBase), F_VECTOR}, {"animation", FOFS(animation), F_VECTOR4}, {"bounce", FOFS(physicsBounce), F_FLOAT}, {"classname", FOFS(classname), F_STRING}, @@ -124,7 +124,7 @@ field_t fields[ ] = {"message", FOFS(message), F_STRING}, {"model", FOFS(model), F_STRING}, {"model2", FOFS(model2), F_STRING}, - {"origin", FOFS(s.origin), F_VECTOR}, + {"origin", FOFS(s.pos.trBase), F_VECTOR}, {"radius", FOFS(pos2), F_VECTOR}, {"random", FOFS(random), F_FLOAT}, {"rotatorAngle", FOFS(rotatorAngle), F_FLOAT}, @@ -306,8 +306,9 @@ qboolean G_CallSpawn( gentity_t *ent ) if( buildable == BA_A_SPAWN || buildable == BA_H_SPAWN ) { - ent->s.angles[ YAW ] += 180.0f; - AngleNormalize360( ent->s.angles[ YAW ] ); + ent->r.currentAngles[ YAW ] += 180.0f; + AngleNormalize360( ent->r.currentAngles[ YAW ] ); + ent->s.apos.trBase[ YAW ] = ent->r.currentAngles[ YAW ]; } G_SpawnBuildable( ent, buildable ); @@ -460,9 +461,8 @@ void G_SpawnGEntityFromSpawnVars( void ) return; } - // move editor origin to pos - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - VectorCopy( ent->s.origin, ent->r.currentOrigin ); + VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin ); + VectorCopy( ent->s.apos.trBase, ent->r.currentAngles ); // if we didn't get a classname, don't bother spawning anything if( !G_CallSpawn( ent ) ) diff --git a/src/game/g_target.c b/src/game/g_target.c index 9fbd62f0..d25b8807 100644 --- a/src/game/g_target.c +++ b/src/game/g_target.c @@ -157,7 +157,7 @@ void SP_target_speaker( gentity_t *ent ) G_SpawnFloat( "random", "0", &ent->random ); if( !G_SpawnString( "noise", "NOSOUND", &s ) ) - G_Error( "target_speaker without a noise key at %s", vtos( ent->s.origin ) ); + G_Error( "target_speaker without a noise key at %s", vtos( ent->r.currentOrigin ) ); // force all client relative sounds to be "activator" speakers that // play on the entity that activates it @@ -187,8 +187,6 @@ void SP_target_speaker( gentity_t *ent ) if( ent->spawnflags & 4 ) ent->r.svFlags |= SVF_BROADCAST; - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - // must link the entity so we get areas and clusters so // the server can determine who to send updates to trap_LinkEntity( ent ); @@ -211,7 +209,7 @@ void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activa return; } - TeleportPlayer( activator, dest->s.origin, dest->s.angles, self->speed ); + TeleportPlayer( activator, dest->r.currentOrigin, dest->r.currentAngles, self->speed ); } /*QUAKED target_teleporter (1 0 0) (-8 -8 -8) (8 8 8) @@ -220,7 +218,7 @@ The activator will be teleported away. void SP_target_teleporter( gentity_t *self ) { if( !self->targetname ) - G_Printf( "untargeted %s at %s\n", self->classname, vtos( self->s.origin ) ); + G_Printf( "untargeted %s at %s\n", self->classname, vtos( self->r.currentOrigin ) ); G_SpawnFloat( "speed", "400", &self->speed ); @@ -288,7 +286,7 @@ Used as a positional target for in-game calculation, like jumppad targets. */ void SP_target_position( gentity_t *self ) { - G_SetOrigin( self, self->s.origin ); + G_SetOrigin( self, self->r.currentOrigin ); } /*QUAKED target_location (0 0.5 0) (-8 -8 -8) (8 8 8) @@ -330,7 +328,7 @@ void SP_target_location( gentity_t *self ) level.locationHead = self; n++; - G_SetOrigin( self, self->s.origin ); + G_SetOrigin( self, self->r.currentOrigin ); } @@ -391,7 +389,7 @@ void SP_target_rumble( gentity_t *self ) if( !self->targetname ) { G_Printf( S_COLOR_YELLOW "WARNING: untargeted %s at %s\n", self->classname, - vtos( self->s.origin ) ); + vtos( self->r.currentOrigin ) ); } if( !self->count ) @@ -470,7 +468,7 @@ void SP_target_hurt( gentity_t *self ) if( !self->targetname ) { G_Printf( S_COLOR_YELLOW "WARNING: untargeted %s at %s\n", self->classname, - vtos( self->s.origin ) ); + vtos( self->r.currentOrigin ) ); } if( !self->damage ) diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index e89a7c36..9b55a157 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -26,8 +26,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA void InitTrigger( gentity_t *self ) { - if( !VectorCompare( self->s.angles, vec3_origin ) ) - G_SetMovedir( self->s.angles, self->movedir ); + if( !VectorCompare( self->r.currentAngles, vec3_origin ) ) + G_SetMovedir( self->r.currentAngles, self->movedir ); trap_SetBrushModel( self, self->model ); self->r.contents = CONTENTS_TRIGGER; // replaces the -1 from trap_SetBrushModel @@ -189,7 +189,7 @@ void AimAtTarget( gentity_t *self ) return; } - height = ent->s.origin[ 2 ] - origin[ 2 ]; + height = ent->r.currentOrigin[ 2 ] - origin[ 2 ]; gravity = g_gravity.value; time = sqrt( height / ( 0.5 * gravity ) ); @@ -200,7 +200,7 @@ void AimAtTarget( gentity_t *self ) } // set s.origin2 to the push velocity - VectorSubtract( ent->s.origin, origin, self->s.origin2 ); + VectorSubtract( ent->r.currentOrigin, origin, self->s.origin2 ); self->s.origin2[ 2 ] = 0; dist = VectorNormalize( self->s.origin2 ); @@ -251,13 +251,13 @@ void SP_target_push( gentity_t *self ) if( !self->speed ) self->speed = 1000; - G_SetMovedir( self->s.angles, self->s.origin2 ); + G_SetMovedir( self->r.currentAngles, self->s.origin2 ); VectorScale( self->s.origin2, self->speed, self->s.origin2 ); if( self->target ) { - VectorCopy( self->s.origin, self->r.absmin ); - VectorCopy( self->s.origin, self->r.absmax ); + VectorCopy( self->r.currentOrigin, self->r.absmin ); + VectorCopy( self->r.currentOrigin, self->r.absmax ); self->think = AimAtTarget; self->nextthink = level.time + FRAMETIME; } @@ -300,7 +300,7 @@ void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace return; } - TeleportPlayer( other, dest->s.origin, dest->s.angles, self->speed ); + TeleportPlayer( other, dest->r.currentOrigin, dest->r.currentAngles, self->speed ); } /* @@ -477,7 +477,7 @@ void SP_func_timer( gentity_t *self ) if( self->random >= self->wait ) { self->random = self->wait - FRAMETIME; - G_Printf( "func_timer at %s has random >= wait\n", vtos( self->s.origin ) ); + G_Printf( "func_timer at %s has random >= wait\n", vtos( self->r.currentOrigin ) ); } if( self->spawnflags & 1 ) diff --git a/src/game/g_utils.c b/src/game/g_utils.c index 8bce5a41..71cf52e4 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -716,7 +716,6 @@ void G_SetOrigin( gentity_t *ent, const vec3_t origin ) VectorClear( ent->s.pos.trDelta ); VectorCopy( origin, ent->r.currentOrigin ); - VectorCopy( origin, ent->s.origin ); } // from quakestyle.telefragged.com @@ -783,13 +782,13 @@ gentity_t *G_ClosestEnt( vec3_t origin, gentity_t **entities, int numEntities ) return NULL; closestEnt = entities[ 0 ]; - d = DistanceSquared( origin, closestEnt->s.origin ); + d = DistanceSquared( origin, closestEnt->r.currentOrigin ); for( i = 1; i < numEntities; i++ ) { gentity_t *ent = entities[ i ]; - nd = DistanceSquared( origin, ent->s.origin ); + nd = DistanceSquared( origin, ent->r.currentOrigin ); if( nd < d ) { d = nd; diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index dfa96ab3..e6b0172a 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -237,10 +237,10 @@ static void WideBloodSpurt( gentity_t *attacker, gentity_t *victim, trace_t *tr return; if( tr ) - VectorSubtract( tr->endpos, victim->s.origin, normal ); + VectorSubtract( tr->endpos, victim->r.currentOrigin, normal ); else VectorSubtract( attacker->client->ps.origin, - victim->s.origin, normal ); + victim->r.currentOrigin, normal ); // Normalize the horizontal components of the vector difference to the // "radius" of the bounding box @@ -258,7 +258,7 @@ static void WideBloodSpurt( gentity_t *attacker, gentity_t *victim, trace_t *tr if( normal[ 2 ] < victim->r.mins[ 2 ] ) normal[ 2 ] = victim->r.mins[ 2 ]; - VectorAdd( victim->s.origin, normal, origin ); + VectorAdd( victim->r.currentOrigin, normal, origin ); VectorNegate( normal, normal ); VectorNormalize( normal ); @@ -697,7 +697,7 @@ void teslaFire( gentity_t *self ) VectorMA( muzzle, self->r.maxs[ 2 ], self->s.origin2, origin ); // Don't aim for the center, aim at the top of the bounding box - VectorCopy( self->enemy->s.origin, target ); + VectorCopy( self->enemy->r.currentOrigin, target ); target[ 2 ] += self->enemy->r.maxs[ 2 ]; // Trace to the target entity @@ -985,7 +985,7 @@ void poisonCloud( gentity_t *ent ) if( humanPlayer->client && humanPlayer->client->pers.teamSelection == TEAM_HUMANS ) { - trap_Trace( &tr, muzzle, NULL, NULL, humanPlayer->s.origin, + trap_Trace( &tr, muzzle, NULL, NULL, humanPlayer->r.currentOrigin, humanPlayer->s.number, CONTENTS_SOLID ); //can't see target from here @@ -1032,8 +1032,8 @@ static void G_FindZapChainTargets( zap_t *zap ) trace_t tr; float distance; - VectorAdd( ent->s.origin, range, maxs ); - VectorSubtract( ent->s.origin, range, mins ); + VectorAdd( ent->r.currentOrigin, range, maxs ); + VectorSubtract( ent->r.currentOrigin, range, mins ); num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); @@ -1044,7 +1044,7 @@ static void G_FindZapChainTargets( zap_t *zap ) if( enemy == ent || ( enemy->client && enemy->client->noclip ) ) continue; - distance = Distance( ent->s.origin, enemy->s.origin ); + distance = Distance( ent->r.currentOrigin, enemy->r.currentOrigin ); if( ( ( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) || @@ -1054,8 +1054,8 @@ static void G_FindZapChainTargets( zap_t *zap ) distance <= LEVEL2_AREAZAP_CHAIN_RANGE ) { // world-LOS check: trace against the world, ignoring other BODY entities - trap_Trace( &tr, ent->s.origin, NULL, NULL, - enemy->s.origin, ent->s.number, CONTENTS_SOLID ); + trap_Trace( &tr, ent->r.currentOrigin, NULL, NULL, + enemy->r.currentOrigin, ent->s.number, CONTENTS_SOLID ); if( tr.entityNum == ENTITYNUM_NONE ) { @@ -1086,7 +1086,7 @@ static void G_UpdateZapEffect( zap_t *zap ) BG_PackEntityNumbers( &zap->effectChannel->s, entityNums, zap->numTargets + 1 ); - VectorCopy( zap->creator->s.origin, zap->effectChannel->r.currentOrigin ); + VectorCopy( zap->creator->r.currentOrigin, zap->effectChannel->r.currentOrigin ); trap_LinkEntity( zap->effectChannel ); } @@ -1117,7 +1117,7 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target ) if( target->health > 0 ) { G_Damage( target, creator, creator, forward, - target->s.origin, LEVEL2_AREAZAP_DMG, + target->r.currentOrigin, LEVEL2_AREAZAP_DMG, DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, MOD_LEVEL2_ZAP ); @@ -1125,7 +1125,7 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target ) for( i = 1; i < zap->numTargets; i++ ) { - G_Damage( zap->targets[ i ], target, zap->creator, forward, target->s.origin, + G_Damage( zap->targets[ i ], target, zap->creator, forward, target->r.currentOrigin, LEVEL2_AREAZAP_DMG * ( 1 - pow( (zap->distances[ i ] / LEVEL2_AREAZAP_CHAIN_RANGE ), LEVEL2_AREAZAP_CHAIN_FALLOFF ) ) + 1, DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, @@ -1328,7 +1328,7 @@ void G_ChargeAttack( gentity_t *ent, gentity_t *victim ) ent->client->ps.weaponTime ) return; - VectorSubtract( victim->s.origin, ent->s.origin, forward ); + VectorSubtract( victim->r.currentOrigin, ent->r.currentOrigin, forward ); VectorNormalize( forward ); if( !victim->takedamage ) @@ -1355,7 +1355,7 @@ void G_ChargeAttack( gentity_t *ent, gentity_t *victim ) damage = LEVEL4_TRAMPLE_DMG * ent->client->ps.stats[ STAT_MISC ] / LEVEL4_TRAMPLE_DURATION; - G_Damage( victim, ent, ent, forward, victim->s.origin, damage, + G_Damage( victim, ent, ent, forward, victim->r.currentOrigin, damage, DAMAGE_NO_LOCDAMAGE, MOD_LEVEL4_TRAMPLE ); ent->client->ps.weaponTime += LEVEL4_TRAMPLE_REPEAT; @@ -1376,7 +1376,7 @@ void G_CrushAttack( gentity_t *ent, gentity_t *victim ) if( !victim->takedamage || ent->client->ps.origin[ 2 ] + ent->r.mins[ 2 ] < - victim->s.origin[ 2 ] + victim->r.maxs[ 2 ] || + victim->r.currentOrigin[ 2 ] + victim->r.maxs[ 2 ] || ( victim->client && victim->client->ps.groundEntityNum == ENTITYNUM_NONE ) ) return; @@ -1401,8 +1401,8 @@ void G_CrushAttack( gentity_t *ent, gentity_t *victim ) return; // Crush the victim over a period of time - VectorSubtract( victim->s.origin, ent->client->ps.origin, dir ); - G_Damage( victim, ent, ent, dir, victim->s.origin, damage, + VectorSubtract( victim->r.currentOrigin, ent->client->ps.origin, dir ); + G_Damage( victim, ent, ent, dir, victim->r.currentOrigin, damage, DAMAGE_NO_LOCDAMAGE, MOD_LEVEL4_CRUSH ); } |