Rework semclip

This commit is contained in:
mittorn 2016-10-21 08:03:12 +03:00
parent e466cc3ab9
commit 5478318232
3 changed files with 34 additions and 5 deletions

View File

@ -1544,7 +1544,7 @@ void FixPlayerCrouchStuck( edict_t *pPlayer )
// Move up as many as 18 pixels if the player is stuck.
for( int i = 0; i < 18; i++ )
{
UTIL_TraceHull( pPlayer->v.origin, pPlayer->v.origin, dont_ignore_monsters, head_hull, pPlayer, &trace );
UTIL_TraceHull( pPlayer->v.origin, pPlayer->v.origin, missile, head_hull, pPlayer, &trace );
if( trace.fStartSolid )
pPlayer->v.origin.z++;
else
@ -1725,7 +1725,7 @@ void CBasePlayer::UpdateStatusBar()
#define CLIMB_SPEED_DEC 15 // climbing deceleration rate
#define CLIMB_PUNCH_X -7 // how far to 'punch' client X axis when climbing
#define CLIMB_PUNCH_Z 7 // how far to 'punch' client Z axis when climbing
float g_flSemclipTime;
void CBasePlayer::PreThink( void )
{
int buttonsChanged = ( m_afButtonLast ^ pev->button ); // These buttons have changed this frame
@ -1866,6 +1866,24 @@ void CBasePlayer::PreThink( void )
}
}
// keep semclip 0.5 seconds
if( mp_semclip.value && (gpGlobals->time - g_flSemclipTime < 0.5 ) )
{
for( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseEntity *plr = UTIL_PlayerByIndex( i );
if( plr && plr->pev->solid == SOLID_SLIDEBOX && plr->IsPlayer() )
{
plr->pev->solid = SOLID_NOT;
}
}
}
}
void CBasePlayer::Touch( CBaseEntity *pOther )
{
if( pOther && pOther->IsPlayer() )
if( mp_semclip.value )
{
for( int i = 1; i <= gpGlobals->maxClients; i++ )
@ -1874,9 +1892,10 @@ void CBasePlayer::PreThink( void )
if( plr && plr->pev->solid == SOLID_SLIDEBOX && plr->IsPlayer() )
{
plr->pev->solid = SOLID_TRIGGER;
plr->pev->solid = SOLID_NOT;
}
}
g_flSemclipTime = gpGlobals->time;
}
}
/* Time based Damage works as follows:
@ -2453,10 +2472,10 @@ void CBasePlayer::PostThink()
{
CBaseEntity *plr = UTIL_PlayerByIndex( i );
if( plr && plr->pev->solid == SOLID_TRIGGER && plr->IsPlayer() )
if( plr && plr->pev->solid == SOLID_NOT && plr->IsPlayer() )
{
plr->pev->solid = SOLID_SLIDEBOX;
UTIL_SetOrigin(pev, pev->origin);
UTIL_SetOrigin(plr->pev, plr->pev->origin);
}
}
}
@ -2862,6 +2881,7 @@ void CBasePlayer::Spawn( void )
m_flSpawnTime = gpGlobals->time;
g_pGameRules->PlayerSpawn( this );
g_flSemclipTime = 0;
}
void CBasePlayer::Precache( void )

View File

@ -323,6 +323,7 @@ public:
float m_flSpawnTime;
PlayerState m_state;
bool m_fTouchMenu;
virtual void Touch( CBaseEntity *pOther );
};
#define AUTOAIM_2DEGREES 0.0348994967025

View File

@ -1548,6 +1548,11 @@ public:
if( imenu == 1 ) // confirm
{
m_iConfirm++;
MESSAGE_BEGIN( MSG_ALL, 8, NULL ); // svc_print
WRITE_BYTE( 3 ); // PRINT_CHAT
WRITE_STRING( UTIL_VarArgs( "%s^7 confirmed map change\n", ( pPlayer->pev->netname && STRING( pPlayer->pev->netname )[0] != 0 ) ? STRING( pPlayer->pev->netname ) : "unconnected"));
MESSAGE_END();
}
if( imenu == 2 ) // cancel
{
@ -2140,6 +2145,9 @@ int CChangeLevel::InTransitionVolume( CBaseEntity *pEntity, char *pVolumeName )
{
edict_t *pentVolume;
if( !pEntity )
return 0;
if( pEntity->ObjectCaps() & FCAP_FORCE_TRANSITION )
return 1;