L L4D2node

CBasePlayer::EntSelectSpawnPoint

0x007afa70 · 914 bytes · __thiscall

_ZN11CBasePlayer19EntSelectSpawnPointEv

Decompiled

undefined (1 param)

/* CBasePlayer::EntSelectSpawnPoint() */

CBaseEntity * __thiscall CBasePlayer::EntSelectSpawnPoint(CBasePlayer *this)

{
  int iVar1;
  char *pcVar2;
  byte *pbVar3;
  int *piVar4;
  char cVar5;
  CBaseEntity *pCVar6;
  int iVar7;
  CBaseEntity *pCVar8;
  CBaseEntity *pCVar9;
  CBaseEntity *pCVar10;
  CTakeDamageInfo local_884 [96];
  int local_824 [517];
  
  iVar1 = *(int *)(this + 0x30);
  cVar5 = (**(code **)(*g_pGameRules + 0xd8))(g_pGameRules);
  if (cVar5 == '\0') {
    cVar5 = (**(code **)(*g_pGameRules + 0xd0))(g_pGameRules);
    pCVar6 = g_pLastSpawn;
    if (cVar5 != '\0') {
      iVar7 = (**(code **)(*random_valve + 8))(random_valve,1,5);
      if (0 < iVar7) {
        do {
          pCVar6 = (CBaseEntity *)
                   CGlobalEntityList::FindEntityByClassname
                             ((CGlobalEntityList *)gEntList,pCVar6,"info_player_deathmatch");
          iVar7 = iVar7 + -1;
        } while (iVar7 != 0);
      }
      pCVar8 = pCVar6;
      if (pCVar6 == (CBaseEntity *)0x0) {
        pCVar6 = (CBaseEntity *)
                 CGlobalEntityList::FindEntityByClassname
                           ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,
                            "info_player_deathmatch");
        pCVar8 = pCVar6;
      }
      do {
        if ((pCVar6 != (CBaseEntity *)0x0) &&
           (cVar5 = (**(code **)(*g_pGameRules + 0x124))(g_pGameRules,pCVar6,this), cVar5 != '\0'))
        {
          if (vec3_origin != *(float *)(pCVar6 + 0x39c)) {
            g_pLastSpawn = pCVar6;
            return pCVar6;
          }
          if (DAT_01053d4c != *(float *)(pCVar6 + 0x3a0)) {
            g_pLastSpawn = pCVar6;
            return pCVar6;
          }
          if (DAT_01053d50 != *(float *)(pCVar6 + 0x3a4)) {
            g_pLastSpawn = pCVar6;
            return pCVar6;
          }
        }
        pCVar6 = (CBaseEntity *)
                 CGlobalEntityList::FindEntityByClassname
                           ((CGlobalEntityList *)gEntList,pCVar6,"info_player_deathmatch");
      } while (pCVar8 != pCVar6);
      if (pCVar6 != (CBaseEntity *)0x0) {
        if (((byte)pCVar6[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(pCVar6);
        }
        CEntitySphereQuery::CEntitySphereQuery
                  ((CEntitySphereQuery *)local_824,(Vector *)(pCVar6 + 0x2e0),128.0,0);
        while (pCVar8 = (CBaseEntity *)
                        CEntitySphereQuery::GetCurrentEntity((CEntitySphereQuery *)local_824),
              pCVar8 != (CBaseEntity *)0x0) {
          cVar5 = (**(code **)(*(int *)pCVar8 + 0x16c))(pCVar8);
          if ((cVar5 != '\0') && (iVar1 != *(int *)(pCVar8 + 0x30))) {
            pCVar10 = (CBaseEntity *)0x0;
            pbVar3 = *(byte **)(gpGlobals + 0x58);
            pCVar9 = (CBaseEntity *)0x0;
            if (pbVar3 != (byte *)0x0) {
              if (((*pbVar3 & 2) == 0) && (piVar4 = *(int **)(pbVar3 + 0xc), piVar4 != (int *)0x0))
              {
                pCVar10 = (CBaseEntity *)(**(code **)(*piVar4 + 0x18))(piVar4);
                pbVar3 = *(byte **)(gpGlobals + 0x58);
                pCVar9 = (CBaseEntity *)0x0;
                if (pbVar3 != (byte *)0x0) {
                  if (((*pbVar3 & 2) == 0) &&
                     (piVar4 = *(int **)(pbVar3 + 0xc), piVar4 != (int *)0x0)) {
                    pCVar9 = (CBaseEntity *)(**(code **)(*piVar4 + 0x18))(piVar4);
                  }
                  else {
                    pCVar9 = (CBaseEntity *)0x0;
                  }
                }
              }
              else {
                pCVar10 = (CBaseEntity *)0x0;
                pCVar9 = (CBaseEntity *)0x0;
              }
            }
            CTakeDamageInfo::CTakeDamageInfo(local_884,pCVar9,pCVar10,300.0,0,0);
            CBaseEntity::TakeDamage(pCVar8,local_884);
          }
          local_824[0] = local_824[0] + 1;
        }
        g_pLastSpawn = pCVar6;
        return pCVar6;
      }
    }
  }
  else {
    pCVar6 = (CBaseEntity *)
             CGlobalEntityList::FindEntityByClassname
                       ((CGlobalEntityList *)gEntList,g_pLastSpawn,"info_player_coop");
    if (pCVar6 != (CBaseEntity *)0x0) {
      g_pLastSpawn = pCVar6;
      return pCVar6;
    }
    pCVar6 = (CBaseEntity *)
             CGlobalEntityList::FindEntityByClassname
                       ((CGlobalEntityList *)gEntList,g_pLastSpawn,"info_player_start");
    if (pCVar6 != (CBaseEntity *)0x0) {
      g_pLastSpawn = pCVar6;
      return pCVar6;
    }
  }
  pcVar2 = *(char **)(gpGlobals + 0x44);
  if ((pcVar2 == (char *)0x0) || (*pcVar2 == '\0')) {
    pCVar6 = (CBaseEntity *)FindPlayerStart("info_player_start");
  }
  else {
    pCVar6 = (CBaseEntity *)
             CGlobalEntityList::FindEntityByName
                       ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar2,(CBaseEntity *)0x0,
                        (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
  }
  pCVar8 = pCVar6;
  if (pCVar6 == (CBaseEntity *)0x0) {
    Warning("PutClientInServer: no info_player_start on level\n");
    pbVar3 = *(byte **)(gpGlobals + 0x58);
    if (((pbVar3 == (byte *)0x0) || ((*pbVar3 & 2) != 0)) ||
       (piVar4 = *(int **)(pbVar3 + 0xc), piVar4 == (int *)0x0)) {
      pCVar6 = (CBaseEntity *)0x0;
      pCVar8 = g_pLastSpawn;
    }
    else {
      pCVar6 = (CBaseEntity *)(**(code **)(*piVar4 + 0x18))(piVar4);
      pCVar8 = g_pLastSpawn;
    }
  }
  g_pLastSpawn = pCVar8;
  return pCVar6;
}

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)