Compare commits
2 commits
67ed5669c0
...
7d5c1d3c06
Author | SHA1 | Date | |
---|---|---|---|
7d5c1d3c06 | |||
52b452c60b |
4 changed files with 108 additions and 5 deletions
|
@ -9,10 +9,12 @@
|
|||
#include "c_cs_player.h"
|
||||
#include "c_user_message_register.h"
|
||||
#include "cdll_client_int.h"
|
||||
#include "cdll_util.h"
|
||||
#include "convar.h"
|
||||
#include "datacache/imdlcache.h"
|
||||
#include "dbg.h"
|
||||
#include "dt_recv.h"
|
||||
#include "hud_basechat.h"
|
||||
#include "iconvar.h"
|
||||
#include "interpolatedvar.h"
|
||||
#include "mathlib/vector.h"
|
||||
|
@ -70,6 +72,8 @@
|
|||
|
||||
#include "iviewrender_beams.h" // flashlight beam
|
||||
|
||||
#include "cs_hud_chat.h"
|
||||
|
||||
//=============================================================================
|
||||
// HPE_BEGIN:
|
||||
// [menglish] Adding and externing variables needed for the freezecam
|
||||
|
@ -766,6 +770,7 @@ C_CSPlayer::C_CSPlayer() :
|
|||
ListenForGameEvent( "bullet_hit_player" );
|
||||
ListenForGameEvent( "bullet_player_hitboxes" );
|
||||
ListenForGameEvent( "player_lag_hitboxes" );
|
||||
ListenForGameEvent( "player_hurt" );
|
||||
|
||||
m_bIsInsideLagCompensationContext = false;
|
||||
}
|
||||
|
@ -2109,6 +2114,7 @@ void C_CSPlayer::FireEvent( const Vector& origin, const QAngle& angles, int even
|
|||
}
|
||||
|
||||
ConVar cl_debug_duration( "cl_debug_duration", "60" );
|
||||
ConVar cl_enable_hitmarks( "cl_enable_hitmarks", "1" );
|
||||
|
||||
void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||
{
|
||||
|
@ -2497,6 +2503,59 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
{
|
||||
ShowEventHitboxes( cl_debug_duration.GetFloat() );
|
||||
}
|
||||
else if ( cl_enable_hitmarks.GetBool() && FStrEq( event->GetName(), "player_hurt" ) )
|
||||
{
|
||||
const int index = event->GetInt( "attacker" );
|
||||
|
||||
if ( index == GetUserID() && IsLocalPlayer() )
|
||||
{
|
||||
const auto playerUserID = event->GetInt( "userid" );
|
||||
const auto player = ( C_CSPlayer* )UTIL_PlayerByUserId( playerUserID );
|
||||
|
||||
if ( player && !player->IsLocalPlayer() )
|
||||
{
|
||||
auto health_damages = event->GetInt( "dmg_health" );
|
||||
auto armor_damages = event->GetInt( "dmg_armor" );
|
||||
auto hitgroup = event->GetInt( "hitgroup" );
|
||||
|
||||
CLocalPlayerFilter filter;
|
||||
EmitSound( filter, GetSoundSourceIndex(), "Player.Hitmark" );
|
||||
|
||||
CHudChat* hudChat = ( CHudChat* )GET_HUDELEMENT( CHudChat );
|
||||
|
||||
if ( hudChat )
|
||||
{
|
||||
char buffer_armor[256];
|
||||
|
||||
if ( armor_damages > 0 )
|
||||
{
|
||||
V_sprintf_safe( buffer_armor,
|
||||
" and \x7"
|
||||
"FF0000%i \x7"
|
||||
"FFFFFFarmor.",
|
||||
armor_damages );
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_armor[0] = '.';
|
||||
buffer_armor[1] = 0;
|
||||
}
|
||||
|
||||
hudChat->Printf( CHAT_FILTER_NONE,
|
||||
"\7FFFFFFYou hit \x7"
|
||||
"FF00FF%s\x7"
|
||||
"FFFFFF with: \x7"
|
||||
"FF0000%i \x7"
|
||||
"FFFFFFhealth%s",
|
||||
player->GetPlayerName(),
|
||||
health_damages,
|
||||
buffer_armor );
|
||||
|
||||
m_bHasHitPlayer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void C_CSPlayer::SetActivity( Activity eActivity )
|
||||
|
|
|
@ -428,6 +428,7 @@ private:
|
|||
|
||||
QAngle m_angRenderAngles;
|
||||
bool m_bIsInsideLagCompensationContext;
|
||||
bool m_bHasHitPlayer;
|
||||
};
|
||||
|
||||
C_CSPlayer* GetLocalOrInEyeCSPlayer( void );
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "ammodef.h"
|
||||
#include "cs_gamerules.h"
|
||||
|
||||
#define ALLOW_WEAPON_SPREAD_DISPLAY 0
|
||||
#define ALLOW_WEAPON_SPREAD_DISPLAY 1
|
||||
|
||||
#if defined( CLIENT_DLL )
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
ConVar weapon_accuracy_model( "weapon_accuracy_model", "1", FCVAR_REPLICATED );
|
||||
ConVar weapon_accuracy_model( "weapon_accuracy_model", "0", FCVAR_REPLICATED );
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- //
|
||||
|
@ -331,8 +331,8 @@ LINK_ENTITY_TO_CLASS( weapon_cs_base, CWeaponCSBase );
|
|||
ConVar cl_crosshaircolor_b( "cl_crosshaircolor_b", "50", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );
|
||||
|
||||
#if ALLOW_WEAPON_SPREAD_DISPLAY
|
||||
ConVar weapon_debug_spread_show( "weapon_debug_spread_show", "0", FCVAR_CLIENTDLL | FCVAR_DEVELOPMENTONLY, "Enables display of weapon accuracy; 1: show accuracy box, 2: show box with recoil offset" );
|
||||
ConVar weapon_debug_spread_gap( "weapon_debug_spread_gap", "0.67", FCVAR_CLIENTDLL | FCVAR_DEVELOPMENTONLY );
|
||||
ConVar weapon_debug_spread_show( "weapon_debug_spread_show", "0", FCVAR_CLIENTDLL, "Enables display of weapon accuracy; 1: show accuracy box, 2: show box with recoil offset" );
|
||||
ConVar weapon_debug_spread_gap( "weapon_debug_spread_gap", "0.67", FCVAR_CLIENTDLL );
|
||||
#endif
|
||||
|
||||
// [paquin] make sure crosshair scales independent of frame rate
|
||||
|
@ -1230,6 +1230,49 @@ void CWeaponCSBase::DefaultTouch(CBaseEntity *pOther)
|
|||
int y1 = y0 + iBarThickness;
|
||||
DrawCrosshairRect( x0, y0, x1, y1, bAdditive );
|
||||
}
|
||||
|
||||
static float flDisplayCurrentTime = 0.0f;
|
||||
static float flDisplayTime = 1.0F;
|
||||
|
||||
if ( pPlayer->m_bHasHitPlayer )
|
||||
{
|
||||
flDisplayCurrentTime = gpGlobals->curtime + flDisplayTime;
|
||||
pPlayer->m_bHasHitPlayer = false;
|
||||
}
|
||||
|
||||
if ( flDisplayCurrentTime >= gpGlobals->curtime )
|
||||
{
|
||||
float flAlpha = ( flDisplayCurrentTime - gpGlobals->curtime ) / flDisplayTime;
|
||||
int tocenter = 10;
|
||||
int initpos = 16;
|
||||
|
||||
initpos += iCrosshairDistance * 2;
|
||||
tocenter += iCrosshairDistance * 2;
|
||||
|
||||
float oldAlphaMultiplier = vgui::surface()->DrawGetAlphaMultiplier();
|
||||
|
||||
vgui::surface()->DrawSetColor( r, g, b, int(flAlpha * 255.0f) );
|
||||
|
||||
for ( int i = -2; i < 2; i++ )
|
||||
{
|
||||
vgui::surface()->DrawLine( iCenterX - initpos - i,
|
||||
iCenterY - initpos - i,
|
||||
iCenterX - tocenter - i,
|
||||
iCenterY - tocenter - i );
|
||||
vgui::surface()->DrawLine( iCenterX + initpos + i,
|
||||
iCenterY + initpos + i,
|
||||
iCenterX + tocenter + i,
|
||||
iCenterY + tocenter + i );
|
||||
vgui::surface()->DrawLine( iCenterX + initpos + i,
|
||||
iCenterY - initpos - i,
|
||||
iCenterX + tocenter + i,
|
||||
iCenterY - tocenter - i );
|
||||
vgui::surface()->DrawLine( iCenterX - initpos - i,
|
||||
iCenterY + initpos + i,
|
||||
iCenterX - tocenter - i,
|
||||
iCenterY + tocenter + i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ALLOW_WEAPON_SPREAD_DISPLAY
|
||||
|
|
2
gamedata
2
gamedata
|
@ -1 +1 @@
|
|||
Subproject commit 4f281876e11e69fc48372dddbec47c1201bdbb09
|
||||
Subproject commit ad7fda715ea07924ff55faa9aed17b4d3bc7ddf4
|
Loading…
Reference in a new issue