diff options
author | /dev/humancontroller <devhc@example.com> | 2014-07-13 19:16:08 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:13 +0100 |
commit | f62e00c4ac73d7b3803cad8bd8eaa260531b0381 (patch) | |
tree | c6b01046347e90bbcbebedc2874756e22023560e | |
parent | 7a159b88bb85822c58a21c0d13fc2d8d90b3fb68 (diff) |
also use configstring #CS_LOCATIONS+0 for storing location names
includes some refactoring
-rw-r--r-- | src/cgame/cg_draw.c | 7 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 4 | ||||
-rw-r--r-- | src/game/g_target.c | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 4d70b343..690df742 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2645,10 +2645,9 @@ static void CG_DrawLocation( rectDef_t *rect, float scale, int textalign, vec4_t maxX = rect->x + rect->w; locent = CG_GetPlayerLocation( ); - if( locent ) - location = CG_ConfigString( CS_LOCATIONS + locent->currentState.generic1 ); - else - location = CG_ConfigString( CS_LOCATIONS ); + if( !locent ) + return; + location = CG_ConfigString( CS_LOCATIONS + locent->currentState.generic1 ); // need to skip horiz. align if it's too long, but valign must be run either way if( UI_Text_Width( location, scale ) < rect->w ) diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 0060d661..6338ceaf 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -2381,7 +2381,7 @@ centity_t *CG_GetPlayerLocation( void ) vec3_t origin; best = NULL; - bestlen = 3.0f * 8192.0f * 8192.0f; + bestlen = 0.0f; VectorCopy( cg.predictedPlayerState.origin, origin ); @@ -2393,7 +2393,7 @@ centity_t *CG_GetPlayerLocation( void ) len = DistanceSquared(origin, eloc->lerpOrigin); - if( len > bestlen ) + if( best != NULL && len > bestlen ) continue; if( !trap_R_inPVS( origin, eloc->lerpOrigin ) ) diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index fec4cfae..f4fb1d54 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -909,12 +909,12 @@ static void CG_Say( int clientNum, saymode_t mode, const char *text ) if( locent ) locationNum = locent->currentState.generic1; else - locationNum = 0; + locationNum = -1; } else locationNum = ci->location; - if( locationNum > 0 && locationNum < MAX_LOCATIONS ) + if( locationNum >= 0 && locationNum < MAX_LOCATIONS ) { const char *s = CG_ConfigString( CS_LOCATIONS + locationNum ); diff --git a/src/game/g_target.c b/src/game/g_target.c index 2ff6ab27..9fbd62f0 100644 --- a/src/game/g_target.c +++ b/src/game/g_target.c @@ -301,7 +301,7 @@ in site, closest in distance */ void SP_target_location( gentity_t *self ) { - static int n = 1; + static int n = 0; char *message; self->s.eType = ET_LOCATION; self->r.svFlags = SVF_BROADCAST; |