L L4D2node

CEnvEffectsScript::ParseNewEffect

0x0068ea90 · 1745 bytes · __thiscall

_ZN17CEnvEffectsScript14ParseNewEffectEv

Decompiled

undefined (1 param)

/* CEnvEffectsScript::ParseNewEffect() */

void __thiscall CEnvEffectsScript::ParseNewEffect(CEnvEffectsScript *this)

{
  int iVar1;
  long lVar2;
  int in_GS_OFFSET;
  double dVar3;
  CEffectScriptElement local_1d0 [128];
  undefined4 local_150;
  undefined4 local_14c;
  undefined4 local_148;
  undefined4 local_144;
  undefined4 local_140;
  undefined4 local_13c;
  undefined4 local_138;
  undefined4 local_134;
  char local_130 [128];
  char local_b0 [128];
  float local_30;
  float local_2c;
  float local_28;
  undefined1 local_24;
  undefined1 local_23;
  int local_20;
  
  local_23 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_30 = 1.0;
  local_24 = 0;
  local_150 = 0xffffffff;
  local_14c = 0xffffffff;
  local_148 = 0;
  local_144 = 5;
  local_140 = 0xff;
  local_13c = 0;
  local_138 = 0;
  local_134 = 0xff;
  local_2c = 1.0;
  local_28 = -1.0;
  if (g_bUnget == '\0') {
    currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4);
    tokencount = tokencount + 1;
  }
  else {
    g_bUnget = '\0';
  }
  V_strncpy((char *)local_1d0,(char *)&token,0x80);
  while( true ) {
    if (g_bUnget == '\0') {
      currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4);
      tokencount = tokencount + 1;
    }
    else {
      g_bUnget = '\0';
    }
    iVar1 = _V_stricmp((char *)&token,"effect");
    if (iVar1 == 0) break;
    iVar1 = _V_stricmp((char *)&token,"{");
    if (iVar1 == 0) {
LAB_0068ec50:
      if (g_bUnget == '\0') goto LAB_0068ece3;
      do {
        g_bUnget = '\0';
        while( true ) {
          iVar1 = _V_stricmp((char *)&token,"}");
          if (iVar1 == 0) goto LAB_0068ed87;
          iVar1 = _V_stricmp((char *)&token,"type");
          if (iVar1 != 0) {
            iVar1 = _V_stricmp((char *)&token,"material");
            if (iVar1 == 0) {
              if (g_bUnget == '\0') {
                currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4);
                tokencount = tokencount + 1;
              }
              else {
                g_bUnget = '\0';
              }
              V_strncpy(local_b0,(char *)&token,0x80);
              CBaseEntity::PrecacheModel(local_b0);
            }
            else {
              iVar1 = _V_stricmp((char *)&token,"attachment");
              if (iVar1 == 0) {
                if (g_bUnget == '\0') {
                  currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4);
                  tokencount = tokencount + 1;
                }
                else {
                  g_bUnget = '\0';
                }
                V_strncpy(local_130,(char *)&token,0x80);
              }
              else {
                iVar1 = _V_stricmp((char *)&token,"color");
                if (iVar1 == 0) {
                  if (g_bUnget == '\0') {
                    currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4);
                    tokencount = tokencount + 1;
                  }
                  else {
                    g_bUnget = '\0';
                  }
                  sscanf((char *)&token,"%i %i %i %i",&local_140,&local_13c,&local_138,&local_134);
                }
                else {
                  iVar1 = _V_stricmp((char *)&token,"scale");
                  if (iVar1 == 0) {
                    if (g_bUnget == '\0') {
                      currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4)
                      ;
                      tokencount = tokencount + 1;
                    }
                    else {
                      g_bUnget = '\0';
                    }
                    dVar3 = strtod((char *)&token,(char **)0x0);
                    local_30 = (float)dVar3;
                  }
                  else {
                    iVar1 = _V_stricmp((char *)&token,"texturescale");
                    if (iVar1 == 0) {
                      if (g_bUnget == '\0') {
                        currenttoken = (**(code **)(*engine + 0xe4))
                                                 (engine,currenttoken,&token,0x4b4);
                        tokencount = tokencount + 1;
                      }
                      else {
                        g_bUnget = '\0';
                      }
                      dVar3 = strtod((char *)&token,(char **)0x0);
                      local_28 = 0.0;
                      if (0.0 < (float)dVar3) {
                        local_28 = 1.0 / (float)dVar3;
                      }
                    }
                    else {
                      iVar1 = _V_stricmp((char *)&token,"fadetime");
                      if (iVar1 == 0) {
                        if (g_bUnget == '\0') {
                          ParseToken();
                        }
                        else {
                          g_bUnget = '\0';
                        }
                        dVar3 = strtod((char *)&token,(char **)0x0);
                        local_2c = (float)dVar3;
                      }
                      else {
                        iVar1 = _V_stricmp((char *)&token,"stopfollowonkill");
                        if (iVar1 == 0) {
                          if (g_bUnget == '\0') {
                            ParseToken();
                          }
                          else {
                            g_bUnget = '\0';
                          }
                          lVar2 = strtol((char *)&token,(char **)0x0,10);
                          local_24 = lVar2 != 0;
                        }
                      }
                    }
                  }
                }
              }
            }
            goto LAB_0068ec50;
          }
          if (g_bUnget == '\0') {
            currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4);
            tokencount = tokencount + 1;
          }
          else {
            g_bUnget = '\0';
          }
          iVar1 = _V_stricmp((char *)&token,"trail");
          if (iVar1 != 0) {
            iVar1 = _V_stricmp((char *)&token,"sprite");
            if (iVar1 == 0) {
              local_148 = 2;
            }
            goto LAB_0068ec50;
          }
          local_148 = 1;
          if (g_bUnget != '\0') break;
LAB_0068ece3:
          currenttoken = (**(code **)(*engine + 0xe4))(engine,currenttoken,&token,0x4b4);
          tokencount = tokencount + 1;
        }
      } while( true );
    }
  }
  g_bUnget = '\x01';
LAB_0068ed87:
  CUtlVector<CEffectScriptElement,CUtlMemory<CEffectScriptElement,int>>::InsertBefore
            ((CUtlVector<CEffectScriptElement,CUtlMemory<CEffectScriptElement,int>> *)
             (this + 0x13f8),*(int *)(this + 0x1404),local_1d0);
  if (local_20 != *(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)