L L4D2node

CTerrorGameRules::GetPlayerSpawnSpot

0x00509d10 · 1007 bytes · __thiscall

_ZN16CTerrorGameRules18GetPlayerSpawnSpotEP11CBasePlayer

Decompiled

undefined (2 params)

/* CTerrorGameRules::GetPlayerSpawnSpot(CBasePlayer*) */

undefined4 __thiscall
CTerrorGameRules::GetPlayerSpawnSpot(CTerrorGameRules *this,CBasePlayer *param_1)

{
  CBaseEntity *pCVar1;
  float fVar2;
  float fVar3;
  char cVar4;
  int iVar5;
  int iVar6;
  undefined4 *puVar7;
  CBaseEntity *pCVar8;
  Checkpoint *this_00;
  QAngle *local_80;
  float local_70;
  float local_6c;
  float local_68;
  undefined4 local_64;
  undefined4 local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  float local_48;
  float local_44;
  CBasePlayer *local_40;
  undefined4 local_3c;
  float local_38;
  float local_34;
  float local_30;
  CBaseEntity *local_2c;
  undefined4 local_28;
  CBaseEntity *local_24;
  undefined4 local_20;
  
  local_70 = vec3_angle;
  local_6c = DAT_01053d40;
  local_68 = DAT_01053d44;
  local_64 = vec3_origin;
  local_60 = DAT_01053d4c;
  local_5c = DAT_01053d50;
  iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
  if (iVar5 == 3) {
    if (*(char *)(TheZombieManager + 0x288) != '\0') {
      local_60 = *(undefined4 *)(TheZombieManager + 0x280);
      local_5c = *(float *)(TheZombieManager + 0x284);
      local_64 = *(undefined4 *)(TheZombieManager + 0x27c);
    }
    goto LAB_00509df9;
  }
  if (g_RespawningCheckpoint == (Checkpoint *)0x0) {
    this_00 = (Checkpoint *)TerrorNavMesh::GetInitialCheckpoint(TheNavMesh);
    if (g_ActiveRescue == (CBaseEntity *)0x0) {
      if (this_00 == (Checkpoint *)0x0) {
        GetPlayerSpawnPosition(8,&local_64,&local_70,0);
        goto LAB_00509df9;
      }
      goto LAB_0050a080;
    }
  }
  else {
    this_00 = g_RespawningCheckpoint;
    if (g_ActiveRescue == (CBaseEntity *)0x0) {
LAB_0050a080:
      Checkpoint::GetSpawnPosition
                (this_00,(Vector *)&local_64,(QAngle *)&local_70,(TerrorNavArea **)0x0);
      goto LAB_00509df9;
    }
  }
  pCVar8 = g_ActiveRescue;
  if (((byte)g_ActiveRescue[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(g_ActiveRescue);
  }
  pCVar1 = g_ActiveRescue;
  local_5c = *(float *)(pCVar8 + 0x2e8) + 1.0;
  local_60 = *(undefined4 *)(pCVar8 + 0x2e4);
  local_64 = *(undefined4 *)(pCVar8 + 0x2e0);
  if (((byte)g_ActiveRescue[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(g_ActiveRescue);
  }
  local_70 = *(float *)(pCVar1 + 0x37c);
  local_6c = *(float *)(pCVar1 + 0x380);
  local_68 = *(float *)(pCVar1 + 900);
LAB_00509df9:
  local_80 = (QAngle *)&local_70;
  iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  iVar6 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  iVar5 = iVar5 + 0x18;
  DropToGround((CBaseEntity *)&local_58,(Vector *)param_1,(Vector *)&local_64,
               (Vector *)(iVar6 + 0xc));
  iVar6 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
  if ((iVar6 == 3) && (cVar4 = (**(code **)(*(int *)param_1 + 0x778))(param_1), cVar4 == '\0')) {
    local_40 = param_1;
    local_38 = local_58;
    local_3c = 2;
    local_34 = local_54;
    local_24 = (CBaseEntity *)0x0;
    local_30 = local_50;
    local_2c = (CBaseEntity *)0x0;
    local_20 = 0x4b18967f;
    local_28 = 0x4b18967f;
    ForEachPlayer<TeamScan>((TeamScan *)&local_40);
    pCVar8 = local_2c;
    if ((local_2c != (CBaseEntity *)0x0) || (pCVar8 = local_24, local_24 != (CBaseEntity *)0x0)) {
      if (((byte)pCVar8[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar8);
      }
      local_4c = *(float *)(pCVar8 + 0x2e0) - local_58;
      local_48 = *(float *)(pCVar8 + 0x2e4) - local_54;
      local_44 = *(float *)(pCVar8 + 0x2e8) - local_50;
      VectorAngles((Vector *)&local_4c,local_80);
    }
  }
  (**(code **)(*(int *)param_1 + 0x1dc))
            (param_1,(CBaseEntity *)&local_58,local_80,&vec3_origin,iVar5);
  fVar3 = DAT_01053d44;
  fVar2 = DAT_01053d40;
  if (((vec3_angle != *(float *)(param_1 + 0x1ab0)) ||
      (DAT_01053d40 != *(float *)(param_1 + 0x1ab4))) ||
     (DAT_01053d44 != *(float *)(param_1 + 0x1ab8))) {
    (**(code **)(*(int *)(param_1 + 0x1a40) + 4))(param_1 + 0x1a40,param_1 + 0x1ab0);
    *(float *)(param_1 + 0x1ab0) = vec3_angle;
    *(float *)(param_1 + 0x1ab4) = fVar2;
    *(float *)(param_1 + 0x1ab8) = fVar3;
  }
  local_40 = (CBasePlayer *)0xffffffff;
  puVar7 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
  local_40 = (CBasePlayer *)*puVar7;
  local_3c = *(undefined4 *)(gpGlobals + 0xc);
  CUtlVector<CTerrorGameRules::TeleportedPlayer,CUtlMemory<CTerrorGameRules::TeleportedPlayer,int>>
  ::InsertBefore((CUtlVector<CTerrorGameRules::TeleportedPlayer,CUtlMemory<CTerrorGameRules::TeleportedPlayer,int>>
                  *)(this + 0x378),*(int *)(this + 900),(TeleportedPlayer *)&local_40);
  return 0;
}

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)