L L4D2node

CTongue::OnUpdateMisfireState

0x00841d10 · 1579 bytes · __thiscall

_ZN7CTongue20OnUpdateMisfireStateEv

Decompiled

undefined (1 param)

/* CTongue::OnUpdateMisfireState() */

void __thiscall CTongue::OnUpdateMisfireState(CTongue *this)

{
  CBaseEdict *this_00;
  uint uVar1;
  char cVar2;
  int iVar3;
  undefined *puVar4;
  longdouble lVar5;
  float fVar6;
  float fVar7;
  float fVar8;
  CBaseEntity *local_160;
  float local_148;
  float local_144;
  float local_140;
  undefined **local_13c [4];
  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;
  
  if (((*(float *)(this + 0x4b8) <= 0.0) ||
      (lVar5 = (longdouble)IntervalTimer::Now(), 1.0 < (float)lVar5 - *(float *)(this + 0x4b8))) &&
     (*(int *)(this + 0x4ac) != 0)) {
    State_Transition();
  }
  if ((((*(float *)(this + 0x55c) <= -0.01) || (0.01 <= *(float *)(this + 0x55c))) ||
      ((*(float *)(this + 0x560) <= -0.01 ||
       ((0.01 <= *(float *)(this + 0x560) || (*(float *)(this + 0x564) <= -0.01)))))) ||
     (0.01 <= *(float *)(this + 0x564))) {
    local_148 = *(float *)(this + 0x55c);
    local_144 = *(float *)(this + 0x560);
    local_140 = *(float *)(this + 0x564);
    VectorNormalize((Vector *)&local_148);
    fVar6 = *(float *)(gpGlobals + 0x10) * *(float *)(TongueFlySpeed._28_4_ + 0x2c);
    fVar8 = local_148 * fVar6 + *(float *)(this + 0x538);
    fVar7 = local_144 * fVar6 + *(float *)(this + 0x53c);
    fVar6 = local_140 * fVar6 + *(float *)(this + 0x540);
    CTraceFilterSimple::CTraceFilterSimple
              ((CTraceFilterSimple *)local_13c,(IHandleEntity *)0x0,0,
               (_func_bool_IHandleEntity_ptr_int *)0x0);
    local_7c = *(float *)(this + 0x538);
    local_78 = *(float *)(this + 0x53c);
    local_44 = 0;
    local_48 = 0;
    local_4c = 0;
    local_6c = fVar8 - local_7c;
    local_74 = *(float *)(this + 0x540);
    local_38 = 1;
    local_68 = fVar7 - local_78;
    local_3c = 0;
    local_54 = 0;
    local_64 = fVar6 - local_74;
    local_13c[0] = &PTR_ShouldHitEntity_00cd7c28;
    local_58 = 0;
    local_5c = 0;
    local_37 = local_68 * local_68 + local_6c * local_6c + local_64 * local_64 != 0.0;
    (**(code **)(*enginetrace + 0x14))
              (enginetrace,&local_7c,0x2006003,(CTraceFilterSimple *)local_13c,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)) &&
       (cVar2 = IsFlimsy(local_84), cVar2 != '\0')) {
      local_160 = (CBaseEntity *)0x0;
      uVar1 = *(uint *)(this + 0x44c);
      if (((uVar1 != 0xffffffff) &&
          (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
        local_160 = *(CBaseEntity **)(puVar4 + 4);
      }
      CTakeDamageInfo::CTakeDamageInfo
                ((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this,local_160,10.0,0x80,0);
      CalculateMeleeDamageForce
                ((CTakeDamageInfo *)&local_7c,(Vector *)&local_148,(Vector *)(this + 0x538),1.0);
      ClearMultiDamage();
      CBaseEntity::DispatchTraceAttack
                ((CTakeDamageInfo *)local_84,(Vector *)&local_7c,(CGameTrace *)&local_148);
      ApplyMultiDamage();
      if (*(int *)(local_84 + 0x100) < 1) {
        local_128 = *(float *)(this + 0x53c);
        local_e8 = 1;
        local_124 = *(float *)(this + 0x540);
        local_f4 = 0;
        local_118 = fVar7 - local_128;
        local_12c = *(float *)(this + 0x538);
        local_f8 = 0;
        local_114 = fVar6 - local_124;
        local_fc = 0;
        local_ec = 0;
        local_11c = fVar8 - local_12c;
        local_104 = 0;
        local_108 = 0;
        local_10c = 0;
        local_e7 = local_118 * local_118 + local_114 * local_114 + local_11c * local_11c != 0.0;
        (**(code **)(*enginetrace + 0x14))
                  (enginetrace,&local_12c,0x2006003,(CTraceFilterSimple *)local_13c,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_00 = *(CBaseEdict **)(this + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar3 + 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;
    }
    if (local_a4 < 1.0) {
      *(undefined4 *)(this + 0x55c) = 0;
      *(undefined4 *)(this + 0x560) = 0;
      *(undefined4 *)(this + 0x564) = 0;
    }
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)