L L4D2node

CSun::Activate

0x00834d50 · 1406 bytes · __thiscall

_ZN4CSun8ActivateEv

Decompiled

undefined (1 param)

/* CSun::Activate() */

void __thiscall CSun::Activate(CSun *this)

{
  CSun CVar1;
  CBaseEdict *pCVar2;
  CBaseEntity *this_00;
  int iVar3;
  int iVar4;
  char *pcVar5;
  int in_GS_OFFSET;
  float fVar6;
  float fVar7;
  float fVar8;
  undefined4 local_130 [4];
  float local_120;
  float local_11c;
  float local_118;
  char local_114 [260];
  int local_10;
  
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  CBaseEntity::Activate((CBaseEntity *)this);
  if (*(int *)(this + 0x454) == 0) {
    pcVar5 = "";
    if (*(char **)(this + 0xf8) != (char *)0x0) {
      pcVar5 = *(char **)(this + 0xf8);
    }
    this_00 = (CBaseEntity *)
              CGlobalEntityList::FindEntityByName
                        ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar5,(CBaseEntity *)0x0,
                         (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
    if (this_00 == (CBaseEntity *)0x0) goto LAB_00834e82;
    if (((byte)this_00[0x14d] & 8) == 0) {
      CVar1 = this[0x14d];
    }
    else {
      CBaseEntity::CalcAbsolutePosition(this_00);
      CVar1 = this[0x14d];
    }
    if (((byte)CVar1 & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    local_120 = *(float *)(this + 0x2e0) - *(float *)(this_00 + 0x2e0);
    local_11c = *(float *)(this + 0x2e4) - *(float *)(this_00 + 0x2e4);
    local_118 = *(float *)(this + 0x2e8) - *(float *)(this_00 + 0x2e8);
    VectorNormalize((Vector *)&local_120);
    if (((local_120 == *(float *)(this + 0x440)) && (local_11c == *(float *)(this + 0x444))) &&
       (local_118 == *(float *)(this + 0x448))) goto LAB_00834e82;
    if (this[0x6c] == (CSun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar3 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CSun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x440) = local_120;
    iVar3 = *(int *)(this + 0x464);
    *(float *)(this + 0x444) = local_11c;
    *(float *)(this + 0x448) = local_118;
  }
  else {
    if (this[0x6c] == (CSun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar3 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CSun)((byte)this[0x70] | 1);
    }
    fVar6 = *(float *)(this + 0x458);
    fVar7 = *(float *)(this + 0x45c);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    SetupLightNormalFromProps((QAngle *)(this + 0x37c),fVar7,fVar6,(Vector *)(this + 0x440));
    fVar8 = -*(float *)(this + 0x448);
    fVar7 = -*(float *)(this + 0x444);
    fVar6 = -*(float *)(this + 0x440);
    if (((*(float *)(this + 0x440) != fVar6) || (*(float *)(this + 0x444) != fVar7)) ||
       (*(float *)(this + 0x448) != fVar8)) {
      if (this[0x6c] == (CSun)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CSun)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x440) = fVar6;
      *(float *)(this + 0x444) = fVar7;
      *(float *)(this + 0x448) = fVar8;
    }
LAB_00834e82:
    iVar3 = *(int *)(this + 0x464);
  }
  if ((iVar3 == -1) && (iVar3 = *(int *)(this + 0x460), iVar3 != -1)) {
    if (this[0x6c] == (CSun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CSun)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x464) = iVar3;
  }
  if (*(char **)(this + 0x44c) == (char *)0x0) {
LAB_00835274:
    AllocPooledString((char *)local_130);
    *(undefined4 *)(this + 0x44c) = local_130[0];
  }
  else {
    iVar3 = V_GetFileExtension(*(char **)(this + 0x44c));
    if (iVar3 == 0) {
      pcVar5 = "";
      if (*(char **)(this + 0x44c) != (char *)0x0) {
        pcVar5 = *(char **)(this + 0x44c);
      }
      V_strncpy(local_114,pcVar5,0x104);
      V_strncat(local_114,".vmt",0x104,-1);
      goto LAB_00835274;
    }
  }
  if (*(char **)(this + 0x450) != (char *)0x0) {
    iVar3 = V_GetFileExtension(*(char **)(this + 0x450));
    if (iVar3 != 0) goto LAB_00834ecb;
    pcVar5 = "";
    if (*(char **)(this + 0x450) != (char *)0x0) {
      pcVar5 = *(char **)(this + 0x450);
    }
    V_strncpy(local_114,pcVar5,0x104);
    V_strncat(local_114,".vmt",0x104,-1);
  }
  AllocPooledString((char *)local_130);
  *(undefined4 *)(this + 0x450) = local_130[0];
LAB_00834ecb:
  pcVar5 = "";
  if (*(char **)(this + 0x44c) != (char *)0x0) {
    pcVar5 = *(char **)(this + 0x44c);
  }
  iVar3 = CBaseEntity::PrecacheModel(pcVar5);
  if (iVar3 != *(int *)(this + 0x470)) {
    if (this[0x6c] == (CSun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CSun)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x470) = iVar3;
  }
  pcVar5 = "";
  if (*(char **)(this + 0x450) != (char *)0x0) {
    pcVar5 = *(char **)(this + 0x450);
  }
  iVar3 = CBaseEntity::PrecacheModel(pcVar5);
  if (iVar3 != *(int *)(this + 0x474)) {
    if (this[0x6c] == (CSun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CSun)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x474) = iVar3;
  }
  if (local_10 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)