L L4D2node

CCarGlassProp::OnTakeDamage

0x007ff920 · 1317 bytes · __thiscall

_ZN13CCarGlassProp12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

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

{
  uint uVar1;
  CDirector *this_00;
  char cVar2;
  int iVar3;
  CBaseEntity *this_01;
  int *piVar4;
  undefined *puVar5;
  longdouble lVar6;
  float fVar7;
  CBaseEntity *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);
    cVar2 = IsASurvivorTeam(iVar3);
    if ((((cVar2 != '\0') && (*(int *)(param_1 + 0x4c) != -1)) &&
        ((((byte)param_1[0x48] & 8) == 0 &&
         ((uVar1 = *(uint *)(this + 0x180), uVar1 != 0xffffffff &&
          (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc))))))
       && ((*(uint *)(puVar5 + 8) == uVar1 >> 0xc &&
           (((((*(int *)(puVar5 + 4) != 0 &&
               (this_01 = (CBaseEntity *)
                          __dynamic_cast(*(int *)(puVar5 + 4),&CBaseEntity::typeinfo,
                                         &CCarProp::typeinfo,0), this_01 != (CBaseEntity *)0x0)) &&
              (this_01[0x1710] == (CBaseEntity)0x0)) &&
             ((this_01[0x1711] == (CBaseEntity)0x0 && (this_01[0x16f5] == (CBaseEntity)0x0)))) &&
            ((*(float *)(this_01 + 0x1700) <= 0.0 ||
             (lVar6 = (longdouble)CountdownTimer::Now(),
             *(float *)(this_01 + 0x1700) <= (float)lVar6)))))))) {
      fVar7 = *(float *)(car_alarm_distance._28_4_ + 0x2c);
      if (((byte)this_01[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(this_01);
      }
      if (((byte)local_58[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(local_58);
      }
      if ((*(float *)(local_58 + 0x2e0) - *(float *)(this_01 + 0x2e0)) *
          (*(float *)(local_58 + 0x2e0) - *(float *)(this_01 + 0x2e0)) +
          (*(float *)(local_58 + 0x2e4) - *(float *)(this_01 + 0x2e4)) *
          (*(float *)(local_58 + 0x2e4) - *(float *)(this_01 + 0x2e4)) +
          (*(float *)(local_58 + 0x2e8) - *(float *)(this_01 + 0x2e8)) *
          (*(float *)(local_58 + 0x2e8) - *(float *)(this_01 + 0x2e8)) <= 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_007ff956;
        }
        cVar2 = CDirector::OnMapInvokedPanicEvent(TheDirector,local_58,1);
        this_00 = TheDirector;
        if (cVar2 != '\0') {
          this_01[0x16f5] = (CBaseEntity)0x1;
          CDirector::UnregisterForbiddenTarget(this_00,this_01);
          this_01[0x16f4] = (CBaseEntity)0x0;
          if (0.0 < *(float *)(this_01 + 0x170c)) {
            pcVar12 = "ContextAlarm";
            uVar11 = 0;
            CBaseEntity::ThinkSet((_func_void *)local_54,(float)this_01,(char *)0x0);
            uVar10 = 0;
            pCVar8 = this_01;
            COutputEvent::FireOutput((COutputEvent *)(this_01 + 0x16dc),this_01,this_01,0.0);
            if (*(float *)(this_01 + 0x170c) != -1.0) {
              (**(code **)(*(int *)(this_01 + 0x1704) + 4))
                        (this_01 + 0x1704,this_01 + 0x170c,pCVar8,uVar10,uVar11,pcVar12);
              *(undefined4 *)(this_01 + 0x170c) = 0xbf800000;
            }
          }
          CL4DGameStats::Event_CarAlarm((CL4DGameStats *)CL4D_GameStats);
          COutputEvent::FireOutput((COutputEvent *)(this_01 + 0x1694),this_01,this_01,0.0);
          fVar7 = *(float *)(car_alarm_duration._28_4_ + 0x2c);
          lVar6 = (longdouble)CountdownTimer::Now();
          if ((float)lVar6 + fVar7 != *(float *)(this_01 + 0x1700)) {
            (**(code **)(*(int *)(this_01 + 0x16f8) + 4))(this_01 + 0x16f8,this_01 + 0x1700);
            *(float *)(this_01 + 0x1700) = (float)lVar6 + fVar7;
          }
          if (fVar7 != *(float *)(this_01 + 0x16fc)) {
            (**(code **)(*(int *)(this_01 + 0x16f8) + 4))(this_01 + 0x16f8,this_01 + 0x16fc);
            *(float *)(this_01 + 0x16fc) = fVar7;
          }
          fVar7 = *(float *)(car_alarm_duration._28_4_ + 0x2c) + *(float *)(gpGlobals + 0xc);
          pcVar12 = "ContextAlarm";
          pcVar9 = CCarProp::AlarmEndThink;
          uVar10 = 0;
          CBaseEntity::ThinkSet
                    ((_func_void *)local_54,(float)this_01,(char *)CCarProp::AlarmEndThink);
          if (local_58 != (CBaseEntity *)0x0) {
            AI_CriteriaSet::AI_CriteriaSet(local_3c);
                    /* try { // try from 007ffcd7 to 007ffd64 has its CatchHandler @ 007ffe53 */
            pcVar12 = (char *)SurvivorCharacterName
                                        (*(undefined4 *)(local_58 + 0x2ba0),this_01,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);
          }
        }
      }
    }
  }
LAB_007ff956:
  CBreakableProp::OnTakeDamage((CBreakableProp *)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)