L L4D2node

CCarProp::AlarmTouch

0x007ff440 · 1205 bytes · __thiscall

_ZN8CCarProp10AlarmTouchEP11CBaseEntity

Decompiled

undefined (2 params)

/* CCarProp::AlarmTouch(CBaseEntity*) */

void __thiscall CCarProp::AlarmTouch(CCarProp *this,CBaseEntity *param_1)

{
  char cVar1;
  int iVar2;
  int *piVar3;
  longdouble lVar4;
  float fVar5;
  CCarProp *pCVar6;
  code *pcVar7;
  undefined4 uVar8;
  undefined4 uVar9;
  char *pcVar10;
  undefined1 local_54 [8];
  CAI_Concept local_4c [8];
  undefined4 local_44;
  undefined4 local_40;
  AI_CriteriaSet local_3c [44];
  
  iVar2 = CBaseEntity::GetTeamNumber(param_1);
  if (((((iVar2 == 2) && (cVar1 = CTerrorGameRules::HasPlayerControlledZombies(), cVar1 != '\0')) &&
       (param_1 != (CBaseEntity *)0x0)) &&
      ((cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1), cVar1 != '\0' &&
       (cVar1 = CTerrorPlayer::IsDominatedBySpecialInfected((CTerrorPlayer *)param_1), cVar1 != '\0'
       )))) && ((this[0x1710] == (CCarProp)0x0 &&
                ((this[0x1711] == (CCarProp)0x0 && (this[0x16f5] == (CCarProp)0x0)))))) {
    if ((0.0 < *(float *)(this + 0x1700)) &&
       (lVar4 = (longdouble)CountdownTimer::Now(), (float)lVar4 < *(float *)(this + 0x1700))) {
      return;
    }
    fVar5 = *(float *)(car_alarm_distance._28_4_ + 0x2c);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(param_1);
    }
    if ((*(float *)(param_1 + 0x2e8) - *(float *)(this + 0x2e8)) *
        (*(float *)(param_1 + 0x2e8) - *(float *)(this + 0x2e8)) +
        (*(float *)(param_1 + 0x2e4) - *(float *)(this + 0x2e4)) *
        (*(float *)(param_1 + 0x2e4) - *(float *)(this + 0x2e4)) +
        (*(float *)(param_1 + 0x2e0) - *(float *)(this + 0x2e0)) *
        (*(float *)(param_1 + 0x2e0) - *(float *)(this + 0x2e0)) <= fVar5 * fVar5) {
      cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
      if (cVar1 == '\0') {
        param_1 = (CBaseEntity *)0x0;
      }
      else {
        cVar1 = (**(code **)(*(int *)param_1 + 0x778))(param_1);
        if (cVar1 != '\0') {
          return;
        }
      }
      cVar1 = CDirector::OnMapInvokedPanicEvent(TheDirector,param_1,1);
      if (cVar1 != '\0') {
        this[0x16f5] = (CCarProp)0x1;
        CDirector::UnregisterForbiddenTarget(TheDirector,(CBaseEntity *)this);
        this[0x16f4] = (CCarProp)0x0;
        if (0.0 < *(float *)(this + 0x170c)) {
          pcVar10 = "ContextAlarm";
          uVar9 = 0;
          CBaseEntity::ThinkSet((_func_void *)local_54,(float)this,(char *)0x0);
          uVar8 = 0;
          pCVar6 = this;
          COutputEvent::FireOutput
                    ((COutputEvent *)(this + 0x16dc),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
          if (*(float *)(this + 0x170c) != -1.0) {
            (**(code **)(*(int *)(this + 0x1704) + 4))
                      (this + 0x1704,this + 0x170c,pCVar6,uVar8,uVar9,pcVar10);
            *(undefined4 *)(this + 0x170c) = 0xbf800000;
          }
        }
        CL4DGameStats::Event_CarAlarm((CL4DGameStats *)CL4D_GameStats);
        COutputEvent::FireOutput
                  ((COutputEvent *)(this + 0x1694),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
        fVar5 = *(float *)(car_alarm_duration._28_4_ + 0x2c);
        lVar4 = (longdouble)CountdownTimer::Now();
        if ((float)lVar4 + fVar5 != *(float *)(this + 0x1700)) {
          (**(code **)(*(int *)(this + 0x16f8) + 4))(this + 0x16f8,this + 0x1700);
          *(float *)(this + 0x1700) = (float)lVar4 + fVar5;
        }
        if (fVar5 != *(float *)(this + 0x16fc)) {
          (**(code **)(*(int *)(this + 0x16f8) + 4))(this + 0x16f8,this + 0x16fc);
          *(float *)(this + 0x16fc) = fVar5;
        }
        fVar5 = *(float *)(car_alarm_duration._28_4_ + 0x2c) + *(float *)(gpGlobals + 0xc);
        pcVar10 = "ContextAlarm";
        pcVar7 = AlarmEndThink;
        uVar8 = 0;
        CBaseEntity::ThinkSet((_func_void *)local_54,(float)this,(char *)AlarmEndThink);
        if (param_1 != (CBaseEntity *)0x0) {
          AI_CriteriaSet::AI_CriteriaSet(local_3c);
                    /* try { // try from 007ff78e to 007ff81b has its CatchHandler @ 007ff904 */
          pcVar10 = (char *)SurvivorCharacterName
                                      (*(undefined4 *)(param_1 + 0x2ba0),this,pcVar7,uVar8,fVar5,
                                       pcVar10);
          AI_CriteriaSet::AppendCriteria(local_3c,"Subject",pcVar10,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);
        }
        piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                  (gameeventmanager,"triggered_car_alarm",0,0);
        if (piVar3 != (int *)0x0) {
          pcVar7 = *(code **)(*piVar3 + 0x30);
          uVar8 = 0;
          if (param_1 != (CBaseEntity *)0x0) {
            uVar8 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
          }
          (*pcVar7)(piVar3,"userid",uVar8);
          (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,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)