From 4f135b96bbce8ccfdf461f68347daa514df87e59 Mon Sep 17 00:00:00 2001 From: maek Date: Fri, 24 Mar 2017 10:15:47 +0000 Subject: [PATCH] Fix FloodEntities origin-less check --- tools/quake3/q3map2/bspfile_abstract.c | 5 ++++- tools/quake3/q3map2/portals.c | 6 +++--- tools/quake3/q3map2/q3map2.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index 1dab66db..cea3239a 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -831,7 +831,7 @@ vec_t FloatForKey( const entity_t *ent, const char *key ){ gets a 3-element vector value for an entity key */ -void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ){ +qboolean GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ){ const char *k; double v1, v2, v3; @@ -845,6 +845,9 @@ void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ){ vec[ 0 ] = v1; vec[ 1 ] = v2; vec[ 2 ] = v3; + + /* true if the key is found, false otherwise */ + return strlen( k ); } diff --git a/tools/quake3/q3map2/portals.c b/tools/quake3/q3map2/portals.c index aee1446e..20ed301b 100644 --- a/tools/quake3/q3map2/portals.c +++ b/tools/quake3/q3map2/portals.c @@ -664,7 +664,7 @@ qboolean PlaceOccupant( node_t *headnode, vec3_t origin, entity_t *occupant, qbo int FloodEntities( tree_t *tree ){ int i, s; vec3_t origin, offset, scale, angles; - qboolean r, inside, skybox; + qboolean r, inside, skybox, found; node_t *headnode; entity_t *e, *tripped; const char *value; @@ -684,10 +684,10 @@ int FloodEntities( tree_t *tree ){ e = &entities[ i ]; /* get origin */ - GetVectorForKey( e, "origin", origin ); + found = GetVectorForKey( e, "origin", origin ); /* as a special case, allow origin-less entities */ - if ( VectorCompare( origin, vec3_origin ) ) { + if ( !found ) { continue; } diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 7bbbc42b..44cd0b58 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1913,7 +1913,7 @@ qboolean KeyExists( const entity_t *ent, const char *key ); / const char *ValueForKey( const entity_t *ent, const char *key ); int IntForKey( const entity_t *ent, const char *key ); vec_t FloatForKey( const entity_t *ent, const char *key ); -void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ); +qboolean GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ); entity_t *FindTargetEntity( const char *target ); void GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castShadows, int *recvShadows ); void InjectCommandLine( char **argv, int beginArgs, int endArgs ); -- 2.39.2