CTongue::OnUpdateExtendingState
0x008458f0 · 3087 bytes · __thiscall
_ZN7CTongue22OnUpdateExtendingStateEv
Decompiled
undefined (1 param)
/* CTongue::OnUpdateExtendingState() */
void __thiscall CTongue::OnUpdateExtendingState(CTongue *this)
{
uint uVar1;
IHandleEntity *pIVar2;
CBaseEntity *this_00;
CBaseEdict *this_01;
char cVar3;
int iVar4;
int iVar5;
undefined4 uVar6;
int *piVar7;
CTraceFilterSimpleList *this_02;
undefined *puVar8;
longdouble lVar9;
float fVar10;
float fVar11;
float fVar12;
CBaseEntity *local_208;
int local_1f0 [4];
float local_1e0;
float local_1dc;
float local_1d8;
undefined **local_1d4 [4];
undefined **local_1c4 [4];
undefined4 local_1b4 [3];
undefined4 local_1a8;
undefined4 local_1a4;
undefined **local_1a0 [4];
undefined4 local_190 [3];
undefined4 local_184;
undefined4 local_180;
float local_17c;
float local_178;
float local_174;
float local_16c;
float local_168;
float local_164;
undefined4 local_15c;
undefined4 local_158;
undefined4 local_154;
undefined4 local_14c;
undefined4 local_148;
undefined4 local_144;
undefined4 local_13c;
undefined1 local_138;
undefined1 local_137;
float local_12c;
float local_128;
float local_124;
float local_11c;
float local_118;
float local_114;
undefined4 local_10c;
undefined4 local_108;
undefined4 local_104;
undefined4 local_fc;
undefined4 local_f8;
undefined4 local_f4;
undefined4 local_ec;
undefined1 local_e8;
undefined1 local_e7;
Vector local_d0 [12];
float local_c4;
float local_c0;
float local_bc;
float local_a4;
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;
uVar1 = *(uint *)(this + 0x44c);
if ((((uVar1 == 0xffffffff) ||
(puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) ||
(pIVar2 = *(IHandleEntity **)(puVar8 + 4), pIVar2 == (IHandleEntity *)0x0)) {
return;
}
uVar1 = *(uint *)(this + 0x480);
if (((uVar1 == 0xffffffff) ||
(puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
((*(uint *)(puVar8 + 8) != uVar1 >> 0xc ||
(this_00 = *(CBaseEntity **)(puVar8 + 4), this_00 == (CBaseEntity *)0x0)))) {
(**(code **)(*(int *)this + 0x390))(this,"TONGUE: Lost target\n");
if (*(int *)(this + 0x4ac) == 4) {
return;
}
State_Transition();
return;
}
(**(code **)(*(int *)this_00 + 0x234))(&local_7c,this_00);
*(float *)(this + 0x550) = local_7c;
*(float *)(this + 0x554) = local_78;
*(float *)(this + 0x558) = local_74;
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
this_02 = (CTraceFilterSimpleList *)local_1c4;
uVar6 = *(undefined4 *)(this_00 + 0x2e4);
*(undefined4 *)(this + 0x550) = *(undefined4 *)(this_00 + 0x2e0);
*(undefined4 *)(this + 0x554) = uVar6;
CTraceFilterSimpleList::CTraceFilterSimpleList(this_02,0);
local_1c4[0] = &PTR_ShouldHitEntity_00c2e780;
/* try { // try from 00845a45 to 00845a49 has its CatchHandler @ 00846591 */
CTraceFilterSimpleList::CTraceFilterSimpleList((CTraceFilterSimpleList *)local_1a0,0);
local_1a0[0] = &PTR_ShouldHitEntity_00cd7c10;
/* try { // try from 00845a54 to 008464d4 has its CatchHandler @ 00846557 */
cVar3 = CTerrorGameRules::HasPlayerControlledZombies();
if (cVar3 == '\0') {
CTraceFilterSimpleList::AddEntityToIgnore(this_02,pIVar2);
}
else {
CTraceFilterSimpleList::AddEntityToIgnore((CTraceFilterSimpleList *)local_1a0,pIVar2);
this_02 = (CTraceFilterSimpleList *)local_1a0;
}
local_17c = *(float *)(this + 0x544);
local_144 = 0;
local_178 = *(float *)(this + 0x548);
local_138 = 1;
local_16c = *(float *)(this + 0x550) - local_17c;
local_174 = *(float *)(this + 0x54c);
local_148 = 0;
local_168 = *(float *)(this + 0x554) - local_178;
local_14c = 0;
local_13c = 0;
local_164 = *(float *)(this + 0x558) - local_174;
local_154 = 0;
local_158 = 0;
local_15c = 0;
local_137 = local_168 * local_168 + local_16c * local_16c + local_164 * local_164 != 0.0;
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_17c,0x42006081,this_02,local_d0);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_d0,(Vector *)&local_c4,0xff,0,0,true,-1.0);
}
if ((1.0 <= local_a4) || (local_84 == this_00)) {
if (*(float *)(this + 0x49c) != -1.0) {
(**(code **)(*(int *)(this + 0x498) + 4))(this + 0x498,this + 0x49c);
*(undefined4 *)(this + 0x49c) = 0xbf800000;
}
LAB_00845bf6:
local_1e0 = *(float *)(this + 0x550) - *(float *)(this + 0x538);
local_1dc = *(float *)(this + 0x554) - *(float *)(this + 0x53c);
local_1d8 = *(float *)(this + 0x558) - *(float *)(this + 0x540);
lVar9 = (longdouble)VectorNormalize((Vector *)&local_1e0);
fVar11 = *(float *)(TongueFlySpeed._28_4_ + 0x2c) * *(float *)(gpGlobals + 0x10);
fVar10 = (float)lVar9;
if (fVar11 <= (float)lVar9) {
fVar10 = fVar11;
}
fVar11 = local_1e0 * fVar10 + *(float *)(this + 0x538);
fVar12 = local_1dc * fVar10 + *(float *)(this + 0x53c);
fVar10 = fVar10 * local_1d8 + *(float *)(this + 0x540);
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)local_1d4,(IHandleEntity *)0x0,0,
(_func_bool_IHandleEntity_ptr_int *)0x0);
local_78 = *(float *)(this + 0x53c);
local_74 = *(float *)(this + 0x540);
local_44 = 0;
local_48 = 0;
local_68 = fVar12 - local_78;
local_7c = *(float *)(this + 0x538);
local_38 = 1;
local_64 = fVar10 - local_74;
local_4c = 0;
local_3c = 0;
local_6c = fVar11 - local_7c;
local_1d4[0] = &PTR_ShouldHitEntity_00cd7c28;
local_54 = 0;
local_58 = 0;
local_5c = 0;
local_37 = local_64 * local_64 + local_68 * local_68 + local_6c * local_6c != 0.0;
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_7c,0x2006003,local_1d4,local_d0);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_d0,(Vector *)&local_c4,0xff,0,0,true,-1.0);
}
if (((local_a4 < 1.0) && (local_84 != (CBaseEntity *)0x0)) &&
(cVar3 = IsFlimsy(local_84), cVar3 != '\0')) {
local_208 = (CBaseEntity *)0x0;
uVar1 = *(uint *)(this + 0x44c);
if (((uVar1 != 0xffffffff) &&
(puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
local_208 = *(CBaseEntity **)(puVar8 + 4);
}
CTakeDamageInfo::CTakeDamageInfo
((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this,local_208,10.0,0x80,0);
CalculateMeleeDamageForce
((CTakeDamageInfo *)&local_7c,(Vector *)&local_1e0,(Vector *)(this + 0x538),1.0);
ClearMultiDamage();
CBaseEntity::DispatchTraceAttack
((CTakeDamageInfo *)local_84,(Vector *)&local_7c,(CGameTrace *)&local_1e0);
ApplyMultiDamage();
if (*(int *)(local_84 + 0x100) < 1) {
local_128 = *(float *)(this + 0x53c);
local_f4 = 0;
local_124 = *(float *)(this + 0x540);
local_e8 = 1;
local_118 = fVar12 - local_128;
local_12c = *(float *)(this + 0x538);
local_f8 = 0;
local_114 = fVar10 - local_124;
local_fc = 0;
local_ec = 0;
local_11c = fVar11 - local_12c;
local_104 = 0;
local_108 = 0;
local_10c = 0;
local_e7 = local_114 * local_114 + local_118 * local_118 + local_11c * local_11c != 0.0;
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_12c,0x2006003,local_1d4,local_d0);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_d0,(Vector *)&local_c4,0xff,0,0,true,-1.0);
}
}
}
if (((local_c4 != *(float *)(this + 0x538)) || (local_c0 != *(float *)(this + 0x53c))) ||
(local_bc != *(float *)(this + 0x540))) {
if (this[0x6c] == (CTongue)0x0) {
this_01 = *(CBaseEdict **)(this + 0x30);
if (this_01 != (CBaseEdict *)0x0) {
*(uint *)this_01 = *(uint *)this_01 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(this_01);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
this[0x70] = (CTongue)((byte)this[0x70] | 1);
}
*(float *)(this + 0x538) = local_c4;
*(float *)(this + 0x53c) = local_c0;
*(float *)(this + 0x540) = local_bc;
}
CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)(this + 0x538));
if (1.0 <= local_a4) {
if (25.0 <= (*(float *)(this + 0x540) - *(float *)(this + 0x558)) *
(*(float *)(this + 0x540) - *(float *)(this + 0x558)) +
(*(float *)(this + 0x53c) - *(float *)(this + 0x554)) *
(*(float *)(this + 0x53c) - *(float *)(this + 0x554)) +
(*(float *)(this + 0x538) - *(float *)(this + 0x550)) *
(*(float *)(this + 0x538) - *(float *)(this + 0x550))) goto LAB_00845f1f;
if (*(float *)(this + 0x49c) <= 0.0) {
iVar4 = (**(code **)(*(int *)this_00 + 0x52c))(this_00);
iVar5 = (**(code **)(*(int *)pIVar2 + 0x52c))(pIVar2);
if (((iVar5 != 0) && (iVar4 != 0)) &&
(((byte)(*(uint *)(iVar4 + 300) >> 0xb) & 1) !=
((byte)(*(uint *)(iVar5 + 300) >> 0xb) & 1))) {
fVar10 = *(float *)(TongueRange._28_4_ + 0x2c);
if ((OnUpdateExtendingState()::doorStr == '\0') &&
(iVar4 = __cxa_guard_acquire(&OnUpdateExtendingState()::doorStr), iVar4 != 0)) {
DAT_00ffb210 = 0;
OnUpdateExtendingState()::doorStr = 0;
DAT_00ffb20c = "prop_door_rotating_checkpoint";
__cxa_guard_release(&OnUpdateExtendingState()::doorStr);
__cxa_atexit(CGameString::~CGameString,&OnUpdateExtendingState()::doorStr,&__dso_handle)
;
}
uVar6 = (**(code **)(*(int *)pIVar2 + 0x288))(pIVar2);
if ((OnUpdateExtendingState()::doorStr == 0) ||
(iVar4 = OnUpdateExtendingState()::doorStr,
DAT_00ffb210 != CGameString::gm_iSerialNumber)) {
if (DAT_00ffb20c == (char *)0x0) {
iVar4 = 0;
}
else {
AllocPooledString((char *)local_1f0);
OnUpdateExtendingState()::doorStr = local_1f0[0];
DAT_00ffb210 = CGameString::gm_iSerialNumber;
iVar4 = local_1f0[0];
}
}
piVar7 = (int *)CGlobalEntityList::FindEntityByClassnameNearestFast
((CGlobalEntityList *)gEntList,iVar4,uVar6,fVar10 + fVar10);
if (((piVar7 != (int *)0x0) &&
(cVar3 = (**(code **)(*piVar7 + 0x478))(piVar7), cVar3 != '\0')) &&
((piVar7[0x57d] == 0 || (piVar7[0x57d] == 3)))) {
(**(code **)(*(int *)this + 0x390))
(this,
"Tongue dropping because we tried to grab through a closed checkpoint door.")
;
goto LAB_00845f0a;
}
}
if (*(int *)(this + 0x4ac) != 3) {
State_Transition();
}
goto LAB_00845f1f;
}
(**(code **)(*(int *)this + 0x390))
(this,"TONGUE: dropping because failed the last moment LOS check before grabbing.");
}
else {
(**(code **)(*(int *)this + 0x390))(this,"hit geometry");
}
}
else {
if (*(float *)(this + 0x49c) <= 0.0) {
lVar9 = (longdouble)IntervalTimer::Now();
if ((float)lVar9 != *(float *)(this + 0x49c)) {
(**(code **)(*(int *)(this + 0x498) + 4))(this + 0x498,this + 0x49c);
*(float *)(this + 0x49c) = (float)lVar9;
}
goto LAB_00845bf6;
}
lVar9 = (longdouble)IntervalTimer::Now();
if ((float)lVar9 - *(float *)(this + 0x49c) < *(float *)(TongueLOSForgivenessTime._28_4_ + 0x2c)
|| (float)lVar9 - *(float *)(this + 0x49c) ==
*(float *)(TongueLOSForgivenessTime._28_4_ + 0x2c)) goto LAB_00845bf6;
(**(code **)(*(int *)this + 0x390))(this,"TONGUE: Lost line of sight\n");
}
LAB_00845f0a:
if (*(int *)(this + 0x4ac) != 4) {
State_Transition();
}
LAB_00845f1f:
local_1a0[0] = &PTR_ShouldHitEntity_00c54590;
local_184 = 0;
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_190);
local_180 = local_190[0];
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_190);
local_1c4[0] = &PTR_ShouldHitEntity_00c54590;
local_1a8 = 0;
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_1b4);
local_1a4 = local_1b4[0];
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_1b4);
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.