L L4D2node

CBaseEntity::DrawDebugTextOverlays

0x0060f820 · 2366 bytes · __thiscall

_ZN11CBaseEntity21DrawDebugTextOverlaysEv

Decompiled

undefined (1 param)

/* CBaseEntity::DrawDebugTextOverlays() */

int __thiscall CBaseEntity::DrawDebugTextOverlays(CBaseEntity *this)

{
  code *pcVar1;
  char cVar2;
  uint uVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  int iVar6;
  float *pfVar7;
  float *pfVar8;
  int iVar9;
  int iVar10;
  int in_GS_OFFSET;
  float afStack_27c [2];
  int local_234;
  int local_230;
  undefined4 local_22c [2];
  undefined2 local_224;
  ushort local_222;
  char local_220 [512];
  int local_20;
  
  pfVar7 = (float *)&stack0xfffffd94;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  uVar3 = *(uint *)(this + 0x110);
  if ((uVar3 & 1) == 0) {
    iVar9 = 1;
  }
  else {
    GetDebugName(this);
    V_snprintf(local_220,0x200,"(%d) Name: %s (%s)");
    EntityText(this,1,local_220,0.0,0,0xff,0,0xff);
    if (*(int *)(this + 0x80) == 0) {
      local_234 = 3;
      iVar9 = 2;
    }
    else {
      iVar9 = 3;
      V_snprintf(local_220,0x200,"GLOBALNAME: %s");
      EntityText(this,2,local_220,0.0,0xff,0xff,0xff,0xff);
      local_234 = 4;
    }
    if (*(int *)(debug_overlay_fullposition._28_4_ + 0x30) == 0) {
      if (((byte)this[0x14d] & 8) != 0) {
        CalcAbsolutePosition(this);
      }
      V_snprintf(local_220,0x200,"Position: %0.3f, %0.3f, %0.3f\n");
      EntityText(this,iVar9,local_220,0.0,0xff,0xff,0xff,0xff);
      cVar2 = BlocksLOS(this);
    }
    else {
      if (((byte)this[0x14d] & 8) != 0) {
        CalcAbsolutePosition(this);
      }
      V_snprintf(local_220,0x200,"pos: (%f, %f, %f)\n");
      EntityText(this,iVar9,local_220,0.0,0xff,0xff,0xff,0xff);
      if (((byte)this[0x14d] & 8) != 0) {
        CalcAbsolutePosition(this);
      }
      V_snprintf(local_220,0x200,"ang: (%f, %f, %f)\n");
      EntityText(this,local_234,local_220,0.0,0xff,0xff,0xff,0xff);
      V_snprintf(local_220,0x200,"cell: (%d, %d, %d)\n");
      EntityText(this,iVar9 + 2,local_220,0.0,0xff,0xff,0xff,0xff);
      V_snprintf(local_220,0x200,"celloffset: (%f, %f, %f)\n");
      EntityText(this,iVar9 + 3,local_220,0.0,0xff,0xff,0xff,0xff);
      local_234 = iVar9 + 4;
      cVar2 = BlocksLOS(this);
    }
    if (cVar2 == '\0') {
      EntityText(this,local_234,"Doesn\'t block LOS",0.0,0xff,0xff,0xff,0xff);
      local_234 = local_234 + 1;
    }
    (**(code **)(*(int *)this + 0x20))();
    pfVar7 = (float *)&stack0xfffffd90;
                    /* try { // try from 00610175 to 0061017a has its CatchHandler @ 006101ad */
    if ((local_230 != 0) || (iVar9 = (**(code **)(*(int *)this + 0xf0))(), iVar9 != 0)) {
      (**(code **)(*(int *)this + 0x20))();
      pfVar7 = (float *)&stack0xfffffd8c;
      V_snprintf(local_220,0x200,"Model:%s");
      EntityText(this,local_234,local_220,0.0,0xff,0xff,0xff,0xff);
      local_234 = local_234 + 1;
    }
    if ((*(int *)(ent_show_contexts._28_4_ + 0x30) != 0) &&
       (iVar9 = *(int *)(this + 0xc4), 0 < iVar9)) {
      iVar10 = 0;
      do {
        pfVar7[1] = (float)iVar10;
        *pfVar7 = (float)this;
        pfVar7[-1] = 8.907567e-39;
        uVar4 = GetContextValue((CBaseEntity *)*pfVar7,(int)pfVar7[1]);
        pfVar7[1] = (float)iVar10;
        *pfVar7 = (float)this;
        pfVar7[-1] = 8.907592e-39;
        uVar5 = GetContextName((CBaseEntity *)*pfVar7,(int)pfVar7[1]);
        *pfVar7 = (float)local_220;
        pfVar7[3] = (float)uVar5;
        pfVar7[2] = (float)"Context: %s:%s";
        pfVar7[1] = 7.17465e-43;
        pfVar7[4] = (float)uVar4;
        pfVar7[-1] = 8.907645e-39;
        V_snprintf((char *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2]);
        pfVar7[2] = (float)local_220;
        pfVar7[7] = 3.57331e-43;
        pfVar7[6] = 0.0;
        pfVar7[5] = 3.57331e-43;
        iVar6 = local_234 + iVar10;
        *pfVar7 = (float)this;
        iVar10 = iVar10 + 1;
        pfVar7[4] = 0.0;
        pfVar7[3] = 0.0;
        pfVar7[1] = (float)iVar6;
        pfVar7[-1] = 8.907739e-39;
        EntityText((CBaseEntity *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2],pfVar7[3],(int)pfVar7[4],
                   (int)pfVar7[5],(int)pfVar7[6],(int)pfVar7[7]);
      } while (iVar10 != iVar9);
      local_234 = local_234 + iVar10;
    }
    uVar4 = *(undefined4 *)(this + 0x150);
    pfVar7[2] = (float)"Flags :%d";
    pfVar7[1] = 7.17465e-43;
    *pfVar7 = (float)local_220;
    pfVar7[3] = (float)uVar4;
    pfVar7[-1] = 8.907812e-39;
    V_snprintf((char *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2]);
    pfVar7[2] = (float)local_220;
    pfVar7[7] = 3.57331e-43;
    pfVar7[6] = 3.57331e-43;
    pfVar7[5] = 3.57331e-43;
    pfVar7[1] = (float)local_234;
    pfVar7[4] = 3.57331e-43;
    pfVar7[3] = 0.0;
    *pfVar7 = (float)this;
    pfVar7[-1] = 8.907899e-39;
    EntityText((CBaseEntity *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2],pfVar7[3],(int)pfVar7[4],
               (int)pfVar7[5],(int)pfVar7[6],(int)pfVar7[7]);
    uVar3 = *(uint *)(this + 0xd4);
    *pfVar7 = (float)local_220;
    pfVar7[2] = (float)"Effects :%d (EF_NODRAW=%d)";
    pfVar7[1] = 7.17465e-43;
    pfVar7[3] = (float)uVar3;
    pfVar7[4] = (float)(uVar3 & 0x20);
    pfVar7[-1] = 8.907959e-39;
    V_snprintf((char *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2]);
    pfVar7[7] = 3.57331e-43;
    pfVar7[6] = 3.57331e-43;
    iVar9 = local_234 + 2;
    pfVar7[1] = (float)(local_234 + 1);
    pfVar7[5] = 3.57331e-43;
    pfVar7[4] = 3.57331e-43;
    pfVar7[3] = 0.0;
    pfVar7[2] = (float)local_220;
    *pfVar7 = (float)this;
    pfVar7[-1] = 8.908049e-39;
    EntityText((CBaseEntity *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2],pfVar7[3],(int)pfVar7[4],
               (int)pfVar7[5],(int)pfVar7[6],(int)pfVar7[7]);
    if (*(int *)(ent_text_allow_script._28_4_ + 0x30) != 0) {
      pfVar7[3] = 0.0;
      local_224 = 0;
      pfVar7[2] = (float)local_22c;
      pfVar7[1] = (float)"OnEntText";
      *pfVar7 = (float)this;
      local_222 = 0;
      local_22c[0] = 0;
                    /* try { // try from 006100a9 to 0061010b has its CatchHandler @ 00610195 */
      pfVar7[-1] = 8.908287e-39;
      cVar2 = CallScriptFunction((CBaseEntity *)*pfVar7,(char *)pfVar7[1],(CVariantBase *)pfVar7[2],
                                 *(bool *)(pfVar7 + 3));
      if (cVar2 != '\0') {
        pfVar7[2] = (float)"Script: %s";
        pfVar7[1] = 7.17465e-43;
        *pfVar7 = (float)local_220;
        pfVar7[3] = (float)local_22c[0];
        pfVar7[-1] = 8.90834e-39;
        V_snprintf((char *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2]);
        pfVar7[7] = 3.57331e-43;
        pfVar7[6] = 3.57331e-43;
        pfVar7[5] = 3.57331e-43;
        pfVar7[4] = 3.57331e-43;
        pfVar7[3] = 0.0;
        pfVar7[2] = (float)local_220;
        pfVar7[1] = (float)iVar9;
        *pfVar7 = (float)this;
        pfVar7[-1] = 8.908419e-39;
        EntityText((CBaseEntity *)*pfVar7,(int)pfVar7[1],(char *)pfVar7[2],pfVar7[3],(int)pfVar7[4],
                   (int)pfVar7[5],(int)pfVar7[6],(int)pfVar7[7]);
        iVar9 = local_234 + 3;
      }
      if ((local_222 & 1) != 0) {
        *pfVar7 = (float)local_22c[0];
        pfVar7[-1] = 8.908469e-39;
        free((void *)*pfVar7);
      }
    }
    uVar3 = *(uint *)(this + 0x110);
  }
  pfVar8 = pfVar7;
  if ((uVar3 & 0x40000000) != 0) {
    iVar10 = *(int *)this;
    pfVar7[1] = (float)this;
    *pfVar7 = (float)local_22c;
    pcVar1 = *(code **)(iVar10 + 0x234);
    pfVar7[-1] = 8.906912e-39;
    (*pcVar1)();
    pfVar8 = pfVar7 + -1;
    pfVar7[5] = 0.05;
    pfVar7[4] = 1.4013e-45;
    pfVar7[3] = 0.0;
    pfVar7[2] = 0.0;
    pfVar7[1] = 3.57331e-43;
    *pfVar7 = 16.0;
    pfVar7[-1] = (float)local_22c;
    pfVar7[-2] = 8.906995e-39;
    NDebugOverlay::Cross3D
              ((Vector *)pfVar7[-1],*pfVar7,(int)pfVar7[1],(int)pfVar7[2],(int)pfVar7[3],
               *(bool *)(pfVar7 + 4),pfVar7[5]);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    *(undefined1 **)((int)pfVar8 + -4) = &LAB_00610195;
    __stack_chk_fail();
  }
  return iVar9;
}

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)