Raised This Month: $51 Target: $400
 12% 

Decompiling EntSelectSpawnPoint


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-01-2014 , 15:37   Decompiling EntSelectSpawnPoint
Reply With Quote #1

I'm wanted to know how it works this function, it isn't similar to Half-Life's one so i've trying to decode it, but it's just hard

I have this code:

PHP Code:
edict_t *__cdecl EntSelectSpawnPoint(CBasePlayer *argumentPlayer)
{
  
CBaseEntity *var_LoopedEntity// edi@2
  
signed int v2// esi@3
  
signed int v3// esi@10
  
signed int var_NotFoundVIPSpawn_Check// esi@20
  
signed int v5// esi@30
  
CBaseEntity *v6// eax@44
  
CBasePlayer *v7// esi@44
  
int v8// ecx@45
  
__int16 v9// fps@47
  
long double v10// fst6@47
  
bool v11// c0@47
  
char v12// c2@47
  
bool v13// c3@47
  
CBaseEntity *v14// eax@51
  
signed int v15// esi@53
  
CBaseEntity *l// esi@59
  
edict_t *v17// eax@62
  
int v18// edx@62
  
edict_t *v19// eax@64
  
int v20// edx@64
  
signed int v21// esi@72
  
CBaseEntity *v22// eax@86
  
CBasePlayer *v23// esi@86
  
int v24// ecx@87
  
__int16 v25// fps@89
  
long double v26// fst6@89
  
bool v27// c0@89
  
char v28// c2@89
  
bool v29// c3@89
  
CBaseEntity *v30// eax@93
  
signed int v31// esi@95
  
CBaseEntity *j// esi@101
  
edict_t *v33// eax@104
  
int v34// edx@104
  
edict_t *v35// eax@106
  
int v36// edx@106
  
string_t var_Globals_startspot// edx@111
  
const char *v38// ecx@112
  
int v39// eax@112
  
int v40// edx@112
  
int v41// edx@121
  
CBaseEntity *v42// eax@129
  
signed int var_NotFoundSelectedSpawn_Check// esi@135
  
int v44// ST1C_4@141
  
edict_t *return_SelectedSpawnEntity// eax@141
  
int *var_LastSpawnEntityPointer// eax@143
  
int v47// [sp-18h] [bp-80h]@64
  
int v48// [sp-18h] [bp-80h]@106
  
CBaseEntity *k// [sp-10h] [bp-78h]@40
  
CBaseEntity *i// [sp-10h] [bp-78h]@82
  
const Vector *v51// [sp-Ch] [bp-74h]@40
  
const char *v52// [sp-Ch] [bp-74h]@49
  
const Vector *var_LoopedEntityOriginVector// [sp-Ch] [bp-74h]@82
  
const char *v54// [sp-Ch] [bp-74h]@91
  
float v55// [sp-8h] [bp-70h]@0
  
float v56// [sp-8h] [bp-70h]@40
  
float var_CheckRadiusFloat// [sp-8h] [bp-70h]@82
  
int v58// [sp-4h] [bp-6Ch]@0
  
signed int var_NotFoundSelectedSpawn// [sp+28h] [bp-40h]@134
  
_vt_CBaseEntity *v60// [sp+2Ch] [bp-3Ch]@104
  
signed int v61// [sp+30h] [bp-38h]@94
  
CBaseEntity *v62// [sp+34h] [bp-34h]@79
  
signed int v63// [sp+38h] [bp-30h]@71
  
_vt_CBaseEntity *v64// [sp+3Ch] [bp-2Ch]@62
  
signed int v65// [sp+40h] [bp-28h]@52
  
CBaseEntity *v66// [sp+44h] [bp-24h]@37
  
signed int v67// [sp+48h] [bp-20h]@29
  
signed int var_NotFoundVIPSpawn// [sp+4Ch] [bp-1Ch]@19
  
signed int v69// [sp+50h] [bp-18h]@9
  
signed int v70// [sp+54h] [bp-14h]@2
  
edict_t *argumentPlayer_ContainingEntity// [sp+58h] [bp-10h]@1

  
argumentPlayer_ContainingEntity argumentPlayer->pev->pContainingEntity;
  if ( !
g_pGameRules->vtbl->CHalfLifeMultiplay__IsCoOp(g_pGameRules) )
  {
    if ( 
g_pGameRules->vtbl->CHalfLifeMultiplay__IsDeathmatch(g_pGameRules) && argumentPlayer->m_bIsVip == )
    {
      
var_LoopedEntity UTIL_FindEntityByClassname(0"info_vip_start");
      
var_NotFoundVIPSpawn 0;
      if ( !
var_LoopedEntity )
        goto 
LABEL_148;
      
var_NotFoundVIPSpawn_Check 0;
      if ( !
var_LoopedEntity->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(var_LoopedEntity->pev->pContainingEntity) )
        
var_NotFoundVIPSpawn_Check 1;
      if ( 
var_NotFoundVIPSpawn_Check )
LABEL_148:
        
var_NotFoundVIPSpawn 1;
      if ( !
var_NotFoundVIPSpawn )
        goto 
LABEL_134;
    }
    else
    {
      if ( !
g_pGameRules->vtbl->CHalfLifeMultiplay__IsDeathmatch(g_pGameRules) || argumentPlayer->m_iTeam != )
      {
        if ( 
g_pGameRules->vtbl->CHalfLifeMultiplay__IsDeathmatch(g_pGameRules) && argumentPlayer->m_iTeam == )
        {
          
var_LoopedEntity UTIL_FindEntityByClassname((CBaseEntity *)g_pLastTerroristSpawn"info_player_deathmatch");
          
v63 0;
          if ( !
var_LoopedEntity )
            goto 
LABEL_149;
          
v21 0;
          if ( !
var_LoopedEntity->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(var_LoopedEntity->pev->pContainingEntity) )
            
v21 1;
          if ( 
v21 )
LABEL_149:
            
v63 1;
          if ( 
v63 )
            
var_LoopedEntity UTIL_FindEntityByClassname(var_LoopedEntity"info_player_deathmatch");
          
v62 var_LoopedEntity;
          do
          {
            if ( 
var_LoopedEntity && var_LoopedEntity->vtable->CBaseEntity__IsTriggered(var_LoopedEntity, (CBaseEntity *)argumentPlayer) )
            {
              
var_CheckRadiusFloat 64.0;
              
var_LoopedEntityOriginVector = (const Vector *)var_LoopedEntity->pev->origin;
              for ( 
0; ; = (CBaseEntity *)v23 )
              {
                
v22 UTIL_FindEntityInSphere(ivar_LoopedEntityOriginVectorv55);
                
v23 = (CBasePlayer *)v22;
                if ( !
v22 )
                  break;
                if ( 
v22->vtable->CBaseEntity__IsPlayer(v22) && v23 != argumentPlayer )
                  goto 
LABEL_92;
                
var_CheckRadiusFloat 64.0;
                
var_LoopedEntityOriginVector = (const Vector *)var_LoopedEntity->pev->origin;
              }
              
v24 0;
              if ( 
var_LoopedEntity->pev->origin[0] != 0.0 && var_LoopedEntity->pev->origin[1] != 0.0 )
              {
                
v26 var_LoopedEntity->pev->origin[2];
                
UNDEF(v25);
                
v27 v26 0.0;
                
v28 0;
                
v29 v26 == 0.0;
                
v24 = (HIBYTE(v25) & 0x45) == 64;
              }
              if ( !
v24 )
                goto 
LABEL_134;
              
v54 "info_player_deathmatch";
            }
            else
            {
LABEL_92:
              
v54 "info_player_deathmatch";
            }
            
v30 UTIL_FindEntityByClassname(var_LoopedEntityv54);
            
var_LoopedEntity v30;
          }
          while ( 
v30 != v62 );
          
v61 0;
          if ( !
v30 )
            goto 
LABEL_150;
          
v31 0;
          if ( !
v30->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(v30->pev->pContainingEntity) )
            
v31 1;
          if ( 
v31 )
LABEL_150:
            
v61 1;
          if ( !
v61 )
          {
            for ( 
UTIL_FindEntityInSphere(0, (const Vector *)var_LoopedEntity->pev->origin64.0);
                  
j;
                  
UTIL_FindEntityInSphere(j, (const Vector *)var_LoopedEntity->pev->origin64.0) )
            {
              if ( 
j->vtable->CBaseEntity__IsPlayer(j) && j->pev->pContainingEntity != argumentPlayer_ContainingEntity )
              {
                
v60 j->vtable;
                
v33 g_engfuncs.pfnPEntityOfEntIndex(0);
                
v34 0;
                if ( 
v33 )
                  
v34 = (int)&v33->v;
                
v48 v34;
                
v35 g_engfuncs.pfnPEntityOfEntIndex(0);
                
v36 0;
                if ( 
v35 )
                  
v36 = (int)&v35->v;
                ((
void (__cdecl *)(_DWORD_DWORD_DWORD_DWORD_DWORD))v60->CBaseEntity__TakeDamage)(
                  
j,
                  (
entvars_s *)v36,
                  (
entvars_s *)v48,
                  
200.0,
                  
0);
              }
            }
            goto 
LABEL_134;
          }
        }
LABEL_111:
        
var_Globals_startspot gpGlobals->startspot;
        if ( !
var_Globals_startspot )
          goto 
LABEL_129;
        
v38 = &gpGlobals->pStringBase[var_Globals_startspot];
        
v39 = (int)&gpGlobals->pStringBase[var_Globals_startspot];
        
v40 = ((_BYTE)var_Globals_startspot LOBYTE(gpGlobals->pStringBase)) & 3;
        if ( !
v40 )
          goto 
LABEL_121;
        if ( !
__SETP__(v400) )
        {
          if ( 
v40 != )
          {
            if ( *
v38 == BYTE1(v40) )
              goto 
LABEL_128;
            
v39 = (int)(v38 1);
          }
          if ( *(
_BYTE *)v39 == BYTE1(v40) )
          {
LABEL_128:
            if ( (const 
char *)v39 != v38 )
            {
              
v42 UTIL_FindEntityByTargetname(0v38);
              goto 
LABEL_131;
            }
LABEL_129:
            
v42 UTIL_FindEntityByClassname(0"info_player_deathmatch");
LABEL_131:
            
var_LoopedEntity v42;
            if ( 
v42 && v42->pev->pContainingEntity )
              
g_engfuncs.pfnEntOffsetOfPEntity(v42->pev->pContainingEntity);
            goto 
LABEL_134;
          }
          ++
v39;
        }
        if ( *(
_BYTE *)v39 != BYTE1(v40) )
        {
          ++
v39;
LABEL_121:
          while ( 
)
          {
            
v41 = *(_DWORD *)v39;
            if ( !(
unsigned __int8)*(_DWORD *)v39 )
              break;
            if ( !
BYTE1(v41) )
              goto 
LABEL_127;
            if ( !(
v41 0xFF0000) )
              goto 
LABEL_126;
            
v39 += 4;
            if ( !(
v41 0xFF000000) )
            {
              
v39 -= 3;
LABEL_126:
              ++
v39;
LABEL_127:
              ++
v39;
              goto 
LABEL_128;
            }
          }
        }
        goto 
LABEL_128;
      }
    }
    
var_LoopedEntity UTIL_FindEntityByClassname((CBaseEntity *)g_pLastCTSpawn"info_player_start");
    
v67 0;
    if ( !
var_LoopedEntity )
      goto 
LABEL_151;
    
v5 0;
    if ( !
var_LoopedEntity->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(var_LoopedEntity->pev->pContainingEntity) )
      
v5 1;
    if ( 
v5 )
LABEL_151:
      
v67 1;
    if ( 
v67 )
      
var_LoopedEntity UTIL_FindEntityByClassname(var_LoopedEntity"info_player_start");
    
v66 var_LoopedEntity;
    do
    {
      if ( 
var_LoopedEntity && var_LoopedEntity->vtable->CBaseEntity__IsTriggered(var_LoopedEntity, (CBaseEntity *)argumentPlayer) )
      {
        
v56 64.0;
        
v51 = (const Vector *)var_LoopedEntity->pev->origin;
        for ( 
0; ; = (CBaseEntity *)v7 )
        {
          
v6 UTIL_FindEntityInSphere(kv51v55);
          
v7 = (CBasePlayer *)v6;
          if ( !
v6 )
            break;
          if ( 
v6->vtable->CBaseEntity__IsPlayer(v6) && v7 != argumentPlayer )
            goto 
LABEL_50;
          
v56 64.0;
          
v51 = (const Vector *)var_LoopedEntity->pev->origin;
        }
        
v8 0;
        if ( 
var_LoopedEntity->pev->origin[0] != 0.0 && var_LoopedEntity->pev->origin[1] != 0.0 )
        {
          
v10 var_LoopedEntity->pev->origin[2];
          
UNDEF(v9);
          
v11 v10 0.0;
          
v12 0;
          
v13 v10 == 0.0;
          
v8 = (HIBYTE(v9) & 0x45) == 64;
        }
        if ( !
v8 )
          goto 
LABEL_134;
        
v52 "info_player_start";
      }
      else
      {
LABEL_50:
        
v52 "info_player_start";
      }
      
v14 UTIL_FindEntityByClassname(var_LoopedEntityv52);
      
var_LoopedEntity v14;
    }
    while ( 
v14 != v66 );
    
v65 0;
    if ( !
v14 )
      goto 
LABEL_152;
    
v15 0;
    if ( !
v14->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(v14->pev->pContainingEntity) )
      
v15 1;
    if ( 
v15 )
LABEL_152:
      
v65 1;
    if ( !
v65 )
    {
      for ( 
UTIL_FindEntityInSphere(0, (const Vector *)var_LoopedEntity->pev->origin64.0);
            
l;
            
UTIL_FindEntityInSphere(l, (const Vector *)var_LoopedEntity->pev->origin64.0) )
      {
        if ( 
l->vtable->CBaseEntity__IsPlayer(l) && l->pev->pContainingEntity != argumentPlayer_ContainingEntity )
        {
          
v64 l->vtable;
          
v17 g_engfuncs.pfnPEntityOfEntIndex(0);
          
v18 0;
          if ( 
v17 )
            
v18 = (int)&v17->v;
          
v47 v18;
          
v19 g_engfuncs.pfnPEntityOfEntIndex(0);
          
v20 0;
          if ( 
v19 )
            
v20 = (int)&v19->v;
          ((
void (__cdecl *)(_DWORD_DWORD_DWORD_DWORD_DWORD))v64->CBaseEntity__TakeDamage)(
            
l,
            (
entvars_s *)v20,
            (
entvars_s *)v47,
            
200.0,
            
0);
        }
      }
      goto 
LABEL_134;
    }
    goto 
LABEL_111;
  }
  
var_LoopedEntity UTIL_FindEntityByClassname((CBaseEntity *)g_pLastSpawn"info_player_coop");
  
v70 0;
  if ( !
var_LoopedEntity )
    goto 
LABEL_153;
  
v2 0;
  if ( !
var_LoopedEntity->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(var_LoopedEntity->pev->pContainingEntity) )
    
v2 1;
  if ( 
v2 )
LABEL_153:
    
v70 1;
  if ( 
v70 )
  {
    
var_LoopedEntity UTIL_FindEntityByClassname((CBaseEntity *)g_pLastSpawn"info_player_start");
    
v69 0;
    if ( !
var_LoopedEntity )
      goto 
LABEL_154;
    
v3 0;
    if ( !
var_LoopedEntity->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(var_LoopedEntity->pev->pContainingEntity) )
      
v3 1;
    if ( 
v3 )
LABEL_154:
      
v69 1;
    if ( 
v69 )
      goto 
LABEL_111;
  }
LABEL_134:
  
var_NotFoundSelectedSpawn 0;
  if ( !
var_LoopedEntity )
    goto 
LABEL_155;
  
var_NotFoundSelectedSpawn_Check 0;
  if ( !
var_LoopedEntity->pev->pContainingEntity || !g_engfuncs.pfnEntOffsetOfPEntity(var_LoopedEntity->pev->pContainingEntity) )
    
var_NotFoundSelectedSpawn_Check 1;
  if ( 
var_NotFoundSelectedSpawn_Check )
LABEL_155:
    
var_NotFoundSelectedSpawn 1;
  if ( 
var_NotFoundSelectedSpawn )
  {
    ((
void (__cdecl *)(signed int_DWORD))g_engfuncs.pfnAlertMessage)(
      
4,
      
"PutClientInServer: no info_player_start on level");
    
return_SelectedSpawnEntity = (edict_t *)((int (__stdcall *)(_DWORDint_DWORDint))g_engfuncs.pfnPEntityOfEntIndex)(
                          
0,
                          
v44,
                          
LODWORD(v55),
                          
v58);
  }
  else
  {
    if ( 
argumentPlayer->m_iTeam == )
      
var_LastSpawnEntityPointer = &g_pLastTerroristSpawn;
    else
      
var_LastSpawnEntityPointer = &g_pLastCTSpawn;
      
    *
var_LastSpawnEntityPointer = (int)var_LoopedEntity;
    
return_SelectedSpawnEntity var_LoopedEntity->pev->pContainingEntity;
  }
  return 
return_SelectedSpawnEntity;

Can anybody fix it?

EDIT: Nevermind, I did a partially compiled code with help of HLSDK and patient, now at least know how it works.

PHP Code:
edict_t *EntSelectSpawnPointCBaseEntity *pPlayer )
{
    
playerEdict pPlayer->edict()
    
    if ( 
g_pGameRules->IsCoOp() )
    {
    
// not needed [...]
    
}

    if ( 
g_pGameRules->IsDeathmatch() && pPlayer->m_bIsVip == )
    {
        
pSpot UTIL_FindEntityByClassname(0"info_vip_start");
        
        if ( !
FNullEnt(pSpot) )
            goto 
ReturnSpot;
          
        
CheckCTSpawn:
        
        
pSpot UTIL_FindEntityByClassname(g_pLastCTSpawn"info_player_start");
        
        if ( 
FNullEnt(pSpot) )
        {
            
pSpot UTIL_FindEntityByClassname(pSpot"info_player_start");
        }
        
        
pFirstSpot pSpot;
        do 
        {
            if ( 
pSpot )
            {
                
// check if pSpot is valid
                
if ( IsSpawnPointValidpPlayerpSpot ) )
                {
                    if ( 
pSpot->pev->origin == Vector00) )
                    {
                        
pSpot UTIL_FindEntityByClassnamepSpot"info_player_start" );
                        continue;
                    }

                    
// if so, go to pSpot
                    
goto ReturnSpot;
                }
            }
            
            
// increment pSpot
            
pSpot UTIL_FindEntityByClassnamepSpot"info_player_start" );
        } 
        while ( 
pSpot != pFirstSpot ); // loop if we're not back to the start
        
        
if ( !FNullEnt(pSpot) )
        {
            while ( (
UTIL_FindEntityInSphereipSpot->pev->origin64.0 )) != NULL )
            {
                if ( 
i->IsPlayer() && i->edict() != playerEdict )
                {
                    
i->TakeDamage(INDEXENT(0), INDEXENT(0), 200.0DMG_GENERIC);
                }
            }
            goto 
ReturnSpot;
        }

        goto 
CheckGlobalSpot;
    }
    
    if ( 
g_pGameRules->IsDeathmatch() && pPlayer->m_iTeam == )
        goto 
CheckCTSpawn;
        
    if ( 
g_pGameRules->IsDeathmatch() && pPlayer->m_iTeam == )
    {
        
pSpot UTIL_FindEntityByClassname(g_pLastTerroristSpawn"info_player_deathmatch");;
        if ( 
FNullEnt(pSpot) )
        {
            
pSpot UTIL_FindEntityByClassname(pSpot"info_player_deathmatch");
        }

        
pFirstSpot pSpot;

        do 
        {
            if ( 
pSpot )
            {
                
// check if pSpot is valid
                
if ( IsSpawnPointValidpPlayerpSpot ) )
                {
                    if ( 
pSpot->pev->origin == Vector00) )
                    {
                        
pSpot UTIL_FindEntityByClassnamepSpot"info_player_deathmatch" );
                        continue;
                    }

                    
// if so, go to pSpot
                    
goto ReturnSpot;
                }
            }
            
// increment pSpot
            
pSpot UTIL_FindEntityByClassnamepSpot"info_player_deathmatch" );
        } 
        while ( 
pSpot != pFirstSpot ); // loop if we're not back to the start

        
if ( !FNullEnt(pSpot) )
        {
            while ( (
UTIL_FindEntityInSpherejpSpot->pev->origin64.0 )) != NULL )
            {
                if ( 
j->IsPlayer() && j->edict() != playerEdict )
                {
                    
j->TakeDamage(INDEXENT(0), INDEXENT(0), 200.0DMG_GENERIC);
                }
            }
            goto 
ReturnSpot;
        }
    }
    
    
CheckGlobalSpot:
    if ( !
FStringNullgpGlobals->startspot ) && strlen(STRING(gpGlobals->startspot))))
    {
        
pSpot UTIL_FindEntityByTargetnameNULLSTRING(gpGlobals->startspot) );
        
        if ( !
FNullEnt(pSpot) )
            goto 
ReturnSpot;
            
        
SendError:
        
ALERT(4"PutClientInServer: no info_player_start on level");
        return 
INDEXENT(0);
    }

    
pSpot UTIL_FindEntityByClassname(0"info_player_deathmatch");
        
    
ReturnSpot:
    
    if ( 
FNullEnt(pSpot) )
        goto 
SendError;

    if ( 
pPlayer->m_iTeam == )
    {
        
g_pLastTerroristSpawn pSpot;
        
result pSpot->edict();
    }
    else
    {
        
g_pLastCTSpawn pSpot;
        
result pSpot->edict();
    }

    return 
result;

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross

Last edited by meTaLiCroSS; 01-02-2014 at 00:10.
meTaLiCroSS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-02-2014 , 16:07   Re: Decompiling EntSelectSpawnPoint
Reply With Quote #2

I can't check because very busy ; but I found this in my uncommitted files :

PHP Code:
edict_t *EntSelectSpawnPoint(CBaseEntity *pPlayer)
{
    
CBaseEntity *pSpot;
    
edict_t *player pPlayer->edict();

    if (
g_pGameRules->IsCoOp())
    {
        
pSpot UTIL_FindEntityByClassname(g_pLastSpawn"info_player_coop");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;

        
pSpot UTIL_FindEntityByClassname(g_pLastSpawn"info_player_start");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_bIsVIP == true)
    {
        
pSpot UTIL_FindEntityByClassname(NULL"info_vip_start");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;

        goto 
CTSpawn;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_iTeam == CT)
    {
CTSpawn:
        
pSpot g_pLastCTSpawn;

        if (
SelectSpawnSpot(pPlayer"info_player_start"pSpot))
            goto 
ReturnSpot;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_iTeam == TERRORIST)
    {
        
pSpot g_pLastTerroristSpawn;

        if (
SelectSpawnSpot(pPlayer"info_player_deathmatch"pSpot))
            goto 
ReturnSpot;
    }

    if (
FStringNull(gpGlobals->startspot) || !strlen(STRING(gpGlobals->startspot)))
    {
        
pSpot UTIL_FindEntityByClassname(NULL"info_player_deathmatch");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }
    else
    {
        
pSpot UTIL_FindEntityByTargetname(NULLSTRING(gpGlobals->startspot));

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }

ReturnSpot:
    if (
FNullEnt(pSpot))
    {
        
ALERT(at_error"PutClientInServer: no info_player_start on level");
        return 
INDEXENT(0);
    }

    if (((
CBasePlayer *)pPlayer)->m_iTeam == TERRORIST)
        
g_pLastTerroristSpawn pSpot;
    else
        
g_pLastCTSpawn pSpot;

    return 
pSpot->edict();

__________________

Last edited by Arkshine; 01-02-2014 at 16:09.
Arkshine is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-02-2014 , 16:38   Re: Decompiling EntSelectSpawnPoint
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
I can't check because very busy ; but I found this in my uncommitted files :

PHP Code:
edict_t *EntSelectSpawnPoint(CBaseEntity *pPlayer)
{
    
CBaseEntity *pSpot;
    
edict_t *player pPlayer->edict();

    if (
g_pGameRules->IsCoOp())
    {
        
pSpot UTIL_FindEntityByClassname(g_pLastSpawn"info_player_coop");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;

        
pSpot UTIL_FindEntityByClassname(g_pLastSpawn"info_player_start");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_bIsVIP == true)
    {
        
pSpot UTIL_FindEntityByClassname(NULL"info_vip_start");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;

        goto 
CTSpawn;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_iTeam == CT)
    {
CTSpawn:
        
pSpot g_pLastCTSpawn;

        if (
SelectSpawnSpot(pPlayer"info_player_start"pSpot))
            goto 
ReturnSpot;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_iTeam == TERRORIST)
    {
        
pSpot g_pLastTerroristSpawn;

        if (
SelectSpawnSpot(pPlayer"info_player_deathmatch"pSpot))
            goto 
ReturnSpot;
    }

    if (
FStringNull(gpGlobals->startspot) || !strlen(STRING(gpGlobals->startspot)))
    {
        
pSpot UTIL_FindEntityByClassname(NULL"info_player_deathmatch");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }
    else
    {
        
pSpot UTIL_FindEntityByTargetname(NULLSTRING(gpGlobals->startspot));

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }

ReturnSpot:
    if (
FNullEnt(pSpot))
    {
        
ALERT(at_error"PutClientInServer: no info_player_start on level");
        return 
INDEXENT(0);
    }

    if (((
CBasePlayer *)pPlayer)->m_iTeam == TERRORIST)
        
g_pLastTerroristSpawn pSpot;
    else
        
g_pLastCTSpawn pSpot;

    return 
pSpot->edict();

Nearly the same, thanks buddy!
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Kuma77
Senior Member
Join Date: Sep 2014
Location: Behind PC
Old 09-29-2014 , 06:27   Re: Decompiling EntSelectSpawnPoint
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
I can't check because very busy ; but I found this in my uncommitted files :

PHP Code:
edict_t *EntSelectSpawnPoint(CBaseEntity *pPlayer)
{
    
CBaseEntity *pSpot;
    
edict_t *player pPlayer->edict();

    if (
g_pGameRules->IsCoOp())
    {
        
pSpot UTIL_FindEntityByClassname(g_pLastSpawn"info_player_coop");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;

        
pSpot UTIL_FindEntityByClassname(g_pLastSpawn"info_player_start");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_bIsVIP == true)
    {
        
pSpot UTIL_FindEntityByClassname(NULL"info_vip_start");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;

        goto 
CTSpawn;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_iTeam == CT)
    {
CTSpawn:
        
pSpot g_pLastCTSpawn;

        if (
SelectSpawnSpot(pPlayer"info_player_start"pSpot))
            goto 
ReturnSpot;
    }
    else if (
g_pGameRules->IsDeathmatch() && ((CBasePlayer *)pPlayer)->m_iTeam == TERRORIST)
    {
        
pSpot g_pLastTerroristSpawn;

        if (
SelectSpawnSpot(pPlayer"info_player_deathmatch"pSpot))
            goto 
ReturnSpot;
    }

    if (
FStringNull(gpGlobals->startspot) || !strlen(STRING(gpGlobals->startspot)))
    {
        
pSpot UTIL_FindEntityByClassname(NULL"info_player_deathmatch");

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }
    else
    {
        
pSpot UTIL_FindEntityByTargetname(NULLSTRING(gpGlobals->startspot));

        if (!
FNullEnt(pSpot))
            goto 
ReturnSpot;
    }

ReturnSpot:
    if (
FNullEnt(pSpot))
    {
        
ALERT(at_error"PutClientInServer: no info_player_start on level");
        return 
INDEXENT(0);
    }

    if (((
CBasePlayer *)pPlayer)->m_iTeam == TERRORIST)
        
g_pLastTerroristSpawn pSpot;
    else
        
g_pLastCTSpawn pSpot;

    return 
pSpot->edict();

i can use red & blue teams ?
__________________
SPACE TIME

Last edited by Kuma77; 09-29-2014 at 06:58. Reason: words
Kuma77 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:15.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode