L L4D2node

CVehicleSoundsParser::ParseKeyValue

0x00b3c8c0 · 1212 bytes · __thiscall

_ZN20CVehicleSoundsParser13ParseKeyValueEPvPKcS2_

Decompiled

undefined (4 params)

/* CVehicleSoundsParser::ParseKeyValue(void*, char const*, char const*) */

void __thiscall
CVehicleSoundsParser::ParseKeyValue
          (CVehicleSoundsParser *this,void *param_1,char *param_2,char *param_3)

{
  int iVar1;
  int iVar2;
  long lVar3;
  undefined4 *puVar4;
  int iVar5;
  double dVar6;
  undefined4 local_20 [4];
  
  iVar1 = _V_stricmp(param_2,"gear");
  if (iVar1 == 0) {
    iVar1 = *(int *)((int)param_1 + 0x10);
    CUtlVector<vehicle_gear_t,CUtlMemory<vehicle_gear_t,int>>::GrowVector
              ((CUtlVector<vehicle_gear_t,CUtlMemory<vehicle_gear_t,int>> *)((int)param_1 + 4),1);
    CUtlVector<vehicle_gear_t,CUtlMemory<vehicle_gear_t,int>>::ShiftElementsRight
              ((CUtlVector<vehicle_gear_t,CUtlMemory<vehicle_gear_t,int>> *)((int)param_1 + 4),iVar1
               ,1);
    iVar2 = iVar1 * 0x10;
    puVar4 = (undefined4 *)(iVar2 + *(int *)((int)param_1 + 4));
    if (puVar4 == (undefined4 *)0x0) {
      iVar5 = 0;
    }
    else {
      *puVar4 = &PTR_GetDataDescMap_00d4a858;
      iVar5 = *(int *)((int)param_1 + 4) + iVar2;
    }
    *(undefined4 *)(iVar5 + 8) = 0;
    *(undefined4 *)(*(int *)((int)param_1 + 4) + 0xc + iVar2) = 0x3f800000;
    iVar5 = *(int *)((int)param_1 + 4);
    if (iVar1 == 0) {
      *(undefined4 *)(iVar5 + 4) = 0;
    }
    else {
      *(undefined4 *)(iVar5 + 4 + iVar2) = *(undefined4 *)(iVar5 + -8 + iVar2);
    }
    *(int *)(this + 4) = iVar1;
  }
  else {
    iVar1 = _V_stricmp(param_2,"state");
    if (iVar1 == 0) {
      *(undefined4 *)(this + 8) = 0;
      return;
    }
    iVar1 = _V_stricmp(param_2,"crashsound");
    if (iVar1 == 0) {
      iVar1 = *(int *)((int)param_1 + 0x24);
      CUtlVector<vehicle_crashsound_t,CUtlMemory<vehicle_crashsound_t,int>>::GrowVector
                ((CUtlVector<vehicle_crashsound_t,CUtlMemory<vehicle_crashsound_t,int>> *)
                 ((int)param_1 + 0x18),1);
      CUtlVector<vehicle_crashsound_t,CUtlMemory<vehicle_crashsound_t,int>>::ShiftElementsRight
                ((CUtlVector<vehicle_crashsound_t,CUtlMemory<vehicle_crashsound_t,int>> *)
                 ((int)param_1 + 0x18),iVar1,1);
      puVar4 = (undefined4 *)(iVar1 * 0x14 + *(int *)((int)param_1 + 0x18));
      if (puVar4 != (undefined4 *)0x0) {
        *puVar4 = &PTR_GetDataDescMap_00d4a868;
      }
      *(int *)(this + 0xc) = iVar1;
      *(undefined4 *)(*(int *)((int)param_1 + 0x18) + 4 + iVar1 * 0x14) = 0;
      *(undefined4 *)(*(int *)((int)param_1 + 0x18) + *(int *)(this + 0xc) * 0x14 + 8) = 0;
      *(undefined4 *)(*(int *)((int)param_1 + 0x18) + *(int *)(this + 0xc) * 0x14 + 0x10) = 0;
    }
    else {
      if (-1 < *(int *)(this + 4)) {
        iVar1 = _V_stricmp(param_2,"max_speed");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 4);
          iVar2 = *(int *)((int)param_1 + 4);
          dVar6 = strtod(param_3,(char **)0x0);
          *(float *)(iVar1 * 0x10 + iVar2 + 8) = (float)dVar6;
          return;
        }
        iVar1 = _V_stricmp(param_2,"speed_approach_factor");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 4);
          iVar2 = *(int *)((int)param_1 + 4);
          dVar6 = strtod(param_3,(char **)0x0);
          *(float *)(iVar1 * 0x10 + iVar2 + 0xc) = (float)dVar6;
          return;
        }
      }
      *(undefined4 *)(this + 4) = 0xffffffff;
      if (-1 < *(int *)(this + 8)) {
        iVar1 = _V_stricmp(param_2,"name");
        if (iVar1 == 0) {
          iVar1 = 0;
          do {
            iVar2 = _V_stricmp((&pSoundStateNames)[iVar1],param_3);
            if (iVar2 == 0) goto LAB_00b3cc1f;
            iVar1 = iVar1 + 1;
          } while (iVar1 != 0x14);
          iVar1 = -1;
LAB_00b3cc1f:
          *(int *)(this + 8) = iVar1;
          *(undefined4 *)((int)param_1 + iVar1 * 4 + 0x50) = 0;
          *(undefined4 *)((int)param_1 + *(int *)(this + 8) * 4 + 0xa0) = 0;
          return;
        }
        iVar1 = _V_stricmp(param_2,"sound");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 8);
          AllocPooledString((char *)local_20);
          *(undefined4 *)((int)param_1 + (iVar1 + 0x14) * 4) = local_20[0];
          return;
        }
        iVar1 = _V_stricmp(param_2,"min_time");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 8);
          dVar6 = strtod(param_3,(char **)0x0);
          *(float *)((int)param_1 + iVar1 * 4 + 0xa0) = (float)dVar6;
          return;
        }
      }
      *(undefined4 *)(this + 8) = 0xffffffff;
      if (-1 < *(int *)(this + 0xc)) {
        iVar1 = _V_stricmp(param_2,"min_speed");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 0xc);
          iVar2 = *(int *)((int)param_1 + 0x18);
          dVar6 = strtod(param_3,(char **)0x0);
          *(float *)(iVar2 + iVar1 * 0x14 + 4) = (float)dVar6;
          return;
        }
        iVar1 = _V_stricmp(param_2,"sound");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 0xc);
          iVar2 = *(int *)((int)param_1 + 0x18);
          AllocPooledString((char *)local_20);
          *(undefined4 *)(iVar2 + iVar1 * 0x14 + 0x10) = local_20[0];
          return;
        }
        iVar1 = _V_stricmp(param_2,"min_speed_change");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 0xc);
          iVar2 = *(int *)((int)param_1 + 0x18);
          dVar6 = strtod(param_3,(char **)0x0);
          *(float *)(iVar2 + iVar1 * 0x14 + 8) = (float)dVar6;
          return;
        }
        iVar1 = _V_stricmp(param_2,"gear_limit");
        if (iVar1 == 0) {
          iVar1 = *(int *)(this + 0xc);
          iVar2 = *(int *)((int)param_1 + 0x18);
          lVar3 = strtol(param_3,(char **)0x0,10);
          *(long *)(iVar2 + iVar1 * 0x14 + 0xc) = lVar3;
          return;
        }
      }
      iVar1 = 0;
      *(undefined4 *)(this + 0xc) = 0xffffffff;
      do {
        iVar2 = _V_stricmp(param_2,(&vehiclesound_parsenames)[iVar1]);
        if (iVar2 == 0) {
          AllocPooledString((char *)local_20);
          *(undefined4 *)((int)param_1 + (iVar1 + 8) * 4 + 0xc) = local_20[0];
          return;
        }
        iVar1 = iVar1 + 1;
      } while (iVar1 != 9);
    }
  }
  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)