diff options
author | enneract <trem.redman@gmail.com> | 2014-12-14 14:56:38 +0100 |
---|---|---|
committer | enneract <trem.redman@gmail.com> | 2014-12-14 14:56:38 +0100 |
commit | 7c02e34b08a4e44a7f7935bf6b1bee45c3a8df6c (patch) | |
tree | e3ff69394522a6cc7dd11edf27cd69df6c0a5819 /src/cgame/cg_view.c | |
parent | bd6fc418d171378de5de2b7450e22f70b4899b5c (diff) | |
parent | 5130cdd357c5b3b442d39ee05052739419456e77 (diff) |
Merge branch 'newguns'
Conflicts:
src/cgame/cg_local.h
src/cgame/cg_main.c
Diffstat (limited to 'src/cgame/cg_view.c')
-rw-r--r-- | src/cgame/cg_view.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index a0142d0..eb6e88d 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -537,6 +537,29 @@ 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; + } + + if( cg.viewQuake > cg_viewQuakeLimit.value ) + cg.viewQuake = cg_viewQuakeLimit.value; +} /* =============== @@ -838,6 +861,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 ); + } } //====================================================================== |