2015-07-12 23:32:09 +03:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
2015-06-30 12:46:07 +03:00
|
|
|
/*
|
|
|
|
* Globals initialization
|
2015-07-12 23:32:09 +03:00
|
|
|
*/
|
|
|
|
#ifndef HOOK_GAMEDLL
|
|
|
|
|
|
|
|
CHalfLifeMultiplay *g_pGameRules = NULL;
|
|
|
|
|
|
|
|
#endif //HOOK_GAMEDLL
|
|
|
|
|
|
|
|
/* <ad93d> ../cstrike/dlls/gamerules.cpp:36 */
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CGameRules::__MAKE_VHOOK(CanHaveAmmo)(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry)
|
2015-07-12 23:32:09 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
int iAmmoIndex;
|
|
|
|
|
|
|
|
if (pszAmmoName != NULL)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
iAmmoIndex = pPlayer->GetAmmoIndex(pszAmmoName);
|
2015-06-30 12:46:07 +03:00
|
|
|
|
|
|
|
if (iAmmoIndex > -1)
|
|
|
|
{
|
|
|
|
if (pPlayer->AmmoInventory(iAmmoIndex) < iMaxCarry)
|
2015-08-20 13:35:01 +03:00
|
|
|
{
|
|
|
|
// player has room for more of this type of ammo
|
2015-06-30 12:46:07 +03:00
|
|
|
return TRUE;
|
2015-08-20 13:35:01 +03:00
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
}
|
2015-08-20 13:35:01 +03:00
|
|
|
|
2015-07-12 23:32:09 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* <ad89d> ../cstrike/dlls/gamerules.cpp:59 */
|
2015-08-20 13:35:01 +03:00
|
|
|
edict_t *CGameRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer)
|
2015-07-12 23:32:09 +03:00
|
|
|
{
|
2016-01-19 14:54:31 +03:00
|
|
|
// gat valid spawn point
|
2015-09-16 23:19:21 +03:00
|
|
|
edict_t *pentSpawnSpot = EntSelectSpawnPoint(pPlayer);
|
|
|
|
|
2016-01-19 14:54:31 +03:00
|
|
|
// Move the player to the place it said.
|
2015-12-22 21:07:49 +03:00
|
|
|
#ifndef PLAY_GAMEDLL
|
|
|
|
pPlayer->pev->origin = VARS(pentSpawnSpot)->origin + Vector(0, 0, 1);
|
|
|
|
#else
|
2015-11-06 17:58:48 +03:00
|
|
|
// TODO: fix test demo
|
|
|
|
pPlayer->pev->origin = VARS(pentSpawnSpot)->origin;
|
2015-09-16 23:19:21 +03:00
|
|
|
pPlayer->pev->origin.z += 1;
|
2015-12-22 21:07:49 +03:00
|
|
|
#endif // PLAY_GAMEDLL
|
2015-09-16 23:19:21 +03:00
|
|
|
|
|
|
|
pPlayer->pev->v_angle = g_vecZero;
|
|
|
|
pPlayer->pev->velocity = g_vecZero;
|
|
|
|
pPlayer->pev->angles = VARS(pentSpawnSpot)->angles;
|
|
|
|
pPlayer->pev->punchangle = g_vecZero;
|
|
|
|
pPlayer->pev->fixangle = 1;
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
return pentSpawnSpot;
|
2015-07-12 23:32:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <ad9a3> ../cstrike/dlls/gamerules.cpp:75 */
|
2015-08-20 13:35:01 +03:00
|
|
|
BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon)
|
2015-07-12 23:32:09 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
// only living players can have items
|
|
|
|
if (pPlayer->pev->deadflag != DEAD_NO)
|
|
|
|
{
|
2015-06-30 12:46:07 +03:00
|
|
|
return FALSE;
|
2015-08-20 13:35:01 +03:00
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
|
|
|
|
CCSBotManager *ctrl = TheCSBots();
|
2015-08-20 13:35:01 +03:00
|
|
|
|
2015-12-05 22:40:30 +03:00
|
|
|
if (pPlayer->IsBot() && ctrl != NULL && !ctrl->IsWeaponUseable(pWeapon))
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-09-16 23:19:21 +03:00
|
|
|
if (pWeapon->pszAmmo1())
|
|
|
|
{
|
|
|
|
if (!CanHaveAmmo(pPlayer, pWeapon->pszAmmo1(), pWeapon->iMaxAmmo1()))
|
|
|
|
{
|
|
|
|
// we can't carry anymore ammo for this gun. We can only
|
|
|
|
// have the gun if we aren't already carrying one of this type
|
|
|
|
if (pPlayer->HasPlayerItem(pWeapon))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// weapon doesn't use ammo, don't take another if you already have it.
|
|
|
|
if (pPlayer->HasPlayerItem(pWeapon))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2015-08-20 13:35:01 +03:00
|
|
|
}
|
|
|
|
|
2015-09-16 23:19:21 +03:00
|
|
|
// note: will fall through to here if GetItemInfo doesn't fill the struct!
|
2015-08-20 13:35:01 +03:00
|
|
|
return TRUE;
|
2015-07-12 23:32:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <ad85d> ../cstrike/dlls/gamerules.cpp:119 */
|
2016-02-04 03:18:26 +03:00
|
|
|
void CGameRules::__MAKE_VHOOK(RefreshSkillData)()
|
2015-07-12 23:32:09 +03:00
|
|
|
{
|
|
|
|
int iSkill = (int)CVAR_GET_FLOAT("skill");
|
|
|
|
|
|
|
|
if (iSkill < 1)
|
|
|
|
iSkill = 1;
|
|
|
|
|
|
|
|
else if (iSkill > 3)
|
|
|
|
iSkill = 3;
|
|
|
|
|
|
|
|
gSkillData.iSkillLevel = iSkill;
|
|
|
|
ALERT(at_console, "\nGAME SKILL LEVEL:%d\n", iSkill);
|
|
|
|
|
|
|
|
gSkillData.monDmg12MM = 8;
|
|
|
|
gSkillData.monDmgMP5 = 3;
|
|
|
|
gSkillData.monDmg9MM = 5;
|
|
|
|
gSkillData.suitchargerCapacity = 75;
|
|
|
|
gSkillData.batteryCapacity = 15;
|
|
|
|
gSkillData.healthchargerCapacity = 50;
|
|
|
|
gSkillData.healthkitCapacity = 15;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* <ada23> ../cstrike/dlls/gamerules.cpp:157 */
|
2016-02-04 03:18:26 +03:00
|
|
|
CGameRules *InstallGameRules()
|
2015-12-05 22:40:30 +03:00
|
|
|
{
|
2015-07-02 00:22:46 +03:00
|
|
|
SERVER_COMMAND("exec game.cfg\n");
|
|
|
|
SERVER_EXECUTE();
|
|
|
|
|
|
|
|
if (!gpGlobals->deathmatch)
|
|
|
|
return new CHalfLifeTraining;
|
|
|
|
|
2015-07-12 23:32:09 +03:00
|
|
|
return new CHalfLifeMultiplay;
|
|
|
|
}
|