CTankTrainAI::Think
0x00836ee0 · 573 bytes · __thiscall
_ZN12CTankTrainAI5ThinkEv
Decompiled
undefined (1 param)
/* CTankTrainAI::Think() */
void __thiscall CTankTrainAI::Think(CTankTrainAI *this)
{
float fVar1;
uint uVar2;
CBaseEntity *this_00;
int iVar3;
undefined *puVar4;
float fVar5;
CTankTrainAI *this_01;
uVar2 = *(uint *)(this + 0x440);
if ((((uVar2 == 0xffffffff) ||
(puVar4 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar4 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar4 + 8) != uVar2 >> 0xc)) ||
(this_00 = *(CBaseEntity **)(puVar4 + 4), this_00 == (CBaseEntity *)0x0)) {
SoundShutdown(this);
UTIL_Remove((CBaseEntity *)this);
return;
}
if (this_00[0x104] != (CBaseEntity)0x0) {
SoundShutdown(this);
UTIL_RemoveHierarchy(this_00);
UTIL_Remove((CBaseEntity *)this);
return;
}
uVar2 = *(uint *)(this + 0x444);
if (((uVar2 != 0xffffffff) &&
(puVar4 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar4 + 8) == uVar2 >> 0xc && (*(int *)(puVar4 + 4) != 0)))) {
iVar3 = PathFindDirection(*(CPathTrack **)(this_00 + 0x440),(Vector *)(this_00 + 0x39c),
(Vector *)(*(int *)(puVar4 + 4) + 0x39c));
if (iVar3 != 0) {
fVar5 = (float)iVar3;
goto LAB_00836fab;
}
}
fVar5 = -1.0;
if (*(float *)(this_00 + 0x11c) <= 0.0) {
if (0.0 <= *(float *)(this_00 + 0x11c)) {
this_01 = this;
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.5,(char *)0x0);
if (*(int *)(this + 0x448) != 0) {
SoundEngineStop(this_01);
}
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 1.0,(char *)0x0);
return;
}
fVar5 = 1.0;
}
LAB_00836fab:
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.5,(char *)0x0);
fVar1 = *(float *)(this_00 + 0x11c);
CFuncTrackTrain::SetSpeed((CFuncTrackTrain *)this_00,fVar5,false);
if ((*(float *)(this_00 + 0x11c) != 0.0) || (fVar1 == 0.0)) {
if ((*(float *)(this_00 + 0x11c) != 0.0) && (fVar1 == 0.0)) {
SoundEngineStart(this);
return;
}
}
else if (*(int *)(this + 0x448) != 0) {
SoundEngineStop(this);
return;
}
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.