diff options
-rw-r--r-- | src/cgame/cg_ents.c | 25 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 9 |
3 files changed, 8 insertions, 30 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index b2794a8b..7b27579a 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -782,26 +782,6 @@ static void CG_LightFlare( centity_t *cent ) /* ========================= -CG_LinkLocation -========================= -*/ -void CG_LinkLocation( centity_t *cent ) -{ - centity_t *tempent; - - for( tempent = cg.locationHead; tempent; tempent = tempent->nextLocation ) - { - if( tempent == cent ) - return; - } - - cent->nextLocation = cg.locationHead; - cg.locationHead = cent; - -} - -/* -========================= CG_Lev2ZapChain ========================= */ @@ -1091,6 +1071,7 @@ static void CG_AddCEntity( centity_t *cent ) case ET_INVISIBLE: case ET_PUSH_TRIGGER: case ET_TELEPORT_TRIGGER: + case ET_LOCATION: break; case ET_GENERAL: @@ -1148,10 +1129,6 @@ static void CG_AddCEntity( centity_t *cent ) case ET_LEV2_ZAP_CHAIN: CG_Lev2ZapChain( cent ); break; - - case ET_LOCATION: - CG_LinkLocation( cent ); - break; } } diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 09737d20..98f72809 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1153,8 +1153,6 @@ typedef struct int nearUsableBuildable; int nextWeaponClickTime; - - centity_t *locationHead; } cg_t; @@ -1708,8 +1706,6 @@ void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *pare qhandle_t parentModel, char *tagName ); void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName ); -void CG_LinkLocation( centity_t* cent ); - // diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index c23d5697..e5becd27 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -2382,6 +2382,7 @@ void CG_PlayerDisconnect( vec3_t org ) centity_t *CG_GetPlayerLocation( void ) { + int i; centity_t *eloc, *best; float bestlen, len; vec3_t origin; @@ -2391,13 +2392,17 @@ centity_t *CG_GetPlayerLocation( void ) VectorCopy( cg.predictedPlayerState.origin, origin ); - for( eloc = cg.locationHead; eloc; eloc = eloc->nextLocation ) + for( i = MAX_CLIENTS; i < MAX_GENTITIES; i++ ) { + eloc = &cg_entities[ i ]; + if( !eloc->valid || eloc->currentState.eType != ET_LOCATION ) + continue; + len = DistanceSquared(origin, eloc->lerpOrigin); if( len > bestlen ) continue; - + if( !trap_R_inPVS( origin, eloc->lerpOrigin ) ) continue; |