L L4D2node

CCarProp::OnTakeDamage

0x008006a0 · 1310 bytes · __thiscall

_ZN8CCarProp12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* CCarProp::OnTakeDamage(CTakeDamageInfo const&) */

void __thiscall CCarProp::OnTakeDamage(CCarProp *this,CTakeDamageInfo *param_1)

{
  uint uVar1;
  CDirector *this_00;
  char cVar2;
  int iVar3;
  int *piVar4;
  undefined *puVar5;
  longdouble lVar6;
  float fVar7;
  CCarProp *pCVar8;
  code *pcVar9;
  undefined4 uVar10;
  undefined4 uVar11;
  char *pcVar12;
  CBaseEntity *local_58;
  undefined1 local_54 [8];
  CAI_Concept local_4c [8];
  undefined4 local_44;
  undefined4 local_40;
  AI_CriteriaSet local_3c [44];
  
  uVar1 = *(uint *)(param_1 + 0x34);
  if ((((uVar1 != 0xffffffff) &&
       (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)) &&
     (local_58 = *(CBaseEntity **)(puVar5 + 4), local_58 != (CBaseEntity *)0x0)) {
    iVar3 = CBaseEntity::GetTeamNumber(local_58);
    if (iVar3 == 2) {
      if ((((*(int *)(param_1 + 0x4c) != -1) && (((byte)param_1[0x48] & 8) == 0)) &&
          ((this[0x1710] == (CCarProp)0x0 &&
           ((this[0x1711] == (CCarProp)0x0 && (this[0x16f5] == (CCarProp)0x0)))))) &&
         ((*(float *)(this + 0x1700) <= 0.0 ||
          (lVar6 = (longdouble)CountdownTimer::Now(), *(float *)(this + 0x1700) <= (float)lVar6))))
      {
        fVar7 = *(float *)(car_alarm_distance._28_4_ + 0x2c);
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        }
        if (((byte)local_58[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(local_58);
        }
        if ((*(float *)(local_58 + 0x2e8) - *(float *)(this + 0x2e8)) *
            (*(float *)(local_58 + 0x2e8) - *(float *)(this + 0x2e8)) +
            (*(float *)(local_58 + 0x2e0) - *(float *)(this + 0x2e0)) *
            (*(float *)(local_58 + 0x2e0) - *(float *)(this + 0x2e0)) +
            (*(float *)(local_58 + 0x2e4) - *(float *)(this + 0x2e4)) *
            (*(float *)(local_58 + 0x2e4) - *(float *)(this + 0x2e4)) <= fVar7 * fVar7) {
          cVar2 = (**(code **)(*(int *)local_58 + 0x16c))(local_58);
          if (cVar2 == '\0') {
            local_58 = (CBaseEntity *)0x0;
          }
          else {
            cVar2 = (**(code **)(*(int *)local_58 + 0x778))(local_58);
            if (cVar2 != '\0') goto LAB_008006d9;
          }
          cVar2 = CDirector::OnMapInvokedPanicEvent(TheDirector,local_58,1);
          this_00 = TheDirector;
          if (cVar2 != '\0') {
            this[0x16f5] = (CCarProp)0x1;
            CDirector::UnregisterForbiddenTarget(this_00,(CBaseEntity *)this);
            this[0x16f4] = (CCarProp)0x0;
            if (0.0 < *(float *)(this + 0x170c)) {
              ChirpEndThink(this);
            }
            CL4DGameStats::Event_CarAlarm((CL4DGameStats *)CL4D_GameStats);
            COutputEvent::FireOutput
                      ((COutputEvent *)(this + 0x1694),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
            fVar7 = *(float *)(car_alarm_duration._28_4_ + 0x2c);
            lVar6 = (longdouble)CountdownTimer::Now();
            if ((float)lVar6 + fVar7 != *(float *)(this + 0x1700)) {
              (**(code **)(*(int *)(this + 0x16f8) + 4))(this + 0x16f8,this + 0x1700);
              *(float *)(this + 0x1700) = (float)lVar6 + fVar7;
            }
            if (fVar7 != *(float *)(this + 0x16fc)) {
              (**(code **)(*(int *)(this + 0x16f8) + 4))(this + 0x16f8,this + 0x16fc);
              *(float *)(this + 0x16fc) = fVar7;
            }
            fVar7 = *(float *)(car_alarm_duration._28_4_ + 0x2c) + *(float *)(gpGlobals + 0xc);
            pcVar12 = "ContextAlarm";
            pcVar9 = AlarmEndThink;
            uVar10 = 0;
            pCVar8 = this;
            CBaseEntity::ThinkSet((_func_void *)local_54,(float)this,(char *)AlarmEndThink);
            if (local_58 != (CBaseEntity *)0x0) {
              AI_CriteriaSet::AI_CriteriaSet(local_3c);
                    /* try { // try from 00800a46 to 00800ad6 has its CatchHandler @ 00800bc8 */
              pcVar12 = (char *)SurvivorCharacterName
                                          (*(undefined4 *)(local_58 + 0x2ba0),pCVar8,pcVar9,uVar10,
                                           fVar7,pcVar12);
              AI_CriteriaSet::AppendCriteria(local_3c,"Subject",pcVar12,1.0);
              AI_CriteriaSet::AppendCriteria(local_3c,"PanicType","CarAlarm",1.0);
              local_44 = 1;
              local_40 = 0xffffffff;
              CAI_Concept::CAI_Concept(local_4c,"PanicEvent");
              CResponseQueue::Add((CResponseQueue *)g_ResponseQueueManager._12_4_,local_4c,local_3c,
                                  0.0,(CFollowupTargetSpec_t *)&local_44,(CBaseEntity *)0x0);
              AI_CriteriaSet::~AI_CriteriaSet(local_3c);
            }
            piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                      (gameeventmanager,"triggered_car_alarm",0,0);
            if (piVar4 != (int *)0x0) {
              pcVar9 = *(code **)(*piVar4 + 0x30);
              uVar10 = 0;
              if (local_58 != (CBaseEntity *)0x0) {
                uVar10 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(local_58 + 0x30));
              }
              (*pcVar9)(piVar4,"userid",uVar10);
              (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,0);
            }
          }
        }
      }
    }
    else if ((((iVar3 == 3) &&
              (cVar2 = (**(code **)(*(int *)local_58 + 0x16c))(local_58), cVar2 != '\0')) &&
             (iVar3 = CBaseEntity::GetTeamNumber(local_58), iVar3 == 3)) &&
            ((iVar3 = (**(code **)(*(int *)local_58 + 0x544))(local_58), iVar3 == 8 &&
             (this[0x16f5] == (CCarProp)0x0)))) {
      this[0x1710] = (CCarProp)0x1;
      pcVar12 = "ContextAlarm";
      uVar11 = 0;
      CBaseEntity::ThinkSet((_func_void *)local_54,(float)this,(char *)0x0);
      uVar10 = 0;
      pCVar8 = this;
      COutputEvent::FireOutput
                ((COutputEvent *)(this + 0x16ac),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
      if (*(float *)(this + 0x170c) != -1.0) {
        (**(code **)(*(int *)(this + 0x1704) + 4))
                  (this + 0x1704,this + 0x170c,pCVar8,uVar10,uVar11,pcVar12);
        *(undefined4 *)(this + 0x170c) = 0xbf800000;
      }
      *(undefined4 *)(this + 0xd8) = 0;
      *(undefined4 *)(this + 0xdc) = 0;
    }
  }
LAB_008006d9:
  CPhysicsProp::OnTakeDamage((CPhysicsProp *)this,param_1);
  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)