L L4D2node

CBaseEntity::PrefetchScriptSound

0x004b2b50 · 274 bytes · __cdecl

_ZN11CBaseEntity19PrefetchScriptSoundEPKc

Decompiled

undefined (1 param)

/* CBaseEntity::PrefetchScriptSound(char const*) */

void CBaseEntity::PrefetchScriptSound(char *param_1)

{
  char cVar1;
  ushort uVar2;
  undefined4 uVar3;
  int iVar4;
  undefined4 *puVar5;
  undefined4 *puVar6;
  uint uVar7;
  
  uVar3 = (**(code **)(*soundemitterbase + 0x1c))(soundemitterbase,param_1);
  cVar1 = (**(code **)(*soundemitterbase + 0x20))(soundemitterbase,uVar3);
  if (cVar1 == '\0') {
    iVar4 = V_stristr(param_1,".wav");
    if ((iVar4 != 0) || (iVar4 = _V_strstr(param_1,".mp3"), iVar4 != 0)) {
      (**(code **)(*enginesound + 8))(enginesound,param_1);
    }
  }
  else {
    puVar5 = (undefined4 *)(**(code **)(*soundemitterbase + 0x58))(soundemitterbase,uVar3);
    if (puVar5 != (undefined4 *)0x0) {
      uVar2 = *(ushort *)(puVar5 + 2);
      if (uVar2 == 0) {
        uVar3 = (**(code **)(*soundemitterbase + 0x28))(soundemitterbase,uVar3);
        DevMsg("CSoundEmitterSystem:  sounds.txt entry \'%s\' has no waves listed under \'wave\' or \'rndwave\' key!!!\n"
               ,uVar3);
      }
      else {
        uVar7 = (uint)uVar2;
        iVar4 = 0;
        while( true ) {
          puVar6 = puVar5;
          if (uVar2 != 1) {
            puVar6 = (undefined4 *)*puVar5;
          }
          uVar3 = (**(code **)(*soundemitterbase + 0x30))(soundemitterbase,puVar6 + iVar4);
          (**(code **)(*enginesound + 8))(enginesound,uVar3);
          if (iVar4 == uVar7 - 1) break;
          uVar2 = *(ushort *)(puVar5 + 2);
          iVar4 = iVar4 + 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)