|
|
|
/***
|
|
|
|
*
|
|
|
|
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
|
|
|
*
|
|
|
|
* This product contains software technology licensed from Id
|
|
|
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use, distribution, and modification of this source code and/or resulting
|
|
|
|
* object code is restricted to non-commercial enhancements to products from
|
|
|
|
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
|
|
* without written permission from Valve LLC.
|
|
|
|
*
|
|
|
|
****/
|
|
|
|
//
|
|
|
|
// heavyrain_gamerules.cpp
|
|
|
|
//
|
|
|
|
#include "extdll.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "cbase.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "weapons.h"
|
|
|
|
#include "gamerules.h"
|
|
|
|
#include "cod_gamerules.h"
|
|
|
|
#include "game.h"
|
|
|
|
|
|
|
|
extern DLL_GLOBAL BOOL g_fGameOver;
|
|
|
|
extern int gmsgScoreInfo;
|
|
|
|
extern int gmsgCOD;
|
|
|
|
extern int gmsgPlayMP3; //AJH - Killars MP3player
|
|
|
|
|
|
|
|
CCodplay :: CCodplay()
|
|
|
|
{
|
|
|
|
//Genfulect
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CCodplay::IsCOD()
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodplay::PlayerSpawn( CBasePlayer *pPlayer )
|
|
|
|
{
|
|
|
|
BOOL addDefault;
|
|
|
|
CBaseEntity *pWeaponEntity = NULL;
|
|
|
|
|
|
|
|
pPlayer->pev->weapons |= (1<<WEAPON_SUIT);
|
|
|
|
|
|
|
|
addDefault = TRUE;
|
|
|
|
|
|
|
|
edict_t *pClient = g_engfuncs.pfnPEntityOfEntIndex( 1 );
|
|
|
|
|
|
|
|
while( ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ) ) )
|
|
|
|
{
|
|
|
|
pWeaponEntity->Touch( pPlayer );
|
|
|
|
addDefault = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( addDefault )
|
|
|
|
{
|
|
|
|
pPlayer->GiveNamedItem( "weapon_mw2" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
|
|
|
{
|
|
|
|
DeathNotice( pVictim, pKiller, pInflictor );
|
|
|
|
|
|
|
|
pVictim->m_iDeaths += 1;
|
|
|
|
|
|
|
|
FireTargets( "game_playerdie", pVictim, pVictim, USE_TOGGLE, 0 );
|
|
|
|
CBasePlayer *peKiller = NULL;
|
|
|
|
CBaseEntity *ktmp = CBaseEntity::Instance( pKiller );
|
|
|
|
if ( ktmp && (ktmp->Classify() == CLASS_PLAYER) )
|
|
|
|
peKiller = (CBasePlayer*)ktmp;
|
|
|
|
|
|
|
|
if ( pVictim->pev == pKiller )
|
|
|
|
{ // killed self
|
|
|
|
pKiller->frags -= 1;
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
FireTargets( "game_playerkill", ktmp, ktmp, USE_TOGGLE, 0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // killed by the world
|
|
|
|
pKiller->frags -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// update the scores
|
|
|
|
// killed scores
|
|
|
|
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
|
|
|
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
|
|
|
WRITE_SHORT( pVictim->pev->frags );
|
|
|
|
WRITE_SHORT( pVictim->m_iDeaths );
|
|
|
|
WRITE_SHORT( 0 );
|
|
|
|
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
|
|
|
WRITE_SHORT( pVictim->m_fHSDev );
|
|
|
|
MESSAGE_END();
|
|
|
|
|
|
|
|
// killers score, if it's a player
|
|
|
|
CBaseEntity *ep = CBaseEntity::Instance( pKiller );
|
|
|
|
if ( ep && ep->Classify() == CLASS_PLAYER )
|
|
|
|
{
|
|
|
|
CBasePlayer *PK = (CBasePlayer*)ep;
|
|
|
|
|
|
|
|
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
|
|
|
WRITE_BYTE( ENTINDEX(PK->edict()) );
|
|
|
|
WRITE_SHORT( PK->pev->frags );
|
|
|
|
WRITE_SHORT( PK->m_iDeaths );
|
|
|
|
WRITE_SHORT( 0 );
|
|
|
|
WRITE_SHORT( GetTeamIndex( PK->m_szTeamName) + 1 );
|
|
|
|
WRITE_SHORT( PK->m_fHSDev );
|
|
|
|
MESSAGE_END();
|
|
|
|
|
|
|
|
MESSAGE_BEGIN( MSG_ONE, gmsgCOD, NULL, PK->pev );
|
|
|
|
WRITE_BYTE( PK->pev->frags );
|
|
|
|
MESSAGE_END();
|
|
|
|
|
|
|
|
// let the killer paint another decal as soon as he'd like.
|
|
|
|
PK->m_flNextDecalTime = gpGlobals->time;
|
|
|
|
}
|
|
|
|
#if !HLDEMO_BUILD
|
|
|
|
if ( pVictim->HasNamedPlayerItem("weapon_satchel") )
|
|
|
|
{
|
|
|
|
DeactivateSatchels( pVictim );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|