diff --git a/dlls/game.cpp b/dlls/game.cpp index f94b8a0a..8a12355b 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -54,6 +54,9 @@ cvar_t mp_coop = { "mp_coop", "0", FCVAR_SERVER }; cvar_t mp_coop_changelevel = { "mp_coop_changelevel", "0", FCVAR_SERVER }; cvar_t mp_coop_nofriendlyfire = { "mp_coop_nofriendlyfire", "0", FCVAR_SERVER }; cvar_t mp_coop_disabledmap = { "mp_coop_disabledmap", "", FCVAR_SERVER }; +cvar_t mp_unduck = { "mp_unduck", "0", FCVAR_SERVER }; +cvar_t mp_semclip = { "mp_semclip", "0", FCVAR_SERVER }; + // Engine Cvars cvar_t *g_psv_gravity = NULL; cvar_t *g_psv_aim = NULL; @@ -499,6 +502,8 @@ void GameDLLInit( void ) CVAR_REGISTER( &mp_coop_changelevel ); CVAR_REGISTER( &mp_coop_nofriendlyfire ); CVAR_REGISTER( &mp_coop_disabledmap ); + CVAR_REGISTER( &mp_unduck ); + CVAR_REGISTER( &mp_semclip ); CVAR_REGISTER( &mp_chattime ); diff --git a/dlls/game.h b/dlls/game.h index f257b27c..8bea381d 100644 --- a/dlls/game.h +++ b/dlls/game.h @@ -52,6 +52,9 @@ extern cvar_t mp_coop; extern cvar_t mp_coop_changelevel; extern cvar_t mp_coop_nofriendlyfire; extern cvar_t mp_coop_disabledmap; +extern cvar_t mp_unduck; +extern cvar_t mp_semclip; +extern bool g_fSavedDuck; // Engine Cvars extern cvar_t *g_psv_gravity; diff --git a/dlls/gamerules.cpp b/dlls/gamerules.cpp index cca9e4dd..07a01066 100644 --- a/dlls/gamerules.cpp +++ b/dlls/gamerules.cpp @@ -69,7 +69,7 @@ Vector FixupSpawnPoint(Vector spawn) { Vector point = spawn + Vector( 0, 0, 36 * i ); TraceResult tr; - UTIL_TraceHull( point, point, ignore_monsters, 1, NULL, &tr ); + UTIL_TraceHull( point, point, ignore_monsters, (mp_unduck.value&&g_fSavedDuck)?head_hull:human_hull, NULL, &tr ); if( !tr.fStartSolid && !tr.fAllSolid ) return point; i = -i; @@ -98,6 +98,8 @@ edict_t *CGameRules::GetPlayerSpawnSpot( CBasePlayer *pPlayer ) CoopGetSpawnPoint( &pPlayer->pev->origin, &pPlayer->pev->angles ); pPlayer->pev->fixangle = TRUE; pPlayer->pev->origin = FixupSpawnPoint( pPlayer->pev->origin ); + if( g_fSavedDuck ) + pPlayer->pev->flags |= FL_DUCKING; return pentSpawnSpot; } diff --git a/dlls/player.cpp b/dlls/player.cpp index d43db7c4..ae03617c 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1849,6 +1849,35 @@ void CBasePlayer::PreThink( void ) { pev->velocity = g_vecZero; } + + if( mp_unduck.value ) + { + if( (pev->button & IN_DUCK) && !(pev->button & IN_JUMP) ) + { + TraceResult tr; + UTIL_TraceHull( pev->origin, pev->origin, ignore_monsters, human_hull, edict(), &tr ); + if( tr.fStartSolid ) + { + pev->view_ofs.z = 12; + pev->flags |= FL_DUCKING; + FixPlayerCrouchStuck(edict()); + UTIL_SetSize( pev, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX ); + } + } + } + + if( mp_semclip.value ) + { + 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_TRIGGER; + } + } + } } /* Time based Damage works as follows: 1) There are several types of timebased damage: @@ -2418,6 +2447,20 @@ void CBasePlayer::PostThink() if( !IsAlive() ) goto pt_end; + if( mp_semclip.value ) + { + for( int i = 1; i < gpGlobals->maxClients; i++ ) + { + CBaseEntity *plr = UTIL_PlayerByIndex( i ); + + if( plr && plr->pev->solid == SOLID_TRIGGER && plr->IsPlayer() ) + { + plr->pev->solid = SOLID_SLIDEBOX; + UTIL_SetOrigin(pev, pev->origin); + } + } + } + // Handle Tank controlling if( m_pTank != NULL ) { @@ -2690,7 +2733,7 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) if( !FStrEq( STRING( pSpot->pev->netname ), STRING( gpGlobals->mapname ) ) ) continue; // check if it is placed in wall - UTIL_TraceHull( pSpot->pev->origin, pSpot->pev->origin , missile, human_hull, NULL, &tr ); + UTIL_TraceHull( pSpot->pev->origin, pSpot->pev->origin , missile, (mp_unduck.value&&g_fSavedDuck)?head_hull:human_hull, NULL, &tr ); if( tr.fStartSolid || tr.fAllSolid ) continue; // trace down to find if there is no floor diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 351751c6..70da4ef6 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1496,14 +1496,21 @@ struct SavedCoords Vector trainoffset; char trainglobal[256]; } g_SavedCoords; + + void CoopClearData( void ) { // nullify SavedCoords l_SavedCoords = {}; g_SavedCoords = l_SavedCoords; } + int g_iMenu; + void ShowMenu( CBasePlayer *pPlayer, const char *title, int count, const char **slot, signed char time = -1 ); + +bool g_fSavedDuck; + // Show to all spawned players: voting, etc.. class GlobalMenu { @@ -1741,7 +1748,8 @@ bool CoopRestorePlayerCoords(CBaseEntity *player, Vector *origin, Vector *angles TraceResult tr; Vector point = g_SavedCoords.origin[i] + g_SavedCoords.offset; - UTIL_TraceHull( point, point, missile, human_hull, NULL, &tr ); + UTIL_TraceHull( point, point, missile, (mp_unduck.value&&g_fSavedDuck)?head_hull:human_hull, NULL, &tr ); + g_SavedCoords.ip[i][0] = 0; if( tr.fStartSolid || tr.fAllSolid ) @@ -1783,7 +1791,11 @@ bool CoopGetSpawnPoint( Vector *origin, Vector *angles) point = point + g_SavedCoords.offset; //UTIL_TraceHull( point, point, ignore_monsters, human_hull, NULL, &tr ); - UTIL_TraceHull( point, point + angle * 100, missile, human_hull, NULL, &tr ); + if( mp_unduck.value ) + UTIL_TraceHull( point, point + angle * 100, missile, head_hull, NULL, &tr ); + else + UTIL_TraceHull( point, point + angle * 100, missile, human_hull, NULL, &tr ); + if( !tr.fStartSolid && !tr.fAllSolid ) { g_SavedCoords.triggerorigin = tr.vecEndPos; @@ -1973,12 +1985,14 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) } else { + g_fSavedDuck = false; // Get current player's coordinated if( pActivator && pActivator->IsPlayer() ) { l_SavedCoords.triggerangles = pActivator->pev->angles; l_SavedCoords.triggerorigin = pActivator->pev->origin; l_SavedCoords.valid = true; + g_fSavedDuck = !!(pActivator->pev->flags & FL_DUCKING); } }