L L4D2node

CTerrorPlayer::TransitionRestore

0x008f8080 · 1130 bytes · __thiscall

_ZN13CTerrorPlayer17TransitionRestoreEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::TransitionRestore() */

PlayerSaveData * __thiscall CTerrorPlayer::TransitionRestore(CTerrorPlayer *this)

{
  CBaseEdict *pCVar1;
  char cVar2;
  CTerrorPlayer CVar3;
  char cVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  int iVar7;
  int iVar8;
  uint uVar9;
  int iVar10;
  int iVar11;
  PlayerSaveData *this_00;
  
  if (this[0x3374] != (CTerrorPlayer)0x0) {
    uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
    uVar6 = (**(code **)(*(int *)this + 0xb8))(this);
    DevMsg(1,"[TAKEOVER]: Restoring %s(%d) after transition.\n",uVar6,uVar5);
    if (*(char *)(TheDirector + 0x28f) == '\0') {
      iVar11 = 0;
      if (0 < DAT_0100e518) {
LAB_008f810f:
        iVar7 = KeyValues::GetInt(*(KeyValues **)(g_SavedPlayers + iVar11 * 4),"userID",0);
        iVar8 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
        if (iVar7 != iVar8) goto LAB_008f8100;
        this_00 = (PlayerSaveData *)(iVar11 * 4 + g_SavedPlayers);
LAB_008f815c:
        if (this_00 != (PlayerSaveData *)0x0) {
LAB_008f8164:
          uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
          uVar6 = (**(code **)(*(int *)this + 0xb8))(this);
          DevMsg(1,"[TAKEOVER]: Found transition data for %s(%d).\n",uVar6,uVar5);
          (**(code **)(*(int *)this + 0x8d0))(this,1);
          uVar9 = KeyValues::GetInt(*(KeyValues **)this_00,"reportid",0);
          SetPlayerReportID(this,uVar9);
          PlayerSaveData::Restore(this_00,this);
          (**(code **)(*(int *)this + 0x8d0))(this,0);
          iVar11 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
          if ((iVar11 == 2) &&
             (cVar2 = CDirectorChallengeMode::HealingGnome
                                (*(CDirectorChallengeMode **)(TheDirector + 0x648)), cVar2 != '\0'))
          {
            cVar4 = '\0';
            iVar11 = (**(code **)(*(int *)this + 0x1fc))(this);
            AddHealthBuffer(this,100.0,(float)iVar11);
            iVar11 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
            cVar2 = IsASurvivorTeam(iVar11);
            if (cVar2 != '\0') {
              cVar4 = IsOnThirdStrike(this);
            }
            if (*(int *)(this + 0x2e54) != 0) {
              if (this[0x6c] == (CTerrorPlayer)0x0) {
                pCVar1 = *(CBaseEdict **)(this + 0x30);
                if (pCVar1 != (CBaseEdict *)0x0) {
                  *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                  iVar11 = CBaseEdict::GetChangeAccessor(pCVar1);
                  *(undefined2 *)(iVar11 + 2) = 0;
                }
              }
              else {
                this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
              }
              *(undefined4 *)(this + 0x2e54) = 0;
            }
            CVar3 = (CTerrorPlayer)IsOnThirdStrike(this);
            if (CVar3 != this[0x2e58]) {
              if (this[0x6c] == (CTerrorPlayer)0x0) {
                pCVar1 = *(CBaseEdict **)(this + 0x30);
                if (pCVar1 != (CBaseEdict *)0x0) {
                  *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                  iVar11 = CBaseEdict::GetChangeAccessor(pCVar1);
                  *(undefined2 *)(iVar11 + 2) = 0;
                }
              }
              else {
                this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
              }
              this[0x2e58] = CVar3;
            }
            cVar2 = IsOnThirdStrike(this);
            if (cVar2 == '\0') {
              if (cVar4 != '\0') {
                StopTrackedSound(this,"Player.Heartbeat");
              }
            }
            else {
              StopTrackedSound(this,"Player.Heartbeat");
              CCSPlayer::EmitPrivateSound((CCSPlayer *)this,"Player.Heartbeat");
              TrackSound(this,"Player.Heartbeat");
            }
          }
          this[0x3374] = (CTerrorPlayer)0x0;
          return this_00;
        }
      }
    }
    else {
      iVar11 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      cVar2 = IsASurvivorTeam(iVar11);
      if (cVar2 != '\0') {
        iVar11 = *(int *)(this + 0x2ba0);
        iVar7 = 0;
        if (0 < DAT_0100e518) {
          do {
            iVar8 = KeyValues::GetInt(*(KeyValues **)(g_SavedPlayers + iVar7 * 4),"teamNumber",0);
            iVar10 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
            if ((iVar10 == iVar8) &&
               (iVar8 = KeyValues::GetInt(*(KeyValues **)(g_SavedPlayers + iVar7 * 4),"character",0)
               , iVar8 == iVar11)) {
              this_00 = (PlayerSaveData *)(iVar7 * 4 + g_SavedPlayers);
              if (this_00 != (PlayerSaveData *)0x0) goto LAB_008f8164;
              break;
            }
            iVar7 = iVar7 + 1;
          } while (iVar7 < DAT_0100e518);
        }
        iVar7 = 0;
        if (0 < DAT_0100e4f0) {
          do {
            iVar8 = KeyValues::GetInt(*(KeyValues **)(g_SavedLevelRestartSurvivorBots + iVar7 * 4),
                                      "teamNumber",0);
            iVar10 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
            if ((iVar10 == iVar8) &&
               (iVar8 = KeyValues::GetInt(*(KeyValues **)
                                           (g_SavedLevelRestartSurvivorBots + iVar7 * 4),"character"
                                          ,0), iVar8 == iVar11)) {
              this_00 = (PlayerSaveData *)(iVar7 * 4 + g_SavedLevelRestartSurvivorBots);
              goto LAB_008f815c;
            }
            iVar7 = iVar7 + 1;
          } while (iVar7 < DAT_0100e4f0);
        }
      }
    }
LAB_008f84c0:
    uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
    uVar6 = (**(code **)(*(int *)this + 0xb8))(this);
    DevMsg(1,"[TAKEOVER]: Failed to find transition data for %s(%d).\n",uVar6,uVar5);
    this[0x3374] = (CTerrorPlayer)0x0;
  }
  return (PlayerSaveData *)0x0;
LAB_008f8100:
  iVar11 = iVar11 + 1;
  if (DAT_0100e518 <= iVar11) goto LAB_008f84c0;
  goto LAB_008f810f;
}

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)