ReGameDLL_CS/regamedll/dlls/singleplay_gamerules.cpp

240 lines
4.7 KiB
C++
Raw Normal View History

2015-06-30 12:46:07 +03:00
#include "precompiled.h"
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();
}
void CHalfLifeRules::Think()
2015-06-30 12:46:07 +03:00
{
;
}
BOOL CHalfLifeRules::IsMultiplayer()
2015-06-30 12:46:07 +03:00
{
return FALSE;
}
BOOL CHalfLifeRules::IsDeathmatch()
2015-06-30 12:46:07 +03:00
{
return FALSE;
}
BOOL CHalfLifeRules::IsCoOp()
2015-06-30 12:46:07 +03:00
{
return FALSE;
}
BOOL CHalfLifeRules::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;
}
BOOL CHalfLifeRules::GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon)
2015-06-30 12:46:07 +03:00
{
return FALSE;
}
BOOL CHalfLifeRules::ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason)
2015-06-30 12:46:07 +03:00
{
return TRUE;
}
void CHalfLifeRules::InitHUD(CBasePlayer *pl)
2015-06-30 12:46:07 +03:00
{
;
}
void CHalfLifeRules::ClientDisconnected(edict_t *pClient)
2015-06-30 12:46:07 +03:00
{
;
}
float CHalfLifeRules::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
2017-10-12 17:50:56 +03:00
pPlayer->m_flFallVelocity -= MAX_PLAYER_SAFE_FALL_SPEED;
2015-06-30 12:46:07 +03:00
return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;
}
void CHalfLifeRules::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");
pPlayer->GiveAmmo(60, "9mm");
pPlayer->GiveAmmo(24, "45acp");
2015-06-30 12:46:07 +03:00
}
BOOL CHalfLifeRules::AllowAutoTargetCrosshair()
2015-06-30 12:46:07 +03:00
{
return (g_iSkillLevel == SKILL_EASY);
}
void CHalfLifeRules::PlayerThink(CBasePlayer *pPlayer)
2015-06-30 12:46:07 +03:00
{
;
}
BOOL CHalfLifeRules::FPlayerCanRespawn(CBasePlayer *pPlayer)
2015-06-30 12:46:07 +03:00
{
return TRUE;
}
float CHalfLifeRules::FlPlayerSpawnTime(CBasePlayer *pPlayer)
2015-06-30 12:46:07 +03:00
{
return gpGlobals->time;
}
int CHalfLifeRules::IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled)
2015-06-30 12:46:07 +03:00
{
return 1;
}
void CHalfLifeRules::PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
2015-06-30 12:46:07 +03:00
{
;
}
void CHalfLifeRules::DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor)
2015-06-30 12:46:07 +03:00
{
;
}
void CHalfLifeRules::PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
2015-06-30 12:46:07 +03:00
{
;
}
float CHalfLifeRules::FlWeaponRespawnTime(CBasePlayerItem *pWeapon)
2015-06-30 12:46:07 +03:00
{
return -1;
}
float CHalfLifeRules::FlWeaponTryRespawn(CBasePlayerItem *pWeapon)
2015-06-30 12:46:07 +03:00
{
return 0;
}
Vector CHalfLifeRules::VecWeaponRespawnSpot(CBasePlayerItem *pWeapon)
2015-06-30 12:46:07 +03:00
{
return pWeapon->pev->origin;
}
edict_t *CHalfLifeRules::GetPlayerSpawnSpot(CBasePlayer *pPlayer)
2015-06-30 12:46:07 +03:00
{
2017-10-12 17:50:56 +03:00
CBaseEntity *pSpot = UTIL_FindEntityByClassname(nullptr, "info_player_start");
2015-06-30 12:46:07 +03:00
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;
2015-12-09 01:39:54 +03:00
pPlayer->pev->velocity = g_vecZero;
pPlayer->pev->angles = pSpot->pev->angles;
pPlayer->pev->punchangle = g_vecZero;
pPlayer->pev->fixangle = 1;
2015-06-30 12:46:07 +03:00
return pSpot->edict();
}
int CHalfLifeRules::WeaponShouldRespawn(CBasePlayerItem *pWeapon)
2015-06-30 12:46:07 +03:00
{
return GR_WEAPON_RESPAWN_NO;
}
BOOL CHalfLifeRules::CanHaveItem(CBasePlayer *pPlayer, CItem *pItem)
2015-06-30 12:46:07 +03:00
{
return TRUE;
}
void CHalfLifeRules::PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem)
2015-06-30 12:46:07 +03:00
{
;
}
int CHalfLifeRules::ItemShouldRespawn(CItem *pItem)
2015-06-30 12:46:07 +03:00
{
return GR_ITEM_RESPAWN_NO;
}
float CHalfLifeRules::FlItemRespawnTime(CItem *pItem)
2015-06-30 12:46:07 +03:00
{
return -1;
}
Vector CHalfLifeRules::VecItemRespawnSpot(CItem *pItem)
2015-06-30 12:46:07 +03:00
{
return pItem->pev->origin;
}
BOOL CHalfLifeRules::IsAllowedToSpawn(CBaseEntity *pEntity)
2015-06-30 12:46:07 +03:00
{
return TRUE;
}
void CHalfLifeRules::PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount)
2015-06-30 12:46:07 +03:00
{
;
}
int CHalfLifeRules::AmmoShouldRespawn(CBasePlayerAmmo *pAmmo)
2015-06-30 12:46:07 +03:00
{
return GR_AMMO_RESPAWN_NO;
}
float CHalfLifeRules::FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo)
2015-06-30 12:46:07 +03:00
{
return -1;
}
Vector CHalfLifeRules::VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo)
2015-06-30 12:46:07 +03:00
{
return pAmmo->pev->origin;
}
float CHalfLifeRules::FlHealthChargerRechargeTime()
2015-06-30 12:46:07 +03:00
{
return 0;
}
int CHalfLifeRules::DeadPlayerWeapons(CBasePlayer *pPlayer)
2015-06-30 12:46:07 +03:00
{
return GR_PLR_DROP_GUN_NO;
}
int CHalfLifeRules::DeadPlayerAmmo(CBasePlayer *pPlayer)
2015-06-30 12:46:07 +03:00
{
return GR_PLR_DROP_AMMO_NO;
}
int CHalfLifeRules::PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget)
2015-06-30 12:46:07 +03:00
{
// why would a single player in half life need this?
2015-06-30 12:46:07 +03:00
return GR_NOTTEAMMATE;
}
BOOL CHalfLifeRules::FAllowMonsters()
2015-06-30 12:46:07 +03:00
{
return TRUE;
}