Browse Source

mp_coop cvar with some coop features

hlzbot-dirty
mittorn 8 years ago
parent
commit
1443818300
  1. 4
      dlls/combat.cpp
  2. 9
      dlls/effects.cpp
  3. 5
      dlls/game.cpp
  4. 2
      dlls/game.h
  5. 7
      dlls/multiplay_gamerules.cpp
  6. 11
      dlls/player.cpp
  7. 7
      dlls/player.h

4
dlls/combat.cpp

@ -602,6 +602,10 @@ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib ) @@ -602,6 +602,10 @@ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
Remember( bits_MEMORY_KILLED );
CBaseEntity *activator = CBaseEntity::Instance( pevAttacker );
if( activator && activator->IsPlayer() )
activator->AddPoints( 1, true );
// clear the deceased's sound channels.(may have been firing or reloading when killed)
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "common/null.wav", 1, ATTN_NORM );
m_IdealMonsterState = MONSTERSTATE_DEAD;

9
dlls/effects.cpp

@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
#include "decals.h"
#include "func_break.h"
#include "shake.h"
#include "game.h"
#define SF_GIBSHOOTER_REPEATABLE 1 // allows a gibshooter to be refired
@ -1943,8 +1944,14 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType @@ -1943,8 +1944,14 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
if( pev->spawnflags & SF_FADE_MODULATE )
fadeFlags |= FFADE_MODULATE;
if( pev->spawnflags & SF_FADE_ONLYONE )
if( mp_coop.value || pev->spawnflags & SF_FADE_ONLYONE )
{
if( !pActivator || pActivator->IsNetClient() )
{
if( !pCaller )
return;
pActivator = pCaller;
}
if( pActivator->IsNetClient() )
{
UTIL_ScreenFade( pActivator, pev->rendercolor, Duration(), HoldTime(), pev->renderamt, fadeFlags );

5
dlls/game.cpp

@ -49,6 +49,8 @@ cvar_t cvar_gibtime = { "mp_gibtime","250", FCVAR_SERVER }; @@ -49,6 +49,8 @@ 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 };
cvar_t mp_gravgun_players = { "mp_gravgun_players", "0", FCVAR_SERVER };
cvar_t mp_coop = { "mp_coop", "0", FCVAR_SERVER };
// Engine Cvars
cvar_t *g_psv_gravity = NULL;
@ -490,6 +492,9 @@ void GameDLLInit( void ) @@ -490,6 +492,9 @@ void GameDLLInit( void )
CVAR_REGISTER( &cvar_gibtime );
CVAR_REGISTER( &cvar_hgibcount );
CVAR_REGISTER( &cvar_agibcount );
CVAR_REGISTER( &mp_gravgun_players );
CVAR_REGISTER( &mp_coop );
CVAR_REGISTER( &mp_chattime );

2
dlls/game.h

@ -47,6 +47,8 @@ extern cvar_t cvar_gibtime; @@ -47,6 +47,8 @@ extern cvar_t cvar_gibtime;
extern cvar_t cvar_hgibcount;
extern cvar_t cvar_agibcount;
extern cvar_t mp_gravgun_players;
extern cvar_t mp_coop;
// Engine Cvars
extern cvar_t *g_psv_gravity;
extern cvar_t *g_psv_aim;

7
dlls/multiplay_gamerules.cpp

@ -640,8 +640,11 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, @@ -640,8 +640,11 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
}
else if( ktmp && ktmp->IsPlayer() )
{
// if a player dies in a deathmatch game and the killer is a client, award the killer some points
pKiller->frags += IPointsForKill( peKiller, pVictim );
if( mp_coop.value )
pKiller->frags -= 10;
else
// if a player dies in a deathmatch game and the killer is a client, award the killer some points
pKiller->frags += IPointsForKill( peKiller, pVictim );
FireTargets( "game_playerkill", ktmp, ktmp, USE_TOGGLE, 0 );
}

11
dlls/player.cpp

@ -3738,6 +3738,17 @@ void CBasePlayer::SendAmmoUpdate( void ) @@ -3738,6 +3738,17 @@ void CBasePlayer::SendAmmoUpdate( void )
}
}
float CBasePlayer::TouchGravGun( CBaseEntity *attacker, int stage )
{
if( stage == 3 )
return 200;
if( mp_gravgun_players.value )
{
return 200;
}
return 0;
}
/*
=========================================================
UpdateClientData

7
dlls/player.h

@ -309,12 +309,7 @@ public: @@ -309,12 +309,7 @@ public:
float m_flNextChatTime;
virtual float TouchGravGun( CBaseEntity *attacker, int stage )
{
if( stage == 3 )
return 200;
return 0;
}
virtual float TouchGravGun( CBaseEntity *attacker, int stage );
};
#define AUTOAIM_2DEGREES 0.0348994967025

Loading…
Cancel
Save