Compare commits

..

No commits in common. "dev" and "master" have entirely different histories.
dev ... master

42 changed files with 210 additions and 2575 deletions

24
.gitignore vendored
View File

@ -19,12 +19,6 @@ ipch
*.idb
*.vcxproj
*.sln
*.lib
# Visual studio config dirs
.vs/*
mp/src/.vs/*
sp/src/.vs/*
# OSX/Linux build products
*.mak
@ -60,21 +54,3 @@ config.cfg
# shader files
*.tmp
sp/game/mod_hl2/cfg/server_blacklist.txt
*.cache
*.pdb
*.db
sp/game/mod_hl2/GameState.txt
sp/game/mod_hl2/maps/graphs/sdk_vehicles.ain
sp/game/mod_hl2/stats.txt
sp/game/mod_hl2/voice_ban.dt
*.vcxproj.FileListAbsolute.txt
*.vpc_crc
*.sentinel
*.filters
#game directories
sp/game/*
mp/game/*

View File

@ -1,3 +0,0 @@
{
"CurrentProjectSetting": "No Configurations"
}

View File

@ -19,7 +19,7 @@
#include <KeyValues.h>
#include "hltvcamera.h"
#ifdef TF_CLIENT_DLL
#include "tf_weaponbase.h"
#include "tf_weaponbase.h"
#endif
#if defined( REPLAY_ENABLED )
@ -35,39 +35,39 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//#ifdef CSTRIKE_DLL
ConVar cl_righthand("cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models.");
//#endif
#ifdef TF_CLIENT_DLL
ConVar cl_flipviewmodels("cl_flipviewmodels", "0", FCVAR_USERINFO | FCVAR_ARCHIVE | FCVAR_NOT_CONNECTED, "Flip view models.");
#ifdef CSTRIKE_DLL
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." );
#endif
void PostToolMessage(HTOOLHANDLE hEntity, KeyValues* msg);
#ifdef TF_CLIENT_DLL
ConVar cl_flipviewmodels( "cl_flipviewmodels", "0", FCVAR_USERINFO | FCVAR_ARCHIVE | FCVAR_NOT_CONNECTED, "Flip view models." );
#endif
void FormatViewModelAttachment(Vector& vOrigin, bool bInverse)
void PostToolMessage( HTOOLHANDLE hEntity, KeyValues *msg );
void FormatViewModelAttachment( Vector &vOrigin, bool bInverse )
{
// Presumably, SetUpView has been called so we know our FOV and render origin.
const CViewSetup* pViewSetup = view->GetPlayerViewSetup();
float worldx = tan(pViewSetup->fov * M_PI / 360.0);
float viewx = tan(pViewSetup->fovViewmodel * M_PI / 360.0);
const CViewSetup *pViewSetup = view->GetPlayerViewSetup();
float worldx = tan( pViewSetup->fov * M_PI/360.0 );
float viewx = tan( pViewSetup->fovViewmodel * M_PI/360.0 );
// aspect ratio cancels out, so only need one factor
// the difference between the screen coordinates of the 2 systems is the ratio
// of the coefficients of the projection matrices (tan (fov/2) is that coefficient)
// NOTE: viewx was coming in as 0 when folks set their viewmodel_fov to 0 and show their weapon.
float factorX = viewx ? (worldx / viewx) : 0.0f;
float factorX = viewx ? ( worldx / viewx ) : 0.0f;
float factorY = factorX;
// Get the coordinates in the viewer's space.
Vector tmp = vOrigin - pViewSetup->origin;
Vector vTransformed(MainViewRight().Dot(tmp), MainViewUp().Dot(tmp), MainViewForward().Dot(tmp));
Vector vTransformed( MainViewRight().Dot( tmp ), MainViewUp().Dot( tmp ), MainViewForward().Dot( tmp ) );
// Now squash X and Y.
if (bInverse)
if ( bInverse )
{
if (factorX != 0 && factorY != 0)
if ( factorX != 0 && factorY != 0 )
{
vTransformed.x /= factorX;
vTransformed.y /= factorY;
@ -92,12 +92,12 @@ void FormatViewModelAttachment(Vector& vOrigin, bool bInverse)
}
void C_BaseViewModel::FormatViewModelAttachment(int nAttachment, matrix3x4_t& attachmentToWorld)
void C_BaseViewModel::FormatViewModelAttachment( int nAttachment, matrix3x4_t &attachmentToWorld )
{
Vector vecOrigin;
MatrixPosition(attachmentToWorld, vecOrigin);
::FormatViewModelAttachment(vecOrigin, false);
PositionMatrix(vecOrigin, attachmentToWorld);
MatrixPosition( attachmentToWorld, vecOrigin );
::FormatViewModelAttachment( vecOrigin, false );
PositionMatrix( vecOrigin, attachmentToWorld );
}
@ -106,110 +106,110 @@ bool C_BaseViewModel::IsViewModel() const
return true;
}
void C_BaseViewModel::UncorrectViewModelAttachment(Vector& vOrigin)
void C_BaseViewModel::UncorrectViewModelAttachment( Vector &vOrigin )
{
// Unformat the attachment.
::FormatViewModelAttachment(vOrigin, true);
::FormatViewModelAttachment( vOrigin, true );
}
//-----------------------------------------------------------------------------
// Purpose
//-----------------------------------------------------------------------------
void C_BaseViewModel::FireEvent(const Vector& origin, const QAngle& angles, int event, const char* options)
void C_BaseViewModel::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
{
// We override sound requests so that we can play them locally on the owning player
if ((event == AE_CL_PLAYSOUND) || (event == CL_EVENT_SOUND))
if ( ( event == AE_CL_PLAYSOUND ) || ( event == CL_EVENT_SOUND ) )
{
// Only do this if we're owned by someone
if (GetOwner() != NULL)
if ( GetOwner() != NULL )
{
CLocalPlayerFilter filter;
EmitSound(filter, GetOwner()->GetSoundSourceIndex(), options, &GetAbsOrigin());
EmitSound( filter, GetOwner()->GetSoundSourceIndex(), options, &GetAbsOrigin() );
return;
}
}
// Otherwise pass the event to our associated weapon
C_BaseCombatWeapon* pWeapon = GetActiveWeapon();
if (pWeapon)
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
if ( pWeapon )
{
// NVNT notify the haptics system of our viewmodel's event
if (haptics)
haptics->ProcessHapticEvent(4, "Weapons", pWeapon->GetName(), "AnimationEvents", VarArgs("%i", event));
if ( haptics )
haptics->ProcessHapticEvent(4,"Weapons",pWeapon->GetName(),"AnimationEvents",VarArgs("%i",event));
bool bResult = pWeapon->OnFireEvent(this, origin, angles, event, options);
if (!bResult)
bool bResult = pWeapon->OnFireEvent( this, origin, angles, event, options );
if ( !bResult )
{
BaseClass::FireEvent(origin, angles, event, options);
BaseClass::FireEvent( origin, angles, event, options );
}
}
}
bool C_BaseViewModel::Interpolate(float currentTime)
bool C_BaseViewModel::Interpolate( float currentTime )
{
CStudioHdr* pStudioHdr = GetModelPtr();
CStudioHdr *pStudioHdr = GetModelPtr();
// Make sure we reset our animation information if we've switch sequences
UpdateAnimationParity();
bool bret = BaseClass::Interpolate(currentTime);
bool bret = BaseClass::Interpolate( currentTime );
// Hack to extrapolate cycle counter for view model
float elapsed_time = currentTime - m_flAnimTime;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
// Predicted viewmodels have fixed up interval
if (GetPredictable() || IsClientCreated())
if ( GetPredictable() || IsClientCreated() )
{
Assert(pPlayer);
Assert( pPlayer );
float curtime = pPlayer ? pPlayer->GetFinalPredictedTime() : gpGlobals->curtime;
elapsed_time = curtime - m_flAnimTime;
// Adjust for interpolated partial frame
if (!engine->IsPaused())
if ( !engine->IsPaused() )
{
elapsed_time += (gpGlobals->interpolation_amount * TICK_INTERVAL);
elapsed_time += ( gpGlobals->interpolation_amount * TICK_INTERVAL );
}
}
// Prediction errors?
if (elapsed_time < 0)
if ( elapsed_time < 0 )
{
elapsed_time = 0;
}
float dt = elapsed_time * GetSequenceCycleRate(pStudioHdr, GetSequence()) * GetPlaybackRate();
if (dt >= 1.0f)
float dt = elapsed_time * GetSequenceCycleRate( pStudioHdr, GetSequence() ) * GetPlaybackRate();
if ( dt >= 1.0f )
{
if (!IsSequenceLooping(GetSequence()))
if ( !IsSequenceLooping( GetSequence() ) )
{
dt = 0.999f;
}
else
{
dt = fmod(dt, 1.0f);
dt = fmod( dt, 1.0f );
}
}
SetCycle(dt);
SetCycle( dt );
return bret;
}
bool C_BaseViewModel::ShouldFlipViewModel()
{
//#ifdef CSTRIKE_DLL
// If cl_righthand is set, then we want them all right-handed.
CBaseCombatWeapon* pWeapon = m_hWeapon.Get();
if (pWeapon)
#ifdef CSTRIKE_DLL
// If cl_righthand is set, then we want them all right-handed.
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
if ( pWeapon )
{
const FileWeaponInfo_t* pInfo = &pWeapon->GetWpnData();
const FileWeaponInfo_t *pInfo = &pWeapon->GetWpnData();
return pInfo->m_bAllowFlipping && pInfo->m_bBuiltRightHanded != cl_righthand.GetBool();
}
//#endif
#endif
#ifdef TF_CLIENT_DLL
CBaseCombatWeapon* pWeapon = m_hWeapon.Get();
if (pWeapon)
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
if ( pWeapon )
{
return pWeapon->m_bFlipViewModel != cl_flipviewmodels.GetBool();
}
@ -219,24 +219,24 @@ bool C_BaseViewModel::ShouldFlipViewModel()
}
void C_BaseViewModel::ApplyBoneMatrixTransform(matrix3x4_t& transform)
void C_BaseViewModel::ApplyBoneMatrixTransform( matrix3x4_t& transform )
{
if (ShouldFlipViewModel())
if ( ShouldFlipViewModel() )
{
matrix3x4_t viewMatrix, viewMatrixInverse;
// We could get MATERIAL_VIEW here, but this is called sometimes before the renderer
// has set that matrix. Luckily, this is called AFTER the CViewSetup has been initialized.
const CViewSetup* pSetup = view->GetPlayerViewSetup();
AngleMatrix(pSetup->angles, pSetup->origin, viewMatrixInverse);
MatrixInvert(viewMatrixInverse, viewMatrix);
const CViewSetup *pSetup = view->GetPlayerViewSetup();
AngleMatrix( pSetup->angles, pSetup->origin, viewMatrixInverse );
MatrixInvert( viewMatrixInverse, viewMatrix );
// Transform into view space.
matrix3x4_t temp, temp2;
ConcatTransforms(viewMatrix, transform, temp);
ConcatTransforms( viewMatrix, transform, temp );
// Flip it along X.
// (This is the slower way to do it, and it equates to negating the top row).
//matrix3x4_t mScale;
//SetIdentityMatrix( mScale );
@ -250,7 +250,7 @@ void C_BaseViewModel::ApplyBoneMatrixTransform(matrix3x4_t& transform)
temp[1][3] = -temp[1][3];
// Transform back out of view space.
ConcatTransforms(viewMatrixInverse, temp, transform);
ConcatTransforms( viewMatrixInverse, temp, transform );
}
}
@ -259,16 +259,16 @@ void C_BaseViewModel::ApplyBoneMatrixTransform(matrix3x4_t& transform)
//-----------------------------------------------------------------------------
bool C_BaseViewModel::ShouldDraw()
{
if (engine->IsHLTV())
if ( engine->IsHLTV() )
{
return (HLTVCamera()->GetMode() == OBS_MODE_IN_EYE &&
HLTVCamera()->GetPrimaryTarget() == GetOwner());
return ( HLTVCamera()->GetMode() == OBS_MODE_IN_EYE &&
HLTVCamera()->GetPrimaryTarget() == GetOwner() );
}
#if defined( REPLAY_ENABLED )
else if (g_pEngineClientReplay->IsPlayingReplayDemo())
else if ( g_pEngineClientReplay->IsPlayingReplayDemo() )
{
return (ReplayCamera()->GetMode() == OBS_MODE_IN_EYE &&
ReplayCamera()->GetPrimaryTarget() == GetOwner());
return ( ReplayCamera()->GetMode() == OBS_MODE_IN_EYE &&
ReplayCamera()->GetPrimaryTarget() == GetOwner() );
}
#endif
else
@ -281,66 +281,66 @@ bool C_BaseViewModel::ShouldDraw()
// Purpose: Render the weapon. Draw the Viewmodel if the weapon's being carried
// by this player, otherwise draw the worldmodel.
//-----------------------------------------------------------------------------
int C_BaseViewModel::DrawModel(int flags)
int C_BaseViewModel::DrawModel( int flags )
{
if (!m_bReadyToDraw)
if ( !m_bReadyToDraw )
return 0;
if (flags & STUDIO_RENDER)
if ( flags & STUDIO_RENDER )
{
// Determine blending amount and tell engine
float blend = (float)(GetFxBlend() / 255.0f);
float blend = (float)( GetFxBlend() / 255.0f );
// Totally gone
if (blend <= 0.0f)
if ( blend <= 0.0f )
return 0;
// Tell engine
render->SetBlend(blend);
render->SetBlend( blend );
float color[3];
GetColorModulation(color);
render->SetColorModulation(color);
GetColorModulation( color );
render->SetColorModulation( color );
}
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
C_BaseCombatWeapon* pWeapon = GetOwningWeapon();
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
int ret;
// If the local player's overriding the viewmodel rendering, let him do it
if (pPlayer && pPlayer->IsOverridingViewmodel())
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
{
ret = pPlayer->DrawOverriddenViewmodel(this, flags);
ret = pPlayer->DrawOverriddenViewmodel( this, flags );
}
else if (pWeapon && pWeapon->IsOverridingViewmodel())
else if ( pWeapon && pWeapon->IsOverridingViewmodel() )
{
ret = pWeapon->DrawOverriddenViewmodel(this, flags);
ret = pWeapon->DrawOverriddenViewmodel( this, flags );
}
else
{
ret = BaseClass::DrawModel(flags);
ret = BaseClass::DrawModel( flags );
}
// Now that we've rendered, reset the animation restart flag
if (flags & STUDIO_RENDER)
if ( flags & STUDIO_RENDER )
{
if (m_nOldAnimationParity != m_nAnimationParity)
if ( m_nOldAnimationParity != m_nAnimationParity )
{
m_nOldAnimationParity = m_nAnimationParity;
}
// Tell the weapon itself that we've rendered, in case it wants to do something
if (pWeapon)
if ( pWeapon )
{
pWeapon->ViewModelDrawn(this);
pWeapon->ViewModelDrawn( this );
}
}
#ifdef TF_CLIENT_DLL
CTFWeaponBase* pTFWeapon = dynamic_cast<CTFWeaponBase*>(pWeapon);
if ((flags & STUDIO_RENDER) && pTFWeapon && pTFWeapon->m_viewmodelStatTrakAddon)
CTFWeaponBase* pTFWeapon = dynamic_cast<CTFWeaponBase*>( pWeapon );
if ( ( flags & STUDIO_RENDER ) && pTFWeapon && pTFWeapon->m_viewmodelStatTrakAddon )
{
pTFWeapon->m_viewmodelStatTrakAddon->RemoveEffects(EF_NODRAW);
pTFWeapon->m_viewmodelStatTrakAddon->DrawModel(flags);
pTFWeapon->m_viewmodelStatTrakAddon->AddEffects(EF_NODRAW);
pTFWeapon->m_viewmodelStatTrakAddon->RemoveEffects( EF_NODRAW );
pTFWeapon->m_viewmodelStatTrakAddon->DrawModel( flags );
pTFWeapon->m_viewmodelStatTrakAddon->AddEffects( EF_NODRAW );
}
#endif
@ -350,15 +350,15 @@ int C_BaseViewModel::DrawModel(int flags)
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int C_BaseViewModel::InternalDrawModel(int flags)
int C_BaseViewModel::InternalDrawModel( int flags )
{
CMatRenderContextPtr pRenderContext(materials);
if (ShouldFlipViewModel())
pRenderContext->CullMode(MATERIAL_CULLMODE_CW);
CMatRenderContextPtr pRenderContext( materials );
if ( ShouldFlipViewModel() )
pRenderContext->CullMode( MATERIAL_CULLMODE_CW );
int ret = BaseClass::InternalDrawModel(flags);
int ret = BaseClass::InternalDrawModel( flags );
pRenderContext->CullMode(MATERIAL_CULLMODE_CCW);
pRenderContext->CullMode( MATERIAL_CULLMODE_CCW );
return ret;
}
@ -366,27 +366,27 @@ int C_BaseViewModel::InternalDrawModel(int flags)
//-----------------------------------------------------------------------------
// Purpose: Called by the player when the player's overriding the viewmodel drawing. Avoids infinite recursion.
//-----------------------------------------------------------------------------
int C_BaseViewModel::DrawOverriddenViewmodel(int flags)
int C_BaseViewModel::DrawOverriddenViewmodel( int flags )
{
return BaseClass::DrawModel(flags);
return BaseClass::DrawModel( flags );
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : int
//-----------------------------------------------------------------------------
int C_BaseViewModel::GetFxBlend(void)
int C_BaseViewModel::GetFxBlend( void )
{
// See if the local player wants to override the viewmodel's rendering
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if (pPlayer && pPlayer->IsOverridingViewmodel())
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
{
pPlayer->ComputeFxBlend();
return pPlayer->GetFxBlend();
}
C_BaseCombatWeapon* pWeapon = GetOwningWeapon();
if (pWeapon && pWeapon->IsOverridingViewmodel())
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
if ( pWeapon && pWeapon->IsOverridingViewmodel() )
{
pWeapon->ComputeFxBlend();
return pWeapon->GetFxBlend();
@ -399,17 +399,17 @@ int C_BaseViewModel::GetFxBlend(void)
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool C_BaseViewModel::IsTransparent(void)
bool C_BaseViewModel::IsTransparent( void )
{
// See if the local player wants to override the viewmodel's rendering
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if (pPlayer && pPlayer->IsOverridingViewmodel())
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
{
return pPlayer->ViewModel_IsTransparent();
}
C_BaseCombatWeapon* pWeapon = GetOwningWeapon();
if (pWeapon && pWeapon->IsOverridingViewmodel())
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
if ( pWeapon && pWeapon->IsOverridingViewmodel() )
return pWeapon->ViewModel_IsTransparent();
return BaseClass::IsTransparent();
@ -418,17 +418,17 @@ bool C_BaseViewModel::IsTransparent(void)
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool C_BaseViewModel::UsesPowerOfTwoFrameBufferTexture(void)
bool C_BaseViewModel::UsesPowerOfTwoFrameBufferTexture( void )
{
// See if the local player wants to override the viewmodel's rendering
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if (pPlayer && pPlayer->IsOverridingViewmodel())
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
{
return pPlayer->ViewModel_IsUsingFBTexture();
}
C_BaseCombatWeapon* pWeapon = GetOwningWeapon();
if (pWeapon && pWeapon->IsOverridingViewmodel())
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
if ( pWeapon && pWeapon->IsOverridingViewmodel() )
{
return pWeapon->ViewModel_IsUsingFBTexture();
}
@ -439,20 +439,20 @@ bool C_BaseViewModel::UsesPowerOfTwoFrameBufferTexture(void)
//-----------------------------------------------------------------------------
// Purpose: If the animation parity of the weapon has changed, we reset cycle to avoid popping
//-----------------------------------------------------------------------------
void C_BaseViewModel::UpdateAnimationParity(void)
void C_BaseViewModel::UpdateAnimationParity( void )
{
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
// If we're predicting, then we don't use animation parity because we change the animations on the clientside
// while predicting. When not predicting, only the server changes the animations, so a parity mismatch
// tells us if we need to reset the animation.
if (m_nOldAnimationParity != m_nAnimationParity && !GetPredictable())
if ( m_nOldAnimationParity != m_nAnimationParity && !GetPredictable() )
{
float curtime = (pPlayer && IsIntermediateDataAllocated()) ? pPlayer->GetFinalPredictedTime() : gpGlobals->curtime;
// FIXME: this is bad
// Simulate a networked m_flAnimTime and m_flCycle
// FIXME: Do we need the magic 0.1?
SetCycle(0.0f); // GetSequenceCycleRate( GetSequence() ) * 0.1;
SetCycle( 0.0f ); // GetSequenceCycleRate( GetSequence() ) * 0.1;
m_flAnimTime = curtime;
}
}
@ -461,26 +461,26 @@ void C_BaseViewModel::UpdateAnimationParity(void)
// Purpose: Update global map state based on data received
// Input : bnewentity -
//-----------------------------------------------------------------------------
void C_BaseViewModel::OnDataChanged(DataUpdateType_t updateType)
void C_BaseViewModel::OnDataChanged( DataUpdateType_t updateType )
{
SetPredictionEligible(true);
SetPredictionEligible( true );
BaseClass::OnDataChanged(updateType);
}
void C_BaseViewModel::PostDataUpdate(DataUpdateType_t updateType)
void C_BaseViewModel::PostDataUpdate( DataUpdateType_t updateType )
{
BaseClass::PostDataUpdate(updateType);
OnLatchInterpolatedVariables(LATCH_ANIMATION_VAR);
OnLatchInterpolatedVariables( LATCH_ANIMATION_VAR );
}
//-----------------------------------------------------------------------------
// Purpose: Add entity to visible view models list
//-----------------------------------------------------------------------------
void C_BaseViewModel::AddEntity(void)
void C_BaseViewModel::AddEntity( void )
{
// Server says don't interpolate this frame, so set previous info to new info.
if (IsNoInterpolationFrame())
if ( IsNoInterpolationFrame() )
{
ResetLatched();
}
@ -491,13 +491,13 @@ void C_BaseViewModel::AddEntity(void)
//-----------------------------------------------------------------------------
void C_BaseViewModel::GetBoneControllers(float controllers[MAXSTUDIOBONECTRLS])
{
BaseClass::GetBoneControllers(controllers);
BaseClass::GetBoneControllers( controllers );
// Tell the weapon itself that we've rendered, in case it wants to do something
C_BaseCombatWeapon* pWeapon = GetActiveWeapon();
if (pWeapon)
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
if ( pWeapon )
{
pWeapon->GetViewmodelBoneControllers(this, controllers);
pWeapon->GetViewmodelBoneControllers( this, controllers );
}
}

View File

@ -19,7 +19,7 @@
extern bool g_bRollingCredits;
ConVar fov_desired( "fov_desired", "75", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 140.0 );
ConVar fov_desired( "fov_desired", "75", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 90.0 );
//-----------------------------------------------------------------------------
// Globals

View File

@ -1,83 +0,0 @@
#include "cbase.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define ITEM_ROTATION_RATE ( 360.0f / 4.0f )
#define PICKUP_MIN_HEIGHT 50
//-----------------------------------------------------------------------------
// Rotating health kit. Heals the player when picked up.
//-----------------------------------------------------------------------------
class C_RotatingPickup : public C_BaseAnimating
{
DECLARE_CLASS(C_RotatingPickup, C_BaseAnimating);
DECLARE_CLIENTCLASS();
public:
C_RotatingPickup() {
ClientRotAng = QAngle(0, 0, 0);
ClientPosVector = Vector(0, 0, 0);
m_bRespawning = m_bRespawning_Cache = false;
}
void Spawn() { ClientThink(); }
bool IsRespawning();
void ClientThink();
void PostDataUpdate(DataUpdateType_t updateType);
bool ShouldDraw();
bool m_bRespawning;
bool m_bRespawning_Cache;
private:
QAngle ClientRotAng; // m_angRotation is stomped sometimes (CItem returning the ent to spawn position?)
Vector ClientPosVector;
};
LINK_ENTITY_TO_CLASS(item_rotating, C_RotatingPickup);
IMPLEMENT_CLIENTCLASS_DT(C_RotatingPickup, DT_RotatingPickup, CRotatingPickup)
RecvPropBool(RECVINFO(m_bRespawning)),
END_RECV_TABLE()
inline bool C_RotatingPickup::IsRespawning()
{
return m_bRespawning;
}
void C_RotatingPickup::ClientThink()
{
if (IsAbsQueriesValid())
{
if (ClientPosVector.x == 0 && ClientPosVector.y == 0 && ClientPosVector.z == 0) {
ClientPosVector = GetAbsOrigin();
}
// Rotate
ClientRotAng.x = 0;
ClientRotAng.y += ITEM_ROTATION_RATE * gpGlobals->frametime;
if (ClientRotAng.y >= 360)
ClientRotAng.y -= 360;
Vector vUp = Vector(0, 0, 1);
SetAbsOrigin(ClientPosVector + 5*sin(2*gpGlobals->curtime)*vUp);
SetAbsAngles(ClientRotAng);
}
SetNextClientThink(CLIENT_THINK_ALWAYS);
}
void C_RotatingPickup::PostDataUpdate(DataUpdateType_t updateType)
{
if (m_bRespawning_Cache != m_bRespawning)
{
// Appear/disappear
UpdateVisibility();
ClientRotAng.y = 0;
m_bRespawning_Cache = m_bRespawning;
}
return BaseClass::PostDataUpdate(updateType);
}
bool C_RotatingPickup::ShouldDraw()
{
return !IsRespawning() && BaseClass::ShouldDraw();
}

View File

@ -1,170 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
//
// Health.cpp
//
// implementation of CHudArmor class
//
#include "cbase.h"
#include "hud.h"
#include "hud_macros.h"
#include "view.h"
#include "iclientmode.h"
#include <KeyValues.h>
#include <vgui/ISurface.h>
#include <vgui/ISystem.h>
#include <vgui_controls/AnimationController.h>
#include <vgui/ILocalize.h>
using namespace vgui;
#include "hudelement.h"
#include "hud_numericdisplay.h"
#include "convar.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define INIT_HEALTH -1
//-----------------------------------------------------------------------------
// Purpose: Health panel
//-----------------------------------------------------------------------------
class CHudArmor : public CHudElement, public CHudNumericDisplay
{
DECLARE_CLASS_SIMPLE(CHudArmor, CHudNumericDisplay);
public:
CHudArmor(const char* pElementName);
virtual void Init(void);
virtual void VidInit(void);
virtual void Reset(void);
virtual void OnThink();
void MsgFunc_Damage(bf_read& msg);
private:
// old variables
int m_iHealth;
int m_bitsDamage;
};
DECLARE_HUDELEMENT(CHudArmor);
DECLARE_HUD_MESSAGE(CHudArmor, Damage);
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CHudArmor::CHudArmor(const char* pElementName) : CHudElement(pElementName), CHudNumericDisplay(NULL, "HudHealth")
{
SetHiddenBits(HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudArmor::Init()
{
HOOK_HUD_MESSAGE(CHudArmor, Damage);
Reset();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudArmor::Reset()
{
m_iHealth = INIT_HEALTH;
m_bitsDamage = 0;
wchar_t* tempString = g_pVGuiLocalize->Find("#Valve_Hud_ARMOR");
if (tempString)
{
SetLabelText(tempString);
}
else
{
SetLabelText(L"ARMOR");
}
SetDisplayValue(m_iHealth);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudArmor::VidInit()
{
Reset();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudArmor::OnThink()
{
int newHealth = 0;
C_BasePlayer* local = C_BasePlayer::GetLocalPlayer();
if (local)
{
// Never below zero
newHealth = MAX(local->GetHealth(), 0);
}
// Only update the fade if we've changed health
if (newHealth == m_iHealth)
{
return;
}
m_iHealth = newHealth;
if (m_iHealth >= 20)
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthIncreasedAbove20");
}
else if (m_iHealth > 0)
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthIncreasedBelow20");
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthLow");
}
SetDisplayValue(m_iHealth);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudArmor::MsgFunc_Damage(bf_read& msg)
{
int armor = msg.ReadByte(); // armor
int damageTaken = msg.ReadByte(); // health
long bitsDamage = msg.ReadLong(); // damage bits
bitsDamage; // variable still sent but not used
Vector vecFrom;
vecFrom.x = msg.ReadBitCoord();
vecFrom.y = msg.ReadBitCoord();
vecFrom.z = msg.ReadBitCoord();
// Actually took damage?
if (damageTaken > 0 || armor > 0)
{
if (damageTaken > 0)
{
// start the animation
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthDamageTaken");
}
}
}

View File

@ -112,7 +112,7 @@ static ConVar v_centerspeed( "v_centerspeed","500" );
// and motions look the most natural.
ConVar v_viewmodel_fov( "viewmodel_fov", "54", FCVAR_ARCHIVE, "Sets the field-of-view for the viewmodel.", true, 0.1, true, 179.9 );
#else
ConVar v_viewmodel_fov( "viewmodel_fov", "68", FCVAR_ARCHIVE, "Sets the field-of-view for the viewmodel.", true, 0.1, true, 179.9 );
ConVar v_viewmodel_fov( "viewmodel_fov", "54", FCVAR_CHEAT, "Sets the field-of-view for the viewmodel.", true, 0.1, true, 179.9 );
#endif
ConVar mat_viewportscale( "mat_viewportscale", "1.0", FCVAR_ARCHIVE, "Scale down the main viewport (to reduce GPU impact on CPU profiling)", true, (1.0f / 640.0f), true, 1.0f );
ConVar mat_viewportupscale( "mat_viewportupscale", "1", FCVAR_ARCHIVE, "Scale the viewport back up" );
@ -1125,13 +1125,11 @@ void CViewRender::Render( vrect_t *rect )
static ConVarRef sv_restrict_aspect_ratio_fov( "sv_restrict_aspect_ratio_fov" );
float aspectRatio = engine->GetScreenAspectRatio() * 0.75f; // / (4/3)
float limitedAspectRatio = aspectRatio;
if ( ( sv_restrict_aspect_ratio_fov.GetInt() > 0 && engine->IsWindowedMode() && gpGlobals->maxClients > 1 ) ||
sv_restrict_aspect_ratio_fov.GetInt() == 2 )
{
limitedAspectRatio = MIN( aspectRatio, 1.85f * 1.75f ); // cap out the FOV advantage at a 1.85:1 ratio (about the widest any legit user should be)
limitedAspectRatio = MIN( aspectRatio, 1.85f * 0.75f ); // cap out the FOV advantage at a 1.85:1 ratio (about the widest any legit user should be)
}
view.fov = ScaleFOVByWidthRatio( view.fov, limitedAspectRatio );

View File

@ -1406,7 +1406,6 @@ Vector CBaseCombatCharacter::CalcDamageForceVector( const CTakeDamageInfo &info
// taking damage from self? Take a little random force, but still try to collapse on the spot.
if ( this == pForce )
{
DevMsg("SelfDamage taken");
forceVector.x = random->RandomFloat( -1.0f, 1.0f );
forceVector.y = random->RandomFloat( -1.0f, 1.0f );
forceVector.z = 0.0;
@ -2179,10 +2178,8 @@ bool CBaseCombatCharacter::Weapon_EquipAmmoOnly( CBaseCombatWeapon *pWeapon )
if ( m_hMyWeapons[i].Get() && FClassnameIs(m_hMyWeapons[i], pWeapon->GetClassname()) )
{
// Just give the ammo from the clip
//int primaryGiven = (pWeapon->UsesClipsForAmmo1()) ? pWeapon->m_iClip1 : pWeapon->GetPrimaryAmmoCount();
//int secondaryGiven = (pWeapon->UsesClipsForAmmo2()) ? pWeapon->m_iClip2 : pWeapon->GetSecondaryAmmoCount();
int primaryGiven = pWeapon->GetDefaultClip1();
int secondaryGiven = pWeapon->GetDefaultClip2();
int primaryGiven = (pWeapon->UsesClipsForAmmo1()) ? pWeapon->m_iClip1 : pWeapon->GetPrimaryAmmoCount();
int secondaryGiven = (pWeapon->UsesClipsForAmmo2()) ? pWeapon->m_iClip2 : pWeapon->GetSecondaryAmmoCount();
int takenPrimary = GiveAmmo( primaryGiven, pWeapon->m_iPrimaryAmmoType);
int takenSecondary = GiveAmmo( secondaryGiven, pWeapon->m_iSecondaryAmmoType);
@ -2246,7 +2243,7 @@ CBaseCombatWeapon *CBaseCombatCharacter::Weapon_GetSlot( int slot ) const
{
if ( m_hMyWeapons[i].Get() != NULL )
{
// If the slots match, i t's already occupied
// If the slots match, it's already occupied
if ( m_hMyWeapons[i]->GetSlot() == targetSlot )
return m_hMyWeapons[i];
}
@ -2493,11 +2490,6 @@ int CBaseCombatCharacter::OnTakeDamage_Alive( const CTakeDamageInfo &info )
m_flDamageAccumulator -= 1.0;
}
// Reduce damage in case of selfdamage
if (info.GetAttacker() == this) {
flIntegerDamage *= 0.33;
}
if ( flIntegerDamage <= 0 )
return 0;

View File

@ -900,11 +900,10 @@ CON_COMMAND( give, "Give item to player.\n\tArguments: <item_name>" )
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
CON_COMMAND( fov, "Change players FOV" ) //this is the "Fov" command
CON_COMMAND( fov, "Change players FOV" )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
//if ( pPlayer && sv_cheats->GetBool() )
if ( pPlayer )
if ( pPlayer && sv_cheats->GetBool() )
{
if ( args.ArgC() > 1 )
{

View File

@ -87,8 +87,8 @@ ConVar hl2_darkness_flashlight_factor ( "hl2_darkness_flashlight_factor", "1" );
#ifdef HL2MP
#define HL2_WALK_SPEED 150
#define HL2_NORM_SPEED 400
#define HL2_SPRINT_SPEED 400
#define HL2_NORM_SPEED 190
#define HL2_SPRINT_SPEED 320
#else
#define HL2_WALK_SPEED hl2_walkspeed.GetFloat()
#define HL2_NORM_SPEED hl2_normspeed.GetFloat()

View File

@ -198,13 +198,12 @@ void CHL2MP_Player::GiveDefaultItems( void )
{
EquipSuit();
//CBasePlayer::GiveAmmo( 255, "Pistol");
//CBasePlayer::GiveAmmo( 45, "SMG1");
//CBasePlayer::GiveAmmo( 45, "Rail");
//CBasePlayer::GiveAmmo( 1, "grenade" );
//CBasePlayer::GiveAmmo( 6, "Buckshot");
//CBasePlayer::GiveAmmo( 6, "357" );
/*
CBasePlayer::GiveAmmo( 255, "Pistol");
CBasePlayer::GiveAmmo( 45, "SMG1");
CBasePlayer::GiveAmmo( 1, "grenade" );
CBasePlayer::GiveAmmo( 6, "Buckshot");
CBasePlayer::GiveAmmo( 6, "357" );
if ( GetPlayerModelType() == PLAYER_SOUNDS_METROPOLICE || GetPlayerModelType() == PLAYER_SOUNDS_COMBINESOLDIER )
{
GiveNamedItem( "weapon_stunstick" );
@ -213,16 +212,11 @@ void CHL2MP_Player::GiveDefaultItems( void )
{
GiveNamedItem( "weapon_crowbar" );
}
*/
GiveNamedItem("weapon_hatchet");
//GiveNamedItem("weapon_rocketlauncher");
//GiveNamedItem("weapon_railgun");
//GiveNamedItem("weapon_lasergun");
GiveNamedItem("weapon_shottie");
//GiveNamedItem( "weapon_pistol" );
//GiveNamedItem( "weapon_smg1" );
//GiveNamedItem( "weapon_frag" );
//GiveNamedItem( "weapon_physcannon" );
GiveNamedItem( "weapon_pistol" );
GiveNamedItem( "weapon_smg1" );
GiveNamedItem( "weapon_frag" );
GiveNamedItem( "weapon_physcannon" );
const char *szDefaultWeaponName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_defaultweapon" );

View File

@ -1575,8 +1575,7 @@ static float DamageForce( const Vector &size, float damage )
if ( force > 1000.0)
{
// Disabled arbitrary force limit
force = force; // force = 1000.0;
force = 1000.0;
}
return force;
@ -1593,7 +1592,7 @@ int CBasePlayer::OnTakeDamage_Alive( const CTakeDamageInfo &info )
{
// set damage type sustained
m_bitsDamageType |= info.GetDamageType();
if ( !BaseClass::OnTakeDamage_Alive( info ) )
return 0;
@ -1612,17 +1611,14 @@ int CBasePlayer::OnTakeDamage_Alive( const CTakeDamageInfo &info )
if ( info.GetInflictor() && (GetMoveType() == MOVETYPE_WALK) &&
( !attacker->IsSolidFlagSet(FSOLID_TRIGGER)) )
{
//Vector force = vecDir * -DamageForce( WorldAlignSize(), info.GetBaseDamage() );
Vector force = vecDir * -DamageForce(WorldAlignSize(), info.GetBlastForce());
DevMsg("applying damage force: %.2f", info.GetBlastForce());
Vector force = vecDir * -DamageForce( WorldAlignSize(), info.GetBaseDamage() );
if ( force.z > 250.0f )
{
//force.z = 250.0f;
force.z = force.z; //disabled arbitrary force limit
force.z = 250.0f;
}
ApplyAbsVelocityImpulse( force );
}
// fire global game event
IGameEvent * event = gameeventmanager->CreateEvent( "player_hurt" );
@ -5681,15 +5677,9 @@ void CBloodSplat::Think( void )
CBaseEntity *CBasePlayer::GiveNamedItem( const char *pszName, int iSubType )
{
// If I already own this type don't create one
//if (Weapon_OwnsThisType(pszName, iSubType))
//return NULL;
// If I already own this type don't create one
//CBaseCombatWeapon *pWeap = Weapon_OwnsThisType(pszName, iSubType);
if (Weapon_OwnsThisType(pszName, iSubType)) {
//Weapon_EquipAmmoOnly(pWeap);
//DevMsg("kankerrrrrrrrr");
if ( Weapon_OwnsThisType(pszName, iSubType) )
return NULL;
}
// Msg( "giving %s\n", pszName );
EHANDLE pent;

View File

@ -1,265 +0,0 @@
#include "cbase.h"
#include "items.h"
#include "ammodef.h"
#include "weapon_hl2mpbasehlmpcombatweapon.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define PICKUP_DECAL "decals/item_base"
#define PICKUP_MODEL "models/items/item_health.mdl"
#define PICKUP_PEDESTALMODEL "models/items/pickup_pedestal.mdl"
#define PICKUP_MIN_HEIGHT 50
int PickupDecalIndex; // set by CRotatingPickup::Precache()
enum EItemType {
PICKUP_HEALTH = 0,
PICKUP_ARMOR = 1,
PICKUP_POWERUP = 2,
PICKUP_WEAPON = 3
};
enum EWeapons {
WEAPON_LASERGUN = 0,
WEAPON_RAILGUN = 1,
WEAPON_ROCKETLAUNCHER = 2,
};
#define SF_SUPPRESS_PICKUP_DECAL 0x00000002
//-----------------------------------------------------------------------------
// Rotating health kit. Heals the player when picked up.
//-----------------------------------------------------------------------------
class CRotatingPickup : public CItem
{
DECLARE_CLASS(CRotatingPickup, CItem);
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
public:
CRotatingPickup();
void Spawn();
void Activate();
void Precache();
bool MyTouch(CBasePlayer* pPlayer);
bool handleWeaponPickup(const char* strWeaponName, CBasePlayer* pPlayer);
CBaseEntity* Respawn();
void Materialize();
int m_iHealthToGive;
float m_fRespawnTime;
int m_iItemType;
int m_iWeaponType;
CBaseAnimating* pedestalModel;
CNetworkVar(bool, m_bRespawning);
private:
Vector MdlTop;
};
LINK_ENTITY_TO_CLASS(item_rotating, CRotatingPickup);
PRECACHE_REGISTER(item_rotating);
BEGIN_DATADESC(CRotatingPickup)
DEFINE_KEYFIELD(m_iHealthToGive, FIELD_INTEGER, "givehealth"),
DEFINE_KEYFIELD(m_fRespawnTime, FIELD_FLOAT, "respawntime"),
DEFINE_KEYFIELD(m_iItemType, FIELD_INTEGER, "itemtype"),
DEFINE_KEYFIELD(m_iWeaponType, FIELD_INTEGER, "weapontype"),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST(CRotatingPickup, DT_RotatingPickup)
SendPropBool(SENDINFO(m_bRespawning)),
SendPropExclude("DT_BaseEntity", "m_angRotation"),
END_SEND_TABLE()
CRotatingPickup::CRotatingPickup()
{
pedestalModel = (CBaseAnimating*)CreateEntityByName("prop_dynamic_override");
if (m_iHealthToGive <= 0)
m_iHealthToGive = 25;
if (m_fRespawnTime <= 0)
m_fRespawnTime = 20;
}
void CRotatingPickup::Spawn()
{
// CItem is designed for Vphys objects, so we need to undo a couple of things its spawn() does
Vector OriginalLocation = GetAbsOrigin();
BaseClass::Spawn();
VPhysicsDestroyObject();
SetAbsOrigin(OriginalLocation);
//pedestalModel->KeyValue("model", PICKUP_PEDESTALMODEL);
pedestalModel->SetModel(PICKUP_PEDESTALMODEL);
//pedestalModel->Create();
DispatchSpawn(pedestalModel);
pedestalModel->SetAbsOrigin(OriginalLocation);
UseClientSideAnimation();
switch (m_iItemType) {
case PICKUP_HEALTH:
SetModel(PICKUP_MODEL);
break;
case PICKUP_ARMOR:
SetModel(PICKUP_MODEL);
break;
case PICKUP_POWERUP:
SetModel(PICKUP_MODEL);
break;
case PICKUP_WEAPON:
switch (m_iWeaponType) {
case WEAPON_LASERGUN:
SetModel("models/weapons/w_lasergun.mdl");
break;
case WEAPON_RAILGUN:
SetModel("models/weapons/w_railgun.mdl");
break;
case WEAPON_ROCKETLAUNCHER:
SetModel("models/weapons/w_rocketlauncher.mdl");
break;
}
break;
}
SetMoveType(MOVETYPE_NONE);
// Grab the highest point on the model before we change the bounding box
MdlTop = GetAbsOrigin();
MdlTop.z += GetModelPtr()->hull_max().z;
SetSolid(SOLID_NONE);
CollisionProp()->UseTriggerBounds(true, 6); // Reign in the volume added to the trigger collision box
Vector OBBSize = Vector(CollisionProp()->OBBSize().Length() / 2); // need to use length as the model will be rotated at 45 degrees on clients
SetSize(-OBBSize, OBBSize); // Resize the bounding box
AddEffects(EF_NOSHADOW);
}
void CRotatingPickup::Activate()
{
BaseClass::Activate();
// Ensure minimum distance above a standable surfare
trace_t tr;
UTIL_TraceLine(MdlTop, MdlTop + Vector(0, 0, -PICKUP_MIN_HEIGHT), MASK_PLAYERSOLID, this, COLLISION_GROUP_NONE, &tr); // measuring from MdlTop
if (tr.DidHit())
{
if (!HasSpawnFlags(SF_SUPPRESS_PICKUP_DECAL))
engine->StaticDecal(tr.endpos, PickupDecalIndex, 0, 0, false); // mark the location of the pickup
SetAbsOrigin(GetAbsOrigin() + (Vector(0, 0, PICKUP_MIN_HEIGHT * (1 - tr.fraction))));
}
}
void CRotatingPickup::Precache()
{
PrecacheModel(PICKUP_MODEL);
PrecacheModel(PICKUP_PEDESTALMODEL);
PrecacheScriptSound("HealthKit.Touch");
PrecacheScriptSound("AlyxEmp.Charge");
PickupDecalIndex = UTIL_PrecacheDecal(PICKUP_DECAL, true);
}
bool CRotatingPickup::handleWeaponPickup(const char* strWeaponName, CBasePlayer* pPlayer) {
CBaseCombatWeapon* pWeapon = pPlayer->Weapon_OwnsThisType(strWeaponName);
if (!pWeapon) {
pPlayer->GiveNamedItem(strWeaponName);
}
else {
Ammo_t* pAmmoType = GetAmmoDef()->GetAmmoOfIndex(pWeapon->GetPrimaryAmmoType());
int iMaxAmmo = pAmmoType->pMaxCarry;
//pPlayer->Weapon_EquipAmmoOnly(pPlayer->Weapon_OwnsThisType(strWeaponName));
const FileWeaponInfo_t& weaponInfo = pWeapon->GetWpnData();
int iAmmoToGive = weaponInfo.m_iOwnedPickupAmmo;
if (pPlayer->GetAmmoCount(pAmmoType->pName) + iAmmoToGive < pWeapon->GetDefaultClip1()) {
iAmmoToGive = pWeapon->GetDefaultClip1() - pPlayer->GetAmmoCount(pAmmoType->pName);
pPlayer->GiveAmmo(iAmmoToGive, pAmmoType->pName);
}
else if (pPlayer->GetAmmoCount(pAmmoType->pName) < iMaxAmmo) {
pPlayer->GiveAmmo(iAmmoToGive, pAmmoType->pName);
}
else {
return false;
}
}
return true;
}
// Called from CItem::ItemTouch()
bool CRotatingPickup::MyTouch(CBasePlayer* pPlayer)
{
if (pPlayer)
{
switch (m_iItemType) {
case PICKUP_HEALTH:
if (pPlayer->GetHealth() < pPlayer->GetMaxHealth())
pPlayer->TakeHealth(m_iHealthToGive, DMG_GENERIC);
else
return false;
break;
case PICKUP_ARMOR:
break;
case PICKUP_POWERUP:
break;
case PICKUP_WEAPON:
switch (m_iWeaponType) {
case WEAPON_LASERGUN:
if (!handleWeaponPickup("weapon_lasergun", pPlayer))
return false;
break;
case WEAPON_RAILGUN:
if (!handleWeaponPickup("weapon_railgun", pPlayer))
return false;
break;
case WEAPON_ROCKETLAUNCHER:
if (!handleWeaponPickup("weapon_rocketlauncher", pPlayer))
return false;
break;
}
break;
}
CSingleUserRecipientFilter PlayerFilter(pPlayer);
PlayerFilter.MakeReliable();
UserMessageBegin(PlayerFilter, "ItemPickup");
WRITE_STRING(GetClassname());
MessageEnd();
EmitSound(PlayerFilter, pPlayer->entindex(), "HealthKit.Touch"); // this should be done by the HUD really
Respawn();
return true;
}
return false;
}
// Disappear
CBaseEntity* CRotatingPickup::Respawn()
{
SetTouch(NULL);
m_bRespawning = true;
SetThink(&CRotatingPickup::Materialize);
SetNextThink(gpGlobals->curtime + m_fRespawnTime);
return this;
}
// Reappear
void CRotatingPickup::Materialize()
{
EmitSound("AlyxEmp.Charge");
m_bRespawning = false;
SetTouch(&CItem::ItemTouch);
}

View File

@ -1,259 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "projectile_rocket.h"
#include "soundent.h"
#include "decals.h"
#include "shake.h"
#include "smoke_trail.h"
#include "ar2_explosion.h"
#include "vstdlib/random.h"
#include "engine/IEngineSound.h"
#include "world.h"
#ifdef PORTAL
#include "portal_util_shared.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define PROJECTILE_ROCKET_MAX_DANGER_RADIUS 300
extern short g_sModelIndexFireball; // (in combatweapon.cpp) holds the index for the smoke cloud
// Moved to HL2_SharedGameRules because these are referenced by shared AmmoDef functions
ConVar sk_plr_dmg_projectile_rocket ("sk_plr_dmg_projectile_rocket", "0");
ConVar sk_npc_dmg_projectile_rocket ("sk_npc_dmg_projectile_rocket", "0");
ConVar sk_max_projectile_rocket ("sk_max_projectile_rocket", "0");
ConVar sk_projectile_rocket_radius ( "sk_smg1_grenade_radius","0");
// Custom Source Arena cvars
ConVar sk_rocket_blast_force("sk_rocket_blast_force", "100"); // Rocket blast force
ConVar g_CV_rocketSmokeTrail("smoke_trail", "1", 0); // temporary dust explosion switch
BEGIN_DATADESC( CProjectileRocket )
DEFINE_FIELD( m_hSmokeTrail, FIELD_EHANDLE ),
DEFINE_FIELD( m_fSpawnTime, FIELD_TIME ),
DEFINE_FIELD( m_fDangerRadius, FIELD_FLOAT ),
// Function pointers
DEFINE_ENTITYFUNC( ProjectileRocketTouch ),
DEFINE_THINKFUNC( ProjectileRocketThink ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( projectile_rocket, CProjectileRocket );
void CProjectileRocket::Spawn( void )
{
Precache( );
SetSolid( SOLID_BBOX );
SetMoveType( MOVETYPE_FLY, MOVECOLLIDE_FLY_BOUNCE );
// Hits everything but debris
SetCollisionGroup( COLLISION_GROUP_PROJECTILE );
SetModel( "models/Weapons/ar2_grenade.mdl");
UTIL_SetSize(this, Vector(-3, -3, -3), Vector(3, 3, 3));
// UTIL_SetSize(this, Vector(0, 0, 0), Vector(0, 0, 0));
SetUse( &CProjectileRocket::DetonateUse );
SetTouch( &CProjectileRocket::ProjectileRocketTouch );
SetThink( &CProjectileRocket::ProjectileRocketThink );
SetNextThink( gpGlobals->curtime + 0.1f );
if( GetOwnerEntity() && GetOwnerEntity()->IsPlayer() )
{
m_flDamage = sk_plr_dmg_projectile_rocket.GetFloat();
}
else
{
m_flDamage = sk_npc_dmg_projectile_rocket.GetFloat();
}
m_DmgRadius = sk_projectile_rocket_radius.GetFloat();
m_takedamage = DAMAGE_YES;
m_bIsLive = true;
m_iHealth = 1;
SetGravity( UTIL_ScaleForGravity( 400 ) ); // use a lower gravity for grenades to make them easier to see
SetFriction( 0.8 );
SetSequence( 0 );
m_fDangerRadius = 100;
m_fSpawnTime = gpGlobals->curtime;
// -------------
// Smoke trail.
// -------------
if( g_CV_rocketSmokeTrail.GetInt() && !IsXbox() )
{
m_hSmokeTrail = SmokeTrail::CreateSmokeTrail();
if( m_hSmokeTrail )
{
m_hSmokeTrail->m_SpawnRate = 48;
m_hSmokeTrail->m_ParticleLifetime = 1;
m_hSmokeTrail->m_StartColor.Init(0.1f, 0.1f, 0.1f);
m_hSmokeTrail->m_EndColor.Init(0,0,0);
m_hSmokeTrail->m_StartSize = 12;
m_hSmokeTrail->m_EndSize = m_hSmokeTrail->m_StartSize * 4;
m_hSmokeTrail->m_SpawnRadius = 4;
m_hSmokeTrail->m_MinSpeed = 4;
m_hSmokeTrail->m_MaxSpeed = 24;
m_hSmokeTrail->m_Opacity = 0.2f;
m_hSmokeTrail->SetLifetime(10.0f);
m_hSmokeTrail->FollowEntity(this);
}
}
}
//-----------------------------------------------------------------------------
// Purpose: The grenade has a slight delay before it goes live. That way the
// person firing it can bounce it off a nearby wall. However if it
// hits another character it blows up immediately
// Input :
// Output :
//-----------------------------------------------------------------------------
void CProjectileRocket::ProjectileRocketThink( void )
{
SetNextThink( gpGlobals->curtime + 0.05f );
if (!m_bIsLive)
{
// Go live after a short delay
if (m_fSpawnTime + MAX_ROCKET_NO_COLLIDE_TIME < gpGlobals->curtime)
{
m_bIsLive = true;
}
}
// If I just went solid and my velocity is zero, it means I'm resting on
// the floor already when I went solid so blow up
if (m_bIsLive)
{
if (GetAbsVelocity().Length() == 0.0 ||
GetGroundEntity() != NULL )
{
Detonate();
}
}
// The old way of making danger sounds would scare the crap out of EVERYONE between you and where the grenade
// was going to hit. The radius of the danger sound now 'blossoms' over the grenade's lifetime, making it seem
// dangerous to a larger area downrange than it does from where it was fired.
if( m_fDangerRadius <= PROJECTILE_ROCKET_MAX_DANGER_RADIUS )
{
m_fDangerRadius += ( PROJECTILE_ROCKET_MAX_DANGER_RADIUS * 0.05 );
}
CSoundEnt::InsertSound( SOUND_DANGER, GetAbsOrigin() + GetAbsVelocity() * 0.5, m_fDangerRadius, 0.2, this, SOUNDENT_CHANNEL_REPEATED_DANGER );
}
void CProjectileRocket::Event_Killed( const CTakeDamageInfo &info )
{
Detonate( );
}
void CProjectileRocket::ProjectileRocketTouch( CBaseEntity *pOther )
{
Assert( pOther );
if ( !pOther->IsSolid() )
return;
// If I'm live go ahead and blow up
if (m_bIsLive)
{
Detonate();
}
else
{
// If I'm not live, only blow up if I'm hitting an chacter that
// is not the owner of the weapon
CBaseCombatCharacter *pBCC = ToBaseCombatCharacter( pOther );
if (pBCC && GetThrower() != pBCC)
{
m_bIsLive = true;
Detonate();
}
}
}
void CProjectileRocket::Detonate(void)
{
if (!m_bIsLive)
{
return;
}
m_bIsLive = false;
m_takedamage = DAMAGE_NO;
if(m_hSmokeTrail)
{
UTIL_Remove(m_hSmokeTrail);
m_hSmokeTrail = NULL;
}
CPASFilter filter( GetAbsOrigin() );
te->Explosion( filter, 0.0,
&GetAbsOrigin(),
g_sModelIndexFireball,
2.0,
15,
TE_EXPLFLAG_NONE,
m_DmgRadius,
m_flDamage );
Vector vecForward = GetAbsVelocity();
VectorNormalize(vecForward);
trace_t tr;
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT,
this, COLLISION_GROUP_NONE, &tr);
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
{
// non-world needs smaller decals
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
{
UTIL_DecalTrace( &tr, "SmallScorch" );
}
}
else
{
UTIL_DecalTrace( &tr, "Scorch" );
}
UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );
CTakeDamageInfo damageInfo = CTakeDamageInfo(this, GetThrower(), m_flDamage, DMG_BLAST);
damageInfo.SetBlastForce(sk_rocket_blast_force.GetFloat());
RadiusDamage ( damageInfo, GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );
UTIL_Remove( this );
}
void CProjectileRocket::Precache( void )
{
PrecacheModel("models/Weapons/ar2_grenade.mdl");
}
CProjectileRocket::CProjectileRocket(void)
{
m_hSmokeTrail = NULL;
}

View File

@ -1,46 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Projectile shot from the AR2
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#ifndef PROJECTILEROCKET_H
#define PROJECTILEROCKET_H
#include "basegrenade_shared.h"
#define MAX_ROCKET_NO_COLLIDE_TIME 0.2
class SmokeTrail;
class CProjectileRocket : public CBaseGrenade
{
public:
DECLARE_CLASS( CProjectileRocket, CBaseGrenade );
CHandle< SmokeTrail > m_hSmokeTrail;
float m_fSpawnTime;
float m_fDangerRadius;
void Spawn( void );
void Precache( void );
void ProjectileRocketTouch( CBaseEntity *pOther );
void ProjectileRocketThink( void );
void Event_Killed( const CTakeDamageInfo &info );
public:
void EXPORT Detonate(void);
CProjectileRocket(void);
DECLARE_DATADESC();
};
#endif //GRENADEAR2_H

View File

@ -1,201 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
/*
===== tf_client.cpp ========================================================
HL2 client/server game specific stuff
*/
#include "cbase.h"
#include "hl2mp_player.h"
#include "hl2mp_gamerules.h"
#include "gamerules.h"
#include "teamplay_gamerules.h"
#include "entitylist.h"
#include "physics.h"
#include "game.h"
#include "player_resource.h"
#include "engine/IEngineSound.h"
#include "team.h"
#include "viewport_panel_names.h"
#include "tier0/vprof.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
void Host_Say( edict_t *pEdict, bool teamonly );
ConVar sv_motd_unload_on_dismissal( "sv_motd_unload_on_dismissal", "0", 0, "If enabled, the MOTD contents will be unloaded when the player closes the MOTD." );
extern CBaseEntity* FindPickerEntityClass( CBasePlayer *pPlayer, char *classname );
extern bool g_fGameOver;
void FinishClientPutInServer( CHL2MP_Player *pPlayer )
{
pPlayer->InitialSpawn();
pPlayer->Spawn();
char sName[128];
Q_strncpy( sName, pPlayer->GetPlayerName(), sizeof( sName ) );
// First parse the name and remove any %'s
for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ )
{
// Replace it with a space
if ( *pApersand == '%' )
*pApersand = ' ';
}
// notify other clients of player joining the game
UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Game_connected", sName[0] != 0 ? sName : "<unconnected>" );
if ( HL2MPRules()->IsTeamplay() == true )
{
ClientPrint( pPlayer, HUD_PRINTTALK, "You are on team %s1\n", pPlayer->GetTeam()->GetName() );
}
const ConVar *hostname = cvar->FindVar( "hostname" );
const char *title = (hostname) ? hostname->GetString() : "MESSAGE OF THE DAY";
KeyValues *data = new KeyValues("data");
data->SetString( "title", title ); // info panel title
data->SetString( "type", "1" ); // show userdata from stringtable entry
data->SetString( "msg", "motd" ); // use this stringtable entry
data->SetBool( "unload", sv_motd_unload_on_dismissal.GetBool() );
pPlayer->ShowViewPortPanel( PANEL_INFO, true, data );
data->deleteThis();
}
/*
===========
ClientPutInServer
called each time a player is spawned into the game
============
*/
void ClientPutInServer( edict_t *pEdict, const char *playername )
{
// Allocate a CBaseTFPlayer for pev, and call spawn
CHL2MP_Player *pPlayer = CHL2MP_Player::CreatePlayer( "player", pEdict );
pPlayer->SetPlayerName( playername );
}
void ClientActive( edict_t *pEdict, bool bLoadGame )
{
// Can't load games in CS!
Assert( !bLoadGame );
CHL2MP_Player *pPlayer = ToHL2MPPlayer( CBaseEntity::Instance( pEdict ) );
FinishClientPutInServer( pPlayer );
}
/*
===============
const char *GetGameDescription()
Returns the descriptive name of this .dll. E.g., Half-Life, or Team Fortress 2
===============
*/
const char *GetGameDescription()
{
if ( g_pGameRules ) // this function may be called before the world has spawned, and the game rules initialized
return g_pGameRules->GetGameDescription();
else
return "Half-Life 2 Deathmatch";
}
//-----------------------------------------------------------------------------
// Purpose: Given a player and optional name returns the entity of that
// classname that the player is nearest facing
//
// Input :
// Output :
//-----------------------------------------------------------------------------
CBaseEntity* FindEntity( edict_t *pEdict, char *classname)
{
// If no name was given set bits based on the picked
if (FStrEq(classname,""))
{
return (FindPickerEntityClass( static_cast<CBasePlayer*>(GetContainingEntity(pEdict)), classname ));
}
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Precache game-specific models & sounds
//-----------------------------------------------------------------------------
void ClientGamePrecache( void )
{
CBaseEntity::PrecacheModel("models/player.mdl");
CBaseEntity::PrecacheModel( "models/gibs/agibs.mdl" );
CBaseEntity::PrecacheModel ("models/weapons/v_hands.mdl");
CBaseEntity::PrecacheScriptSound( "HUDQuickInfo.LowAmmo" );
CBaseEntity::PrecacheScriptSound( "HUDQuickInfo.LowHealth" );
CBaseEntity::PrecacheScriptSound( "FX_AntlionImpact.ShellImpact" );
CBaseEntity::PrecacheScriptSound( "Missile.ShotDown" );
CBaseEntity::PrecacheScriptSound( "Bullets.DefaultNearmiss" );
CBaseEntity::PrecacheScriptSound( "Bullets.GunshipNearmiss" );
CBaseEntity::PrecacheScriptSound( "Bullets.StriderNearmiss" );
CBaseEntity::PrecacheScriptSound( "Geiger.BeepHigh" );
CBaseEntity::PrecacheScriptSound( "Geiger.BeepLow" );
}
// called by ClientKill and DeadThink
void respawn( CBaseEntity *pEdict, bool fCopyCorpse )
{
CHL2MP_Player *pPlayer = ToHL2MPPlayer( pEdict );
if ( pPlayer )
{
if ( gpGlobals->curtime > pPlayer->GetDeathTime() + DEATH_ANIMATION_TIME )
{
// respawn player
pPlayer->Spawn();
}
else
{
pPlayer->SetNextThink( gpGlobals->curtime + 0.1f );
}
}
}
void GameStartFrame( void )
{
VPROF("GameStartFrame()");
if ( g_fGameOver )
return;
gpGlobals->teamplay = (teamplay.GetInt() != 0);
#ifdef DEBUG
extern void Bot_RunAll();
Bot_RunAll();
#endif
}
//=========================================================
// instantiate the proper game rules object
//=========================================================
void InstallGameRules()
{
// vanilla deathmatch
CreateGameRulesObject( "CHL2MPRules" );
}

View File

@ -2414,18 +2414,6 @@ void CTriggerTeleport::Touch( CBaseEntity *pOther )
{
// make origin adjustments in case the teleportee is a player. (origin in center, not at feet)
tmp.z -= pOther->WorldAlignMins().z;
// force velocity to target direction
Vector vecVelIn = pOther->GetAbsVelocity();
QAngle vecVelInDir = QAngle(0, 0, 0);
VectorAngles(vecVelIn, vecVelInDir);
QAngle vecDirOut = pentTarget->GetAbsAngles();
//vecVelInDir.z = 0;
//vecVelInDir.x, vecVelInDir.y = 0;
//vecDirOut.x, vecDirOut.y = 0;
Vector vecVelOut = Vector(0, 0, 0);
VectorRotate(vecVelIn, vecDirOut-vecVelInDir, vecVelOut);
pOther->SetAbsVelocity(vecVelOut);
}
//

View File

@ -36,14 +36,6 @@ extern IFileSystem *filesystem;
#endif
#ifndef SA_MOVEMENT
#define SA_MOVEMENT
#endif
ConVar sa_sv_pogostick("sv_pogostick", "1", FCVAR_REPLICATED, "queue jumps", 1, 0, 1, 1);
ConVar sa_sv_queuejump("sv_queuejump", "0", FCVAR_REPLICATED, "auto bunny hopping", 1, 0, 1, 1);
// tickcount currently isn't set during prediction, although gpGlobals->curtime and
// gpGlobals->frametime are. We should probably set tickcount (to player->m_nTickBase),
// but we're REALLY close to shipping, so we can change that later and people can use
@ -70,7 +62,7 @@ ConVar debug_latch_reset_onduck( "debug_latch_reset_onduck", "1", FCVAR_CHEAT );
#endif
// [MD] I'll remove this eventually. For now, I want the ability to A/B the optimizations.
bool g_bMovementOptimizations = false; //switched to false to fix prediction errors
bool g_bMovementOptimizations = true;
// Roughly how often we want to update the info about the ground surface we're on.
// We don't need to do this very often.
@ -1207,14 +1199,6 @@ void CGameMovement::FinishTrackPredictionErrors( CBasePlayer *pPlayer )
//-----------------------------------------------------------------------------
void CGameMovement::FinishMove( void )
{
ConVar* pPogoStick = cvar->FindVar("sv_pogostick");
ConVar* pQueueJump = cvar->FindVar("sv_queuejump");
if (!(mv->m_nButtons & IN_JUMP) && pQueueJump->GetInt() == 1) {
mv->m_bRejumpAllowed = true;
}
else if (pPogoStick->GetInt() == 1) {
mv->m_bRejumpAllowed = true;
}
mv->m_nOldButtons = mv->m_nButtons;
}
@ -1735,10 +1719,8 @@ void CGameMovement::AirAccelerate( Vector& wishdir, float wishspeed, float accel
return;
// Cap speed
//if ( wishspd > GetAirSpeedCap() )
//wishspd = GetAirSpeedCap();
if (wishspd > 30.0f)
wishspd = 30.0f;
if ( wishspd > GetAirSpeedCap() )
wishspd = GetAirSpeedCap();
// Determine veer amount
currentspeed = mv->m_vecVelocity.Dot(wishdir);
@ -1907,12 +1889,6 @@ void CGameMovement::StayOnGround( void )
}
}
// Camera Bob
ConVar cl_camtilt_enabled("cl_camtilt_enabled", "1", 0, "Oscillation Toggle", true, 0, true, 1);
ConVar cl_viewbob_timer("cl_viewbob_timer", "1", 0, "Speed of Oscillation");
ConVar cl_camtilt_scale("cl_camtilt_scale", "2.5", 0, "Magnitude of Oscillation");
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@ -1939,16 +1915,6 @@ void CGameMovement::WalkMove( void )
fmove = mv->m_flForwardMove;
smove = mv->m_flSideMove;
if (cl_camtilt_enabled.GetInt() == 1 && !engine->IsPaused())
{
float offset = 2 * cl_viewbob_timer.GetFloat() * player->GetAbsVelocity().Length() * cl_camtilt_scale.GetFloat() / 4000000 * smove;
QAngle playerAngles = mv->m_vecViewAngles;
QAngle camTilt(0, 0, offset);
QAngle resultAngles(playerAngles.x, playerAngles.y, playerAngles.z + camTilt.z);
player->ViewPunch(camTilt);
}
// Zero out z components of movement vectors
if ( g_bMovementOptimizations )
{
@ -2108,8 +2074,7 @@ void CGameMovement::FullWalkMove( )
// If we are on ground, no downward velocity.
if ( player->GetGroundEntity() != NULL )
{
mv->m_vecVelocity[2] = 0;
mv->m_bRejumpAllowed = true;
mv->m_vecVelocity[2] = 0;
}
}
else
@ -2388,9 +2353,6 @@ void CGameMovement::PlaySwimSound()
//-----------------------------------------------------------------------------
bool CGameMovement::CheckJumpButton( void )
{
ConVar* pPogoStick = cvar->FindVar("sv_pogostick");
ConVar* pQueueJump = cvar->FindVar("sv_queuejump");
if (player->pl.deadflag)
{
mv->m_nOldButtons |= IN_JUMP ; // don't jump again until released
@ -2403,13 +2365,13 @@ bool CGameMovement::CheckJumpButton( void )
player->m_flWaterJumpTime -= gpGlobals->frametime;
if (player->m_flWaterJumpTime < 0)
player->m_flWaterJumpTime = 0;
return false;
}
// If we are in the water most of the way...
if ( player->GetWaterLevel() >= 2 )
{
{
// swimming, not jumping
SetGroundEntity( NULL );
@ -2417,7 +2379,7 @@ bool CGameMovement::CheckJumpButton( void )
mv->m_vecVelocity[2] = 100;
else if (player->GetWaterType() == CONTENTS_SLIME)
mv->m_vecVelocity[2] = 80;
// play swiming sound
if ( player->m_flSwimSoundTime <= 0 )
{
@ -2430,13 +2392,11 @@ bool CGameMovement::CheckJumpButton( void )
}
// No more effect
if (player->GetGroundEntity() == NULL)
if (player->GetGroundEntity() == NULL)
{
//Removed because we don't want the jump button to become 'unpressed'
// mv->m_nOldButtons |= IN_JUMP;
mv->m_nOldButtons |= IN_JUMP;
return false; // in air, so no effect
}
DevMsg("Got past getGroundEntity() == NULL \n");
// Don't allow jumping when the player is in a stasis field.
#ifndef HL2_EPISODIC
@ -2444,47 +2404,35 @@ bool CGameMovement::CheckJumpButton( void )
return false;
#endif
//pressed jump on last tick/frame and both autojump and queuejump are disabled through console.
if ( mv->m_nOldButtons & IN_JUMP && !(mv->m_bRejumpAllowed ) ) {
if ( mv->m_nOldButtons & IN_JUMP )
return false; // don't pogo stick
}
//DevMsg("Got past dont pogo \n");
// Cannot jump will in the unduck transition.
//if ( player->m_Local.m_bDucking && ( player->GetFlags() & FL_DUCKING ) )
//return false;
if ( player->m_Local.m_bDucking && ( player->GetFlags() & FL_DUCKING ) )
return false;
// Still updating the eye position.
//if ( player->m_Local.m_flDuckJumpTime > 0.0f )
//return false;
if (pPogoStick->GetInt() == 0) {
DevMsg("rejump disabled \n");
mv->m_bRejumpAllowed = false;
}
if ( player->m_Local.m_flDuckJumpTime > 0.0f )
return false;
// In the air now.
SetGroundEntity( NULL );
SetGroundEntity( NULL );
player->PlayStepSound( (Vector &)mv->GetAbsOrigin(), player->m_pSurfaceData, 1.0, true );
MoveHelper()->PlayerSetAnimation( PLAYER_JUMP );
float flGroundFactor = 1.0f;
if (player->m_pSurfaceData)
{
flGroundFactor = player->m_pSurfaceData->game.jumpFactor;
flGroundFactor = player->m_pSurfaceData->game.jumpFactor;
}
float flMul;
if ( g_bMovementOptimizations )
{
#if defined(HL2_DLL) &!defined(SArena_DLL) || defined(HL2_CLIENT_DLL) &!defined(SArena_DLL)
#if defined(HL2_DLL) || defined(HL2_CLIENT_DLL)
Assert( GetCurrentGravity() == 600.0f );
flMul = 160.0f; // approx. 21 units.
#else
@ -2495,10 +2443,7 @@ bool CGameMovement::CheckJumpButton( void )
}
else
{
//flMul = sqrt(2 * GetCurrentGravity() * GAMEMOVEMENT_JUMP_HEIGHT);
//We need these
Assert(GetCurrentGravity() == 800.0f);
flMul = 268.3281572999747f;
flMul = sqrt(2 * GetCurrentGravity() * GAMEMOVEMENT_JUMP_HEIGHT);
}
// Acclerate upward
@ -2528,7 +2473,7 @@ bool CGameMovement::CheckJumpButton( void )
AngleVectors( mv->m_vecViewAngles, &vecForward );
vecForward.z = 0;
VectorNormalize( vecForward );
// We give a certain percentage of the current forward movement as a bonus to the jump speed. That bonus is clipped
// to not accumulate over time.
float flSpeedBoostPerc = ( !pMoveData->m_bIsSprinting && !player->m_Local.m_bDucked ) ? 0.5f : 0.1f;
@ -2578,13 +2523,9 @@ bool CGameMovement::CheckJumpButton( void )
}
#endif
//Commented out because idk why
if (pPogoStick->GetInt() == 0 && pQueueJump->GetInt() == 1 && player->GetGroundEntity() != NULL) {
// Flag that we jumped.
mv->m_nOldButtons |= IN_JUMP; // don't jump again until released
}
// Flag that we jumped.
mv->m_nOldButtons |= IN_JUMP; // don't jump again until released
return true;
}
@ -2899,7 +2840,7 @@ inline bool CGameMovement::OnLadder( trace_t &trace )
// HPE_BEGIN
// [sbodenbender] make ladders easier to climb in cstrike
//=============================================================================
#if defined (CSTRIKE_DLL) || defined( SArena_DLL )
#if defined (CSTRIKE_DLL)
ConVar sv_ladder_dampen ( "sv_ladder_dampen", "0.2", FCVAR_REPLICATED, "Amount to dampen perpendicular movement on a ladder", true, 0.0f, true, 1.0f );
ConVar sv_ladder_angle( "sv_ladder_angle", "-0.707", FCVAR_REPLICATED, "Cos of angle of incidence to ladder perpendicular for applying ladder_dampen", true, -1.0f, true, 1.0f );
#endif
@ -3036,7 +2977,7 @@ bool CGameMovement::LadderMove( void )
// HPE_BEGIN
// [sbodenbender] make ladders easier to climb in cstrike
//=============================================================================
#if defined (CSTRIKE_DLL) || defined( SArena_DLL )
#if defined (CSTRIKE_DLL)
// break lateral into direction along tmp (up the ladder) and direction along perp (perpendicular to ladder)
float tmpDist = DotProduct ( tmp, lateral );
float perpDist = DotProduct ( perp, lateral );
@ -3866,8 +3807,7 @@ void CGameMovement::CategorizePosition( void )
// Shooting up really fast. Definitely not on ground.
// On ladder moving up, so not on ground either
// NOTE: 145 is a jump.
//#define NON_JUMP_VELOCITY 140.0f
#define NON_JUMP_VELOCITY 190.0f
#define NON_JUMP_VELOCITY 140.0f
float zvel = mv->m_vecVelocity[2];
bool bMovingUp = zvel > 0.0f;

View File

@ -513,7 +513,7 @@ void CGameRules::RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc
else
{
// Assume the force passed in is the maximum force. Decay it based on falloff.
float flForce = adjustedInfo.GetDamageForce().Length() * 200 * falloff;
float flForce = adjustedInfo.GetDamageForce().Length() * falloff;
adjustedInfo.SetDamageForce( dir * flForce );
adjustedInfo.SetDamagePosition( vecSrc );
}

View File

@ -144,7 +144,7 @@ public:
virtual CBaseCombatWeapon *GetNextBestWeapon( CBaseCombatCharacter *pPlayer, CBaseCombatWeapon *pCurrentWeapon ); // I can't use this weapon anymore, get me the next best one.
virtual bool ShouldCollide( int collisionGroup0, int collisionGroup1 );
virtual int DefaultFOV( void ) { return 100; }
virtual int DefaultFOV( void ) { return 90; }
// This function is here for our CNetworkVars.
inline void NetworkStateChanged()

View File

@ -1,20 +1,3 @@
//========= Copyright © 1996-2010, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "gamemovement.h"
// Expose our interface.
static CGameMovement g_GameMovement;
IGameMovement *g_pGameMovement = (IGameMovement *)&g_GameMovement;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CGameMovement, IGameMovement, INTERFACENAME_GAMEMOVEMENT, g_GameMovement);
/*
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Special handling for hl2 usable ladders
@ -159,7 +142,6 @@ LINK_ENTITY_TO_CLASS( reserved_spot, CReservePlayerSpot );
// goalpos -
// *ladder -
//-----------------------------------------------------------------------------
void CHL2GameMovement::StartForcedMove( bool mounting, float transit_speed, const Vector& goalpos, CFuncLadder *ladder )
{
LadderMove_t* lm = GetLadderMove();
@ -540,7 +522,7 @@ bool CHL2GameMovement::ExitLadderViaDismountNode( CFuncLadder *ladder, bool stri
//-----------------------------------------------------------------------------
void CHL2GameMovement::FullLadderMove()
{
//#if !defined( CLIENT_DLL )
#if !defined( CLIENT_DLL )
CFuncLadder *ladder = GetLadder();
Assert( ladder );
if ( !ladder )
@ -719,7 +701,7 @@ void CHL2GameMovement::FullLadderMove()
mv->SetAbsOrigin( oldOrigin );
}
}
//#endif
#endif
}
bool CHL2GameMovement::CheckLadderAutoMountEndPoint( CFuncLadder *ladder, const Vector& bestOrigin )
@ -1167,5 +1149,4 @@ bool CHL2GameMovement::CanAccelerate()
IGameMovement *g_pGameMovement = ( IGameMovement * )&g_GameMovement;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CGameMovement, IGameMovement,INTERFACENAME_GAMEMOVEMENT, g_GameMovement );
#endif
*/
#endif

View File

@ -1,4 +1,3 @@
/*
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Special handling for hl2 usable ladders
@ -128,4 +127,3 @@ inline CFuncLadder *CHL2GameMovement::GetLadder()
{
return static_cast<CFuncLadder*>( static_cast<CBaseEntity *>( GetHL2Player()->m_HL2Local.m_hLadder.Get() ) );
}
*/

View File

@ -929,10 +929,6 @@ CAmmoDef *GetAmmoDef()
def.AddAmmoType("Pistol", DMG_BULLET, TRACER_LINE_AND_WHIZ, 0, 0, 150, BULLET_IMPULSE(200, 1225), 0 );
def.AddAmmoType("SMG1", DMG_BULLET, TRACER_LINE_AND_WHIZ, 0, 0, 225, BULLET_IMPULSE(200, 1225), 0 );
def.AddAmmoType("357", DMG_BULLET, TRACER_LINE_AND_WHIZ, 0, 0, 12, BULLET_IMPULSE(800, 5000), 0 );
def.AddAmmoType("Rail", DMG_BULLET, TRACER_LINE_AND_WHIZ, 0, 0, 15, BULLET_IMPULSE(800, 5000), 0);
def.AddAmmoType("Laser", DMG_BULLET, TRACER_LINE_AND_WHIZ, 0, 0, 200, BULLET_IMPULSE(200, 1225), 0);
def.AddAmmoType("Rocket", DMG_BURN, TRACER_LINE_AND_WHIZ, 0, 0, 30, 0, 0);
def.AddAmmoType("Shottie", DMG_BULLET | DMG_BUCKSHOT, TRACER_LINE, 0, 0, 30, BULLET_IMPULSE(400, 1200), 0);
def.AddAmmoType("XBowBolt", DMG_BULLET, TRACER_LINE, 0, 0, 10, BULLET_IMPULSE(800, 8000), 0 );
def.AddAmmoType("Buckshot", DMG_BULLET | DMG_BUCKSHOT, TRACER_LINE, 0, 0, 30, BULLET_IMPULSE(400, 1200), 0 );
def.AddAmmoType("RPG_Round", DMG_BURN, TRACER_NONE, 0, 0, 3, 0, 0 );

View File

@ -19,7 +19,6 @@ FileWeaponInfo_t* CreateWeaponInfo()
CHL2MPSWeaponInfo::CHL2MPSWeaponInfo()
{
m_iPlayerDamage = 0;
m_iOwnedPickupAmmo = 0;
}

View File

@ -40,7 +40,6 @@ class CMoveData
public:
bool m_bFirstRunOfFunctions : 1;
bool m_bGameCodeMovedPlayer : 1;
bool m_bRejumpAllowed : 1; //keeping track of allowed jump status SA
EntityHandle_t m_nPlayerHandle; // edict index on server, client entity handle on client

View File

@ -16,7 +16,7 @@
#include "tier0/memdbgon.h"
// some cvars used by player movement system
#if defined( HL2_DLL ) &! defined( SArena_DLL ) || defined( HL2_CLIENT_DLL ) &! defined( SArena_DLL )
#if defined( HL2_DLL ) || defined( HL2_CLIENT_DLL )
#define DEFAULT_GRAVITY_STRING "600"
#else
#define DEFAULT_GRAVITY_STRING "800"
@ -36,7 +36,7 @@ float GetCurrentGravity( void )
ConVar sv_gravity ( "sv_gravity", DEFAULT_GRAVITY_STRING, FCVAR_NOTIFY | FCVAR_REPLICATED, "World gravity." );
#if defined( DOD_DLL ) || defined( CSTRIKE_DLL ) || defined( HL1MP_DLL ) || defined( SArena_DLL )
#if defined( DOD_DLL ) || defined( CSTRIKE_DLL ) || defined( HL1MP_DLL )
ConVar sv_stopspeed ( "sv_stopspeed","100", FCVAR_NOTIFY | FCVAR_REPLICATED, "Minimum stopping speed when on ground." );
#else
ConVar sv_stopspeed ( "sv_stopspeed","100", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Minimum stopping speed when on ground." );
@ -48,8 +48,8 @@ ConVar sv_specaccelerate( "sv_specaccelerate", "5", FCVAR_NOTIFY | FCVAR_ARCHIVE
ConVar sv_specspeed ( "sv_specspeed", "3", FCVAR_ARCHIVE | FCVAR_NOTIFY | FCVAR_REPLICATED);
ConVar sv_specnoclip ( "sv_specnoclip", "1", FCVAR_ARCHIVE | FCVAR_NOTIFY | FCVAR_REPLICATED);
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL ) || defined( SArena_DLL )
ConVar sv_maxspeed ( "sv_maxspeed", "400", FCVAR_NOTIFY | FCVAR_REPLICATED);
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL )
ConVar sv_maxspeed ( "sv_maxspeed", "320", FCVAR_NOTIFY | FCVAR_REPLICATED);
#else
ConVar sv_maxspeed ( "sv_maxspeed", "320", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY);
#endif // CSTRIKE_DLL
@ -58,7 +58,7 @@ ConVar sv_maxspeed ( "sv_maxspeed", "320", FCVAR_NOTIFY | FCVAR_REPLICATED | FC
ConVar sv_accelerate ( "sv_accelerate", "7", FCVAR_NOTIFY | FCVAR_REPLICATED);
#else
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL ) || defined( SArena_DLL )
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL )
ConVar sv_accelerate ( "sv_accelerate", "10", FCVAR_NOTIFY | FCVAR_REPLICATED);
#else
ConVar sv_accelerate ( "sv_accelerate", "10", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY);
@ -66,8 +66,8 @@ ConVar sv_maxspeed ( "sv_maxspeed", "320", FCVAR_NOTIFY | FCVAR_REPLICATED | FC
#endif//_XBOX
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL ) || defined( SArena_DLL ) //we need these to not be hidden
ConVar sv_airaccelerate( "sv_airaccelerate", "100", FCVAR_NOTIFY | FCVAR_REPLICATED);
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL )
ConVar sv_airaccelerate( "sv_airaccelerate", "10", FCVAR_NOTIFY | FCVAR_REPLICATED);
ConVar sv_wateraccelerate( "sv_wateraccelerate", "10", FCVAR_NOTIFY | FCVAR_REPLICATED);
ConVar sv_waterfriction( "sv_waterfriction", "1", FCVAR_NOTIFY | FCVAR_REPLICATED);
ConVar sv_footsteps ( "sv_footsteps", "1", FCVAR_NOTIFY | FCVAR_REPLICATED, "Play footstep sound for players" );
@ -82,13 +82,13 @@ ConVar sv_rollspeed ( "sv_rollspeed", "200", FCVAR_NOTIFY | FCVAR_REPLICATED | F
ConVar sv_rollangle ( "sv_rollangle", "0", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Max view roll angle");
#endif // CSTRIKE_DLL
#if defined( DOD_DLL ) || defined( CSTRIKE_DLL ) || defined( HL1MP_DLL ) || defined( SArena_DLL ) //need these too
#if defined( DOD_DLL ) || defined( CSTRIKE_DLL ) || defined( HL1MP_DLL )
ConVar sv_friction ( "sv_friction","4", FCVAR_NOTIFY | FCVAR_REPLICATED, "World friction." );
#else
ConVar sv_friction ( "sv_friction","4", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "World friction." );
#endif // DOD_DLL || CSTRIKE_DLL
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL ) || defined( SArena_DLL ) //need these too
#if defined( CSTRIKE_DLL ) || defined( HL1MP_DLL )
ConVar sv_bounce ( "sv_bounce","0", FCVAR_NOTIFY | FCVAR_REPLICATED, "Bounce multiplier for when physically simulated objects collide with other objects." );
ConVar sv_maxvelocity ( "sv_maxvelocity","3500", FCVAR_REPLICATED, "Maximum speed any ballistically moving object is allowed to attain per axis." );
ConVar sv_stepsize ( "sv_stepsize","18", FCVAR_NOTIFY | FCVAR_REPLICATED );

View File

@ -628,8 +628,7 @@ ConVarRef suitcharger( "sk_suitcharger" );
break;
default:
case 0:// fixed
//return 10;
return 0;
return 10;
break;
}
}

View File

@ -1,228 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Hatchet - an old favorite
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "sarena/weapon_hatchet.h"
#include "weapon_hl2mpbasehlmpcombatweapon.h"
#include "gamerules.h"
#include "ammodef.h"
#include "mathlib/mathlib.h"
#include "in_buttons.h"
#include "vstdlib/random.h"
#include "npcevent.h"
#if defined( CLIENT_DLL )
#include "c_hl2mp_player.h"
#else
#include "hl2mp_player.h"
#include "ai_basenpc.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define hatchet_RANGE 75.0f
#define hatchet_REFIRE 0.4f
//-----------------------------------------------------------------------------
// CWeaponHatchet
//-----------------------------------------------------------------------------
IMPLEMENT_NETWORKCLASS_ALIASED( WeaponHatchet, DT_WeaponHatchet )
BEGIN_NETWORK_TABLE( CWeaponHatchet, DT_WeaponHatchet )
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA( CWeaponHatchet )
END_PREDICTION_DATA()
LINK_ENTITY_TO_CLASS( weapon_hatchet, CWeaponHatchet );
PRECACHE_WEAPON_REGISTER( weapon_hatchet );
#ifndef CLIENT_DLL
acttable_t CWeaponHatchet::m_acttable[] =
{
{ ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_SLAM, true },
{ ACT_HL2MP_IDLE, ACT_HL2MP_IDLE_MELEE, false },
{ ACT_HL2MP_RUN, ACT_HL2MP_RUN_MELEE, false },
{ ACT_HL2MP_IDLE_CROUCH, ACT_HL2MP_IDLE_CROUCH_MELEE, false },
{ ACT_HL2MP_WALK_CROUCH, ACT_HL2MP_WALK_CROUCH_MELEE, false },
{ ACT_HL2MP_GESTURE_RANGE_ATTACK, ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE, false },
{ ACT_HL2MP_GESTURE_RELOAD, ACT_HL2MP_GESTURE_RELOAD_MELEE, false },
{ ACT_HL2MP_JUMP, ACT_HL2MP_JUMP_MELEE, false },
};
IMPLEMENT_ACTTABLE(CWeaponHatchet);
#endif
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
CWeaponHatchet::CWeaponHatchet( void )
{
}
//-----------------------------------------------------------------------------
// Purpose: Get the damage amount for the animation we're doing
// Input : hitActivity - currently played activity
// Output : Damage amount
//-----------------------------------------------------------------------------
float CWeaponHatchet::GetDamageForActivity( Activity hitActivity )
{
return 25.0f;
}
//-----------------------------------------------------------------------------
// Purpose: Add in a view kick for this weapon
//-----------------------------------------------------------------------------
void CWeaponHatchet::AddViewKick( void )
{
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( pPlayer == NULL )
return;
QAngle punchAng;
punchAng.x = SharedRandomFloat( "hatchetpax", 1.0f, 2.0f );
punchAng.y = SharedRandomFloat( "hatchetpay", -2.0f, -1.0f );
punchAng.z = 0.0f;
pPlayer->ViewPunch( punchAng );
}
#ifndef CLIENT_DLL
//-----------------------------------------------------------------------------
// Animation event handlers
//-----------------------------------------------------------------------------
void CWeaponHatchet::HandleAnimEventMeleeHit( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
// Trace up or down based on where the enemy is...
// But only if we're basically facing that direction
Vector vecDirection;
AngleVectors( GetAbsAngles(), &vecDirection );
Vector vecEnd;
VectorMA( pOperator->Weapon_ShootPosition(), 50, vecDirection, vecEnd );
CBaseEntity *pHurt = pOperator->CheckTraceHullAttack( pOperator->Weapon_ShootPosition(), vecEnd,
Vector(-16,-16,-16), Vector(36,36,36), GetDamageForActivity( GetActivity() ), DMG_CLUB, 0.75 );
// did I hit someone?
if ( pHurt )
{
// play sound
WeaponSound( MELEE_HIT );
// Fake a trace impact, so the effects work out like a player's crowbaw
trace_t traceHit;
UTIL_TraceLine( pOperator->Weapon_ShootPosition(), pHurt->GetAbsOrigin(), MASK_SHOT_HULL, pOperator, COLLISION_GROUP_NONE, &traceHit );
ImpactEffect( traceHit );
}
else
{
WeaponSound( MELEE_MISS );
}
}
//-----------------------------------------------------------------------------
// Animation event
//-----------------------------------------------------------------------------
void CWeaponHatchet::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_MELEE_HIT:
HandleAnimEventMeleeHit( pEvent, pOperator );
break;
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}
//-----------------------------------------------------------------------------
// Attempt to lead the target (needed because citizens can't hit manhacks with the hatchet!)
//-----------------------------------------------------------------------------
ConVar sk_hatchet_lead_time( "sk_hatchet_lead_time", "0.9" );
int CWeaponHatchet::WeaponMeleeAttack1Condition( float flDot, float flDist )
{
// Attempt to lead the target (needed because citizens can't hit manhacks with the hatchet!)
CAI_BaseNPC *pNPC = GetOwner()->MyNPCPointer();
CBaseEntity *pEnemy = pNPC->GetEnemy();
if (!pEnemy)
return COND_NONE;
Vector vecVelocity;
vecVelocity = pEnemy->GetSmoothedVelocity( );
// Project where the enemy will be in a little while
float dt = sk_hatchet_lead_time.GetFloat();
dt += SharedRandomFloat( "hatchetmelee1", -0.3f, 0.2f );
if ( dt < 0.0f )
dt = 0.0f;
Vector vecExtrapolatedPos;
VectorMA( pEnemy->WorldSpaceCenter(), dt, vecVelocity, vecExtrapolatedPos );
Vector vecDelta;
VectorSubtract( vecExtrapolatedPos, pNPC->WorldSpaceCenter(), vecDelta );
if ( fabs( vecDelta.z ) > 70 )
{
return COND_TOO_FAR_TO_ATTACK;
}
Vector vecForward = pNPC->BodyDirection2D( );
vecDelta.z = 0.0f;
float flExtrapolatedDist = Vector2DNormalize( vecDelta.AsVector2D() );
if ((flDist > 64) && (flExtrapolatedDist > 64))
{
return COND_TOO_FAR_TO_ATTACK;
}
float flExtrapolatedDot = DotProduct2D( vecDelta.AsVector2D(), vecForward.AsVector2D() );
if ((flDot < 0.7) && (flExtrapolatedDot < 0.7))
{
return COND_NOT_FACING_ATTACK;
}
return COND_CAN_MELEE_ATTACK1;
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponHatchet::Drop( const Vector &vecVelocity )
{
#ifndef CLIENT_DLL
UTIL_Remove( this );
#endif
}
float CWeaponHatchet::GetRange( void )
{
return hatchet_RANGE;
}
float CWeaponHatchet::GetFireRate( void )
{
return hatchet_REFIRE;
}

View File

@ -1,70 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#ifndef SARENA_WEAPON_HATCHET_H
#define SARENA_WEAPON_HATCHET_H
#pragma once
#include "weapon_hl2mpbasehlmpcombatweapon.h"
#include "weapon_hl2mpbasebasebludgeon.h"
#ifdef CLIENT_DLL
#define CWeaponHatchet C_WeaponHatchet
#endif
//-----------------------------------------------------------------------------
// CWeaponHatchet
//-----------------------------------------------------------------------------
class CWeaponHatchet : public CBaseHL2MPBludgeonWeapon
{
public:
DECLARE_CLASS( CWeaponHatchet, CBaseHL2MPBludgeonWeapon );
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
CWeaponHatchet();
float GetRange( void );
float GetFireRate( void );
void AddViewKick( void );
float GetDamageForActivity( Activity hitActivity );
void SecondaryAttack( void ) { return; }
void Drop( const Vector &vecVelocity );
// Animation event
#ifndef CLIENT_DLL
virtual void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
void HandleAnimEventMeleeHit( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
int WeaponMeleeAttack1Condition( float flDot, float flDist );
#endif
CWeaponHatchet( const CWeaponHatchet & );
private:
};
#endif // HL2MP_WEAPON_CROWBAR_H

View File

@ -1,179 +0,0 @@
#include "cbase.h"
#include "npcevent.h"
#include "in_buttons.h"
#ifdef CLIENT_DLL
#include "c_hl2mp_player.h"
#else
#include "grenade_ar2.h"
#include "hl2mp_player.h"
#include "basegrenade_shared.h"
#endif
#include "weapon_hl2mpbase.h"
#include "weapon_hl2mpbase_machinegun.h"
#ifdef CLIENT_DLL
#define CWeaponLasergun C_WeaponLasergun
#endif
#include "tier0\memdbgon.h"
class CWeaponLasergun : public CHL2MPMachineGun
{
public:
DECLARE_CLASS(CWeaponLasergun, CHL2MPMachineGun);
CWeaponLasergun();
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
void Precache();
void ItemPreFrame();
void ItemBusyFrame();
void ItemPostFrame();
void PrimaryAttack();
void AddViewKick();
void DryFire();
virtual bool Reload(void);
virtual const Vector& GetBulletSpread()
{
static Vector cone = VECTOR_CONE_1DEGREES, npcCone = VECTOR_CONE_1DEGREES;
if (GetOwner() && GetOwner()->IsNPC()) //Always handle NPCs first
return npcCone;
else
return cone;
}
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
CWeaponLasergun(const CWeaponLasergun &);
#endif
private:
float m_flRateOfFire;
};
IMPLEMENT_NETWORKCLASS_ALIASED( WeaponLasergun, DT_WeaponLasergun)
BEGIN_NETWORK_TABLE( CWeaponLasergun, DT_WeaponLasergun)
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA(CWeaponLasergun)
END_PREDICTION_DATA()
LINK_ENTITY_TO_CLASS(weapon_lasergun, CWeaponLasergun);
PRECACHE_WEAPON_REGISTER(weapon_lasergun);
#ifndef CLIENT_DLL
acttable_t CWeaponLasergun::m_acttable[] =
{
{ ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_SMG1, true },
{ ACT_RELOAD, ACT_RELOAD_SMG1, true },
{ ACT_IDLE, ACT_IDLE_SMG1, true },
{ ACT_IDLE_ANGRY, ACT_IDLE_ANGRY_SMG1, true },
{ ACT_WALK, ACT_WALK_RIFLE, true },
{ ACT_WALK_AIM, ACT_WALK_AIM_RIFLE, true },
};
IMPLEMENT_ACTTABLE(CWeaponLasergun);
#endif
CWeaponLasergun::CWeaponLasergun()
{
m_fMinRange1 = 24;
m_fMaxRange1 = 3000;
m_bFiresUnderwater = true;
}
void CWeaponLasergun::Precache()
{
m_flRateOfFire = 0.05f;
#ifndef CLIENT_DLL
PrecacheModel("models/weapons/v_lasergun.mdl", true);
PrecacheModel("models/weapons/w_lasergun.mdl", true);
#endif
BaseClass::Precache();
}
void CWeaponLasergun::DryFire()
{
WeaponSound(EMPTY);
SendWeaponAnim(ACT_VM_DRYFIRE);
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
}
void CWeaponLasergun::ItemPreFrame()
{
BaseClass::ItemPreFrame();
}
void CWeaponLasergun::ItemBusyFrame()
{
BaseClass::ItemBusyFrame();
}
void CWeaponLasergun::ItemPostFrame()
{
BaseClass::ItemPostFrame();
}
void CWeaponLasergun::PrimaryAttack()
{
CBasePlayer* pPlayer = ToBasePlayer(GetOwner()); //This gets the current player holding the weapon
Vector vecSrc = pPlayer->Weapon_ShootPosition(); //This simply just gets the current position of the player.
Vector vecAim = pPlayer->GetAutoaimVector(0.0); //This gets where the player is looking, but also corrected by autoaim.
FireBulletsInfo_t info(1, vecSrc, vecAim, vec3_origin, MAX_TRACE_LENGTH, m_iPrimaryAmmoType);
//if (m_iClip1 <= 0)
if (pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
{
if (!m_bFireOnEmpty)
{
Reload();
}
else
{
WeaponSound(EMPTY);
m_flNextPrimaryAttack = 0.15;
}
return;
}
pPlayer->FireBullets(info);
//This is a lengthy one. All of the args in here are data for our bullet. We could simply use
//BaseClass::PrimaryAttack, but this gives us no control over how our weapon is fired.
//So instead, we use this and give it all our info for our bullet.
//The next 2 are just where the bullet is being fired from and where it should go.
//Next is how far the bullet is fired, and after that is what type of ammo we use.
//After this is the tracer freq, which really doesnt matter.
//Next is the id of the entity firing the weapon, and the attachment id. These 2 dont really matter.
//Next is how much damage each bullet should do, which is 30.
//Next is what entity is firing the bullet, again.
//The final 2 define wether our first shot should be accurate, and wether this is the primary attack.
WeaponSound(SINGLE); //This makes our weapon emit the single show sound.
SendWeaponAnim(ACT_VM_PRIMARYATTACK); //This sends the animation for us shooting.
m_flNextPrimaryAttack = gpGlobals->curtime + m_flRateOfFire; //This defines when our next attack should be
//m_iClip1--;
pPlayer->RemoveAmmo(1, m_iPrimaryAmmoType);
//AddViewKick(); //Don't forget to add our viewkick
}
void CWeaponLasergun::AddViewKick()
{
CBasePlayer* pPlayer = ToBasePlayer(GetOwner());
QAngle punch;
punch += QAngle(-0.2, 0.0, 0.0);
pPlayer->ViewPunch(punch);
}
bool CWeaponLasergun::Reload()
{
bool fRet = DefaultReload(GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD);
if (fRet)
WeaponSound(RELOAD);
return fRet;
}

View File

@ -1,177 +0,0 @@
#include "cbase.h"
#include "npcevent.h"
#include "in_buttons.h"
#ifdef CLIENT_DLL
#include "c_hl2mp_player.h"
#else
#include "hl2mp_player.h"
#endif
#include "weapon_hl2mpbasehlmpcombatweapon.h"
//#include "particle_parse.h"
#ifdef CLIENT_DLL
#define CWeaponRailgun C_WeaponRailgun
#endif
//-----------------------------------------------------------------------------
// CWeaponRailgun
//-----------------------------------------------------------------------------
class CWeaponRailgun : public CBaseHL2MPCombatWeapon
{
DECLARE_CLASS(CWeaponRailgun, CBaseHL2MPCombatWeapon);
public:
CWeaponRailgun(void);
//void Precache(void);
void PrimaryAttack(void);
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
private:
CWeaponRailgun(const CWeaponRailgun&);
};
IMPLEMENT_NETWORKCLASS_ALIASED(WeaponRailgun, DT_WeaponRailgun)
BEGIN_NETWORK_TABLE(CWeaponRailgun, DT_WeaponRailgun)
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA(CWeaponRailgun)
END_PREDICTION_DATA()
LINK_ENTITY_TO_CLASS(weapon_railgun, CWeaponRailgun);
PRECACHE_WEAPON_REGISTER(weapon_railgun);
#ifndef CLIENT_DLL
acttable_t CWeaponRailgun::m_acttable[] =
{
{ ACT_HL2MP_IDLE, ACT_HL2MP_IDLE_PISTOL, false },
{ ACT_HL2MP_RUN, ACT_HL2MP_RUN_PISTOL, false },
{ ACT_HL2MP_IDLE_CROUCH, ACT_HL2MP_IDLE_CROUCH_PISTOL, false },
{ ACT_HL2MP_WALK_CROUCH, ACT_HL2MP_WALK_CROUCH_PISTOL, false },
{ ACT_HL2MP_GESTURE_RANGE_ATTACK, ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, false },
{ ACT_HL2MP_GESTURE_RELOAD, ACT_HL2MP_GESTURE_RELOAD_PISTOL, false },
{ ACT_HL2MP_JUMP, ACT_HL2MP_JUMP_PISTOL, false },
{ ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_PISTOL, false },
};
IMPLEMENT_ACTTABLE(CWeaponRailgun);
#endif
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CWeaponRailgun::CWeaponRailgun(void)
{
m_bReloadsSingly = false;
m_bFiresUnderwater = false;
}
//void CWeaponRailgun::Precache(void)
//{
//PrecacheParticleSystem("railbeam");
//BaseClass::Precache();
//}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponRailgun::PrimaryAttack(void)
{
// Only the player fires this way so we can cast
CBasePlayer* pPlayer = ToBasePlayer(GetOwner());
if (!pPlayer)
{
return;
}
//if (m_iClip1 <= 0)
if (pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <=0)
{
if (!m_bFireOnEmpty)
{
Reload();
}
else
{
WeaponSound(EMPTY);
m_flNextPrimaryAttack = 0.15;
}
return;
}
WeaponSound(SINGLE);
pPlayer->DoMuzzleFlash();
SendWeaponAnim(ACT_VM_PRIMARYATTACK);
pPlayer->SetAnimation(PLAYER_ATTACK1);
m_flNextPrimaryAttack = gpGlobals->curtime + 1.5;
m_flNextSecondaryAttack = gpGlobals->curtime + 1.5;
//m_iClip1--;
pPlayer->RemoveAmmo(1, m_iPrimaryAmmoType);
Vector vecSrc = pPlayer->Weapon_ShootPosition();
Vector vecAiming = pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES);
FireBulletsInfo_t info(1, vecSrc, vecAiming, vec3_origin, MAX_TRACE_LENGTH, m_iPrimaryAmmoType);
info.m_pAttacker = pPlayer;
// Particle Tracer
//Vector vecShootOrigin2; //The origin of the shot
//QAngle angShootDir2; //The angle of the shot
//We need to figure out where to place the particle effect, so lookup where the muzzle is
//Vector vForward, vRight, vUp;
//CBasePlayer* pOwner = ToBasePlayer(GetOwner());
//pOwner->EyeVectors(&vForward, &vRight, &vUp);
//Vector vecSrc = pPlayer->Weapon_ShootPosition() + vForward * 12.0f + vRight * 6.0f + vUp * -3.0f;
//Vector vecSrc = vecShootOrigin2 + vForward * 20.0f + vUp * 25.0f;
//GetAttachment(LookupAttachment("muzzle"), vecShootOrigin2, angShootDir2);
//DispatchParticleEffect("railbeam", pPlayer->Weapon_ShootPosition(), angShootDir2);
//CNewParticleEffect* pEffect = ParticleProp()->FindEffect("railbeam");
//pEffect->SetControlPoint(1, vecShootOrigin2 + vForward * 100);
// Fire the bullets, and force the first shot to be perfectly accuracy
pPlayer->FireBullets(info);
//Disorient the player
QAngle angles = pPlayer->GetLocalAngles();
//angles.x += random->RandomInt(-1, 1);
//angles.y += random->RandomInt(-1, 1);
//angles.z = 0;
#ifndef CLIENT_DLL
pPlayer->SnapEyeAngles(angles);
#endif
//pPlayer->ViewPunch(QAngle(-8, random->RandomFloat(-2, 2), 0));
if (!m_iClip1 && pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
}

View File

@ -1,172 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "npcevent.h"
#include "in_buttons.h"
#ifdef CLIENT_DLL
#include "c_hl2mp_player.h"
#else
#include "projectile_rocket.h"
#include "hl2mp_player.h"
#include "basegrenade_shared.h"
#endif
#include "weapon_hl2mpbase.h"
#include "weapon_hl2mpbase_machinegun.h"
#include "weapon_hl2mpbasehlmpcombatweapon.h"
#define PROJECTILE_ROCKET_DAMAGE 100.0f
#define PROJECTILE_ROCKET_RADIUS 250.0f
#ifdef CLIENT_DLL
#define CWeaponRocketlauncher C_WeaponRocketlauncher
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// CWeaponRocketlauncher
//-----------------------------------------------------------------------------
class CWeaponRocketlauncher : public CBaseHL2MPCombatWeapon
{
DECLARE_CLASS(CWeaponRocketlauncher, CBaseHL2MPCombatWeapon);
public:
CWeaponRocketlauncher(void);
void PrimaryAttack(void);
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
private:
CWeaponRocketlauncher(const CWeaponRocketlauncher&);
};
IMPLEMENT_NETWORKCLASS_ALIASED(WeaponRocketlauncher, DT_WeaponRocketlauncher)
BEGIN_NETWORK_TABLE(CWeaponRocketlauncher, DT_WeaponRocketlauncher)
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA(CWeaponRocketlauncher)
END_PREDICTION_DATA()
LINK_ENTITY_TO_CLASS(weapon_Rocketlauncher, CWeaponRocketlauncher);
PRECACHE_WEAPON_REGISTER(weapon_Rocketlauncher);
#ifndef CLIENT_DLL
acttable_t CWeaponRocketlauncher::m_acttable[] =
{
{ ACT_HL2MP_IDLE, ACT_HL2MP_IDLE_PISTOL, false },
{ ACT_HL2MP_RUN, ACT_HL2MP_RUN_PISTOL, false },
{ ACT_HL2MP_IDLE_CROUCH, ACT_HL2MP_IDLE_CROUCH_PISTOL, false },
{ ACT_HL2MP_WALK_CROUCH, ACT_HL2MP_WALK_CROUCH_PISTOL, false },
{ ACT_HL2MP_GESTURE_RANGE_ATTACK, ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, false },
{ ACT_HL2MP_GESTURE_RELOAD, ACT_HL2MP_GESTURE_RELOAD_PISTOL, false },
{ ACT_HL2MP_JUMP, ACT_HL2MP_JUMP_PISTOL, false },
{ ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_PISTOL, false },
};
IMPLEMENT_ACTTABLE(CWeaponRocketlauncher);
#endif
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CWeaponRocketlauncher::CWeaponRocketlauncher(void)
{
m_bReloadsSingly = false;
m_bFiresUnderwater = false;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponRocketlauncher::PrimaryAttack(void)
{
// Only the player fires this way so we can cast
CBasePlayer* pPlayer = ToBasePlayer(GetOwner());
if (pPlayer == NULL)
return;
//Must have ammo
if ((pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0) || (pPlayer->GetWaterLevel() == 3))
{
SendWeaponAnim(ACT_VM_DRYFIRE);
BaseClass::WeaponSound(EMPTY);
m_flNextPrimaryAttack = gpGlobals->curtime + 0.5f;
return;
}
if (m_bInReload)
m_bInReload = false;
// MUST call sound before removing a round from the clip of a CMachineGun
BaseClass::WeaponSound(WPN_DOUBLE);
Vector vecShootOrigin2;
QAngle angShootDir2;
this->GetAttachment(LookupAttachment("muzzle"), vecShootOrigin2, angShootDir2);
Vector vForward, vRight, vUp;
CBasePlayer* pOwner = ToBasePlayer(GetOwner());
pOwner->EyeVectors(&vForward, &vRight, &vUp);
//Vector vecSrc = pPlayer->Weapon_ShootPosition() + vForward * 12.0f + vRight * 6.0f + vUp * -3.0f;
//Vector vecSrc = vecShootOrigin2 + vForward * 20.0f + vUp * 25.0f;
Vector vecSrc = pPlayer->Weapon_ShootPosition();
Vector vecThrow;
// Don't autoaim on grenade tosses
AngleVectors(pPlayer->EyeAngles() + pPlayer->GetPunchAngle(), &vecThrow);
VectorScale(vecThrow, 2000.0f, vecThrow);
#ifndef CLIENT_DLL
//Create the grenade
CProjectileRocket* pRocket = (CProjectileRocket*)Create("projectile_rocket", vecSrc, vec3_angle, pPlayer);
pRocket->SetAbsVelocity(vecThrow);
pRocket->SetLocalAngularVelocity(RandomAngle(-400, 400));
pRocket->SetMoveType(MOVETYPE_FLY, MOVECOLLIDE_FLY_BOUNCE);
pRocket->SetThrower(GetOwner());
pRocket->SetDamage(PROJECTILE_ROCKET_DAMAGE);
pRocket->SetDamageRadius(PROJECTILE_ROCKET_RADIUS);
#endif
SendWeaponAnim(ACT_VM_PRIMARYATTACK);
// player "shoot" animation
pPlayer->SetAnimation(PLAYER_ATTACK1);
// Decrease ammo
pPlayer->RemoveAmmo(1, m_iPrimaryAmmoType);
//m_nNumShotsFired++;
// Can shoot again immediately
m_flNextPrimaryAttack = gpGlobals->curtime + 1.0f;
}

View File

@ -1,192 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "npcevent.h"
#include "in_buttons.h"
#ifdef CLIENT_DLL
#include "c_hl2mp_player.h"
#else
#include "hl2mp_player.h"
#endif
#include "weapon_hl2mpbasehlmpcombatweapon.h"
#ifdef CLIENT_DLL
#define CWeaponShottie C_WeaponShottie
#endif
//extern ConVar sk_auto_reload_time;
//extern ConVar sk_plr_num_shotgun_pellets;
class CWeaponShottie : public CBaseHL2MPCombatWeapon
{
public:
DECLARE_CLASS(CWeaponShottie, CBaseHL2MPCombatWeapon);
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
private:
public:
virtual const Vector& GetBulletSpread(void)
{
static Vector cone = VECTOR_CONE_10DEGREES;
return cone;
}
virtual int GetMinBurst() { return 1; }
virtual int GetMaxBurst() { return 3; }
void PrimaryAttack(void);
virtual float GetFireRate(void) { return 0.7; };
#ifndef CLIENT_DLL
DECLARE_ACTTABLE();
#endif
CWeaponShottie(void);
private:
CWeaponShottie(const CWeaponShottie&);
};
IMPLEMENT_NETWORKCLASS_ALIASED(WeaponShottie, DT_WeaponShottie)
BEGIN_NETWORK_TABLE(CWeaponShottie, DT_WeaponShottie)
#ifdef CLIENT_DLL
#else
#endif
END_NETWORK_TABLE()
#ifdef CLIENT_DLL
BEGIN_PREDICTION_DATA(CWeaponShottie)
END_PREDICTION_DATA()
#endif
LINK_ENTITY_TO_CLASS(weapon_shottie, CWeaponShottie);
PRECACHE_WEAPON_REGISTER(weapon_shottie);
#ifndef CLIENT_DLL
acttable_t CWeaponShottie::m_acttable[] =
{
{ ACT_HL2MP_IDLE, ACT_HL2MP_IDLE_SHOTGUN, false },
{ ACT_HL2MP_RUN, ACT_HL2MP_RUN_SHOTGUN, false },
{ ACT_HL2MP_IDLE_CROUCH, ACT_HL2MP_IDLE_CROUCH_SHOTGUN, false },
{ ACT_HL2MP_WALK_CROUCH, ACT_HL2MP_WALK_CROUCH_SHOTGUN, false },
{ ACT_HL2MP_GESTURE_RANGE_ATTACK, ACT_HL2MP_GESTURE_RANGE_ATTACK_SHOTGUN, false },
{ ACT_HL2MP_GESTURE_RELOAD, ACT_HL2MP_GESTURE_RELOAD_SHOTGUN, false },
{ ACT_HL2MP_JUMP, ACT_HL2MP_JUMP_SHOTGUN, false },
{ ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_SHOTGUN, false },
};
IMPLEMENT_ACTTABLE(CWeaponShottie);
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponShottie::PrimaryAttack(void)
{
// Only the player fires this way so we can cast
CBasePlayer* pPlayer = ToBasePlayer(GetOwner());
if (!pPlayer)
{
return;
}
//if (m_iClip1 <= 0)
if (pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
{
if (!m_bFireOnEmpty)
{
Reload();
}
else
{
WeaponSound(EMPTY);
m_flNextPrimaryAttack = 0.15;
}
return;
}
WeaponSound(SINGLE);
pPlayer->DoMuzzleFlash();
SendWeaponAnim(ACT_VM_PRIMARYATTACK);
pPlayer->SetAnimation(PLAYER_ATTACK1);
m_flNextPrimaryAttack = gpGlobals->curtime + 0.75;
m_flNextSecondaryAttack = gpGlobals->curtime + 0.75;
//m_iClip1--;
pPlayer->RemoveAmmo(1, m_iPrimaryAmmoType);
// player "shoot" animation
pPlayer->SetAnimation(PLAYER_ATTACK1);
Vector vecSrc = pPlayer->Weapon_ShootPosition();
Vector vecAiming = pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
FireBulletsInfo_t info(7, vecSrc, vecAiming, GetBulletSpread(), MAX_TRACE_LENGTH, m_iPrimaryAmmoType);
info.m_pAttacker = pPlayer;
pPlayer->FireBullets(info);
//pPlayer->ViewPunch(QAngle(-8, random->RandomFloat(-2, 2), 0));
if (!m_iClip1 && pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CWeaponShottie::CWeaponShottie(void)
{
//m_bReloadsSingly = true;
//m_fMinRange1 = 0.0;
//m_fMaxRange1 = 500;
//m_fMinRange2 = 0.0;
//m_fMaxRange2 = 200;
}
//==================================================
// Purpose:
//==================================================
/*
void CWeaponShotgun::WeaponIdle( void )
{
//Only the player fires this way so we can cast
CBasePlayer *pPlayer = GetOwner()
if ( pPlayer == NULL )
return;
//If we're on a target, play the new anim
if ( pPlayer->IsOnTarget() )
{
SendWeaponAnim( ACT_VM_IDLE_ACTIVE );
}
}
*/

View File

@ -234,7 +234,7 @@ enum CastVote
#define MAX_PLACE_NAME_LENGTH 18
#define MAX_FOV 140 //Max fov
#define MAX_FOV 90
//===================================================================================================================
// Team Defines

View File

@ -52,7 +52,6 @@ void CTakeDamageInfo::Init( CBaseEntity *pInflictor, CBaseEntity *pAttacker, CBa
m_bitsDamageType = bitsDamageType;
m_iDamageCustom = iCustomDamage;
m_flBlastForce = 0;
m_flMaxDamage = flDamage;
m_vecDamageForce = damageForce;
m_vecDamagePosition = damagePosition;

View File

@ -73,9 +73,6 @@ public:
Vector GetReportedPosition() const;
void SetReportedPosition( const Vector &reportedPosition );
void SetBlastForce( float flBlastForceAmount );
float GetBlastForce( void ) const;
int GetDamageType() const;
void SetDamageType( int bitsDamageType );
void AddDamageType( int bitsDamageType );
@ -121,7 +118,6 @@ protected:
EHANDLE m_hInflictor;
EHANDLE m_hAttacker;
EHANDLE m_hWeapon;
float m_flBlastForce; // Pushforce specifically for blast damage
float m_flDamage;
float m_flMaxDamage;
float m_flBaseDamage; // The damage amount before skill leve adjustments are made. Used to get uniform damage forces.
@ -329,16 +325,6 @@ inline void CTakeDamageInfo::SetReportedPosition( const Vector &reportedPosition
m_vecReportedPosition = reportedPosition;
}
inline void CTakeDamageInfo::SetBlastForce(float flBlastForceAmount)
{
m_flBlastForce = flBlastForceAmount;
}
inline float CTakeDamageInfo::GetBlastForce() const
{
return m_flBlastForce;
}
inline void CTakeDamageInfo::SetDamageType( int bitsDamageType )
{

View File

@ -347,7 +347,6 @@ FileWeaponInfo_t::FileWeaponInfo_t()
bShowUsageHint = false;
m_bAllowFlipping = true;
m_bBuiltRightHanded = true;
m_iOwnedPickupAmmo = 0;
}
#ifdef CLIENT_DLL
@ -412,7 +411,6 @@ void FileWeaponInfo_t::Parse( KeyValues *pKeyValuesData, const char *szWeaponNam
m_bBuiltRightHanded = ( pKeyValuesData->GetInt( "BuiltRightHanded", 1 ) != 0 ) ? true : false;
m_bAllowFlipping = ( pKeyValuesData->GetInt( "AllowFlipping", 1 ) != 0 ) ? true : false;
m_bMeleeWeapon = ( pKeyValuesData->GetInt( "MeleeWeapon", 0 ) != 0 ) ? true : false;
m_iOwnedPickupAmmo = pKeyValuesData->GetInt("pickup_ammo", 0);
#if defined(_DEBUG) && defined(HL2_CLIENT_DLL)
// make sure two weapons aren't in the same slot & position

View File

@ -99,8 +99,6 @@ public:
char szAmmo1[MAX_WEAPON_AMMO_NAME]; // "primary" ammo type
char szAmmo2[MAX_WEAPON_AMMO_NAME]; // "secondary" ammo type
int m_iOwnedPickupAmmo; // How much ammo to give when picking a weapon the player already owns
// Sound blocks
char aShootSounds[NUM_SHOOT_SOUND_TYPES][MAX_WEAPON_STRING];

View File

@ -1,64 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29201.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (HL2MP)", "game\client\client_hl2mp.vcxproj", "{17BCE59A-9037-EC8D-433E-F81339E2F1BA}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib\mathlib.vcxproj", "{BAB92FF0-D72A-D7E5-1988-74628D39B94F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Raytrace", "raytrace\raytrace.vcxproj", "{95D67225-8415-236F-9128-DCB171B7DEC6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (HL2MP)", "game\server\server_hl2mp.vcxproj", "{33B7DFDC-BECB-3678-1190-6C951E393EB3}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tier1", "tier1\tier1.vcxproj", "{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vgui_controls", "vgui2\vgui_controls\vgui_controls.vcxproj", "{F69B3672-C5E8-CD1A-257F-253A25B5B939}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Debug|x86.ActiveCfg = Debug|Win32
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Debug|x86.Build.0 = Debug|Win32
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Release|x86.ActiveCfg = Release|Win32
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Release|x86.Build.0 = Release|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|x86.ActiveCfg = Debug|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|x86.Build.0 = Debug|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|x86.ActiveCfg = Release|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|x86.Build.0 = Release|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|x86.ActiveCfg = Debug|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|x86.Build.0 = Debug|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|x86.ActiveCfg = Release|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|x86.Build.0 = Release|Win32
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Debug|x86.ActiveCfg = Debug|Win32
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Debug|x86.Build.0 = Debug|Win32
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Release|x86.ActiveCfg = Release|Win32
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Release|x86.Build.0 = Release|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|x86.ActiveCfg = Debug|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|x86.Build.0 = Debug|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|x86.ActiveCfg = Release|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|x86.Build.0 = Release|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|x86.ActiveCfg = Debug|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|x86.Build.0 = Debug|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|x86.ActiveCfg = Release|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1D78039F-6074-40C4-8237-C7B4C2D01F18}
EndGlobalSection
EndGlobal

View File

@ -614,8 +614,8 @@ void CUtlBuffer::GetStringInternal( char *pString, size_t maxLenInChars )
*pString = 0;
return;
}
//Was crashing the game at startup so had to comment this out
//Assert( maxLenInChars != 0 );
Assert( maxLenInChars != 0 );
if ( maxLenInChars == 0 )
{

View File

@ -2404,9 +2404,8 @@ bool CGameMovement::CheckJumpButton( void )
return false;
#endif
//if ( mv->m_nOldButtons & IN_JUMP )
//return false; // don't pogo stick
//bla
if ( mv->m_nOldButtons & IN_JUMP )
return false; // don't pogo stick
// Cannot jump will in the unduck transition.
if ( player->m_Local.m_bDucking && ( player->GetFlags() & FL_DUCKING ) )

View File

@ -1,85 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (HL2)", "game\client\client_hl2.vcxproj", "{09E5D61D-4897-7B98-288B-C87442D14BFF}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (Episodic)", "game\client\client_episodic.vcxproj", "{353A799F-E73F-7A69-07AD-B2AD57F3B775}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib\mathlib.vcxproj", "{BAB92FF0-D72A-D7E5-1988-74628D39B94F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Raytrace", "raytrace\raytrace.vcxproj", "{95D67225-8415-236F-9128-DCB171B7DEC6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (HL2)", "game\server\server_hl2.vcxproj", "{C3EE918E-6836-5578-1FA2-5703048552B9}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (Episodic)", "game\server\server_episodic.vcxproj", "{7855B476-B6D4-535D-F7A9-D623245F8B07}"
ProjectSection(ProjectDependencies) = postProject
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tier1", "tier1\tier1.vcxproj", "{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vgui_controls", "vgui2\vgui_controls\vgui_controls.vcxproj", "{F69B3672-C5E8-CD1A-257F-253A25B5B939}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|x86.ActiveCfg = Debug|Win32
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|x86.Build.0 = Debug|Win32
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|x86.ActiveCfg = Release|Win32
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|x86.Build.0 = Release|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|x86.ActiveCfg = Debug|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|x86.Build.0 = Debug|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|x86.ActiveCfg = Release|Win32
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|x86.Build.0 = Release|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|x86.ActiveCfg = Debug|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|x86.Build.0 = Debug|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|x86.ActiveCfg = Release|Win32
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|x86.Build.0 = Release|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|x86.ActiveCfg = Debug|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Debug|x86.Build.0 = Debug|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|x86.ActiveCfg = Release|Win32
{95D67225-8415-236F-9128-DCB171B7DEC6}.Release|x86.Build.0 = Release|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|x86.ActiveCfg = Debug|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|x86.Build.0 = Debug|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|x86.ActiveCfg = Release|Win32
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|x86.Build.0 = Release|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|x86.ActiveCfg = Debug|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|x86.Build.0 = Debug|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|x86.ActiveCfg = Release|Win32
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|x86.Build.0 = Release|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|x86.ActiveCfg = Debug|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|x86.Build.0 = Debug|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|x86.ActiveCfg = Release|Win32
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|x86.Build.0 = Release|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|x86.ActiveCfg = Debug|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|x86.Build.0 = Debug|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|x86.ActiveCfg = Release|Win32
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {659B5A0E-7CCE-4B7B-A6E8-F54A2490E5BB}
EndGlobalSection
EndGlobal