L L4D2node

CDirector::RandomizeSpecialSpawnTimers

0x00879250 · 432 bytes · __thiscall

_ZN9CDirector27RandomizeSpecialSpawnTimersEv

Decompiled

undefined (1 param)

/* CDirector::RandomizeSpecialSpawnTimers() */

void __thiscall CDirector::RandomizeSpecialSpawnTimers(CDirector *this)

{
  float fVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  longdouble lVar7;
  float fVar8;
  float fVar9;
  
  lVar7 = (longdouble)GetScriptValue(this,"AddToSpawnTimer",0.0);
  fVar1 = (float)lVar7;
  if (fVar1 != 0.0) {
    iVar6 = 0;
    iVar5 = 0;
    while( true ) {
      iVar2 = (**(code **)(*(int *)this + 0x30))(this);
      iVar4 = 3;
      if (3 < iVar2) {
        iVar4 = (**(code **)(*(int *)this + 0x30))(this);
      }
      if ((iVar4 <= iVar5) || (*(int *)(this + 0x370) <= iVar5)) break;
      fVar9 = *(float *)(*(int *)(this + 0x33c) + iVar6 + 8);
      lVar7 = (longdouble)CountdownTimer::Now();
      fVar9 = fVar9 - (float)lVar7;
      if (fVar9 <= 0.0) {
        fVar9 = 0.0;
      }
      if (fVar9 < fVar1) {
        fVar8 = 0.0;
        if (0.0 < fVar1) {
          lVar7 = (longdouble)RandomFloat(fVar1 * 0.5,fVar1 * 1.5);
          fVar8 = (float)lVar7 + fVar9;
        }
        piVar3 = (int *)(*(int *)(this + 0x33c) + iVar6);
        lVar7 = (longdouble)CountdownTimer::Now();
        if ((float)lVar7 + fVar8 != (float)piVar3[2]) {
          (**(code **)(*piVar3 + 4))(piVar3,piVar3 + 2);
          piVar3[2] = (int)((float)lVar7 + fVar8);
        }
        if (fVar8 != (float)piVar3[1]) {
          (**(code **)(*piVar3 + 4))(piVar3,piVar3 + 1);
          piVar3[1] = (int)fVar8;
        }
      }
      iVar5 = iVar5 + 1;
      iVar6 = iVar6 + 0xc;
    }
  }
  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)