From f4413207a03658c719987d02fdbb87443843f43b Mon Sep 17 00:00:00 2001 From: enneract Date: Sun, 23 Nov 2014 22:29:30 +0100 Subject: Remove Smoke Grenade. --- src/cgame/cg_event.c | 10 +--------- src/cgame/cg_weapons.c | 2 -- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 794b8a4..d9e2f77 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -244,10 +244,7 @@ static void CG_Obituary( entityState_t *ent ) else message = "^5was terminated by own flames"; break; - - case MOD_SMOKE: - message = "^5smoked himself up"; - break; + case MOD_ABOMB: message = "^5bombed himself up"; break; @@ -357,11 +354,6 @@ static void CG_Obituary( entityState_t *ent ) message2 = "^5's ^5flames"; break; - case MOD_SMOKE: - message = "^5tasted^7"; - message2 = "^5's ^5smoke"; - break; - case MOD_ABUILDER_CLAW: message = "^5should leave^7"; message2 = "^5's ^5buildings alone"; diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 2b41d13..04f6495 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -65,8 +65,6 @@ void CG_RegisterUpgrade( int upgradeNum ) upgradeInfo->upgradeIcon = cg_weapons[ WP_GRENADE ].weaponIcon; else if( upgradeNum == UP_MINE ) upgradeInfo->upgradeIcon = cg_weapons[ WP_MINE ].weaponIcon; - else if( upgradeNum == UP_SMOKE ) - upgradeInfo->upgradeIcon = cg_weapons[ WP_SMOKE ].weaponIcon; else if( ( icon = BG_Upgrade( upgradeNum )->icon ) ) upgradeInfo->upgradeIcon = trap_R_RegisterShader( icon ); } -- cgit From b0a9981e09bbc7c30769f680a4e0ff17c9ea8239 Mon Sep 17 00:00:00 2001 From: enneract Date: Mon, 24 Nov 2014 02:20:51 +0100 Subject: Implement the Lightning Gun. --- src/cgame/cg_local.h | 2 + src/cgame/cg_main.c | 3 +- src/cgame/cg_weapons.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index a477336..72b5a96 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1336,6 +1336,8 @@ typedef struct qhandle_t headShotPS; qhandle_t humanWoundsBleedPS; qhandle_t alienWoundsBleedPS; + + qhandle_t lightningBeam; } cgMedia_t; typedef struct diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index b7885ec..9abdc7e 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -821,7 +821,8 @@ static void CG_RegisterGraphics( void ) cgs.media.healthCrossPoisoned = trap_R_RegisterShader( "ui/assets/neutral/cross_poison.tga" ); cgs.media.upgradeClassIconShader = trap_R_RegisterShader( "icons/icona_upgrade.tga" ); - + + cgs.media.lightningBeam = trap_R_RegisterShader( "gfx/lightning/beam" ); cgs.media.disconnectPS = CG_RegisterParticleSystem( "disconnectPS" ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 04f6495..86306e1 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -866,6 +866,60 @@ static float CG_MachinegunSpinAngle( centity_t *cent, qboolean firing ) return angle; } +/* +============= +CG_RenderBeam +============= +*/ + +void CG_RenderGenericBeam( const vec3_t start, const vec3_t end, qhandle_t shader, float radius ) +{ + vec3_t delta, viewdelta, side; + float length; + polyVert_t quad[ 4 ]; + + VectorSubtract( end, start, delta ); + length = VectorLength( delta ); + VectorSubtract( start, cg.refdef.vieworg, viewdelta ); + CrossProduct( delta, viewdelta, side ); + VectorNormalize( side ); + + VectorMA( start, radius, side, quad[ 3 ].xyz ); + VectorMA( start, -radius, side, quad[ 2 ].xyz ); + VectorMA( end, -radius, side, quad[ 1 ].xyz ); + VectorMA( end, radius, side, quad[ 0 ].xyz ); + + quad[ 0 ].st[ 0 ] = length / radius * 0.1; + quad[ 0 ].st[ 1 ] = 0; + quad[ 0 ].modulate[ 0 ] = 255; + quad[ 0 ].modulate[ 1 ] = 255; + quad[ 0 ].modulate[ 2 ] = 255; + quad[ 0 ].modulate[ 3 ] = 255; + + quad[ 1 ].st[ 0 ] = length / radius * 0.1; + quad[ 1 ].st[ 1 ] = 1; + quad[ 1 ].modulate[ 0 ] = 255; + quad[ 1 ].modulate[ 1 ] = 255; + quad[ 1 ].modulate[ 2 ] = 255; + quad[ 1 ].modulate[ 3 ] = 255; + + quad[ 2 ].st[ 0 ] = 0; + quad[ 2 ].st[ 1 ] = 1; + quad[ 2 ].modulate[ 0 ] = 255; + quad[ 2 ].modulate[ 1 ] = 255; + quad[ 2 ].modulate[ 2 ] = 255; + quad[ 2 ].modulate[ 3 ] = 255; + + quad[ 3 ].st[ 0 ] = 0; + quad[ 3 ].st[ 1 ] = 0; + quad[ 3 ].modulate[ 0 ] = 255; + quad[ 3 ].modulate[ 1 ] = 255; + quad[ 3 ].modulate[ 2 ] = 255; + quad[ 3 ].modulate[ 3 ] = 255; + + trap_R_AddPolyToScene( shader, 4, quad ); +} + /* ============= @@ -876,6 +930,7 @@ The main player will have this called for BOTH cases, so effects like light and sound should only be done on the world model case. ============= */ + void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent ) { refEntity_t gun; @@ -1114,6 +1169,52 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent cent->muzzlePsTrigger = qfalse; } + if( weaponNum == WP_LIGHTNING_GUN ) + { + attachment_t attachment; + vec3_t muzzle, forward, end, beam_start; + trace_t tr; + + if( ps ) + { + BG_GetClientViewOrigin( ps, muzzle ); + AngleVectors( ps->viewangles, forward, NULL, NULL ); + } + else + { + // NOTE: this code assumes that the player's normal is (0,0,1) + // it will break when humans start walking on walls + class_t class = ( cent->currentState.misc >> 8 ) & 0xFF; + + VectorCopy( cent->lerpOrigin, muzzle ); + + // the only way to tell if a human is crouching is to check its bbox + // which is transmitted in a weird, encoded form (hence the magic number) + if( class == PCL_HUMAN && cent->currentState.solid == 3151887 ) + muzzle[ 2 ] += BG_ClassConfig( class )->crouchViewheight; + else + muzzle[ 2 ] += BG_ClassConfig( class )->viewheight; + + AngleVectors( cent->lerpAngles, forward, NULL, NULL ); + } + + VectorMA( muzzle, LIGHTNING_RANGE, forward, end ); + + CG_Trace( &tr, muzzle, NULL, NULL, end, cg.predictedPlayerState.clientNum, MASK_SHOT ); + + memset( &attachment, 0, sizeof( attachment ) ); + + if( noGunModel ) + CG_SetAttachmentTag( &attachment, *parent, parent->hModel, "tag_weapon" ); + else + CG_SetAttachmentTag( &attachment, gun, gun.hModel, "tag_flash" ); + + CG_AttachToTag( &attachment ); + + if( CG_AttachmentPoint( &attachment, beam_start ) ) + CG_RenderGenericBeam( beam_start, tr.endpos, cgs.media.lightningBeam, 3 ); + } + // make a dlight for the flash if( weapon->wim[ weaponMode ].flashDlightColor[ 0 ] || weapon->wim[ weaponMode ].flashDlightColor[ 1 ] || -- cgit From 0aa94f6b6b7b49972a839aadaee4dbb42a3a53de Mon Sep 17 00:00:00 2001 From: enneract Date: Tue, 25 Nov 2014 01:45:57 +0100 Subject: Lightning Gun assets. --- src/cgame/cg_event.c | 3 +++ src/cgame/cg_local.h | 1 + src/cgame/cg_main.c | 2 ++ src/cgame/cg_weapons.c | 33 ++++++++++++++++++++++++++++++++- 4 files changed, 38 insertions(+), 1 deletion(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index d9e2f77..4c756ad 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -335,6 +335,9 @@ static void CG_Obituary( entityState_t *ent ) message = "^5almost dodged^7"; message2 = "^5's ^5rocket"; break; + case MOD_LIGHTNING: + message = "^5was electrocuted by^7"; + break; case MOD_GRENADE: message = "^5couldn't escape^7"; message2 = "^5's ^5grenade"; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 72b5a96..d979046 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1338,6 +1338,7 @@ typedef struct qhandle_t alienWoundsBleedPS; qhandle_t lightningBeam; + qhandle_t lightningImpactPS; } cgMedia_t; typedef struct diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 9abdc7e..6be1d50 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -867,6 +867,8 @@ static void CG_RegisterGraphics( void ) cgs.media.humanWoundsBleedPS = CG_RegisterParticleSystem( "humanWoundBleedPS" ); cgs.media.headShotPS = CG_RegisterParticleSystem( "headShotPS" ); + cgs.media.lightningImpactPS = CG_RegisterParticleSystem( "models/weapons/lightning/impactPS" ); + CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat ); CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 86306e1..21d0352 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -868,7 +868,7 @@ static float CG_MachinegunSpinAngle( centity_t *cent, qboolean firing ) /* ============= -CG_RenderBeam +CG_RenderGenericBeam ============= */ @@ -1169,6 +1169,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent cent->muzzlePsTrigger = qfalse; } + // Lightning Gun's beam if( weaponNum == WP_LIGHTNING_GUN ) { attachment_t attachment; @@ -1213,6 +1214,19 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent if( CG_AttachmentPoint( &attachment, beam_start ) ) CG_RenderGenericBeam( beam_start, tr.endpos, cgs.media.lightningBeam, 3 ); + + if( tr.entityNum != ENTITYNUM_NONE && + !( tr.surfaceFlags & SURF_NOIMPACT ) ) + { + particleSystem_t *ps = CG_SpawnNewParticleSystem( cgs.media.lightningImpactPS ); + + if( CG_IsParticleSystemValid( &ps ) ) + { + CG_SetAttachmentPoint( &ps->attachment, tr.endpos ); + CG_SetParticleSystemNormal( ps, tr.plane.normal ); + CG_AttachToPoint( &ps->attachment ); + } + } } // make a dlight for the flash @@ -1353,6 +1367,15 @@ void CG_AddViewWeapon( playerState_t *ps ) } + // Lightning Gun vibration effect + if( ( weapon == WP_LIGHTNING_GUN ) && ps->eFlags & EF_FIRING ) + { + VectorMA( hand.origin, random( ) * 0.1, cg.refdef.viewaxis[ 0 ], + hand.origin ); + VectorMA( hand.origin, random( ) * 0.1, cg.refdef.viewaxis[ 1 ], + hand.origin ); + } + AnglesToAxis( angles, hand.axis ); // map torso animations to weapon animations @@ -1753,6 +1776,7 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode ) int c; weaponInfo_t *wi; weapon_t weaponNum; + qboolean skipSound = qfalse; es = ¢->currentState; @@ -1772,6 +1796,10 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode ) wi = &cg_weapons[ weaponNum ]; + if( wi->wim[ weaponMode ].continuousFlash && + cent->muzzleFlashTime >= cg.time - 100 ) + skipSound = qtrue; + // mark the entity as muzzle flashing, so when it is added it will // append the flash to the weapon model cent->muzzleFlashTime = cg.time; @@ -1783,6 +1811,9 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode ) cent->muzzlePsTrigger = qtrue; } + if( skipSound ) + return; + // play a sound for( c = 0; c < 4; c++ ) { -- cgit From d1853e239ae258e394a516f0eeda80f430a1a328 Mon Sep 17 00:00:00 2001 From: enneract Date: Sat, 13 Dec 2014 16:06:15 +0100 Subject: View quake, improved Rocket Launcher assets. (FIXME: Rocket explosion doesn't fade out) --- src/cgame/cg_local.h | 8 ++++++++ src/cgame/cg_main.c | 10 ++++++++-- src/cgame/cg_view.c | 34 ++++++++++++++++++++++++++++++++++ src/cgame/cg_weapons.c | 42 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 91 insertions(+), 3 deletions(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index d979046..97a21d9 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -787,6 +787,7 @@ typedef struct weaponInfoMode_s vec3_t flashDlightColor; sfxHandle_t flashSound[ 4 ]; // fast firing weapons randomly choose qboolean continuousFlash; + float flashQuake; qhandle_t missileModel; sfxHandle_t missileSound; @@ -816,6 +817,7 @@ typedef struct weaponInfoMode_s qhandle_t impactMarkSize; sfxHandle_t impactSound[ 4 ]; //random impact sound sfxHandle_t impactFleshSound[ 4 ]; //random impact sound + float impactQuake; } weaponInfoMode_t; // each WP_* weapon enum has an associated weaponInfo_t @@ -1159,6 +1161,8 @@ typedef struct int nearUsableBuildable; int nextWeaponClickTime; + + float viewQuake; } cg_t; @@ -1586,6 +1590,9 @@ extern vmCvar_t cg_chatTeamPrefix; extern vmCvar_t cg_drawBubble; extern vmCvar_t cg_BubbleZoom; +extern vmCvar_t cg_viewQuake; +extern vmCvar_t cg_viewQuakeLambda; + // // cg_main.c // @@ -1627,6 +1634,7 @@ void CG_TestModelNextSkin_f( void ); void CG_TestModelPrevSkin_f( void ); void CG_AddBufferedSound( sfxHandle_t sfx ); void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback ); +void CG_InduceViewQuake( vec3_t src, float mag ); void CG_OffsetFirstPersonView( void ); void CG_OffsetThirdPersonView( void ); void CG_OffsetShoulderView( void ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 6be1d50..c5ad444 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -226,7 +226,10 @@ vmCvar_t cg_chatTeamPrefix; vmCvar_t cg_drawBubble; vmCvar_t cg_BubbleZoom; -vmCvar_t cg_EDGEFPSFIX; +vmCvar_t cg_EDGEFPSFIX; + +vmCvar_t cg_viewQuake; +vmCvar_t cg_viewQuakeLambda; typedef struct { @@ -371,7 +374,10 @@ static cvarTable_t cvarTable[ ] = // { &cg_chatTeamPrefix, "cg_chatTeamPrefix", "1", CVAR_ARCHIVE} { &cg_chatTeamPrefix, "cg_chatTeamPrefix", "1", CVAR_ARCHIVE}, - { &cg_EDGEFPSFIX, "cg_EDGEFPSFIX", "0", CVAR_ARCHIVE|CVAR_USERINFO } + { &cg_EDGEFPSFIX, "cg_EDGEFPSFIX", "0", CVAR_ARCHIVE|CVAR_USERINFO }, + + { &cg_viewQuake, "cg_viewQuake", "1", CVAR_ARCHIVE }, + { &cg_viewQuakeLambda, "cg_viewQuakeLambda", "-10", CVAR_ARCHIVE } }; static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] ); 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 ); + } } //====================================================================== diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 21d0352..8e3b438 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -416,6 +416,26 @@ static qboolean CG_ParseWeaponModeSection( weaponInfoMode_t *wim, char **text_p continue; } + else if( !Q_stricmp( token, "impactQuake" ) ) + { + token = COM_Parse( text_p ); + if( !token ) + break; + + wim->impactQuake = atof( token ); + + continue; + } + else if( !Q_stricmp( token, "flashQuake" ) ) + { + token = COM_Parse( text_p ); + if( !token ) + break; + + wim->flashQuake = atof( token ); + + continue; + } else if( !Q_stricmp( token, "}" ) ) return qtrue; //reached the end of this weapon section else @@ -1827,6 +1847,14 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode ) if( wi->wim[ weaponMode ].flashSound[ c ] ) trap_S_StartSound( NULL, es->number, CHAN_WEAPON, wi->wim[ weaponMode ].flashSound[ c ] ); } + + if( cent == &cg.predictedPlayerEntity ) + { + float quake; + + quake = wi->wim[ weaponMode ].flashQuake; + CG_InduceViewQuake( NULL, quake ); + } } @@ -1843,7 +1871,7 @@ void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientN qhandle_t mark = 0; qhandle_t ps = 0; int c; - float radius = 1.0f; + float radius = 1.0f, quake; weaponInfo_t *weapon = &cg_weapons[ weaponNum ]; if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES ) @@ -1852,6 +1880,7 @@ void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientN mark = weapon->wim[ weaponMode ].impactMark; radius = weapon->wim[ weaponMode ].impactMarkSize; ps = weapon->wim[ weaponMode ].impactParticleSystem; + quake = weapon->wim[ weaponMode ].impactQuake; if( soundType == IMPACTSOUND_FLESH ) { @@ -1905,6 +1934,11 @@ void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientN // if( radius > 0.0f ) CG_ImpactMark( mark, origin, dir, random( ) * 360, 1, 1, 1, 1, qfalse, radius, qfalse ); + + if( weaponNum == WP_LUCIFER_CANNON ) + quake *= charge; + + CG_InduceViewQuake( origin, quake ); } @@ -1918,6 +1952,7 @@ void CG_MissileHitEntity( weapon_t weaponNum, weaponMode_t weaponMode, { vec3_t normal; weaponInfo_t *weapon = &cg_weapons[ weaponNum ]; + float quake = weapon->wim[ weaponMode ].impactQuake; VectorCopy( dir, normal ); VectorInverse( normal ); @@ -1947,6 +1982,11 @@ void CG_MissileHitEntity( weapon_t weaponNum, weaponMode_t weaponMode, CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, sound, charge ); } + + if( weaponNum == WP_LUCIFER_CANNON ) + quake *= charge; + + CG_InduceViewQuake( origin, quake ); } -- cgit From bb6121f265d70282aeba57a252996f130e5d6df8 Mon Sep 17 00:00:00 2001 From: enneract Date: Sun, 14 Dec 2014 13:17:33 +0100 Subject: Add view quake to more events. --- src/cgame/cg_event.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/cgame') diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 4c756ad..e5002cd 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -1009,9 +1009,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_METAL, es->torsoAnim ); break; +#define BUILDABLE_EXPLOSION_QUAKE 50 + case EV_HUMAN_BUILDABLE_EXPLOSION: ByteToDir( es->eventParm, dir ); CG_HumanBuildableExplosion( position, dir, es->modelindex ); + CG_InduceViewQuake( position, BUILDABLE_EXPLOSION_QUAKE ); break; case EV_ALIEN_BUILDABLE_EXPLOSION: @@ -1020,6 +1023,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) if ( es->modelindex == BA_A_SPITEFUL_ABCESS ) CG_AlienSPITEFUL_ABCESSExplosion( position, dir ); + + CG_InduceViewQuake( position, BUILDABLE_EXPLOSION_QUAKE ); break; //Scleim greifer schwanz f\FCr slime -- cgit From 5130cdd357c5b3b442d39ee05052739419456e77 Mon Sep 17 00:00:00 2001 From: enneract Date: Sun, 14 Dec 2014 14:47:51 +0100 Subject: Limit view quake's mangitude. --- src/cgame/cg_local.h | 1 + src/cgame/cg_main.c | 4 +++- src/cgame/cg_view.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 97a21d9..7d4bd3d 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1592,6 +1592,7 @@ extern vmCvar_t cg_BubbleZoom; extern vmCvar_t cg_viewQuake; extern vmCvar_t cg_viewQuakeLambda; +extern vmCvar_t cg_viewQuakeLimit; // // cg_main.c diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index c5ad444..366a6a3 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -230,6 +230,7 @@ vmCvar_t cg_EDGEFPSFIX; vmCvar_t cg_viewQuake; vmCvar_t cg_viewQuakeLambda; +vmCvar_t cg_viewQuakeLimit; typedef struct { @@ -377,7 +378,8 @@ static cvarTable_t cvarTable[ ] = { &cg_EDGEFPSFIX, "cg_EDGEFPSFIX", "0", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_viewQuake, "cg_viewQuake", "1", CVAR_ARCHIVE }, - { &cg_viewQuakeLambda, "cg_viewQuakeLambda", "-10", CVAR_ARCHIVE } + { &cg_viewQuakeLambda, "cg_viewQuakeLambda", "-10", CVAR_ARCHIVE }, + { &cg_viewQuakeLimit, "cg_viewQuakeLimit", "5", CVAR_ARCHIVE } }; static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] ); diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 68f9287..eb6e88d 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -556,6 +556,9 @@ void CG_InduceViewQuake( vec3_t src, float mag ) dist = Distance( src, cg.refdef.vieworg ); cg.viewQuake += mag / dist / dist * 1000.0f; } + + if( cg.viewQuake > cg_viewQuakeLimit.value ) + cg.viewQuake = cg_viewQuakeLimit.value; } /* -- cgit