SurvivorLocomotion::Update
0x00962800 · 2643 bytes · __thiscall
_ZN18SurvivorLocomotion6UpdateEv
Decompiled
undefined (1 param)
/* SurvivorLocomotion::Update() */
void __thiscall SurvivorLocomotion::Update(SurvivorLocomotion *this)
{
SurvivorLocomotion *pSVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
code *pcVar6;
char cVar7;
int *piVar8;
CTerrorPlayer *this_00;
float *pfVar9;
Vector *pVVar10;
undefined4 *puVar11;
int iVar12;
int iVar13;
int *piVar14;
IHandleEntity *pIVar15;
float *pfVar16;
undefined4 uVar17;
CBaseEntity *pCVar18;
longdouble lVar19;
float fVar20;
float fVar21;
CTakeDamageInfo *local_f0;
float local_ec;
float local_e8;
float local_e4;
undefined **local_e0 [4];
Vector local_d0 [12];
Vector local_c4 [64];
CBaseEntity *local_84;
float local_7c;
float local_78;
float local_74;
float local_6c;
float local_68;
float local_64;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_4c;
undefined4 local_48;
undefined4 local_44;
undefined4 local_3c;
undefined1 local_38;
undefined1 local_37;
pSVar1 = this + 0xe0;
PlayerLocomotion::Update((PlayerLocomotion *)this);
piVar8 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
this_00 = (CTerrorPlayer *)(**(code **)(*piVar8 + 0xb4))(piVar8);
lVar19 = (longdouble)CountdownTimer::Now();
if ((((((float)lVar19 < *(float *)(this + 0xe8)) ||
(cVar7 = CTerrorPlayer::IsAbleToMove(this_00), cVar7 == '\0')) ||
(cVar7 = (**(code **)(*(int *)this_00 + 0x804))(this_00), cVar7 != '\0')) ||
((cVar7 = CTerrorPlayer::IsStaggering(this_00), cVar7 != '\0' ||
(*(int *)(NextBotPlayerMove._28_4_ + 0x30) == 0)))) &&
(cVar7 = (**(code **)(*(int *)this + 0xf8))(this), uVar17 = vec3_origin, cVar7 != '\0')) {
*(undefined4 *)(this + 200) = 0;
this[0xdc] = (SurvivorLocomotion)0x0;
*(undefined4 *)(this + 0xbc) = uVar17;
uVar17 = DAT_01053d4c;
*(undefined4 *)(this + 0xcc) = 0;
*(undefined4 *)(this + 0xc0) = uVar17;
*(undefined4 *)(this + 0xc4) = DAT_01053d50;
puVar11 = (undefined4 *)(**(code **)(*(int *)this + 300))(this);
*(undefined4 *)(this + 0xd0) = *puVar11;
*(undefined4 *)(this + 0xd4) = puVar11[1];
*(undefined4 *)(this + 0xd8) = puVar11[2];
(**(code **)(*(int *)this + 0x170))(this,&DAT_00d539c2);
return;
}
fVar20 = *(float *)(this + 200);
if (fVar20 <= 0.0) goto LAB_00962ae9;
if ((1 < *(int *)(this + 0xcc)) && (0.0 < *(float *)(this + 8))) {
cVar7 = (**(code **)(*(int *)this + 0x114))(this);
if ((cVar7 == '\0') && (cVar7 = (**(code **)(*(int *)this + 0xf8))(this), cVar7 != '\0')) {
pfVar9 = (float *)(**(code **)(*(int *)this + 300))(this);
fVar20 = SQRT((pfVar9[1] - *(float *)(this + 0xd4)) * (pfVar9[1] - *(float *)(this + 0xd4)) +
(*pfVar9 - *(float *)(this + 0xd0)) * (*pfVar9 - *(float *)(this + 0xd0)) +
(pfVar9[2] - *(float *)(this + 0xd8)) * (pfVar9[2] - *(float *)(this + 0xd8))) /
*(float *)(this + 8);
if (*(float *)(SurvivorBotLocomotionWaitThreshold._28_4_ + 0x2c) <= fVar20 &&
fVar20 != *(float *)(SurvivorBotLocomotionWaitThreshold._28_4_ + 0x2c)) {
this[0xdc] = (SurvivorLocomotion)0x1;
fVar20 = *(float *)(this + 200);
goto LAB_009628ac;
}
if (this[0xdc] != (SurvivorLocomotion)0x0) {
lVar19 = (longdouble)RandomFloat(0x40000000,0x40400000);
fVar20 = (float)lVar19;
lVar19 = (longdouble)CountdownTimer::Now();
if ((float)lVar19 + fVar20 != *(float *)(this + 0xe8)) {
(**(code **)(*(int *)(this + 0xe0) + 4))(pSVar1,this + 0xe8);
*(float *)(this + 0xe8) = (float)lVar19 + fVar20;
}
if (fVar20 != *(float *)(this + 0xe4)) {
(**(code **)(*(int *)(this + 0xe0) + 4))(pSVar1,this + 0xe4);
*(float *)(this + 0xe4) = fVar20;
}
goto LAB_00962e79;
}
}
fVar20 = *(float *)(this + 200);
}
LAB_009628ac:
uVar17 = SurvivorBotDebugLocomotion._28_4_;
fVar2 = *(float *)(this + 0xbc);
fVar20 = 1.0 / fVar20;
fVar3 = *(float *)(this + 0xc0);
fVar4 = *(float *)(this + 0xc4);
*(float *)(this + 0xbc) = fVar2 * fVar20;
*(float *)(this + 0xc0) = fVar3 * fVar20;
*(float *)(this + 0xc4) = fVar20 * fVar4;
if ((*(int *)(uVar17 + 0x30) != 0) && (0.0 < *(float *)(this + 8))) {
fVar21 = 1.0 / *(float *)(this + 8);
pfVar9 = (float *)(**(code **)(*(int *)this + 300))(this);
local_7c = fVar2 * fVar20 * fVar21 + *pfVar9;
local_78 = fVar3 * fVar20 * fVar21 + pfVar9[1];
local_74 = fVar20 * fVar4 * fVar21 + pfVar9[2];
pVVar10 = (Vector *)(**(code **)(*(int *)this + 300))(this);
NDebugOverlay::HorzArrow(pVVar10,(Vector *)&local_7c,5.0,0xff,0,0,0xff,true,0.1);
}
puVar11 = (undefined4 *)(**(code **)(*(int *)this + 300))(this);
*(undefined4 *)(this + 0xd0) = *puVar11;
*(undefined4 *)(this + 0xd4) = puVar11[1];
*(undefined4 *)(this + 0xd8) = puVar11[2];
pfVar9 = (float *)(**(code **)(*(int *)this + 300))(this);
local_7c = *(float *)(this + 0xbc) + *pfVar9;
local_78 = *(float *)(this + 0xc0) + pfVar9[1];
local_74 = *(float *)(this + 0xc4) + pfVar9[2];
iVar12 = (**(code **)(*(int *)this_00 + 0x52c))(this_00);
iVar13 = CNavMesh::GetNavArea(TheNavMesh,(Vector *)&local_7c,120.0);
if (((((iVar13 != 0) && (iVar12 != 0)) && (*(int *)(iVar12 + 0x70) < *(int *)(gpGlobals + 0x18)))
&& ((*(int *)(gpGlobals + 0x18) <= *(int *)(iVar13 + 0x70) &&
(0.0 < *(float *)(this_00 + 0x3174))))) &&
(lVar19 = (longdouble)IntervalTimer::Now(), (float)lVar19 - *(float *)(this_00 + 0x3174) < 10.0
)) {
lVar19 = (longdouble)RandomFloat(0x40000000,0x40400000);
fVar20 = (float)lVar19;
lVar19 = (longdouble)CountdownTimer::Now();
if ((float)lVar19 + fVar20 != *(float *)(this + 0xe8)) {
(**(code **)(*(int *)(this + 0xe0) + 4))(pSVar1,this + 0xe8);
*(float *)(this + 0xe8) = (float)lVar19 + fVar20;
}
if (fVar20 != *(float *)(this + 0xe4)) {
(**(code **)(*(int *)(this + 0xe0) + 4))(pSVar1,this + 0xe4);
*(float *)(this + 0xe4) = fVar20;
}
LAB_00962e79:
(**(code **)(*(int *)this + 0x170))(this,&DAT_00d539c2);
return;
}
local_f0 = (CTakeDamageInfo *)&local_7c;
PlayerLocomotion::Approach((Vector *)this,(float)local_f0);
uVar17 = vec3_origin;
*(undefined4 *)(this + 200) = 0;
*(undefined4 *)(this + 0xcc) = 0;
*(undefined4 *)(this + 0xbc) = uVar17;
*(undefined4 *)(this + 0xc0) = DAT_01053d4c;
*(undefined4 *)(this + 0xc4) = DAT_01053d50;
LAB_00962ae9:
local_f0 = (CTakeDamageInfo *)&local_7c;
piVar8 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
piVar8 = (int *)(**(code **)(*piVar8 + 0xc4))(piVar8);
piVar14 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
pIVar15 = (IHandleEntity *)(**(code **)(*piVar14 + 0xb4))(piVar14);
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)local_e0,pIVar15,0,IgnoreActorsTraceFilterFunction);
local_e0[0] = &PTR_ShouldHitEntity_00c23430;
piVar14 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
piVar14 = (int *)(**(code **)(*piVar14 + 0xb4))(piVar14);
pfVar9 = (float *)(**(code **)(*piVar14 + 0x288))(piVar14);
pfVar16 = (float *)(**(code **)(*(int *)this + 0x108))(this);
fVar20 = *pfVar16;
fVar2 = pfVar16[1];
fVar3 = pfVar16[2];
fVar4 = *pfVar9;
fVar21 = pfVar9[1];
fVar5 = pfVar9[2];
uVar17 = (**(code **)(*piVar8 + 0x130))(piVar8);
local_6c = (fVar20 * 50.0 - *pfVar9) + fVar4;
local_68 = (fVar2 * 50.0 - pfVar9[1]) + fVar21;
local_3c = 0;
local_4c = 0x3f800000;
local_48 = 0x3f800000;
local_64 = (fVar3 * 50.0 - pfVar9[2]) + fVar5;
local_44 = 0x3f800000;
local_38 = 0;
local_5c = 0;
local_58 = 0;
local_54 = 0;
local_37 = local_68 * local_68 + local_6c * local_6c + local_64 * local_64 != 0.0;
local_7c = *pfVar9;
local_78 = pfVar9[1];
local_74 = pfVar9[2];
(**(code **)(*enginetrace + 0x14))(enginetrace,local_f0,uVar17,local_e0,local_d0);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_d0,local_c4,0xff,0xff,0,true,-1.0);
}
cVar7 = CGameTrace::DidHitNonWorldEntity((CGameTrace *)local_d0);
if (cVar7 != '\0') {
fVar20 = *(float *)(ZombieGunDamage._28_4_ + 0x2c);
pCVar18 = (CBaseEntity *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this_00);
CTakeDamageInfo::CTakeDamageInfo
(local_f0,(CBaseEntity *)this_00,(CBaseEntity *)this_00,pCVar18,(Vector *)&vec3_origin
,(Vector *)&vec3_origin,fVar20,0x80,0,(Vector *)0x0);
cVar7 = IsBreakableEntity(local_84,false,false,local_f0);
if (cVar7 != '\0') {
piVar8 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
piVar8 = (int *)(**(code **)(*piVar8 + 0xb4))(piVar8);
piVar14 = (int *)(**(code **)(*piVar8 + 0x9a4))(piVar8);
pcVar6 = *(code **)(*piVar14 + 0xc0);
pfVar9 = (float *)(**(code **)(*(int *)this + 0x108))(this);
fVar20 = *pfVar9;
fVar2 = pfVar9[2];
fVar3 = pfVar9[1];
pfVar9 = (float *)(**(code **)(*piVar8 + 0x288))(piVar8);
local_ec = fVar20 * 50.0 + *pfVar9;
local_e4 = fVar2 * 50.0 + pfVar9[2];
local_e8 = fVar3 * 50.0 + pfVar9[1];
(*pcVar6)(piVar14,&local_ec,3,0x3f000000,&g_SurvivorBotMeleeOnReply,
"Looking toward breakable for melee swing",1,0x3e800000);
}
}
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.