SurvivorUseObject::Update
0x00936630 · 1529 bytes · __thiscall
_ZN17SurvivorUseObject6UpdateEP11SurvivorBotf
Decompiled
undefined (3 params)
/* SurvivorUseObject::Update(SurvivorBot*, float) */
SurvivorUseObject * __thiscall
SurvivorUseObject::Update(SurvivorUseObject *this,SurvivorBot *param_1,float param_2)
{
int *piVar1;
code *pcVar2;
char cVar3;
int *piVar4;
uint uVar5;
int iVar6;
Vector *pVVar7;
float *pfVar8;
int *piVar9;
undefined *puVar10;
double *pdVar11;
double *pdVar12;
undefined1 *puVar13;
int in_GS_OFFSET;
longdouble lVar14;
float fVar15;
float fVar16;
float fVar17;
Vector local_48 [12];
float local_3c;
float local_38;
float local_34;
float local_30;
float local_2c;
float local_28;
undefined1 local_24;
undefined1 local_23;
undefined1 local_22;
undefined1 local_21;
int local_20;
pdVar11 = (double *)&stack0xffffff74;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
piVar4 = (int *)(**(code **)(*(int *)param_2 + 0x9a4))();
uVar5 = *(uint *)(param_1 + 0x34);
if ((((uVar5 == 0xffffffff) ||
(puVar10 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar10 + 8) != uVar5 >> 0xc)) ||
(piVar1 = *(int **)(puVar10 + 4), piVar1 == (int *)0x0)) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "The object we wanted to use is gone";
pdVar11 = (double *)&stack0xffffff74;
goto LAB_009366a0;
}
uVar5 = piVar1[0x88];
if (((uVar5 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar10 + 8) == uVar5 >> 0xc && (*(int **)(puVar10 + 4) != (int *)0x0)))) {
cVar3 = (**(code **)(**(int **)(puVar10 + 4) + 0x16c))();
if (cVar3 != '\0') {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "The object we wanted to use is owned by someone";
goto LAB_009366a0;
}
}
uVar5 = (**(code **)(*piVar1 + 0xa4))();
if ((uVar5 & 0x10) == 0) {
iVar6 = __dynamic_cast();
if (iVar6 != 0) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "The object we wanted to use is no longer usable";
pdVar11 = (double *)&stack0xffffff74;
goto LAB_009366a0;
}
}
cVar3 = (**(code **)(*(int *)param_1 + 0x164))();
if (cVar3 != '\0') {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Situation changed - giving up";
pdVar11 = (double *)&stack0xffffff74;
goto LAB_009366a0;
}
cVar3 = INextBot::IsDebugging((INextBot *)((int)param_2 + 0x4028),1);
pdVar11 = (double *)&stack0xffffff74;
if (cVar3 != '\0') {
pVVar7 = (Vector *)(**(code **)(*piVar1 + 0x288))();
(**(code **)(*(int *)param_2 + 0x234))();
NDebugOverlay::Line((Vector *)&local_30,pVVar7,0xff,0xff,0,true,0.1);
pfVar8 = (float *)(**(code **)(*piVar4 + 0xbc))();
fVar15 = *pfVar8;
fVar16 = pfVar8[1];
fVar17 = pfVar8[2];
(**(code **)(*(int *)param_2 + 0x234))();
local_30 = fVar15 * 100.0 + local_3c;
local_2c = fVar16 * 100.0 + local_38;
local_28 = fVar17 * 100.0 + local_34;
(**(code **)(*(int *)param_2 + 0x234))();
pdVar11 = (double *)&stack0xffffff68;
NDebugOverlay::Line(local_48,(Vector *)&local_30,0xff,0,0,true,0.1);
}
iVar6 = *(int *)param_1;
*(SurvivorBot **)pdVar11 = param_1;
*(float *)((int)pdVar11 + 4) = param_2;
pcVar2 = *(code **)(iVar6 + 0x16c);
*(undefined4 *)((int)pdVar11 + -4) = 0x936915;
cVar3 = (*pcVar2)();
iVar6 = *(int *)param_1;
if (cVar3 == '\0') {
*(SurvivorBot **)pdVar11 = param_1;
*(int **)(pdVar11 + 1) = piVar1;
*(float *)((int)pdVar11 + 4) = param_2;
pcVar2 = *(code **)(iVar6 + 0x160);
*(undefined4 *)((int)pdVar11 + -4) = 0x936933;
pfVar8 = (float *)(*pcVar2)();
iVar6 = *(int *)param_1;
*(int **)(pdVar11 + 1) = piVar1;
*(float *)((int)pdVar11 + 4) = param_2;
*(SurvivorBot **)pdVar11 = param_1;
/* try { // try from 00936946 to 0093694b has its CatchHandler @ 00936c54 */
pcVar2 = *(code **)(iVar6 + 0x15c);
*(undefined4 *)((int)pdVar11 + -4) = 0x93694c;
lVar14 = (longdouble)(*pcVar2)();
iVar6 = *(int *)param_2;
*(float *)((int)pdVar11 + 4) = param_2;
*(float **)pdVar11 = &local_30;
/* try { // try from 0093695b to 00936960 has its CatchHandler @ 00936c52 */
pcVar2 = *(code **)(iVar6 + 0x234);
*(undefined4 *)((int)pdVar11 + -4) = 0x936961;
(*pcVar2)();
if ((local_30 - *pfVar8) * (local_30 - *pfVar8) +
(local_28 - pfVar8[2]) * (local_28 - pfVar8[2]) +
(local_2c - pfVar8[1]) * (local_2c - pfVar8[1]) < (float)lVar14 * (float)lVar14) {
LAB_00936a80:
iVar6 = *(int *)param_2;
*(float *)((int)pdVar11 + -4) = param_2;
/* try { // try from 00936a85 to 00936a95 has its CatchHandler @ 00936c4d */
pcVar2 = *(code **)(iVar6 + 0x9a0);
*(undefined4 *)(pdVar11 + -1) = 0x936a8b;
piVar9 = (int *)(*pcVar2)();
iVar6 = *piVar9;
*(int **)((int)pdVar11 + -4) = piVar9;
pcVar2 = *(code **)(iVar6 + 0xd4);
*(undefined4 *)(pdVar11 + -1) = 0x936a96;
cVar3 = (*pcVar2)();
if (cVar3 != '\x01') {
iVar6 = *piVar4;
*(int **)((int)pdVar11 + -4) = piVar4;
*(float **)pdVar11 = pfVar8;
*(int *)(pdVar11 + 3) = 0x3e800000;
*(int *)((int)pdVar11 + 0x14) = 1;
*(char **)(pdVar11 + 2) = "Look at object to use";
*(int *)((int)pdVar11 + 0xc) = 0;
*(int *)(pdVar11 + 1) = 0x3f800000;
*(int *)((int)pdVar11 + 4) = 4;
pcVar2 = *(code **)(iVar6 + 0xc0);
*(undefined4 *)(pdVar11 + -1) = 0x936adf;
(*pcVar2)();
iVar6 = *(int *)param_2;
*(float **)((int)pdVar11 + -4) = &local_30;
*(float *)pdVar11 = param_2;
pcVar2 = *(code **)(iVar6 + 0x234);
*(undefined4 *)(pdVar11 + -1) = 0x936af1;
(*pcVar2)();
local_3c = *pfVar8 - local_30;
local_38 = pfVar8[1] - local_2c;
local_34 = pfVar8[2];
*(float **)(pdVar11 + -1) = &local_3c;
local_34 = local_34 - local_28;
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936b2e;
VectorNormalize(*(Vector **)(pdVar11 + -1));
iVar6 = *piVar4;
*(int **)(pdVar11 + -1) = piVar4;
pcVar2 = *(code **)(iVar6 + 0xbc);
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936b3e;
pfVar8 = (float *)(*pcVar2)();
pdVar12 = pdVar11 + -1;
if (0.7 < pfVar8[1] * local_38 + *pfVar8 * local_3c + pfVar8[2] * local_34) {
iVar6 = *piVar1;
*(int *)(pdVar11 + 1) = 0;
*(int *)((int)pdVar11 + 4) = 1;
*(float *)pdVar11 = param_2;
*(float *)((int)pdVar11 + -4) = param_2;
*(int **)(pdVar11 + -1) = piVar1;
pcVar2 = *(code **)(iVar6 + 0x1ac);
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936b93;
(*pcVar2)();
iVar6 = *(int *)param_2;
*(undefined4 *)pdVar11 = 3;
*(int **)((int)pdVar11 + -4) = piVar1;
*(float *)(pdVar11 + -1) = param_2;
pcVar2 = *(code **)(iVar6 + 0x6e8);
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936baa;
(*pcVar2)();
*(int *)((int)pdVar11 + -4) = 1;
*(INextBot **)(pdVar11 + -1) = (INextBot *)((int)param_2 + 0x4028);
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936bbd;
cVar3 = INextBot::IsDebugging(*(INextBot **)(pdVar11 + -1),*(uint *)((int)pdVar11 + -4));
if (cVar3 != '\0') {
puVar13 = &DAT_00d539c2;
if ((undefined1 *)piVar1[0x1f] != (undefined1 *)0x0) {
puVar13 = (undefined1 *)piVar1[0x1f];
}
iVar6 = *(int *)param_2;
*(float *)(pdVar11 + -1) = param_2;
pcVar2 = *(code **)(iVar6 + 0xb8);
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936bd9;
iVar6 = (*pcVar2)();
local_24 = 0xff;
local_23 = 0xff;
local_22 = 0;
local_21 = 0xff;
fVar15 = *(float *)(gpGlobals + 0xc);
*(int *)(pdVar11 + 1) = iVar6;
*(undefined1 **)((int)pdVar11 + 0xc) = puVar13;
*pdVar11 = (double)fVar15;
*(char **)((int)pdVar11 + -4) = "%3.2f: %s used %s\n";
*(undefined1 **)(pdVar11 + -1) = &local_24;
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936c18;
ConColorMsg(*(Color **)(pdVar11 + -1),*(char **)((int)pdVar11 + -4));
}
iVar6 = *(int *)param_1;
*(float *)((int)pdVar11 + -4) = param_2;
*(SurvivorBot **)(pdVar11 + -1) = param_1;
pcVar2 = *(code **)(iVar6 + 0x168);
*(undefined4 *)((int)pdVar11 + -0xc) = 0x936c2a;
(*pcVar2)();
pdVar12 = pdVar11 + -1;
}
goto LAB_00936a31;
}
}
else {
iVar6 = *(int *)param_1;
*(int **)((int)pdVar11 + 4) = piVar1;
*(float *)pdVar11 = param_2;
*(SurvivorBot **)((int)pdVar11 + -4) = param_1;
/* try { // try from 009369bd to 009369c2 has its CatchHandler @ 00936c4f */
pcVar2 = *(code **)(iVar6 + 0x15c);
*(undefined4 *)(pdVar11 + -1) = 0x9369c3;
lVar14 = (longdouble)(*pcVar2)();
if ((*(byte *)((int)param_2 + 0x14d) & 8) != 0) {
*(float *)((int)pdVar11 + -4) = param_2;
/* try { // try from 00936c32 to 00936c36 has its CatchHandler @ 00936c45 */
*(undefined4 *)(pdVar11 + -1) = 0x936c37;
CBaseEntity::CalcAbsolutePosition(*(CBaseEntity **)((int)pdVar11 + -4));
}
fVar15 = *(float *)((int)param_2 + 0x2e0) - *pfVar8;
fVar17 = *(float *)((int)param_2 + 0x2e4) - pfVar8[1];
fVar16 = *(float *)((int)param_2 + 0x2e8) - pfVar8[2];
if (fVar15 * fVar15 + fVar17 * fVar17 + fVar16 * fVar16 < (float)lVar14 * (float)lVar14)
goto LAB_00936a80;
}
*(float *)((int)pdVar11 + -4) = param_2;
*(undefined4 *)(pdVar11 + -1) = 0x936a29;
SurvivorBot::LookAround(*(SurvivorBot **)((int)pdVar11 + -4));
*(float *)((int)pdVar11 + -4) = param_2;
*(undefined4 *)(pdVar11 + -1) = 0x936a31;
SurvivorBot::MaintainWeaponry(*(SurvivorBot **)((int)pdVar11 + -4));
pdVar12 = (double *)((int)pdVar11 + -4);
}
else {
*(float *)((int)pdVar11 + 4) = param_2;
*(SurvivorBot **)pdVar11 = param_1;
pcVar2 = *(code **)(iVar6 + 0x170);
*(undefined4 *)((int)pdVar11 + -4) = 0x936a5d;
cVar3 = (*pcVar2)();
pdVar12 = pdVar11;
if (cVar3 != '\0') {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Used object";
goto LAB_009366a0;
}
}
LAB_00936a31:
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
pdVar11 = pdVar12;
LAB_009366a0:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return this;
}
/* WARNING: Subroutine does not return */
*(undefined1 **)((int)pdVar11 + -4) = &LAB_00936c45;
__stack_chk_fail();
}
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.