Browse Source

Add mp_instagib cvar for instagib gamemode.

dmc
Night Owl 7 years ago
parent
commit
dcb4b90785
  1. 61
      dlls/dmc/quake_player.cpp
  2. 2
      dlls/game.cpp

61
dlls/dmc/quake_player.cpp

@ -24,6 +24,7 @@
#include "util.h" #include "util.h"
#include "cbase.h" #include "cbase.h"
#include "player.h" #include "player.h"
#include "game.h"
#include "gamerules.h" #include "gamerules.h"
#include "hltv.h" #include "hltv.h"
@ -101,6 +102,8 @@ void CBasePlayer::UpdateStatusBar()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{ {
float flTake;
if ( (pev->takedamage == DAMAGE_NO) || (IsAlive() == FALSE) ) if ( (pev->takedamage == DAMAGE_NO) || (IsAlive() == FALSE) )
return 0; return 0;
@ -150,39 +153,46 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
// Teamplay 2 you can still hurt teammates // Teamplay 2 you can still hurt teammates
} }
// check for quad damage powerup on the attacker if( instagib.value )
if (pAttacker->IsPlayer())
{ {
if ( ((CBasePlayer*)pAttacker)->m_flSuperDamageFinished > gpGlobals->time ) flTake = 900.0;
}
else
{
// check for quad damage powerup on the attacker
if (pAttacker->IsPlayer())
{ {
if (gpGlobals->deathmatch == 4) if ( ((CBasePlayer*)pAttacker)->m_flSuperDamageFinished > gpGlobals->time )
flDamage *= 8; {
else if (gpGlobals->deathmatch == 4)
flDamage *= 4; flDamage *= 8;
else
flDamage *= 4;
}
if( ( (CBasePlayer*)pAttacker )->m_iRuneStatus == ITEM_RUNE2_FLAG )
{
flDamage *= 2;
}
} }
if( ( (CBasePlayer*)pAttacker )->m_iRuneStatus == ITEM_RUNE2_FLAG ) if( m_iRuneStatus == ITEM_RUNE1_FLAG )
{ {
flDamage *= 2; flDamage /= 2;
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "rune/rune1.wav", 1, ATTN_NORM );
} }
}
if( m_iRuneStatus == ITEM_RUNE1_FLAG )
{
flDamage /= 2;
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "rune/rune1.wav", 1, ATTN_NORM );
}
// save damage based on the target's armor level // save damage based on the target's armor level
float flSave = ceil(pev->armortype * flDamage); float flSave = ceil(pev->armortype * flDamage);
if (flSave >= pev->armorvalue) if (flSave >= pev->armorvalue)
{ {
flSave = pev->armorvalue; flSave = pev->armorvalue;
pev->armortype = 0; // lost all armor pev->armortype = 0; // lost all armor
m_iQuakeItems &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3); m_iQuakeItems &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
}
pev->armorvalue -= flSave;
flTake = ceil(flDamage - flSave);
} }
pev->armorvalue -= flSave;
float flTake = ceil(flDamage - flSave);
// add to the damage total for clients, which will be sent as a single message at the end of the frame // add to the damage total for clients, which will be sent as a single message at the end of the frame
pev->dmg_take = pev->dmg_take + flTake; pev->dmg_take = pev->dmg_take + flTake;
@ -203,7 +213,6 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
// this global is still used for glass and other non-monster killables, along with decals. // this global is still used for glass and other non-monster killables, along with decals.
g_vecAttackDir = vecTemp.Normalize(); g_vecAttackDir = vecTemp.Normalize();
// figure momentum add // figure momentum add
if ( (pevInflictor) && (pev->movetype == MOVETYPE_WALK) && !( FBitSet (bitsDamageType, DMG_BURN) ) && !( FBitSet (bitsDamageType, DMG_ACID) ) ) if ( (pevInflictor) && (pev->movetype == MOVETYPE_WALK) && !( FBitSet (bitsDamageType, DMG_BURN) ) && !( FBitSet (bitsDamageType, DMG_ACID) ) )
{ {

2
dlls/game.cpp

@ -46,6 +46,7 @@ cvar_t defaultteam = { "mp_defaultteam","0" };
cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER }; cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER };
cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER }; cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER };
cvar_t allowhook = { "mp_allow_hook", "1", FCVAR_SERVER }; cvar_t allowhook = { "mp_allow_hook", "1", FCVAR_SERVER };
cvar_t instagib = { "mp_instagib", "0", FCVAR_SERVER };
cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators
@ -487,6 +488,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &allowmonsters ); CVAR_REGISTER( &allowmonsters );
CVAR_REGISTER( &bhopcap ); CVAR_REGISTER( &bhopcap );
CVAR_REGISTER( &allowhook ); CVAR_REGISTER( &allowhook );
CVAR_REGISTER( &instagib );
CVAR_REGISTER( &mp_chattime ); CVAR_REGISTER( &mp_chattime );

Loading…
Cancel
Save