L L4D2node

CBasePropDoor::CalcDoorSounds

0x007e4620 · 2872 bytes · __thiscall

_ZN13CBasePropDoor14CalcDoorSoundsEv

Decompiled

undefined (1 param)

/* CBasePropDoor::CalcDoorSounds() */

void __thiscall CBasePropDoor::CalcDoorSounds(CBasePropDoor *this)

{
  code *pcVar1;
  int *piVar2;
  bool bVar3;
  char cVar4;
  int iVar5;
  KeyValues *pKVar6;
  undefined4 uVar7;
  char *pcVar8;
  char *pcVar9;
  KeyValues *pKVar10;
  int iVar11;
  int iVar12;
  int in_GS_OFFSET;
  double dVar13;
  double dVar14;
  double dVar15;
  uint in_stack_fffffee8;
  int local_f4;
  int local_f0;
  int local_ec;
  int local_e8;
  int local_e4;
  int local_d4;
  int local_d0 [4];
  char local_c0 [80];
  char local_70 [80];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar5 = CBaseEntity::GetModel((CBaseEntity *)this);
  if (iVar5 == 0) {
    if (((byte)this[0x14d] & 8) == 0) {
      dVar14 = (double)*(float *)(this + 0x2e8);
LAB_007e4d0c:
      dVar13 = (double)*(float *)(this + 0x2e4);
    }
    else {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      dVar14 = (double)*(float *)(this + 0x2e8);
      if (((byte)this[0x14d] & 8) == 0) goto LAB_007e4d0c;
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      dVar13 = (double)*(float *)(this + 0x2e4);
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
    }
    dVar15 = (double)*(float *)(this + 0x2e0);
    Error("prop_door with no model at %.2f %.2f %.2f\n",dVar15,dVar13,dVar14);
    in_stack_fffffee8 = SUB84(dVar15,0);
  }
  pKVar6 = KeyValues::operator_new((KeyValues *)0x2c,in_stack_fffffee8);
                    /* try { // try from 007e4677 to 007e467b has its CatchHandler @ 007e4df1 */
  KeyValues::KeyValues(pKVar6,"",(IKeyValuesSystem *)0x0,false);
  pcVar1 = *(code **)(*modelinfo + 0x54);
  uVar7 = CBaseEntity::GetModel((CBaseEntity *)this);
  pcVar8 = (char *)(*pcVar1)(modelinfo,uVar7);
  pcVar1 = *(code **)(*modelinfo + 0x10);
  uVar7 = CBaseEntity::GetModel((CBaseEntity *)this);
  pcVar9 = (char *)(*pcVar1)(modelinfo,uVar7);
  cVar4 = KeyValues::LoadFromBuffer(pKVar6,pcVar9,pcVar8,(IBaseFileSystem *)0x0,(char *)0x0);
  if ((cVar4 == '\0') ||
     (pKVar6 = (KeyValues *)KeyValues::FindKey(pKVar6,"door_options",false),
     pKVar6 == (KeyValues *)0x0)) {
    iVar12 = 0;
    KeyValues::deleteThis();
    iVar5 = 0;
    local_f0 = 0;
    local_f4 = 0;
    local_ec = 0;
    local_e8 = 0;
    local_e4 = 0;
    local_d4 = 0;
  }
  else {
    V_snprintf(local_c0,0x50,"skin%d",*(undefined4 *)(this + 0x458));
    pKVar10 = (KeyValues *)KeyValues::FindKey(pKVar6,local_c0,false);
    if (pKVar10 == (KeyValues *)0x0) {
      local_f0 = 0;
      local_e8 = 0;
      local_e4 = 0;
      local_d4 = 0;
      bVar3 = false;
    }
    else {
      KeyValues::GetString(pKVar10,"open","");
      AllocPooledString((char *)local_d0);
      local_d4 = local_d0[0];
      KeyValues::GetString(pKVar10,"close","");
      AllocPooledString((char *)local_d0);
      local_e4 = local_d0[0];
      KeyValues::GetString(pKVar10,"move","");
      AllocPooledString((char *)local_d0);
      local_e8 = local_d0[0];
      KeyValues::GetString(pKVar10,"pound","");
      AllocPooledString((char *)local_d0);
      local_f0 = local_d0[0];
      iVar5 = KeyValues::GetString(pKVar10,"surfaceprop","");
      if ((iVar5 == 0) || (piVar2 = *(int **)(this + 0x238), piVar2 == (int *)0x0)) {
        bVar3 = false;
      }
      else {
        pcVar1 = *(code **)(*piVar2 + 0xa0);
        uVar7 = (**(code **)(*physprops + 0x10))(physprops,iVar5);
        (*pcVar1)(piVar2,uVar7);
        bVar3 = true;
      }
    }
    V_snprintf(local_70,0x50,"hardware%d",*(undefined4 *)(this + 0x15f0));
    pKVar10 = (KeyValues *)KeyValues::FindKey(pKVar6,local_70,false);
    if (pKVar10 == (KeyValues *)0x0) {
      local_f4 = 0;
      iVar12 = 0;
      iVar5 = 0;
      local_ec = 0;
    }
    else {
      KeyValues::GetString(pKVar10,"locked","");
      AllocPooledString((char *)local_d0);
      iVar5 = local_d0[0];
      KeyValues::GetString(pKVar10,"unlocked","");
      AllocPooledString((char *)local_d0);
      local_ec = local_d0[0];
      KeyValues::GetString(pKVar10,"lock","");
      AllocPooledString((char *)local_d0);
      local_f4 = local_d0[0];
      KeyValues::GetString(pKVar10,"unlock","");
      AllocPooledString((char *)local_d0);
      iVar12 = local_d0[0];
    }
    if (local_d4 == 0) {
      pKVar6 = (KeyValues *)KeyValues::FindKey(pKVar6,"defaults",false);
      if (pKVar6 != (KeyValues *)0x0) {
        KeyValues::GetString(pKVar6,"open","");
        AllocPooledString((char *)local_d0);
        local_d4 = local_d0[0];
        goto LAB_007e4e3d;
      }
    }
    else if (((((local_e4 == 0) || (local_e8 == 0)) || (iVar5 == 0)) ||
             ((local_ec == 0 || (local_f0 == 0)))) &&
            (pKVar6 = (KeyValues *)KeyValues::FindKey(pKVar6,"defaults",false),
            pKVar6 != (KeyValues *)0x0)) {
LAB_007e4e3d:
      if (local_e4 == 0) {
        KeyValues::GetString(pKVar6,"close","");
        AllocPooledString((char *)local_d0);
        local_e4 = local_d0[0];
      }
      if (local_e8 == 0) {
        KeyValues::GetString(pKVar6,"move","");
        AllocPooledString((char *)local_d0);
        local_e8 = local_d0[0];
      }
      if (iVar5 == 0) {
        KeyValues::GetString(pKVar6,"locked","");
        AllocPooledString((char *)local_d0);
        iVar5 = local_d0[0];
      }
      if (local_ec == 0) {
        KeyValues::GetString(pKVar6,"unlocked","");
        AllocPooledString((char *)local_d0);
        local_ec = local_d0[0];
      }
      if (local_f4 == 0) {
        KeyValues::GetString(pKVar6,"lock","");
        AllocPooledString((char *)local_d0);
        local_f4 = local_d0[0];
      }
      if (iVar12 == 0) {
        KeyValues::GetString(pKVar6,"unlock","");
        AllocPooledString((char *)local_d0);
        iVar12 = local_d0[0];
      }
      if (local_f0 == 0) {
        KeyValues::GetString(pKVar6,"pound","");
        AllocPooledString((char *)local_d0);
        local_f0 = local_d0[0];
      }
      iVar11 = KeyValues::GetString(pKVar6,"surfaceprop","");
      if ((iVar11 != 0) && (piVar2 = *(int **)(this + 0x238), piVar2 != (int *)0x0)) {
        pcVar1 = *(code **)(*piVar2 + 0xa0);
        uVar7 = (**(code **)(*physprops + 0x10))(physprops,iVar11);
        (*pcVar1)(piVar2,uVar7);
      }
      KeyValues::deleteThis();
      goto LAB_007e47ca;
    }
    KeyValues::deleteThis();
    if (bVar3) goto LAB_007e47ca;
  }
  if (*(int *)(this + 0x238) != 0) {
    pcVar1 = *(code **)(*modelinfo + 0x10);
    uVar7 = CBaseEntity::GetModel((CBaseEntity *)this);
    (*pcVar1)(modelinfo,uVar7);
    uVar7 = CBaseEntity::GetDebugName((CBaseEntity *)this);
    Warning("%s has Door model (%s) with no door_options! Verify that SKIN is valid, and has a corresponding options block in the model QC file\n"
            ,uVar7);
    piVar2 = *(int **)(this + 0x238);
    pcVar1 = *(code **)(*piVar2 + 0xa0);
    uVar7 = (**(code **)(*physprops + 0x10))(physprops,&DAT_00cc0bea);
    (*pcVar1)(piVar2,uVar7);
  }
LAB_007e47ca:
  *(int *)(this + 0x15fc) = iVar5;
  *(int *)(this + 0x1658) = iVar12;
  *(int *)(this + 0x164c) = local_d4;
  *(int *)(this + 0x1650) = local_e4;
  *(int *)(this + 0x1648) = local_e8;
  *(int *)(this + 0x1604) = local_ec;
  *(int *)(this + 0x1654) = local_f4;
  *(int *)(this + 0x165c) = local_f0;
  UTIL_ValidateSoundName((string_t *)(this + 0x1648),"DoorSound.Null");
  UTIL_ValidateSoundName((string_t *)(this + 0x164c),"DoorSound.Null");
  UTIL_ValidateSoundName((string_t *)(this + 0x1650),"DoorSound.Null");
  UTIL_ValidateSoundName((string_t *)(this + 0x15fc),"DoorSound.Null");
  UTIL_ValidateSoundName((string_t *)(this + 0x1604),"DoorSound.Null");
  UTIL_ValidateSoundName((string_t *)(this + 0x1654),"WoodenDoor.Lock");
  UTIL_ValidateSoundName((string_t *)(this + 0x1658),"WoodenDoor.Lock");
  UTIL_ValidateSoundName((string_t *)(this + 0x165c),"WoodenDoor.Pound");
  pcVar8 = *(char **)(this + 0x1648);
  if (pcVar8 == (char *)0x0) {
    pcVar8 = "";
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  pcVar8 = *(char **)(this + 0x164c);
  if (pcVar8 == (char *)0x0) {
    pcVar8 = "";
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  pcVar8 = *(char **)(this + 0x1650);
  if (pcVar8 == (char *)0x0) {
    pcVar8 = "";
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  pcVar8 = *(char **)(this + 0x15fc);
  if (pcVar8 == (char *)0x0) {
    pcVar8 = "";
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  pcVar8 = *(char **)(this + 0x1604);
  if (pcVar8 == (char *)0x0) {
    pcVar8 = "";
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  pcVar8 = *(char **)(this + 0x1654);
  if (pcVar8 == (char *)0x0) {
    pcVar8 = "";
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  pcVar8 = *(char **)(this + 0x1658);
  if (pcVar8 == (char *)0x0) {
    pcVar8 = "";
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  pcVar8 = "";
  if (*(char **)(this + 0x165c) != (char *)0x0) {
    pcVar8 = *(char **)(this + 0x165c);
  }
  CBaseEntity::PrecacheScriptSound(pcVar8);
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)