summaryrefslogtreecommitdiff
path: root/src/cgame/cg_buildable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame/cg_buildable.c')
-rw-r--r--src/cgame/cg_buildable.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 08b91b3c..c550d11a 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -295,7 +295,7 @@ void CG_GhostBuildable( buildable_t buildable )
{
refEntity_t ent;
playerState_t *ps;
- vec3_t angles, forward, player_origin, entity_origin, target_origin;
+ vec3_t angles, forward, player_origin, entity_origin, target_origin, normal;
vec3_t mins, maxs, start, end;
float distance;
trace_t tr;
@@ -306,6 +306,7 @@ void CG_GhostBuildable( buildable_t buildable )
VectorCopy( cg.predictedPlayerState.viewangles, angles );
angles[ PITCH ] = 0; // always forward
+ /////FIXME PITCH CAN'T BE ZERO
AngleVectors( angles, forward, NULL, NULL );
VectorCopy( ps->origin, player_origin );
@@ -313,15 +314,28 @@ void CG_GhostBuildable( buildable_t buildable )
distance = BG_FindBuildDistForClass( ps->stats[ STAT_PCLASS ] );
VectorMA( player_origin, distance, forward, entity_origin );
+ if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING )
+ {
+ if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
+ VectorSet( normal, 0.0f, 0.0f, -1.0f );
+ else
+ VectorCopy( cg.predictedPlayerState.grapplePoint, normal );
+ }
+ else
+ VectorSet( normal, 0.0f, 0.0f, 1.0f );
+
VectorCopy( entity_origin, target_origin );
- entity_origin[ 2 ] += 32;
- target_origin[ 2 ] -= 4096;
+ VectorMA( entity_origin, 32, normal, entity_origin );
+ VectorMA( target_origin, -4096, normal, target_origin );
+/* entity_origin[ 2 ] += 32;
+ target_origin[ 2 ] -= 4096;*/
BG_FindBBoxForBuildable( buildable, mins, maxs );
CG_Trace( &tr, entity_origin, mins, maxs, target_origin, ps->clientNum, MASK_PLAYERSOLID );
VectorCopy( tr.endpos, entity_origin );
- entity_origin[ 2 ] += 0.1f;
+ /*entity_origin[ 2 ] += 0.1f;*/
+ VectorMA( entity_origin, 0.1f, normal, entity_origin );
AngleVectors( angles, forward, NULL, NULL );
VectorCopy( tr.plane.normal, ent.axis[2] );