PunchVictim::Update
0x00a2cd90 · 2528 bytes · __thiscall
_ZN11PunchVictim6UpdateEP8Infectedf
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* PunchVictim::Update(Infected*, float) */
PunchVictim * __thiscall PunchVictim::Update(PunchVictim *this,Infected *param_1,float param_2)
{
uint *puVar1;
float fVar2;
CBaseEntity *this_00;
code *pcVar3;
char cVar4;
int iVar5;
int *piVar6;
int *piVar7;
int iVar8;
undefined4 uVar9;
uint uVar10;
int *piVar11;
float *pfVar12;
undefined *puVar13;
longdouble lVar14;
CBaseEntity *local_60;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
undefined4 local_48;
int local_44;
float local_40;
float local_3c;
float local_34;
float local_30;
float local_28;
float local_24;
float local_20;
local_54 = 0;
local_50 = 0;
if (_towlower == 0) {
local_44 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_54,0,0,0,0,
"/data/src/game/server/terror/zombiebot/infected/infectedattack.cpp",0x304,
&Update(Infected*,float)::tm_fmt,"(%s)%s","NextBot",
"InfectedAttack::PunchVictim::Update");
local_44 = _towlower;
}
iVar8 = _DAT_0105db00;
local_4c = local_54;
local_48 = local_50;
/* try { // try from 00a2cf36 to 00a2cf96 has its CatchHandler @ 00a2d7cb */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar5 = ThreadGetCurrentId(), iVar8 == iVar5)) {
if ((char *)*_DAT_0105d15c != "InfectedAttack::PunchVictim::Update") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd228f8,(char *)0x0,0xca8906);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
uVar10 = *(uint *)(param_1 + 0x58);
if (((uVar10 != 0xffffffff) &&
(puVar13 = g_pEntityList + (uVar10 & 0xfff) * 0x10, puVar13 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar13 + 8) == uVar10 >> 0xc &&
(this_00 = *(CBaseEntity **)(puVar13 + 4), this_00 != (CBaseEntity *)0x0)))) {
/* try { // try from 00a2cfc8 to 00a2d7c5 has its CatchHandler @ 00a2d7e0 */
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x594))(param_2);
(**(code **)(*piVar6 + 0x13c))(piVar6,this_00,2,0x3dcccccd,0,"Watch our victim");
lVar14 = (longdouble)CountdownTimer::Now();
if (*(float *)(param_1 + 0x54) <= (float)lVar14) {
Infected::Vocalize((Infected *)param_2,"Zombie.RageAtVictim",false);
lVar14 = (longdouble)RandomFloat(0x3f800000,0x40000000);
fVar2 = (float)lVar14;
lVar14 = (longdouble)CountdownTimer::Now();
if ((float)lVar14 + fVar2 != *(float *)(param_1 + 0x54)) {
(**(code **)(*(int *)(param_1 + 0x4c) + 4))(param_1 + 0x4c,param_1 + 0x54);
*(float *)(param_1 + 0x54) = (float)lVar14 + fVar2;
}
if (fVar2 != *(float *)(param_1 + 0x50)) {
(**(code **)(*(int *)(param_1 + 0x4c) + 4))(param_1 + 0x4c,param_1 + 0x50);
*(float *)(param_1 + 0x50) = fVar2;
}
}
cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
if (cVar4 == '\0') {
uVar10 = (**(code **)(*(int *)(this_00 + 0x194) + 0x30))(this_00 + 0x194);
if ((uVar10 & 4) != 0) goto LAB_00a2ce77;
}
else {
cVar4 = (**(code **)(*(int *)this_00 + 300))(this_00);
if (cVar4 == '\0') {
lVar14 = (longdouble)CountdownTimer::Now();
if (*(float *)(param_1 + 0x40) <= (float)lVar14) goto LAB_00a2ce77;
}
else {
lVar14 = (longdouble)RandomFloat(0x3f800000,0x40000000);
fVar2 = (float)lVar14;
lVar14 = (longdouble)CountdownTimer::Now();
if ((float)lVar14 + fVar2 != *(float *)(param_1 + 0x40)) {
(**(code **)(*(int *)(param_1 + 0x38) + 4))(param_1 + 0x38,param_1 + 0x40);
*(float *)(param_1 + 0x40) = (float)lVar14 + fVar2;
}
if (fVar2 != *(float *)(param_1 + 0x3c)) {
(**(code **)(*(int *)(param_1 + 0x38) + 4))(param_1 + 0x38,param_1 + 0x3c);
*(float *)(param_1 + 0x3c) = fVar2;
}
}
}
cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
if ((cVar4 == '\0') ||
(cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), local_60 = this_00, cVar4 == '\0'))
{
local_60 = (CBaseEntity *)0x0;
}
iVar8 = (int)param_2 + 0x1a3c;
cVar4 = (**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0x11c))
(iVar8,this_00,*(undefined4 *)(ZombieAttackMaxRange._28_4_ + 0x2c));
if (cVar4 == '\0') {
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x594))(param_2);
if (piVar6 != (int *)0x0) {
piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x590))(param_2);
if (local_60 == (CBaseEntity *)0x0) {
if ((((*(char **)(this_00 + 0x7c) == "func_door*") ||
(cVar4 = CBaseEntity::ClassMatchesComplex(this_00,"func_door*"), cVar4 != '\0')) ||
(*(char **)(this_00 + 0x7c) == "prop_door*")) ||
(cVar4 = CBaseEntity::ClassMatchesComplex(this_00,"prop_door*"), cVar4 != '\0')) {
piVar11 = (int *)__dynamic_cast(this_00,&CBaseEntity::typeinfo,&CBasePropDoor::typeinfo,
0);
if ((piVar11 == (int *)0x0) ||
(cVar4 = (**(code **)(*piVar11 + 0x47c))(piVar11), cVar4 == '\0')) {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x26a);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x26a,1);
}
}
else {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x26c);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x26c,1);
}
}
if (piVar7 != (int *)0x0) {
(**(code **)(*(int *)(this_00 + 0x194) + 0x3c))(this_00 + 0x194,&local_40,&local_34);
pfVar12 = (float *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xd4))(iVar8);
local_28 = *pfVar12;
local_24 = pfVar12[1];
local_20 = pfVar12[2];
if (ABS(local_34 - local_40) <= ABS(local_30 - local_3c)) {
pfVar12 = (float *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xd4))(iVar8);
fVar2 = *pfVar12;
pfVar12 = (float *)(**(code **)(*(int *)this_00 + 0x288))(this_00);
if (*pfVar12 <= fVar2) {
local_28 = local_28 - 1000.0;
}
else {
local_28 = local_28 + 1000.0;
}
}
else {
iVar8 = (**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xd4))();
fVar2 = *(float *)(iVar8 + 4);
iVar8 = (**(code **)(*(int *)this_00 + 0x288))(this_00);
if (*(float *)(iVar8 + 4) <= fVar2) {
local_24 = local_24 - 1000.0;
}
else {
local_24 = local_24 + 1000.0;
}
}
(**(code **)(*piVar7 + 0x120))(piVar7,&local_28);
}
goto LAB_00a2d1d7;
}
piVar11 = (int *)__dynamic_cast(this_00,&CBaseEntity::typeinfo,&INextBot::typeinfo,
0xfffffffe);
if (piVar11 == (int *)0x0) {
iVar8 = (**(code **)(*(int *)this_00 + 0x288))(this_00);
fVar2 = *(float *)(iVar8 + 8);
piVar11 = (int *)(**(code **)(*(int *)param_2 + 0x590))(param_2);
iVar8 = (**(code **)(*piVar11 + 300))(piVar11);
if (*(float *)(iVar8 + 8) <= fVar2) {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x266);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x266,1);
}
}
else {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x268);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x268,1);
}
}
lVar14 = (longdouble)IntervalTimer::Now();
if (3.0 < (float)lVar14 - *(float *)(param_1 + 0x48)) goto LAB_00a2ce77;
}
else {
piVar11 = (int *)(**(code **)(*piVar11 + 0xc4))(piVar11);
if ((piVar11 == (int *)0x0) ||
(cVar4 = (**(code **)(*piVar11 + 0x100))(piVar11,0), cVar4 == '\0')) {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x268);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x268,1);
}
}
else {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x266);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x266,1);
}
}
}
}
else {
iVar8 = CBaseEntity::GetGender((CBaseEntity *)param_2);
if ((iVar8 == 0x10) ||
(iVar8 = CBaseEntity::GetGender((CBaseEntity *)param_2), iVar8 == 0x11)) {
DestroyAttractGoal((Infected *)param_2);
}
cVar4 = CBaseAnimatingOverlay::IsPlayingGesture((CBaseAnimatingOverlay *)param_2,0x265);
if (cVar4 == '\0') {
cVar4 = (**(code **)(*(int *)local_60 + 0x7e8))(local_60);
if ((cVar4 == '\0') || (local_60[0x33dc] != (CBaseEntity)0x0)) {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x266);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x266,1);
}
}
else {
cVar4 = (**(code **)(*piVar6 + 0xe4))(piVar6,0x268);
if (cVar4 == '\0') {
(**(code **)(*piVar6 + 0xd8))(piVar6,0x268,1);
}
}
}
}
if (piVar7 != (int *)0x0) {
pcVar3 = *(code **)(*piVar7 + 0x120);
uVar9 = (**(code **)(*(int *)this_00 + 0x288))(this_00);
(*pcVar3)(piVar7,uVar9);
}
}
LAB_00a2d1d7:
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
goto LAB_00a2ce8e;
}
}
LAB_00a2ce77:
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
LAB_00a2ce8e:
iVar8 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar8 == iVar5)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_44 != 0) {
(**(code **)(local_44 + 0x54))(local_44,local_4c,local_48,0,0,0);
}
return this;
}
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.