CTongue::OnUpdateAttachedToTargetState
0x00844590 · 1856 bytes · __thiscall
_ZN7CTongue29OnUpdateAttachedToTargetStateEv
Decompiled
undefined (1 param)
/* CTongue::OnUpdateAttachedToTargetState() */
void __thiscall CTongue::OnUpdateAttachedToTargetState(CTongue *this)
{
uint uVar1;
int *piVar2;
CBaseEntity *this_00;
CBaseEdict *this_01;
code *pcVar3;
char cVar4;
int iVar5;
undefined4 *puVar6;
int *piVar7;
undefined4 uVar8;
undefined *puVar9;
int iVar10;
CTongue *pCVar11;
float fVar12;
double dVar13;
double dVar14;
char *pcVar15;
uVar1 = *(uint *)(this + 0x44c);
if (uVar1 == 0xffffffff) {
return;
}
puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
if (puVar9 == (undefined *)0xfffffffc) {
return;
}
if (*(uint *)(puVar9 + 8) != uVar1 >> 0xc) {
return;
}
piVar2 = *(int **)(puVar9 + 4);
if (piVar2 == (int *)0x0) {
return;
}
if (*(int *)(TongueForceBreak._28_4_ + 0x30) == 0) {
uVar1 = piVar2[0xcf0];
if ((((uVar1 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) &&
((this_00 = *(CBaseEntity **)(puVar9 + 4), this_00 != (CBaseEntity *)0x0 &&
(cVar4 = (**(code **)(*(int *)this_00 + 300))(this_00), cVar4 != '\0')))) {
iVar5 = CBaseEntity::GetTeamNumber(this_00);
cVar4 = IsASurvivorTeam(iVar5);
if (cVar4 != '\0') {
if ((*(byte *)(piVar2 + 0x54) & 1) == 0) {
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"tongue_broke_bent",0,0);
if (piVar7 != (int *)0x0) {
pcVar3 = *(code **)(*piVar7 + 0x30);
uVar8 = (**(code **)(*engine + 0x40))(engine,piVar2[0xc]);
(*pcVar3)(piVar7,"userid",uVar8);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
iVar5 = *(int *)this;
pcVar15 = "Tongue broke because we left the ground.";
}
else if (((byte)this_00[0x150] & 8) == 0) {
uVar1 = *(uint *)(this_00 + 0x33a4);
if (((uVar1 == 0xffffffff) ||
(puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc))
|| ((*(uint *)(puVar9 + 8) != uVar1 >> 0xc || (*(int *)(puVar9 + 4) == 0)))) {
puVar6 = (undefined4 *)(**(code **)(*(int *)this_00 + 0x288))(this_00);
*(undefined4 *)(this + 0x550) = *puVar6;
*(undefined4 *)(this + 0x554) = puVar6[1];
*(undefined4 *)(this + 0x558) = puVar6[2];
UpdateAirChoke(this);
fVar12 = *(float *)(gpGlobals + 0xc) - *(float *)(this + 0x468);
if ((((*(float *)(TongueNoProgressChokeEarlyAmbushDelay._28_4_ + 0x2c) <= fVar12) &&
(this[0x46c] != (CTongue)0x0)) ||
(*(float *)(TongueNoProgressChokeEarlyDelay._28_4_ + 0x2c) <= fVar12)) &&
(cVar4 = UpdateGroundChoke(this), cVar4 == '\0')) {
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"tongue_broke_bent",0,0);
if (piVar7 != (int *)0x0) {
pcVar3 = *(code **)(*piVar7 + 0x30);
uVar8 = (**(code **)(*engine + 0x40))(engine,piVar2[0xc]);
(*pcVar3)(piVar7,"userid",uVar8);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
goto LAB_0084465c;
}
cVar4 = UpdateBend(this);
if (cVar4 == '\0') {
if (((*(int *)(TongueAllowVoluntaryRelease._28_4_ + 0x30) == 0) ||
(cVar4 = (**(code **)(*piVar2 + 0x778))(piVar2), cVar4 != '\0')) ||
((*(byte *)((int)piVar2 + 0x1cb1) & 8) == 0)) {
fVar12 = *(float *)(this + 0x550);
*(undefined4 *)(this + 0x4a4) = *(undefined4 *)(this + 0x554);
*(float *)(this + 0x4a0) = fVar12;
*(undefined4 *)(this + 0x4a8) = *(undefined4 *)(this + 0x558);
if (this_00[0x33dc] == (CBaseEntity)0x0) {
CTerrorPlayer::NotifyTongueIsPulling((CTerrorPlayer *)this_00,true);
fVar12 = *(float *)(this + 0x550);
}
if (((fVar12 == *(float *)(this + 0x538)) &&
(*(float *)(this + 0x554) == *(float *)(this + 0x53c))) &&
(*(float *)(this + 0x558) == *(float *)(this + 0x540))) {
return;
}
if (this[0x6c] == (CTongue)0x0) {
this_01 = *(CBaseEdict **)(this + 0x30);
if (this_01 != (CBaseEdict *)0x0) {
*(uint *)this_01 = *(uint *)this_01 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(this_01);
*(undefined2 *)(iVar5 + 2) = 0;
fVar12 = *(float *)(this + 0x550);
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(float *)(this + 0x538) = fVar12;
*(undefined4 *)(this + 0x53c) = *(undefined4 *)(this + 0x554);
*(undefined4 *)(this + 0x540) = *(undefined4 *)(this + 0x558);
return;
}
(**(code **)(*(int *)this + 0x390))(this,"Tongue dropping because we released it.");
if (*(int *)(this + 0x4ac) == 4) {
return;
}
goto LAB_0084462e;
}
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"tongue_broke_bent",0,0);
if (piVar7 != (int *)0x0) {
pcVar3 = *(code **)(*piVar7 + 0x30);
uVar8 = (**(code **)(*engine + 0x40))(engine,piVar2[0xc]);
(*pcVar3)(piVar7,"userid",uVar8);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
(**(code **)(*(int *)this + 0x390))
(this,"Tongue dropping because it bent too many times.");
if (0 < *(int *)(this + 0x534)) {
iVar5 = 0;
pCVar11 = this;
do {
iVar10 = iVar5 + 1;
(**(code **)(*(int *)this + 0x390))
(this,"Bend point %d: %f %f %f",iVar5,(double)*(float *)(pCVar11 + 0x4bc),
(double)*(float *)(pCVar11 + 0x4c0),(double)*(float *)(pCVar11 + 0x4c4));
iVar5 = iVar10;
pCVar11 = pCVar11 + 0xc;
} while (iVar10 < *(int *)(this + 0x534));
}
pcVar3 = *(code **)(*(int *)this + 0x390);
if (((byte)this_00[0x14d] & 8) == 0) {
dVar14 = (double)*(float *)(this_00 + 0x2e8);
LAB_00844b5d:
dVar13 = (double)*(float *)(this_00 + 0x2e4);
}
else {
CBaseEntity::CalcAbsolutePosition(this_00);
dVar14 = (double)*(float *)(this_00 + 0x2e8);
if (((byte)this_00[0x14d] & 8) == 0) goto LAB_00844b5d;
CBaseEntity::CalcAbsolutePosition(this_00);
dVar13 = (double)*(float *)(this_00 + 0x2e4);
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
}
(*pcVar3)(this,"Target is at %f %f %f",(double)*(float *)(this_00 + 0x2e0),
SUB84(dVar13,0),(int)((ulonglong)dVar13 >> 0x20),SUB84(dVar14,0),
(int)((ulonglong)dVar14 >> 0x20));
iVar5 = *(int *)(this + 0x4ac);
goto joined_r0x00844b99;
}
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"tongue_broke_bent",0,0);
if (piVar7 != (int *)0x0) {
pcVar3 = *(code **)(*piVar7 + 0x30);
uVar8 = (**(code **)(*engine + 0x40))(engine,piVar2[0xc]);
(*pcVar3)(piVar7,"userid",uVar8);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
iVar5 = *(int *)this;
pcVar15 = "Tongue broke because victim is on the rescue vehicle.";
}
else {
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"tongue_broke_bent",0,0);
if (piVar7 != (int *)0x0) {
pcVar3 = *(code **)(*piVar7 + 0x30);
uVar8 = (**(code **)(*engine + 0x40))(engine,piVar2[0xc]);
(*pcVar3)(piVar7,"userid",uVar8);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
iVar5 = *(int *)this;
pcVar15 = "Tongue broke because victim is on a moving platform.";
}
(**(code **)(iVar5 + 0x394))(this,this_00,pcVar15);
iVar5 = *(int *)(this + 0x4ac);
goto joined_r0x00844b99;
}
}
(**(code **)(*(int *)this + 0x390))(this,"Tongue dropping because we no longer have a target.");
iVar5 = *(int *)(this + 0x4ac);
}
else {
ConVar::SetValue(0xffa800);
LAB_0084465c:
iVar5 = *(int *)(this + 0x4ac);
}
joined_r0x00844b99:
if (iVar5 == 4) {
return;
}
LAB_0084462e:
State_Transition();
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.