L L4D2node

CBaseServerVehicle::ParseNPCRoles

0x00b3c1a0 · 970 bytes · __thiscall

_ZN18CBaseServerVehicle13ParseNPCRolesEP9KeyValues

Decompiled

undefined (2 params)

/* CBaseServerVehicle::ParseNPCRoles(KeyValues*) */

void __thiscall CBaseServerVehicle::ParseNPCRoles(CBaseServerVehicle *this,KeyValues *param_1)

{
  CBaseEntity *this_00;
  int iVar1;
  int iVar2;
  int iVar3;
  undefined1 *puVar4;
  int *piVar5;
  int iVar6;
  undefined4 *puVar7;
  int iVar8;
  undefined4 uVar9;
  int local_3c;
  int local_38;
  KeyValues *local_34;
  undefined4 local_30 [4];
  undefined4 local_20 [4];
  
  if (((param_1 != (KeyValues *)0x0) && (*(int *)(this + 0x2c) != 0)) &&
     (this_00 = (CBaseEntity *)
                __dynamic_cast(*(int *)(this + 0x2c),&CBaseEntity::typeinfo,
                               &CBaseAnimating::typeinfo,0), this_00 != (CBaseEntity *)0x0)) {
    piVar5 = *(int **)(this_00 + 0x13e0);
    if (piVar5 == (int *)0x0) {
      iVar1 = CBaseEntity::GetModel(this_00);
      if (iVar1 == 0) {
        piVar5 = *(int **)(this_00 + 0x13e0);
      }
      else {
        CBaseAnimating::LockStudioHdr((CBaseAnimating *)this_00);
        piVar5 = *(int **)(this_00 + 0x13e0);
      }
      if (piVar5 == (int *)0x0) {
        return;
      }
    }
    if (*piVar5 != 0) {
      local_34 = (KeyValues *)KeyValues::GetFirstSubKey(param_1);
      if (local_34 != (KeyValues *)0x0) {
        do {
          KeyValues::GetName(local_34);
          AllocPooledString((char *)local_30);
          uVar9 = local_30[0];
          iVar1 = FindOrCreatePassengerRole(this,local_30[0],local_20);
          if (iVar1 != 0) {
            iVar2 = CUtlVector<CPassengerSeat,CUtlMemory<CPassengerSeat,int>>::InsertBefore
                              ((CUtlVector<CPassengerSeat,CUtlMemory<CPassengerSeat,int>> *)
                               (iVar1 + 4),*(int *)(iVar1 + 0x10));
            ParseNPCPassengerSeat
                      (this,local_34,(CPassengerSeat *)(iVar2 * 0x30 + *(int *)(iVar1 + 4)));
            iVar6 = *(int *)(this + 0x10);
            CUtlVector<CPassengerInfo,CUtlMemory<CPassengerInfo,int>>::GrowVector
                      ((CUtlVector<CPassengerInfo,CUtlMemory<CPassengerInfo,int>> *)(this + 4),1);
            CUtlVector<CPassengerInfo,CUtlMemory<CPassengerInfo,int>>::ShiftElementsRight
                      ((CUtlVector<CPassengerInfo,CUtlMemory<CPassengerInfo,int>> *)(this + 4),iVar6
                       ,1);
            iVar3 = iVar6 * 0x14;
            puVar7 = (undefined4 *)(iVar3 + *(int *)(this + 4));
            if (puVar7 == (undefined4 *)0x0) {
              iVar8 = 0;
            }
            else {
              *puVar7 = 0xffffffff;
              puVar7[1] = 0xffffffff;
              puVar7[2] = 0;
              puVar7[3] = 0;
              puVar7[4] = 0xffffffff;
              iVar8 = *(int *)(this + 4) + iVar3;
            }
            *(undefined4 *)(iVar8 + 0x10) = 0xffffffff;
            *(int *)(*(int *)(this + 4) + 4 + iVar3) = iVar2;
            *(undefined4 *)(*(int *)(this + 4) + iVar6 * 0x14) = local_20[0];
            *(undefined4 *)(*(int *)(this + 4) + 8 + iVar3) = uVar9;
            *(undefined4 *)(*(int *)(this + 4) + 0xc + iVar3) =
                 *(undefined4 *)(*(int *)(iVar1 + 4) + iVar2 * 0x30);
            local_34 = (KeyValues *)KeyValues::GetNextKey(local_34);
          }
        } while (local_34 != (KeyValues *)0x0);
      }
      if ((*(int *)(g_debug_npc_vehicle_roles._28_4_ + 0x30) != 0) &&
         (Msg("Passenger Roles Parsed:\t%d\n\n",*(undefined4 *)(this + 0x24)),
         0 < *(int *)(this + 0x24))) {
        iVar1 = 0;
        local_3c = 0;
        do {
          uVar9 = ((undefined4 *)(*(int *)(this + 0x18) + iVar1))[4];
          puVar4 = *(undefined1 **)(*(int *)(this + 0x18) + iVar1);
          if (puVar4 == (undefined1 *)0x0) {
            puVar4 = &DAT_00d539c2;
          }
          Msg("\tPassenger Role:\t%s (%d seats)\n",puVar4,uVar9);
          local_38 = 0;
          iVar6 = *(int *)(this + 0x18) + iVar1;
          if (0 < *(int *)(iVar6 + 0x10)) {
            do {
              iVar2 = local_38 * 0x30;
              Msg("\t\tAttachment: %d\n",*(undefined4 *)(*(int *)(iVar6 + 4) + 4 + iVar2),uVar9);
              puVar4 = *(undefined1 **)(*(int *)(*(int *)(this + 0x18) + 4 + iVar1) + 0x14 + iVar2);
              Msg("\t\tEntries:\t%d\n",puVar4);
              Msg("\t\t=====================\n");
              iVar6 = *(int *)(*(int *)(this + 0x18) + 4 + iVar1) + iVar2;
              if (0 < *(int *)(iVar6 + 0x14)) {
                iVar3 = 0;
                do {
                  puVar7 = (undefined4 *)(*(int *)(iVar6 + 8) + iVar3 * 8);
                  uVar9 = puVar7[1];
                  puVar4 = (undefined1 *)*puVar7;
                  if (puVar4 == (undefined1 *)0x0) {
                    puVar4 = &DAT_00d539c2;
                  }
                  iVar3 = iVar3 + 1;
                  Msg("\t\t\tAnimation:\t%s\t(Priority %d)\n",puVar4,uVar9);
                  iVar6 = *(int *)(*(int *)(this + 0x18) + 4 + iVar1) + iVar2;
                } while (iVar3 < *(int *)(iVar6 + 0x14));
              }
              Msg(&DAT_00cff71e,puVar4,uVar9);
              puVar4 = *(undefined1 **)(*(int *)(*(int *)(this + 0x18) + 4 + iVar1) + 0x28 + iVar2);
              Msg("\t\tExits:\t%d\n",puVar4);
              Msg("\t\t=====================\n");
              iVar6 = *(int *)(this + 0x18) + iVar1;
              iVar3 = *(int *)(iVar6 + 4) + iVar2;
              if (0 < *(int *)(iVar3 + 0x28)) {
                iVar8 = 0;
                do {
                  puVar7 = (undefined4 *)(*(int *)(iVar3 + 0x1c) + iVar8 * 8);
                  uVar9 = puVar7[1];
                  puVar4 = (undefined1 *)*puVar7;
                  if (puVar4 == (undefined1 *)0x0) {
                    puVar4 = &DAT_00d539c2;
                  }
                  iVar8 = iVar8 + 1;
                  Msg("\t\t\tAnimation:\t%s\t(Priority %d)\n",puVar4,uVar9);
                  iVar6 = *(int *)(this + 0x18) + iVar1;
                  iVar3 = iVar2 + *(int *)(iVar6 + 4);
                } while (iVar8 < *(int *)(iVar3 + 0x28));
              }
              local_38 = local_38 + 1;
            } while (local_38 < *(int *)(iVar6 + 0x10));
          }
          iVar1 = iVar1 + 0x18;
          Msg(&DAT_00cff71e,puVar4,uVar9);
          local_3c = local_3c + 1;
        } while (local_3c < *(int *)(this + 0x24));
        return;
      }
    }
  }
  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)