L L4D2node

CTerrorPlayer::OnBeginChangeLevel

0x008f61f0 · 539 bytes · __thiscall

_ZN13CTerrorPlayer18OnBeginChangeLevelEPKc

Decompiled

undefined (2 params)

/* CTerrorPlayer::OnBeginChangeLevel(char const*) */

void __thiscall CTerrorPlayer::OnBeginChangeLevel(CTerrorPlayer *this,char *param_1)

{
  float fVar1;
  char cVar2;
  int iVar3;
  CBaseBackpackItem *this_00;
  undefined4 uVar4;
  double local_2c;
  double local_24;
  KeyValues *local_10;
  
  cVar2 = CTerrorGameRules::IsVersusMode();
  if (cVar2 != '\0') {
    return;
  }
  cVar2 = (**(code **)(*(int *)this + 0x778))(this);
  if (cVar2 != '\0') goto LAB_008f634b;
  iVar3 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
  if (iVar3 != 0) {
    this_00 = (CBaseBackpackItem *)
              __dynamic_cast(iVar3,&CBaseCombatWeapon::typeinfo,&CBaseBackpackItem::typeinfo,0);
    if ((this_00 != (CBaseBackpackItem *)0x0) && (this_00[0x17dc] != (CBaseBackpackItem)0x0)) {
      CBaseBackpackItem::CompleteAction(this_00);
      if (this_00[0x17dc] != (CBaseBackpackItem)0x0) {
        (**(code **)(*(int *)this + 0x470))(this,this_00,0,0);
        UTIL_Remove((CBaseEntity *)this_00);
      }
    }
  }
  UpdateMissionStats(this);
  cVar2 = CDirector::IsTransitionScenarioRestart();
  if (cVar2 == '\0') {
    ShowTransitionStats(this);
  }
  if (((byte)this[0x14d] & 8) == 0) {
    local_24 = (double)*(float *)(this + 0x2e8);
LAB_008f629a:
    local_2c = (double)*(float *)(this + 0x2e4);
  }
  else {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    local_24 = (double)*(float *)(this + 0x2e8);
    if (((byte)this[0x14d] & 8) == 0) goto LAB_008f629a;
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    local_2c = (double)*(float *)(this + 0x2e4);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
  }
  fVar1 = *(float *)(this + 0x2e0);
  uVar4 = (**(code **)(*(int *)this + 0xb8))(this);
  UTIL_LogPrintf("Saving %s for transition at %f %f %f\n",uVar4,(double)fVar1,local_2c,local_24);
  PlayerSaveData::PlayerSaveData((PlayerSaveData *)&local_10,this,"player");
                    /* try { // try from 008f6322 to 008f633f has its CatchHandler @ 008f641a */
  KeyValues::SetString(local_10,"targetMap",param_1);
  CUtlVector<PlayerSaveData,CUtlMemory<PlayerSaveData,int>>::InsertBefore
            ((CUtlVector<PlayerSaveData,CUtlMemory<PlayerSaveData,int>> *)&g_SavedPlayers,
             DAT_0100e518,(PlayerSaveData *)&local_10);
  KeyValues::deleteThis();
LAB_008f634b:
  CBaseEntity::AddFlag((CBaseEntity *)this,0x20);
  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)