2015-06-30 12:46:07 +03:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
CHalfLifeRules::CHalfLifeRules()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
m_bFreezePeriod = FALSE;
|
2015-06-30 12:46:07 +03:00
|
|
|
RefreshSkillData();
|
|
|
|
}
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(Think)()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(IsMultiplayer)()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(IsDeathmatch)()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(IsCoOp)()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-12-09 01:39:54 +03:00
|
|
|
if (!pPlayer->m_pActiveItem)
|
|
|
|
{
|
|
|
|
// player doesn't have an active item!
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pPlayer->m_pActiveItem->CanHolster())
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-06-30 12:46:07 +03:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(GetNextBestWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(ClientConnected)(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(ClientDisconnected)(edict_t *pClient)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
float CHalfLifeRules::__MAKE_VHOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-12-09 01:39:54 +03:00
|
|
|
// subtract off the speed at which a player is allowed to fall without being hurt,
|
2015-08-20 13:35:01 +03:00
|
|
|
// so damage will be based on speed beyond that, not the entire fall
|
2015-06-30 12:46:07 +03:00
|
|
|
pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED;
|
|
|
|
return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
pPlayer->pev->weapons |= (1 << WEAPON_SUIT);
|
|
|
|
|
|
|
|
pPlayer->GiveNamedItem("weapon_knife");
|
|
|
|
pPlayer->GiveNamedItem("weapon_usp");
|
|
|
|
pPlayer->GiveNamedItem("weapon_mp5navy");
|
|
|
|
pPlayer->GiveNamedItem("weapon_hegrenade");
|
|
|
|
|
2016-12-06 22:21:52 +03:00
|
|
|
pPlayer->GiveAmmo(60, "9mm");
|
|
|
|
pPlayer->GiveAmmo(24, "45acp");
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(AllowAutoTargetCrosshair)()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return (g_iSkillLevel == SKILL_EASY);
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
float CHalfLifeRules::__MAKE_VHOOK(FlPlayerSpawnTime)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return gpGlobals->time;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
int CHalfLifeRules::__MAKE_VHOOK(IPointsForKill)(CBasePlayer *pAttacker, CBasePlayer *pKilled)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(DeathNotice)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(PlayerGotWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
float CHalfLifeRules::__MAKE_VHOOK(FlWeaponRespawnTime)(CBasePlayerItem *pWeapon)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
float CHalfLifeRules::__MAKE_VHOOK(FlWeaponTryRespawn)(CBasePlayerItem *pWeapon)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
Vector CHalfLifeRules::__MAKE_VHOOK(VecWeaponRespawnSpot)(CBasePlayerItem *pWeapon)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return pWeapon->pev->origin;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
edict_t *CHalfLifeRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
CBaseEntity *pSpot = UTIL_FindEntityByClassname(NULL, "info_player_start");
|
|
|
|
|
|
|
|
if (!pSpot)
|
|
|
|
{
|
|
|
|
ALERT(at_error, "PutClientInServer: no info_player_start on level");
|
|
|
|
return INDEXENT(0);
|
|
|
|
}
|
2015-12-09 01:39:54 +03:00
|
|
|
|
|
|
|
pPlayer->pev->origin = pSpot->pev->origin + Vector(0, 0, 1);
|
|
|
|
pPlayer->pev->v_angle = g_vecZero;
|
|
|
|
pPlayer->pev->velocity = g_vecZero;
|
|
|
|
pPlayer->pev->angles = pSpot->pev->angles;
|
|
|
|
pPlayer->pev->punchangle = g_vecZero;
|
|
|
|
pPlayer->pev->fixangle = 1;
|
2016-02-04 03:18:26 +03:00
|
|
|
|
2015-06-30 12:46:07 +03:00
|
|
|
return pSpot->edict();
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
int CHalfLifeRules::__MAKE_VHOOK(WeaponShouldRespawn)(CBasePlayerItem *pWeapon)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return GR_WEAPON_RESPAWN_NO;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(CanHaveItem)(CBasePlayer *pPlayer, CItem *pItem)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(PlayerGotItem)(CBasePlayer *pPlayer, CItem *pItem)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
int CHalfLifeRules::__MAKE_VHOOK(ItemShouldRespawn)(CItem *pItem)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return GR_ITEM_RESPAWN_NO;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
float CHalfLifeRules::__MAKE_VHOOK(FlItemRespawnTime)(CItem *pItem)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
Vector CHalfLifeRules::__MAKE_VHOOK(VecItemRespawnSpot)(CItem *pItem)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return pItem->pev->origin;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(IsAllowedToSpawn)(CBaseEntity *pEntity)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
void CHalfLifeRules::__MAKE_VHOOK(PlayerGotAmmo)(CBasePlayer *pPlayer, char *szName, int iCount)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
int CHalfLifeRules::__MAKE_VHOOK(AmmoShouldRespawn)(CBasePlayerAmmo *pAmmo)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return GR_AMMO_RESPAWN_NO;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
float CHalfLifeRules::__MAKE_VHOOK(FlAmmoRespawnTime)(CBasePlayerAmmo *pAmmo)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
Vector CHalfLifeRules::__MAKE_VHOOK(VecAmmoRespawnSpot)(CBasePlayerAmmo *pAmmo)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return pAmmo->pev->origin;
|
|
|
|
}
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
float CHalfLifeRules::__MAKE_VHOOK(FlHealthChargerRechargeTime)()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
int CHalfLifeRules::__MAKE_VHOOK(DeadPlayerWeapons)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return GR_PLR_DROP_GUN_NO;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
int CHalfLifeRules::__MAKE_VHOOK(DeadPlayerAmmo)(CBasePlayer *pPlayer)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return GR_PLR_DROP_AMMO_NO;
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
int CHalfLifeRules::__MAKE_VHOOK(PlayerRelationship)(CBasePlayer *pPlayer, CBaseEntity *pTarget)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2016-02-04 03:18:26 +03:00
|
|
|
// why would a single player in half life need this?
|
2015-06-30 12:46:07 +03:00
|
|
|
return GR_NOTTEAMMATE;
|
|
|
|
}
|
|
|
|
|
2016-02-04 03:18:26 +03:00
|
|
|
BOOL CHalfLifeRules::__MAKE_VHOOK(FAllowMonsters)()
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|