From 54249920dea34a3b848e91c106eafbbf9e6cfe45 Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Sat, 3 Oct 2009 12:26:34 +0000 Subject: * Fix the order of the arguments to APropHovel_Blocked so that it's not completely broken. Mysterious successes and failures of allowed hovel placement should no longer occur. * Prevent hovels allowing grangers to get outside the map, once again (thanks Rezyn) --- src/game/g_buildable.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 7ae279d7..870fa6fe 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1235,6 +1235,16 @@ qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideEx VectorMaxComponent( hovelMaxs ) * M_ROOT3 + 1.0f; VectorMA( hovel->s.origin, displacement, forward, origin ); + + VectorCopy( hovel->s.origin, start ); + VectorCopy( origin, end ); + + // see if there's something between the hovel and its exit + // (eg built right up against a wall) + trap_Trace( &tr, start, NULL, NULL, end, player->s.number, MASK_PLAYERSOLID ); + if( tr.fraction < 1.0f ) + return qtrue; + vectoangles( forward, angles ); VectorMA( origin, HOVEL_TRACE_DEPTH, normal, start ); @@ -3081,7 +3091,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance //this assumes the adv builder is the biggest thing that'll use the hovel BG_ClassBoundingBox( PCL_ALIEN_BUILDER0_UPG, builderMins, builderMaxs, NULL, NULL, NULL ); - if( APropHovel_Blocked( angles, origin, normal, ent ) ) + if( APropHovel_Blocked( origin, angles, normal, ent ) ) reason = IBE_HOVELEXIT; } -- cgit