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
This commit is contained in:
divverent 2009-01-01 12:14:01 +00:00
parent 733ae2732e
commit c75784be71
2 changed files with 15 additions and 4 deletions

View File

@ -595,6 +595,19 @@ produces a final brush based on the buildBrush->sides array
and links it to the current entity 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 *FinishBrush( void )
{ {
brush_t *b; brush_t *b;
@ -621,10 +634,7 @@ brush_t *FinishBrush( void )
VectorAdd (buildBrush->mins, buildBrush->maxs, origin); VectorAdd (buildBrush->mins, buildBrush->maxs, origin);
VectorScale (origin, 0.5, origin); VectorScale (origin, 0.5, origin);
sprintf( string, "%i %i %i", (int) origin[ 0 ], (int) origin[ 1 ], (int) origin[ 2 ] ); MergeOrigin(&entities[ numEntities - 1 ], origin);
SetKeyValue( &entities[ numEntities - 1 ], "origin", string);
VectorCopy( origin, entities[ numEntities - 1 ].origin);
/* don't keep this brush */ /* don't keep this brush */
return NULL; return NULL;

View File

@ -1076,6 +1076,7 @@ typedef struct
int mapEntityNum, firstDrawSurf; int mapEntityNum, firstDrawSurf;
int firstBrush, numBrushes; /* only valid during BSP compile */ int firstBrush, numBrushes; /* only valid during BSP compile */
epair_t *epairs; epair_t *epairs;
vec3_t originbrush_origin;
} }
entity_t; entity_t;