L L4D2node

CDirector::UpdateTempo

0x00879600 · 1531 bytes · __thiscall

_ZN9CDirector11UpdateTempoEv

Decompiled

undefined (1 param)

/* CDirector::UpdateTempo() */

void __thiscall CDirector::UpdateTempo(CDirector *this)

{
  int iVar1;
  undefined4 uVar2;
  char cVar3;
  CTerrorPlayer *pCVar4;
  longdouble lVar5;
  longdouble lVar6;
  float fVar7;
  float local_20 [4];
  
  cVar3 = (**(code **)(*(int *)this + 0x44))(this);
  if (cVar3 != '\0') {
    *(undefined4 *)(this + 0x194) = 0;
    return;
  }
  iVar1 = *(int *)(this + 0x194);
  if (iVar1 == 1) {
    lVar5 = (longdouble)CountdownTimer::Now();
    if ((float)lVar5 < *(float *)(this + 0x1a0)) {
      return;
    }
    UTIL_LogPrintf(
                  "------------------------------ Director state change SUSTAIN_PEAK -> PEAK_FADE\n"
                  );
    *(undefined4 *)(this + 0x194) = 2;
    pCVar4 = (CTerrorPlayer *)
             CDirectorTacticalServices::GetHighestFlowSurvivor
                       (*(CDirectorTacticalServices **)(this + 0x628),0);
    fVar7 = -9999.0;
    if (pCVar4 != (CTerrorPlayer *)0x0) {
      lVar5 = (longdouble)CTerrorPlayer::GetFlowDistance(pCVar4,0);
      fVar7 = (float)lVar5;
    }
    *(float *)(this + 0x1a4) = fVar7;
    return;
  }
  if (iVar1 < 2) {
    if (iVar1 != 0) {
      return;
    }
    lVar5 = (longdouble)CountdownTimer::Now();
    if ((float)lVar5 < *(float *)(this + 0x1a0)) {
      return;
    }
    local_20[0] = 0.0;
    ForEachTerrorPlayer<FindMaxIntensity>((FindMaxIntensity *)local_20);
    fVar7 = local_20[0];
    lVar5 = (longdouble)
            GetScriptValue(this,"IntensityThreshold",
                           *(float *)(DirectorPrivate_DirectorIntensityThreshold._28_4_ + 0x2c));
    if (fVar7 < (float)lVar5) {
      return;
    }
    UTIL_LogPrintf("------------------------------ Director state change BUILD_UP -> SUSTAIN_PEAK\n"
                  );
    uVar2 = DirectorPrivate_DirectorSustainPeakMaxTime._28_4_;
    *(undefined4 *)(this + 0x194) = 1;
    lVar5 = (longdouble)GetScriptValue(this,"SustainPeakMaxTime",*(float *)(uVar2 + 0x2c));
    lVar6 = (longdouble)
            GetScriptValue(this,"SustainPeakMinTime",
                           *(float *)(DirectorPrivate_DirectorSustainPeakMinTime._28_4_ + 0x2c));
    lVar5 = (longdouble)RandomFloat((float)lVar6,(float)lVar5);
    fVar7 = (float)lVar5;
    lVar5 = (longdouble)CountdownTimer::Now();
    if ((float)lVar5 + fVar7 != *(float *)(this + 0x1a0)) {
      (**(code **)(*(int *)(this + 0x198) + 4))(this + 0x198,this + 0x1a0);
      *(float *)(this + 0x1a0) = (float)lVar5 + fVar7;
    }
    if (fVar7 != *(float *)(this + 0x19c)) {
      (**(code **)(*(int *)(this + 0x198) + 4))(this + 0x198,this + 0x19c);
      *(float *)(this + 0x19c) = fVar7;
    }
    TerrorNavMesh::RemoveWanderersInActiveAreaSet();
    return;
  }
  if (iVar1 != 2) {
    if (iVar1 != 3) {
      return;
    }
    pCVar4 = (CTerrorPlayer *)
             CDirectorTacticalServices::GetHighestFlowSurvivor
                       (*(CDirectorTacticalServices **)(this + 0x628),0);
    lVar5 = (longdouble)CountdownTimer::Now();
    if ((float)lVar5 < *(float *)(this + 0x1a0)) {
      if (pCVar4 == (CTerrorPlayer *)0x0) {
        return;
      }
      if (*(float *)(this + 0x1a4) == -9999.0) {
        return;
      }
      lVar5 = (longdouble)CTerrorPlayer::GetFlowDistance(pCVar4,0);
      fVar7 = *(float *)(this + 0x1a4);
      lVar6 = (longdouble)
              GetScriptValue(this,"RelaxMaxFlowTravel",
                             *(float *)(DirectorPrivate_DirectorRelaxMaxFlowTravel._28_4_ + 0x2c));
      if ((float)lVar5 <= (float)lVar6 + fVar7) {
        return;
      }
    }
    UTIL_LogPrintf("------------------------------ Director state change RELAX -> BUILD_UP\n");
    uVar2 = DirectorPrivate_DirectorBuildUpMinInterval._28_4_;
    *(undefined4 *)(this + 0x194) = 0;
    lVar5 = (longdouble)GetScriptValue(this,"BuildUpMinInterval",*(float *)(uVar2 + 0x2c));
    fVar7 = (float)lVar5;
    lVar5 = (longdouble)CountdownTimer::Now();
    if ((float)lVar5 + fVar7 != *(float *)(this + 0x1a0)) {
      (**(code **)(*(int *)(this + 0x198) + 4))(this + 0x198,this + 0x1a0);
      *(float *)(this + 0x1a0) = (float)lVar5 + fVar7;
    }
    if (fVar7 == *(float *)(this + 0x19c)) {
      return;
    }
    (**(code **)(*(int *)(this + 0x198) + 4))(this + 0x198,this + 0x19c);
    *(float *)(this + 0x19c) = fVar7;
    return;
  }
  pCVar4 = (CTerrorPlayer *)
           CDirectorTacticalServices::GetHighestFlowSurvivor
                     (*(CDirectorTacticalServices **)(this + 0x628),0);
  if (*(int *)(this + 0x1c0) < 1) {
    local_20[0] = 0.0;
    ForEachTerrorPlayer<FindMaxIntensity>((FindMaxIntensity *)local_20);
    fVar7 = local_20[0];
    lVar5 = (longdouble)
            GetScriptValue(this,"IntensityRelaxThreshold",
                           *(float *)(DirectorPrivate_DirectorIntensityRelaxThreshold._28_4_ + 0x2c)
                          );
    if (fVar7 < (float)lVar5) goto LAB_00879840;
  }
  if (pCVar4 == (CTerrorPlayer *)0x0) {
    return;
  }
  if (*(float *)(this + 0x1a4) == -9999.0) {
    return;
  }
  lVar5 = (longdouble)CTerrorPlayer::GetFlowDistance(pCVar4,0);
  fVar7 = *(float *)(this + 0x1a4);
  lVar6 = (longdouble)
          GetScriptValue(this,"RelaxMaxFlowTravel",
                         *(float *)(DirectorPrivate_DirectorRelaxMaxFlowTravel._28_4_ + 0x2c));
  if ((float)lVar5 <= (float)lVar6 + fVar7) {
    return;
  }
LAB_00879840:
  UTIL_LogPrintf("------------------------------ Director state change PEAK_FADE -> RELAX\n");
  uVar2 = DirectorPrivate_DirectorRelaxMaxInterval._28_4_;
  *(undefined4 *)(this + 0x194) = 3;
  lVar5 = (longdouble)GetScriptValue(this,"RelaxMaxInterval",*(float *)(uVar2 + 0x2c));
  lVar6 = (longdouble)
          GetScriptValue(this,"RelaxMinInterval",
                         *(float *)(DirectorPrivate_DirectorRelaxMinInterval._28_4_ + 0x2c));
  lVar5 = (longdouble)RandomFloat((float)lVar6,(float)lVar5);
  fVar7 = (float)lVar5;
  lVar5 = (longdouble)CountdownTimer::Now();
  if ((float)lVar5 + fVar7 != *(float *)(this + 0x1a0)) {
    (**(code **)(*(int *)(this + 0x198) + 4))(this + 0x198,this + 0x1a0);
    *(float *)(this + 0x1a0) = (float)lVar5 + fVar7;
  }
  if (fVar7 != *(float *)(this + 0x19c)) {
    (**(code **)(*(int *)(this + 0x198) + 4))(this + 0x198,this + 0x19c);
    *(float *)(this + 0x19c) = fVar7;
  }
  fVar7 = -9999.0;
  if (pCVar4 != (CTerrorPlayer *)0x0) {
    lVar5 = (longdouble)CTerrorPlayer::GetFlowDistance(pCVar4,0);
    fVar7 = (float)lVar5;
  }
  *(float *)(this + 0x1a4) = fVar7;
  CL4DGameStats::Event_DirectorRelaxed((CL4DGameStats *)CL4D_GameStats);
  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)