All pastes #937708 Raw Edit

ufo:ai breakable bounding box fi

public text v1 · immutable
·published 2008-03-11 03:51 UTC
rendered paste body
Index: g_spawn.c
===================================================================
--- g_spawn.c	(revision 15680)
+++ g_spawn.c	(working copy)
@@ -297,13 +297,20 @@
 			ent = g_edicts;
 		else
 			ent = G_Spawn();
+
 		entities = ED_ParseEdict(entities, ent);
 
+		ent->mapNum = entnum++;
+
+		/* Set the position of the entity */
 		VecToPos(ent->origin, ent->pos);
-		gi.GridPosToVec(gi.routingMap, ent->pos, ent->origin);
 
-		ent->mapNum = entnum++;
+		/*Call this entity's specific initializer (sets ent->type) */
 		ED_CallSpawn(ent);
+
+		/* if this entity is not an actor, then center its origin based on its position */
+		if (ent->type != ET_BREAKABLE && ent->type != ET_BREAKABLE)
+			gi.GridPosToVec(gi.routingMap, ent->pos, ent->origin);
 	}
 
 	/* spawn ai players, if needed */