Get rid of spec-crosshair from gameplay. (Useless)

Reworked hookchain's: SetClientUserInfoName, GiveNamedItem
Added hookchain's: DropShield, MakeVIP, MakeBomber, GetIntoGame, Disappear, Radio, StartObserver, OnSpawnEquip
Refactoring
This commit is contained in:
s1lentq 2016-12-07 02:21:52 +07:00
parent 00579432d7
commit c77486dadd
98 changed files with 2163 additions and 1566 deletions

1
.gitignore vendored
View File

@ -13,6 +13,7 @@
**/msvc/*.user
**/msvc/*.suo
**/msvc/*.txt
**/msvc/*.amplxeproj
**/msvc/ipch
regamedll/version/appversion.h

View File

@ -8,7 +8,7 @@ Regamedll_CS is a result of reverse engineering of original library mods HLDS (b
* Provide more stable (than official) version of Counter-Strike game with extended API for mods and plugins
## How can use it?
Regamedll_CS is fully compatible with official mod CS 1.6 by Valve. All you have to do is to download binaries and replace original mo.dll/cs.so
Regamedll_CS is fully compatible with official mod CS 1.6 / CZero by Valve. All you have to do is to download binaries and replace original mp.dll/cs.so
Compiled binaries are available here: [link](http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/regamedll/regamedll/0.2-SNAPSHOT/)
@ -22,20 +22,22 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| CVar | Default | Min | Max | Description |
| :---------------------------- | :-----: | :-: | :----------: | :--------------------------------------------- |
| mp_freeforall | 0 | 0 | 1 | The style of gameplay where there aren't any teams (FFA mode)<br/>`0` disabled <br/>`1` enabled |
| mp_autoteambalance | 1 | 0 | 2 | Auto balancing of teams<br/>`0` disabled <br/>`1` on after next round<br/>`2` on next round |
| mp_buytime | 1.5 | 0.0 | - | Designate the desired amount of buy time for each round. (in minutes)<br />`-1` means no time limit<br />`0` disable buy |
| mp_maxmoney | 16000 | 0 | `0x7FFFFFFF` | The maximum allowable amount of money in the game |
| mp_round_infinite | 0 | 0 | 1 | Flags for fine grained control (choose as many as needed)<br/>`0` disabled<br/>`1` enabled<br/><br/>or flags<br/>`a` block round time round end check<br/>`b` block needed players round end check<br/>`c` block VIP assassination/success round end check<br/>`d` block prison escape round end check<br/>`e` block bomb round end check<br/>`f` block team extermination round end check<br/>`g` block hostage rescue round end check<br/><br/>`Example setting:` "ae" blocks round time and bomb round end checks |
| mp_hegrenade_penetration | 0 | 0 | 1 | Disable grenade damage through walls<br/>`0` disabled<br/>`1` enabled |
| mp_nadedrops | 0 | 0 | 2 | Drop a grenade after player death<br/>`0` disabled<br/>`1` drop one the grenade<br/>`2` drop a everyone grenades |
| mp_nadedrops | 0 | 0 | 2 | Drop a grenade after player death<br/>`0` disabled<br/>`1` drop one the grenade<br/>`2` drop an everyone grenades |
| mp_roundrespawn_time | 20 | 0 | - | Player cannot respawn until next round if more than N seconds has elapsed since the beginning round |
| mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn<br/>`0` disabled<br/>`1` enabled |
| mp_refill_bpammo_weapons | 0 | 0 | 2 | Refill amount of backpack ammo up to the max<br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on each weapon reload |
| mp_refill_bpammo_weapons | 0 | 0 | 3 | Refill amount of backpack ammo up to the max<br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on player spawn and on the purchase of the item<br/>`3` refill backpack ammo on each weapon reload |
| mp_auto_join_team | 0 | 0 | 1 | Automatically joins the team <br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar humans_join_team any/CT/T) |
| mp_max_teamkills | 3 | 0 | - | Maximum number of allowed teamkills before autokick. Used when enabled mp_autokick. |
| mp_fragsleft | - | - | - | Is the number of frags left, if you have set mp_fraglimit. You just type mp_fragsleft in server console, and it tells you the number of frags left depending of mp_fraglimit. |
| mp_fraglimit | 0 | - | - | If set to something other than 0, when anybodys scored reaches mp_fraglimit the server changes map.<br />`0` means no limit |
| mp_timeleft | - | - | - | Is the number of time left before the map changes, if you have set mp_timelimit. You just type mp_timeleft in server console, and it tells you the number of time left depending of mp_timelimit. |
| mp_timelimit | 0 | - | - | Period between map rotations.<br />`0` means no limit |
| mp_roundover | 0 | - | - | The round by expired time will be over, if on a map it does not have the scenario of the game.<br/>`0` disabled<br/>`1` enabled |
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot <br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |

19
dist/game.cfg vendored
View File

@ -8,6 +8,14 @@ echo Executing ReGameDLL Configuration File
// Default value: "0"
mp_freeforall 0
// Auto balancing of teams
// 0 - disabled
// 1 - on after next round (default behaviour)
// 2 - on next round
//
// Default value: "1"
mp_autoteambalance 1
// Designate the desired amount of buy time for each round. (in minutes)
// -1 - means no time limit
// 0 - disable buy
@ -37,6 +45,12 @@ mp_maxmoney 16000
// Default value: "0"
mp_round_infinite 0
// The round by expired time will be over, if on a map it does not have the scenario of the game.
// 0 - disabled (default behaviour)
// 1 - enabled
// Default value: "0"
mp_roundover 0
// Disable grenade damage through walls
// 0 - disabled
// 1 - enabled
@ -46,7 +60,7 @@ mp_hegrenade_penetration 0
// Drop a grenade after player death
// 0 - disabled
// 1 - drop one the grenade
// 2 - drop a everyone grenades
// 2 - drop an everyone grenades
// Default value: "0"
mp_nadedrops 0
@ -66,7 +80,8 @@ mp_auto_reload_weapons "0"
// Refill amount of backpack ammo up to the max
// 0 - disabled (default behaviour)
// 1 - refill backpack ammo on player spawn
// 2 - refill backpack ammo on each weapon reload (NOTE: Useful for mods like DeathMatch, GunGame, ZombieMod etc.)
// 2 - refill backpack ammo on player spawn and on the purchase of the item
// 3 - refill backpack ammo on each weapon reload (NOTE: Useful for mods like DeathMatch, GunGame, ZombieMod etc.)
//
// Default value: "0"
mp_refill_bpammo_weapons 0

View File

@ -122,7 +122,7 @@
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_RESPAWNABLE 3 // do respawn the entity
#define DEAD_DISCARDBODY 4
#define DAMAGE_NO 0

View File

@ -15,7 +15,7 @@ void C9MMAmmo::__MAKE_VHOOK(Precache)()
BOOL C9MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_9MM_BUY, "9mm", MAX_AMMO_9MM) == -1)
if (pOther->GiveAmmo(AMMO_9MM_BUY, "9mm") == -1)
{
return FALSE;
}
@ -41,7 +41,7 @@ void CBuckShotAmmo::__MAKE_VHOOK(Precache)()
BOOL CBuckShotAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_BUCKSHOT_BUY, "buckshot", MAX_AMMO_BUCKSHOT) == -1)
if (pOther->GiveAmmo(AMMO_BUCKSHOT_BUY, "buckshot") == -1)
{
return FALSE;
}
@ -67,7 +67,7 @@ void C556NatoAmmo::__MAKE_VHOOK(Precache)()
BOOL C556NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_556NATO_BUY, "556Nato", MAX_AMMO_556NATO) == -1)
if (pOther->GiveAmmo(AMMO_556NATO_BUY, "556Nato") == -1)
{
return FALSE;
}
@ -93,7 +93,7 @@ void C556NatoBoxAmmo::__MAKE_VHOOK(Precache)()
BOOL C556NatoBoxAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_556NATOBOX_BUY, "556NatoBox", MAX_AMMO_556NATOBOX) == -1)
if (pOther->GiveAmmo(AMMO_556NATOBOX_BUY, "556NatoBox") == -1)
{
return FALSE;
}
@ -119,7 +119,7 @@ void C762NatoAmmo::__MAKE_VHOOK(Precache)()
BOOL C762NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_762NATO_BUY, "762Nato", MAX_AMMO_762NATO) == -1)
if (pOther->GiveAmmo(AMMO_762NATO_BUY, "762Nato") == -1)
{
return FALSE;
}
@ -145,7 +145,7 @@ void C45ACPAmmo::__MAKE_VHOOK(Precache)()
BOOL C45ACPAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_45ACP_BUY, "45acp", MAX_AMMO_45ACP) == -1)
if (pOther->GiveAmmo(AMMO_45ACP_BUY, "45acp") == -1)
{
return FALSE;
}
@ -171,7 +171,7 @@ void C50AEAmmo::__MAKE_VHOOK(Precache)()
BOOL C50AEAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_50AE_BUY, "50AE", MAX_AMMO_50AE) == -1)
if (pOther->GiveAmmo(AMMO_50AE_BUY, "50AE") == -1)
{
return FALSE;
}
@ -197,7 +197,7 @@ void C338MagnumAmmo::__MAKE_VHOOK(Precache)()
BOOL C338MagnumAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_338MAG_BUY, "338Magnum", MAX_AMMO_338MAGNUM) == -1)
if (pOther->GiveAmmo(AMMO_338MAG_BUY, "338Magnum") == -1)
{
return FALSE;
}
@ -223,7 +223,7 @@ void C57MMAmmo::__MAKE_VHOOK(Precache)()
BOOL C57MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_57MM_BUY, "57mm", MAX_AMMO_57MM) == -1)
if (pOther->GiveAmmo(AMMO_57MM_BUY, "57mm") == -1)
{
return FALSE;
}
@ -249,7 +249,7 @@ void C357SIGAmmo::__MAKE_VHOOK(Precache)()
BOOL C357SIGAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther)
{
if (pOther->GiveAmmo(AMMO_357SIG_BUY, "357SIG", MAX_AMMO_357SIG) == -1)
if (pOther->GiveAmmo(AMMO_357SIG_BUY, "357SIG") == -1)
{
return FALSE;
}

View File

@ -588,13 +588,13 @@ void CCSBot::UpdateHostageEscortCount()
m_hostageEscortCount = 0;
CHostage *hostage = NULL;
while ((hostage = static_cast<CHostage *>(UTIL_FindEntityByClassname(hostage, "hostage_entity"))) != NULL)
while ((hostage = static_cast<CHostage *>(UTIL_FindEntityByClassname(hostage, "hostage_entity"))))
{
if (FNullEnt(hostage->edict()))
break;
// skip dead or rescued hostages
if (!hostage->IsValid())
if (!hostage->IsAlive())
continue;
// check if hostage has targeted us, and is following

View File

@ -102,8 +102,7 @@ void CCSBotManager::__MAKE_VHOOK(RestartRound)()
ResetRadioMessageTimestamps();
m_lastSeenEnemyTimestamp = -9999.9f;
m_roundStartTimestamp = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime");
m_roundStartTimestamp = gpGlobals->time + freezetime.value;
// randomly decide if defensive team wants to "rush" as a whole
const float defenseRushChance = 33.3f; // 25.0f;

View File

@ -293,12 +293,12 @@ void CSGameState::InitializeHostageInfo()
m_haveSomeHostagesBeenTaken = false;
CBaseEntity *hostage = NULL;
while ((hostage = UTIL_FindEntityByClassname(hostage, "hostage_entity")) != NULL)
while ((hostage = UTIL_FindEntityByClassname(hostage, "hostage_entity")))
{
if (m_hostageCount >= MAX_HOSTAGES)
break;
if (hostage->pev->takedamage != DAMAGE_YES)
if (!hostage->IsAlive())
continue;
m_hostage[m_hostageCount].hostage = static_cast<CHostage *>(hostage);
@ -338,7 +338,7 @@ CHostage *CSGameState::GetNearestFreeHostage(Vector *knowPos) const
if (m_owner->m_iTeam == CT)
{
// we know exactly where the hostages are, and if they are alive
if (!m_hostage[i].hostage || !m_hostage[i].hostage->IsValid())
if (!m_hostage[i].hostage || !m_hostage[i].hostage->IsAlive())
continue;
if (m_hostage[i].hostage->IsFollowingSomeone())
@ -457,7 +457,7 @@ CSGameState::ValidateStatusType CSGameState::ValidateHostagePositions()
// if we can see a hostage, update our knowledge of it
if (m_owner->IsVisible(&info->hostage->pev->origin, CHECK_FOV))
{
if (info->hostage->pev->takedamage == DAMAGE_YES)
if (info->hostage->IsAlive())
{
// live hostage
// if hostage is being escorted by a CT, we don't "see" it, we see the CT
@ -494,7 +494,7 @@ CSGameState::ValidateStatusType CSGameState::ValidateHostagePositions()
if (m_owner->IsVisible(&info->knownPos, CHECK_FOV))
{
// we can see where we thought the hostage was - verify it is still there and alive
if (info->hostage->pev->takedamage != DAMAGE_YES)
if (!info->hostage->IsAlive())
{
// since we have line of sight to an invalid hostage, it must be dead
// discovered that hostage has been killed
@ -559,7 +559,7 @@ CHostage *CSGameState::GetNearestVisibleFreeHostage() const
continue;
// if the hostage is dead or rescued, its not free
if (info->hostage->pev->takedamage != DAMAGE_YES)
if (!info->hostage->IsAlive())
continue;
// if this hostage is following someone, its not free
@ -591,7 +591,6 @@ bool CSGameState::AreAllHostagesBeingRescued() const
return false;
bool isAllDead = true;
for (int i = 0; i < m_hostageCount; ++i)
{
const HostageInfo *info = &m_hostage[i];
@ -599,7 +598,7 @@ bool CSGameState::AreAllHostagesBeingRescued() const
if (m_owner->m_iTeam == CT)
{
// CT's have perfect knowledge via their radar
if (info->hostage != NULL && info->hostage->IsValid())
if (info->hostage && info->hostage->IsAlive())
{
if (!info->hostage->IsFollowingSomeone())
return false;
@ -638,7 +637,7 @@ bool CSGameState::AreAllHostagesGone() const
if (m_owner->m_iTeam == CT)
{
// CT's have perfect knowledge via their radar
if (info->hostage->IsAlive())// == DAMAGE_YES)
if (info->hostage->IsAlive())
return false;
}
else

View File

@ -172,7 +172,7 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// Since CT's have a radar, they can directly look at the actual hostage state
// check if someone else collected our hostage, or the hostage died or was rescued
CHostage *hostage = static_cast<CHostage *>(me->GetGoalEntity());
if (hostage == NULL || !hostage->IsValid() || hostage->IsFollowingSomeone())
if (!hostage || !hostage->IsAlive() || hostage->IsFollowingSomeone())
{
me->Idle();
return;

View File

@ -162,19 +162,17 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
if (m_rescuer)
{
int hostages_ = 0;
CBaseEntity *hostageEntity = NULL;
CHostage *hostageEntity = NULL;
while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL)
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
{
if (hostageEntity->pev->takedamage != DAMAGE_YES)
if (!hostageEntity->IsAlive())
continue;
CHostage *hostage = static_cast<CHostage *>(hostageEntity);
if (!hostage->IsFollowingSomeone())
if (!hostageEntity->IsFollowingSomeone())
continue;
if (hostage->IsValid() && hostage->m_target == pVictim)
if (hostageEntity->m_target == pVictim)
++hostages_;
}
@ -182,22 +180,22 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
return;
}
if (m_weaponId == WEAPON_SHIELDGUN)
{
if (!killerHasShield)
return;
}
else if (m_weaponId)
{
if (m_weaponId != weaponId)
return;
}
else
{
if (!m_weaponClassId || m_weaponClassId != weaponClassId)
return;
}
if (m_weaponId == WEAPON_SHIELDGUN)
{
if (!killerHasShield)
return;
}
else if (m_weaponId)
{
if (m_weaponId != weaponId)
return;
}
else
{
if (!m_weaponClassId || m_weaponClassId != weaponClassId)
return;
}
++m_eventsSeen;
SendPartialNotification();
}
@ -240,19 +238,17 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
if (m_rescuer)
{
int hostages_ = 0;
CBaseEntity *hostageEntity = NULL;
CHostage *hostageEntity = NULL;
while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL)
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
{
if (hostageEntity->pev->takedamage != DAMAGE_YES)
if (!hostageEntity->IsAlive())
continue;
CHostage *hostage = static_cast<CHostage *>(hostageEntity);
if (!hostage->IsFollowingSomeone())
if (!hostageEntity->IsFollowingSomeone())
continue;
if (hostage->IsValid() && hostage->m_target == pAttacker)
if (hostageEntity->m_target == pAttacker)
++hostages_;
}
@ -271,11 +267,11 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
if (!Q_strcmp(m_name, "defendhostages"))
{
int hostages_ = 0;
CBaseEntity *hostageEntity = NULL;
CHostage *hostageEntity = NULL;
while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL)
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
{
if (hostageEntity->pev->takedamage != 1.0f && hostageEntity->pev->deadflag != DEAD_DEAD)
if (hostageEntity->pev->takedamage != DAMAGE_YES && hostageEntity->pev->deadflag != DEAD_DEAD)
++hostages_;
}
@ -288,13 +284,11 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
else if (!Q_strcmp(m_name, "hostagessurvive"))
{
int hostages_ = 0;
CBaseEntity *hostageEntity = NULL;
CHostage *hostageEntity = NULL;
while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL)
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
{
CHostage *hostage = (CHostage *)hostageEntity;
if (hostage && hostage->IsDead())
if (hostageEntity && hostageEntity->IsDead())
++hostages_;
}
@ -337,7 +331,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
WRITE_BYTE(m_id);
MESSAGE_END();
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_CAREER_TASK_DONE);
}
@ -382,7 +376,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
UTIL_GetLocalPlayer()->SyncRoundTimer();
}
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_CAREER_TASK_DONE);
}
@ -401,7 +395,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti
void CCareerTaskManager::Create()
{
if (TheCareerTasks != NULL)
if (TheCareerTasks)
{
TheCareerTasks->Reset();
return;
@ -420,26 +414,23 @@ void CCareerTaskManager::Reset(bool deleteTasks)
{
if (deleteTasks)
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
delete (*it);
for (auto task : m_tasks)
delete task;
m_tasks.clear();
m_nextId = 0;
}
else
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
CCareerTask *pTask = (*it);
pTask->Reset();
}
for (auto task : m_tasks)
task->Reset();
}
m_finishedTaskTime = 0;
m_finishedTaskRound = 0;
m_shouldLatchRoundEndMessage = false;
m_roundStartTime = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime");
m_roundStartTime = gpGlobals->time + freezetime.value;
}
void CCareerTaskManager::SetFinishedTaskTime(int val)
@ -456,7 +447,7 @@ void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, i
{
const TaskInfo *pTaskInfo = &taskInfo[ i ];
if (pTaskInfo->taskName != NULL)
if (pTaskInfo->taskName)
{
if (!Q_stricmp(pTaskInfo->taskName, taskName))
{
@ -509,17 +500,15 @@ void CCareerTaskManager::HandleEvent(GameEventType event, CBasePlayer *pAttacker
return;
}
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
(*it)->OnEvent(event, pAttacker, pVictim);
for (auto task : m_tasks) {
task->OnEvent(event, pAttacker, pVictim);
}
}
void CCareerTaskManager::HandleWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim)
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
(*it)->OnWeaponKill(weaponId, weaponClassId, headshot, killerHasShield, pAttacker, pVictim);
for (auto task : m_tasks) {
task->OnWeaponKill(weaponId, weaponClassId, headshot, killerHasShield, pAttacker, pVictim);
}
}
@ -540,9 +529,8 @@ void CCareerTaskManager::HandleEnemyKill(bool wasBlind, const char *weaponName,
void CCareerTaskManager::HandleWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker)
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
(*it)->OnWeaponInjury(weaponId, weaponClassId, attackerHasShield, pAttacker);
for (auto task : m_tasks) {
task->OnWeaponInjury(weaponId, weaponClassId, attackerHasShield, pAttacker);
}
}
@ -563,7 +551,6 @@ void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker)
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
if (pPlayer && pPlayer->m_iTeam == enemyTeam && pPlayer->IsAlive())
++numEnemies;
}
@ -576,9 +563,8 @@ void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker)
bool CCareerTaskManager::AreAllTasksComplete()
{
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
if (!(*it)->IsComplete())
for (auto task : m_tasks) {
if (!task->IsComplete())
return false;
}
@ -587,14 +573,13 @@ bool CCareerTaskManager::AreAllTasksComplete()
int CCareerTaskManager::GetNumRemainingTasks()
{
int ret = 0;
for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it)
{
if (!(*it)->IsComplete())
++ret;
int nCount = 0;
for (auto task : m_tasks) {
if (task->IsComplete())
++nCount;
}
return ret;
return nCount;
}
float CCareerTaskManager::GetRoundElapsedTime()

View File

@ -5,7 +5,7 @@
*/
#ifndef HOOK_GAMEDLL
static DLL_FUNCTIONS gFunctionTable =
DLL_FUNCTIONS gFunctionTable =
{
&GameDLLInit,
&DispatchSpawn,
@ -59,7 +59,7 @@ static DLL_FUNCTIONS gFunctionTable =
&AllowLagCompensation
};
static NEW_DLL_FUNCTIONS gNewDLLFunctions =
NEW_DLL_FUNCTIONS gNewDLLFunctions =
{
&OnFreeEntPrivateData,
NULL,
@ -79,7 +79,6 @@ TYPEDESCRIPTION CBaseEntity::m_SaveData[] =
};
CMemoryPool hashItemMemPool(sizeof(hash_item_t), 64);
BOOL gTouchDisabled = FALSE;
#endif // HOOK_GAMEDLL
@ -300,7 +299,7 @@ void REMOVE_ENTITY(edict_t *pEntity)
{
if (pEntity)
{
(*g_engfuncs.pfnRemoveEntity)(pEntity);
g_engfuncs.pfnRemoveEntity(pEntity);
}
}
@ -329,16 +328,16 @@ void loopPerformance()
for (i = 0; i < 100; ++i)
{
CBaseEntity *pSpot;
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "info_player_start"); pSpot != NULL; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "info_player_start"))
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "info_player_start"); pSpot; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "info_player_start"))
;
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "info_player_deathmatch"); pSpot != NULL; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "info_player_deathmatch"))
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "info_player_deathmatch"); pSpot; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "info_player_deathmatch"))
;
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "player"); pSpot != NULL; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "player"))
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "player"); pSpot; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "player"))
;
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "bodyque"); pSpot != NULL; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "bodyque"))
for (pSpot = UTIL_FindEntityByString_Old(NULL, "classname", "bodyque"); pSpot; pSpot = UTIL_FindEntityByString_Old(pSpot, "classname", "bodyque"))
;
}
@ -351,16 +350,16 @@ void loopPerformance()
for (i = 0; i < 100; ++i)
{
CBaseEntity *pSpot;
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "info_player_start"); pSpot != NULL; pSpot = UTIL_FindEntityByString(pSpot, "classname", "info_player_start"))
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "info_player_start"); pSpot; pSpot = UTIL_FindEntityByString(pSpot, "classname", "info_player_start"))
;
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "info_player_deathmatch"); pSpot != NULL; pSpot = UTIL_FindEntityByString(pSpot, "classname", "info_player_deathmatch"))
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "info_player_deathmatch"); pSpot; pSpot = UTIL_FindEntityByString(pSpot, "classname", "info_player_deathmatch"))
;
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "player"); pSpot != NULL; pSpot = UTIL_FindEntityByString(pSpot, "classname", "player"))
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "player"); pSpot; pSpot = UTIL_FindEntityByString(pSpot, "classname", "player"))
;
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "bodyque"); pSpot != NULL; pSpot = UTIL_FindEntityByString(pSpot, "classname", "bodyque"))
for (pSpot = UTIL_FindEntityByString(NULL, "classname", "bodyque"); pSpot; pSpot = UTIL_FindEntityByString(pSpot, "classname", "bodyque"))
;
}
@ -482,7 +481,6 @@ void EXT_FUNC DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
// Get the actualy entity object
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentKeyvalue);
if (!pEntity)
return;
@ -493,9 +491,6 @@ void EXT_FUNC DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
// while it builds the graph
void EXT_FUNC DispatchTouch(edict_t *pentTouched, edict_t *pentOther)
{
if (gTouchDisabled)
return;
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentTouched);
CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther);
@ -712,7 +707,6 @@ int EXT_FUNC DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int glob
void EXT_FUNC DispatchObjectCollsionBox(edict_t *pent)
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
if (pEntity)
{
pEntity->SetObjectCollisionBox();
@ -865,7 +859,6 @@ CBaseEntity *CBaseEntity::__MAKE_VHOOK(GetNextTarget)()
return NULL;
edict_t *pTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->target));
if (FNullEnt(pTarget))
{
return NULL;
@ -886,10 +879,7 @@ int CBaseEntity::__MAKE_VHOOK(Save)(CSave &save)
int CBaseEntity::__MAKE_VHOOK(Restore)(CRestore &restore)
{
int status;
status = restore.ReadEntVars("ENTVARS", pev);
int status = restore.ReadEntVars("ENTVARS", pev);
if (status)
{
status = restore.ReadFields("BASE", this, IMPL(m_SaveData), ARRAYSIZE(IMPL(m_SaveData)));
@ -978,18 +968,10 @@ int CBaseEntity::Intersects(CBaseEntity *pOther)
void CBaseEntity::MakeDormant()
{
pev->flags |= FL_DORMANT;
// Don't touch
pev->solid = SOLID_NOT;
// Don't move
pev->movetype = MOVETYPE_NONE;
// Don't draw
pev->effects |= EF_NODRAW;
// Don't think
pev->nextthink = 0;
pev->solid = SOLID_NOT; // Don't touch
pev->movetype = MOVETYPE_NONE; // Don't move
pev->effects |= EF_NODRAW; // Don't draw
pev->nextthink = 0; // Don't think
// Relink
UTIL_SetOrigin(pev, pev->origin);
@ -1069,7 +1051,7 @@ CBaseEntity *CBaseEntity::Create(char *szName, const Vector &vecOrigin, const Ve
return pEntity;
}
void OnFreeEntPrivateData(edict_t *pEnt)
void EXT_FUNC OnFreeEntPrivateData(edict_t *pEnt)
{
CBaseEntity *pEntity = CBaseEntity::Instance(pEnt);
if (!pEntity)

View File

@ -252,7 +252,7 @@ public:
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) {}
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) { return FALSE; }
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) { return FALSE; }
virtual int GiveAmmo(int iAmount, char *szName, int iMax) { return -1; }
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) { return -1; }
virtual float GetDelay() { return 0.0f; }
virtual int IsMoving() { return (pev->velocity != g_vecZero); }
virtual void OverrideReset() {}
@ -341,9 +341,17 @@ public:
BOOL IsLockedByMaster() { return FALSE; }
public:
static CBaseEntity *Instance(edict_t *pent) { return (CBaseEntity *)GET_PRIVATE(pent ? pent : ENT(0)); }
static CBaseEntity *Instance(edict_t *pent)
{
if (!pent)
pent = ENT(0);
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
return pEntity;
}
static CBaseEntity *Instance(entvars_t *pev) { return Instance(ENT(pev)); }
static CBaseEntity *Instance(int offset) { return Instance(ENT(offset)); }
static CBaseEntity *Instance(EOFFSET offset) { return Instance(ENT(offset)); }
CBaseMonster *GetMonsterPointer(entvars_t *pevMonster)
{
@ -698,13 +706,13 @@ T *GetClassPtr(T *a)
entvars_t *pev = (entvars_t *)a;
// allocate entity if necessary
if (pev == NULL)
if (pev == nullptr)
pev = VARS(CREATE_ENTITY());
// get the private data
a = (T *)GET_PRIVATE(ENT(pev));
if (!a)
if (a == nullptr)
{
// allocate private data
a = new(pev) T;

View File

@ -39,13 +39,14 @@
#define DEFAULT_FOV 90 // the default field of view
#define HIDEHUD_WEAPONS (1 << 0)
#define HIDEHUD_FLASHLIGHT (1 << 1)
#define HIDEHUD_ALL (1 << 2)
#define HIDEHUD_HEALTH (1 << 3)
#define HIDEHUD_TIMER (1 << 4)
#define HIDEHUD_MONEY (1 << 5)
#define HIDEHUD_CROSSHAIR (1 << 6)
#define HIDEHUD_WEAPONS (1<<0)
#define HIDEHUD_FLASHLIGHT (1<<1)
#define HIDEHUD_ALL (1<<2)
#define HIDEHUD_HEALTH (1<<3)
#define HIDEHUD_TIMER (1<<4)
#define HIDEHUD_MONEY (1<<5)
#define HIDEHUD_CROSSHAIR (1<<6)
#define HIDEHUD_OBSERVER_CROSSHAIR (1<<7)
#define STATUSICON_HIDE 0
#define STATUSICON_SHOW 1
@ -73,10 +74,11 @@
#define SIGNAL_ESCAPE (1<<3)
#define SIGNAL_VIPSAFETY (1<<4)
#define DATA_IUSER3_CANSHOOT (1<<0)
#define DATA_IUSER3_FREEZETIMEOVER (1<<1)
#define DATA_IUSER3_INBOMBZONE (1<<2)
#define DATA_IUSER3_HOLDINGSHIELD (1<<3)
// player data iuser3
#define PLAYER_CAN_SHOOT (1<<0)
#define PLAYER_FREEZE_TIME_OVER (1<<1)
#define PLAYER_IN_BOMB_ZONE (1<<2)
#define PLAYER_HOLDING_SHIELD (1<<3)
#define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1)
@ -104,15 +106,15 @@ enum VGUIMenu
{
VGUI_Menu_Team = 2,
VGUI_Menu_MapBriefing = 4,
VGUI_Menu_Class_T = 26,
VGUI_Menu_Class_CT,
VGUI_Menu_Buy,
VGUI_Menu_Buy_Pistol,
VGUI_Menu_Buy_ShotGun,
VGUI_Menu_Buy_Rifle,
VGUI_Menu_Buy_SubMachineGun,
VGUI_Menu_Buy_MachineGun,
VGUI_Menu_Class_T = 26,
VGUI_Menu_Class_CT,
VGUI_Menu_Buy,
VGUI_Menu_Buy_Pistol,
VGUI_Menu_Buy_ShotGun,
VGUI_Menu_Buy_Rifle,
VGUI_Menu_Buy_SubMachineGun,
VGUI_Menu_Buy_MachineGun,
VGUI_Menu_Buy_Item,
};

View File

@ -113,7 +113,7 @@ void EXT_FUNC ClientDisconnect(edict_t *pEntity)
{
CBasePlayer *pPlayer = CBasePlayer::Instance(pEntity);
if (!g_fGameOver)
if (!g_pGameRules->IsGameOver())
{
UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_disconnected", STRING(pEntity->v.netname));
#ifndef REGAMEDLL_FIXES
@ -198,7 +198,7 @@ void EXT_FUNC ClientKill(edict_t *pEntity)
LINK_HOOK_VOID_CHAIN(ShowMenu, (CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText), pPlayer, bitsValidSlots, nDisplayTime, fNeedMore, pszText);
void __API_HOOK(ShowMenu)(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText)
void EXT_FUNC __API_HOOK(ShowMenu)(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText)
{
MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pPlayer->pev);
WRITE_SHORT(bitsValidSlots);
@ -210,7 +210,7 @@ void __API_HOOK(ShowMenu)(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplay
LINK_HOOK_VOID_CHAIN(ShowVGUIMenu, (CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu), pPlayer, MenuType, BitMask, szOldMenu);
void __API_HOOK(ShowVGUIMenu)(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu)
void EXT_FUNC __API_HOOK(ShowVGUIMenu)(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu)
{
#ifdef REGAMEDLL_ADD
if (CSGameRules()->ShouldSkipShowMenu()) {
@ -245,7 +245,7 @@ NOXREF int CountTeams()
int iNumCT = 0, iNumTerrorist = 0;
CBaseEntity *pPlayer = NULL;
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")) != NULL)
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
{
if (FNullEnt(pPlayer->edict()))
break;
@ -276,7 +276,7 @@ void ListPlayers(CBasePlayer *current)
char message[120] = "", cNumber[12];
CBaseEntity *pPlayer = NULL;
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")) != NULL)
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
{
if (FNullEnt(pPlayer->edict()))
break;
@ -304,7 +304,7 @@ int CountTeamPlayers(int iTeam)
CBaseEntity *pPlayer = NULL;
int i = 0;
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")) != NULL)
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
{
if (FNullEnt(pPlayer->edict()))
break;
@ -340,7 +340,7 @@ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer)
pTempEntity = NULL;
iVoteID = pVotingPlayer->m_iCurrentKickVote;
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")) != NULL)
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")))
{
if (FNullEnt(pTempEntity->edict()))
break;
@ -369,7 +369,7 @@ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer)
SERVER_COMMAND(UTIL_VarArgs("kick # %d\n", iVoteID));
pTempEntity = NULL;
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")) != NULL)
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")))
{
if (FNullEnt(pTempEntity->edict()))
break;
@ -466,16 +466,19 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
pPlayer->SetThink(NULL);
CBaseEntity *pTarget = UTIL_FindEntityByClassname(NULL, "trigger_camera");
pPlayer->m_pIntroCamera = pTarget;
CBaseEntity *pTarget = NULL;
pPlayer->m_pIntroCamera = UTIL_FindEntityByClassname(NULL, "trigger_camera");
if (CSGameRules() && CSGameRules()->m_bMapHasCameras == MAP_HAS_CAMERAS_INIT)
if (g_pGameRules && g_pGameRules->IsMultiplayer())
{
CSGameRules()->m_bMapHasCameras = (pTarget != NULL);
CSGameRules()->m_bMapHasCameras = (pPlayer->m_pIntroCamera != NULL);
}
if (pPlayer->m_pIntroCamera)
{
// find the target (by default info_target) for the camera view direction.
pTarget = UTIL_FindEntityByTargetname(NULL, STRING(pPlayer->m_pIntroCamera->pev->target));
}
if (pPlayer->m_pIntroCamera && pTarget)
{
@ -495,7 +498,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
{
pPlayer->m_iTeam = CT;
if (g_pGameRules != NULL)
if (g_pGameRules)
{
g_pGameRules->GetPlayerSpawnSpot(pPlayer);
}
@ -506,7 +509,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
}
#endif
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, (CBaseEntity *)pPlayer);
}
@ -639,7 +642,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
pszFormat = "#Cstrike_Chat_CT_Dead";
pszConsoleFormat = "*DEAD*(Counter-Terrorist) %s : %s";
}
else if (placeName != NULL)
else if (placeName)
{
pszFormat = "#Cstrike_Chat_CT_Loc";
pszConsoleFormat = "*(Counter-Terrorist) %s @ %s : %s";
@ -658,7 +661,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
pszFormat = "#Cstrike_Chat_T_Dead";
pszConsoleFormat = "*DEAD*(Terrorist) %s : %s";
}
else if (placeName != NULL)
else if (placeName)
{
pszFormat = "#Cstrike_Chat_T_Loc";
pszConsoleFormat = "(Terrorist) %s @ %s : %s";
@ -704,7 +707,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
// -3 for /n and null terminator
j = sizeof(text) - 3 - Q_strlen(text) - Q_strlen(pszFormat);
if (placeName != NULL)
if (placeName)
{
j -= Q_strlen(placeName) + 1;
}
@ -712,7 +715,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
if ((signed int)Q_strlen(p) > j)
p[j] = 0;
for (char *pAmpersand = p; pAmpersand != NULL && *pAmpersand != '\0'; pAmpersand++)
for (char *pAmpersand = p; pAmpersand && *pAmpersand != '\0'; pAmpersand++)
{
if (pAmpersand[0] == '%')
{
@ -732,7 +735,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
// so check it, or it will infinite loop
client = NULL;
while ((client = (CBasePlayer *)UTIL_FindEntityByClassname(client, "player")) != NULL)
while ((client = (CBasePlayer *)UTIL_FindEntityByClassname(client, "player")))
{
if (FNullEnt(client->edict()))
break;
@ -769,7 +772,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
WRITE_STRING("");
WRITE_STRING(text);
if (placeName != NULL)
if (placeName)
{
WRITE_STRING(placeName);
}
@ -787,7 +790,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
WRITE_STRING("");
WRITE_STRING(text);
if (placeName != NULL)
if (placeName)
{
WRITE_STRING(placeName);
}
@ -805,7 +808,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
else
SERVER_PRINT(text);
if (CVAR_GET_FLOAT("mp_logmessages") != 0)
if (logmessages.value)
{
const char *temp = teamonly ? "say_team" : "say";
const char *deadText = (player->m_iTeam != SPECTATOR && bSenderDead) ? " (dead)" : "";
@ -825,10 +828,10 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon)
if (pPlayer->HasShield() && iWeapon == WEAPON_SHIELDGUN)
return false;
if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ] != NULL && pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ]->m_iId == WEAPON_ELITE && iWeapon == WEAPON_SHIELDGUN)
if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ] && pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ]->m_iId == WEAPON_ELITE && iWeapon == WEAPON_SHIELDGUN)
return false;
if (pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ] != NULL && pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]->m_iId == iWeapon)
if (pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ] && pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]->m_iId == iWeapon)
{
if (g_bClientPrintEnable)
{
@ -838,7 +841,7 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon)
return false;
}
if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ] != NULL && pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ]->m_iId == iWeapon)
if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ] && pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ]->m_iId == iWeapon)
{
if (g_bClientPrintEnable)
{
@ -848,7 +851,7 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon)
return false;
}
if (!CanBuyWeaponByMaptype(pPlayer->m_iTeam, (WeaponIdType)iWeapon, (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES)))
if (!CanBuyWeaponByMaptype(pPlayer->m_iTeam, (WeaponIdType)iWeapon, CSGameRules()->m_bMapHasVIPSafetyZone == TRUE))
{
if (g_bClientPrintEnable)
{
@ -1093,7 +1096,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
if (pPlayer->HasRestrictItem(ITEM_FLASHBANG, ITEM_TYPE_BUYING))
return;
#endif
if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("Flashbang")) >= MaxAmmoCarry("Flashbang"))
if (pPlayer->AmmoInventory(AMMO_FLASHBANG) >= MaxAmmoCarry(WEAPON_FLASHBANG))
{
if (g_bClientPrintEnable)
{
@ -1118,7 +1121,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
if (pPlayer->HasRestrictItem(ITEM_HEGRENADE, ITEM_TYPE_BUYING))
return;
#endif
if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("HEGrenade")) >= MaxAmmoCarry("HEGrenade"))
if (pPlayer->AmmoInventory(AMMO_HEGRENADE) >= MaxAmmoCarry(WEAPON_HEGRENADE))
{
if (g_bClientPrintEnable)
{
@ -1142,7 +1145,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
if (pPlayer->HasRestrictItem(ITEM_SMOKEGRENADE, ITEM_TYPE_BUYING))
return;
#endif
if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("SmokeGrenade")) >= MaxAmmoCarry("SmokeGrenade"))
if (pPlayer->AmmoInventory(AMMO_SMOKEGRENADE) >= MaxAmmoCarry(WEAPON_SMOKEGRENADE))
{
if (g_bClientPrintEnable)
{
@ -1268,34 +1271,36 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
return;
}
if (pszItem != NULL)
if (pszItem)
{
pPlayer->GiveNamedItem(pszItem);
pPlayer->AddAccount(-iItemPrice, RT_PLAYER_BOUGHT_SOMETHING);
}
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
}
void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID)
LINK_HOOK_CHAIN(CBaseEntity *, BuyWeaponByWeaponID, (CBasePlayer *pPlayer, WeaponIdType weaponID), pPlayer, weaponID);
CBaseEntity *EXT_FUNC __API_HOOK(BuyWeaponByWeaponID)(CBasePlayer *pPlayer, WeaponIdType weaponID)
{
if (!pPlayer->CanPlayerBuy(true))
return;
return nullptr;
#ifdef REGAMEDLL_ADD
if (pPlayer->HasRestrictItem((ItemID)weaponID, ITEM_TYPE_BUYING))
return;
return nullptr;
#endif
if (!CanBuyThis(pPlayer, weaponID))
return;
return nullptr;
WeaponInfoStruct *info = GetWeaponInfo(weaponID);
if (!info || !info->entityName)
return;
return nullptr;
if (pPlayer->m_iAccount < info->cost)
{
@ -1305,7 +1310,7 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID)
BlinkAccount(pPlayer);
}
return;
return nullptr;
}
if (IsPrimaryWeapon(weaponID))
@ -1317,18 +1322,26 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID)
pPlayer->DropSecondary();
}
pPlayer->GiveNamedItem(info->entityName);
auto pEntity = pPlayer->GiveNamedItem(info->entityName);
pPlayer->AddAccount(-info->cost, RT_PLAYER_BOUGHT_SOMETHING);
if (TheTutor != NULL)
#ifdef REGAMEDLL_ADD
if (refill_bpammo_weapons.value > 1 && info->ammoType >= AMMO_338MAGNUM && info->ammoType <= AMMO_9MM) {
pPlayer->m_rgAmmo[info->ammoType] = info->maxRounds;
}
#endif
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
return pEntity;
}
LINK_HOOK_VOID_CHAIN(HandleMenu_ChooseAppearance, (CBasePlayer *player, int slot), player, slot);
void __API_HOOK(HandleMenu_ChooseAppearance)(CBasePlayer *player, int slot)
void EXT_FUNC __API_HOOK(HandleMenu_ChooseAppearance)(CBasePlayer *player, int slot)
{
int numSkins = g_bIsCzeroGame ? CZ_NUM_SKIN : CS_NUM_SKIN;
@ -1466,15 +1479,7 @@ void __API_HOOK(HandleMenu_ChooseAppearance)(CBasePlayer *player, int slot)
player->SetClientUserInfoModel(GET_INFO_BUFFER(player->edict()), appearance.model_name);
player->SetNewPlayerModel(sPlayerModelFiles[ appearance.model_name_index ]);
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_VIP_SAFETYZONE_UNINITIALIZED)
{
if ((UTIL_FindEntityByClassname(NULL, "func_vip_safetyzone")) != NULL)
CSGameRules()->m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_YES;
else
CSGameRules()->m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_NO;
}
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES)
if (CSGameRules()->m_bMapHasVIPSafetyZone)
{
if (!CSGameRules()->m_pVIP && player->m_iTeam == CT)
{
@ -1487,7 +1492,7 @@ LINK_HOOK_CHAIN(BOOL, HandleMenu_ChooseTeam, (CBasePlayer *player, int slot), pl
// returns true if the selection has been handled and the player's menu
// can be closed...false if the menu should be displayed again
BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
{
int oldTeam;
char *szOldTeam;
@ -1527,7 +1532,7 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
break;
case MENU_SLOT_TEAM_VIP:
{
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == CT)
if (CSGameRules()->m_bMapHasVIPSafetyZone && player->m_iTeam == CT)
{
CSGameRules()->AddToVIPQueue(player);
CLIENT_COMMAND(ENT(player->pev), "slot10\n");
@ -1637,7 +1642,7 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
player->m_pIntroCamera = NULL;
player->m_bTeamChanged = true;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
}
@ -1820,7 +1825,7 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
oldTeam = player->m_iTeam;
player->m_iTeam = team;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
}
@ -1871,7 +1876,7 @@ void Radio1(CBasePlayer *player, int slot)
break;
}
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_1 + slot), player);
}
@ -1910,7 +1915,7 @@ void Radio2(CBasePlayer *player, int slot)
break;
}
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_2 + slot), player);
}
@ -1962,13 +1967,15 @@ void Radio3(CBasePlayer *player, int slot)
break;
}
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent((GameEventType)(EVENT_START_RADIO_3 + slot), player);
}
}
bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney)
LINK_HOOK_CHAIN(bool, BuyGunAmmo, (CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney), player, weapon, bBlinkMoney);
bool EXT_FUNC __API_HOOK(BuyGunAmmo)(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney)
{
if (!player->CanPlayerBuy(true))
return false;
@ -2031,7 +2038,7 @@ bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney)
pItem = player->m_rgpPlayerItems[ PISTOL_SLOT ];
}
if (pItem != NULL)
if (pItem)
{
while (BuyGunAmmo(player, pItem, bBlinkMoney))
{
@ -2051,7 +2058,7 @@ CBaseEntity *EntityFromUserID(int userID)
{
CBaseEntity *pTempEntity = NULL;
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")) != NULL)
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")))
{
if (FNullEnt(pTempEntity->edict()))
break;
@ -2072,7 +2079,7 @@ NOXREF int CountPlayersInServer()
int count = 0;
CBaseEntity *pTempEntity = NULL;
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")) != NULL)
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")))
{
if (FNullEnt(pTempEntity->edict()))
break;
@ -2104,12 +2111,12 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
if (weaponID != WEAPON_NONE)
{
// assasination maps have a specific set of weapons that can be used in them.
if (CanBuyWeaponByMaptype(pPlayer->m_iTeam, weaponID, (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES)))
if (CanBuyWeaponByMaptype(pPlayer->m_iTeam, weaponID, CSGameRules()->m_bMapHasVIPSafetyZone == TRUE))
{
bRetVal = TRUE;
BuyWeaponByWeaponID(pPlayer, weaponID);
}
else if (weaponFailName != NULL)
else if (weaponFailName)
{
bRetVal = TRUE;
if (g_bClientPrintEnable)
@ -2141,7 +2148,7 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
while (BuyAmmo(pPlayer, PRIMARY_WEAPON_SLOT, false))
;
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -2160,7 +2167,7 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
while (BuyAmmo(pPlayer, PISTOL_SLOT, false))
;
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -2225,7 +2232,7 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
}
}
if (g_bClientPrintEnable && pszFailItem != NULL)
if (g_bClientPrintEnable && pszFailItem)
{
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Alias_Not_Avail", pszFailItem);
}
@ -2280,6 +2287,10 @@ BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
return FALSE;
}
bool InternalCommand(edict_t *pEntity, const char *cmd) {
return true;
}
// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command.
void EXT_FUNC ClientCommand(edict_t *pEntity)
{
@ -2290,16 +2301,139 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
if (!pEntity->pvPrivateData)
return;
#ifdef REGAMEDLL_API
if (!g_ReGameHookchains.m_InternalCommand.callChain(InternalCommand, pEntity, pcmd))
return;
#endif
entvars_t *pev = &pEntity->v;
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pev);
if (FStrEq(pcmd, "vip"))
{
/*for (int i = 0; i < MAX_VIP_QUEUES; ++i)
{
if (CSGameRules()->m_pVIPQueue[i])
{
printf(" -> (%d) (%p)", i, CSGameRules()->m_pVIPQueue[i]);
printf(" -> (%s)", STRING(CSGameRules()->m_pVIPQueue[i]->pev->netname));
printf(" -> index: (%d)\n", ENTINDEX(CSGameRules()->m_pVIPQueue[i]->edict()));
}
}*/
auto pEdict = FIND_ENTITY_BY_CLASSNAME(nullptr, "trigger_zone");
if (pEdict)
{
printf(" -> pEdict: (%p) -> pEdict->v.solid: (%d)\n", pEdict, pEdict->v.solid);
} else {
printf(" -> pEdict: (%p)\n", pEdict);
}
} else
if (FStrEq(pcmd, "say"))
{
auto pcmd2 = CMD_ARGV_(1);
if (FStrEq(pcmd2, "q")) // nety
{
//char szMessage[190];
//Q_snprintf(szMessage, sizeof(szMessage), "\x1[\x4Tag\x1] Hey \x3%s\x1, welcome to join us on the server\x4.", STRING(pev->netname));
//MESSAGE_BEGIN(MSG_ONE, gmsgSayText, NULL, pev);
// WRITE_BYTE(player->entindex());
/// WRITE_STRING(UTIL_VarArgs("\1[\4Aim Detector\1] Hey \3%s\1, welcome to join us on the server\4.", STRING(pev->netname)));
//MESSAGE_END();
} else
if (FStrEq(pcmd2, "h")) // nety
{
//printf(" -> m_iHideHUD: (%d)", pPlayer->m_iHideHUD);
UTIL_SayText(UTIL_VarArgs(" -> m_iHideHUD: (%d)", player->m_iHideHUD), player);
} else
if (FStrEq(pcmd2, "h_weapon")) // nety
{
player->m_iHideHUD |= HIDEHUD_WEAPONS;
} else
if (FStrEq(pcmd2, "h_timer")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_TIMER;
} else
if (FStrEq(pcmd2, "h_money")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_MONEY;
} else
if (FStrEq(pcmd2, "h_all")) // nety
{
player->m_iHideHUD |= HIDEHUD_ALL;
} else
if (FStrEq(pcmd2, "h_flash")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_FLASHLIGHT;
} else
if (FStrEq(pcmd2, "h_hp")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_HEALTH;
} else
if (FStrEq(pcmd2, "h_cross"))
{
player->m_iHideHUD |= HIDEHUD_CROSSHAIR;
} else
if (FStrEq(pcmd2, "h_7"))
{
player->m_iHideHUD |= (1<<7);
} else
if (FStrEq(pcmd2, "h_8"))
{
player->m_iHideHUD |= (1<<8);
} else
if (FStrEq(pcmd2, "h_9"))
{
player->m_iHideHUD |= (1<<9);
} else
if (FStrEq(pcmd2, "h_10"))
{
player->m_iHideHUD |= (1<<10);
} else
if (FStrEq(pcmd2, "h_clear"))
{
player->m_iHideHUD = 0;
} else
{
if (gpGlobals->time >= player->m_flLastCommandTime[CMD_SAY])
{
player->m_flLastCommandTime[CMD_SAY] = gpGlobals->time + 0.3f;
Host_Say(pEntity, FALSE);
}
}
}
else if (FStrEq(pcmd, "say_team"))
{
@ -2364,7 +2498,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
}
CBaseEntity *pKickEntity = EntityFromUserID(iVoteID);
if (pKickEntity != NULL)
if (pKickEntity)
{
CBasePlayer *pKickPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pKickEntity->pev);
@ -2481,19 +2615,18 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
ClientPrint(player->pev, HUD_PRINTTALK, "#Game_no_timelimit");
return;
}
#ifndef REGAMEDLL_FIXES
int iTimeRemaining = (int)CSGameRules()->GetTimeLeft();
if (iTimeRemaining < 0)
iTimeRemaining = 0;
int timeRemaining = (int)CSGameRules()->GetTimeLeft();
if (timeRemaining < 0)
timeRemaining = 0;
int iMinutes = int(iTimeRemaining % 60);
int iSeconds = int(iTimeRemaining / 60);
int iMinutes = timeRemaining / 60;
int iSeconds = timeRemaining % 60;
char secs[5];
char *temp = UTIL_dtos2(iMinutes);
char *temp = UTIL_dtos2(iSeconds);
if (iMinutes >= 10)
if (iSeconds >= 10)
{
secs[0] = temp[0];
secs[1] = temp[1];
@ -2506,11 +2639,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
secs[2] = '\0';
}
ClientPrint(player->pev, HUD_PRINTTALK, "#Game_timelimit", UTIL_dtos1(iSeconds), secs);
#else
int timeRemaining = (int)(timelimit.value ? CSGameRules()->GetTimeLeft() : 0);
ClientPrint(player->pev, HUD_PRINTTALK, "#Game_timelimit", UTIL_dtos1(timeRemaining / 60), UTIL_dtos2(timeRemaining % 60));
#endif
ClientPrint(player->pev, HUD_PRINTTALK, "#Game_timelimit", UTIL_dtos1(iMinutes), secs);
}
}
else if (FStrEq(pcmd, "listplayers"))
@ -2530,7 +2659,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
if (player->m_signals.GetState() & SIGNAL_BUY)
{
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_TUTOR_BUY_MENU_OPENNED);
}
@ -2624,7 +2753,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
case VGUI_MenuSlot_Buy_ShotGun:
{
player->m_iMenu = Menu_BuyShotgun;
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == TERRORIST)
if (CSGameRules()->m_bMapHasVIPSafetyZone && player->m_iTeam == TERRORIST)
ShowVGUIMenu(player, VGUI_Menu_Buy_ShotGun, MENU_KEY_0, "#AS_BuyShotgun");
else
ShowVGUIMenu(player, VGUI_Menu_Buy_ShotGun, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_0), "#BuyShotgun");
@ -2633,7 +2762,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
case VGUI_MenuSlot_Buy_SubMachineGun:
{
player->m_iMenu = Menu_BuySubMachineGun;
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES)
if (CSGameRules()->m_bMapHasVIPSafetyZone)
{
if (player->m_iTeam == CT)
ShowVGUIMenu(player, VGUI_Menu_Buy_SubMachineGun, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_0), "#AS_CT_BuySubMachineGun");
@ -2652,7 +2781,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
case VGUI_MenuSlot_Buy_Rifle:
{
player->m_iMenu = Menu_BuyRifle;
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES)
if (CSGameRules()->m_bMapHasVIPSafetyZone)
{
if (player->m_iTeam == CT)
ShowVGUIMenu(player, VGUI_Menu_Buy_Rifle, (MENU_KEY_1 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_0), "#AS_CT_BuyRifle");
@ -2671,7 +2800,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
case VGUI_MenuSlot_Buy_MachineGun:
{
player->m_iMenu = Menu_BuyMachineGun;
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == TERRORIST)
if (CSGameRules()->m_bMapHasVIPSafetyZone && player->m_iTeam == TERRORIST)
ShowVGUIMenu(player, VGUI_Menu_Buy_MachineGun, MENU_KEY_0, "#AS_T_BuyMachineGun");
else
ShowVGUIMenu(player, VGUI_Menu_Buy_MachineGun, (MENU_KEY_1 | MENU_KEY_0), "#BuyMachineGun");
@ -2686,7 +2815,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
while (BuyAmmo(player, PRIMARY_WEAPON_SLOT, false))
;
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -2705,7 +2834,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
while (BuyAmmo(player, PISTOL_SLOT, false))
;
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -2820,7 +2949,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
if (!CSGameRules()->IsCareer())
{
player->m_iMenu = Menu_ChooseTeam;
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iJoiningState == JOINED && player->m_iTeam == CT)
if (CSGameRules()->m_bMapHasVIPSafetyZone && player->m_iJoiningState == JOINED && player->m_iTeam == CT)
{
if (CSGameRules()->IsFreezePeriod() || player->pev->deadflag != DEAD_NO)
ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_0), "#IG_VIP_Team_Select_Spect");
@ -2931,7 +3060,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
if (g_pGameRules->ClientCommand_DeadOrAlive(GetClassPtr<CCSPlayer>((CBasePlayer *)pev), pcmd))
return;
if (TheBots != NULL)
if (TheBots)
{
if (TheBots->ClientCommand(GetClassPtr<CCSPlayer>((CBasePlayer *)pev), pcmd))
return;
@ -3004,7 +3133,6 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CBasePlayer *pObserver = UTIL_PlayerByIndex(i);
if (pObserver && pObserver->IsObservingPlayer(player))
{
EMIT_SOUND(ENT(pObserver->pev), CHAN_ITEM, "items/nvg_off.wav", RANDOM_FLOAT(0.92, 1), ATTN_NORM);
@ -3030,7 +3158,6 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CBasePlayer *pObserver = UTIL_PlayerByIndex(i);
if (pObserver && pObserver->IsObservingPlayer(player))
{
EMIT_SOUND(ENT(pObserver->pev), CHAN_ITEM, "items/nvg_on.wav", RANDOM_FLOAT(0.92, 1), ATTN_NORM);
@ -3066,7 +3193,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
// player is dropping an item.
if (player->HasShield())
{
if (player->m_pActiveItem != NULL && player->m_pActiveItem->m_iId == WEAPON_C4)
if (player->m_pActiveItem && player->m_pActiveItem->m_iId == WEAPON_C4)
{
player->DropPlayerItem("weapon_c4");
}
@ -3089,7 +3216,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
{
GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->SelectItem(CMD_ARGV_(1));
}
else if (((pstr = Q_strstr(pcmd, "weapon_")) != NULL) && (pstr == pcmd))
else if (((pstr = Q_strstr(pcmd, "weapon_"))) && (pstr == pcmd))
{
GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->SelectItem(pcmd);
}
@ -3104,7 +3231,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
BuyAmmo(player, PRIMARY_WEAPON_SLOT, true);
player->BuildRebuyStruct();
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -3117,7 +3244,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
BuyAmmo(player, PISTOL_SLOT, true);
player->BuildRebuyStruct();
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, player);
}
@ -3152,7 +3279,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
ShowVGUIMenu(player, VGUI_Menu_Buy, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_0), "#Buy");
player->m_iMenu = Menu_Buy;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_TUTOR_BUY_MENU_OPENNED);
}
@ -3251,7 +3378,7 @@ void EXT_FUNC ClientUserInfoChanged(edict_t *pEntity, char *infobuffer)
Q_snprintf(szName, sizeof(szName), "%s", szBufferName);
// First parse the name and remove any %'s
for (char *pPct = szName; pPct != NULL && *pPct != '\0'; pPct++)
for (char *pPct = szName; pPct && *pPct != '\0'; pPct++)
{
// Replace it with a space
if (*pPct == '%' || *pPct == '&')
@ -3261,8 +3388,12 @@ void EXT_FUNC ClientUserInfoChanged(edict_t *pEntity, char *infobuffer)
if (szName[0] == '#')
szName[0] = '*';
// Set the name
pPlayer->SetClientUserInfoName(infobuffer, szName);
// Can set it a new name?
if (!pPlayer->SetClientUserInfoName(infobuffer, szName))
{
// so to back old name into buffer
SET_CLIENT_KEY_VALUE(pPlayer->entindex(), infobuffer, "name", (char *)STRING(pPlayer->pev->netname));
}
}
// was already checking on pvPrivateData
@ -3321,7 +3452,7 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
pClass = CBaseEntity::Instance(pEdict);
// Activate this entity if it's got a class & isn't dormant
if (pClass != NULL && !(pClass->pev->flags & FL_DORMANT))
if (pClass && !(pClass->pev->flags & FL_DORMANT))
{
AddEntityHashValue(&pEdict->v, STRING(pEdict->v.classname), CLASSNAME);
pClass->Activate();
@ -3334,17 +3465,17 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
LinkUserMessages();
WriteSigonMessages();
if (g_pGameRules != NULL)
if (g_pGameRules)
{
g_pGameRules->CheckMapConditions();
}
if (TheBots != NULL)
if (TheBots)
{
TheBots->ServerActivate();
}
if (g_pHostages != NULL)
if (g_pHostages)
{
g_pHostages->ServerActivate();
}
@ -3395,13 +3526,13 @@ void EXT_FUNC ParmsChangeLevel()
void EXT_FUNC StartFrame()
{
if (g_pGameRules) {
if (g_pGameRules)
{
g_pGameRules->Think();
if (g_pGameRules->IsGameOver())
return;
}
if (g_fGameOver)
return;
CLocalNav::Think();
static cvar_t *skill = NULL;
@ -3412,7 +3543,7 @@ void EXT_FUNC StartFrame()
gpGlobals->teamplay = 1.0f;
if (skill != NULL)
if (skill)
g_iSkillLevel = int(skill->value);
else
@ -3627,7 +3758,6 @@ void ClientPrecache()
for (i = FirstCustomSkin; i <= LastCustomSkin; ++i)
{
const char *fname = TheBotProfiles->GetCustomSkinFname(i);
if (!fname)
break;
@ -4502,16 +4632,16 @@ void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struc
int iUser3 = 0;
if (pPlayer->m_bCanShoot && !pPlayer->m_bIsDefusing)
iUser3 |= DATA_IUSER3_CANSHOOT;
iUser3 |= PLAYER_CAN_SHOOT;
if (g_pGameRules->IsFreezePeriod())
iUser3 |= DATA_IUSER3_FREEZETIMEOVER;
iUser3 |= PLAYER_FREEZE_TIME_OVER;
if (pPlayer->m_signals.GetState() & SIGNAL_BOMB)
iUser3 |= DATA_IUSER3_INBOMBZONE;
iUser3 |= PLAYER_IN_BOMB_ZONE;
if (pPlayer->HasShield())
iUser3 |= DATA_IUSER3_HOLDINGSHIELD;
iUser3 |= PLAYER_HOLDING_SHIELD;
if (pPlayer->pev->iuser1 == OBS_NONE && !pevOrg)
{

View File

@ -134,7 +134,8 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon);
void BuyPistol(CBasePlayer *pPlayer, int iSlot);
void BuyShotgun(CBasePlayer *pPlayer, int iSlot);
void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot);
void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID);
CBaseEntity *BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID);
CBaseEntity *BuyWeaponByWeaponID_(CBasePlayer *pPlayer, WeaponIdType weaponID);
void BuyRifle(CBasePlayer *pPlayer, int iSlot);
void BuyMachineGun(CBasePlayer *pPlayer, int iSlot);
void BuyItem(CBasePlayer *pPlayer, int iSlot);
@ -146,6 +147,7 @@ void Radio1(CBasePlayer *player, int slot);
void Radio2(CBasePlayer *player, int slot);
void Radio3(CBasePlayer *player, int slot);
bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyGunAmmo_(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney);
CBaseEntity *EntityFromUserID(int userID);
int CountPlayersInServer();

View File

@ -97,7 +97,7 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim)
edict_t *pentPlayer = FIND_CLIENT_IN_PVS(pGib->edict());
if (RANDOM_LONG(0, 100) <= 5 && pentPlayer != NULL)
if (RANDOM_LONG(0, 100) <= 5 && pentPlayer)
{
// 5% chance head will be thrown at player's face.
entvars_t *pevPlayer = VARS(pentPlayer);
@ -905,7 +905,6 @@ void EXT_FUNC PlayerBlind(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CBasePlayer *pObserver = UTIL_PlayerByIndex(i);
if (!pObserver || !pObserver->IsObservingPlayer(pPlayer))
continue;
@ -917,7 +916,7 @@ void EXT_FUNC PlayerBlind(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars
pPlayer->Blind(fadeTime * 0.33, fadeHold, fadeTime, alpha);
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_PLAYER_BLINDED_BY_FLASHBANG, pPlayer);
}
@ -940,7 +939,7 @@ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker,
vecSrc.z += 1;
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, 1500.0)) != NULL)
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, 1500.0)))
{
TraceResult tr2;
Vector vecLOS;
@ -1121,7 +1120,7 @@ void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker
pevAttacker = pevInflictor;
// iterate on all entities in the vicinity.
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)) != NULL)
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)))
{
if (pEntity->pev->takedamage != DAMAGE_NO)
{
@ -1215,7 +1214,7 @@ void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
pevAttacker = pevInflictor;
// iterate on all entities in the vicinity.
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)) != NULL)
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)))
{
if (pEntity->pev->takedamage != DAMAGE_NO)
{
@ -1740,7 +1739,7 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec
ClearMultiDamage();
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, ENT(pev), &tr);
if (TheBots != NULL && tr.flFraction != 1.0f)
if (TheBots && tr.flFraction != 1.0f)
{
TheBots->OnEvent(EVENT_BULLET_IMPACT, this, (CBaseEntity *)&tr.vecEndPos);
}

View File

@ -27,19 +27,30 @@
*/
#pragma once
#undef DLLEXPORT
#ifdef _WIN32
// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#define DLLEXPORT __declspec(dllexport)
// WINAPI should be provided in the windows compiler headers.
// It's usually defined to something like "__stdcall".
#define NOINLINE __declspec(noinline)
#else
#undef DLLEXPORT
#define DLLEXPORT __attribute__((visibility("default")))
#define WINAPI /* */
#define NOINLINE __attribute__((noinline))
#endif // _WIN32
// Manual branch optimization for GCC 3.0.0 and newer
#if !defined(__GNUC__) || __GNUC__ < 3
#define likely(x) (x)
#define unlikely(x) (x)
#else
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
// Simplified macro for declaring/defining exported DLL functions. They
// need to be 'extern "C"' so that the C++ compiler enforces parameter
// type-matching, rather than considering routines with mis-matched

View File

@ -113,6 +113,10 @@ cvar_t fraglimit = { "mp_fraglimit", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers
// TODO: Maybe it's better to register in the engine?
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "1", FCVAR_SERVER, 0.0f, nullptr };
void GameDLL_Version_f()
{
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
@ -147,12 +151,20 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&friendlyfire);
CVAR_REGISTER(&flashlight);
CVAR_REGISTER(&decalfrequency);
#ifndef REGAMEDLL_FIXES
CVAR_REGISTER(&allowmonsters);
#endif
CVAR_REGISTER(&roundtime);
CVAR_REGISTER(&buytime);
CVAR_REGISTER(&freezetime);
CVAR_REGISTER(&c4timer);
#ifndef REGAMEDLL_FIXES
CVAR_REGISTER(&ghostfrequency);
#endif
CVAR_REGISTER(&autokick);
CVAR_REGISTER(&autokick_timeout);
CVAR_REGISTER(&restartround);
@ -247,6 +259,9 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&fraglimit);
CVAR_REGISTER(&showtriggers);
CVAR_REGISTER(&hostagehurtable);
CVAR_REGISTER(&roundover);
CVAR_REGISTER(&forcerespawn);
// print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");

View File

@ -146,6 +146,9 @@ extern cvar_t max_teamkills;
extern cvar_t fraglimit;
extern cvar_t showtriggers;
extern cvar_t hostagehurtable;
extern cvar_t roundover;
extern cvar_t forcerespawn;
#endif

View File

@ -12,6 +12,10 @@ CGameRules *g_pGameRules = NULL;
CGameRules::CGameRules()
: m_GameDesc()
{
m_bFreezePeriod = FALSE;
m_bBombDropped = FALSE;
m_bGameOver = false;
m_GameDesc = new char[sizeof("Counter-Strike")];
Q_strcpy(m_GameDesc, AreRunningCZero() ? "Condition Zero" : "Counter-Strike");
}
@ -34,12 +38,9 @@ const char *CGameRules::GetGameDescription()
BOOL CGameRules::__MAKE_VHOOK(CanHaveAmmo)(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry)
{
int iAmmoIndex;
if (pszAmmoName != NULL)
if (pszAmmoName)
{
iAmmoIndex = pPlayer->GetAmmoIndex(pszAmmoName);
auto iAmmoIndex = pPlayer->GetAmmoIndex(pszAmmoName);
if (iAmmoIndex > -1)
{
if (pPlayer->AmmoInventory(iAmmoIndex) < iMaxCarry)
@ -138,7 +139,7 @@ void CGameRules::__MAKE_VHOOK(RefreshSkillData)()
LINK_HOOK_CHAIN2(CGameRules *, InstallGameRules);
CGameRules *__API_HOOK(InstallGameRules)()
CGameRules *EXT_FUNC __API_HOOK(InstallGameRules)()
{
SERVER_COMMAND("exec game.cfg\n");
SERVER_EXECUTE();

View File

@ -40,13 +40,6 @@
#define MAX_BOMB_RADIUS 2048
#define MAP_VIP_SAFETYZONE_UNINITIALIZED 0 // uninitialized
#define MAP_HAVE_VIP_SAFETYZONE_YES 1 // has VIP safety zone
#define MAP_HAVE_VIP_SAFETYZONE_NO 2 // does not have VIP safetyzone
#define MAP_HAS_CAMERAS_INIT 2 // initial
#define MAP_HAS_CAMERAS_YES 1 // on map have of camera's
#define ITEM_RESPAWN_TIME 30
#define WEAPON_RESPAWN_TIME 20
#define AMMO_RESPAWN_TIME 20
@ -100,6 +93,8 @@ enum ScenarioEventEndRound
ROUND_TERRORISTS_NOT_ESCAPED,
ROUND_VIP_NOT_ESCAPED,
ROUND_GAME_COMMENCE,
ROUND_GAME_RESTART,
ROUND_GAME_OVER
};
enum RewardRules
@ -207,13 +202,13 @@ enum
// custom enum
enum
{
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0),
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1),
SCENARIO_BLOCK_VIP_ESCAPRE = (1 << 2),
SCENARIO_BLOCK_PRISON_ESCAPRE = (1 << 3),
SCENARIO_BLOCK_BOMB = (1 << 4),
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5),
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6),
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0), // flag "a"
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1), // flag "b"
SCENARIO_BLOCK_VIP_ESCAPE = (1 << 2), // flag "c"
SCENARIO_BLOCK_PRISON_ESCAPE = (1 << 3), // flag "d"
SCENARIO_BLOCK_BOMB = (1 << 4), // flag "e"
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5), // flag "f"
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6), // flag "g"
};
// Player relationship return codes
@ -346,12 +341,17 @@ public:
#endif
// inline function's
inline bool IsGameOver() const { return m_bGameOver; }
inline void SetGameOver() { m_bGameOver = true; }
public:
BOOL m_bFreezePeriod; // TRUE at beginning of round, set to FALSE when the period expires
BOOL m_bBombDropped;
// custom
char *m_GameDesc;
bool m_bGameOver; // intermission or finale (deprecated name g_fGameOver)
};
// CHalfLifeRules - rules for the single player Half-Life game.
@ -676,7 +676,11 @@ public:
bool TeamExterminationCheck(int NumAliveTerrorist, int NumAliveCT, int NumDeadTerrorist, int NumDeadCT);
// for internal functions API
void OnRoundFreezeEnd();
bool RoundOver_internal(int winStatus, ScenarioEventEndRound event, float tmDelay);
bool NeededPlayersCheck_internal(int winStatus, ScenarioEventEndRound event, float tmDelay);
bool RestartRoundCheck_internal(int winStatus, ScenarioEventEndRound event, float tmDelay);
bool VIP_Escaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay);
bool VIP_Died_internal(int winStatus, ScenarioEventEndRound event, float tmDelay);
@ -763,9 +767,10 @@ public:
bool IsFreeForAll() const;
bool HasRoundInfinite(int flags = 0) const;
private:
VFUNC bool HasRoundTimeExpired();
VFUNC bool IsBombPlanted();
private:
void MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int iTeam);
public:
@ -804,8 +809,8 @@ public:
bool m_bMapHasRescueZone;
bool m_bMapHasEscapeZone;
int m_iMapHasVIPSafetyZone; // 0 = uninitialized; 1 = has VIP safety zone; 2 = DOES not have VIP safetyzone
int m_bMapHasCameras;
BOOL m_bMapHasVIPSafetyZone; // TRUE = has VIP safety zone, FALSE = does not have VIP safetyzone
BOOL m_bMapHasCameras;
int m_iC4Timer;
int m_iC4Guy; // The current Terrorist who has the C4.
int m_iLoserBonus; // the amount of money the losing team gets. This scales up as they lose more rounds in a row
@ -848,7 +853,7 @@ protected:
float m_flIntermissionStartTime;
BOOL m_iEndIntermissionButtonHit;
float m_tmNextPeriodicThink;
bool m_bFirstConnected;
bool m_bGameStarted; // TRUE = the game commencing when there is at least one CT and T, FALSE = scoring will not start until both teams have players (deprecated name m_bFirstConnected)
bool m_bInCareerGame;
float m_fCareerRoundMenuTime;
int m_iCareerMatchWins;

View File

@ -57,7 +57,7 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
#endif
entvars_t *pevOwner = VARS(pev->owner);
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_FLASHBANG_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner), (CBaseEntity *)&pev->origin);
}
@ -109,7 +109,7 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
if (CSGameRules()->IsCareer())
{
if (TheCareerTasks != NULL)
if (TheCareerTasks)
{
TheCareerTasks->LatchRoundEndMessage();
}
@ -179,7 +179,7 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
if (CSGameRules()->IsCareer())
{
if (TheCareerTasks != NULL)
if (TheCareerTasks)
{
TheCareerTasks->UnlatchRoundEndMessage();
}
@ -266,7 +266,7 @@ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType)
#endif
entvars_t *pevOwner = VARS(pev->owner);
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_HE_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner));
}
@ -503,7 +503,7 @@ void CGrenade::SG_Smoke()
{
pev->effects |= EF_NODRAW;
if (TheBots != NULL)
if (TheBots)
{
TheBots->RemoveGrenade(this);
}
@ -553,7 +553,7 @@ void CGrenade::SG_Detonate()
UTIL_TraceLine(vecSpot, vecSpot + Vector(0, 0, -40), ignore_monsters, ENT(pev), &tr);
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_SMOKE_GRENADE_EXPLODED, CBaseEntity::Instance(pev->owner));
TheBots->AddGrenade(WEAPON_SMOKEGRENADE, this);
@ -561,14 +561,13 @@ void CGrenade::SG_Detonate()
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/sg_explode.wav", VOL_NORM, ATTN_NORM);
while ((pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade")) != NULL)
while ((pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade")))
{
if (FNullEnt(pentFind))
break;
CBaseEntity *pEnt = CBaseEntity::Instance(pentFind);
if (pEnt != NULL)
if (pEnt)
{
float fDistance = (pEnt->pev->origin - pev->origin).Length();
@ -962,14 +961,14 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
// freeze the player in place while defusing
SET_CLIENT_MAXSPEED(player->edict(), 1);
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator);
}
if (CSGameRules()->IsCareer())
{
if (TheCareerTasks != NULL)
if (TheCareerTasks)
{
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSING);
}
@ -1179,7 +1178,7 @@ void CGrenade::C4Think()
// let the bots hear the bomb beeping
// BOTPORT: Emit beep events at same time as client effects
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BOMB_BEEP, this);
}
@ -1204,7 +1203,7 @@ void CGrenade::C4Think()
// If the timer has expired ! blow this bomb up!
if (gpGlobals->time >= m_flC4Blow)
{
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BOMB_EXPLODED);
}
@ -1231,7 +1230,7 @@ void CGrenade::C4Think()
MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup);
MESSAGE_END();
g_pGameRules->m_bBombDropped = false;
g_pGameRules->m_bBombDropped = FALSE;
if (pev->waterlevel != 0)
UTIL_Remove(this);
@ -1240,7 +1239,7 @@ void CGrenade::C4Think()
}
// if the defusing process has started
if (m_bStartDefuse && m_pBombDefuser != NULL)
if (m_bStartDefuse && m_pBombDefuser)
{
CBasePlayer *pPlayer = (CBasePlayer *)m_pBombDefuser;
@ -1268,7 +1267,7 @@ void CGrenade::C4Think()
m_flDefuseCountDown = 0;
// tell the bots someone has aborted defusing
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED);
}
@ -1279,7 +1278,7 @@ void CGrenade::C4Think()
{
Broadcast("BOMBDEF");
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSED, (CBaseEntity *)m_pBombDefuser);
}
@ -1313,7 +1312,7 @@ void CGrenade::C4Think()
if (CSGameRules()->IsCareer() && !pPlayer->IsBot())
{
if (TheCareerTasks != NULL)
if (TheCareerTasks)
{
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSED, pPlayer);
}
@ -1343,7 +1342,7 @@ void CGrenade::C4Think()
m_pBombDefuser = NULL;
// tell the bots someone has aborted defusing
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BOMB_DEFUSE_ABORTED);
}
@ -1364,14 +1363,13 @@ NOXREF void CGrenade::UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code)
edict_t *pentFind = NULL;
CBaseEntity *pOwner = CBaseEntity::Instance(pevOwner);
while ((pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade")) != NULL)
while ((pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade")))
{
if (FNullEnt(pentFind))
break;
CBaseEntity *pEnt = Instance(pentFind);
if (pEnt != NULL)
if (pEnt)
{
if ((pEnt->pev->spawnflags & SF_DETONATE) && pEnt->pev->owner == pOwner->edict())
{

View File

@ -16,7 +16,6 @@ NOXREF u_long g_ulModelIndexEyes;
Vector g_vecAttackDir;
int g_iSkillLevel;
int gDisplayTitle;
BOOL g_fGameOver;
bool g_bIsCzeroGame = false;
bool g_bAllowedCSBot = false;
bool g_bHostageImprov = false;

View File

@ -41,7 +41,6 @@ extern u_long g_ulModelIndexEyes;
extern Vector g_vecAttackDir;
extern int g_iSkillLevel;
extern int gDisplayTitle;
extern BOOL g_fGameOver;
extern bool g_bIsCzeroGame;
extern bool g_bAllowedCSBot;
extern bool g_bHostageImprov;

View File

@ -411,7 +411,7 @@ void CHostage::IdleThink()
{
pSpot = NULL;
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")) != NULL)
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")))
{
if ((pSpot->pev->origin - pev->origin).Length() < RESCUE_HOSTAGES_RADIUS)
{
@ -424,19 +424,19 @@ void CHostage::IdleThink()
if (m_bRescueMe)
{
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_HOSTAGE_RESCUED, player, this);
}
if (TheCareerTasks != NULL && CSGameRules()->IsCareer() && player != NULL && !player->IsBot())
if (TheCareerTasks && CSGameRules()->IsCareer() && player && !player->IsBot())
{
TheCareerTasks->HandleEvent(EVENT_HOSTAGE_RESCUED, player);
}
pev->deadflag = DEAD_RESPAWNABLE;
if (player != NULL)
if (player)
{
player->AddAccount(REWARD_TAKEN_HOSTAGE, RT_HOSTAGE_RESCUED);
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname),
@ -564,6 +564,16 @@ void CHostage::RePosition()
m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
}
void CHostage::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
#ifdef REGAMEDLL_ADD
if (hostagehurtable.value)
#endif
{
CBaseMonster::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType);
}
}
BOOL CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
float flActualDamage;
@ -634,7 +644,7 @@ BOOL CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevA
pev->flags &= ~FL_ONGROUND;
SetDeathActivity();
if (pAttacker != NULL)
if (pAttacker)
{
pAttacker->AddAccount(20 * (-25 - int(flActualDamage)), RT_HOSTAGE_KILLED);
AnnounceDeath(pAttacker);
@ -820,8 +830,13 @@ void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller,
if (!pActivator->IsPlayer())
return;
#ifdef REGAMEDLL_FIXES
if (!IsAlive())
return;
#else
if (pev->takedamage == DAMAGE_NO)
return;
#endif
CBasePlayer *pPlayer = (CBasePlayer *)pActivator;
@ -1027,7 +1042,7 @@ void CHostage::DoFollow()
MoveToward(vecNodes[nTargetNode]);
m_bStuck = FALSE;
}
else if (pev->takedamage == DAMAGE_YES)
else if (IsAlive())
{
if (IsFollowingSomeone())
{
@ -1370,7 +1385,7 @@ void CHostageManager::ServerActivate()
m_hostageCount = 0;
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "hostage_entity")) != NULL)
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "hostage_entity")))
{
AddHostage((CHostage *)pEntity);
}

View File

@ -32,9 +32,6 @@
#pragma once
#endif
// Improved the hostages from CZero
#include "hostage/hostage_improv.h"
#define MAX_NODES 100
#define MAX_HOSTAGES 12
#define MAX_HOSTAGES_NAV 20
@ -80,6 +77,9 @@ enum HostageChatterType
NUM_HOSTAGE_CHATTER_TYPES,
};
// Improved the hostages from CZero
#include "hostage/hostage_improv.h"
extern CHostageManager *g_pHostages;
extern int g_iHostageNumber;
@ -94,8 +94,14 @@ public:
virtual void Precache();
virtual int ObjectCaps(); // make hostage "useable"
virtual int Classify() { return CLASS_HUMAN_PASSIVE; }
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int BloodColor() { return BLOOD_COLOR_RED; }
#ifndef REGAMEDLL_FIXES
virtual BOOL IsAlive() { return (pev->takedamage == DAMAGE_YES); }
#endif
virtual void Touch(CBaseEntity *pOther);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -160,10 +166,11 @@ public:
return true;
}
bool IsValid() { return (pev->takedamage == DAMAGE_YES); }
bool IsDead() { return (pev->deadflag == DEAD_DEAD); }
bool IsAtHome() { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
const Vector *GetHomePosition() { return &m_vStart; }
bool IsValid() const { return (pev->takedamage == DAMAGE_YES); }
bool IsDead() const { return (pev->deadflag == DEAD_DEAD); }
bool IsAtHome() const { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
const Vector *GetHomePosition() const { return &m_vStart; }
public:
int m_Activity;

View File

@ -42,7 +42,7 @@ bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector *
if (GetSimpleGroundHeight(pos, height, normal))
{
// our current nav area also serves as a ground polygon
if (m_lastKnownArea != NULL && m_lastKnownArea->IsOverlapping(pos))
if (m_lastKnownArea && m_lastKnownArea->IsOverlapping(pos))
*height = Q_max((*height), m_lastKnownArea->GetZ(pos));
return true;
@ -314,11 +314,11 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(const Vector &goalPos) const
CheckWayFunctor check(this, goalPos);
if (g_pHostages != NULL)
if (g_pHostages)
{
g_pHostages->ForEachHostage(check);
if (check.m_blocker != NULL)
if (check.m_blocker)
{
return m_isFriendInTheWay = true;
}
@ -329,7 +329,7 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(const Vector &goalPos) const
{
CBasePlayer *player = UTIL_PlayerByIndex(i);
if (player == NULL)
if (!player)
continue;
if (FNullEnt(player->pev))
@ -646,7 +646,7 @@ void CHostageImprov::UpdateVision()
{
CBasePlayer *player = UTIL_PlayerByIndex(i);
if (player == NULL)
if (!player)
continue;
if (FNullEnt(player->pev))
@ -780,12 +780,12 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
}
else
{
if (departPos != NULL)
if (departPos)
{
float closeRange = 1e6;
float range;
if (ladder->m_topForwardArea != NULL)
if (ladder->m_topForwardArea)
{
range = (*departPos - *ladder->m_topForwardArea->GetCenter()).LengthSquared();
@ -800,7 +800,7 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
}
}
}
if (ladder->m_topLeftArea != NULL)
if (ladder->m_topLeftArea)
{
range = (*departPos - *ladder->m_topLeftArea->GetCenter()).LengthSquared();
@ -814,7 +814,7 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT
}
}
}
if (ladder->m_topRightArea != NULL)
if (ladder->m_topRightArea)
{
range = (*departPos - *ladder->m_topRightArea->GetCenter()).LengthSquared();
@ -845,7 +845,7 @@ void CHostageImprov::UpdatePosition(float deltaT)
{
CNavArea *area = TheNavAreaGrid.GetNavArea(&m_hostage->pev->origin);
if (area != NULL)
if (area)
{
m_lastKnownArea = area;
}
@ -973,7 +973,7 @@ void CHostageImprov::UpdatePosition(float deltaT)
KeepPersonalSpace spacer(this);
ForEachPlayer(spacer);
if (g_pHostages != NULL)
if (g_pHostages)
{
g_pHostages->ForEachHostage(spacer);
}
@ -1043,7 +1043,7 @@ void CHostageImprov::UpdateGrenadeReactions()
m_grenadeTimer.Start(RANDOM_FLOAT(0.4f, 0.6f));
while ((entity = UTIL_FindEntityInSphere(entity, GetCentroid(), watchGrenadeRadius)) != NULL)
while ((entity = UTIL_FindEntityInSphere(entity, GetCentroid(), watchGrenadeRadius)))
{
CGrenade *grenade = static_cast<CGrenade *>(entity);
@ -1281,7 +1281,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
PriorityType priority;
bool isHostile;
if (entity != NULL && IsGameEventAudible(event, entity, other, &range, &priority, &isHostile))
if (entity && IsGameEventAudible(event, entity, other, &range, &priority, &isHostile))
{
const float fudge = 0.4f;
@ -1467,12 +1467,12 @@ bool CHostageImprov::IsAtHome() const
bool CHostageImprov::CanSeeRescueZone() const
{
if (TheCSBots() == NULL)
if (!TheCSBots())
return false;
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&GetCentroid());
if (zone != NULL)
if (zone)
return IsVisible(zone->m_center);
return false;
@ -1792,15 +1792,13 @@ void CHostageImprov::ClearPath()
if (result.flFraction == 1.0f)
return;
if (result.pHit != NULL)
if (result.pHit)
{
entvars_t *entity = VARS(result.pHit);
if (FClassnameIs(entity, "func_door") || FClassnameIs(entity, "func_door_rotating"))
{
CBaseEntity *pObject = CBaseEntity::Instance(entity);
if (pObject != NULL)
if (pObject)
{
pObject->Touch(m_hostage);
}
@ -1808,8 +1806,7 @@ void CHostageImprov::ClearPath()
else if (FClassnameIs(entity, "func_breakable") && entity->takedamage == DAMAGE_YES)
{
CBaseEntity *pObject = CBaseEntity::Instance(entity);
if (pObject != NULL)
if (pObject)
{
pObject->TakeDamage(m_hostage->pev, m_hostage->pev, 9999.9, DMG_BULLET);
}

View File

@ -386,7 +386,7 @@ void CGamePlayerZone::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC
{
CBaseEntity *pPlayer = UTIL_PlayerByIndex(i);
if (pPlayer == nullptr)
if (!pPlayer)
continue;
TraceResult trace;
@ -576,7 +576,7 @@ void CGamePlayerEquip::EquipPlayer(CBaseEntity *pEntity)
for (int j = 0; j < m_weaponCount[i]; ++j)
{
pPlayer->GiveNamedItem(STRING(m_weaponNames[i]));
pPlayer->GiveNamedItemEx(STRING(m_weaponNames[i]));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
LINK_HOOK_CHAIN(int, GetForceCamera, (CBasePlayer *pObserver), pObserver);
int __API_HOOK(GetForceCamera)(CBasePlayer *pObserver)
int EXT_FUNC __API_HOOK(GetForceCamera)(CBasePlayer *pObserver)
{
int retVal;
@ -21,7 +21,7 @@ int __API_HOOK(GetForceCamera)(CBasePlayer *pObserver)
LINK_HOOK_CLASS_CHAIN(CBasePlayer *, CBasePlayer, Observer_IsValidTarget, (int iPlayerIndex, bool bSameTeam), iPlayerIndex, bSameTeam);
CBasePlayer *CBasePlayer::__API_HOOK(Observer_IsValidTarget)(int iPlayerIndex, bool bSameTeam)
CBasePlayer *EXT_FUNC CBasePlayer::__API_HOOK(Observer_IsValidTarget)(int iPlayerIndex, bool bSameTeam)
{
if (iPlayerIndex > gpGlobals->maxClients || iPlayerIndex < 1)
return NULL;
@ -266,8 +266,7 @@ void CBasePlayer::Observer_CheckTarget()
if (m_hObserverTarget)
{
int iPlayerIndex = ENTINDEX(m_hObserverTarget->edict());
CBasePlayer *target = UTIL_PlayerByIndex(iPlayerIndex);
CBasePlayer *target = UTIL_PlayerByIndex(m_hObserverTarget->entindex());
// check taget
if (!target || target->pev->deadflag == DEAD_RESPAWNABLE || (target->pev->effects & EF_NODRAW))
@ -301,7 +300,7 @@ void CBasePlayer::Observer_CheckTarget()
void CBasePlayer::Observer_CheckProperties()
{
// try to find a traget if we have no current one
if (pev->iuser1 == OBS_IN_EYE && m_hObserverTarget != NULL)
if (pev->iuser1 == OBS_IN_EYE && m_hObserverTarget)
{
CBasePlayer *target = UTIL_PlayerByIndex(m_hObserverTarget->entindex());
@ -488,9 +487,11 @@ void CBasePlayer::Observer_SetMode(int iMode)
if (m_hObserverTarget != NULL)
UTIL_SetOrigin(pev, m_hObserverTarget->pev->origin);
#ifndef REGAMEDLL_FIXES
MESSAGE_BEGIN(MSG_ONE, gmsgCrosshair, NULL, pev);
WRITE_BYTE((iMode == OBS_ROAMING) != 0);
MESSAGE_END();
#endif
UpdateClientEffects(this, oldMode);

File diff suppressed because it is too large Load Diff

View File

@ -365,7 +365,7 @@ public:
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore);
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem);
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem);
virtual int GiveAmmo(int iAmount, char *szName, int iMax);
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1);
virtual void StartSneaking() { m_tSneaking = gpGlobals->time - 1; }
#ifndef REGAMEDLL_FIXES
@ -412,7 +412,7 @@ public:
void AddPointsToTeam_(int score, BOOL bAllowNegativeScore);
BOOL AddPlayerItem_(CBasePlayerItem *pItem);
BOOL RemovePlayerItem_(CBasePlayerItem *pItem);
int GiveAmmo_(int iAmount,char *szName,int iMax);
int GiveAmmo_(int iAmount, char *szName, int iMax);
void ResetMaxSpeed_();
void Jump_();
void Duck_();
@ -447,6 +447,7 @@ public:
int IsObserver() { return pev->iuser1; }
void PlantC4();
void Radio(const char *msg_id, const char *msg_verbose = NULL, short pitch = 100, bool showIcon = true);
void Radio_(const char *msg_id, const char *msg_verbose = NULL, short pitch = 100, bool showIcon = true);
CBasePlayer *GetNextRadioRecipient(CBasePlayer *pStartPlayer);
void SmartRadio();
void ThrowWeapon(char *pszItemName);
@ -454,7 +455,9 @@ public:
void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
void AddAccount_(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
void Disappear();
void Disappear_();
void MakeVIP();
void MakeVIP_();
bool CanPlayerBuy(bool display = false);
void SwitchTeam();
void TabulateAmmo();
@ -472,8 +475,8 @@ public:
void SetProgressBarTime(int time);
void SetProgressBarTime2(int time, float timeElapsed);
void SetPlayerModel(BOOL HasC4);
void SetClientUserInfoName(char *infobuffer, char *szNewName);
void SetClientUserInfoName_(char *infobuffer, char *szNewName);
bool SetClientUserInfoName(char *infobuffer, char *szNewName);
bool SetClientUserInfoName_(char *infobuffer, char *szNewName);
void SetClientUserInfoModel(char *infobuffer, char *szNewModel);
void SetClientUserInfoModel_api(char *infobuffer, char *szNewModel);
void SetNewPlayerModel(const char *modelName);
@ -501,7 +504,8 @@ public:
void SetWeaponAnimType(const char *szExtention) { Q_strcpy(m_szAnimExtention, szExtention); }
void CheatImpulseCommands(int iImpulse);
void StartDeathCam();
void StartObserver(Vector vecPosition, Vector vecViewAngle);
void StartObserver(Vector &vecPosition, Vector &vecViewAngle);
void StartObserver_(Vector &vecPosition, Vector &vecViewAngle);
void HandleSignals();
void DropPlayerItem(const char *pszItemName);
void DropPlayerItem_(const char *pszItemName);
@ -514,9 +518,9 @@ public:
void SelectItem(const char *pstr);
void ItemPreFrame();
void ItemPostFrame();
void GiveNamedItem(const char *pszName);
void GiveNamedItem_(const char *pszName);
void GiveNamedItemEx(const char *pszName);
CBaseEntity *GiveNamedItem(const char *pszName);
CBaseEntity *GiveNamedItem_(const char *pszName);
CBaseEntity *GiveNamedItemEx(const char *pszName);
void EnableControl(BOOL fControl);
bool HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead = FALSE, BOOL bOverride = FALSE);
void SendAmmoUpdate();
@ -563,6 +567,7 @@ public:
bool IsProtectedByShield() { return HasShield() && m_bShieldDrawn; }
void RemoveShield();
void DropShield(bool bDeploy = true);
void DropShield_(bool bDeploy = true);
void GiveShield(bool bDeploy = true);
void GiveShield_(bool bDeploy = true);
bool IsHittingShield(Vector &vecDirection, TraceResult *ptr);
@ -612,7 +617,17 @@ public:
void DropSecondary();
void DropPrimary();
void OnSpawnEquip(bool addDefault = true, bool equipGame = true);
void OnSpawnEquip_(bool addDefault = true, bool equipGame = true);
void RemoveBomb();
void HideTimer();
bool MakeBomber();
bool MakeBomber_();
bool GetIntoGame();
bool GetIntoGame_();
CBasePlayerItem *GetItemByName(const char *itemName);
CBasePlayerItem *GetItemById(WeaponIdType weaponID);
@ -875,8 +890,7 @@ public:
inline bool CBasePlayer::IsReloading() const
{
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_pActiveItem);
if (weapon != NULL && weapon->m_fInReload)
if (weapon && weapon->m_fInReload)
return true;
return false;
@ -888,8 +902,27 @@ inline CCSPlayer *CBasePlayer::CSPlayer() const {
}
#endif
#ifdef REGAMEDLL_FIXES
// returns a CBaseEntity pointer to a player by index. Only returns if the player is spawned and connected otherwise returns NULL
// Index is 1 based
inline CBasePlayer *UTIL_PlayerByIndex(int playerIndex)
{
return (CBasePlayer *)GET_PRIVATE(INDEXENT(playerIndex));
}
#endif
inline CBasePlayer *UTIL_PlayerByIndexSafe(int playerIndex)
{
CBasePlayer *player = nullptr;
if (likely(playerIndex > 0 && playerIndex <= gpGlobals->maxClients))
player = UTIL_PlayerByIndex(playerIndex);
return player;
}
extern int gEvilImpulse101;
extern char g_szMapBriefingText[512];
extern entvars_t *g_pevLastInflictor;
extern CBaseEntity *g_pLastSpawn;
extern CBaseEntity *g_pLastCTSpawn;

View File

@ -79,8 +79,8 @@ void CHalfLifeRules::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer)
pPlayer->GiveNamedItem("weapon_mp5navy");
pPlayer->GiveNamedItem("weapon_hegrenade");
pPlayer->GiveAmmo(60, "9mm", 120);
pPlayer->GiveAmmo(24, "45acp", 100);
pPlayer->GiveAmmo(60, "9mm");
pPlayer->GiveAmmo(24, "45acp");
}
BOOL CHalfLifeRules::__MAKE_VHOOK(AllowAutoTargetCrosshair)()

View File

@ -95,7 +95,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
m_iHostagesRescued = 0;
m_iRoundTimeSecs = int(gpGlobals->time + 1.0f);
m_bFreezePeriod = FALSE;
g_fGameOver = FALSE;
m_bGameOver = false;
pPlayer->m_iTeam = CT;
pPlayer->m_bCanShoot = true;
@ -253,8 +253,6 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)()
{
CBaseEntity *pHostage = NULL;
if (m_bBombDefused)
{
CGrenade *pBomb = NULL;
@ -289,42 +287,26 @@ void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)()
}
}
pHostage = CBaseEntity::Instance(FIND_ENTITY_BY_CLASSNAME(NULL, "hostage_entity"));
while (pHostage)
CBaseEntity *pHostage = NULL;
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
{
if (pHostage->pev->deadflag != DEAD_RESPAWNABLE || !FStringNull(pHostage->pev->noise1))
continue;
UTIL_SetSize(pHostage->pev, Vector(-16, -16, 0), Vector(16, 16, 72));
CBaseEntity *pRescueArea;
CBaseEntity *pFirstRescueArea;
pFirstRescueArea = CBaseEntity::Instance(FIND_ENTITY_BY_CLASSNAME(NULL, "func_hostage_rescue"));
pRescueArea = pFirstRescueArea;
if (pFirstRescueArea)
CBaseEntity *pRescueArea = NULL;
while ((pRescueArea = UTIL_FindEntityByClassname(pRescueArea, "func_hostage_rescue")))
{
while (pRescueArea != pFirstRescueArea)
{
if (!pRescueArea->Intersects(pHostage))
break;
pRescueArea = UTIL_FindEntityByClassname(pRescueArea, "func_hostage_rescue");
if (!pRescueArea)
break;
}
if (pRescueArea != NULL)
{
pHostage->pev->noise1 = 1;
FireTargets(STRING(pRescueArea->pev->target), NULL, NULL, USE_TOGGLE, 0);
}
if (!pRescueArea->Intersects(pHostage))
break;
}
pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity");
if (pRescueArea)
{
pHostage->pev->noise1 = 1;
FireTargets(STRING(pRescueArea->pev->target), NULL, NULL, USE_TOGGLE, 0);
}
}
}

View File

@ -1520,7 +1520,7 @@ NOXREF void NextLevel()
pChange = GetClassPtr<CCSChangeLevel>((CChangeLevel *)VARS(pent));
Q_strcpy(st_szNextMap, pChange->m_szMapName);
g_fGameOver = TRUE;
g_pGameRules->SetGameOver();
if (pChange->pev->nextthink < gpGlobals->time)
{
@ -1817,7 +1817,7 @@ void CEscapeZone::EscapeTouch(CBaseEntity *pOther)
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
if (pPlayer == NULL || FNullEnt(pPlayer->pev))
if (!pPlayer || FNullEnt(pPlayer->pev))
continue;
if (pPlayer->m_iTeam == p->m_iTeam)

View File

@ -82,7 +82,7 @@ void MonitorTutorStatus()
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
if (pPlayer != NULL && !pPlayer->IsBot())
if (pPlayer && !pPlayer->IsBot())
++numHumans;
}

File diff suppressed because it is too large Load Diff

View File

@ -522,6 +522,7 @@ CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc
return pEntity;
}
#ifndef REGAMEDLL_FIXES
CBasePlayer *EXT_FUNC UTIL_PlayerByIndex(int playerIndex)
{
CBasePlayer *pPlayer = nullptr;
@ -534,6 +535,7 @@ CBasePlayer *EXT_FUNC UTIL_PlayerByIndex(int playerIndex)
return pPlayer;
}
#endif
void UTIL_MakeVectors(const Vector &vecAngles)
{
@ -737,7 +739,7 @@ void UTIL_HudMessageAll(const hudtextparms_t &textparms, const char *pMessage)
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CBaseEntity *pPlayer = UTIL_PlayerByIndex(i);
if (pPlayer != NULL)
if (pPlayer)
UTIL_HudMessage(pPlayer, textparms, pMessage);
}
}
@ -866,7 +868,7 @@ void UTIL_ShowMessageAll(const char *pString, bool isHint)
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CBaseEntity *pPlayer = UTIL_PlayerByIndex(i);
if (pPlayer != NULL)
if (pPlayer)
UTIL_ShowMessage(pString, pPlayer, isHint);
}
}
@ -2332,8 +2334,8 @@ char UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd)
NOXREF int GetPlayerTeam(int index)
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(index);
if (pPlayer != NULL)
CBasePlayer *pPlayer = UTIL_PlayerByIndexSafe(index);
if (pPlayer)
{
return pPlayer->m_iTeam;
}
@ -2358,7 +2360,7 @@ bool UTIL_IsGame(const char *gameName)
float_precision UTIL_GetPlayerGaitYaw(int playerIndex)
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(playerIndex);
if (pPlayer != NULL)
if (pPlayer)
{
return pPlayer->m_flGaityaw;
}

View File

@ -191,9 +191,20 @@ inline entvars_t *VARS(edict_t *pent)
return &pent->v;
}
inline entvars_t *VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); }
inline entvars_t *VARS(EOFFSET eoffset)
{
return VARS(ENT(eoffset));
}
#ifndef ENTINDEX
inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
inline int ENTINDEX(const entvars_t *pev) { return (*g_engfuncs.pfnIndexOfEdict)(ENT(pev)); }
#endif // ENTINDEX
#ifndef INDEXENT
inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
#endif // INDEXENT
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent) { MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent)); }
inline BOOL FNullEnt(EOFFSET eoffset) { return (eoffset == 0); }
inline BOOL FNullEnt(entvars_t *pev) { return (pev == NULL || FNullEnt(OFFSET(pev))); }
@ -246,7 +257,9 @@ CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKe
CBaseEntity *UTIL_FindEntityByClassname(CBaseEntity *pStartEntity, const char *szName);
CBaseEntity *UTIL_FindEntityByTargetname(CBaseEntity *pStartEntity, const char *szName);
CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc, float flRadius);
#ifndef REGAMEDLL_FIXES
CBasePlayer *UTIL_PlayerByIndex(int playerIndex);
#endif
void UTIL_MakeVectors(const Vector &vecAngles);
void UTIL_MakeAimVectors(const Vector &vecAngles);
void UTIL_MakeInvVectors(const Vector &vec, globalvars_t *pgv);

View File

@ -68,7 +68,6 @@ int MaxAmmoCarry(const char *szName)
for (int i = 0; i < MAX_WEAPONS; ++i)
{
ItemInfo *info = &IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ i ];
if (info->pszAmmo1 && !Q_strcmp(szName, info->pszAmmo1))
{
return info->iMaxAmmo1;
@ -84,6 +83,11 @@ int MaxAmmoCarry(const char *szName)
return -1;
}
int MaxAmmoCarry(WeaponIdType weaponId)
{
return IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ weaponId ].iMaxAmmo1;
}
int MaxAmmoCarry(int iszName)
{
return MaxAmmoCarry(STRING(iszName));
@ -152,7 +156,6 @@ void DecalGunshot(TraceResult *pTrace, int iBulletType, bool ClientOnly, entvars
// EjectBrass - tosses a brass shell from passed origin at passed velocity
void EjectBrass(const Vector &vecOrigin, const Vector &vecLeft, const Vector &vecVelocity, float rotation, int model, int soundtype, int entityIndex)
{
//CBaseEntity *ent = UTIL_PlayerByIndex(entityIndex); // unused
bool useNewBehavior = g_bIsCzeroGame;
MESSAGE_BEGIN(MSG_PVS, gmsgBrass, vecOrigin);
@ -652,7 +655,9 @@ void CBasePlayerItem::DefaultTouch(CBaseEntity *pOther)
if (pOther->AddPlayerItem(this))
{
AttachToPlayer(pPlayer);
#ifndef REGAMEDLL_FIXES
SetThink(NULL);
#endif
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM);
}
@ -945,7 +950,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)()
#ifdef REGAMEDLL_ADD
// Do not remove bpammo of the player,
// if cvar allows to refill bpammo on during reloading the weapons
if (refill_bpammo_weapons.value < 2.0f) {
if (refill_bpammo_weapons.value < 3.0f) {
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;
}
#else
@ -1119,7 +1124,14 @@ void CBasePlayerItem::__MAKE_VHOOK(AttachToPlayer)(CBasePlayer *pPlayer)
pev->modelindex = 0;
pev->model = 0;
pev->owner = pPlayer->edict();
#ifndef REGAMEDLL_FIXES
pev->nextthink = gpGlobals->time + 0.1f;
#else
// Remove think - prevents futher attempts to materialize
pev->nextthink = 0;
SetThink(NULL);
#endif
SetTouch(NULL);
}
@ -1630,7 +1642,7 @@ void CWeaponBox::BombThink()
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_BYTE(0);
WRITE_BYTE(BOMB_FLAG_DROPPED);
MESSAGE_END();
}
}
@ -1986,7 +1998,6 @@ int CWeaponBox::PackAmmo(int iszName, int iCount)
}
int iMaxCarry = MaxAmmoCarry(iszName);
if (iMaxCarry != -1 && iCount > 0)
{
GiveAmmo(iCount, (char *)STRING(iszName), iMaxCarry);
@ -2345,7 +2356,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
{
case ARMOURY_FLASHBANG:
{
if (p->AmmoInventory(p->GetAmmoIndex("Flashbang")) >= MaxAmmoCarry("Flashbang"))
if (p->AmmoInventory(AMMO_FLASHBANG) >= MaxAmmoCarry(WEAPON_FLASHBANG))
return;
p->GiveNamedItem("weapon_flashbang");
@ -2354,7 +2365,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
}
case ARMOURY_HEGRENADE:
{
if (p->AmmoInventory(p->GetAmmoIndex("HEGrenade")) >= MaxAmmoCarry("HEGrenade"))
if (p->AmmoInventory(AMMO_HEGRENADE) >= MaxAmmoCarry(WEAPON_HEGRENADE))
return;
p->GiveNamedItem("weapon_hegrenade");
@ -2381,7 +2392,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
}
case ARMOURY_SMOKEGRENADE:
{
if (p->AmmoInventory(p->GetAmmoIndex("SmokeGrenade")) >= MaxAmmoCarry("SmokeGrenade"))
if (p->AmmoInventory(AMMO_SMOKEGRENADE) >= MaxAmmoCarry(WEAPON_SMOKEGRENADE))
return;
p->GiveNamedItem("weapon_smokegrenade");

View File

@ -793,6 +793,10 @@ private:
unsigned short m_usFireAWP;
};
// for usermsg BombDrop
#define BOMB_FLAG_DROPPED 0 // if the bomb was dropped due to voluntary dropping or death/disconnect
#define BOMB_FLAG_PLANTED 1 // if the bomb has been planted will also trigger the round timer to hide will also show where the dropped bomb on the Terrorist team's radar.
class CC4: public CBasePlayerWeapon
{
public:
@ -1863,6 +1867,7 @@ void AnnounceFlashInterval(float interval, float offset = 0);
int MaxAmmoCarry(int iszName);
int MaxAmmoCarry(const char *szName);
int MaxAmmoCarry(WeaponIdType ammoType);
void ClearMultiDamage();
void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker);

View File

@ -69,6 +69,8 @@ TYPEDESCRIPTION gGlobalEntitySaveData[] =
#endif // HOOK_GAMEDLL
char g_szMapBriefingText[512];
class CDecal: public CBaseEntity
{
public:
@ -414,9 +416,45 @@ LINK_ENTITY_TO_CLASS(worldspawn, CWorld, CCSWorld);
void CWorld::__MAKE_VHOOK(Spawn)()
{
EmptyEntityHashTable();
g_fGameOver = FALSE;
#ifdef REGAMEDLL_FIXES
static char szMapBriefingFile[64] = "";
EmptyEntityHashTable();
Precache();
g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats");
g_szMapBriefingText[0] = '\0';
Q_sprintf(szMapBriefingFile, "maps/%s.txt", STRING(gpGlobals->mapname));
int flength = 0;
char *pFile = (char *)LOAD_FILE_FOR_ME(szMapBriefingFile, &flength);
if (pFile && flength)
{
Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2);
g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = '\0';
PRECACHE_GENERIC(szMapBriefingFile);
}
else
{
pFile = (char *)LOAD_FILE_FOR_ME("maps/default.txt", &flength);
if (pFile && flength)
{
Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2);
g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = '\0';
PRECACHE_GENERIC("maps/default.txt");
}
}
if (pFile)
{
FREE_FILE(pFile);
}
#else
EmptyEntityHashTable();
Precache();
g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats");
@ -425,14 +463,9 @@ void CWorld::__MAKE_VHOOK(Spawn)()
int flength = 0;
char *pFile = (char *)LOAD_FILE_FOR_ME(UTIL_VarArgs("maps/%s.txt", STRING(gpGlobals->mapname)), &flength);
if (pFile != NULL && flength)
if (pFile && flength)
{
Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2);
#ifdef REGAMEDLL_FIXES
g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = '\0';
#endif
PRECACHE_GENERIC(UTIL_VarArgs("maps/%s.txt", STRING(gpGlobals->mapname)));
FREE_FILE(pFile);
}
@ -440,18 +473,14 @@ void CWorld::__MAKE_VHOOK(Spawn)()
{
pFile = (char *)LOAD_FILE_FOR_ME(UTIL_VarArgs("maps/default.txt"), &flength);
if (pFile != NULL && flength)
if (pFile && flength)
{
Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2);
#ifdef REGAMEDLL_FIXES
g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = '\0';
#endif
PRECACHE_GENERIC(UTIL_VarArgs("maps/default.txt"));
FREE_FILE(pFile);
}
FREE_FILE(pFile);
}
#endif
}
void CWorld::__MAKE_VHOOK(Precache)()
@ -468,7 +497,7 @@ void CWorld::__MAKE_VHOOK(Precache)()
CVAR_SET_STRING("room_type", "0");
// Set up game rules
if (g_pGameRules != NULL)
if (g_pGameRules)
{
delete g_pGameRules;
}
@ -642,11 +671,11 @@ void CWorld::__MAKE_VHOOK(Precache)()
}
}
#ifndef REGAMEDLL_FIXES
#ifdef REGAMEDLL_FIXES
if (!IS_DEDICATED_SERVER())
#endif
{
// TODO: cvar v_dark there is only the client side
// NOTE: cvar v_dark refers for the client side
if (pev->spawnflags & SF_WORLD_DARK)
CVAR_SET_FLOAT("v_dark", 1);
else

View File

@ -42,5 +42,6 @@ void ResetGlobalState();
extern CGlobalState gGlobalState;
extern float g_flWeaponCheat;
extern char g_szMapBriefingText[512];
#endif // WORLD_H

View File

@ -166,7 +166,7 @@ void CAK47::__MAKE_VHOOK(Reload)()
return;
#endif
if (DefaultReload(AK47_MAX_CLIP, AK47_RELOAD, AK47_RELOAD_TIME))
if (DefaultReload(iMaxClip(), AK47_RELOAD, AK47_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -173,7 +173,7 @@ void CAUG::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_556nato <= 0)
return;
if (DefaultReload(AUG_MAX_CLIP, AUG_RELOAD, AUG_RELOAD_TIME))
if (DefaultReload(iMaxClip(), AUG_RELOAD, AUG_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -183,7 +183,7 @@ void CAWP::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_338mag <= 0)
return;
if (DefaultReload(AWP_MAX_CLIP, AWP_RELOAD, AWP_RELOAD_TIME))
if (DefaultReload(iMaxClip(), AWP_RELOAD, AWP_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -143,7 +143,7 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)()
Broadcast("BOMBPL");
m_pPlayer->m_bHasC4 = false;
if (pev->speed != 0 && CSGameRules() != NULL)
if (pev->speed != 0 && CSGameRules())
{
CSGameRules()->m_iC4Timer = int(pev->speed);
}
@ -162,16 +162,16 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)()
WRITE_COORD(pBomb->pev->origin.x);
WRITE_COORD(pBomb->pev->origin.y);
WRITE_COORD(pBomb->pev->origin.z);
WRITE_BYTE(1);
WRITE_BYTE(BOMB_FLAG_PLANTED);
MESSAGE_END();
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Bomb_Planted");
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BOMB_PLANTED, m_pPlayer, pBomb);
}
if (TheCareerTasks != NULL && CSGameRules()->IsCareer() && !m_pPlayer->IsBot())
if (TheCareerTasks && CSGameRules()->IsCareer() && !m_pPlayer->IsBot())
{
TheCareerTasks->HandleEvent(EVENT_BOMB_PLANTED, m_pPlayer);
}
@ -302,19 +302,16 @@ void CC4::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
void CC4::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
if (m_pPlayer != NULL)
{
if (m_pPlayer)
return;
}
CBasePlayer *pPlayer = UTIL_PlayerByIndex(1);
if (pPlayer != NULL)
if (pPlayer)
{
edict_t *m_pentOldCurBombTarget = pPlayer->m_pentCurBombTarget;
pPlayer->m_pentCurBombTarget = NULL;
if (pev->speed != 0 && CSGameRules() != NULL)
if (pev->speed != 0 && CSGameRules())
{
CSGameRules()->m_iC4Timer = int(pev->speed);
}
@ -324,7 +321,7 @@ void CC4::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
CGrenade::ShootSatchelCharge(m_pPlayer->pev, m_pPlayer->pev->origin, Vector(0, 0, 0));
CGrenade *pC4 = NULL;
while ((pC4 = (CGrenade *)UTIL_FindEntityByClassname(pC4, "grenade")) != NULL)
while ((pC4 = (CGrenade *)UTIL_FindEntityByClassname(pC4, "grenade")))
{
if (pC4->m_bIsC4 && pC4->m_flNextFreq == gpGlobals->time)
{

View File

@ -173,7 +173,7 @@ void CDEAGLE::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_50ae <= 0)
return;
if (DefaultReload(DEAGLE_MAX_CLIP, DEAGLE_RELOAD, DEAGLE_RELOAD_TIME))
if (DefaultReload(iMaxClip(), DEAGLE_RELOAD, DEAGLE_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9f;

View File

@ -192,7 +192,7 @@ void CELITE::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_9mm <= 0)
return;
if (DefaultReload(ELITE_MAX_CLIP, ELITE_RELOAD, ELITE_RELOAD_TIME))
if (DefaultReload(iMaxClip(), ELITE_RELOAD, ELITE_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.88f;

View File

@ -206,7 +206,7 @@ void CFamas::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_556nato <= 0)
return;
if (DefaultReload(FAMAS_MAX_CLIP, FAMAS_RELOAD, FAMAS_RELOAD_TIME))
if (DefaultReload(iMaxClip(), FAMAS_RELOAD, FAMAS_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -172,7 +172,7 @@ void CFiveSeven::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_57mm <= 0)
return;
if (DefaultReload(FIVESEVEN_MAX_CLIP, FIVESEVEN_RELOAD, FIVESEVEN_RELOAD_TIME))
if (DefaultReload(iMaxClip(), FIVESEVEN_RELOAD, FIVESEVEN_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.92f;

View File

@ -181,7 +181,7 @@ void CG3SG1::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_762nato <= 0)
return;
if (DefaultReload(G3SG1_MAX_CLIP, G3SG1_RELOAD, G3SG1_RELOAD_TIME))
if (DefaultReload(iMaxClip(), G3SG1_RELOAD, G3SG1_RELOAD_TIME))
{
m_flAccuracy = 0.2f;
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -171,7 +171,7 @@ void CGalil::__MAKE_VHOOK(Reload)()
return;
#endif
if (DefaultReload(GALIL_MAX_CLIP, GALIL_RELOAD, GALIL_RELOAD_TIME))
if (DefaultReload(iMaxClip(), GALIL_RELOAD, GALIL_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -256,7 +256,7 @@ void CGLOCK18::__MAKE_VHOOK(Reload)()
else
iResult = GLOCK18_RELOAD2;
if (DefaultReload(GLOCK18_MAX_CLIP, iResult, GLOCK18_RELOAD_TIME))
if (DefaultReload(iMaxClip(), iResult, GLOCK18_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9;

View File

@ -163,7 +163,7 @@ void CM249::__MAKE_VHOOK(Reload)()
return;
#endif
if (DefaultReload(M249_MAX_CLIP, M249_RELOAD, M249_RELOAD_TIME))
if (DefaultReload(iMaxClip(), M249_RELOAD, M249_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -135,7 +135,7 @@ void CM3::__MAKE_VHOOK(PrimaryAttack)()
void CM3::__MAKE_VHOOK(Reload)()
{
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == M3_MAX_CLIP)
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == iMaxClip())
return;
// don't reload until recoil is done
@ -168,7 +168,7 @@ void CM3::__MAKE_VHOOK(Reload)()
++m_iClip;
#ifdef REGAMEDLL_ADD
if (refill_bpammo_weapons.value < 2.0f)
if (refill_bpammo_weapons.value < 3.0f)
#endif
{
--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType];
@ -197,7 +197,7 @@ void CM3::__MAKE_VHOOK(WeaponIdle)()
}
else if (m_fInSpecialReload != 0)
{
if (m_iClip != M3_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
if (m_iClip != iMaxClip() && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}

View File

@ -218,7 +218,7 @@ void CM4A1::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_556nato <= 0)
return;
if (DefaultReload(M4A1_MAX_CLIP, ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED) ? M4A1_RELOAD : M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME))
if (DefaultReload(iMaxClip(), ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED) ? M4A1_RELOAD : M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -153,7 +153,7 @@ void CMAC10::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_45acp <= 0)
return;
if (DefaultReload(MAC10_MAX_CLIP, MAC10_RELOAD, MAC10_RELOAD_TIME))
if (DefaultReload(iMaxClip(), MAC10_RELOAD, MAC10_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -154,7 +154,7 @@ void CMP5N::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_9mm <= 0)
return;
if (DefaultReload(MP5N_MAX_CLIP, MP5N_RELOAD, MP5N_RELOAD_TIME))
if (DefaultReload(iMaxClip(), MP5N_RELOAD, MP5N_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -172,7 +172,7 @@ void CP228::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_357sig <= 0)
return;
if (DefaultReload(P228_MAX_CLIP, m_pPlayer->HasShield() ? P228_SHIELD_RELOAD : P228_RELOAD, P228_RELOAD_TIME))
if (DefaultReload(iMaxClip(), m_pPlayer->HasShield() ? P228_SHIELD_RELOAD : P228_RELOAD, P228_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.9f;

View File

@ -160,7 +160,7 @@ void CP90::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_57mm <= 0)
return;
if (DefaultReload(P90_MAX_CLIP, P90_RELOAD, P90_RELOAD_TIME))
if (DefaultReload(iMaxClip(), P90_RELOAD, P90_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -179,7 +179,7 @@ void CSCOUT::__MAKE_VHOOK(Reload)()
return;
#endif
if (DefaultReload(SCOUT_MAX_CLIP, SCOUT_RELOAD, SCOUT_RELOAD_TIME))
if (DefaultReload(iMaxClip(), SCOUT_RELOAD, SCOUT_RELOAD_TIME))
{
if (m_pPlayer->pev->fov != DEFAULT_FOV)
{

View File

@ -176,7 +176,7 @@ void CSG550::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_556nato <= 0)
return;
if (DefaultReload(SG550_MAX_CLIP, SG550_RELOAD, SG550_RELOAD_TIME))
if (DefaultReload(iMaxClip(), SG550_RELOAD, SG550_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -172,7 +172,7 @@ void CSG552::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_556nato <= 0)
return;
if (DefaultReload(SG552_MAX_CLIP, SG552_RELOAD, SG552_RELOAD_TIME))
if (DefaultReload(iMaxClip(), SG552_RELOAD, SG552_RELOAD_TIME))
{
if (m_pPlayer->m_iFOV != DEFAULT_FOV)
{

View File

@ -154,7 +154,7 @@ void CTMP::__MAKE_VHOOK(Reload)()
return;
#endif
if (DefaultReload(TMP_MAX_CLIP, TMP_RELOAD, TMP_RELOAD_TIME))
if (DefaultReload(iMaxClip(), TMP_RELOAD, TMP_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -157,7 +157,7 @@ void CUMP45::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_45acp <= 0)
return;
if (DefaultReload(UMP45_MAX_CLIP, UMP45_RELOAD, UMP45_RELOAD_TIME))
if (DefaultReload(iMaxClip(), UMP45_RELOAD, UMP45_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);

View File

@ -237,19 +237,15 @@ void CUSP::__MAKE_VHOOK(Reload)()
if (m_pPlayer->ammo_45acp <= 0)
return;
int iResult;
int iAnim;
if (m_pPlayer->HasShield())
{
iResult = DefaultReload(USP_MAX_CLIP, USP_SHIELD_RELOAD, USP_RELOAD_TIME);
}
iAnim = USP_SHIELD_RELOAD;
else if (m_iWeaponState & WPNSTATE_USP_SILENCED)
{
iResult = DefaultReload(USP_MAX_CLIP, USP_RELOAD, USP_RELOAD_TIME);
}
iAnim = USP_RELOAD;
else
iResult = DefaultReload(USP_MAX_CLIP, USP_UNSIL_RELOAD, USP_RELOAD_TIME);
iAnim = USP_UNSIL_RELOAD;
if (iResult)
if (DefaultReload(iMaxClip(), iAnim, USP_RELOAD_TIME))
{
m_pPlayer->SetAnimation(PLAYER_RELOAD);
m_flAccuracy = 0.92f;

View File

@ -133,7 +133,7 @@ void CXM1014::__MAKE_VHOOK(PrimaryAttack)()
void CXM1014::__MAKE_VHOOK(Reload)()
{
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == XM1014_MAX_CLIP)
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == iMaxClip())
return;
// don't reload until recoil is done
@ -172,7 +172,7 @@ void CXM1014::__MAKE_VHOOK(Reload)()
++m_iClip;
#ifdef REGAMEDLL_ADD
if (refill_bpammo_weapons.value < 2.0f)
if (refill_bpammo_weapons.value < 3.0f)
#endif
{
--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType];
@ -201,7 +201,7 @@ void CXM1014::__MAKE_VHOOK(WeaponIdle)()
}
else if (m_fInSpecialReload != 0)
{
if (m_iClip != XM1014_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
if (m_iClip != iMaxClip() && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
Reload();
}

View File

@ -81,7 +81,7 @@ public:
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0;
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) = 0;
virtual float GetDelay() = 0;
virtual int IsMoving() = 0;
virtual void OverrideReset() = 0;

View File

@ -41,6 +41,7 @@
#define HIDEHUD_TIMER (1<<4)
#define HIDEHUD_MONEY (1<<5)
#define HIDEHUD_CROSSHAIR (1<<6)
#define HIDEHUD_OBSERVER_CROSSHAIR (1<<7)
#define STATUSICON_HIDE 0
#define STATUSICON_SHOW 1
@ -68,10 +69,11 @@
#define SIGNAL_ESCAPE (1<<3)
#define SIGNAL_VIPSAFETY (1<<4)
#define DATA_IUSER3_CANSHOOT (1<<0)
#define DATA_IUSER3_FREEZETIMEOVER (1<<1)
#define DATA_IUSER3_INBOMBZONE (1<<2)
#define DATA_IUSER3_HOLDINGSHIELD (1<<3)
// player data iuser3
#define PLAYER_CAN_SHOOT (1<<0)
#define PLAYER_FREEZE_TIME_OVER (1<<1)
#define PLAYER_IN_BOMB_ZONE (1<<2)
#define PLAYER_HOLDING_SHIELD (1<<3)
#define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1)

View File

@ -29,19 +29,30 @@
#include "regamedll_const.h"
#undef DLLEXPORT
#ifdef _WIN32
// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#define DLLEXPORT __declspec(dllexport)
// WINAPI should be provided in the windows compiler headers.
// It's usually defined to something like "__stdcall".
#define NOINLINE __declspec(noinline)
#else
#undef DLLEXPORT
#define DLLEXPORT __attribute__((visibility("default")))
#define WINAPI /* */
#define NOINLINE __attribute__((noinline))
#endif // _WIN32
// Manual branch optimization for GCC 3.0.0 and newer
#if !defined(__GNUC__) || __GNUC__ < 3
#define likely(x) (x)
#define unlikely(x) (x)
#else
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
// Simplified macro for declaring/defining exported DLL functions. They
// need to be 'extern "C"' so that the C++ compiler enforces parameter
// type-matching, rather than considering routines with mis-matched

View File

@ -35,13 +35,6 @@
#define MAX_BOMB_RADIUS 2048
#define MAP_VIP_SAFETYZONE_UNINITIALIZED 0 // uninitialized
#define MAP_HAVE_VIP_SAFETYZONE_YES 1 // has VIP safety zone
#define MAP_HAVE_VIP_SAFETYZONE_NO 2 // does not have VIP safetyzone
#define MAP_HAS_CAMERAS_INIT 2 // initial
#define MAP_HAS_CAMERAS_YES 1 // on map have of camera's
#define ITEM_RESPAWN_TIME 30
#define WEAPON_RESPAWN_TIME 20
#define AMMO_RESPAWN_TIME 20
@ -88,6 +81,8 @@ enum ScenarioEventEndRound
ROUND_TERRORISTS_NOT_ESCAPED,
ROUND_VIP_NOT_ESCAPED,
ROUND_GAME_COMMENCE,
ROUND_GAME_RESTART,
ROUND_GAME_OVER
};
enum RewardRules
@ -195,13 +190,13 @@ enum
// custom enum
enum
{
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0),
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1),
SCENARIO_BLOCK_VIP_ESCAPRE = (1 << 2),
SCENARIO_BLOCK_PRISON_ESCAPRE = (1 << 3),
SCENARIO_BLOCK_BOMB = (1 << 4),
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5),
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6),
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0), // flag "a"
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1), // flag "b"
SCENARIO_BLOCK_VIP_ESCAPE = (1 << 2), // flag "c"
SCENARIO_BLOCK_PRISON_ESCAPE = (1 << 3), // flag "d"
SCENARIO_BLOCK_BOMB = (1 << 4), // flag "e"
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5), // flag "f"
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6), // flag "g"
};
// Player relationship return codes
@ -323,12 +318,18 @@ public:
virtual BOOL IsFreezePeriod() = 0;
virtual void ServerDeactivate() = 0;
virtual void CheckMapConditions() = 0;
// inline function's
inline bool IsGameOver() const { return m_bGameOver; }
inline void SetGameOver() { m_bGameOver = true; }
public:
BOOL m_bFreezePeriod; // TRUE at beginning of round, set to FALSE when the period expires
BOOL m_bBombDropped;
// custom
char *m_GameDesc;
bool m_bGameOver; // intermission or finale (deprecated name g_fGameOver)
};
// CHalfLifeRules - rules for the single player Half-Life game.
@ -590,8 +591,8 @@ public:
bool m_bMapHasRescueZone;
bool m_bMapHasEscapeZone;
int m_iMapHasVIPSafetyZone; // 0 = uninitialized; 1 = has VIP safety zone; 2 = DOES not have VIP safetyzone
int m_bMapHasCameras;
BOOL m_bMapHasVIPSafetyZone; // TRUE = has VIP safety zone, FALSE = does not have VIP safetyzone
BOOL m_bMapHasCameras;
int m_iC4Timer;
int m_iC4Guy; // The current Terrorist who has the C4.
int m_iLoserBonus; // the amount of money the losing team gets. This scales up as they lose more rounds in a row
@ -632,7 +633,7 @@ public:
float m_flIntermissionStartTime;
BOOL m_iEndIntermissionButtonHit;
float m_tmNextPeriodicThink;
bool m_bFirstConnected;
bool m_bGameStarted; // TRUE = the game commencing when there is at least one CT and T, FALSE = scoring will not start until both teams have players (deprecated name m_bFirstConnected)
bool m_bInCareerGame;
float m_fCareerRoundMenuTime;
int m_iCareerMatchWins;

View File

@ -27,9 +27,6 @@
*/
#pragma once
// Improved the hostages from CZero
#include "hostage/hostage_improv.h"
#define MAX_NODES 100
#define MAX_HOSTAGES 12
#define MAX_HOSTAGES_NAV 20
@ -75,6 +72,9 @@ enum HostageChatterType
NUM_HOSTAGE_CHATTER_TYPES,
};
// Improved the hostages from CZero
#include "hostage/hostage_improv.h"
extern CHostageManager *g_pHostages;
extern int g_iHostageNumber;
@ -85,6 +85,7 @@ public:
virtual void Precache() = 0;
virtual int ObjectCaps() = 0; // make hostage "useable"
virtual int Classify() = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int BloodColor() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
@ -118,10 +119,10 @@ public:
return true;
}
bool IsValid() { return (pev->takedamage == DAMAGE_YES); }
bool IsDead() { return (pev->deadflag == DEAD_DEAD); }
bool IsAtHome() { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
const Vector *GetHomePosition() { return &m_vStart; }
bool IsValid() const { return (pev->takedamage == DAMAGE_YES); }
bool IsDead() const { return (pev->deadflag == DEAD_DEAD); }
bool IsAtHome() const { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
const Vector *GetHomePosition() const { return &m_vStart; }
public:
int m_Activity;
BOOL m_bTouched;

View File

@ -320,7 +320,7 @@ public:
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0;
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) = 0;
virtual void StartSneaking() = 0;
virtual void UpdateOnRemove() = 0;
virtual BOOL IsSneaking() = 0;
@ -598,8 +598,7 @@ public:
inline bool CBasePlayer::IsReloading() const
{
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_pActiveItem);
if (weapon != NULL && weapon->m_fInReload)
if (weapon && weapon->m_fInReload)
return true;
return false;
@ -608,3 +607,19 @@ inline bool CBasePlayer::IsReloading() const
inline CCSPlayer *CBasePlayer::CSPlayer() const {
return reinterpret_cast<CCSPlayer *>(this->m_pEntity);
}
// returns a CBaseEntity pointer to a player by index. Only returns if the player is spawned and connected otherwise returns NULL
// Index is 1 based
inline CBasePlayer *UTIL_PlayerByIndex(int playerIndex)
{
return (CBasePlayer *)GET_PRIVATE(INDEXENT(playerIndex));
}
inline CBasePlayer *UTIL_PlayerByIndexSafe(int playerIndex)
{
CBasePlayer *player = nullptr;
if (likely(playerIndex > 0 && playerIndex <= gpGlobals->maxClients))
player = UTIL_PlayerByIndex(playerIndex);
return player;
}

View File

@ -139,8 +139,8 @@ typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_GiveDefau
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_GiveDefaultItems;
// CBasePlayer::GiveNamedItem hook
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
typedef IHookChainClass<class CBaseEntity *, class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
typedef IHookChainRegistryClass<class CBaseEntity *, class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
// CBasePlayer::AddAccount hook
typedef IVoidHookChainClass<class CBasePlayer, int, RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
@ -155,8 +155,8 @@ typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBase
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
// CBasePlayer:SetClientUserInfoName hook
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
typedef IHookChainClass<bool, class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
typedef IHookChainRegistryClass<bool, class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
// CBasePlayer::HasRestrictItem hook
typedef IHookChainClass<bool, class CBasePlayer, ItemID, ItemRestType> IReGameHook_CBasePlayer_HasRestrictItem;
@ -166,6 +166,38 @@ typedef IHookChainRegistryClass<bool, class CBasePlayer, ItemID, ItemRestType> I
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropPlayerItem;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropPlayerItem;
// CBasePlayer::DropShield hook
typedef IVoidHookChainClass<class CBasePlayer, bool> IReGameHook_CBasePlayer_DropShield;
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_DropShield;
// CBasePlayer::OnSpawnEquip hook
typedef IVoidHookChainClass<class CBasePlayer, bool, bool> IReGameHook_CBasePlayer_OnSpawnEquip;
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool, bool> IReGameHookRegistry_CBasePlayer_OnSpawnEquip;
// CBasePlayer::Radio hook
typedef IVoidHookChainClass<class CBasePlayer, const char *, const char *, short, bool> IReGameHook_CBasePlayer_Radio;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *, const char *, short, bool> IReGameHookRegistry_CBasePlayer_Radio;
// CBasePlayer::Disappear hook
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Disappear;
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Disappear;
// CBasePlayer::MakeVIP hook
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_MakeVIP;
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_MakeVIP;
// CBasePlayer::MakeBomber hook
typedef IHookChainClass<bool, class CBasePlayer> IReGameHook_CBasePlayer_MakeBomber;
typedef IHookChainRegistryClass<bool, class CBasePlayer> IReGameHookRegistry_CBasePlayer_MakeBomber;
// CBasePlayer::StartObserver hook
typedef IVoidHookChainClass<class CBasePlayer, Vector &, Vector &> IReGameHook_CBasePlayer_StartObserver;
typedef IVoidHookChainRegistryClass<class CBasePlayer, Vector &, Vector &> IReGameHookRegistry_CBasePlayer_StartObserver;
// CBasePlayer::GetIntoGame hook
typedef IHookChainClass<bool, class CBasePlayer> IReGameHook_CBasePlayer_GetIntoGame;
typedef IHookChainRegistryClass<bool, class CBasePlayer> IReGameHookRegistry_CBasePlayer_GetIntoGame;
// CBaseAnimating::ResetSequenceInfo hook
typedef IVoidHookChainClass<class CBaseAnimating> IReGameHook_CBaseAnimating_ResetSequenceInfo;
typedef IVoidHookChainRegistryClass<class CBaseAnimating> IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
@ -218,6 +250,18 @@ typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReG
typedef IVoidHookChain<class CBasePlayer *, int, int, char *> IReGameHook_ShowVGUIMenu;
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *> IReGameHookRegistry_ShowVGUIMenu;
// BuyGunAmmo hook
typedef IHookChain<bool, class CBasePlayer *, class CBasePlayerItem *, bool> IReGameHook_BuyGunAmmo;
typedef IHookChainRegistry<bool, class CBasePlayer *, class CBasePlayerItem *, bool> IReGameHookRegistry_BuyGunAmmo;
// BuyWeaponByWeaponID hook
typedef IHookChain<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGameHook_BuyWeaponByWeaponID;
typedef IHookChainRegistry<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGameHookRegistry_BuyWeaponByWeaponID;
// InternalCommand hook
typedef IHookChain<bool, edict_t *, const char *> IReGameHook_InternalCommand;
typedef IHookChainRegistry<bool, edict_t *, const char *> IReGameHookRegistry_InternalCommand;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
@ -306,9 +350,14 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermissio
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
// CHalfLifeMultiplay::OnRoundFreezeEnd hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_OnRoundFreezeEnd;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
// CBasePlayer virtual
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn() = 0;
virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache() = 0;
@ -343,6 +392,15 @@ public:
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_DropShield* CBasePlayer_DropShield() = 0;
virtual IReGameHookRegistry_CBasePlayer_OnSpawnEquip* CBasePlayer_OnSpawnEquip() = 0;
virtual IReGameHookRegistry_CBasePlayer_Radio* CBasePlayer_Radio() = 0;
virtual IReGameHookRegistry_CBasePlayer_Disappear* CBasePlayer_Disappear() = 0;
virtual IReGameHookRegistry_CBasePlayer_MakeVIP* CBasePlayer_MakeVIP() = 0;
virtual IReGameHookRegistry_CBasePlayer_MakeBomber* CBasePlayer_MakeBomber() = 0;
virtual IReGameHookRegistry_CBasePlayer_StartObserver* CBasePlayer_StartObserver() = 0;
virtual IReGameHookRegistry_CBasePlayer_GetIntoGame* CBasePlayer_GetIntoGame() = 0;
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;
@ -357,6 +415,9 @@ public:
virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam() = 0;
virtual IReGameHookRegistry_ShowMenu* ShowMenu() = 0;
virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu() = 0;
virtual IReGameHookRegistry_BuyGunAmmo* BuyGunAmmo() = 0;
virtual IReGameHookRegistry_BuyWeaponByWeaponID* BuyWeaponByWeaponID() = 0;
virtual IReGameHookRegistry_InternalCommand* InternalCommand() = 0;
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
@ -380,10 +441,10 @@ public:
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd() = 0;
};
struct ReGameFuncs_t {
class CBasePlayer *(*UTIL_PlayerByIndex)(int playerIndex);
struct edict_s *(*CREATE_NAMED_ENTITY2)(string_t iClass);
void (*ChangeString)(char *&dest, const char *source);
void (*RadiusDamage)(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
@ -393,6 +454,8 @@ struct ReGameFuncs_t {
class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
void (*AddEntityHashValue)(entvars_t *pev, const char *value, hash_types_e fieldType);
void (*RemoveEntityHashValue)(entvars_t *pev, const char *value, hash_types_e fieldType);
int (*Cmd_Argc)();
const char *(*Cmd_Argv)(int i);
};
class IReGameApi {

View File

@ -85,6 +85,7 @@
#define Q_pow pow
#define Q_fmod fmod
#define Q_fopen fopen
#define Q_fwrite fwrite
#define Q_fprintf fprintf
#define Q_fclose fclose

View File

@ -37,8 +37,6 @@
#define FCAP_ONOFF_USE 0x00000020 // can be used by the player
#define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains)
#define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource)
#define FCAP_MUST_RESET 0x00000100 // should reset on the new round
#define FCAP_MUST_RELEASE 0x00000200 // should release on the new round
// UNDONE: This will ignore transition volumes (trigger_transition), but not the PVS!!!
#define FCAP_FORCE_TRANSITION 0x00000080 // ALWAYS goes across transitions

View File

@ -59,8 +59,8 @@ public:
virtual bool IsConnected() const;
virtual void SetAnimation(PLAYER_ANIM playerAnim);
virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
virtual void GiveNamedItem(const char *pszName);
virtual void GiveNamedItemEx(const char *pszName);
virtual CBaseEntity *GiveNamedItem(const char *pszName);
virtual CBaseEntity *GiveNamedItemEx(const char *pszName);
virtual void GiveDefaultItems();
virtual void GiveShield(bool bDeploy = true);
virtual void DropShield(bool bDeploy = true);
@ -90,6 +90,11 @@ public:
virtual void DropPrimary();
virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem);
virtual bool HasNamedPlayerItem(const char *pszItemName);
virtual CBasePlayerItem *GetItemById(WeaponIdType weaponID);
virtual CBasePlayerItem *GetItemByName(const char *itemName);
virtual void Disappear();
virtual void MakeVIP();
virtual bool MakeBomber();
CBasePlayer *BasePlayer() const;
public:

View File

@ -128,10 +128,20 @@ inline entvars_t *VARS(edict_t *pent)
return &pent->v;
}
inline entvars_t *VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); }
inline entvars_t *VARS(EOFFSET eoffset)
{
return VARS(ENT(eoffset));
}
#ifndef ENTINDEX
inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
inline int ENTINDEX(const entvars_t *pev) { return (*g_engfuncs.pfnIndexOfEdict)(ENT(pev)); }
#endif // ENTINDEX
#ifndef INDEXENT
inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
#endif // INDEXENT
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent) { MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent)); }
inline BOOL FNullEnt(EOFFSET eoffset) { return (eoffset == 0); }
inline BOOL FNullEnt(entvars_t *pev) { return (pev == NULL || FNullEnt(OFFSET(pev))); }

View File

@ -442,6 +442,10 @@ private:
unsigned short m_usFireAWP;
};
// for usermsg BombDrop
#define BOMB_FLAG_DROPPED 0 // if the bomb was dropped due to voluntary dropping or death/disconnect
#define BOMB_FLAG_PLANTED 1 // if the bomb has been planted will also trigger the round timer to hide will also show where the dropped bomb on the Terrorist team's radar.
class CC4: public CBasePlayerWeapon {
public:
virtual void Spawn() = 0;

View File

@ -298,8 +298,12 @@ typedef struct enginefuncs_s
// Added 2005/11/21 (no SDK update):
void(*pfnQueryClientCvarValue2) (const edict_t *player, const char *cvarName, int requestID);
// Comment out this, for compatibility with older versions metamod - s1lent
#if !defined(CSSDK_COMPAT_OLD_METAMOD)
// Added 2009/06/19 (no SDK update):
// int(*pfnEngCheckParm) (const char *pchCmdLineToken, char **ppnext); // s1lent: comment out this, for compatibility with older versions metamod
int(*pfnEngCheckParm) (const char *pchCmdLineToken, char **ppnext);
#endif
} enginefuncs_t;

View File

@ -12,7 +12,7 @@ float g_flBotCommandInterval = 1.0 / 30.0;
float g_flBotFullThinkInterval = 1.0 / 10.0;
// Nasty Hack. See client.cpp/ClientCommand()
const char *BotArgs[4] = { NULL };
const char *BotArgs[4] = {};
bool UseBotArgs = false;
#endif
@ -319,6 +319,7 @@ byte CBot::ThrottledMsec() const
return byte(iNewMsec);
}
#ifndef REGAMEDLL_FIXES
// Do a "client command" - useful for invoking menu choices, etc.
void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3)
{
@ -331,6 +332,7 @@ void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, co
::ClientCommand(ENT(pev));
UseBotArgs = false;
}
#endif
// Returns TRUE if given entity is our enemy
bool CBot::IsEnemy(CBaseEntity *ent) const

View File

@ -262,8 +262,11 @@ public:
#ifndef HOOK_GAMEDLL
protected:
#endif
#ifndef REGAMEDLL_FIXES
// Do a "client command" - useful for invoking menu choices, etc.
void ClientCommand(const char *cmd, const char *arg1 = NULL, const char *arg2 = NULL, const char *arg3 = NULL);
#endif
// the "personality" profile of this bot
const BotProfile *m_profile;

View File

@ -142,6 +142,7 @@ public:
};
typedef std::STD_LIST<CNavLadder *> NavLadderList;
extern NavLadderList TheNavLadderList;
class HidingSpot
{
@ -189,6 +190,7 @@ private:
};
typedef std::STD_LIST<HidingSpot *> HidingSpotList;
extern HidingSpotList TheHidingSpotList;
struct SpotOrder
{
@ -552,6 +554,8 @@ private:
}
};
extern CNavAreaGrid TheNavAreaGrid;
class ShortestPathCost
{
public:
@ -1167,9 +1171,4 @@ void BuildLadders();
void MarkJumpAreas();
void GenerateNavigationAreaMesh();
extern NavLadderList TheNavLadderList;
extern HidingSpotList TheHidingSpotList;
extern NavAreaList TheNavAreaList;
extern CNavAreaGrid TheNavAreaGrid;
#endif // NAV_AREA_H

View File

@ -816,7 +816,6 @@ void SanityCheckNavigationMap(const char *mapName)
}
unsigned int bspSize = (unsigned int)GET_FILE_SIZE(bspFilename);
if (bspSize != saveBspSize)
{
// this nav file is out of date for this bsp file

View File

@ -283,7 +283,7 @@ FunctionHook g_FunctionHooks[] =
{ 0x01D65850, "_Z9BuyPistolP11CBasePlayeri", (size_t)&BuyPistol },
{ 0x01D65A30, "_Z10BuyShotgunP11CBasePlayeri", (size_t)&BuyShotgun },
{ 0x01D65B70, "_Z16BuySubMachineGunP11CBasePlayeri", (size_t)&BuySubMachineGun },
{ 0x01D65D00, "_Z19BuyWeaponByWeaponIDP11CBasePlayer12WeaponIdType", (size_t)&BuyWeaponByWeaponID },
//{ 0x01D65D00, "_Z19BuyWeaponByWeaponIDP11CBasePlayer12WeaponIdType", (size_t)&BuyWeaponByWeaponID },
{ 0x01D65E80, "_Z8BuyRifleP11CBasePlayeri", (size_t)&BuyRifle },
{ 0x01D66070, "_Z13BuyMachineGunP11CBasePlayeri", (size_t)&BuyMachineGun },
{ 0x01D66170, "_Z7BuyItemP11CBasePlayeri", (size_t)&BuyItem },
@ -719,7 +719,7 @@ FunctionHook g_FunctionHooks[] =
{ 0x01DA67A0, "_ZN11CBasePlayer14SelectLastItemEv", mfunc_ptr_cast(&CBasePlayer::SelectLastItem) },
//{ 0x01DA8BB0, "_ZN11CBasePlayer12ItemPreFrameEv", mfunc_ptr_cast(&CBasePlayer::ItemPreFrame) }, // NOXREF
//{ 0x01DA8BE0, "_ZN11CBasePlayer13ItemPostFrameEv", mfunc_ptr_cast(&CBasePlayer::ItemPostFrame) }, // NOXREF
{ 0x01DA6CC0, "_ZN11CBasePlayer13GiveNamedItemEPKc", mfunc_ptr_cast(&CBasePlayer::GiveNamedItem) },
//{ 0x01DA6CC0, "_ZN11CBasePlayer13GiveNamedItemEPKc", mfunc_ptr_cast(&CBasePlayer::GiveNamedItem) },
{ 0x01DA9C80, "_ZN11CBasePlayer13EnableControlEi", mfunc_ptr_cast(&CBasePlayer::EnableControl) },
{ 0x01DA9D50, "_ZN11CBasePlayer11HintMessageEPKcii", mfunc_ptr_cast(&CBasePlayer::HintMessage) },
{ 0x01DA8CC0, "_ZN11CBasePlayer14SendAmmoUpdateEv", mfunc_ptr_cast(&CBasePlayer::SendAmmoUpdate) },
@ -2399,7 +2399,7 @@ FunctionHook g_FunctionHooks[] =
{ 0x01DC2FB0, "_Z26UTIL_FindEntityByClassnameP11CBaseEntityPKc", (size_t)&UTIL_FindEntityByClassname },
{ 0x01DC2FD0, "_Z27UTIL_FindEntityByTargetnameP11CBaseEntityPKc", (size_t)&UTIL_FindEntityByTargetname },
//{ 0x01DC2FF0, "_Z22UTIL_FindEntityGenericPKcR6Vectorf", (size_t)&UTIL_FindEntityGeneric }, // NOXREF
{ 0x01DC30A0, "_Z18UTIL_PlayerByIndexi", (size_t)&UTIL_PlayerByIndex },
//{ 0x01DC30A0, "_Z18UTIL_PlayerByIndexi", (size_t)&UTIL_PlayerByIndex },
{ 0x01DC30E0, "_Z16UTIL_MakeVectorsRK6Vector", (size_t)&UTIL_MakeVectors },
{ 0x01DC30F0, "_Z19UTIL_MakeAimVectorsRK6Vector", (size_t)&UTIL_MakeAimVectors },
{ 0x01DC3120, "_Z19UTIL_MakeInvVectorsRK6VectorP12globalvars_t", (size_t)&UTIL_MakeInvVectors },
@ -5766,7 +5766,7 @@ AddressRef g_DataRefs[] =
{ 0x01E22C50, "gDecals", (size_t)&pgDecals },
{ 0x01E31748, "stringsHashTable", (size_t)&pstringsHashTable },
{ 0x01E312E8, "hashItemMemPool", (size_t)&phashItemMemPool },
{ 0x01E3175C, "gTouchDisabled", (size_t)&pgTouchDisabled },
//{ 0x01E3175C, "gTouchDisabled", (size_t)&pgTouchDisabled },
{ 0x01E6359C, "giPrecacheGrunt", (size_t)&pgiPrecacheGrunt },
{ 0x01E6360C, "gmsgWeapPickup", (size_t)&pgmsgWeapPickup },
{ 0x01E635E0, "gmsgHudText", (size_t)&pgmsgHudText },

View File

@ -214,6 +214,7 @@ CCareerTaskManager *TheCareerTasks;
const TaskInfo taskInfo[21];
// globals client.cpp
BOOL g_fGameOver; // moved from gamerules
float g_flTimeLimit; // moved from gamerules
float g_flResetTime; // moved from gamerules
bool g_bClientPrintEnable;

View File

@ -925,6 +925,7 @@ extern char pm_grgszTextureName[1024][17];
extern char pm_grgchTextureType[1024];
extern char *BotDifficultyName[5];
extern BOOL g_fGameOver;
extern float g_flResetTime;
C_DLLEXPORT float g_flTimeLimit;

View File

@ -4,21 +4,27 @@
:: Create and fill PublishPath_mp.txt file with path to deployment folder
:: I.e. PublishPath_mp.txt should contain one line with a folder path
:: Call it so:
:: IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")
:: IF EXIST "$(ProjectDir)PostBuild_mp.bat" (CALL "$(ProjectDir)PostBuild_mp.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")
::
SET targetDir=%~1
SET targetDirPlay=%targetDir:Play=%
SET targetName=%~2
SET targetExt=%~3
SET projectDir=%~4
SET destination=
SET destination=PublishPath_mp
IF NOT EXIST "%projectDir%\PublishPath_mp.txt" (
ECHO No deployment path specified. Create PublishPath_mp.txt near PostBuild.bat with paths on separate lines for auto deployment.
IF NOT "%targetDir%"=="%targetDirPlay%" (
SET destination=PublishPath_mp_play
)
IF NOT EXIST "%projectDir%\%destination%.txt" (
ECHO No deployment path specified. Create %destination%.txt near PostBuild_mp.bat with paths on separate lines for auto deployment.
exit /B 0
)
FOR /f "tokens=* delims= usebackq" %%a IN ("%projectDir%\PublishPath_mp.txt") DO (
FOR /f "tokens=* delims= usebackq" %%a IN ("%projectDir%\%destination%.txt") DO (
ECHO Deploying to: %%a
IF NOT "%%a" == "" (
copy /Y "%targetDir%%targetName%%targetExt%" "%%a"
@ -27,7 +33,7 @@ FOR /f "tokens=* delims= usebackq" %%a IN ("%projectDir%\PublishPath_mp.txt") DO
copy /Y "%targetDir%%targetName%.pdb" "%%a"
)
) ELSE (
ECHO PostBuild.bat ^(27^) : warning : Can't copy '%targetName%%targetExt%' to deploy path '%%a'
ECHO PostBuild_mp.bat ^(27^) : warning : Can't copy '%targetName%%targetExt%' to deploy path '%%a'
)
)
)

View File

@ -131,9 +131,9 @@ IF NOT %errlvl% == "1" (
:: append extra string
If NOT "%url_commit%"=="%url_commit:bitbucket.org=%" (
set url_commit=!url_commit!/commits/
) ELSE (
set url_commit=!url_commit!/commit/
) ELSE (
set url_commit=!url_commit!/commits/
)
) ELSE (
@ -146,9 +146,9 @@ IF NOT %errlvl% == "1" (
:: append extra string
If NOT "%url_commit%"=="%url_commit:bitbucket.org=%" (
set url_commit=https://!url_commit!/commits/
) ELSE (
set url_commit=https://!url_commit!/commit/
) ELSE (
set url_commit=https://!url_commit!/commits/
)
)
)

View File

@ -1533,7 +1533,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REGAMEDLL_SELF;PLAY_GAMEDLL;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REGAMEDLL_SELF;PLAY_GAMEDLL;REGAMEDLL_CHECKS;REGAMEDLL_API;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Precise</FloatingPointModel>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>

View File

@ -35,8 +35,8 @@
#include "client.h"
#include "items.h"
#define REGAMEDLL_API_VERSION_MAJOR 4
#define REGAMEDLL_API_VERSION_MINOR 2
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 0
// CBasePlayer::Spawn hook
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -139,8 +139,8 @@ typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_GiveDefau
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_GiveDefaultItems;
// CBasePlayer::GiveNamedItem hook
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
typedef IHookChainClass<class CBaseEntity *, class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
typedef IHookChainRegistryClass<class CBaseEntity *, class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
// CBasePlayer::AddAccount hook
typedef IVoidHookChainClass<class CBasePlayer, int, RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
@ -155,8 +155,8 @@ typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBase
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
// CBasePlayer:SetClientUserInfoName hook
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
typedef IHookChainClass<bool, class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
typedef IHookChainRegistryClass<bool, class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
// CBasePlayer::HasRestrictItem hook
typedef IHookChainClass<bool, class CBasePlayer, ItemID, ItemRestType> IReGameHook_CBasePlayer_HasRestrictItem;
@ -166,6 +166,38 @@ typedef IHookChainRegistryClass<bool, class CBasePlayer, ItemID, ItemRestType> I
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropPlayerItem;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropPlayerItem;
// CBasePlayer::DropShield hook
typedef IVoidHookChainClass<class CBasePlayer, bool> IReGameHook_CBasePlayer_DropShield;
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_DropShield;
// CBasePlayer::OnSpawnEquip hook
typedef IVoidHookChainClass<class CBasePlayer, bool, bool> IReGameHook_CBasePlayer_OnSpawnEquip;
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool, bool> IReGameHookRegistry_CBasePlayer_OnSpawnEquip;
// CBasePlayer::Radio hook
typedef IVoidHookChainClass<class CBasePlayer, const char *, const char *, short, bool> IReGameHook_CBasePlayer_Radio;
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *, const char *, short, bool> IReGameHookRegistry_CBasePlayer_Radio;
// CBasePlayer::Disappear hook
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Disappear;
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Disappear;
// CBasePlayer::MakeVIP hook
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_MakeVIP;
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_MakeVIP;
// CBasePlayer::MakeBomber hook
typedef IHookChainClass<bool, class CBasePlayer> IReGameHook_CBasePlayer_MakeBomber;
typedef IHookChainRegistryClass<bool, class CBasePlayer> IReGameHookRegistry_CBasePlayer_MakeBomber;
// CBasePlayer::StartObserver hook
typedef IVoidHookChainClass<class CBasePlayer, Vector &, Vector &> IReGameHook_CBasePlayer_StartObserver;
typedef IVoidHookChainRegistryClass<class CBasePlayer, Vector &, Vector &> IReGameHookRegistry_CBasePlayer_StartObserver;
// CBasePlayer::GetIntoGame hook
typedef IHookChainClass<bool, class CBasePlayer> IReGameHook_CBasePlayer_GetIntoGame;
typedef IHookChainRegistryClass<bool, class CBasePlayer> IReGameHookRegistry_CBasePlayer_GetIntoGame;
// CBaseAnimating::ResetSequenceInfo hook
typedef IVoidHookChainClass<class CBaseAnimating> IReGameHook_CBaseAnimating_ResetSequenceInfo;
typedef IVoidHookChainRegistryClass<class CBaseAnimating> IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
@ -218,6 +250,18 @@ typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReG
typedef IVoidHookChain<class CBasePlayer *, int, int, char *> IReGameHook_ShowVGUIMenu;
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *> IReGameHookRegistry_ShowVGUIMenu;
// BuyGunAmmo hook
typedef IHookChain<bool, class CBasePlayer *, class CBasePlayerItem *, bool> IReGameHook_BuyGunAmmo;
typedef IHookChainRegistry<bool, class CBasePlayer *, class CBasePlayerItem *, bool> IReGameHookRegistry_BuyGunAmmo;
// BuyWeaponByWeaponID hook
typedef IHookChain<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGameHook_BuyWeaponByWeaponID;
typedef IHookChainRegistry<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGameHookRegistry_BuyWeaponByWeaponID;
// InternalCommand hook
typedef IHookChain<bool, edict_t *, const char *> IReGameHook_InternalCommand;
typedef IHookChainRegistry<bool, edict_t *, const char *> IReGameHookRegistry_InternalCommand;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
@ -306,9 +350,14 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermissio
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
// CHalfLifeMultiplay::OnRoundFreezeEnd hook
typedef IVoidHookChain<> IReGameHook_CSGameRules_OnRoundFreezeEnd;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
// CBasePlayer virtual
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn() = 0;
virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache() = 0;
@ -343,6 +392,15 @@ public:
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_DropShield* CBasePlayer_DropShield() = 0;
virtual IReGameHookRegistry_CBasePlayer_OnSpawnEquip* CBasePlayer_OnSpawnEquip() = 0;
virtual IReGameHookRegistry_CBasePlayer_Radio* CBasePlayer_Radio() = 0;
virtual IReGameHookRegistry_CBasePlayer_Disappear* CBasePlayer_Disappear() = 0;
virtual IReGameHookRegistry_CBasePlayer_MakeVIP* CBasePlayer_MakeVIP() = 0;
virtual IReGameHookRegistry_CBasePlayer_MakeBomber* CBasePlayer_MakeBomber() = 0;
virtual IReGameHookRegistry_CBasePlayer_StartObserver* CBasePlayer_StartObserver() = 0;
virtual IReGameHookRegistry_CBasePlayer_GetIntoGame* CBasePlayer_GetIntoGame() = 0;
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;
@ -357,6 +415,9 @@ public:
virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam() = 0;
virtual IReGameHookRegistry_ShowMenu* ShowMenu() = 0;
virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu() = 0;
virtual IReGameHookRegistry_BuyGunAmmo* BuyGunAmmo() = 0;
virtual IReGameHookRegistry_BuyWeaponByWeaponID* BuyWeaponByWeaponID() = 0;
virtual IReGameHookRegistry_InternalCommand* InternalCommand() = 0;
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
@ -380,10 +441,10 @@ public:
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd() = 0;
};
struct ReGameFuncs_t {
class CBasePlayer *(*UTIL_PlayerByIndex)(int playerIndex);
struct edict_s *(*CREATE_NAMED_ENTITY2)(string_t iClass);
void (*ChangeString)(char *&dest, const char *source);
void (*RadiusDamage)(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
@ -393,6 +454,8 @@ struct ReGameFuncs_t {
class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
void (*AddEntityHashValue)(entvars_t *pev, const char *value, hash_types_e fieldType);
void (*RemoveEntityHashValue)(entvars_t *pev, const char *value, hash_types_e fieldType);
int (*Cmd_Argc)();
const char *(*Cmd_Argv)(int i);
};
class IReGameApi {

View File

@ -85,6 +85,7 @@
#define Q_pow pow
#define Q_fmod fmod
#define Q_fopen fopen
#define Q_fwrite fwrite
#define Q_fprintf fprintf
#define Q_fclose fclose

View File

@ -59,8 +59,8 @@ public:
virtual bool IsConnected() const;
virtual void SetAnimation(PLAYER_ANIM playerAnim);
virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
virtual void GiveNamedItem(const char *pszName);
virtual void GiveNamedItemEx(const char *pszName);
virtual CBaseEntity *GiveNamedItem(const char *pszName);
virtual CBaseEntity *GiveNamedItemEx(const char *pszName);
virtual void GiveDefaultItems();
virtual void GiveShield(bool bDeploy = true);
virtual void DropShield(bool bDeploy = true);
@ -90,6 +90,11 @@ public:
virtual void DropPrimary();
virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem);
virtual bool HasNamedPlayerItem(const char *pszItemName);
virtual CBasePlayerItem *GetItemById(WeaponIdType weaponID);
virtual CBasePlayerItem *GetItemByName(const char *itemName);
virtual void Disappear();
virtual void MakeVIP();
virtual bool MakeBomber();
CBasePlayer *BasePlayer() const;
public:

View File

@ -119,8 +119,8 @@ typedef float& FloatRef;
#include "game_shared/shared_util.h"
#include "game_shared/bot/bot_profile.h"
#include "game_shared/bot/improv.h"
#include "game_shared/bot/nav.h"
#include "game_shared/bot/improv.h"
#include "game_shared/bot/nav_node.h"
#include "game_shared/bot/nav_area.h"
#include "game_shared/bot/nav_file.h"

View File

@ -29,8 +29,15 @@
CReGameHookchains g_ReGameHookchains;
int EXT_FUNC Cmd_Argc_api() {
return CMD_ARGC_();
}
const char *EXT_FUNC Cmd_Argv_api(int i) {
return CMD_ARGV_(i);
}
ReGameFuncs_t g_ReGameApiFuncs = {
&UTIL_PlayerByIndex,
&CREATE_NAMED_ENTITY,
&Regamedll_ChangeString_api,
@ -43,80 +50,95 @@ ReGameFuncs_t g_ReGameApiFuncs = {
&UTIL_FindEntityByString,
&AddEntityHashValue,
&RemoveEntityHashValue
&RemoveEntityHashValue,
Cmd_Argc_api,
Cmd_Argv_api
};
IReGameHookRegistry_CBasePlayer_Spawn* CReGameHookchains::CBasePlayer_Spawn() { return &m_CBasePlayer_Spawn; }
IReGameHookRegistry_CBasePlayer_Precache* CReGameHookchains::CBasePlayer_Precache() { return &m_CBasePlayer_Precache; }
IReGameHookRegistry_CBasePlayer_ObjectCaps* CReGameHookchains::CBasePlayer_ObjectCaps() { return &m_CBasePlayer_ObjectCaps; }
IReGameHookRegistry_CBasePlayer_Classify* CReGameHookchains::CBasePlayer_Classify() { return &m_CBasePlayer_Classify; }
IReGameHookRegistry_CBasePlayer_TraceAttack* CReGameHookchains::CBasePlayer_TraceAttack() { return &m_CBasePlayer_TraceAttack; }
IReGameHookRegistry_CBasePlayer_TakeDamage* CReGameHookchains::CBasePlayer_TakeDamage() { return &m_CBasePlayer_TakeDamage; }
IReGameHookRegistry_CBasePlayer_TakeHealth* CReGameHookchains::CBasePlayer_TakeHealth() { return &m_CBasePlayer_TakeHealth; }
IReGameHookRegistry_CBasePlayer_Killed* CReGameHookchains::CBasePlayer_Killed() { return &m_CBasePlayer_Killed; }
IReGameHookRegistry_CBasePlayer_AddPoints* CReGameHookchains::CBasePlayer_AddPoints() { return &m_CBasePlayer_AddPoints; }
IReGameHookRegistry_CBasePlayer_AddPointsToTeam* CReGameHookchains::CBasePlayer_AddPointsToTeam() { return &m_CBasePlayer_AddPointsToTeam; }
IReGameHookRegistry_CBasePlayer_AddPlayerItem* CReGameHookchains::CBasePlayer_AddPlayerItem() { return &m_CBasePlayer_AddPlayerItem; }
IReGameHookRegistry_CBasePlayer_RemovePlayerItem* CReGameHookchains::CBasePlayer_RemovePlayerItem() { return &m_CBasePlayer_RemovePlayerItem; }
IReGameHookRegistry_CBasePlayer_GiveAmmo* CReGameHookchains::CBasePlayer_GiveAmmo() { return &m_CBasePlayer_GiveAmmo; }
IReGameHookRegistry_CBasePlayer_ResetMaxSpeed* CReGameHookchains::CBasePlayer_ResetMaxSpeed() { return &m_CBasePlayer_ResetMaxSpeed; }
IReGameHookRegistry_CBasePlayer_Jump* CReGameHookchains::CBasePlayer_Jump() { return &m_CBasePlayer_Jump; }
IReGameHookRegistry_CBasePlayer_Duck* CReGameHookchains::CBasePlayer_Duck() { return &m_CBasePlayer_Duck; }
IReGameHookRegistry_CBasePlayer_PreThink* CReGameHookchains::CBasePlayer_PreThink() { return &m_CBasePlayer_PreThink; }
IReGameHookRegistry_CBasePlayer_PostThink* CReGameHookchains::CBasePlayer_PostThink() { return &m_CBasePlayer_PostThink; }
IReGameHookRegistry_CBasePlayer_UpdateClientData* CReGameHookchains::CBasePlayer_UpdateClientData() { return &m_CBasePlayer_UpdateClientData; }
IReGameHookRegistry_CBasePlayer_ImpulseCommands* CReGameHookchains::CBasePlayer_ImpulseCommands() { return &m_CBasePlayer_ImpulseCommands; }
IReGameHookRegistry_CBasePlayer_RoundRespawn* CReGameHookchains::CBasePlayer_RoundRespawn() { return &m_CBasePlayer_RoundRespawn; }
IReGameHookRegistry_CBasePlayer_Blind* CReGameHookchains::CBasePlayer_Blind() { return &m_CBasePlayer_Blind; }
GAMEHOOK_REGISTRY(CBasePlayer_Spawn);
GAMEHOOK_REGISTRY(CBasePlayer_Precache);
GAMEHOOK_REGISTRY(CBasePlayer_ObjectCaps);
GAMEHOOK_REGISTRY(CBasePlayer_Classify);
GAMEHOOK_REGISTRY(CBasePlayer_TraceAttack);
GAMEHOOK_REGISTRY(CBasePlayer_TakeDamage);
GAMEHOOK_REGISTRY(CBasePlayer_TakeHealth);
GAMEHOOK_REGISTRY(CBasePlayer_Killed);
GAMEHOOK_REGISTRY(CBasePlayer_AddPoints);
GAMEHOOK_REGISTRY(CBasePlayer_AddPointsToTeam);
GAMEHOOK_REGISTRY(CBasePlayer_AddPlayerItem);
GAMEHOOK_REGISTRY(CBasePlayer_RemovePlayerItem);
GAMEHOOK_REGISTRY(CBasePlayer_GiveAmmo);
GAMEHOOK_REGISTRY(CBasePlayer_ResetMaxSpeed);
GAMEHOOK_REGISTRY(CBasePlayer_Jump);
GAMEHOOK_REGISTRY(CBasePlayer_Duck);
GAMEHOOK_REGISTRY(CBasePlayer_PreThink);
GAMEHOOK_REGISTRY(CBasePlayer_PostThink);
GAMEHOOK_REGISTRY(CBasePlayer_UpdateClientData);
GAMEHOOK_REGISTRY(CBasePlayer_ImpulseCommands);
GAMEHOOK_REGISTRY(CBasePlayer_RoundRespawn);
GAMEHOOK_REGISTRY(CBasePlayer_Blind);
IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget* CReGameHookchains::CBasePlayer_Observer_IsValidTarget() { return &m_CBasePlayer_Observer_IsValidTarget; }
IReGameHookRegistry_CBasePlayer_SetAnimation* CReGameHookchains::CBasePlayer_SetAnimation() { return &m_CBasePlayer_SetAnimation; }
IReGameHookRegistry_CBasePlayer_GiveDefaultItems* CReGameHookchains::CBasePlayer_GiveDefaultItems() { return &m_CBasePlayer_GiveDefaultItems; }
IReGameHookRegistry_CBasePlayer_GiveNamedItem* CReGameHookchains::CBasePlayer_GiveNamedItem() { return &m_CBasePlayer_GiveNamedItem; }
IReGameHookRegistry_CBasePlayer_AddAccount* CReGameHookchains::CBasePlayer_AddAccount() { return &m_CBasePlayer_AddAccount; }
IReGameHookRegistry_CBasePlayer_GiveShield* CReGameHookchains::CBasePlayer_GiveShield() { return &m_CBasePlayer_GiveShield; }
IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CReGameHookchains::CBasePlayer_SetClientUserInfoModel() { return &m_CBasePlayer_SetClientUserInfoModel; }
IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CReGameHookchains::CBasePlayer_SetClientUserInfoName() { return &m_CBasePlayer_SetClientUserInfoName; }
IReGameHookRegistry_CBasePlayer_HasRestrictItem* CReGameHookchains::CBasePlayer_HasRestrictItem() { return &m_CBasePlayer_HasRestrictItem; }
IReGameHookRegistry_CBasePlayer_DropPlayerItem* CReGameHookchains::CBasePlayer_DropPlayerItem() { return &m_CBasePlayer_DropPlayerItem; }
IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CReGameHookchains::CBaseAnimating_ResetSequenceInfo() { return &m_CBaseAnimating_ResetSequenceInfo; }
GAMEHOOK_REGISTRY(CBasePlayer_Observer_IsValidTarget);
GAMEHOOK_REGISTRY(CBasePlayer_SetAnimation);
GAMEHOOK_REGISTRY(CBasePlayer_GiveDefaultItems);
GAMEHOOK_REGISTRY(CBasePlayer_GiveNamedItem);
GAMEHOOK_REGISTRY(CBasePlayer_AddAccount);
GAMEHOOK_REGISTRY(CBasePlayer_GiveShield);
GAMEHOOK_REGISTRY(CBasePlayer_SetClientUserInfoModel);
GAMEHOOK_REGISTRY(CBasePlayer_SetClientUserInfoName);
GAMEHOOK_REGISTRY(CBasePlayer_HasRestrictItem);
GAMEHOOK_REGISTRY(CBasePlayer_DropPlayerItem);
GAMEHOOK_REGISTRY(CBasePlayer_DropShield);
GAMEHOOK_REGISTRY(CBasePlayer_OnSpawnEquip);
GAMEHOOK_REGISTRY(CBasePlayer_Radio);
GAMEHOOK_REGISTRY(CBasePlayer_Disappear);
GAMEHOOK_REGISTRY(CBasePlayer_MakeVIP);
GAMEHOOK_REGISTRY(CBasePlayer_MakeBomber);
GAMEHOOK_REGISTRY(CBasePlayer_StartObserver);
GAMEHOOK_REGISTRY(CBasePlayer_GetIntoGame);
IReGameHookRegistry_GetForceCamera* CReGameHookchains::GetForceCamera() { return &m_GetForceCamera; }
IReGameHookRegistry_PlayerBlind* CReGameHookchains::PlayerBlind() { return &m_PlayerBlind; }
IReGameHookRegistry_RadiusFlash_TraceLine* CReGameHookchains::RadiusFlash_TraceLine() { return &m_RadiusFlash_TraceLine; }
IReGameHookRegistry_RoundEnd* CReGameHookchains::RoundEnd() { return &m_RoundEnd; }
IReGameHookRegistry_InstallGameRules* CReGameHookchains::InstallGameRules() { return &m_InstallGameRules; }
IReGameHookRegistry_PM_Init* CReGameHookchains::PM_Init() { return &m_PM_Init; }
IReGameHookRegistry_PM_Move* CReGameHookchains::PM_Move() { return &m_PM_Move; }
IReGameHookRegistry_PM_AirMove* CReGameHookchains::PM_AirMove() { return &m_PM_AirMove; }
IReGameHookRegistry_HandleMenu_ChooseAppearance* CReGameHookchains::HandleMenu_ChooseAppearance() { return &m_HandleMenu_ChooseAppearance; }
IReGameHookRegistry_HandleMenu_ChooseTeam* CReGameHookchains::HandleMenu_ChooseTeam() { return &m_HandleMenu_ChooseTeam; }
IReGameHookRegistry_ShowMenu* CReGameHookchains::ShowMenu() { return &m_ShowMenu; }
IReGameHookRegistry_ShowVGUIMenu* CReGameHookchains::ShowVGUIMenu() { return &m_ShowVGUIMenu; }
GAMEHOOK_REGISTRY(CBaseAnimating_ResetSequenceInfo);
IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CReGameHookchains::CSGameRules_FShouldSwitchWeapon() { return &m_CSGameRules_FShouldSwitchWeapon; }
IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CReGameHookchains::CSGameRules_GetNextBestWeapon() { return &m_CSGameRules_GetNextBestWeapon; }
IReGameHookRegistry_CSGameRules_FlPlayerFallDamage* CReGameHookchains::CSGameRules_FlPlayerFallDamage() { return &m_CSGameRules_FlPlayerFallDamage; }
IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage* CReGameHookchains::CSGameRules_FPlayerCanTakeDamage() { return &m_CSGameRules_FPlayerCanTakeDamage; }
IReGameHookRegistry_CSGameRules_PlayerSpawn* CReGameHookchains::CSGameRules_PlayerSpawn() { return &m_CSGameRules_PlayerSpawn; }
IReGameHookRegistry_CSGameRules_FPlayerCanRespawn* CReGameHookchains::CSGameRules_FPlayerCanRespawn() { return &m_CSGameRules_FPlayerCanRespawn; }
IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot* CReGameHookchains::CSGameRules_GetPlayerSpawnSpot() { return &m_CSGameRules_GetPlayerSpawnSpot; }
IReGameHookRegistry_CSGameRules_ClientUserInfoChanged* CReGameHookchains::CSGameRules_ClientUserInfoChanged() { return &m_CSGameRules_ClientUserInfoChanged; }
IReGameHookRegistry_CSGameRules_PlayerKilled* CReGameHookchains::CSGameRules_PlayerKilled() { return &m_CSGameRules_PlayerKilled; }
IReGameHookRegistry_CSGameRules_DeathNotice* CReGameHookchains::CSGameRules_DeathNotice() { return &m_CSGameRules_DeathNotice; }
IReGameHookRegistry_CSGameRules_CanHavePlayerItem* CReGameHookchains::CSGameRules_CanHavePlayerItem() { return &m_CSGameRules_CanHavePlayerItem; }
IReGameHookRegistry_CSGameRules_DeadPlayerWeapons* CReGameHookchains::CSGameRules_DeadPlayerWeapons() { return &m_CSGameRules_DeadPlayerWeapons; }
IReGameHookRegistry_CSGameRules_ServerDeactivate* CReGameHookchains::CSGameRules_ServerDeactivate() { return &m_CSGameRules_ServerDeactivate; }
IReGameHookRegistry_CSGameRules_CheckMapConditions* CReGameHookchains::CSGameRules_CheckMapConditions() { return &m_CSGameRules_CheckMapConditions; }
IReGameHookRegistry_CSGameRules_CleanUpMap* CReGameHookchains::CSGameRules_CleanUpMap() { return &m_CSGameRules_CleanUpMap; }
IReGameHookRegistry_CSGameRules_RestartRound* CReGameHookchains::CSGameRules_RestartRound() { return &m_CSGameRules_RestartRound; }
IReGameHookRegistry_CSGameRules_CheckWinConditions* CReGameHookchains::CSGameRules_CheckWinConditions() { return &m_CSGameRules_CheckWinConditions; }
IReGameHookRegistry_CSGameRules_RemoveGuns* CReGameHookchains::CSGameRules_RemoveGuns() { return &m_CSGameRules_RemoveGuns; }
IReGameHookRegistry_CSGameRules_GiveC4* CReGameHookchains::CSGameRules_GiveC4() { return &m_CSGameRules_GiveC4; }
IReGameHookRegistry_CSGameRules_ChangeLevel* CReGameHookchains::CSGameRules_ChangeLevel() { return &m_CSGameRules_ChangeLevel; }
IReGameHookRegistry_CSGameRules_GoToIntermission* CReGameHookchains::CSGameRules_GoToIntermission() { return &m_CSGameRules_GoToIntermission; }
IReGameHookRegistry_CSGameRules_BalanceTeams* CReGameHookchains::CSGameRules_BalanceTeams() { return &m_CSGameRules_BalanceTeams; }
GAMEHOOK_REGISTRY(GetForceCamera);
GAMEHOOK_REGISTRY(PlayerBlind);
GAMEHOOK_REGISTRY(RadiusFlash_TraceLine);
GAMEHOOK_REGISTRY(RoundEnd);
GAMEHOOK_REGISTRY(InstallGameRules);
GAMEHOOK_REGISTRY(PM_Init);
GAMEHOOK_REGISTRY(PM_Move);
GAMEHOOK_REGISTRY(PM_AirMove);
GAMEHOOK_REGISTRY(HandleMenu_ChooseAppearance);
GAMEHOOK_REGISTRY(HandleMenu_ChooseTeam);
GAMEHOOK_REGISTRY(ShowMenu);
GAMEHOOK_REGISTRY(ShowVGUIMenu);
GAMEHOOK_REGISTRY(BuyGunAmmo);
GAMEHOOK_REGISTRY(BuyWeaponByWeaponID);
GAMEHOOK_REGISTRY(InternalCommand);
GAMEHOOK_REGISTRY(CSGameRules_FShouldSwitchWeapon);
GAMEHOOK_REGISTRY(CSGameRules_GetNextBestWeapon);
GAMEHOOK_REGISTRY(CSGameRules_FlPlayerFallDamage);
GAMEHOOK_REGISTRY(CSGameRules_FPlayerCanTakeDamage);
GAMEHOOK_REGISTRY(CSGameRules_PlayerSpawn);
GAMEHOOK_REGISTRY(CSGameRules_FPlayerCanRespawn);
GAMEHOOK_REGISTRY(CSGameRules_GetPlayerSpawnSpot);
GAMEHOOK_REGISTRY(CSGameRules_ClientUserInfoChanged);
GAMEHOOK_REGISTRY(CSGameRules_PlayerKilled);
GAMEHOOK_REGISTRY(CSGameRules_DeathNotice);
GAMEHOOK_REGISTRY(CSGameRules_CanHavePlayerItem);
GAMEHOOK_REGISTRY(CSGameRules_DeadPlayerWeapons);
GAMEHOOK_REGISTRY(CSGameRules_ServerDeactivate);
GAMEHOOK_REGISTRY(CSGameRules_CheckMapConditions);
GAMEHOOK_REGISTRY(CSGameRules_CleanUpMap);
GAMEHOOK_REGISTRY(CSGameRules_RestartRound);
GAMEHOOK_REGISTRY(CSGameRules_CheckWinConditions);
GAMEHOOK_REGISTRY(CSGameRules_RemoveGuns);
GAMEHOOK_REGISTRY(CSGameRules_GiveC4);
GAMEHOOK_REGISTRY(CSGameRules_ChangeLevel);
GAMEHOOK_REGISTRY(CSGameRules_GoToIntermission);
GAMEHOOK_REGISTRY(CSGameRules_BalanceTeams);
GAMEHOOK_REGISTRY(CSGameRules_OnRoundFreezeEnd);
int EXT_FUNC CReGameApi::GetMajorVersion() {
return REGAMEDLL_API_VERSION_MAJOR;

View File

@ -31,6 +31,9 @@
#include "regamedll_api.h"
#include "regamedll_interfaces_impl.h"
#define GAMEHOOK_REGISTRY(func)\
IReGameHookRegistry_##func* CReGameHookchains::##func() { return &m_##func; }
// CBasePlayer::Spawn hook
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_Spawn;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_Spawn;
@ -132,8 +135,8 @@ typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_GiveDefault
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_GiveDefaultItems;
// CBasePlayer::GiveNamedItem hook
typedef IVoidHookChainClassImpl<CBasePlayer, const char *> CReGameHook_CBasePlayer_GiveNamedItem;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, const char *> CReGameHookRegistry_CBasePlayer_GiveNamedItem;
typedef IHookChainClassImpl<CBaseEntity *, CBasePlayer, const char *> CReGameHook_CBasePlayer_GiveNamedItem;
typedef IHookChainRegistryClassImpl<CBaseEntity *, CBasePlayer, const char *> CReGameHookRegistry_CBasePlayer_GiveNamedItem;
// CBasePlayer::AddAccount hook
typedef IVoidHookChainClassImpl<CBasePlayer, int, RewardType, bool> CReGameHook_CBasePlayer_AddAccount;
@ -148,8 +151,8 @@ typedef IVoidHookChainClassImpl<CBasePlayer, char *, char *> CReGameHook_CBasePl
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, char *, char *> CReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
// CBasePlayer:SetClientUserInfoName hook
typedef IVoidHookChainClassImpl<CBasePlayer, char *, char *> CReGameHook_CBasePlayer_SetClientUserInfoName;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, char *, char *> CReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
typedef IHookChainClassImpl<bool, CBasePlayer, char *, char *> CReGameHook_CBasePlayer_SetClientUserInfoName;
typedef IHookChainRegistryClassImpl<bool, CBasePlayer, char *, char *> CReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
// CBasePlayer::HasRestrictItem hook
typedef IHookChainClassImpl<bool, CBasePlayer, ItemID, ItemRestType> CReGameHook_CBasePlayer_HasRestrictItem;
@ -159,6 +162,38 @@ typedef IHookChainRegistryClassImpl<bool, CBasePlayer, ItemID, ItemRestType> CRe
typedef IVoidHookChainClassImpl<CBasePlayer, const char *> CReGameHook_CBasePlayer_DropPlayerItem;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, const char *> CReGameHookRegistry_CBasePlayer_DropPlayerItem;
// CBasePlayer::DropShield hook
typedef IVoidHookChainClassImpl<CBasePlayer, bool> CReGameHook_CBasePlayer_DropShield;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, bool> CReGameHookRegistry_CBasePlayer_DropShield;
// CBasePlayer::OnSpawnEquip hook
typedef IVoidHookChainClassImpl<CBasePlayer, bool, bool> CReGameHook_CBasePlayer_OnSpawnEquip;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, bool, bool> CReGameHookRegistry_CBasePlayer_OnSpawnEquip;
// CBasePlayer::Radio hook
typedef IVoidHookChainClassImpl<CBasePlayer, const char *, const char *, short, bool> CReGameHook_CBasePlayer_Radio;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, const char *, const char *, short, bool> CReGameHookRegistry_CBasePlayer_Radio;
// CBasePlayer::Disappear hook
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_Disappear;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_Disappear;
// CBasePlayer::MakeVIP hook
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_MakeVIP;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_MakeVIP;
// CBasePlayer::MakeBomber hook
typedef IHookChainClassImpl<bool, CBasePlayer> CReGameHook_CBasePlayer_MakeBomber;
typedef IHookChainRegistryClassImpl<bool, CBasePlayer> CReGameHookRegistry_CBasePlayer_MakeBomber;
// CBasePlayer::StartObserver hook
typedef IVoidHookChainClassImpl<CBasePlayer, Vector &, Vector &> CReGameHook_CBasePlayer_StartObserver;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, Vector &, Vector &> CReGameHookRegistry_CBasePlayer_StartObserver;
// CBasePlayer::GetIntoGame hook
typedef IHookChainClassImpl<bool, CBasePlayer> CReGameHook_CBasePlayer_GetIntoGame;
typedef IHookChainRegistryClassImpl<bool, CBasePlayer> CReGameHookRegistry_CBasePlayer_GetIntoGame;
// CBaseAnimating::ResetSequenceInfo hook
typedef IVoidHookChainClassImpl<CBaseAnimating> CReGameHook_CBaseAnimating_ResetSequenceInfo;
typedef IVoidHookChainRegistryClassImpl<CBaseAnimating> CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
@ -211,6 +246,18 @@ typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, BOOL, char *> CReGam
typedef IVoidHookChainImpl<CBasePlayer *, int, int, char *> CReGameHook_ShowVGUIMenu;
typedef IVoidHookChainRegistryImpl<CBasePlayer *, int, int, char *> CReGameHookRegistry_ShowVGUIMenu;
// BuyGunAmmo hook
typedef IHookChainImpl<bool, CBasePlayer *, CBasePlayerItem *, bool> CReGameHook_BuyGunAmmo;
typedef IHookChainRegistryImpl<bool, CBasePlayer *, CBasePlayerItem *, bool> CReGameHookRegistry_BuyGunAmmo;
// BuyWeaponByWeaponID hook
typedef IHookChainImpl<CBaseEntity *, CBasePlayer *, WeaponIdType> CReGameHook_BuyWeaponByWeaponID;
typedef IHookChainRegistryImpl<CBaseEntity *, CBasePlayer *, WeaponIdType> CReGameHookRegistry_BuyWeaponByWeaponID;
// InternalCommand hook
typedef IHookChainImpl<bool, edict_t *, const char *> CReGameHook_InternalCommand;
typedef IHookChainRegistryImpl<bool, edict_t *, const char *> CReGameHookRegistry_InternalCommand;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_FShouldSwitchWeapon;
typedef IHookChainRegistryClassEmptyImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
@ -241,7 +288,7 @@ typedef IHookChainRegistryClassEmptyImpl<edict_t *, class CHalfLifeMultiplay, CB
// CHalfLifeMultiplay::ClientUserInfoChanged hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay, CBasePlayer *, char *> CReGameHook_CSGameRules_ClientUserInfoChanged;
typedef IVoidHookChainRegistryClassEmptyImpl< class CHalfLifeMultiplay, CBasePlayer *, char *> CReGameHookRegistry_CSGameRules_ClientUserInfoChanged;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay, CBasePlayer *, char *> CReGameHookRegistry_CSGameRules_ClientUserInfoChanged;
// CHalfLifeMultiplay::PlayerKilled hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay, CBasePlayer *, entvars_t *, entvars_t *> CReGameHook_CSGameRules_PlayerKilled;
@ -299,6 +346,10 @@ typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHo
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_BalanceTeams;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_BalanceTeams;
// CHalfLifeMultiplay::OnRoundFreezeEnd hook
typedef IVoidHookChainClassImpl<class CHalfLifeMultiplay> CReGameHook_CSGameRules_OnRoundFreezeEnd;
typedef IVoidHookChainRegistryClassEmptyImpl<class CHalfLifeMultiplay> CReGameHookRegistry_CSGameRules_OnRoundFreezeEnd;
class CReGameHookchains: public IReGameHookchains {
public:
// CBasePlayer virtual
@ -335,6 +386,15 @@ public:
CReGameHookRegistry_CBasePlayer_SetClientUserInfoName m_CBasePlayer_SetClientUserInfoName;
CReGameHookRegistry_CBasePlayer_HasRestrictItem m_CBasePlayer_HasRestrictItem;
CReGameHookRegistry_CBasePlayer_DropPlayerItem m_CBasePlayer_DropPlayerItem;
CReGameHookRegistry_CBasePlayer_DropShield m_CBasePlayer_DropShield;
CReGameHookRegistry_CBasePlayer_OnSpawnEquip m_CBasePlayer_OnSpawnEquip;
CReGameHookRegistry_CBasePlayer_Radio m_CBasePlayer_Radio;
CReGameHookRegistry_CBasePlayer_Disappear m_CBasePlayer_Disappear;
CReGameHookRegistry_CBasePlayer_MakeVIP m_CBasePlayer_MakeVIP;
CReGameHookRegistry_CBasePlayer_MakeBomber m_CBasePlayer_MakeBomber;
CReGameHookRegistry_CBasePlayer_StartObserver m_CBasePlayer_StartObserver;
CReGameHookRegistry_CBasePlayer_GetIntoGame m_CBasePlayer_GetIntoGame;
CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo m_CBaseAnimating_ResetSequenceInfo;
CReGameHookRegistry_GetForceCamera m_GetForceCamera;
@ -349,6 +409,9 @@ public:
CReGameHookRegistry_HandleMenu_ChooseTeam m_HandleMenu_ChooseTeam;
CReGameHookRegistry_ShowMenu m_ShowMenu;
CReGameHookRegistry_ShowVGUIMenu m_ShowVGUIMenu;
CReGameHookRegistry_BuyGunAmmo m_BuyGunAmmo;
CReGameHookRegistry_BuyWeaponByWeaponID m_BuyWeaponByWeaponID;
CReGameHookRegistry_InternalCommand m_InternalCommand;
CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon m_CSGameRules_FShouldSwitchWeapon;
CReGameHookRegistry_CSGameRules_GetNextBestWeapon m_CSGameRules_GetNextBestWeapon;
@ -372,6 +435,7 @@ public:
CReGameHookRegistry_CSGameRules_ChangeLevel m_CSGameRules_ChangeLevel;
CReGameHookRegistry_CSGameRules_GoToIntermission m_CSGameRules_GoToIntermission;
CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams;
CReGameHookRegistry_CSGameRules_OnRoundFreezeEnd m_CSGameRules_OnRoundFreezeEnd;
public:
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn();
@ -407,6 +471,15 @@ public:
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName();
virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem();
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem();
virtual IReGameHookRegistry_CBasePlayer_DropShield* CBasePlayer_DropShield();
virtual IReGameHookRegistry_CBasePlayer_OnSpawnEquip* CBasePlayer_OnSpawnEquip();
virtual IReGameHookRegistry_CBasePlayer_Radio* CBasePlayer_Radio();
virtual IReGameHookRegistry_CBasePlayer_Disappear* CBasePlayer_Disappear();
virtual IReGameHookRegistry_CBasePlayer_MakeVIP* CBasePlayer_MakeVIP();
virtual IReGameHookRegistry_CBasePlayer_MakeBomber* CBasePlayer_MakeBomber();
virtual IReGameHookRegistry_CBasePlayer_StartObserver* CBasePlayer_StartObserver();
virtual IReGameHookRegistry_CBasePlayer_GetIntoGame* CBasePlayer_GetIntoGame();
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo();
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera();
@ -421,6 +494,9 @@ public:
virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam();
virtual IReGameHookRegistry_ShowMenu* ShowMenu();
virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu();
virtual IReGameHookRegistry_BuyGunAmmo* BuyGunAmmo();
virtual IReGameHookRegistry_BuyWeaponByWeaponID* BuyWeaponByWeaponID();
virtual IReGameHookRegistry_InternalCommand* InternalCommand();
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon();
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon();
@ -444,6 +520,7 @@ public:
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel();
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission();
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams();
virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd();
};
extern CReGameHookchains g_ReGameHookchains;

View File

@ -73,7 +73,7 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
case CT:
case TERRORIST:
{
if (pPlayer->m_iTeam == SPECTATOR || pPlayer->m_iTeam == UNASSIGNED)
if (pPlayer->m_iTeam == SPECTATOR)
{
// If they're switching into spectator, setup spectator properties..
pPlayer->m_bNotKilled = true;
@ -81,7 +81,7 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
pPlayer->m_iTeamKills = 0;
if (pPlayer->m_iAccount < int(startmoney.value)) {
pPlayer->m_iAccount = int(startmoney.value);
pPlayer->AddAccount(startmoney.value, RT_PLAYER_JOIN);
}
pPlayer->pev->solid = SOLID_NOT;
@ -207,7 +207,6 @@ bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char* pszItemName)
pPlayer->RemoveShield();
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(pPlayer->m_pActiveItem);
if (pWeapon)
{
if (!pWeapon->CanHolster())
@ -237,44 +236,34 @@ bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char* pszItemName)
return true;
}
bool bIsC4 = !!FStrEq(pszItemName, "weapon_c4");
for (auto pItem : pPlayer->m_rgpPlayerItems) {
while (pItem != nullptr)
{
if (FClassnameIs(pItem->pev, pszItemName))
{
if (pItem->iItemSlot() == PRIMARY_WEAPON_SLOT) {
pPlayer->m_bHasPrimary = false;
}
else if (bIsC4)
{
pPlayer->m_bHasC4 = false;
pPlayer->pev->body = 0;
pPlayer->SetBombIcon(FALSE);
pPlayer->SetProgressBarTime(0);
}
auto pItem = GetItemByName(pszItemName);
if (pItem)
{
if (pItem->iItemSlot() == PRIMARY_WEAPON_SLOT) {
pPlayer->m_bHasPrimary = false;
}
else if (FClassnameIs(pItem->pev, "weapon_c4")) {
pPlayer->m_bHasC4 = false;
pPlayer->pev->body = 0;
pPlayer->SetBombIcon(FALSE);
pPlayer->SetProgressBarTime(0);
}
if (pItem->IsWeapon() && pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
}
if (pItem->IsWeapon() && pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
}
if (pPlayer->RemovePlayerItem(pItem)) {
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
pItem->Kill();
return true;
}
return false;
}
pItem = pItem->m_pNext;
if (pPlayer->RemovePlayerItem(pItem)) {
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
pItem->Kill();
return true;
}
}
return false;
}
void EXT_FUNC CCSPlayer::GiveNamedItemEx(const char *pszName)
CBaseEntity *EXT_FUNC CCSPlayer::GiveNamedItemEx(const char *pszName)
{
CBasePlayer *pPlayer = BasePlayer();
@ -288,16 +277,16 @@ void EXT_FUNC CCSPlayer::GiveNamedItemEx(const char *pszName)
} else if (FStrEq(pszName, "weapon_shield")) {
pPlayer->DropPrimary();
pPlayer->GiveShield();
return;
return nullptr;
}
pPlayer->GiveNamedItemEx(pszName);
return pPlayer->GiveNamedItemEx(pszName);
}
bool EXT_FUNC CCSPlayer::IsConnected() const { return m_pContainingEntity->has_disconnected == false; }
void EXT_FUNC CCSPlayer::SetAnimation(PLAYER_ANIM playerAnim) { BasePlayer()->SetAnimation(playerAnim); }
void EXT_FUNC CCSPlayer::AddAccount(int amount, RewardType type, bool bTrackChange) { BasePlayer()->AddAccount(amount, type, bTrackChange); }
void EXT_FUNC CCSPlayer::GiveNamedItem(const char *pszName) { BasePlayer()->GiveNamedItem(pszName); }
CBaseEntity *EXT_FUNC CCSPlayer::GiveNamedItem(const char *pszName) { return BasePlayer()->GiveNamedItem(pszName); }
void EXT_FUNC CCSPlayer::GiveDefaultItems() { BasePlayer()->GiveDefaultItems(); }
void EXT_FUNC CCSPlayer::GiveShield(bool bDeploy) { BasePlayer()->GiveShield(bDeploy); }
void EXT_FUNC CCSPlayer::DropShield(bool bDeploy) { BasePlayer()->DropShield(bDeploy); }
@ -325,3 +314,8 @@ void EXT_FUNC CCSPlayer::DropSecondary() { BasePlayer()->DropSecondary(); }
void EXT_FUNC CCSPlayer::DropPrimary() { BasePlayer()->DropPrimary(); }
bool EXT_FUNC CCSPlayer::HasPlayerItem(CBasePlayerItem *pCheckItem) { return BasePlayer()->HasPlayerItem(pCheckItem); }
bool EXT_FUNC CCSPlayer::HasNamedPlayerItem(const char *pszItemName) { return BasePlayer()->HasNamedPlayerItem(pszItemName); }
CBasePlayerItem *EXT_FUNC CCSPlayer::GetItemById(WeaponIdType weaponID) { return BasePlayer()->GetItemById(weaponID); }
CBasePlayerItem *EXT_FUNC CCSPlayer::GetItemByName(const char *itemName) { return BasePlayer()->GetItemByName(itemName); }
void EXT_FUNC CCSPlayer::Disappear() { BasePlayer()->Disappear(); }
void EXT_FUNC CCSPlayer::MakeVIP() { BasePlayer()->MakeVIP(); }
bool EXT_FUNC CCSPlayer::MakeBomber() { return BasePlayer()->MakeBomber(); }