commit 920c3d4a96b1bbd5624b0abec70b540214285031 Author: devhc Date: Thu Apr 21 21:08:40 2011 +0200 add a BG function to get the view origin of a client diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index d99eb61..7c6d839 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -3272,6 +3272,20 @@ void BG_GetClientNormal( const playerState_t *ps, vec3_t normal ) /* =============== +BG_GetClientViewOrigin + +Get the position of the client's eye, based on the client's position, the surface's normal, and client's view height +=============== +*/ +void BG_GetClientViewOrigin( const playerState_t *ps, vec3_t viewOrigin ) +{ + vec3_t normal; + BG_GetClientNormal( ps, normal ); + VectorMA( ps->origin, ps->viewheight, normal, viewOrigin ); +} + +/* +=============== BG_PositionBuildableRelativeToPlayer Find a place to build a buildable diff --git a/src/game/bg_public.h b/src/game/bg_public.h index baff633..da2b24b 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1104,6 +1104,7 @@ qboolean BG_UpgradeIsActive( int item, int stats[ ] ); qboolean BG_RotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ); void BG_GetClientNormal( const playerState_t *ps, vec3_t normal ); +void BG_GetClientViewOrigin( const playerState_t *ps, vec3_t viewOrigin ); void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, const vec3_t mins, const vec3_t maxs, void (*trace)( trace_t *, const vec3_t, const vec3_t,