CTongue::OnEnterAttachedToTargetState
0x00842360 · 1860 bytes · __thiscall
_ZN7CTongue28OnEnterAttachedToTargetStateEv
Decompiled
undefined (1 param)
/* CTongue::OnEnterAttachedToTargetState() */
void __thiscall CTongue::OnEnterAttachedToTargetState(CTongue *this)
{
undefined4 uVar1;
undefined4 uVar2;
uint uVar3;
CTerrorPlayer *this_00;
CBaseEntity *pCVar4;
CBaseEdict *pCVar5;
char cVar6;
int iVar7;
int iVar8;
undefined *puVar9;
float fVar10;
float *local_40;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
uVar3 = *(uint *)(this + 0x44c);
if ((((uVar3 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar3 >> 0xc)) &&
(this_00 = *(CTerrorPlayer **)(puVar9 + 4), this_00 != (CTerrorPlayer *)0x0)) {
uVar3 = *(uint *)(this + 0x480);
if (((uVar3 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar9 + 8) == uVar3 >> 0xc &&
((pCVar4 = *(CBaseEntity **)(puVar9 + 4), pCVar4 != (CBaseEntity *)0x0 &&
(cVar6 = (**(code **)(*(int *)pCVar4 + 300))(pCVar4), cVar6 != '\0')))))) {
iVar7 = CBaseEntity::GetTeamNumber(pCVar4);
cVar6 = IsASurvivorTeam(iVar7);
if (cVar6 != '\0') {
CTerrorPlayer::GrabVictimWithTongue(this_00,(CTerrorPlayer *)pCVar4);
uVar3 = *(uint *)(this_00 + 0x33c0);
if ((((uVar3 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar9 + 8) == uVar3 >> 0xc)) &&
(pCVar4 = *(CBaseEntity **)(puVar9 + 4), pCVar4 != (CBaseEntity *)0x0)) {
iVar7 = *(int *)(this_00 + 0x100);
if (iVar7 != *(int *)(this + 0x460)) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(int *)(this + 0x460) = iVar7;
}
*(undefined4 *)(this + 0x56c) = *(undefined4 *)(pCVar4 + 0x2ba0);
if (((byte)pCVar4[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar4);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_00);
}
fVar10 = SQRT((*(float *)(this_00 + 0x2e0) - *(float *)(pCVar4 + 0x2e0)) *
(*(float *)(this_00 + 0x2e0) - *(float *)(pCVar4 + 0x2e0)) +
(*(float *)(this_00 + 0x2e8) - *(float *)(pCVar4 + 0x2e8)) *
(*(float *)(this_00 + 0x2e8) - *(float *)(pCVar4 + 0x2e8)) +
(*(float *)(this_00 + 0x2e4) - *(float *)(pCVar4 + 0x2e4)) *
(*(float *)(this_00 + 0x2e4) - *(float *)(pCVar4 + 0x2e4)));
if (fVar10 != *(float *)(this + 0x464)) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(float *)(this + 0x464) = fVar10;
}
if (((byte)pCVar4[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar4);
}
iVar7 = gpGlobals;
*(undefined4 *)(this + 0x58c) = *(undefined4 *)(pCVar4 + 0x2e0);
*(undefined4 *)(this + 0x590) = *(undefined4 *)(pCVar4 + 0x2e4);
*(undefined4 *)(this + 0x594) = *(undefined4 *)(pCVar4 + 0x2e8);
fVar10 = *(float *)(iVar7 + 0xc);
if (fVar10 != *(float *)(this + 0x468)) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(float *)(this + 0x468) = fVar10;
}
if (this[0x46c] != (CTongue)0x0) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
this[0x46c] = (CTongue)0x0;
}
cVar6 = CTerrorGameRules::HasPlayerControlledZombies();
if (cVar6 != '\0') {
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_00);
}
if (((byte)pCVar4[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar4);
}
local_34 = *(float *)(pCVar4 + 0x2e0) - *(float *)(this_00 + 0x2e0);
local_30 = *(float *)(pCVar4 + 0x2e4) - *(float *)(this_00 + 0x2e4);
local_2c = *(float *)(pCVar4 + 0x2e8) - *(float *)(this_00 + 0x2e8);
(**(code **)(*(int *)pCVar4 + 0x24c))(pCVar4,(Vector *)&local_28,0,0);
VectorNormalize((Vector *)&local_34);
VectorNormalize((Vector *)&local_28);
if ((0.0 < local_24 * local_30 + local_28 * local_34 + local_20 * local_2c) &&
((**(code **)(*(int *)this + 0x390))
(this,"Tongue from behind, attack was an ambush.\n"),
this[0x46c] != (CTongue)0x1)) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
this[0x46c] = (CTongue)0x1;
}
}
local_40 = &local_28;
fVar10 = *(float *)(this + 0x464);
if (fVar10 != *(float *)(this + 0x470)) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(float *)(this + 0x470) = fVar10;
}
fVar10 = *(float *)(gpGlobals + 0xc);
if (fVar10 != *(float *)(this + 0x474)) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(float *)(this + 0x474) = fVar10;
}
if (*(float *)(this + 0x494) != -1.0) {
(**(code **)(*(int *)(this + 0x490) + 4))(this + 0x490,this + 0x494);
*(undefined4 *)(this + 0x494) = 0xbf800000;
}
CBaseAbility::StartActivationTimer
((CBaseAbility *)this,*(float *)(TongueHitDelay._28_4_ + 0x2c),0.0);
if (*(int *)(this + 0x534) != 0) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x534) = 0;
}
(**(code **)(*(int *)pCVar4 + 0x234))(local_40,pCVar4);
*(float *)(this + 0x550) = local_28;
*(float *)(this + 0x554) = local_24;
*(float *)(this + 0x558) = local_20;
if (((byte)pCVar4[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar4);
local_20 = *(float *)(this + 0x558);
}
puVar9 = g_pEntityList;
uVar1 = *(undefined4 *)(pCVar4 + 0x2e0);
uVar2 = *(undefined4 *)(pCVar4 + 0x2e4);
*(float *)(this + 0x4a8) = local_20;
*(undefined4 *)(this + 0x550) = uVar1;
*(undefined4 *)(this + 0x554) = uVar2;
*(undefined4 *)(this + 0x4a0) = uVar1;
*(undefined4 *)(this + 0x4a4) = uVar2;
if ((puVar9 == (undefined *)0xfffffffc) || (*(int *)(puVar9 + 8) != 0)) {
iVar7 = 0;
}
else {
iVar7 = *(int *)(puVar9 + 4);
}
uVar3 = *(uint *)(this + 0x480);
if (((uVar3 == 0xffffffff) ||
(puVar9 = puVar9 + (uVar3 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar9 + 8) != uVar3 >> 0xc)) {
iVar8 = 0;
}
else {
iVar8 = *(int *)(puVar9 + 4);
}
if (iVar7 != iVar8) {
if (this[0x6c] == (CTongue)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x480) = 0;
}
*(undefined4 *)(this + 0x568) = *(undefined4 *)(TongueHealth._28_4_ + 0x2c);
(**(code **)(*(int *)this_00 + 0x7fc))(this_00,0x59,0);
return;
}
(**(code **)(*(int *)this + 0x390))
(this,"Tongue dropping because GrabVictimWithTongue somehow failed.");
if (*(int *)(this + 0x4ac) == 4) {
return;
}
goto LAB_008423f2;
}
}
(**(code **)(*(int *)this + 0x390))(this,"TONGUE: not a good target\n");
if (*(int *)(this + 0x4ac) != 4) {
LAB_008423f2:
State_Transition();
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.