diff --git a/dlls/ar2.cpp b/dlls/ar2.cpp index e8c8cbf1..d9c21a7d 100644 --- a/dlls/ar2.cpp +++ b/dlls/ar2.cpp @@ -14,6 +14,7 @@ #include "player.h" #include "soundent.h" #include "gamerules.h" +#include "game.h" #define AR2_BEAM_SPRITE "sprites/xbeam1.spr" #define WEAPON_AR2 19 @@ -409,10 +410,20 @@ void CAR2::Precache(void) int CAR2::GetItemInfo(ItemInfo *p) { p->pszName = STRING(pev->classname); - p->pszAmmo1 = "AR2"; - p->iMaxAmmo1 = 120; - p->pszAmmo2 = "AR2grenades"; - p->iMaxAmmo2 = 3; + if( !cvar_ar2_mp5.value ) + { + p->pszAmmo1 = "AR2"; + p->iMaxAmmo1 = 120; + p->pszAmmo2 = "AR2grenades"; + p->iMaxAmmo2 = 3; + } + else + { + p->pszAmmo1 = "9mm"; + p->iMaxAmmo1 = _9MM_MAX_CARRY; + p->pszAmmo2 = "ARgrenades"; + p->iMaxAmmo2 = M203_GRENADE_MAX_CARRY; + } p->iMaxClip = 30; p->iSlot = 2; p->iPosition = 3; diff --git a/dlls/combat.cpp b/dlls/combat.cpp index 334e721b..ec4663cf 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -29,7 +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; @@ -37,9 +37,9 @@ extern Vector VecBModelOrigin( entvars_t *pevBModel ); extern entvars_t *g_pevLastInflictor; #define GERMAN_GIB_COUNT 4 -#define HUMAN_GIB_COUNT 12 -#define ALIEN_GIB_COUNT 8 - +// replaced by cvars +//#define HUMAN_GIB_COUNT 12 +//#define ALIEN_GIB_COUNT 8 // HACKHACK -- The gib velocity equations don't work void CGib::LimitVelocity( void ) @@ -197,13 +197,13 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human ) { // human pieces pGib->Spawn( "models/hgibs.mdl" ); - pGib->pev->body = RANDOM_LONG( 1, HUMAN_GIB_COUNT - 1 );// start at one to avoid throwing random amounts of skulls (0th gib) + pGib->pev->body = RANDOM_LONG( 1, cvar_hgibcount.value - 1 );// start at one to avoid throwing random amounts of skulls (0th gib) } else { // aliens pGib->Spawn( "models/agibs.mdl" ); - pGib->pev->body = RANDOM_LONG( 0, ALIEN_GIB_COUNT - 1 ); + pGib->pev->body = RANDOM_LONG( 0, cvar_agibcount.value - 1 ); } } @@ -799,7 +799,7 @@ void CGib::Spawn( const char *szGibModel ) pev->nextthink = gpGlobals->time + 4; - m_lifeTime = 250; + m_lifeTime = cvar_gibtime.value; SetThink( &CGib::WaitTillLand ); SetTouch( &CGib::BounceGibTouch ); @@ -808,6 +808,8 @@ void CGib::Spawn( const char *szGibModel ) m_cBloodDecals = 5;// how many blood decals this gib can place (1 per bounce until none remain). } +LINK_ENTITY_TO_CLASS( gib, CGib ) + // take health int CBaseMonster::TakeHealth( float flHealth, int bitsDamageType ) { diff --git a/dlls/game.cpp b/dlls/game.cpp index 3aec1810..3af725e4 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -38,7 +38,16 @@ cvar_t teamlist = { "mp_teamlist","hgrunt;scientist", FCVAR_SERVER }; cvar_t teamoverride = { "mp_teamoverride","1" }; cvar_t defaultteam = { "mp_defaultteam","0" }; cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER }; - +cvar_t cvar_allow_gravgun = { "mp_allow_gravgun","1", FCVAR_SERVER }; +cvar_t cvar_allow_ar2 = { "mp_allow_ar2","0", FCVAR_SERVER }; +cvar_t cvar_ar2_mp5 = { "mp_ar2_mp5","0", FCVAR_SERVER }; +cvar_t cvar_ar2_balls = { "mp_ar2_balls","0", FCVAR_SERVER }; +cvar_t cvar_ar2_bullets = { "mp_ar2_bullets","0", FCVAR_SERVER }; +cvar_t cvar_wresptime = { "mp_wresptime","20", FCVAR_SERVER }; +cvar_t cvar_iresptime = { "mp_iresptime","30", FCVAR_SERVER }; +cvar_t cvar_gibtime{ "mp_gibtime","250", FCVAR_SERVER }; +cvar_t cvar_hgibcount{ "mp_hgibcount","12", FCVAR_SERVER }; +cvar_t cvar_agibcount{ "mp_agibcount","8", FCVAR_SERVER }; cvar_t mp_chattime = { "mp_chattime","10", FCVAR_SERVER }; // Engine Cvars @@ -471,6 +480,16 @@ void GameDLLInit( void ) CVAR_REGISTER( &teamoverride ); CVAR_REGISTER( &defaultteam ); CVAR_REGISTER( &allowmonsters ); + CVAR_REGISTER( &cvar_allow_ar2 ); + CVAR_REGISTER( &cvar_allow_gravgun ); + CVAR_REGISTER( &cvar_ar2_mp5 ); + CVAR_REGISTER( &cvar_ar2_bullets ); + CVAR_REGISTER( &cvar_ar2_balls ); + CVAR_REGISTER( &cvar_wresptime ); + CVAR_REGISTER( &cvar_iresptime ); + CVAR_REGISTER( &cvar_gibtime ); + CVAR_REGISTER( &cvar_hgibcount ); + CVAR_REGISTER( &cvar_agibcount ); CVAR_REGISTER( &mp_chattime ); diff --git a/dlls/game.h b/dlls/game.h index 925010f3..4c6b82dd 100644 --- a/dlls/game.h +++ b/dlls/game.h @@ -35,6 +35,17 @@ extern cvar_t teamlist; extern cvar_t teamoverride; extern cvar_t defaultteam; extern cvar_t allowmonsters; +extern cvar_t cvar_allow_gravgun; +extern cvar_t cvar_allow_ar2; +extern cvar_t cvar_ar2_mp5; +extern cvar_t cvar_ar2_bullets; +extern cvar_t cvar_ar2_balls; +extern cvar_t cvar_wresptime; +extern cvar_t cvar_iresptime; + +extern cvar_t cvar_gibtime; +extern cvar_t cvar_hgibcount; +extern cvar_t cvar_agibcount; // Engine Cvars extern cvar_t *g_psv_gravity; diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 1835d4ab..ace1c84f 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -40,10 +40,6 @@ extern int gmsgServerName; extern int g_teamplay; -#define ITEM_RESPAWN_TIME 30 -#define WEAPON_RESPAWN_TIME 20 -#define AMMO_RESPAWN_TIME 20 - float g_flIntermissionStartTime = 0; #ifndef NO_VOICEGAMEMGR @@ -581,7 +577,15 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) { pPlayer->GiveNamedItem( "weapon_crowbar" ); pPlayer->GiveNamedItem( "weapon_9mmhandgun" ); - pPlayer->GiveNamedItem( "weapon_gravgun" ); + if( cvar_allow_gravgun.value) + pPlayer->GiveNamedItem( "weapon_gravgun" ); + if( cvar_allow_ar2.value ) + pPlayer->GiveNamedItem( "weapon_ar2" ); + if( !cvar_ar2_mp5.value ) + { + pPlayer->GiveAmmo( cvar_ar2_bullets.value, "AR2", 120 ); + pPlayer->GiveAmmo( cvar_ar2_balls.value, "AR2grenades", 3 ); + } pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads } } @@ -907,7 +911,7 @@ float CHalfLifeMultiplay::FlWeaponRespawnTime( CBasePlayerItem *pWeapon ) } } - return gpGlobals->time + WEAPON_RESPAWN_TIME; + return gpGlobals->time + cvar_wresptime.value; } // when we are within this close to running out of entities, items @@ -1017,7 +1021,7 @@ int CHalfLifeMultiplay::ItemShouldRespawn( CItem *pItem ) //========================================================= float CHalfLifeMultiplay::FlItemRespawnTime( CItem *pItem ) { - return gpGlobals->time + ITEM_RESPAWN_TIME; + return gpGlobals->time + cvar_iresptime.value; } //========================================================= @@ -1061,7 +1065,7 @@ int CHalfLifeMultiplay::AmmoShouldRespawn( CBasePlayerAmmo *pAmmo ) //========================================================= float CHalfLifeMultiplay::FlAmmoRespawnTime( CBasePlayerAmmo *pAmmo ) { - return gpGlobals->time + AMMO_RESPAWN_TIME; + return gpGlobals->time + cvar_wresptime.value; } //=========================================================