game_shared/baseplayer_shared.cpp
217218219220221222
// remove this line and call ImpulseCommands instead.
m_nImpulse = 0;
#endif
}
217218219220221222223224225226227
// remove this line and call ImpulseCommands instead.
m_nImpulse = 0;
#endif
// Mirv: Totally disable weapons in spectator mode
if (GetTeamNumber() >= TEAM_BLUE && GetTeamNumber() <= TEAM_GREEN)
if(GetActiveWeapon()) //voogru: crash fix 08/14/2006
GetActiveWeapon()->ItemPostFrame( );
}
275276277278279280281
#ifdef CLIENT_DLL
if ( IsObserver() )
{
if ( m_iObserverMode == OBS_MODE_CHASE )
{
if ( IsLocalPlayer() )
{
280281282283284285286
#ifdef CLIENT_DLL
if ( IsObserver() )
{
if ( GetObserverMode() == OBS_MODE_CHASE )
{
if ( IsLocalPlayer() )
{
413414415416417418419420421422423424425426427428429
float flduck;
int fLadder;
if ( m_flStepSoundTime > 0 )
{
m_flStepSoundTime -= 1000.0f * gpGlobals->frametime;
if ( m_flStepSoundTime < 0 )
{
m_flStepSoundTime = 0;
}
}
if ( m_flStepSoundTime > 0 )
return;
if ( GetFlags() & (FL_FROZEN|FL_ATCONTROLS))
return;
418419420421422423424425426427
float flduck;
int fLadder;
// --> Mirv: Replaced to fix footsteps
if (m_flStepSoundTime > gpGlobals->curtime)
return;
// <-- Mirv
if ( GetFlags() & (FL_FROZEN|FL_ATCONTROLS))
return;
484485486487488489490
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "ladder" ) );
#endif
fvol = 0.5;
m_flStepSoundTime = 350;
}
else if ( enginetrace->GetPointContents( knee ) & MASK_WATER )
{
482483484485486487488
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "ladder" ) );
#endif
fvol = 0.5;
m_flStepSoundTime = gpGlobals->curtime +0.350f; // |-- Mirv: Added gpGlobals->curtime
}
else if ( enginetrace->GetPointContents( knee ) & MASK_WATER )
{
502503504505506507508509510511512513514
}
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "wade" ) );
fvol = 0.65;
m_flStepSoundTime = 600;
}
else if ( enginetrace->GetPointContents( feet ) & MASK_WATER )
{
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "water" ) );
fvol = fWalking ? 0.2 : 0.5;
m_flStepSoundTime = fWalking ? 400 : 300;
}
else
{
500501502503504505506507508509510511512
}
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "wade" ) );
fvol = 0.65;
m_flStepSoundTime = gpGlobals->curtime +0.600f; // |-- Mirv: Added gpGlobals->curtime
}
else if ( enginetrace->GetPointContents( feet ) & MASK_WATER )
{
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "water" ) );
fvol = fWalking ? 0.2 : 0.5;
m_flStepSoundTime = fWalking ? gpGlobals->curtime +0.400f : gpGlobals->curtime +0.300f; // |-- Mirv: Added gpGlobals->curtime
}
else
{
515516517518519520521
if ( !psurface )
return;
m_flStepSoundTime = fWalking ? 400 : 300;
switch ( psurface->game.material )
{
default:
513514515516517518519
if ( !psurface )
return;
m_flStepSoundTime = fWalking ? gpGlobals->curtime +0.400f : gpGlobals->curtime +0.300f; // |-- Mirv: Added gpGlobals->curtime
switch ( psurface->game.material )
{
default:
549550551552553554555
}
}
m_flStepSoundTime += flduck; // slower step time if ducking
// play the sound
// 65% volume if ducking
547548549550551552553
}
}
m_flStepSoundTime += 0.001f * flduck; // slower step time if ducking // |-- Mirv: Added gpGlobals->curtime
// play the sound
// 65% volume if ducking
558559560561562563
fvol *= 0.65;
}
PlayStepSound( feet, psurface, fvol, false );
}
556557558559560561562563564565566567568569570571572573
fvol *= 0.65;
}
// --> Mirv: Redone sound stuff
// If we are walking or ducking, silence
if (GetFlags() & (FL_DUCKING) || m_nButtons & IN_SPEED)
{
fvol = 0;
}
else
{
fvol = 1.0f;
}
PlayStepSound( feet, psurface, fvol, false );
}
113411351136113711381139
//!!!UNDONE: traceline here to prevent +USEing buttons through walls
int caps = pUseEntity->ObjectCaps();
variant_t emptyVariant;
if ( ( (m_nButtons & IN_USE) && (caps & FCAP_CONTINUOUS_USE) ) || ( (m_afButtonPressed & IN_USE) && (caps & (FCAP_IMPULSE_USE|FCAP_ONOFF_USE)) ) )
11441145114611471148114911501151
//!!!UNDONE: traceline here to prevent +USEing buttons through walls
bool bUsed = false;
int caps = pUseEntity->ObjectCaps();
variant_t emptyVariant;
if ( ( (m_nButtons & IN_USE) && (caps & FCAP_CONTINUOUS_USE) ) || ( (m_afButtonPressed & IN_USE) && (caps & (FCAP_IMPULSE_USE|FCAP_ONOFF_USE)) ) )
1146114711481149115011511152115311541155
if ( pUseEntity->ObjectCaps() & FCAP_ONOFF_USE )
{
pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_ON );
}
else
{
pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_TOGGLE );
}
}
// UNDONE: Send different USE codes for ON/OFF. Cache last ONOFF_USE object to send 'off' if you turn away
115811591160116111621163116411651166116711681169
if ( pUseEntity->ObjectCaps() & FCAP_ONOFF_USE )
{
pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_ON );
bUsed = true;
}
else
{
pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_TOGGLE );
bUsed = true;
}
}
// UNDONE: Send different USE codes for ON/OFF. Cache last ONOFF_USE object to send 'off' if you turn away
1156115711581159116011611162
else if ( (m_afButtonReleased & IN_USE) && (pUseEntity->ObjectCaps() & FCAP_ONOFF_USE) ) // BUGBUG This is an "off" use
{
pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_OFF );
}
}
else if ( m_afButtonPressed & IN_USE )
{
1170117111721173117411751176117711781179118011811182118311841185118611871188
else if ( (m_afButtonReleased & IN_USE) && (pUseEntity->ObjectCaps() & FCAP_ONOFF_USE) ) // BUGBUG This is an "off" use
{
pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_OFF );
bUsed = true;
}
if(bUsed)
{
IGameEvent *pEvent = gameeventmanager->CreateEvent("player_use");
if(pEvent)
{
pEvent->SetInt("userid", GetUserID());
pEvent->SetInt("entity", pUseEntity->entindex());
gameeventmanager->FireEvent(pEvent, true);
}
}
}
else if ( m_afButtonPressed & IN_USE )
{
121812191220122112221223
float flCurrentPlayerZ = GetLocalOrigin().z;
float flCurrentPlayerViewOffsetZ = GetViewOffset().z;
// Smooth out stair step ups
// NOTE: Don't want to do this when the ground entity is moving the player
if ( ( pGroundEntity != NULL && pGroundEntity->GetMoveType() == MOVETYPE_NONE ) && ( flCurrentPlayerZ != m_flOldPlayerZ ) && smoothstairs.GetBool() &&
124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
float flCurrentPlayerZ = GetLocalOrigin().z;
float flCurrentPlayerViewOffsetZ = GetViewOffset().z;
// --> Mirv:
// We're now only smoothing stairs if we've recently stepped up or down
// far enough (currently >= 8.0 units). This way the stair smoothing isn't
// affecting ramps
if (!m_bSmoothStair)
{
m_flOldPlayerZ = flCurrentPlayerZ;
}
else
{
// Once we've got close enough to our actual position then stop stair
// smoothing
float flDistance = flCurrentPlayerZ - m_flOldPlayerZ;
if (flDistance < 0.1f && flDistance > -0.1f)
{
m_flOldPlayerZ = flCurrentPlayerZ;
m_bSmoothStair = false;
}
}
// <-- Mirv
// Smooth out stair step ups
// NOTE: Don't want to do this when the ground entity is moving the player
if ( ( pGroundEntity != NULL && pGroundEntity->GetMoveType() == MOVETYPE_NONE ) && ( flCurrentPlayerZ != m_flOldPlayerZ ) && smoothstairs.GetBool() &&