L L4D2node

InfoChangelevel::StartChangeLevel

0x00865a60 · 994 bytes · __thiscall

_ZN15InfoChangelevel16StartChangeLevelEPK10Checkpoint

Decompiled

undefined (2 params)

/* InfoChangelevel::StartChangeLevel(Checkpoint const*) */

void __thiscall InfoChangelevel::StartChangeLevel(InfoChangelevel *this,Checkpoint *param_1)

{
  InfoChangelevel *pIVar1;
  int *piVar2;
  char cVar3;
  CBaseEntity *pCVar4;
  int iVar5;
  int iVar6;
  Vector *pVVar7;
  Checkpoint *this_00;
  uint uVar8;
  undefined1 local_24 [21];
  KillBurningPZs local_f;
  TransitionResponse local_e;
  PlayTransitionMusic local_d;
  
  if (*(int *)(ChangeLevelInhibit._28_4_ + 0x30) == 0) {
    if ((*(int *)(nav_edit._28_4_ + 0x30) == 0) && (this[0x5a9] == (InfoChangelevel)0x0)) {
      pIVar1 = this + 0x589;
      this[0x5a9] = (InfoChangelevel)0x1;
      V_strncpy(s_landmarkName,(char *)pIVar1,0x20);
      pCVar4 = (CBaseEntity *)
               CGlobalEntityList::FindEntityByName
                         ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,s_landmarkName,
                          (CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
                          (IEntityFindFilter *)0x0);
      if (pCVar4 == (CBaseEntity *)0x0) {
        s_landmarkPosition._0_4_ = 0;
        s_landmarkPosition._4_4_ = 0;
        s_landmarkPosition._8_4_ = 0;
      }
      else {
        if (((byte)pCVar4[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(pCVar4);
        }
        s_landmarkPosition._0_4_ = *(undefined4 *)(pCVar4 + 0x2e0);
        s_landmarkPosition._4_4_ = *(undefined4 *)(pCVar4 + 0x2e4);
        s_landmarkPosition._8_4_ = *(undefined4 *)(pCVar4 + 0x2e8);
      }
      if ((pIVar1 == (InfoChangelevel *)0xc13fa0) ||
         (iVar5 = _V_stricmp((char *)pIVar1,"."), iVar5 == 0)) {
        pVVar7 = (Vector *)(**(code **)(*(int *)this + 0x288))(this);
        this_00 = (Checkpoint *)TerrorNavMesh::GetCheckpoint(TheNavMesh,pVVar7);
        if (this_00 != (Checkpoint *)0x0) {
          Checkpoint::RespawnSurvivors(this_00);
        }
      }
      else {
        ZombieManager::OnChangelevelStart(TheZombieManager);
        if (param_1 != (Checkpoint *)0x0) {
          Checkpoint::LockAllDoors(param_1);
        }
        ForEachTerrorPlayer<KillBurningPZs>(&local_f);
        cVar3 = CTerrorGameRules::HasPlayerControlledZombies();
        if (cVar3 == '\0') {
          SaveEntities(this);
        }
        iVar5 = (**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"map_transition",0,0);
        if (iVar5 != 0) {
          (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,iVar5,0);
        }
        cVar3 = (**(code **)(*TheDirector + 0x3c))(TheDirector);
        if (cVar3 != '\0') {
          (**(code **)(*TheDirector + 0x28))(TheDirector,1);
          (**(code **)(*g_pGameRules + 0x9c))(g_pGameRules,this + 0x569);
        }
        iVar5 = 1;
        ForEachSurvivor<TransitionResponse>(&local_e);
        ForEachSurvivor<PlayTransitionMusic>(&local_d);
        if (0 < *(int *)(gpGlobals + 0x14)) {
          do {
            pCVar4 = (CBaseEntity *)UTIL_PlayerByIndex(iVar5);
            if ((((pCVar4 != (CBaseEntity *)0x0) && (*(int *)(pCVar4 + 0x30) != 0)) &&
                (*(int *)(pCVar4 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0)) &&
               (((cVar3 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4), cVar3 != '\0' &&
                 (*(int *)(pCVar4 + 0x1f6c) != 2)) &&
                (iVar6 = (**(code **)(*(int *)pCVar4 + 0x148))(pCVar4), iVar6 == 0)))) {
              CBaseEntity::AddFlag(pCVar4,0x4020);
              CBasePlayer::RumbleEffect((CBasePlayer *)pCVar4,'\0','\0','\0');
            }
            iVar5 = iVar5 + 1;
          } while (iVar5 <= *(int *)(gpGlobals + 0x14));
        }
        iVar5 = TheNextBots();
        uVar8 = (uint)*(ushort *)(iVar5 + 0x10);
        if (uVar8 != 0xffff) {
          iVar6 = *(int *)(iVar5 + 4);
          do {
            piVar2 = *(int **)(iVar6 + uVar8 * 8);
            pCVar4 = (CBaseEntity *)(**(code **)(*piVar2 + 0xb4))(piVar2);
            CBaseEntity::AddFlag(pCVar4,0x20);
            iVar6 = *(int *)(iVar5 + 4);
            uVar8 = (uint)*(ushort *)(iVar6 + 6 + uVar8 * 8);
          } while (uVar8 != 0xffff);
        }
        COutputEvent::FireOutput
                  ((COutputEvent *)(this + 0x5b8),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
        CBaseEntity::ThinkSet((_func_void *)local_24,(float)this,(char *)ChangeLevelSpeechDelay);
        CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.5,(char *)0x0)
        ;
      }
    }
    return;
  }
  Msg("Would change level, but not going to!\n");
  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)