[ioquake3] 03/50: Fix Team Arena team base models not dropping to floor

Simon McVittie smcv at debian.org
Sun Jul 23 21:55:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit f19efb77c8cae5768cbcf1e96448a7dad108e2bb
Author: Zack Middleton <zack at cloemail.com>
Date:   Sat Jun 24 19:31:23 2017 -0500

    Fix Team Arena team base models not dropping to floor
    
    Team Arena's Overload gametype has red and blue team Obelisk base
    objects. It uses separate entities for visual and damage. Only the
    damageable entity was dropped to floor. Leaving model floating off
    the ground.
    
    Team Arena's Harvester base has the same problem. Model entity
    floats in air but trigger entity drops to floor.
    
    Drop all Team Arena team base models to floor. Fixes CTF, 1Flag,
    Overload, and Harvester base models.
---
 code/game/g_team.c | 54 +++++++++++++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 21 deletions(-)

diff --git a/code/game/g_team.c b/code/game/g_team.c
index 12d9f6a..7e0e90b 100644
--- a/code/game/g_team.c
+++ b/code/game/g_team.c
@@ -1313,9 +1313,8 @@ static void ObeliskPain( gentity_t *self, gentity_t *attacker, int damage ) {
 	AddScore(attacker, self->r.currentOrigin, actualDamage);
 }
 
-gentity_t *SpawnObelisk( vec3_t origin, int team, int spawnflags) {
-	trace_t		tr;
-	vec3_t		dest;
+// spawn invisible damagable obelisk entity / harvester base trigger.
+gentity_t *SpawnObelisk( vec3_t origin, vec3_t mins, vec3_t maxs, int team ) {
 	gentity_t	*ent;
 
 	ent = G_Spawn();
@@ -1324,8 +1323,8 @@ gentity_t *SpawnObelisk( vec3_t origin, int team, int spawnflags) {
 	VectorCopy( origin, ent->s.pos.trBase );
 	VectorCopy( origin, ent->r.currentOrigin );
 
-	VectorSet( ent->r.mins, -15, -15, 0 );
-	VectorSet( ent->r.maxs, 15, 15, 87 );
+	VectorCopy( mins, ent->r.mins );
+	VectorCopy( maxs, ent->r.maxs );
 
 	ent->s.eType = ET_GENERAL;
 	ent->flags = FL_NO_KNOCKBACK;
@@ -1344,7 +1343,26 @@ gentity_t *SpawnObelisk( vec3_t origin, int team, int spawnflags) {
 		ent->touch = ObeliskTouch;
 	}
 
-	if ( spawnflags & 1 ) {
+	G_SetOrigin( ent, ent->s.origin );
+
+	ent->spawnflags = team;
+
+	trap_LinkEntity( ent );
+
+	return ent;
+}
+
+// setup entity for team base model / obelisk model.
+void ObeliskInit( gentity_t *ent ) {
+	trace_t tr;
+	vec3_t dest;
+
+	ent->s.eType = ET_TEAM;
+
+	VectorSet( ent->r.mins, -15, -15, 0 );
+	VectorSet( ent->r.maxs, 15, 15, 87 );
+
+	if ( ent->spawnflags & 1 ) {
 		// suspended
 		G_SetOrigin( ent, ent->s.origin );
 	} else {
@@ -1368,12 +1386,6 @@ gentity_t *SpawnObelisk( vec3_t origin, int team, int spawnflags) {
 			G_SetOrigin( ent, tr.endpos );
 		}
 	}
-
-	ent->spawnflags = team;
-
-	trap_LinkEntity( ent );
-
-	return ent;
 }
 
 /*QUAKED team_redobelisk (1 0 0) (-16 -16 0) (16 16 8)
@@ -1385,16 +1397,16 @@ void SP_team_redobelisk( gentity_t *ent ) {
 		G_FreeEntity(ent);
 		return;
 	}
-	ent->s.eType = ET_TEAM;
+	ObeliskInit( ent );
 	if ( g_gametype.integer == GT_OBELISK ) {
-		obelisk = SpawnObelisk( ent->s.origin, TEAM_RED, ent->spawnflags );
+		obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_RED );
 		obelisk->activator = ent;
 		// initial obelisk health value
 		ent->s.modelindex2 = 0xff;
 		ent->s.frame = 0;
 	}
 	if ( g_gametype.integer == GT_HARVESTER ) {
-		obelisk = SpawnObelisk( ent->s.origin, TEAM_RED, ent->spawnflags );
+		obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_RED );
 		obelisk->activator = ent;
 	}
 	ent->s.modelindex = TEAM_RED;
@@ -1410,16 +1422,16 @@ void SP_team_blueobelisk( gentity_t *ent ) {
 		G_FreeEntity(ent);
 		return;
 	}
-	ent->s.eType = ET_TEAM;
+	ObeliskInit( ent );
 	if ( g_gametype.integer == GT_OBELISK ) {
-		obelisk = SpawnObelisk( ent->s.origin, TEAM_BLUE, ent->spawnflags );
+		obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_BLUE );
 		obelisk->activator = ent;
 		// initial obelisk health value
 		ent->s.modelindex2 = 0xff;
 		ent->s.frame = 0;
 	}
 	if ( g_gametype.integer == GT_HARVESTER ) {
-		obelisk = SpawnObelisk( ent->s.origin, TEAM_BLUE, ent->spawnflags );
+		obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_BLUE );
 		obelisk->activator = ent;
 	}
 	ent->s.modelindex = TEAM_BLUE;
@@ -1433,10 +1445,10 @@ void SP_team_neutralobelisk( gentity_t *ent ) {
 		G_FreeEntity(ent);
 		return;
 	}
-	ent->s.eType = ET_TEAM;
+	ObeliskInit( ent );
 	if ( g_gametype.integer == GT_HARVESTER) {
-		neutralObelisk = SpawnObelisk( ent->s.origin, TEAM_FREE, ent->spawnflags);
-		neutralObelisk->spawnflags = TEAM_FREE;
+		neutralObelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_FREE );
+		neutralObelisk->activator = ent;
 	}
 	ent->s.modelindex = TEAM_FREE;
 	trap_LinkEntity(ent);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list