L L4D2node

CBaseViewModel::SpawnControlPanels

0x0041cb40 · 919 bytes · __thiscall

_ZN14CBaseViewModel18SpawnControlPanelsEv

Decompiled

undefined (1 param)

/* CBaseViewModel::SpawnControlPanels() */

void __thiscall CBaseViewModel::SpawnControlPanels(CBaseViewModel *this)

{
  uint uVar1;
  int *piVar2;
  code *pcVar3;
  int *piVar4;
  float fVar5;
  float fVar6;
  int iVar7;
  CVGuiScreen *this_00;
  undefined4 uVar8;
  int iVar9;
  undefined4 *puVar10;
  undefined *puVar11;
  int iVar12;
  int in_GS_OFFSET;
  int local_f4;
  char *local_e0;
  char *local_dc;
  Vector local_d8 [12];
  float local_cc;
  float local_c8;
  matrix3x4_t local_c0 [48];
  matrix3x4_t local_90 [48];
  char local_60 [64];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  DestroyControlPanels(this);
  piVar4 = mdlcache;
  uVar1 = *(uint *)(this + 0x1618);
  if ((((uVar1 != 0xffffffff) &&
       (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) &&
     (piVar2 = *(int **)(puVar11 + 4), piVar2 != (int *)0x0)) {
    iVar12 = 0;
    (**(code **)(*mdlcache + 0x68))(mdlcache);
    do {
      V_snprintf(local_60,0x40,"controlpanel%d_ll",iVar12);
      local_f4 = CBaseAnimating::LookupAttachment((CBaseAnimating *)this,local_60);
      if (local_f4 < 1) {
        V_snprintf(local_60,0x40,"controlpanel%d_ll",iVar12);
        local_f4 = CBaseAnimating::LookupAttachment((CBaseAnimating *)this,local_60);
        if (local_f4 < 1) {
          (**(code **)(*piVar4 + 0x6c))(piVar4);
          break;
        }
      }
                    /* try { // try from 0041cbf2 to 0041ce6a has its CatchHandler @ 0041cedb */
      V_snprintf(local_60,0x40,"controlpanel%d_ur",iVar12);
      iVar7 = CBaseAnimating::LookupAttachment((CBaseAnimating *)this,local_60);
      if (iVar7 < 1) {
                    /* try { // try from 0041ceaa to 0041cebd has its CatchHandler @ 0041cedb */
        V_snprintf(local_60,0x40,"controlpanel%d_ur",iVar12);
        iVar7 = CBaseAnimating::LookupAttachment((CBaseAnimating *)this,local_60);
        if (iVar7 < 1) goto code_r0x0041cec8;
      }
      (**(code **)(*piVar2 + 0x4f0))(piVar2,iVar12,&local_e0);
      if (local_e0 != (char *)0x0) {
        (**(code **)(*piVar2 + 0x4f4))(piVar2,iVar12,&local_dc);
        if (local_dc != (char *)0x0) {
          (**(code **)(*(int *)this + 0x370))(this,local_f4,local_c0);
          MatrixInvert(local_c0,local_90);
          (**(code **)(*(int *)this + 0x370))(this,iVar7,local_c0);
          MatrixGetColumn(local_c0,3,local_d8);
          VectorTransform((float *)local_d8,local_90,&local_cc);
          fVar6 = local_c8;
          fVar5 = local_cc;
          this_00 = (CVGuiScreen *)
                    CreateVGuiScreen(local_dc,local_e0,(CBaseEntity *)this,(CBaseEntity *)this,
                                     local_f4);
          pcVar3 = *(code **)(*(int *)this_00 + 0x194);
          uVar8 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
          (*pcVar3)(this_00,uVar8);
          CVGuiScreen::SetActualSize(this_00,fVar5,fVar6);
          CVGuiScreen::SetActive(this_00,false);
          CVGuiScreen::MakeVisibleOnlyToTeammates(this_00,false);
          CVGuiScreen::SetAttachedToViewModel(this_00,true);
          iVar9 = CUtlVector<CHandle<CVGuiScreen>,CUtlMemory<CHandle<CVGuiScreen>,int>>::
                  InsertBefore((CUtlVector<CHandle<CVGuiScreen>,CUtlMemory<CHandle<CVGuiScreen>,int>>
                                *)(this + 0x1630),*(int *)(this + 0x163c));
          iVar7 = *(int *)(this + 0x1630);
          puVar10 = (undefined4 *)(**(code **)(*(int *)this_00 + 0xc))(this_00);
          *(undefined4 *)(iVar7 + iVar9 * 4) = *puVar10;
        }
      }
      iVar12 = iVar12 + 1;
    } while( true );
  }
LAB_0041cb8f:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
code_r0x0041cec8:
  (**(code **)(*piVar4 + 0x6c))(piVar4);
  goto LAB_0041cb8f;
}

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)