Implement 'corpsephysics' cvar. Issue #190 (#255)

This commit is contained in:
Roman Chistokhodov 2022-06-06 18:51:03 +03:00 committed by GitHub
parent 8d844a1764
commit ab38461c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -29,6 +29,7 @@
#include "animation.h"
#include "weapons.h"
#include "func_break.h"
#include "game.h"
extern DLL_GLOBAL Vector g_vecAttackDir;
extern DLL_GLOBAL int g_iSkillLevel;
@ -514,10 +515,16 @@ void CBaseMonster::BecomeDead( void )
// make the corpse fly away from the attack vector
pev->movetype = MOVETYPE_TOSS;
//pev->flags &= ~FL_ONGROUND;
//pev->origin.z += 2.0f;
//pev->velocity = g_vecAttackDir * -1.0f;
//pev->velocity = pev->velocity * RANDOM_FLOAT( 300.0f, 400.0f );
if (corpsephysics.value &&
// affect only dying monsters, not initially dead ones
m_IdealMonsterState == MONSTERSTATE_DEAD)
{
pev->flags &= ~FL_ONGROUND;
pev->origin.z += 2.0f;
pev->velocity = g_vecAttackDir * -1.0f;
pev->velocity = pev->velocity * RANDOM_FLOAT( 300.0f, 400.0f );
}
}
BOOL CBaseMonster::ShouldGibMonster( int iGib )

View File

@ -37,6 +37,7 @@ 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 corpsephysics = { "corpsephysics", "0", FCVAR_SERVER };
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER };
@ -489,6 +490,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &satchelfix );
CVAR_REGISTER( &explosionfix );
CVAR_REGISTER( &monsteryawspeedfix );
CVAR_REGISTER( &corpsephysics );
CVAR_REGISTER( &forcerespawn );
CVAR_REGISTER( &flashlight );
CVAR_REGISTER( &aimcrosshair );

View File

@ -32,6 +32,7 @@ extern cvar_t chargerfix;
extern cvar_t satchelfix;
extern cvar_t explosionfix;
extern cvar_t monsteryawspeedfix;
extern cvar_t corpsephysics;
extern cvar_t forcerespawn;
extern cvar_t flashlight;
extern cvar_t aimcrosshair;