L L4D2node

SurvivorBot::OnBeginChangeLevel

0x008f6590 · 397 bytes · __thiscall

_ZN11SurvivorBot18OnBeginChangeLevelEPKc

Decompiled

undefined (2 params)

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

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

{
  float fVar1;
  float fVar2;
  float fVar3;
  int iVar4;
  CBaseBackpackItem *this_00;
  undefined4 uVar5;
  KeyValues *local_10;
  
  iVar4 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
  if (((iVar4 == 0) ||
      (this_00 = (CBaseBackpackItem *)
                 __dynamic_cast(iVar4,&CBaseCombatWeapon::typeinfo,&CBaseBackpackItem::typeinfo,0),
      this_00 == (CBaseBackpackItem *)0x0)) || (this_00[0x17dc] == (CBaseBackpackItem)0x0)) {
    iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  }
  else {
    CBaseBackpackItem::CompleteAction(this_00);
    (**(code **)(*(int *)this + 0x470))(this,this_00,0,0);
    UTIL_Remove((CBaseEntity *)this_00);
    iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  }
  if (iVar4 != 2) {
    return;
  }
  CTerrorPlayer::UpdateMissionStats((CTerrorPlayer *)this);
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  fVar1 = *(float *)(this + 0x2e8);
  fVar2 = *(float *)(this + 0x2e4);
  fVar3 = *(float *)(this + 0x2e0);
  uVar5 = CTerrorPlayer::GetClassString((CTerrorPlayer *)this);
  UTIL_LogPrintf("Saving %s for map transition at %.0f,%.0f,%.0f\n",uVar5,(double)fVar3,
                 (double)fVar2,(double)fVar1);
  PlayerSaveData::PlayerSaveData((PlayerSaveData *)&local_10,(CTerrorPlayer *)this,"survivorbot");
                    /* try { // try from 008f66d6 to 008f6703 has its CatchHandler @ 008f672d */
  KeyValues::SetString(local_10,"targetMap",param_1);
  CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>>::InsertBefore
            ((CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>> *)
             &g_SavedSurvivorBots,DAT_0100e504,(SurvivorBotSaveData *)&local_10);
  CBaseEntity::AddFlag((CBaseEntity *)this,0x20);
  KeyValues::deleteThis();
  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)