From c75784be7173dd2fae93906b3bd8c469bb9caeab Mon Sep 17 00:00:00 2001 From: divverent Date: Thu, 1 Jan 2009 12:14:01 +0000 Subject: [PATCH] if an origin brush exists, ALSO take into account the "origin" key (add the two) git-svn-id: svn://svn.icculus.org/netradiant/trunk@143 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/map.c | 18 ++++++++++++++---- tools/quake3/q3map2/q3map2.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tools/quake3/q3map2/map.c b/tools/quake3/q3map2/map.c index 78c77293..18ab6b21 100644 --- a/tools/quake3/q3map2/map.c +++ b/tools/quake3/q3map2/map.c @@ -595,6 +595,19 @@ produces a final brush based on the buildBrush->sides array and links it to the current entity */ +static void MergeOrigin(entity_t *ent, vec3_t origin) +{ + vec3_t adjustment; + + VectorMA(origin, -1, ent->originbrush_origin, adjustment); + VectorAdd(adjustment, ent->origin, ent->origin); + VectorCopy(origin, ent->originbrush_origin); + + char string[128]; + sprintf(string, "%f %f %f", ent->origin[0], ent->origin[1], ent->origin[2]); + SetKeyValue(ent, "origin", string); +} + brush_t *FinishBrush( void ) { brush_t *b; @@ -621,10 +634,7 @@ brush_t *FinishBrush( void ) VectorAdd (buildBrush->mins, buildBrush->maxs, origin); VectorScale (origin, 0.5, origin); - sprintf( string, "%i %i %i", (int) origin[ 0 ], (int) origin[ 1 ], (int) origin[ 2 ] ); - SetKeyValue( &entities[ numEntities - 1 ], "origin", string); - - VectorCopy( origin, entities[ numEntities - 1 ].origin); + MergeOrigin(&entities[ numEntities - 1 ], origin); /* don't keep this brush */ return NULL; diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 96a8799e..2fe5f7b8 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1076,6 +1076,7 @@ typedef struct int mapEntityNum, firstDrawSurf; int firstBrush, numBrushes; /* only valid during BSP compile */ epair_t *epairs; + vec3_t originbrush_origin; } entity_t; -- 2.39.2