Browse Source

Replace magic numbers, Put changes under cvar

hltopdown
tyabus 6 years ago committed by Alibek Omarov
parent
commit
873baccceb
  1. 2
      dlls/game.cpp
  2. 1
      dlls/game.h
  3. 4
      dlls/h_battery.cpp
  4. 3
      dlls/healthkit.cpp

2
dlls/game.cpp

@ -31,6 +31,7 @@ cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER };
cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER }; cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER }; cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
cvar_t selfgauss = { "mp_selfgauss", "1", FCVAR_SERVER }; cvar_t selfgauss = { "mp_selfgauss", "1", FCVAR_SERVER };
cvar_t chargerfix = { "mp_chargerfix", "0", FCVAR_SERVER };
cvar_t satchelfix = { "mp_satchelfix", "0", FCVAR_SERVER }; cvar_t satchelfix = { "mp_satchelfix", "0", FCVAR_SERVER };
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER }; cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER }; cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
@ -471,6 +472,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &falldamage ); CVAR_REGISTER( &falldamage );
CVAR_REGISTER( &weaponstay ); CVAR_REGISTER( &weaponstay );
CVAR_REGISTER( &selfgauss ); CVAR_REGISTER( &selfgauss );
CVAR_REGISTER( &chargerfix );
CVAR_REGISTER( &satchelfix ); CVAR_REGISTER( &satchelfix );
CVAR_REGISTER( &forcerespawn ); CVAR_REGISTER( &forcerespawn );
CVAR_REGISTER( &flashlight ); CVAR_REGISTER( &flashlight );

1
dlls/game.h

@ -28,6 +28,7 @@ extern cvar_t friendlyfire;
extern cvar_t falldamage; extern cvar_t falldamage;
extern cvar_t weaponstay; extern cvar_t weaponstay;
extern cvar_t selfgauss; extern cvar_t selfgauss;
extern cvar_t chargerfix;
extern cvar_t satchelfix; extern cvar_t satchelfix;
extern cvar_t forcerespawn; extern cvar_t forcerespawn;
extern cvar_t flashlight; extern cvar_t flashlight;

4
dlls/h_battery.cpp

@ -26,6 +26,8 @@
#include "saverestore.h" #include "saverestore.h"
#include "skill.h" #include "skill.h"
#include "gamerules.h" #include "gamerules.h"
#include "weapons.h"
#include "game.h"
class CRecharge : public CBaseToggle class CRecharge : public CBaseToggle
{ {
@ -116,7 +118,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
} }
// if the player doesn't have the suit, or there is no juice left, make the deny noise // if the player doesn't have the suit, or there is no juice left, make the deny noise
if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( pActivator->pev->armorvalue == 100 ) ) if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( chargerfix.value ) && ( pActivator->pev->armorvalue == MAX_NORMAL_BATTERY ) )
{ {
if( m_flSoundTime <= gpGlobals->time ) if( m_flSoundTime <= gpGlobals->time )
{ {

3
dlls/healthkit.cpp

@ -22,6 +22,7 @@
#include "player.h" #include "player.h"
#include "items.h" #include "items.h"
#include "gamerules.h" #include "gamerules.h"
#include "game.h"
extern int gmsgItemPickup; extern int gmsgItemPickup;
@ -187,7 +188,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
} }
// if the player doesn't have the suit, or there is no juice left, make the deny noise // if the player doesn't have the suit, or there is no juice left, make the deny noise
if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( pActivator->pev->health == 100 ) ) if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( chargerfix.value ) && ( pActivator->pev->health >= pActivator->pev->max_health ) )
{ {
if( m_flSoundTime <= gpGlobals->time ) if( m_flSoundTime <= gpGlobals->time )
{ {

Loading…
Cancel
Save