Skip to content

Commit

Permalink
Add 'explosionfix' cvar to control explosions going through walls som…
Browse files Browse the repository at this point in the history
…etimes. Related issue: ValveSoftware/halflife#3244 (FWGS#252)
  • Loading branch information
FreeSlave authored Jun 5, 2022
1 parent 3db3772 commit 4e13400
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
cvar_t selfgauss = { "selfgauss", "1", FCVAR_SERVER };
cvar_t chargerfix = { "chargerfix", "0", FCVAR_SERVER };
cvar_t satchelfix = { "satchelfix", "0", FCVAR_SERVER };
cvar_t explosionfix = { "explosionfix", "0", FCVAR_SERVER };
cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "1", FCVAR_SERVER };
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
Expand Down Expand Up @@ -486,6 +487,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &selfgauss );
CVAR_REGISTER( &chargerfix );
CVAR_REGISTER( &satchelfix );
CVAR_REGISTER( &explosionfix );
CVAR_REGISTER( &monsteryawspeedfix );
CVAR_REGISTER( &forcerespawn );
CVAR_REGISTER( &flashlight );
Expand Down
1 change: 1 addition & 0 deletions dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern cvar_t weaponstay;
extern cvar_t selfgauss;
extern cvar_t chargerfix;
extern cvar_t satchelfix;
extern cvar_t explosionfix;
extern cvar_t monsteryawspeedfix;
extern cvar_t forcerespawn;
extern cvar_t flashlight;
Expand Down
6 changes: 5 additions & 1 deletion dlls/ggrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "nodes.h"
#include "soundent.h"
#include "decals.h"
#include "game.h"

//===================grenade

Expand Down Expand Up @@ -59,7 +60,10 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
// Pull out of the wall a bit
if( pTrace->flFraction != 1.0f )
{
pev->origin = pTrace->vecEndPos + ( pTrace->vecPlaneNormal * ( pev->dmg - 24 ) * 0.6f );
if (explosionfix.value)
pev->origin = pTrace->vecEndPos + ( pTrace->vecPlaneNormal * 0.6f );
else
pev->origin = pTrace->vecEndPos + ( pTrace->vecPlaneNormal * ( pev->dmg - 24 ) * 0.6f );
}

int iContents = UTIL_PointContents( pev->origin );
Expand Down

0 comments on commit 4e13400

Please sign in to comment.