Fix crash when self-build navigation areas

Added cvar's mp_fragsleft, mp_fraglimit, showtriggers (also handling mp_timeleft)
Removed client cmd's (like cd, kill) - they are in the black list of cl_filterstuffcmd.
Refactoring
This commit is contained in:
s1lentq 2016-10-05 22:27:50 +07:00
parent 3c805aae95
commit 42edf0ebec
38 changed files with 432 additions and 293 deletions

View File

@ -29,9 +29,14 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| 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 |
| 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 |
| 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 |
| 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 |
## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)

19
dist/game.cfg vendored
View File

@ -84,3 +84,22 @@ mp_auto_join_team 0
//
// Default value: "3"
mp_max_teamkills 3
// If set to something other than 0,
// when anybodys scored reaches mp_fraglimit the server changes map.
// 0 - means no limit
//
// Default value: "0"
mp_fraglimit 0
// Period between map rotations.
// 0 - means no limit
//
// Default value: "0"
mp_timelimit 20
// Debug cvar shows triggers.
// 0 - disabled
//
// Default value: "0"
showtriggers 0

View File

@ -359,12 +359,7 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue
}
int setting = int64(255.0f * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start));
if (setting < 0)
setting = 0;
if (setting > 255)
setting = 255;
setting = Q_clamp(setting, 0, 255);
pev->controller[ iController ] = setting;
@ -408,12 +403,7 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue)
}
int setting = int64(255.0f * (flValue - pseqdesc->blendstart[iBlender]) / (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender]));
if (setting < 0)
setting = 0;
if (setting > 255)
setting = 255;
setting = Q_clamp(setting, 0, 255);
pev->blending[iBlender] = setting;
@ -751,13 +741,7 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b
else
{
value = (pcontroller1[i] * dadt + pcontroller2[i] * (1.0 - dadt)) / 255.0;
if (value < 0)
value = 0;
if (value > 1.0)
value = 1.0;
value = Q_clamp(value, 0.0f, 1.0f);
value = (1.0 - value) * pbonecontroller[j].start + value * pbonecontroller[j].end;
}
}
@ -797,7 +781,7 @@ void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioan
{
if (panim->offset[j + 3] == 0)
{
// default;
// default
angle2[j] = angle1[j] = pbone->value[j + 3];
}
else
@ -894,6 +878,7 @@ void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioani
if (panimvalue->num.total < panimvalue->num.valid)
k = 0;
}
// if we're inside the span
if (panimvalue->num.valid > k)
{
@ -913,6 +898,7 @@ void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioani
pos[j] += panimvalue[panimvalue->num.valid].value * pbone->scale[j];
}
}
if (pbone->bonecontroller[j] != -1 && adj)
{
pos[j] += adj[pbone->bonecontroller[j]];
@ -926,13 +912,8 @@ void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3],
vec4_t q3;
float s1;
if (s < 0)
s = 0;
else if (s > 1.0)
s = 1.0;
s1 = 1.0 - s;
s = Q_clamp(s, 0.0f, 1.0f);
s1 = 1.0f - s;
for (i = 0; i < g_pstudiohdr->numbones; ++i)
{
@ -958,8 +939,8 @@ void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, flo
{
j = chain[i];
StudioCalcBoneQuaterion(int(f), s, &pbones[j], &panim[j], adj, q[j]);
StudioCalcBonePosition(int(f), s, &pbones[j], &panim[j], adj, pos[j]);
StudioCalcBoneQuaterion((int)f, s, &pbones[j], &panim[j], adj, q[j]);
StudioCalcBonePosition((int)f, s, &pbones[j], &panim[j], adj, pos[j]);
}
}
@ -991,16 +972,16 @@ float_precision StudioEstimateFrame(float frame, mstudioseqdesc_t *pseqdesc)
void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t *angles, const vec_t *origin, const byte *pcontroller, const byte *pblending, int iBone, const edict_t *pEdict)
{
int i, j;
float_precision f;
int i, j, chainlength = 0;
int chain[MAXSTUDIOBONES];
double f;
float subframe;
float adj[MAXSTUDIOCONTROLLERS];
mstudiobone_t *pbones;
mstudioseqdesc_t *pseqdesc;
mstudioanim_t *panim;
float bonematrix[3][4];
int chain[MAXSTUDIOBONES];
int chainlength;
vec3_t temp_angles;
/*static */float pos[MAXSTUDIOBONES][3], pos2[MAXSTUDIOBONES][3];
@ -1028,8 +1009,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
}
else
{
chainlength = 0;
// only the parent bones
for (i = iBone; i != -1; i = pbones[i].parent)
chain[chainlength++] = i;
}
@ -1047,7 +1027,6 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
{
float b = float_precision(pblending[0]) / 255.0f;
pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + sequence;
panim = StudioGetAnim(pModel, pseqdesc);
panim += g_pstudiohdr->numbones;
@ -1154,7 +1133,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
if (pseqdesc->numblends == 9 && sequence < ANIM_FIRST_DEATH_SEQUENCE && sequence != ANIM_SWIM_1 && sequence != ANIM_SWIM_2)
{
int copy = 1;
bool bCopy = true;
int gaitsequence = GetPlayerGaitsequence(pEdict); // calc gait animation
if (gaitsequence < 0 || gaitsequence >= g_pstudiohdr->numseq)
@ -1169,14 +1148,14 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
{
if (!Q_strcmp(pbones[i].name, "Bip01 Spine"))
{
copy = 0;
bCopy = 0;
}
else if (!Q_strcmp(pbones[pbones[i].parent].name, "Bip01 Pelvis"))
{
copy = 1;
bCopy = 1;
}
if (copy)
if (bCopy)
{
Q_memcpy(pos[i], pos2[i], sizeof(pos[i]));
Q_memcpy(q[i], q2[i], sizeof(q[i]));
@ -1187,9 +1166,9 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
VectorCopy(angles, temp_angles);
#ifndef REGAMEDLL_FIXES
if (pEdict != NULL)
if (pEdict)
#else
if (pEdict != NULL && CBaseEntity::Instance(const_cast<edict_t *>(pEdict))->IsPlayer())
if (pEdict && CBaseEntity::Instance(const_cast<edict_t *>(pEdict))->IsPlayer())
#endif
{
temp_angles[1] = UTIL_GetPlayerGaitYaw(ENTINDEX(pEdict));

View File

@ -1871,7 +1871,7 @@ public:
void InstallBotControl();
void Bot_ServerCommand();
void Bot_RegisterCvars();
void Bot_RegisterCVars();
int GetBotFollowCount(CBasePlayer *leader);
const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange);

View File

@ -49,6 +49,8 @@ class BotMeme
{
public:
void Transmit(CCSBot *sender) const; // transmit meme to other bots
virtual ~BotMeme(){}
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const = 0; // cause the given bot to act on this meme
};

View File

@ -269,7 +269,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa
Run();
m_goalEntity = entity;
MoveTo(&entity->pev->origin, (RouteType)(m_hostageEscortCount == 0));
MoveTo(&entity->pev->origin, m_hostageEscortCount == 0 ? SAFEST_ROUTE : FASTEST_ROUTE);
PrintIfWatched("I'm fetching a hostage that called out to me\n");
return;

View File

@ -61,7 +61,7 @@ void Bot_ServerCommand()
}
}
void Bot_RegisterCvars()
void Bot_RegisterCVars()
{
if (!AreBotsAllowed())
return;

View File

@ -776,9 +776,6 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
if (IMPL(m_isLearningMap))
return false;
if (!AreBotsAllowed())
return false;
const BotProfile *profile = NULL;
if (!isFromConsole || CMD_ARGC() < 2)
@ -848,8 +845,10 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
// Keep a minimum quota of bots in the game
void CCSBotManager::MaintainBotQuota()
{
#ifdef REGAMEDLL_FIXES
if (!AreBotsAllowed())
return;
#endif
if (IMPL(m_isLearningMap))
return;
@ -887,8 +886,15 @@ void CCSBotManager::MaintainBotQuota()
{
// don't try to add a bot if all teams are full
if (!CSGameRules()->TeamFull(TERRORIST) || !CSGameRules()->TeamFull(CT))
{
#ifndef REGAMEDLL_FIXES
if (AreBotsAllowed())
#endif
{
BotAddCommand(BOT_TEAM_ANY);
}
}
}
else if (desiredBotCount < botsInGame)
{
// kick a bot to maintain quota

View File

@ -267,12 +267,20 @@ void CCSBot::Attack(CBasePlayer *victim)
if (IsAttacking())
return;
// if we are currently hiding, increase our chances of crouching and holding position
if (IsAtHidingSpot())
m_attackState.SetCrouchAndHold((RANDOM_FLOAT(0, 100) < 60.0f) != 0);
else
m_attackState.SetCrouchAndHold(false);
PrintIfWatched("ATTACK BEGIN (reaction time = %g (+ update time), surprise time = %g, attack delay = %g)\n");
PrintIfWatched("ATTACK BEGIN (reaction time = %g (+ update time), surprise time = %g, attack delay = %g)\n"
#ifdef REGAMEDLL_FIXES
, GetProfile()->GetReactionTime(), m_surpriseDelay, GetProfile()->GetAttackDelay()
#endif
);
m_isAttacking = true;
m_attackState.OnEnter(this);

View File

@ -5,8 +5,6 @@
*/
#ifndef HOOK_GAMEDLL
float g_flTimeLimit = 0;
float g_flResetTime = 0;
bool g_bClientPrintEnable = true;
char *sPlayerModelFiles[] =
@ -57,10 +55,9 @@ static entity_field_alias_t custom_entity_field_alias[] =
{ "animtime", 0 },
};
bool g_bServerActive = false;
#endif // HOOK_GAMEDLL
bool g_bServerActive = false;
PLAYERPVSSTATUS g_PVSStatus[MAX_CLIENTS];
unsigned short m_usResetDecals;
unsigned short g_iShadowSprite;
@ -991,7 +988,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
return;
}
int fullArmor = (pPlayer->pev->armorvalue >= 100);
bool bFullArmor = (pPlayer->pev->armorvalue >= 100);
bool bHasHelmet = (pPlayer->m_iKevlar == ARMOR_VESTHELM);
bool bEnoughMoney = false;
@ -1003,7 +1000,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
if (pPlayer->HasRestrictItem(ITEM_KEVLAR, ITEM_TYPE_BUYING))
return;
#endif
if (fullArmor)
if (bFullArmor)
{
if (g_bClientPrintEnable)
{
@ -1032,7 +1029,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
if (pPlayer->HasRestrictItem(ITEM_ASSAULT, ITEM_TYPE_BUYING))
return;
#endif
if (fullArmor)
if (bFullArmor)
{
if (bHasHelmet)
{
@ -2090,9 +2087,9 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
WeaponIdType weaponID = WEAPON_NONE;
const char *weaponFailName = BuyAliasToWeaponID(pszCommand, weaponID);
// Ok, we have weapon info ID.
if (weaponID != WEAPON_NONE)
{
// Ok, we have weapon info ID.
// 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)))
{
@ -2464,15 +2461,15 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
{
if (gpGlobals->time > player->m_iTimeCheckAllowed)
{
player->m_iTimeCheckAllowed = int(gpGlobals->time + 1);
player->m_iTimeCheckAllowed = int(gpGlobals->time + 1.0f);
if (!timelimit.value)
{
ClientPrint(player->pev, HUD_PRINTTALK, "#Game_no_timelimit");
return;
}
int iTimeRemaining = int(g_flTimeLimit - gpGlobals->time);
#ifndef REGAMEDLL_FIXES
int iTimeRemaining = (int)CSGameRules()->GetTimeLeft();
if (iTimeRemaining < 0)
iTimeRemaining = 0;
@ -2497,6 +2494,10 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
}
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
}
}
else if (FStrEq(pcmd, "listplayers"))
@ -3338,6 +3339,7 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
#ifdef REGAMEDLL_ADD
CSGameRules()->ServerActivate();
#endif
}
void EXT_FUNC PlayerPreThink(edict_t *pEntity)

View File

@ -101,13 +101,10 @@ struct entity_field_alias_t
int field;
};
C_DLLEXPORT float g_flTimeLimit;
C_DLLEXPORT int CountTeams();
C_DLLEXPORT int CountTeamPlayers(int iTeam);
extern bool g_bServerActive;
extern float g_flResetTime;
extern bool g_skipCareerInitialSpawn;
extern unsigned short m_usResetDecals;

View File

@ -1034,15 +1034,21 @@ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
{
float retval = 0.0f;
TraceResult tr;
Vector spot;
const float topOfHead = 25.0f;
const float standFeet = 34.0f;
const float crouchFeet = 14.0f;
const float edgeOffset = 13.0f;
const float damagePercentageChest = 0.40f;
const float damagePercentageHead = 0.20f;
const float damagePercentageFeet = 0.20f;
const float damagePercentageRightSide = 0.10f;
const float damagePercentageLeftSide = 0.10f;
if (!entity->IsPlayer())
{
// the entity is not a player, so the damage is all or nothing.
UTIL_TraceLine(vecSrc, entity->pev->origin, ignore_monsters, NULL, &tr);
if (tr.flFraction == 1.0f)
@ -1051,46 +1057,47 @@ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
return retval;
}
UTIL_TraceLine(vecSrc, entity->pev->origin, ignore_monsters, NULL, &tr);
// check chest
Vector vecChest = entity->pev->origin;
UTIL_TraceLine(vecSrc, vecChest, ignore_monsters, NULL, &tr);
if (tr.flFraction == 1.0f)
retval += 0.4f;
retval += damagePercentageChest;
spot = entity->pev->origin + Vector(0, 0, topOfHead);
UTIL_TraceLine(vecSrc, spot, ignore_monsters, NULL, &tr);
// check top of head
Vector vecHead = entity->pev->origin + Vector(0, 0, topOfHead);
UTIL_TraceLine(vecSrc, vecHead, ignore_monsters, NULL, &tr);
if (tr.flFraction == 1.0f)
retval += 0.2f;
retval += damagePercentageHead;
spot = entity->pev->origin;
if (entity->pev->flags & FL_DUCKING)
spot.z -= crouchFeet;
else
spot.z -= standFeet;
// check feet
Vector vecFeet = entity->pev->origin;
vecFeet.z -= (entity->pev->flags & FL_DUCKING) ? crouchFeet : standFeet;
UTIL_TraceLine(vecSrc, spot, ignore_monsters, NULL, &tr);
UTIL_TraceLine(vecSrc, vecFeet, ignore_monsters, NULL, &tr);
if (tr.flFraction == 1.0f)
retval += 0.2f;
retval += damagePercentageFeet;
Vector2D dir = (entity->pev->origin - vecSrc).Make2D();
dir.NormalizeInPlace();
Vector2D perp(-dir.y * edgeOffset, dir.x * edgeOffset);
Vector vecRightSide = entity->pev->origin + Vector(perp.x, perp.y, 0);
Vector vecLeftSide = entity->pev->origin - Vector(perp.x, perp.y, 0);
spot = entity->pev->origin + Vector(perp.x, perp.y, 0);
UTIL_TraceLine(vecSrc, spot, ignore_monsters, NULL, &tr);
// check right "edge"
UTIL_TraceLine(vecSrc, vecRightSide, ignore_monsters, NULL, &tr);
if (tr.flFraction == 1.0f)
retval += 0.1;
retval += damagePercentageRightSide;
spot = entity->pev->origin - Vector(perp.x, perp.y, 0);
UTIL_TraceLine(vecSrc, spot, ignore_monsters, NULL, &tr);
// check left "edge"
UTIL_TraceLine(vecSrc, vecLeftSide, ignore_monsters, NULL, &tr);
if (tr.flFraction == 1.0f)
retval += 0.1;
retval += damagePercentageLeftSide;
return retval;
}

View File

@ -16,8 +16,10 @@ cvar_t timelimit = { "mp_timelimit", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t flashlight = { "mp_flashlight", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t decalfrequency = { "decalfrequency", "30", FCVAR_SERVER, 0.0f, NULL };
cvar_t fadetoblack = { "mp_fadetoblack", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t fragsleft = { "mp_fragsleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL };
cvar_t fragsleft = { "mp_fragsleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL }; // Don't spam console/log files/users with this changing
cvar_t timeleft = { "mp_timeleft", "0", FCVAR_SERVER | FCVAR_UNLOGGED, 0.0f, NULL };
cvar_t friendlyfire = { "mp_friendlyfire", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t allowmonsters = { "mp_allowmonsters", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t roundtime = { "mp_roundtime", "5", FCVAR_SERVER, 0.0f, NULL };
@ -106,6 +108,10 @@ cvar_t refill_bpammo_weapons = { "mp_refill_bpammo_weapons", "0", 0, 0.0f, nullp
cvar_t freeforall = { "mp_freeforall", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t auto_join_team = { "mp_auto_join_team", "0", 0, 0.0f, nullptr };
cvar_t max_teamkills = { "mp_max_teamkills", "3", 0, 3.0f, nullptr };
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?
void GameDLL_Version_f()
{
@ -238,6 +244,9 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&freeforall);
CVAR_REGISTER(&auto_join_team);
CVAR_REGISTER(&max_teamkills);
CVAR_REGISTER(&fraglimit);
CVAR_REGISTER(&showtriggers);
// print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");
@ -245,7 +254,7 @@ void EXT_FUNC GameDLLInit()
#endif // REGAMEDLL_ADD
Bot_RegisterCvars();
Bot_RegisterCVars();
Tutor_RegisterCVars();
Hostage_RegisterCVars();
}

View File

@ -143,6 +143,9 @@ extern cvar_t refill_bpammo_weapons;
extern cvar_t freeforall;
extern cvar_t auto_join_team;
extern cvar_t max_teamkills;
extern cvar_t fraglimit;
extern cvar_t showtriggers;
#endif

View File

@ -347,7 +347,7 @@ public:
#endif
public:
BOOL m_bFreezePeriod;
BOOL m_bFreezePeriod; // TRUE at beginning of round, set to FALSE when the period expires
BOOL m_bBombDropped;
// custom
@ -702,6 +702,7 @@ public:
// Check various conditions to end the map.
bool CheckGameOver();
bool CheckTimeLimit();
bool CheckFragLimit();
bool CheckMaxRounds();
bool CheckWinLimit();
@ -721,7 +722,9 @@ public:
bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
void MarkSpawnSkipped() { m_bSkipSpawn = false; }
void PlayerJoinedTeam(CBasePlayer *pPlayer) { }
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
float GetRoundRemainingTime() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTime; }
float GetTimeLeft() const { return m_flTimeLimit - gpGlobals->time; }
BOOL TeamFull(int team_id);
BOOL TeamStacked(int newTeam_id, int curTeam_id);
bool IsVIPQueueEmpty();
@ -750,7 +753,7 @@ public:
VFUNC BOOL IsThereABomb();
VFUNC TeamName SelectDefaultTeam();
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
bool IsMatchStarted() { return (m_flRestartRoundTime != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
void SendMOTDToClient(edict_t *client);
void TerminateRound(float tmDelay, int iWinStatus);
@ -769,9 +772,9 @@ public:
static RewardAccount m_rgRewardAccountRules[];
CVoiceGameMgr m_VoiceGameMgr;
float m_fTeamCount; // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0
float m_flRestartRoundTime; // The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount)
float m_flCheckWinConditions;
float m_fRoundCount;
float m_fRoundStartTime; // Time round has started (deprecated name m_fRoundCount)
int m_iRoundTime; // (From mp_roundtime) - How many seconds long this round is.
int m_iRoundTimeSecs;
int m_iIntroRoundTime; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is.
@ -857,6 +860,8 @@ protected:
bool m_bSkipShowMenu;
bool m_bNeededPlayers;
float m_flEscapeRatio;
float m_flTimeLimit;
float m_flGameStartTime;
};
typedef struct mapcycle_item_s
@ -894,15 +899,16 @@ extern CGameRules DLLEXPORT *g_pGameRules;
CGameRules *InstallGameRules();
CGameRules *InstallGameRules_();
// Gets us at the CS game rules
inline CHalfLifeMultiplay *CSGameRules()
{
return reinterpret_cast<CHalfLifeMultiplay *>(g_pGameRules);
return static_cast<CHalfLifeMultiplay *>(g_pGameRules);
}
inline void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus)
{
m_iRoundWinStatus = iWinStatus;
m_fTeamCount = gpGlobals->time + tmDelay;
m_flRestartRoundTime = gpGlobals->time + tmDelay;
m_bRoundTerminating = true;
}

View File

@ -499,7 +499,7 @@ void CHostage::IdleThink()
{
m_vOldPos = pev->origin;
if (!CSGameRules()->m_fTeamCount)
if (!CSGameRules()->m_flRestartRoundTime)
{
SendHostagePositionMsg();
}
@ -657,7 +657,7 @@ BOOL CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevA
CSGameRules()->CheckWinConditions();
if (!CSGameRules()->m_fTeamCount)
if (!CSGameRules()->m_flRestartRoundTime)
SendHostageEventMsg();
pev->nextthink = gpGlobals->time + 3.0f;

View File

@ -152,7 +152,7 @@ public:
return m_improv->IsFollowing();
}
if (entity == NULL && m_hTargetEnt == NULL || (entity != NULL && m_hTargetEnt != entity))
if ((!entity && !m_hTargetEnt) || (entity != NULL && m_hTargetEnt != entity))
return false;
if (m_State != FOLLOW)

View File

@ -1246,7 +1246,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity
{
Frighten(TERRIFIED);
if (!entity->IsPlayer() || entity->IsPlayer() && ((CBasePlayer *)entity)->m_iTeam != TERRORIST)
if (!entity->IsPlayer() || (entity->IsPlayer() && ((CBasePlayer *)entity)->m_iTeam != TERRORIST))
{
DelayedChatter(RANDOM_FLOAT(0.5f, 0.7f), HOSTAGE_CHATTER_SCARED_OF_MURDER, true);
}

View File

@ -57,9 +57,9 @@ bool IsBotSpeaking()
void SV_Continue_f()
{
if (CSGameRules()->IsCareer() && CSGameRules()->m_fTeamCount > 100000.0)
if (CSGameRules()->IsCareer() && CSGameRules()->m_flRestartRoundTime > 100000.0)
{
CSGameRules()->m_fTeamCount = gpGlobals->time;
CSGameRules()->m_flRestartRoundTime = gpGlobals->time;
// go continue
MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer);
@ -414,7 +414,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
m_flIntermissionEndTime = 0;
m_flIntermissionStartTime = 0;
m_fTeamCount = 0;
m_flRestartRoundTime = 0;
m_iAccountCT = 0;
m_iAccountTerrorist = 0;
@ -542,7 +542,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
}
}
m_fRoundCount = 0;
m_fRoundStartTime = 0;
m_fIntroRoundCount = 0;
#ifndef CSTRIKE
@ -591,6 +591,8 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
m_bSkipShowMenu = false;
m_bNeededPlayers = false;
m_flEscapeRatio = 0.0f;
m_flTimeLimit = 0.0f;
m_flGameStartTime = 0.0f;
#ifndef REGAMEDLL_FIXES
g_pMPGameRules = this;
@ -1533,11 +1535,7 @@ void CHalfLifeMultiplay::SwapAllPlayers()
}
// Swap Team victories
int iTemp;
iTemp = m_iNumTerroristWins;
m_iNumTerroristWins = m_iNumCTWins;
m_iNumCTWins = iTemp;
SWAP(m_iNumTerroristWins, m_iNumCTWins);
// Update the clients team score
UpdateTeamScores();
@ -1749,11 +1747,11 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
CVAR_SET_FLOAT("mp_timelimit", 0);
}
g_flResetTime = gpGlobals->time;
m_flGameStartTime = gpGlobals->time;
// Reset timelimit
if (timelimit.value)
g_flTimeLimit = gpGlobals->time + (timelimit.value * 60);
m_flTimeLimit = gpGlobals->time + (timelimit.value * 60);
// Reset total # of rounds played
m_iTotalRoundsPlayed = 0;
@ -1924,7 +1922,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
// Update individual players accounts and respawn players
// the round time stamp must be set before players are spawned
m_fIntroRoundCount = m_fRoundCount = gpGlobals->time;
m_fIntroRoundCount = m_fRoundStartTime = gpGlobals->time;
// Adrian - No cash for anyone at first rounds! ( well, only the default. )
if (m_bCompleteReset)
@ -2031,7 +2029,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
// Reset game variables
m_flIntermissionEndTime = 0;
m_flIntermissionStartTime = 0;
m_fTeamCount = 0.0;
m_flRestartRoundTime = 0.0;
m_iAccountTerrorist = m_iAccountCT = 0;
m_iHostagesRescued = 0;
m_iHostagesTouched = 0;
@ -2353,10 +2351,10 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)()
CVAR_SET_FLOAT("sv_clienttrace", 1);
}
if (!m_fRoundCount)
if (!m_fRoundStartTime)
{
// intialize the timer time stamps, this happens once only
m_fIntroRoundCount = m_fRoundCount = gpGlobals->time;
// initialize the timer time stamps, this happens once only
m_fIntroRoundCount = m_fRoundStartTime = gpGlobals->time;
}
if (m_flForceCameraValue != forcecamera.value
@ -2382,6 +2380,10 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)()
if (CheckTimeLimit())
return;
// did somebody hit the fraglimit ?
if (CheckFragLimit())
return;
if (!IsCareer())
{
// have we hit the max rounds?
@ -2413,7 +2415,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)()
CheckRoundTimeExpired();
}
if (m_fTeamCount != 0.0f && m_fTeamCount <= gpGlobals->time)
if (m_flRestartRoundTime > 0.0f && m_flRestartRoundTime <= gpGlobals->time)
{
if (!IsCareer() || !m_fCareerRoundMenuTime)
{
@ -2423,7 +2425,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)()
{
bool isBotSpeaking = false;
if (m_fTeamCount + 10.0f > gpGlobals->time)
if (m_flRestartRoundTime + 10.0f > gpGlobals->time)
{
isBotSpeaking = IsBotSpeaking();
}
@ -2480,7 +2482,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)()
MESSAGE_END();
pPlayer->m_iHideHUD |= HIDEHUD_ALL;
m_fTeamCount = gpGlobals->time + 100000.0;
m_flRestartRoundTime = gpGlobals->time + 100000.0;
UTIL_LogPrintf("Career Round %d %d %d %d\n", m_iRoundWinStatus, m_iNumCTWins, m_iNumTerroristWins, TheCareerTasks->AreAllTasksComplete());
break;
@ -2568,6 +2570,7 @@ bool CHalfLifeMultiplay::CheckGameOver()
// someone else quit the game already
if (g_fGameOver)
{
// bounds check
int time = int(CVAR_GET_FLOAT("mp_chattime"));
if (time < 1)
@ -2576,7 +2579,6 @@ bool CHalfLifeMultiplay::CheckGameOver()
else if (time > MAX_INTERMISSION_TIME)
CVAR_SET_STRING("mp_chattime", UTIL_dtos1(MAX_INTERMISSION_TIME));
// bounds check
m_flIntermissionEndTime = m_flIntermissionStartTime + mp_chattime.value;
// check to see if we should change levels now
@ -2599,9 +2601,7 @@ bool CHalfLifeMultiplay::CheckGameOver()
bool CHalfLifeMultiplay::CheckTimeLimit()
{
float fTimeLimit = timelimit.value;
if (fTimeLimit < 0)
if (timelimit.value < 0)
{
CVAR_SET_FLOAT("mp_timelimit", 0);
return false;
@ -2609,12 +2609,11 @@ bool CHalfLifeMultiplay::CheckTimeLimit()
if (!IsCareer())
{
if (fTimeLimit != 0.0f)
if (timelimit.value)
{
g_flTimeLimit = g_flResetTime + fTimeLimit * 60.0f;
}
m_flTimeLimit = m_flGameStartTime + timelimit.value * 60.0f;
if (fTimeLimit > 0 && gpGlobals->time >= g_flTimeLimit)
if (gpGlobals->time >= m_flTimeLimit)
{
ALERT(at_console, "Changing maps because time limit has been met\n");
GoToIntermission();
@ -2622,6 +2621,19 @@ bool CHalfLifeMultiplay::CheckTimeLimit()
}
}
#ifdef REGAMEDLL_ADD
static int lastTime = 0;
int timeRemaining = (int)(timelimit.value ? (m_flTimeLimit - gpGlobals->time) : 0);
// Updates once per second
if (timeRemaining != lastTime)
{
lastTime = timeRemaining;
g_engfuncs.pfnCvar_DirectSet(&timeleft, UTIL_VarArgs("%02d:%02d", timeRemaining / 60, timeRemaining % 60));
}
#endif
}
return false;
}
@ -2653,9 +2665,56 @@ bool CHalfLifeMultiplay::CheckWinLimit()
return false;
}
bool CHalfLifeMultiplay::CheckFragLimit()
{
#ifdef REGAMEDLL_ADD
int fragsRemaining = 0;
if (fraglimit.value)
{
int bestFrags = fraglimit.value;
// check if any player is over the frag limit
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
auto pPlayer = UTIL_PlayerByIndex(i);
if (!pPlayer || pPlayer->has_disconnected)
continue;
if (pPlayer->pev->frags >= fraglimit.value)
{
ALERT(at_console, "Changing maps because frag limit has been met\n");
GoToIntermission();
return true;
}
int remain = (int)(fraglimit.value - pPlayer->pev->frags);
if (remain < bestFrags)
{
bestFrags = remain;
}
}
fragsRemaining = bestFrags;
}
static int lastFrags = 0;
// Updates when frags change
if (fragsRemaining != lastFrags)
{
lastFrags = fragsRemaining;
g_engfuncs.pfnCvar_DirectSet(&fragsleft, UTIL_VarArgs("%i", fragsRemaining));
}
#endif
return false;
}
void CHalfLifeMultiplay::CheckFreezePeriodExpired()
{
if (TimeRemaining() > 0)
if (GetRoundRemainingTime() > 0)
return;
// Log this information
@ -2700,7 +2759,7 @@ void CHalfLifeMultiplay::CheckFreezePeriodExpired()
}
// Reset the round time
m_fRoundCount = gpGlobals->time;
m_fRoundStartTime = gpGlobals->time;
// in seconds
m_iRoundTimeSecs = m_iRoundTime;
@ -2843,12 +2902,12 @@ void CHalfLifeMultiplay::CheckRoundTimeExpired()
float flEndRoundTime;
// Check to see if there's still a live C4 hanging around.. if so, wait until this C4 blows before ending the round
CGrenade *C4 = (CGrenade *)UTIL_FindEntityByClassname(NULL, "grenade");
CGrenade *pBomb = (CGrenade *)UTIL_FindEntityByClassname(NULL, "grenade");
if (C4 != NULL)
if (pBomb)
{
if (!C4->m_bJustBlew)
flEndRoundTime = C4->m_flC4Blow;
if (!pBomb->m_bJustBlew)
flEndRoundTime = pBomb->m_flC4Blow;
else
flEndRoundTime = gpGlobals->time + 5.0f;
}
@ -2877,7 +2936,7 @@ void CHalfLifeMultiplay::CheckRoundTimeExpired()
}
// This is done so that the portion of code has enough time to do it's thing.
m_fRoundCount = gpGlobals->time + 60.0f;
m_fRoundStartTime = gpGlobals->time + 60.0f;
}
void CHalfLifeMultiplay::CheckLevelInitialized()
@ -2927,7 +2986,7 @@ void CHalfLifeMultiplay::CheckRestartRound()
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Game_will_restart_in", UTIL_dtos1(iRestartDelay), (iRestartDelay == 1) ? "SECOND" : "SECONDS");
UTIL_ClientPrintAll(HUD_PRINTCONSOLE, "#Game_will_restart_in_console", UTIL_dtos1(iRestartDelay), (iRestartDelay == 1) ? "SECOND" : "SECONDS");
m_fTeamCount = gpGlobals->time + iRestartDelay;
m_flRestartRoundTime = gpGlobals->time + iRestartDelay;
m_bCompleteReset = true;
CVAR_SET_FLOAT("sv_restartround", 0);
@ -2940,7 +2999,7 @@ void CHalfLifeMultiplay::CheckRestartRound()
bool CHalfLifeMultiplay::HasRoundTimeExpired()
{
// We haven't completed other objectives, so go for this!.
if (TimeRemaining() > 0 || m_iRoundWinStatus != WINNER_NONE)
if (GetRoundRemainingTime() > 0 || m_iRoundWinStatus != WINNER_NONE)
{
return false;
}
@ -3001,9 +3060,9 @@ void CHalfLifeMultiplay::CareerRestart()
{
g_fGameOver = FALSE;
if (m_fTeamCount == 0.0f)
if (m_flRestartRoundTime == 0.0f)
{
m_fTeamCount = gpGlobals->time + 1.0f;
m_flRestartRoundTime = gpGlobals->time + 1.0f;
}
// for reset everything
@ -3534,7 +3593,7 @@ BOOL CHalfLifeMultiplay::__API_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer)
if (m_iNumTerrorist > 0 && m_iNumCT > 0)
{
if (gpGlobals->time > m_fRoundCount + GetRoundRespawnTime())
if (gpGlobals->time > m_fRoundStartTime + GetRoundRespawnTime())
{
// If this player just connected and fadetoblack is on, then maybe
// the server admin doesn't want him peeking around.
@ -4599,8 +4658,13 @@ void CHalfLifeMultiplay::__API_VHOOK(ChangeLevel)()
char szRules[1500];
int minplayers = 0, maxplayers = 0;
#ifdef REGAMEDLL_FIXES
// the absolute default level is de_dust
Q_strcpy(szFirstMapInList, "de_dust");
#else
// the absolute default level is hldm1
Q_strcpy(szFirstMapInList, "hldm1");
#endif
int curplayers;
bool do_cycle = true;
@ -4821,5 +4885,4 @@ TeamName CHalfLifeMultiplay::SelectDefaultTeam()
}
return team;
}

View File

@ -570,7 +570,7 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch
CBasePlayer *pTarget = static_cast<CBasePlayer *>(CBaseEntity::Instance(pPlayer->m_hObserverTarget->pev));
if (pTarget != NULL && pTarget->m_iTeam == m_iTeam)
if (pTarget && pTarget->m_iTeam == m_iTeam)
{
bSend = true;
}
@ -1690,6 +1690,10 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit)
pev->viewmodel = 0;
pev->weaponmodel = 0;
#ifdef REGAMEDLL_FIXES
m_iHideHUD |= HIDEHUD_WEAPONS;
#endif
if (removeSuit)
pev->weapons = 0;
else
@ -3231,7 +3235,7 @@ void CBasePlayer::SyncRoundTimer()
float tmRemaining;
if (CSGameRules()->IsMultiplayer())
tmRemaining = CSGameRules()->TimeRemaining();
tmRemaining = CSGameRules()->GetRoundRemainingTime();
else
tmRemaining = 0;
@ -3260,7 +3264,7 @@ void CBasePlayer::SyncRoundTimer()
if (tmRemaining != 0.0f)
{
remaining = TheCareerTasks->GetTaskTime() - (gpGlobals->time - CSGameRules()->m_fRoundCount);
remaining = TheCareerTasks->GetTaskTime() - (gpGlobals->time - CSGameRules()->m_fRoundStartTime);
}
if (remaining < 0)
@ -3418,7 +3422,7 @@ void CBasePlayer::JoiningThink()
Spawn();
CSGameRules()->CheckWinConditions();
if (!CSGameRules()->m_fTeamCount && CSGameRules()->m_bMapHasBombTarget && !CSGameRules()->IsThereABomber() && !CSGameRules()->IsThereABomb())
if (!CSGameRules()->m_flRestartRoundTime && CSGameRules()->m_bMapHasBombTarget && !CSGameRules()->IsThereABomber() && !CSGameRules()->IsThereABomb())
{
CSGameRules()->GiveC4();
}
@ -4179,7 +4183,7 @@ bool CBasePlayer::CanPlayerBuy(bool display)
CVAR_SET_FLOAT("mp_buytime", (MIN_BUY_TIME / 60.0f));
}
if (gpGlobals->time - CSGameRules()->m_fRoundCount > buyTime)
if (gpGlobals->time - CSGameRules()->m_fRoundStartTime > buyTime)
{
if (display)
{
@ -4630,7 +4634,7 @@ void CBasePlayer::CheckSuitUpdate()
// play a sentence off of the end of the queue
for (i = 0; i < CSUITPLAYLIST; ++i)
{
if (isentence = m_rgSuitPlayList[ isearch ])
if ((isentence = m_rgSuitPlayList[ isearch ]))
break;
if (++isearch == CSUITPLAYLIST)
@ -6428,6 +6432,9 @@ BOOL CBasePlayer::__API_VHOOK(AddPlayerItem)(CBasePlayerItem *pItem)
SwitchWeapon(pItem);
}
}
#ifdef REGAMEDLL_FIXES
m_iHideHUD &= ~HIDEHUD_WEAPONS;
#endif
return TRUE;
}
@ -7432,7 +7439,7 @@ void CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszItemName)
SetBombIcon(FALSE);
pWeapon->m_pPlayer->SetProgressBarTime(0);
if (!CSGameRules()->m_fTeamCount)
if (!CSGameRules()->m_flRestartRoundTime)
{
UTIL_LogPrintf("\"%s<%i><%s><TERRORIST>\" triggered \"Dropped_The_Bomb\"\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()));
g_pGameRules->m_bBombDropped = TRUE;
@ -7730,7 +7737,7 @@ BOOL CBasePlayer::SwitchWeapon(CBasePlayerItem *pWeapon)
ResetAutoaim();
if (m_pActiveItem != NULL)
if (m_pActiveItem)
{
m_pActiveItem->Holster();
}
@ -7738,9 +7745,10 @@ BOOL CBasePlayer::SwitchWeapon(CBasePlayerItem *pWeapon)
CBasePlayerItem *pTemp = m_pActiveItem;
m_pActiveItem = pWeapon;
m_pLastItem = pTemp;
pWeapon->Deploy();
if (pWeapon->m_pPlayer != NULL)
if (pWeapon->m_pPlayer)
{
pWeapon->m_pPlayer->ResetMaxSpeed();
}
@ -8191,7 +8199,7 @@ void CBasePlayer::SpawnClientSideCorpse()
m_canSwitchObserverModes = true;
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_CLIENT_CORPSE_SPAWNED, this);
}
@ -8293,30 +8301,15 @@ bool CBasePlayer::IsLookingAtPosition(Vector *pos, float angleTolerance)
bool CBasePlayer::CanAffordPrimary()
{
int account = m_iAccount;
auto team = (m_iTeam == CT) ? TERRORIST : (m_iTeam == TERRORIST) ? CT : UNASSIGNED;
if (team == UNASSIGNED)
return false;
if (m_iTeam == CT)
for (auto& weapon : g_weaponStruct)
{
WeaponStruct *temp;
for (int i = 0; i < MAX_WEAPONS; ++i)
{
temp = &g_weaponStruct[ i ];
if ((temp->m_side & TERRORIST) && temp->m_slot == PRIMARY_WEAPON_SLOT && account >= temp->m_price)
if ((weapon.m_side & team) && weapon.m_slot == PRIMARY_WEAPON_SLOT && m_iAccount >= weapon.m_price)
return true;
}
}
else if (m_iTeam == TERRORIST)
{
WeaponStruct *temp;
for (int i = 0; i < MAX_WEAPONS; ++i)
{
temp = &g_weaponStruct[ i ];
if ((temp->m_side & CT) && temp->m_slot == PRIMARY_WEAPON_SLOT && account >= temp->m_price)
return true;
}
}
return false;
}
@ -8325,11 +8318,9 @@ bool CBasePlayer::CanAffordPrimaryAmmo()
{
CBasePlayerWeapon *primary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]);
for (int i = 0; i < MAX_WEAPONS; ++i)
for (auto& weapon : g_weaponStruct)
{
WeaponStruct *temp = &g_weaponStruct[ i ];
if (temp->m_type == primary->m_iId && m_iAccount >= temp->m_ammoPrice)
if (weapon.m_type == primary->m_iId && m_iAccount >= weapon.m_ammoPrice)
return true;
}
@ -8340,11 +8331,9 @@ bool CBasePlayer::CanAffordSecondaryAmmo()
{
CBasePlayerWeapon *secondary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ PISTOL_SLOT ]);
for (int i = 0; i < MAX_WEAPONS; ++i)
for (auto& weapon : g_weaponStruct)
{
WeaponStruct *temp = &g_weaponStruct[ i ];
if (temp->m_type == secondary->m_iId && m_iAccount >= temp->m_ammoPrice)
if (weapon.m_type == secondary->m_iId && m_iAccount >= weapon.m_ammoPrice)
return true;
}
@ -8596,9 +8585,10 @@ bool IsSecondaryWeaponId(int id)
const char *GetWeaponAliasFromName(const char *weaponName)
{
if (!Q_strncmp(weaponName, "weapon_", 7))
const char cut_weapon[] = "weapon_";
if (!Q_strncmp(weaponName, cut_weapon, sizeof(cut_weapon) - 1))
{
weaponName += 7;
weaponName += sizeof(cut_weapon) - 1;
}
return weaponName;
@ -8674,11 +8664,7 @@ const char *CBasePlayer::PickPrimaryCareerTaskWeapon()
{
// randomize names weapons of list
int rand = RANDOM_LONG(0, taskNum - 1);
CCareerTask *temp = taskVector[0];
taskVector[0] = taskVector[rand];
taskVector[rand] = temp;
SWAP(taskVector[0], taskVector[rand]);
}
if (!taskNum)
@ -8754,11 +8740,7 @@ const char *CBasePlayer::PickSecondaryCareerTaskWeapon()
{
// randomize names weapons of list
int rand = RANDOM_LONG(0, taskNum - 1);
CCareerTask *temp = taskVector[0];
taskVector[0] = taskVector[rand];
taskVector[rand] = temp;
SWAP(taskVector[0], taskVector[rand]);
}
if (!taskNum)

View File

@ -606,7 +606,7 @@ public:
void RemoveBomb();
CBasePlayerItem *GetItemOfNamed(const char *pszItemName);
#ifdef REGAMEDLL_ADD
#ifdef REGAMEDLL_API
CCSPlayer *CSPlayer() const;
#endif
@ -843,7 +843,7 @@ inline bool CBasePlayer::IsReloading() const
return false;
}
#ifdef REGAMEDLL_ADD
#ifdef REGAMEDLL_API
inline CCSPlayer *CBasePlayer::CSPlayer() const {
return reinterpret_cast<CCSPlayer *>(this->m_pEntity);
}

View File

@ -45,7 +45,7 @@ void CHalfLifeTraining::HostageDied()
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(1);
if (pPlayer != NULL)
if (pPlayer)
{
pPlayer->pev->radsuit_finished = gpGlobals->time + 3.0f;
}
@ -134,9 +134,9 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
}
CGrenade *pBomb = NULL;
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")) != NULL)
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
{
if (pBomb->m_pentCurBombTarget != NULL)
if (pBomb->m_pentCurBombTarget)
pBomb->m_bStartDefuse = true;
}
@ -194,7 +194,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
pPlayer->pev->scale = pPlayer->m_iAccount;
pPlayer->pev->ideal_yaw = pPlayer->m_bHasDefuser;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, pPlayer);
}
@ -220,7 +220,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer)
CBaseEntity *pWeaponEntity = NULL;
while ((pWeaponEntity = UTIL_FindEntityByClassname(pWeaponEntity, "game_player_equip")) != NULL)
while ((pWeaponEntity = UTIL_FindEntityByClassname(pWeaponEntity, "game_player_equip")))
{
pWeaponEntity->Touch(pPlayer);
}
@ -259,7 +259,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)()
{
CGrenade *pBomb = NULL;
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")) != NULL)
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
{
if (!pBomb->m_bIsC4 || !pBomb->m_bJustBlew)
continue;
@ -274,7 +274,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)()
{
CGrenade *pBomb = NULL;
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")) != NULL)
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
{
if (!pBomb->m_bIsC4 || !pBomb->m_bJustBlew)
continue;
@ -291,7 +291,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)()
pHostage = CBaseEntity::Instance(FIND_ENTITY_BY_CLASSNAME(NULL, "hostage_entity"));
while (pHostage != NULL)
while (pHostage)
{
if (pHostage->pev->deadflag != DEAD_RESPAWNABLE || !FStringNull(pHostage->pev->noise1))
continue;
@ -304,7 +304,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)()
pFirstRescueArea = CBaseEntity::Instance(FIND_ENTITY_BY_CLASSNAME(NULL, "func_hostage_rescue"));
pRescueArea = pFirstRescueArea;
if (pFirstRescueArea != NULL)
if (pFirstRescueArea)
{
while (pRescueArea != pFirstRescueArea)
{
@ -365,7 +365,7 @@ void CBaseGrenCatch::__MAKE_VHOOK(Think)()
m_fSmokeTouching = false;
pGrenade = NULL;
while (pGrenade = (CGrenade *)UTIL_FindEntityByClassname(pGrenade, "grenade"))
while ((pGrenade = (CGrenade *)UTIL_FindEntityByClassname(pGrenade, "grenade")))
{
vMin = pGrenade->pev->mins;
vMax = pGrenade->pev->maxs;
@ -391,7 +391,7 @@ void CBaseGrenCatch::__MAKE_VHOOK(Think)()
{
pTrigger = NULL;
while ((pTrigger = UTIL_FindEntityByTargetname(pTrigger, STRING(sDisableOnGrenade))) != NULL)
while ((pTrigger = UTIL_FindEntityByTargetname(pTrigger, STRING(sDisableOnGrenade))))
{
// save solid
pTrigger->pev->team = pTrigger->pev->solid;
@ -406,7 +406,7 @@ void CBaseGrenCatch::__MAKE_VHOOK(Think)()
{
pTrigger = NULL;
while (pTrigger = UTIL_FindEntityByTargetname(pTrigger, STRING(sDisableOnGrenade)))
while ((pTrigger = UTIL_FindEntityByTargetname(pTrigger, STRING(sDisableOnGrenade))))
{
// restore solid
pTrigger->pev->solid = pTrigger->pev->team;

View File

@ -557,12 +557,44 @@ void CTriggerCDAudio::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC
PlayTrack();
}
#ifdef REGAMEDLL_FIXES
const char *g_szMP3trackFileMap[] =
{
"", "",
"media/Half-Life01.mp3",
"media/Prospero01.mp3",
"media/Half-Life12.mp3",
"media/Half-Life07.mp3",
"media/Half-Life10.mp3",
"media/Suspense01.mp3",
"media/Suspense03.mp3",
"media/Half-Life09.mp3",
"media/Half-Life02.mp3",
"media/Half-Life13.mp3",
"media/Half-Life04.mp3",
"media/Half-Life15.mp3",
"media/Half-Life14.mp3",
"media/Half-Life16.mp3",
"media/Suspense02.mp3",
"media/Half-Life03.mp3",
"media/Half-Life08.mp3",
"media/Prospero02.mp3",
"media/Half-Life05.mp3",
"media/Prospero04.mp3",
"media/Half-Life11.mp3",
"media/Half-Life06.mp3",
"media/Prospero03.mp3",
"media/Half-Life17.mp3",
"media/Prospero05.mp3",
"media/Suspense05.mp3",
"media/Suspense07.mp3"
};
#endif
void PlayCDTrack(int iTrack)
{
edict_t *pClient;
// manually find the single player.
pClient = INDEXENT(1);
edict_t *pClient = INDEXENT(1);
// Can't play if the client is not connected!
if (!pClient)
@ -576,15 +608,22 @@ void PlayCDTrack(int iTrack)
if (iTrack == -1)
{
#ifdef REGAMEDLL_FIXES
CLIENT_COMMAND(pClient, "mp3 stop\n");
#else
CLIENT_COMMAND(pClient, "cd stop\n");
#endif
}
else
{
#ifdef REGAMEDLL_FIXES
CLIENT_COMMAND(pClient, UTIL_VarArgs("mp3 play %s\n", g_szMP3trackFileMap[iTrack]));
#else
char string[64];
Q_sprintf(string, "cd play %3d\n", iTrack);
CLIENT_COMMAND(pClient, string);
#endif
}
}
// only plays for ONE client, so only use in single play!
@ -628,10 +667,8 @@ void CTargetCDAudio::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCa
// only plays for ONE client, so only use in single play!
void CTargetCDAudio::__MAKE_VHOOK(Think)()
{
edict_t *pClient;
// manually find the single player.
pClient = INDEXENT(1);
edict_t *pClient = INDEXENT(1);
// Can't play if the client is not connected!
if (!pClient)

View File

@ -2527,7 +2527,7 @@ void CCSTutor::CheckForTimeRunningOut()
{
CBasePlayer *localPlayer = UTIL_GetLocalPlayer();
if (localPlayer == NULL || CSGameRules()->IsFreezePeriod() || CSGameRules()->TimeRemaining() > 30.0f)
if (localPlayer == NULL || CSGameRules()->IsFreezePeriod() || CSGameRules()->GetRoundRemainingTime() > 30.0f)
return;
if (IsBombMap())

View File

@ -2361,11 +2361,14 @@ int UTIL_ReadFlags(const char *c)
// Determine whether bots can be used or not
bool UTIL_AreBotsAllowed()
{
#ifdef REGAMEDLL_ADD
if (g_engfuncs.pfnEngCheckParm == NULL)
return false;
#endif
if (g_bIsCzeroGame)
{
#ifdef REGAMEDLL_ADD
// If they pass in -nobots, don't allow bots. This is for people who host servers, to
// allow them to disallow bots to enforce CPU limits.
int nobots = ENG_CHECK_PARM("-nobots", NULL);
@ -2373,6 +2376,7 @@ bool UTIL_AreBotsAllowed()
{
return false;
}
#endif
return true;
}

View File

@ -412,9 +412,8 @@ struct WeaponInfoStruct
AmmoType ammoType;
char *entityName;
#ifndef HOOK_GAMEDLL
// custom
const char *ammoName;
#endif
};
struct WeaponSlotInfo

View File

@ -412,6 +412,12 @@
15: "Distort (Models)"
16: "Hologram (Distort + fade)"
// Strange effect. As seen, briefly, when a Gargantua dies.
17: "Dead Player" // kRenderFxDeadPlayer
18: "Explode" // kRenderFxExplode
19: "Glow Shell" // kRenderFxGlowShell
20 : "Clamp Min Scale" // kRenderFxClampMinScale
21 : "Light Multiplier" // kRenderFxLightMultiplier
]
]
@ -867,30 +873,13 @@
// style commented out, seems to serve no purpose besides adding
// to the lightdata load.
// style(integer) : "Style" : 32
sounds(choices) : "Sound style" : 0 =
[
0: "No Sound, None"
// the rest of these may or may not work, copied from button
1: "Big zap & Warmup"
2: "Access Denied"
3: "Access Granted"
4: "Quick Combolock"
5: "Power Deadbolt 1"
6: "Power Deadbolt 2"
7: "Plunger"
8: "Small zap"
9: "Keycard Sound"
10: "Buzz"
11: "Buzz Off"
14: "Lightswitch"
]
message(string) : "Message (set sound too)"
spawnflags(flags) =
[
1: "Monsters" : 0
2: "No Players, entity only" : 0
4: "Pushables" : 0
64: "No reset on New Round"
64: "No reset on New Round" : 0
]
]
@ -1019,10 +1008,10 @@
// line below edited by Dmitrich! -->
// was: @PointClass base(Targetname, Angles, RenderFields) iconsprite("sprites/CS/cycler_sprite.spr") = cycler_sprite : "Sprite Cycler"
@PointClass base(Targetname, Angles, Sequence) size(-16 -16 0, 16 16 72) studio() = cycler_sprite : "Sprite Cycler"
@PointClass base(Targetname, Angles, RenderFields) size(-16 -16 0, 16 16 72) studio() = cycler_sprite : "Sprite Cycler"
[
model(sprite) : "Sprite/model path/name"
sequence(string) : "model only sequence # of animation" : ""
model(studio) : "Model / Sprite" : ""
sequence(string) : "Animation # sequence (Models only)" : ""
framerate(integer) : "Frames per second" : 10
]
@ -1433,11 +1422,6 @@
[
1: "Use Only" : 0
]
weapon_briefcase (choices) : "Give Nightvision" : 0 =
[
0: "No"
1: "Yes"
]
weapon_knife (choices) : "Give Knife" : 0 =
[
0: "No"
@ -1563,7 +1547,7 @@
0: "No"
1: "Yes"
]
weapon_shieldgun (choices) : "CS 1.6 Police Riot Shield" : 0 =
weapon_shield (choices) : "CS 1.6 Police Riot Shield" : 0 =
[
0: "No"
1: "Yes"
@ -1680,7 +1664,6 @@
5: "5 Clips"
6: "6 Clips"
7: "7 Clips (Fill FN M249 Para)"
]
ammo_338magnum (choices) : "Give .338 AWP Ammo" : 0 =
[

View File

@ -150,7 +150,8 @@ enum RewardAccount
REWARD_VIP_HAVE_SELF_RESCUED = 2500,
REWARD_TAKEN_HOSTAGE = 1000
REWARD_TOOK_HOSTAGE_ACC = 100,
REWARD_TOOK_HOSTAGE = 150,
};
// custom enum
@ -323,7 +324,7 @@ public:
virtual void ServerDeactivate() = 0;
virtual void CheckMapConditions() = 0;
public:
BOOL m_bFreezePeriod;
BOOL m_bFreezePeriod; // TRUE at beginning of round, set to FALSE when the period expires
BOOL m_bBombDropped;
// custom
@ -549,20 +550,17 @@ public:
bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
void MarkSpawnSkipped() { m_bSkipSpawn = false; }
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
float GetRoundRemainingTime() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTime; }
float GetTimeLeft() const { return m_flTimeLimit - gpGlobals->time; }
bool IsMatchStarted() { return (m_flRestartRoundTime != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
void TerminateRound(float tmDelay, int iWinStatus);
inline void TerminateRound(float tmDelay, int iWinStatus)
{
m_iRoundWinStatus = iWinStatus;
m_fTeamCount = gpGlobals->time + tmDelay;
m_bRoundTerminating = true;
}
public:
CVoiceGameMgr m_VoiceGameMgr;
float m_fTeamCount; // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0
float m_flRestartRoundTime; // The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount)
float m_flCheckWinConditions;
float m_fRoundCount;
float m_fRoundStartTime; // Time round has started (deprecated name m_fRoundCount)
int m_iRoundTime; // (From mp_roundtime) - How many seconds long this round is.
int m_iRoundTimeSecs;
int m_iIntroRoundTime; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is.
@ -646,6 +644,8 @@ public:
bool m_bSkipShowMenu;
bool m_bNeededPlayers;
float m_flEscapeRatio;
float m_flTimeLimit;
float m_flGameStartTime;
};
typedef struct mapcycle_item_s
@ -672,7 +672,15 @@ public:
extern CGameRules *g_pGameRules;
// Gets us at the CS game rules
inline CHalfLifeMultiplay *CSGameRules()
{
return reinterpret_cast<CHalfLifeMultiplay *>(g_pGameRules);
return static_cast<CHalfLifeMultiplay *>(g_pGameRules);
}
inline void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus)
{
m_iRoundWinStatus = iWinStatus;
m_flRestartRoundTime = gpGlobals->time + tmDelay;
m_bRoundTerminating = true;
}

View File

@ -47,6 +47,8 @@ typedef std::list<ActiveGrenade *> ActiveGrenadeList;
class CBotManager {
public:
virtual ~CBotManager() {}
virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;

View File

@ -67,6 +67,7 @@ class CBotManager
{
public:
CBotManager();
virtual ~CBotManager() {}
virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;

View File

@ -4215,8 +4215,18 @@ void EditNavAreas(NavEditCmdType cmd)
{
// create the new nav area
CNavArea *newArea = new CNavArea(&anchor, &cursor);
#ifdef REGAMEDLL_FIXES
if (TheNavAreaList.empty())
{
// first add the areas to the grid
TheNavAreaGrid.Initialize(8192.0f, -8192.0f, 8192.0f, -8192.0f);
}
#endif
TheNavAreaList.push_back(newArea);
TheNavAreaGrid.AddNavArea(newArea);
EMIT_SOUND_DYN(ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100);
// if we have a marked area, inter-connect the two
@ -4255,6 +4265,7 @@ void EditNavAreas(NavEditCmdType cmd)
{
EMIT_SOUND_DYN(ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100);
}
break;
}
}

View File

@ -165,7 +165,7 @@ FunctionHook g_FunctionHooks[] =
{ 0x01DB2B50, "PM_Friction", (size_t)&PM_Friction },
{ 0x01DB2CF0, "PM_AirAccelerate", (size_t)&PM_AirAccelerate },
{ 0x01DB2DB0, "PM_WaterMove", (size_t)&PM_WaterMove },
{ 0x01DB30C0, "PM_AirMove", (size_t)&PM_AirMove },
{ 0x01DB30C0, "PM_AirMove", (size_t)&PM_AirMove_internal },
//{ 0x01DB3200, "PM_InWater", (size_t)&PM_InWater }, // NOXREF
{ 0x01DB3220, "PM_CheckWater", (size_t)&PM_CheckWater },
{ 0x01DB33E0, "PM_CatagorizePosition", (size_t)&PM_CatagorizePosition },
@ -278,7 +278,7 @@ FunctionHook g_FunctionHooks[] =
{ 0x01D64F00, "Q_strlen", (size_t)&Q_strlen_ },
{ 0x01D64F20, "_Z8Host_SayP7edict_si", (size_t)&Host_Say },
//{ 0x0, "", (size_t)&DropSecondary }, // NOXREF
{ 0x01D656F0, "_Z11DropPrimaryP11CBasePlayer", (size_t)&DropPrimary },
//{ 0x01D656F0, "_Z11DropPrimaryP11CBasePlayer", (size_t)&DropPrimary },
{ 0x01D65740, "_Z10CanBuyThisP11CBasePlayeri", (size_t)&CanBuyThis },
{ 0x01D65850, "_Z9BuyPistolP11CBasePlayeri", (size_t)&BuyPistol },
{ 0x01D65A30, "_Z10BuyShotgunP11CBasePlayeri", (size_t)&BuyShotgun },
@ -644,7 +644,7 @@ FunctionHook g_FunctionHooks[] =
//{ 0x01D9B9A0, "_ZN11CBasePlayer10SmartRadioEv", mfunc_ptr_cast(&CBasePlayer::SmartRadio) }, // NOXREF
{ 0x01DA07D0, "_ZN11CBasePlayer11ThrowWeaponEPc", mfunc_ptr_cast(&CBasePlayer::ThrowWeapon) }, // NOXREF
//{ 0x01DA0DB0, "_ZN11CBasePlayer12ThrowPrimaryEv", mfunc_ptr_cast(&CBasePlayer::ThrowPrimary) }, // NOXREF
{ 0x01DA1170, "_ZN11CBasePlayer10AddAccountEib", mfunc_ptr_cast(&CBasePlayer::AddAccount) },
//{ 0x01DA1170, "_ZN11CBasePlayer10AddAccountEib", mfunc_ptr_cast(&CBasePlayer::AddAccount) },
{ 0x01DA1DA0, "_ZN11CBasePlayer9DisappearEv", mfunc_ptr_cast(&CBasePlayer::Disappear) },
{ 0x01DA15B0, "_ZN11CBasePlayer7MakeVIPEv", mfunc_ptr_cast(&CBasePlayer::MakeVIP) },
{ 0x01DA36C0, "_ZN11CBasePlayer12CanPlayerBuyEb", mfunc_ptr_cast(&CBasePlayer::CanPlayerBuy) },
@ -1908,17 +1908,17 @@ FunctionHook g_FunctionHooks[] =
{ 0x01D87730, "_ZN5CItem11MaterializeEv", mfunc_ptr_cast(&CItem::Materialize) },
//CWorldItem
//virtual func
{ 0x01D874A0, "_ZN10CWorldItem5SpawnEv", mfunc_ptr_cast(&CWorldItem::Spawn_) },
{ 0x01D87450, "_ZN10CWorldItem8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CWorldItem::KeyValue_) },
//{ 0x01D874A0, "_ZN10CWorldItem5SpawnEv", mfunc_ptr_cast(&CWorldItem::Spawn_) },
//{ 0x01D87450, "_ZN10CWorldItem8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CWorldItem::KeyValue_) },
//linked objects
{ 0x01D87400, "world_items", (size_t)&world_items },
//{ 0x01D87400, "world_items", (size_t)&world_items },
//CItemSuit
//virtual func
{ 0x01D877F0, "_ZN9CItemSuit5SpawnEv", mfunc_ptr_cast(&CItemSuit::Spawn_) },
{ 0x01D878B0, "_ZN9CItemSuit8PrecacheEv", mfunc_ptr_cast(&CItemSuit::Precache_) },
{ 0x01D878D0, "_ZN9CItemSuit7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemSuit::MyTouch_) },
//{ 0x01D877F0, "_ZN9CItemSuit5SpawnEv", mfunc_ptr_cast(&CItemSuit::Spawn_) },
//{ 0x01D878B0, "_ZN9CItemSuit8PrecacheEv", mfunc_ptr_cast(&CItemSuit::Precache_) },
//{ 0x01D878D0, "_ZN9CItemSuit7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemSuit::MyTouch_) },
//linked objects
{ 0x01D877A0, "item_suit", (size_t)&item_suit },
//{ 0x01D877A0, "item_suit", (size_t)&item_suit },
//CItemBattery
//virtual func
{ 0x01D87990, "_ZN12CItemBattery5SpawnEv", mfunc_ptr_cast(&CItemBattery::Spawn_) },
@ -1935,11 +1935,11 @@ FunctionHook g_FunctionHooks[] =
{ 0x01D87BC0, "item_antidote", (size_t)&item_antidote },
//CItemSecurity
//virtual func
{ 0x01D87D60, "_ZN13CItemSecurity5SpawnEv", mfunc_ptr_cast(&CItemSecurity::Spawn_) },
{ 0x01D87E20, "_ZN13CItemSecurity8PrecacheEv", mfunc_ptr_cast(&CItemSecurity::Precache_) },
{ 0x01D87E30, "_ZN13CItemSecurity7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemSecurity::MyTouch_) },
//{ 0x01D87D60, "_ZN13CItemSecurity5SpawnEv", mfunc_ptr_cast(&CItemSecurity::Spawn_) },
//{ 0x01D87E20, "_ZN13CItemSecurity8PrecacheEv", mfunc_ptr_cast(&CItemSecurity::Precache_) },
//{ 0x01D87E30, "_ZN13CItemSecurity7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemSecurity::MyTouch_) },
//linked objects
{ 0x01D87D10, "item_security", (size_t)&item_security },
//{ 0x01D87D10, "item_security", (size_t)&item_security },
//CItemLongJump
//virtual func
{ 0x01D87EA0, "_ZN13CItemLongJump5SpawnEv", mfunc_ptr_cast(&CItemLongJump::Spawn_) },
@ -2531,7 +2531,7 @@ FunctionHook g_FunctionHooks[] =
{ 0x01D01140, "_Z21WeaponIDToWeaponClassi", (size_t)&WeaponIDToWeaponClass },
{ 0x01D011C0, "_Z15IsPrimaryWeaponi", (size_t)&IsPrimaryWeapon },
//{ 0x01D01250, "_Z17IsSecondaryWeaponi", (size_t)&IsSecondaryWeapon }, // NOXREF
{ 0x01D012A0, "_Z13GetWeaponInfoi", (size_t)&GetWeaponInfo },
{ 0x01D012A0, "_Z13GetWeaponInfoi", mfunc_ptr_cast<WeaponInfoStruct* (*)(int)>(&GetWeaponInfo) },
{ 0x01D012E0, "_Z21CanBuyWeaponByMaptypei12WeaponIdTypeb", (size_t)&CanBuyWeaponByMaptype },
#endif // WeaponType_Region
@ -4453,7 +4453,7 @@ FunctionHook g_FunctionHooks[] =
{ 0x01D206A0, "_Z17InstallBotControlv", (size_t)&InstallBotControl },
{ 0x01D20730, "_Z17Bot_ServerCommandv", (size_t)&Bot_ServerCommand },
{ 0x01D20760, "_Z17Bot_RegisterCvarsv", (size_t)&Bot_RegisterCvars },
{ 0x01D20760, "_Z17Bot_RegisterCvarsv", (size_t)&Bot_RegisterCVars },
#endif // CS_Init_Region

View File

@ -214,8 +214,8 @@ CCareerTaskManager *TheCareerTasks;
const TaskInfo taskInfo[21];
// globals client.cpp
float g_flTimeLimit;
float g_flResetTime;
float g_flTimeLimit; // moved from gamerules
float g_flResetTime; // moved from gamerules
bool g_bClientPrintEnable;
char *sPlayerModelFiles[12];
@ -936,7 +936,7 @@ void CFuncTank::Precache() { Precache_(); }
void CFuncTank::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
int CFuncTank::Save(CSave &save) { return Save_(save); }
int CFuncTank::Restore(CRestore &restore) { return Restore_(restore); }
BOOL CFuncTank::OnControls(entvars_t *pevTest) { OnControls_(pevTest); }
BOOL CFuncTank::OnControls(entvars_t *pevTest) { return OnControls_(pevTest); }
void CFuncTank::Think() { Think_(); }
void CFuncTank::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator, pCaller, useType, value); }
void CFuncTank::Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) { Fire_(barrelEnd, forward, pevAttacker); }
@ -970,8 +970,8 @@ BOOL CGameRules::CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int
// grenade
void CGrenade::Spawn() { Spawn_(); }
int CGrenade::Save(CSave &save) { Save_(save); }
int CGrenade::Restore(CRestore &restore) { Restore_(restore); }
int CGrenade::Save(CSave &save) { return Save_(save); }
int CGrenade::Restore(CRestore &restore) { return Restore_(restore); }
void CGrenade::Killed(entvars_t *pevAttacker, int iGib) { Killed_(pevAttacker, iGib); }
void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Use_(pActivator, pCaller, useType, value); }
void CGrenade::BounceSound() { BounceSound_(); }
@ -1032,12 +1032,12 @@ void CWallHealth::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
void CItem::Spawn() { Spawn_(); }
CBaseEntity *CItem::Respawn() { return Respawn_(); }
void CWorldItem::Spawn() { Spawn_(); }
void CWorldItem::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
//void CWorldItem::Spawn() { Spawn_(); }
//void CWorldItem::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
void CItemSuit::Spawn() { Spawn_(); }
void CItemSuit::Precache() { Precache_(); }
BOOL CItemSuit::MyTouch(CBasePlayer *pPlayer) { return MyTouch_(pPlayer); }
//void CItemSuit::Spawn() { Spawn_(); }
//void CItemSuit::Precache() { Precache_(); }
//BOOL CItemSuit::MyTouch(CBasePlayer *pPlayer) { return MyTouch_(pPlayer); }
void CItemBattery::Spawn() { Spawn_(); }
void CItemBattery::Precache() { Precache_(); }
@ -1047,9 +1047,9 @@ void CItemAntidote::Spawn() { Spawn_(); }
void CItemAntidote::Precache() { Precache_(); }
BOOL CItemAntidote::MyTouch(CBasePlayer *pPlayer) { return MyTouch_(pPlayer); }
void CItemSecurity::Spawn() { Spawn_(); }
void CItemSecurity::Precache() { Precache_(); }
BOOL CItemSecurity::MyTouch(CBasePlayer *pPlayer) { return MyTouch_(pPlayer); }
//void CItemSecurity::Spawn() { Spawn_(); }
//void CItemSecurity::Precache() { Precache_(); }
//BOOL CItemSecurity::MyTouch(CBasePlayer *pPlayer) { return MyTouch_(pPlayer); }
void CItemLongJump::Spawn() { Spawn_(); }
void CItemLongJump::Precache() { Precache_(); }
@ -1380,8 +1380,8 @@ void CAmbientGeneric::Spawn() { Spawn_(); }
void CAmbientGeneric::Precache() { Precache_(); }
void CAmbientGeneric::Restart() { Restart_(); }
void CAmbientGeneric::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }
int CAmbientGeneric::Save(CSave &save) { Save_(save); }
int CAmbientGeneric::Restore(CRestore &restore) { Restore_(restore); }
int CAmbientGeneric::Save(CSave &save) { return Save_(save); }
int CAmbientGeneric::Restore(CRestore &restore) { return Restore_(restore); }
void CEnvSound::Spawn() { Spawn_(); }
void CEnvSound::KeyValue(KeyValueData *pkvd) { KeyValue_(pkvd); }

View File

@ -91,6 +91,7 @@ typedef float FloatRef;
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(...)
#define LINK_HOOK_VOID_CHAIN(...)
#define LINK_HOOK_CHAIN(...)
#define LINK_HOOK_CHAIN2(...)
// refs
extern void (CBaseEntity::*pCHostage__IdleThink)();
@ -924,6 +925,9 @@ extern char pm_grgszTextureName[1024][17];
extern char pm_grgchTextureType[1024];
extern char *BotDifficultyName[5];
extern float g_flResetTime;
C_DLLEXPORT float g_flTimeLimit;
// declared functions
C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, globalvars_t *pGlobals);
bool NavAreaBuildPath__HostagePathCost__wrapper(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, HostagePathCost &costFunc, CNavArea **closestArea);
@ -951,7 +955,7 @@ void PM_WalkMove();
void PM_Friction();
void PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel);
void PM_WaterMove();
void PM_AirMove();
void PM_AirMove(int playerIndex = 0);
qboolean PM_InWater();
qboolean PM_CheckWater();
void PM_CatagorizePosition();

View File

@ -27,6 +27,7 @@
*/
#include "precompiled.h"
#include "FileSystem.h"
#ifdef _WIN32
#include <direct.h>

View File

@ -32,7 +32,6 @@
#pragma once
#endif
/* <2cab3d> ../public/MemPool.h:18 */
class CMemoryPool
{
public:

View File

@ -21,6 +21,7 @@ rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind ->
linkerOptions: new GccToolchainConfig.LinkerOptions(
interProceduralOptimizations: true, // -ipo
stripSymbolTable: true,
staticLibStdCpp: false,
staticLibGcc: true,
staticIntel: true,
),
@ -46,6 +47,7 @@ rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind ->
linkerOptions: new GccToolchainConfig.LinkerOptions(
interProceduralOptimizations: false,
stripSymbolTable: false,
staticLibStdCpp: false,
staticLibGcc: true,
staticIntel: true,
),