L L4D2node

Script_GetInvTable

0x00b47720 · 599 bytes · __cdecl

_ZL18Script_GetInvTableP9HSCRIPT__S0_

Decompiled

undefined (2 params)

/* Script_GetInvTable(HSCRIPT__*, HSCRIPT__*) */

void Script_GetInvTable(HSCRIPT__ *param_1,HSCRIPT__ *param_2)

{
  code *pcVar1;
  ScriptClassDesc_t *pSVar2;
  int iVar3;
  CBaseEntity *pCVar4;
  undefined4 uVar5;
  void *pvVar6;
  int iVar7;
  int in_GS_OFFSET;
  CTerrorPlayer *local_70;
  void *local_6c;
  undefined4 local_68;
  undefined2 local_64;
  ushort local_62;
  char local_60 [64];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (param_1 != (HSCRIPT__ *)0x0) {
    pcVar1 = *(code **)(*g_pScriptVM + 0x68);
    pSVar2 = GetScriptDesc<CBaseEntity>((CBaseEntity *)0x0);
    iVar3 = (*pcVar1)(g_pScriptVM,param_1,pSVar2);
    if (iVar3 != 0) {
      local_70 = (CTerrorPlayer *)
                 __dynamic_cast(iVar3,&CBaseEntity::typeinfo,&CTerrorPlayer::typeinfo,0);
      goto LAB_00b47798;
    }
  }
  local_70 = (CTerrorPlayer *)0x0;
LAB_00b47798:
  local_6c = (void *)0x0;
  local_64 = 0;
  iVar3 = 1;
  local_62 = 0;
  do {
                    /* try { // try from 00b477d1 to 00b47934 has its CatchHandler @ 00b47978 */
    pCVar4 = (CBaseEntity *)CTerrorPlayer::GetTerrorWeapon(local_70,iVar3);
    if (pCVar4 != (CBaseEntity *)0x0) {
      uVar5 = (**(code **)(*(int *)pCVar4 + 0x530))(pCVar4);
      V_snprintf(local_60,0x40,"slot%d",uVar5);
      pvVar6 = (void *)CBaseEntity::GetScriptInstance(pCVar4);
      if ((local_62 & 1) != 0) {
        free(local_6c);
        local_62 = local_62 & 0xfffe;
      }
      local_68 = 0;
      local_64 = 0x20;
      local_6c = pvVar6;
      (**(code **)(*g_pScriptVM + 0x78))(g_pScriptVM,param_2,local_60,&local_6c);
      iVar7 = (**(code **)(*(int *)pCVar4 + 0x530))(pCVar4);
      if (((iVar7 == 3) &&
          (iVar7 = __dynamic_cast(pCVar4,&CTerrorWeapon::typeinfo,&CBaseBackpackItem::typeinfo,0),
          iVar7 != 0)) && (*(char *)(iVar7 + 0x17dc) != '\0')) {
        DevMsg("   is performing action!\n");
      }
    }
    iVar3 = iVar3 + 1;
  } while (iVar3 != 0x38);
  pCVar4 = (CBaseEntity *)CTerrorPlayer::GetHeldEntity(local_70);
  if (pCVar4 != (CBaseEntity *)0x0) {
    uVar5 = CBaseEntity::GetDebugName(pCVar4);
    DevMsg("Holding %s\n",uVar5);
    pvVar6 = (void *)CBaseEntity::GetScriptInstance(pCVar4);
    if ((local_62 & 1) != 0) {
      free(local_6c);
      local_62 = local_62 & 0xfffe;
    }
    local_68 = 0;
    local_64 = 0x20;
    local_6c = pvVar6;
    (**(code **)(*g_pScriptVM + 0x78))(g_pScriptVM,param_2,&DAT_00d4bc59,&local_6c);
  }
  if ((local_62 & 1) != 0) {
    free(local_6c);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)