CTerrorPlayer::OnReloadStart
0x009b7b90 · 955 bytes · __thiscall
_ZN13CTerrorPlayer13OnReloadStartEbib
Decompiled
undefined (4 params)
/* CTerrorPlayer::OnReloadStart(bool, int, bool) */
void __thiscall
CTerrorPlayer::OnReloadStart(CTerrorPlayer *this,bool param_1,int param_2,bool param_3)
{
float fVar1;
code *pcVar2;
int *piVar3;
undefined4 uVar4;
int iVar5;
longdouble lVar6;
undefined4 local_28;
undefined1 local_24;
int local_20;
piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"weapon_reload",0,0);
if (piVar3 != (int *)0x0) {
pcVar2 = *(code **)(*piVar3 + 0x30);
uVar4 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
(*pcVar2)(piVar3,"userid",uVar4);
(**(code **)(*piVar3 + 0x2c))(piVar3,"manual",*(uint *)(this + 0x1cb0) >> 0xd & 1);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,0);
}
if ((this[0x2edc] == (CTerrorPlayer)0x0) && (!param_3)) {
if (this[0x3330] == (CTerrorPlayer)0x0) {
lVar6 = (longdouble)CountdownTimer::Now();
fVar1 = *(float *)(this + 0x30a0);
if (fVar1 <= (float)lVar6) {
lVar6 = (longdouble)CountdownTimer::Now();
if (fVar1 - (float)lVar6 <= -3.0) {
if (param_1) {
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 < *(float *)(this + 0x332c)) {
if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) == 0) {
return;
}
DevMsg("No reload voice because: Second or later shotgun shell.\n");
return;
}
if (*(int *)(ZombieReloadChatterShotgunAmmoThreshold._28_4_ + 0x30) < param_2) {
if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) == 0) {
return;
}
DevMsg("No reload voice because: Topping off a shotgun.\n");
return;
}
}
iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
if (iVar5 == 2) {
local_28 = 2;
local_24 = 1;
local_20 = 0;
ForEachPlayer<LivePlayerCounter>((LivePlayerCounter *)&local_28);
if (local_20 == 1) {
if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) == 0) {
return;
}
DevMsg("No reload voice because: Everyone else is dead.\n");
return;
}
}
if (*(float *)(this + 12000) < *(float *)(ZombieReloadChatterIntensity._28_4_ + 0x2c)) {
if ((0.0 < *(float *)(this + 0x3120)) &&
(lVar6 = (longdouble)IntervalTimer::Now(),
*(float *)(ZombieReloadChatterRecentEnemy._28_4_ + 0x2c) <=
(float)lVar6 - *(float *)(this + 0x3120) &&
(float)lVar6 - *(float *)(this + 0x3120) !=
*(float *)(ZombieReloadChatterRecentEnemy._28_4_ + 0x2c))) {
if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) == 0) {
return;
}
DevMsg("No reload voice because: Haven\'t seen a zombie recently.\n");
return;
}
iVar5 = GetNearbyFriendCount
(this,*(float *)(ZombieReloadChatterNearbyFriendRange._28_4_ + 0x2c),
false);
if (iVar5 == 0) {
if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) == 0) {
return;
}
DevMsg("No reload voice because: Nobody nearby to hear.\n");
return;
}
if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) != 0) {
DevMsg("YES reload voice because: No reason not to.\n");
}
}
else if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) != 0) {
DevMsg("YES reload voice because: Personal Intensity high enough to demand it.\n");
}
uVar4 = ZombieNoiseLevelVocalize._28_4_;
this[0x3330] = (CTerrorPlayer)0x1;
(**(code **)(*(int *)this + 0x850))(this,*(undefined4 *)(uVar4 + 0x2c));
pcVar2 = *(code **)(*(int *)this + 0x7b4);
CAI_Concept::CAI_Concept((CAI_Concept *)&local_28,"PlayerReloading");
(*pcVar2)(this,(CAI_Concept *)&local_28,0,0,0,0,0);
CountdownTimer::Start((CountdownTimer *)(this + 0x3098),2.0);
if (param_1) {
CountdownTimer::Start
((CountdownTimer *)(this + 0x3324),
*(float *)(ZombieReloadChatterShotgunInterval._28_4_ + 0x2c));
}
}
}
else if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) != 0) {
DevMsg("No reload voice because: VocalizeTimer still running.\n");
}
}
else if (*(int *)(ZombieReloadChatterDebug._28_4_ + 0x30) != 0) {
DevMsg("No reload voice because: we already said Reloading and haven\'t finished.\n");
}
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.