L L4D2node

CDirectorScriptedEventManager::ChangeScriptedEventStage

0x008b8dd0 · 1094 bytes · __thiscall

_ZN29CDirectorScriptedEventManager24ChangeScriptedEventStageEiPKc

Decompiled

undefined (3 params)

/* CDirectorScriptedEventManager::ChangeScriptedEventStage(int, char const*) */

void __thiscall
CDirectorScriptedEventManager::ChangeScriptedEventStage
          (CDirectorScriptedEventManager *this,int param_1,char *param_2)

{
  float fVar1;
  int iVar2;
  char *pcVar3;
  NextBotManager *this_00;
  int in_GS_OFFSET;
  longdouble lVar4;
  CDirector *pCVar5;
  CDirector *pCVar6;
  char local_a0 [128];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  switch(param_1) {
  case 0:
    ChangeFinaleStage(this,7,param_2);
    pCVar6 = (CDirector *)this;
    break;
  case 1:
    this[0x8b] = (CDirectorScriptedEventManager)0x0;
    lVar4 = (longdouble)CountdownTimer::Now();
    if ((float)lVar4 + 1.0 != *(float *)(this + 0xfc)) {
      (**(code **)(*(int *)(this + 0xf4) + 4))(this + 0xf4,this + 0xfc);
      *(float *)(this + 0xfc) = (float)lVar4 + 1.0;
    }
    if (*(float *)(this + 0xf8) != 1.0) {
      (**(code **)(*(int *)(this + 0xf4) + 4))(this + 0xf4,this + 0xf8);
      *(undefined4 *)(this + 0xf8) = 0x3f800000;
    }
    ChangeFinaleStage(this,8,param_2);
    pCVar6 = TheDirector;
    iVar2 = CDirector::GetFinaleTankLimit();
    if (-1 < iVar2) {
      *(undefined4 *)(this + 0xec) = 1;
    }
    break;
  case 2:
    if (*(float *)(this + 0x98) != -1.0) {
      (**(code **)(*(int *)(this + 0x90) + 4))(this + 0x90,this + 0x98);
      *(undefined4 *)(this + 0x98) = 0xbf800000;
    }
    ChangeFinaleStage(this,10,param_2);
    pCVar6 = (CDirector *)this;
    break;
  case 3:
    ChangeFinaleStage(this,9,param_2);
    pcVar3 = (char *)CDirector::GetScriptValue
                               (TheDirector,(char *)(this + 8),(char *)0x0,local_a0,0x80);
    if (pcVar3 == (char *)0x0) {
      Warning("Couldn\'t find a script name for custom scripted stage %s\n",this + 8);
    }
    else {
      CDirector::BeginLocalScript(TheDirector,pcVar3);
    }
    pCVar5 = (CDirector *)(this + 0x104);
    lVar4 = (longdouble)CDirector::GetScriptValue(TheDirector,"MinimumStageTime",1.0);
    fVar1 = (float)lVar4;
    pCVar6 = pCVar5;
    lVar4 = (longdouble)CountdownTimer::Now();
    if ((float)lVar4 + fVar1 != *(float *)(this + 0x10c)) {
      pCVar6 = pCVar5;
      (**(code **)(*(int *)(this + 0x104) + 4))(pCVar5,this + 0x10c);
      *(float *)(this + 0x10c) = (float)lVar4 + fVar1;
    }
    if (fVar1 != *(float *)(this + 0x108)) {
      (**(code **)(*(int *)(this + 0x104) + 4))(pCVar5,this + 0x108);
      *(float *)(this + 0x108) = fVar1;
      pCVar6 = pCVar5;
    }
    break;
  case 4:
    Msg("Going into Old ClearNWait");
    if (*(float *)(this + 0x98) != -1.0) {
      (**(code **)(*(int *)(this + 0x90) + 4))(this + 0x90,this + 0x98);
      *(undefined4 *)(this + 0x98) = 0xbf800000;
    }
    this_00 = (NextBotManager *)TheNextBots();
    NextBotManager::StartAssault(this_00);
    ChangeFinaleStage(this,0xb,param_2);
    pCVar6 = (CDirector *)this;
    break;
  case 5:
    InitScriptedSetupStage(this);
    ChangeFinaleStage(this,0x13,param_2);
    pCVar6 = (CDirector *)this;
    break;
  default:
    if (*(int *)this == 3) {
      *(undefined4 *)this = 5;
    }
    else {
      InitScriptedEscapeStage(this);
      ChangeFinaleStage(this,6,param_2);
    }
    pCVar6 = TheDirector;
    CDirector::EndLocalScript(TheDirector);
    break;
  case 7:
    InitScriptedEscapeStage(this);
    ChangeFinaleStage(this,0x15,param_2);
    pCVar6 = (CDirector *)this;
    break;
  case 8:
    if (*(float *)(this + 0x98) != -1.0) {
      (**(code **)(*(int *)(this + 0x90) + 4))(this + 0x90,this + 0x98);
      *(undefined4 *)(this + 0x98) = 0xbf800000;
    }
    ChangeFinaleStage(this,0x16,param_2);
    pCVar6 = (CDirector *)this;
    break;
  case 9:
    ChangeFinaleStage(this,0x12,param_2);
    pCVar6 = (CDirector *)this;
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(pCVar6);
}

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)