mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-06 20:14:44 +00:00
Try fix spawn on nowhere
This commit is contained in:
parent
40f7666c10
commit
76bfbd3cdb
@ -14,7 +14,7 @@ LOCAL_MODULE_FILENAME = libserver_hardfp
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \
|
LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \
|
||||||
-fno-exceptions -DNO_VOICEGAMEMGR -w
|
-fno-exceptions -DNO_VOICEGAMEMGR
|
||||||
|
|
||||||
|
|
||||||
LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -frtti
|
LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -frtti
|
||||||
|
@ -63,9 +63,18 @@ public:
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CBasePlayerStart : public CPointEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// prevent transition as FCAP_ACROSS_TRANSITION does not help
|
||||||
|
virtual int ObjectCaps( void ) { return CPointEntity::ObjectCaps() | FCAP_DONT_SAVE; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
// These are the new entry points to entities.
|
// These are the new entry points to entities.
|
||||||
LINK_ENTITY_TO_CLASS( info_player_deathmatch, CBaseDMStart )
|
LINK_ENTITY_TO_CLASS( info_player_deathmatch, CBaseDMStart )
|
||||||
LINK_ENTITY_TO_CLASS( info_player_start, CPointEntity )
|
LINK_ENTITY_TO_CLASS( info_player_start, CBasePlayerStart )
|
||||||
LINK_ENTITY_TO_CLASS( info_landmark, CPointEntity )
|
LINK_ENTITY_TO_CLASS( info_landmark, CPointEntity )
|
||||||
|
|
||||||
void CBaseDMStart::KeyValue( KeyValueData *pkvd )
|
void CBaseDMStart::KeyValue( KeyValueData *pkvd )
|
||||||
|
@ -1506,27 +1506,31 @@ bool CoopRestorePlayerCoords(CBaseEntity *player, Vector *origin, Vector *angles
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CoopGetSpawnPoint( Vector *point, Vector *angles)
|
bool CoopGetSpawnPoint( Vector *origin, Vector *angles)
|
||||||
{
|
{
|
||||||
if(!g_SavedCoords.valid)
|
if(!g_SavedCoords.valid)
|
||||||
return false;
|
return false;
|
||||||
validateoffset();
|
validateoffset();
|
||||||
*point = g_SavedCoords.triggerorigin + g_SavedCoords.offset;
|
Vector point = g_SavedCoords.triggerorigin + g_SavedCoords.offset;
|
||||||
*angles = g_SavedCoords.triggerangles;
|
*angles = g_SavedCoords.triggerangles;
|
||||||
if( !g_SavedCoords.validspawnpoint )
|
if( !g_SavedCoords.validspawnpoint )
|
||||||
{
|
{
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
Vector angle;
|
Vector angle;
|
||||||
UTIL_MakeVectorsPrivate( *angles, (float*)&angle, NULL, NULL );
|
UTIL_MakeVectorsPrivate( *angles, (float*)&angle, NULL, NULL );
|
||||||
UTIL_TraceHull( *point, *point + angle * 100, missile, human_hull, NULL, &tr );
|
UTIL_TraceHull( point, point + angle * 100, missile, human_hull, NULL, &tr );
|
||||||
if( !tr.fStartSolid )
|
if( !tr.fStartSolid && !tr.fAllSolid )
|
||||||
{
|
{
|
||||||
g_SavedCoords.triggerorigin = tr.vecEndPos;
|
g_SavedCoords.triggerorigin = tr.vecEndPos;
|
||||||
g_SavedCoords.validspawnpoint = true;
|
g_SavedCoords.validspawnpoint = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
g_SavedCoords.valid = false;
|
g_SavedCoords.valid = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
*origin = point;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1546,21 +1550,17 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
|
|||||||
{
|
{
|
||||||
|
|
||||||
m_uTouchCount |= ENTINDEX( pActivator->edict() );
|
m_uTouchCount |= ENTINDEX( pActivator->edict() );
|
||||||
unsigned int count1 = m_uTouchCount;
|
unsigned int count1 = 0;
|
||||||
unsigned int count2 = 0;
|
unsigned int count2 = 0;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
// count set bits
|
|
||||||
count1 = count1 - ((count1 >> 1) & 0x55555555);
|
|
||||||
count1 = (count1 & 0x33333333) + ((count1 >> 2) & 0x33333333);
|
|
||||||
count1 = (((count1 + (count1 >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
|
|
||||||
|
|
||||||
// loop through all clients, count number of players
|
// loop through all clients, count number of players
|
||||||
for( i = 1; i <= gpGlobals->maxClients; i++ )
|
for( i = 1; i <= gpGlobals->maxClients; i++ )
|
||||||
{
|
{
|
||||||
CBaseEntity *plr = UTIL_PlayerByIndex( i );
|
CBaseEntity *plr = UTIL_PlayerByIndex( i );
|
||||||
|
|
||||||
if( plr )
|
// count only players in the transition volume
|
||||||
|
if( plr && InTransitionVolume( plr, m_szLandmarkName ) )
|
||||||
{
|
{
|
||||||
count2++;
|
count2++;
|
||||||
char *ip = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( plr->edict() ), "ip" );
|
char *ip = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( plr->edict() ), "ip" );
|
||||||
@ -1568,6 +1568,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
|
|||||||
// player touched trigger, save it's coordinates
|
// player touched trigger, save it's coordinates
|
||||||
if( m_uTouchCount & (i - 1) )
|
if( m_uTouchCount & (i - 1) )
|
||||||
{
|
{
|
||||||
|
count1++;
|
||||||
strcpy(l_SavedCoords.ip[l_SavedCoords.iCount], ip );
|
strcpy(l_SavedCoords.ip[l_SavedCoords.iCount], ip );
|
||||||
l_SavedCoords.origin[l_SavedCoords.iCount] = plr->pev->origin;
|
l_SavedCoords.origin[l_SavedCoords.iCount] = plr->pev->origin;
|
||||||
l_SavedCoords.angles[l_SavedCoords.iCount] = plr->pev->angles;
|
l_SavedCoords.angles[l_SavedCoords.iCount] = plr->pev->angles;
|
||||||
@ -1594,6 +1595,15 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
|
|||||||
|
|
||||||
if( count1 == 1 && count2 == 2 )
|
if( count1 == 1 && count2 == 2 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// check if it is near spawn point
|
||||||
|
Vector point, angles;
|
||||||
|
if( CoopGetSpawnPoint(&point, &angles ) )
|
||||||
|
if( (VecBModelOrigin(pev) - point).Length() < 200 )
|
||||||
|
// need almost all players agree to go back
|
||||||
|
if( count2 - count1 > 1 )
|
||||||
|
return;
|
||||||
|
|
||||||
g_SavedCoords.triggerangles = pActivator->pev->angles;
|
g_SavedCoords.triggerangles = pActivator->pev->angles;
|
||||||
g_SavedCoords.triggerorigin = pActivator->pev->origin;
|
g_SavedCoords.triggerorigin = pActivator->pev->origin;
|
||||||
g_SavedCoords.valid = true;
|
g_SavedCoords.valid = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user