L L4D2node

InfoChangelevel::UpdateChangelevel

0x00865e70 · 1211 bytes · __thiscall

_ZN15InfoChangelevel17UpdateChangelevelEP30InfoChangelevelPlayerCollector

Decompiled

undefined (2 params)

/* InfoChangelevel::UpdateChangelevel(InfoChangelevelPlayerCollector*) */

void __thiscall
InfoChangelevel::UpdateChangelevel(InfoChangelevel *this,InfoChangelevelPlayerCollector *param_1)

{
  CBaseEntity *this_00;
  CBaseEntity *this_01;
  code *pcVar1;
  byte bVar2;
  char cVar3;
  Vector *pVVar4;
  Checkpoint *pCVar5;
  int iVar6;
  int *piVar7;
  undefined4 uVar8;
  longdouble lVar9;
  double dVar10;
  double dVar11;
  float fVar12;
  int local_30;
  CAI_Concept local_24 [20];
  
  if ((param_1[0x2a] != (InfoChangelevelPlayerCollector)0x0) &&
     (param_1[0x28] == (InfoChangelevelPlayerCollector)0x0)) {
    pVVar4 = (Vector *)(**(code **)(*(int *)this + 0x288))(this);
    pCVar5 = (Checkpoint *)TerrorNavMesh::GetCheckpoint(TheNavMesh,pVVar4);
    if (pCVar5 != (Checkpoint *)0x0) {
      bVar2 = Checkpoint::AreAllDoorsClosed(pCVar5);
      this[0x5aa] = (InfoChangelevel)(bVar2 ^ 1);
      if (*(float *)(this + 0x5b4) <= 0.0) {
        lVar9 = (longdouble)CountdownTimer::Now();
        if ((float)lVar9 + 3.0 != *(float *)(this + 0x5b4)) {
          (**(code **)(*(int *)(this + 0x5ac) + 4))(this + 0x5ac,this + 0x5b4);
          *(float *)(this + 0x5b4) = (float)lVar9 + 3.0;
        }
        if (*(float *)(this + 0x5b0) != 3.0) {
          (**(code **)(*(int *)(this + 0x5ac) + 4))(this + 0x5ac,this + 0x5b0);
          *(undefined4 *)(this + 0x5b0) = 0x40400000;
        }
      }
      else {
        lVar9 = (longdouble)CountdownTimer::Now();
        if (*(float *)(this + 0x5b4) <= (float)lVar9) {
          if (*(int *)(param_1 + 0xc) != 0) {
            iVar6 = RandomInt(0,*(int *)(param_1 + 0xc) + -1);
            this_00 = *(CBaseEntity **)(*(int *)param_1 + iVar6 * 4);
            piVar7 = (int *)(**(code **)(*(int *)this_00 + 0x77c))(this_00);
            cVar3 = (**(code **)(*piVar7 + 0x10))(piVar7);
            if (cVar3 == '\0') {
              if (param_1[0x29] == (InfoChangelevelPlayerCollector)0x0) {
                if (this[0x5aa] != (InfoChangelevel)0x0) {
                  pcVar1 = *(code **)(*(int *)this_00 + 0x7b4);
                  CAI_Concept::CAI_Concept(local_24,"PlayerLockTheDoorCheckPoint");
                  (*pcVar1)(this_00,local_24,1,0,0,0,0);
                }
              }
              else {
                if (*(int *)(param_1 + 0x20) < 1) {
                  dVar11 = 1.7976931348623157e+308;
                  local_30 = 0;
                }
                else {
                  dVar11 = 1.7976931348623157e+308;
                  iVar6 = 0;
                  local_30 = 0;
                  do {
                    this_01 = *(CBaseEntity **)(*(int *)(param_1 + 0x14) + iVar6 * 4);
                    if (((byte)this_00[0x14d] & 8) != 0) {
                      CBaseEntity::CalcAbsolutePosition(this_00);
                    }
                    if (((byte)this_01[0x14d] & 8) != 0) {
                      CBaseEntity::CalcAbsolutePosition(this_01);
                    }
                    dVar10 = (double)((*(float *)(this_01 + 0x2e4) - *(float *)(this_00 + 0x2e4)) *
                                      (*(float *)(this_01 + 0x2e4) - *(float *)(this_00 + 0x2e4)) +
                                      (*(float *)(this_01 + 0x2e8) - *(float *)(this_00 + 0x2e8)) *
                                      (*(float *)(this_01 + 0x2e8) - *(float *)(this_00 + 0x2e8)) +
                                     (*(float *)(this_01 + 0x2e0) - *(float *)(this_00 + 0x2e0)) *
                                     (*(float *)(this_01 + 0x2e0) - *(float *)(this_00 + 0x2e0)));
                    if (dVar10 < dVar11) {
                      dVar11 = dVar10;
                      local_30 = iVar6;
                    }
                    iVar6 = iVar6 + 1;
                  } while (iVar6 < *(int *)(param_1 + 0x20));
                }
                uVar8 = SurvivorCharacterName
                                  (*(undefined4 *)
                                    (*(int *)(*(int *)(param_1 + 0x14) + local_30 * 4) + 0x2ba0));
                uVar8 = UTIL_VarArgs("Subject:%s,Distance:%g",uVar8,SQRT(dVar11));
                pcVar1 = *(code **)(*(int *)this_00 + 0x7b4);
                CAI_Concept::CAI_Concept(local_24,"PlayerGetInsideCheckPoint");
                (*pcVar1)(this_00,local_24,1,uVar8,0,0,0);
              }
            }
          }
          iVar6 = RandomInt(5,8);
          fVar12 = (float)iVar6;
          lVar9 = (longdouble)CountdownTimer::Now();
          if ((float)lVar9 + fVar12 != *(float *)(this + 0x5b4)) {
            (**(code **)(*(int *)(this + 0x5ac) + 4))(this + 0x5ac,this + 0x5b4);
            *(float *)(this + 0x5b4) = (float)lVar9 + fVar12;
          }
          if (fVar12 != *(float *)(this + 0x5b0)) {
            (**(code **)(*(int *)(this + 0x5ac) + 4))(this + 0x5ac,this + 0x5b0);
            *(float *)(this + 0x5b0) = fVar12;
          }
        }
      }
      if (this[0x5aa] != (InfoChangelevel)0x0) {
        return;
      }
      if (param_1[0x29] == (InfoChangelevelPlayerCollector)0x0) {
        cVar3 = CDirectorChallengeMode::IsTransitionAllowed
                          (*(CDirectorChallengeMode **)(TheDirector + 0x648));
        if (cVar3 == '\0') {
          return;
        }
        StartChangeLevel(this,pCVar5);
        return;
      }
    }
  }
  if (*(int *)(param_1 + 0xc) != 0) {
    pVVar4 = (Vector *)(**(code **)(*(int *)this + 0x288))(this);
    pCVar5 = (Checkpoint *)TerrorNavMesh::GetCheckpoint(TheNavMesh,pVVar4);
    if (pCVar5 != (Checkpoint *)0x0) {
      bVar2 = Checkpoint::AreAllDoorsClosed(pCVar5);
      this[0x5aa] = (InfoChangelevel)(bVar2 ^ 1);
      return;
    }
  }
  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)