summaryrefslogtreecommitdiff
path: root/src/cgame/cg_view.c
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2014-12-13 16:06:15 +0100
committerenneract <trem.redman@gmail.com>2014-12-13 16:06:15 +0100
commitd1853e239ae258e394a516f0eeda80f430a1a328 (patch)
treec32016d8a27b10d09d2331ea5314f0ccf63346e0 /src/cgame/cg_view.c
parent2fde9f3481239b2b2226ee812dd34ed4d8d5d6d6 (diff)
View quake, improved Rocket Launcher assets.
(FIXME: Rocket explosion doesn't fade out)
Diffstat (limited to 'src/cgame/cg_view.c')
-rw-r--r--src/cgame/cg_view.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index a0142d0..68f9287 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -537,6 +537,26 @@ static void CG_StepOffset( void )
#define PCLOUD_ZOOM_FREQUENCY 0.625f // 2.5s / 4
#define PCLOUD_DISORIENT_DURATION 2500
+/*
+===============
+CG_InduceViewQuake
+===============
+*/
+
+void CG_InduceViewQuake( vec3_t src, float mag )
+{
+ if( !src )
+ {
+ cg.viewQuake += mag;
+ }
+ else
+ {
+ float dist;
+
+ dist = Distance( src, cg.refdef.vieworg );
+ cg.viewQuake += mag / dist / dist * 1000.0f;
+ }
+}
/*
===============
@@ -838,6 +858,20 @@ void CG_OffsetFirstPersonView( void )
// add step offset
CG_StepOffset( );
+
+
+ // view quake
+ if( cg.thisFrameTeleport )
+ {
+ cg.viewQuake = 0;
+ }
+ else
+ {
+ angles[ PITCH ] += crandom( ) * cg.viewQuake * cg_viewQuake.value;
+ angles[ YAW ] += crandom( ) * cg.viewQuake * cg_viewQuake.value;
+
+ cg.viewQuake *= pow( 2, (float)cg.frametime * 1.0e-3 * cg_viewQuakeLambda.value );
+ }
}
//======================================================================