Merge branch 'master' into windows

This commit is contained in:
HappyDOGE
2022-07-27 12:58:56 +03:00
3089 changed files with 38639 additions and 844820 deletions
-720
View File
@@ -1,720 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic in-game abuse reporting
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "abuse_report.h"
#include "abuse_report_ui.h"
#include "filesystem.h"
#include "imageutils.h"
#include "econ/confirm_dialog.h"
#include "econ/econ_notifications.h"
inline bool IsLoggedOnToSteam()
{
return steamapicontext != NULL && steamapicontext->SteamUser() != NULL && steamapicontext->SteamUser()->BLoggedOn();
}
const char CAbuseReportManager::k_rchScreenShotFilenameBase[] = "abuse_report";
const char CAbuseReportManager::k_rchScreenShotFilename[] = "screenshots\\abuse_report.jpg";
//-----------------------------------------------------------------------------
class CEconNotification_AbuseReportReady : public CEconNotification
{
public:
CEconNotification_AbuseReportReady() : CEconNotification()
{
m_bHasTriggered = false;
m_bShowInGame = false;
}
~CEconNotification_AbuseReportReady()
{
//if ( !m_bHasTriggered )
//{
// ReallyTrigger();
//}
}
virtual void MarkForDeletion()
{
m_bHasTriggered = true;
CEconNotification::MarkForDeletion();
}
virtual bool BShowInGameElements() const { return m_bShowInGame; }
virtual EType NotificationType() { return eType_Trigger; }
virtual void Trigger()
{
ReallyTrigger();
MarkForDeletion();
}
virtual const char *GetUnlocalizedHelpText()
{
return "#AbuseReport_Notification_Help";
}
static bool IsNotificationType( CEconNotification *pNotification ) { return dynamic_cast< CEconNotification_AbuseReportReady *>( pNotification ) != NULL; }
static bool IsInGameNotificationType( CEconNotification *pNotification )
{
CEconNotification_AbuseReportReady *n = dynamic_cast< CEconNotification_AbuseReportReady *>( pNotification );
return n != NULL && n->BShowInGameElements();
}
bool m_bShowInGame;
private:
void ReallyTrigger()
{
Assert( !m_bHasTriggered );
m_bHasTriggered = true;
engine->ClientCmd_Unrestricted( "abuse_report_submit" );
}
bool m_bHasTriggered;
};
AbuseIncidentData_t::AbuseIncidentData_t()
{
m_nScreenShotWaitFrames = 5;
}
AbuseIncidentData_t::~AbuseIncidentData_t()
{
}
bool AbuseIncidentData_t::Poll()
{
bool bReady = true;
// Poll player data
for ( int i = 0 ; i < m_vecPlayers.Count() ; ++i )
{
// Make sure sure Steam knows we want the Avatar
PlayerData_t *p = &m_vecPlayers[i];
if ( p->m_iSteamAvatarIndex < 0 )
{
if ( steamapicontext && steamapicontext->SteamUser() )
{
p->m_iSteamAvatarIndex = steamapicontext->SteamFriends()->GetLargeFriendAvatar( p->m_steamID );
if ( p->m_iSteamAvatarIndex < 0 )
{
bReady = false;
}
}
else
{
p->m_iSteamAvatarIndex = 0;
}
}
}
// Screenshot ready?
if ( !m_bitmapScreenshot.IsValid() && m_nScreenShotWaitFrames > 0 )
{
--m_nScreenShotWaitFrames;
// Just load the whole file into a memory buffer
char szFullPath[ MAX_PATH ] = "";
if ( !g_pFullFileSystem->RelativePathToFullPath( CAbuseReportManager::k_rchScreenShotFilename, NULL, szFullPath, ARRAYSIZE(szFullPath) ) )
{
Assert( false ); // ???
}
// Load it
if ( g_pFullFileSystem->FileExists( szFullPath ) )
{
// Load the screenshot into a local buffer
if ( !g_pFullFileSystem->ReadFile( CAbuseReportManager::k_rchScreenShotFilename, NULL, m_bufScreenshotFileData ) )
{
Warning( "Failed to read back %s\n", CAbuseReportManager::k_rchScreenShotFilename );
m_nScreenShotWaitFrames = 0;
}
else
{
ConversionErrorType nErrorCode = ImgUtl_LoadBitmap( szFullPath, m_bitmapScreenshot );
if ( nErrorCode != CE_SUCCESS )
{
Warning( "Abuse report screenshot %s failed to load with error code %d\n", CAbuseReportManager::k_rchScreenShotFilename, nErrorCode );
Assert( nErrorCode == CE_SUCCESS );
m_nScreenShotWaitFrames = 0;
}
else
{
// !KLUDGE! Resize to power of two dimensions, since VGUI doesn't like odd sizes
ImgUtl_ResizeBitmap( m_bitmapScreenshot, 1024, 1024, &m_bitmapScreenshot );
}
}
g_pFullFileSystem->RemoveFile( CAbuseReportManager::k_rchScreenShotFilename );
}
}
return bReady;
}
CAbuseReportManager *g_AbuseReportMgr;
CAbuseReportManager::CAbuseReportManager()
{
m_pIncidentData = NULL;
m_bTestReport = false;
m_eIncidentDataStatus = k_EIncidentDataStatus_None;
m_bReportUIPending = false;
// We're the singleton --- set global pointer
Assert( g_AbuseReportMgr == NULL );
g_AbuseReportMgr = this;
m_timeLastReportReadyNotification = 0.0;
m_adrCurrentServer.Clear();
}
CAbuseReportManager::~CAbuseReportManager()
{
Assert( m_pIncidentData == NULL );
}
char const *CAbuseReportManager::Name()
{
return "AbuseRepotManager";
}
bool CAbuseReportManager::Init()
{
// Clean out any temporary files
Assert( m_pIncidentData == NULL );
DestroyIncidentData();
ListenForGameEvent( "teamplay_round_win" );
ListenForGameEvent( "tf_game_over" );
ListenForGameEvent( "player_death" );
ListenForGameEvent( "server_spawn" );
return true;
}
void CAbuseReportManager::LevelShutdownPreEntity()
{
// Don't keep the dialog open across a level transition. Don't discard their
// report data, but let's kill the dialog
if ( g_AbuseReportDlg.Get() != NULL )
{
Warning( "Abuse report dialog open during level shutdown. Closing it.\n" );
g_AbuseReportDlg.Get()->Close();
}
// And clear the 'pending' flag
m_bReportUIPending = false;
}
void CAbuseReportManager::FireGameEvent( IGameEvent *event )
{
//C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
const char *eventname = event->GetName();
if ( !eventname || !eventname[0] )
return;
if (
!Q_strcmp( "teamplay_round_win", eventname )
|| !Q_strcmp( "tf_game_over", eventname )
) {
// Periodically remind them that they have a report ready to file
CheckCreateReportReadyNotification( 60.0 * 5.0, true, 10.0f );
}
else if ( !Q_strcmp( "player_death", eventname ) )
{
// In some maps, the round just never ends.
// So make sure we do remind them every now and then about this.
// Just not too often
CheckCreateReportReadyNotification( 60.0 * 20.0, true, 5.0f );
}
else if ( !Q_strcmp( "server_spawn", eventname ) )
{
m_adrCurrentServer.Clear();
m_adrCurrentServer.SetFromString( event->GetString( "address", "" ), false );
m_adrCurrentServer.SetPort( event->GetInt( "port", 0 ) );
m_steamIDCurrentServer = CSteamID();
if ( steamapicontext && steamapicontext->SteamUser() && GetUniverse() != k_EUniverseInvalid )
{
m_steamIDCurrentServer.SetFromString( event->GetString( "steamid", "" ), GetUniverse() );
}
}
}
void CAbuseReportManager::Shutdown()
{
// Close the dialog, if any
LevelShutdownPreEntity();
DestroyIncidentData();
// Clear global pointer
Assert( g_AbuseReportMgr == this );
if ( g_AbuseReportMgr == this )
{
g_AbuseReportMgr = NULL;
}
}
void CAbuseReportManager::Update( float frametime )
{
// if a dialog is already displayed, make sure we don't try to activate another
if ( g_AbuseReportDlg.Get() != NULL )
{
m_bReportUIPending = false;
}
// Poll report data, if any
if ( m_pIncidentData != NULL )
{
if ( m_eIncidentDataStatus == k_EIncidentDataStatus_Preparing )
{
if ( m_pIncidentData->Poll() )
{
m_eIncidentDataStatus = k_EIncidentDataStatus_Ready;
CheckCreateReportReadyNotification( 1.0f, true, 7.0f );
}
}
else
{
Assert( m_eIncidentDataStatus == k_EIncidentDataStatus_Ready );
}
if ( m_eIncidentDataStatus == k_EIncidentDataStatus_Ready && m_bReportUIPending )
{
m_bReportUIPending = false;
ActivateSubmitReportUI();
}
}
else
{
m_bReportUIPending = false;
}
// Re-create notification constantly in the menu.
// While in game, we will only popup notifications
// periodically at round end or player death
CheckCreateReportReadyNotification( 10.0, false, 999.0f );
}
void CAbuseReportManager::SubmitReportUIRequested()
{
if ( g_AbuseReportDlg.Get() != NULL )
{
Assert( g_AbuseReportDlg.Get() == NULL );
return;
}
// If no report data already, then create some
if ( m_pIncidentData == NULL )
{
QueueReport();
if ( m_pIncidentData == NULL )
{
// Failed
return;
}
}
// Set flag to bring up the reporting UI at earliest opportunity,
// once all data has been fetched asynchronously
m_bReportUIPending = true;
}
bool CAbuseReportManager::CreateAndPopulateIncident()
{
Assert( m_pIncidentData == NULL );
// by default, just create the base class version
m_pIncidentData = new AbuseIncidentData_t;
// And populate it
return PopulateIncident();
}
bool CAbuseReportManager::PopulateIncident()
{
if ( m_pIncidentData == NULL )
{
Assert( m_pIncidentData );
return false;
}
// Queue a screenshot
CUtlString cmd;
cmd.Format( "__screenshot_internal \"%s\"", k_rchScreenShotFilenameBase );
engine->ClientCmd_Unrestricted( cmd );
// Set status as preparing
m_eIncidentDataStatus = k_EIncidentDataStatus_Preparing;
m_pIncidentData->m_bCanReportGameServer = false;
m_pIncidentData->m_adrGameServer.Clear();
if (
m_adrCurrentServer.IsValid()
&& !m_adrCurrentServer.IsLocalhost()
&& m_steamIDCurrentServer.IsValid()
&& ( !m_adrCurrentServer.IsReservedAdr() || m_steamIDCurrentServer.GetEUniverse() != k_EUniversePublic )
)
{
m_pIncidentData->m_adrGameServer = m_adrCurrentServer;
m_pIncidentData->m_steamIDGameServer = m_steamIDCurrentServer;
m_pIncidentData->m_bCanReportGameServer = true;
}
m_pIncidentData->m_matWorldToClip = engine->WorldToScreenMatrix();
// Add in players
for (int i = 1 ; i <= gpGlobals->maxClients ; ++i )
{
CBasePlayer *player = UTIL_PlayerByIndex( i );
#ifndef _DEBUG
// Skip local players
if ( player != NULL && player->IsLocalPlayer() )
{
continue;
}
#endif
// Get player info from the engine. This works even if they haven't spawned yet.
player_info_t pi;
if ( !engine->GetPlayerInfo( i, &pi ) )
{
continue;
}
if ( pi.fakeplayer )
{
continue;
}
if ( pi.friendsID == 0 )
{
continue;
}
CSteamID steamID( pi.friendsID, 1, GetUniverse(), k_EAccountTypeIndividual );
if ( !steamID.IsValid() )
{
Assert( steamID.IsValid() );
continue;
}
int arrayIndex = m_pIncidentData->m_vecPlayers.AddToTail();
AbuseIncidentData_t::PlayerData_t *p = &m_pIncidentData->m_vecPlayers[ arrayIndex ];
p->m_iClientIndex = i;
p->m_steamID = steamID;
p->m_sPersona = pi.name;
p->m_bHasEntity = false;
p->m_bRenderBoundsValid = false;
p->m_screenBoundsMin.x = p->m_screenBoundsMin.y = 1.0f;
p->m_screenBoundsMax.x = p->m_screenBoundsMax.y = 0.0f;
if ( player==NULL )
{
continue;
}
p->m_bHasEntity = true;
player->GetRenderBounds( p->m_vecRenderBoundsMin, p->m_vecRenderBoundsMax );
p->m_matModelToWorld.CopyFrom3x4( player->RenderableToWorldTransform() );
MatrixMultiply( m_pIncidentData->m_matWorldToClip, p->m_matModelToWorld, p->m_matModelToClip );
// Gather up screen extents
p->m_bRenderBoundsValid = false;
for ( int j = 0 ; j < 8 ; ++j )
{
// Get corner point in model space
Vector4D modelCorner(
( j & 1 ) ? p->m_vecRenderBoundsMax.x : p->m_vecRenderBoundsMin.x,
( j & 2 ) ? p->m_vecRenderBoundsMax.y : p->m_vecRenderBoundsMin.y,
( j & 4 ) ? p->m_vecRenderBoundsMax.z : p->m_vecRenderBoundsMin.z,
1.0f
);
// Transform to clip space
Vector4D clipCorner;
Vector4DMultiply( p->m_matModelToClip, modelCorner, clipCorner );
//Msg( "%6.3f, %6.3f, %6.3f, %6.3f\n", clipCorner[0], clipCorner[1], clipCorner[2], clipCorner[3] );
// If all points behind near clip plane, don't try to
// figure out screen space bounds
if ( clipCorner[3] > .1f )
{
p->m_bRenderBoundsValid = true;
}
// Push w forward to "near clip plane"
float w = MAX( clipCorner[3], .1f );
// Divide by w to project, and convert normalized device coordinates
// where the view volume is (-1...1), to normalized screen coords, where
// they are from 0...1
float x = ( clipCorner[0] / w + 1.0f ) / 2.0f;
float y = ( -clipCorner[1] / w + 1.0f ) / 2.0f;
p->m_screenBoundsMin.x = MIN( p->m_screenBoundsMin.x, x );
p->m_screenBoundsMax.x = MAX( p->m_screenBoundsMax.x, x );
p->m_screenBoundsMin.y = MIN( p->m_screenBoundsMin.y, y );
p->m_screenBoundsMax.y = MAX( p->m_screenBoundsMax.y, y );
}
// Clip projected rect to the screen
if ( p->m_bRenderBoundsValid )
{
p->m_screenBoundsMin.x = MAX( p->m_screenBoundsMin.x, 0.0f );
p->m_screenBoundsMax.x = MIN( p->m_screenBoundsMax.x, 1.0f );
p->m_screenBoundsMin.y = MAX( p->m_screenBoundsMin.y, 0.0f );
p->m_screenBoundsMax.y = MIN( p->m_screenBoundsMax.y, 1.0f );
p->m_bRenderBoundsValid =
p->m_screenBoundsMin.x + .01f < p->m_screenBoundsMax.x
&& p->m_screenBoundsMin.y + .01f < p->m_screenBoundsMax.y;
}
// Sanity check that we agree on what their steam ID is!
if ( player->GetSteamID( &steamID ) )
{
Assert( p->m_steamID == steamID );
}
}
// Test harness: add in a handful of fake players
#ifdef _DEBUG
if ( m_bTestReport )
{
int arrayIndex = m_pIncidentData->m_vecPlayers.AddToTail();
AbuseIncidentData_t::PlayerData_t *p = &m_pIncidentData->m_vecPlayers[ arrayIndex ];
p->m_iClientIndex = -1;
p->m_sPersona = "Lippencott";
p->m_steamID.SetFromUint64( 148618791998333672 );
arrayIndex = m_pIncidentData->m_vecPlayers.AddToTail();
p = &m_pIncidentData->m_vecPlayers[ arrayIndex ];
p->m_iClientIndex = -1;
p->m_sPersona = "EricS";
p->m_steamID.SetFromUint64( 148618791998195668 );
arrayIndex = m_pIncidentData->m_vecPlayers.AddToTail();
p = &m_pIncidentData->m_vecPlayers[ arrayIndex ];
p->m_iClientIndex = -1;
p->m_sPersona = "Sarenya";
p->m_steamID.SetFromUint64( 148618791998429832 );
arrayIndex = m_pIncidentData->m_vecPlayers.AddToTail();
p = &m_pIncidentData->m_vecPlayers[ arrayIndex ];
p->m_iClientIndex = -1;
p->m_sPersona = "fletch";
p->m_steamID.SetFromUint64( 148618791998436114 );
{
AbuseIncidentData_t::PlayerImage_t img;
img.m_eType = AbuseIncidentData_t::k_PlayerImageType_UGC;
img.m_hUGCHandle = 6978249415967519;
p->m_vecImages.AddToTail( img );
}
if ( !m_pIncidentData->m_bCanReportGameServer)
{
m_pIncidentData->m_adrGameServer.SetFromString( "123.45.67.89:27015", false );
m_pIncidentData->m_steamIDGameServer = CSteamID( 12345, 0, GetUniverse(), k_EAccountTypeAnonGameServer );
m_pIncidentData->m_bCanReportGameServer = true;
}
}
#endif
// Make sure there is at least one other person we could file a report against!
if ( m_pIncidentData->m_vecPlayers.Count() < 1 )
{
Warning( "No players to accuse of abuse, cannot file report\n" );
return false;
}
return true;
}
void CAbuseReportManager::DestroyIncidentData()
{
if ( m_pIncidentData != NULL )
{
delete m_pIncidentData;
m_pIncidentData = NULL;
}
m_eIncidentDataStatus = k_EIncidentDataStatus_None;
// Get rid of any existing screenshot file, both locally
// and in the cloud. We don't want this to count against
// our quota
if ( steamapicontext && steamapicontext->SteamRemoteStorage() && steamapicontext->SteamRemoteStorage()->FileExists( k_rchScreenShotFilename ) )
{
steamapicontext->SteamRemoteStorage()->FileDelete( k_rchScreenShotFilename );
}
if ( g_pFullFileSystem->FileExists( k_rchScreenShotFilename ) ) // !KLUDGE! To prevent warning if the file doesn't exist!
{
g_pFullFileSystem->RemoveFile( k_rchScreenShotFilename );
}
m_timeLastReportReadyNotification = 0.0;
// Make sure we don't have any notifications queued
NotificationQueue_Remove( &CEconNotification_AbuseReportReady::IsNotificationType );
}
void CAbuseReportManager::QueueReport()
{
// Dialog is already active?
if ( g_AbuseReportDlg.Get() != NULL )
{
Warning( "Cannot capture another incident report. Submission dialog is active.\n" );
return;
}
// Destroy any existing data
DestroyIncidentData();
// Make sure we're logged on to Steam
if ( !IsLoggedOnToSteam() )
{
g_AbuseReportMgr->ShowNoSteamErrorMessage();
return;
}
if ( CreateAndPopulateIncident() )
{
Msg( "Captured data for abuse report.\n");
}
else
{
Warning( "Failed to captured data for abuse report.\n");
DestroyIncidentData();
}
}
void CAbuseReportManager::ShowNoSteamErrorMessage()
{
ShowMessageBox( "#AbuseReport_NoSteamTitle", "#AbuseReport_NoSteamMessage", "#GameUI_OK" );
}
void CAbuseReportManager::CheckCreateReportReadyNotification( float flMinSecondsSinceLastNotification, bool bInGame, float flLifetime )
{
// We have to have some data ready
if ( m_pIncidentData == NULL || m_eIncidentDataStatus != k_EIncidentDataStatus_Ready )
{
return;
}
// Don't pester them if they are already trying to do something about it
if ( g_AbuseReportDlg.Get() != NULL || m_bReportUIPending )
{
return;
}
// Already notified them too recently?
if ( m_timeLastReportReadyNotification != 0.0 && Plat_FloatTime() < m_timeLastReportReadyNotification + flMinSecondsSinceLastNotification )
{
return;
}
// Already a notification in the queue?
if ( bInGame )
{
if ( NotificationQueue_Count( &CEconNotification_AbuseReportReady::IsInGameNotificationType ) > 0 )
{
return;
}
}
else
{
if ( NotificationQueue_Count( &CEconNotification_AbuseReportReady::IsNotificationType ) > 0 )
{
return;
}
}
CreateReportReadyNotification( bInGame, flLifetime );
}
void CAbuseReportManager::CreateReportReadyNotification( bool bInGame, float flLifetime )
{
NotificationQueue_Remove( &CEconNotification_AbuseReportReady::IsNotificationType );
CEconNotification_AbuseReportReady *pNotification = new CEconNotification_AbuseReportReady();
pNotification->SetText( "AbuseReport_Notification" );
pNotification->SetLifetime( flLifetime );
pNotification->m_bShowInGame = bInGame;
NotificationQueue_Add( pNotification );
m_timeLastReportReadyNotification = Plat_FloatTime();
}
CON_COMMAND_F( abuse_report_queue, "Capture data for abuse report and queue for submission. Use abose_report_submit to activate UI to submit the report", FCVAR_DONTRECORD )
{
if ( !g_AbuseReportMgr )
{
Warning( "abuse_report_queue: No abuse report manager, cannot create report.\n" );
return;
}
g_AbuseReportMgr->QueueReport();
}
CON_COMMAND_F( abuse_report_submit, "Activate UI to submit queued report. Use abuse_report_queue to capture data for the report the report", FCVAR_DONTRECORD )
{
if ( !g_AbuseReportMgr )
{
Warning( "abuse_report_submit: No abuse report manager, cannot submit report.\n" );
return;
}
// Make sure we're logged on to Steam
if ( !IsLoggedOnToSteam() )
{
g_AbuseReportMgr->ShowNoSteamErrorMessage();
return;
}
if ( g_AbuseReportDlg.Get() != NULL )
{
// Dialog is already active
return;
}
g_AbuseReportMgr->SubmitReportUIRequested();
}
// Test harness
#ifdef _DEBUG
CON_COMMAND_F( abuse_report_test, "Make a test abuse incident and activate UI", FCVAR_DONTRECORD )
{
if ( !g_AbuseReportMgr )
{
Assert( g_AbuseReportMgr );
return;
}
g_AbuseReportMgr->m_bTestReport = true;
g_AbuseReportMgr->QueueReport();
g_AbuseReportMgr->m_bTestReport = false;
engine->ClientCmd_Unrestricted( "abuse_report_submit" );
}
#endif
-274
View File
@@ -1,274 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic in-game abuse reporting
//
// $NoKeywords: $
//=============================================================================//
#ifndef ABUSE_REPORT_H
#define ABUSE_REPORT_H
#ifdef _WIN32
#pragma once
#endif
#include <igamesystem.h>
#include <GameEventListener.h>
#include <bitmap/bitmap.h>
#include <netadr.h>
/// Different content types that can be reported as abusive.
///
/// WARNING: These enum values MUST MATCH the values in Steam's
/// ECommunityContentType!
enum EAbuseReportContentType
{
k_EAbuseReportContentNoSelection = -1, // dummy ilegal value: the user has not made a selection
k_EAbuseReportContentUnspecified = 0, // we use this to mean "other"
//k_EAbuseReportContentAll = 1, // reset all community content
k_EAbuseReportContentAvatarImage = 2, // clear avatar image
//k_EAbuseReportContentProfileText = 3, // reset profile text
//k_EAbuseReportContentWebLinks = 4, // delete web links
//k_EAbuseReportContentAnnouncement = 5,
//k_EAbuseReportContentEventText = 6,
//k_EAbuseReportContentCustomCSS = 7,
//k_EAbuseReportContentProfileURL = 8, // delete community URL ID
k_EAbuseReportContentComments = 9, // just comments this guy has written
k_EAbuseReportContentPersonaName = 10, // persona name
//k_EAbuseReportContentScreenshot = 11, // screenshot
//k_EAbuseReportContentVideo = 12, // videos
k_EAbuseReportContentCheating = 13, // cheating
k_EAbuseReportContentUGCImage = 14, // Image stored in UGC --- the report is accusing the image of being offensive
k_EAbuseReportContentActorUGCImage = 15, // Abuse report actor has uploaded a UGC image to server as supporting documentation of their claim
};
/// Types of reasons why a violation report was issued
///
/// WARNING: These enum values MUST MATCH the values in Steam's
/// EAbuseReportType!
enum EAbuseReportType
{
k_EAbuseReportTypeNoSelection = -1, // dummy ilegal value: the user has not made a selection
k_EAbuseReportTypeUnspecified = 0,
k_EAbuseReportTypeInappropriate = 1, // just not ok to post
k_EAbuseReportTypeProhibited = 2, // prohibited by EULA or general law
k_EAbuseReportTypeSpamming = 3, // excessive spamming
k_EAbuseReportTypeAdvertisement = 4, // unwanted advertisement
//k_EAbuseReportTypeExploit = 5, // content data attempts to exploit code issue
k_EAbuseReportTypeSpoofing = 6, // user/group is impersonating an official contact
k_EAbuseReportTypeLanguage = 7, // bad language
k_EAbuseReportTypeAdultContent = 8, // any kind of adult material, references etc
k_EAbuseReportTypeHarassment = 9, // harassment, discrimination, racism etc
k_EAbuseReportTypeCheating = 10, // cheating
};
/// Container class that has everything we need to know in order to file
/// an abuse report, which is significantly more than the data we actually
/// include in a particular abuse report. It's everything we save off at the
/// time the user initiates the abuse reporting mechanism. Games can derive
/// their own report types and put game-specific data in here.
struct AbuseIncidentData_t
{
AbuseIncidentData_t();
virtual ~AbuseIncidentData_t();
enum EPlayerImageType
{
k_PlayerImageType_UGC,
k_PlayerImageType_Spray,
};
/// A custom image of the player's that could be considered offensive
struct PlayerImage_t
{
/// What kind of image is it?
EPlayerImageType m_eType;
/// For UGC images, what's the handle?
uint64 m_hUGCHandle;
};
/// Info we remember for one player.
struct PlayerData_t
{
PlayerData_t()
{
m_iClientIndex = -1;
m_iSteamAvatarIndex = -1;
}
/// The client index. (See UTIL_PlayerByIndex). Note that this
/// index is really only valid at the time the incident is captured.
/// Because players can leave after the incident is captured.
int m_iClientIndex;
/// The name they were going by at the time
CUtlString m_sPersona;
/// Their steam ID. This is essential so we can file
/// an abuse report!
CSteamID m_steamID;
/// Index of steam friends icon for their avatar.
/// 0 if they don't have one!
int m_iSteamAvatarIndex;
/// Do we have an entity for this player? They might not have spawned,
/// or might be outside our PVS, etc.
bool m_bHasEntity;
/// Model transform for the player's render stuff
VMatrix m_matModelToWorld;
/// Model->clip matrix for the player's render stuff
VMatrix m_matModelToClip;
/// True if the render bounds are approximately correct, false if not
bool m_bRenderBoundsValid;
/// Bounds (in model space) of the player's renderable stuff
Vector m_vecRenderBoundsMin, m_vecRenderBoundsMax;
/// Bounds (in normalized screen space coords 0...1) of the player's
/// renderable stuff
Vector2D m_screenBoundsMin, m_screenBoundsMax;
/// List of his images
CUtlVector<PlayerImage_t> m_vecImages;
};
/// List of base player data. You got more data per player in your derived
/// incident type? Store it in a parallel array.
CUtlVector<PlayerData_t> m_vecPlayers;
/// Camera world -> clip matrix.
VMatrix m_matWorldToClip;
/// Screenshot
Bitmap_t m_bitmapScreenshot;
// Screenshot file data
CUtlBuffer m_bufScreenshotFileData;
/// Number of frames we're willing to wait for the engine to write out a screenshot.
/// Zero if we already failed
int m_nScreenShotWaitFrames;
/// Is it possible to report the game server itself for abuse?
bool m_bCanReportGameServer;
/// What Game Server/IP are we on? Will be an invalid address if we don't know
netadr_t m_adrGameServer;
/// Steam ID of the game server / IP we are on
CSteamID m_steamIDGameServer;
/// Poll report (some data may have to be fetched asynchronously),
/// return true if everything is ready
virtual bool Poll();
};
/// Generic abuse reporting panel. Your
class CAbuseReportManager : public CBaseGameSystemPerFrame, public CGameEventListener
{
public:
CAbuseReportManager();
virtual ~CAbuseReportManager();
//
// CAutoGameSystemPerFrame overrides
//
virtual char const *Name();
virtual bool Init();
virtual void Shutdown();
virtual void LevelShutdownPreEntity();
//
// CGameEventListener overrides
//
virtual void FireGameEvent( IGameEvent *event );
// CAutoGameSystemPerFrame defines different stuff depending on which DLL we're building
#ifdef CLIENT_DLL
// Do our frame-time processing
virtual void Update( float frametime );
#else
#error "Why is this being included?"
#endif
/// Called when the console command is executed to capture data for a report
virtual void QueueReport();
/// Called when the console command is executed to submit data for a report
virtual void SubmitReportUIRequested();
/// Called to actually trigger the report UI, after all data is ready
virtual void ActivateSubmitReportUI() = 0;
/// Fetch the incident that's queued to be reported
AbuseIncidentData_t *GetIncidentData() const { return m_pIncidentData; }
/// Delete any current report incident. Also should clean
/// out any temporary files used by the incident system.
virtual void DestroyIncidentData();
/// Show a message box complaining about lack of steam
/// connection
virtual void ShowNoSteamErrorMessage();
/// Insert a a notification into the queue indicating that an unfiled report is ready
virtual void CreateReportReadyNotification( bool bInGame, float flLifetime );
/// Test harness. Set this to true, to generate fake data
bool m_bTestReport;
static const char k_rchScreenShotFilenameBase[];
static const char k_rchScreenShotFilename[];
protected:
/// Your app will probably define its own abuse report types.
/// if so, you will need to override this function.
/// The base class just calls new to create an object, then calls
/// PopulateIncident()
virtual bool CreateAndPopulateIncident();
/// Fill in the details about the current incident. This just fills in the
/// base class data, and it should be called from CreateAndPopulateIncident
bool PopulateIncident();
/// Current incident that is pending to be reported or is being generated.
/// Might be NULL.
AbuseIncidentData_t *m_pIncidentData;
/// Status of incident data.
enum EIncidentDataStatus
{
k_EIncidentDataStatus_None,
k_EIncidentDataStatus_Preparing, // we shuld call Poll() until it's ready
k_EIncidentDataStatus_Ready, // it's ready
};
EIncidentDataStatus m_eIncidentDataStatus;
/// Do we want to show the report UI as soon as the report is ready?
bool m_bReportUIPending;
void CheckCreateReportReadyNotification( float flMinSecondsSinceLastNotification, bool bInGame, float flLifetime );
/// Time when we last pestered them about filing their report
double m_timeLastReportReadyNotification;
/// Address of the lasts server we connected to
netadr_t m_adrCurrentServer;
CSteamID m_steamIDCurrentServer;
};
/// Pointer to the app-specific instance. This pointer mght be NULL! Your
/// app should define set this pointer if it uses the system
extern CAbuseReportManager *g_AbuseReportMgr;
#endif // ABUSE_REPORT_H
-949
View File
@@ -1,949 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic in-game abuse reporting
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "abuse_report_ui.h"
#include "econ/econ_controls.h"
#include "ienginevgui.h"
#include "vgui/ISurface.h"
#include <vgui_controls/TextEntry.h>
#include <vgui_controls/ComboBox.h>
#include <vgui_controls/RadioButton.h>
#include "vgui_bitmappanel.h"
#include "vgui_avatarimage.h"
#include "gc_clientsystem.h"
#include "econ/tool_items/tool_items.h"
#include "econ/econ_gcmessages.h"
#include "econ/confirm_dialog.h"
#include "tool_items/custom_texture_cache.h"
vgui::DHANDLE<CAbuseReportDlg> g_AbuseReportDlg;
CAbuseReportDlg::CAbuseReportDlg( vgui::Panel *parent, AbuseIncidentData_t *pIncidentData )
: EditablePanel( parent, "AbuseReportSubmitDialog" )
, m_pSubmitButton( NULL )
, m_pScreenShot( NULL )
, m_pScreenShotAttachCheckButton( NULL )
, m_pOffensiveImage( NULL )
, m_pDescriptionTextEntry( NULL )
, m_pPlayerLabel( NULL )
, m_pPlayerRadio( NULL )
, m_pGameServerRadio( NULL )
, m_pPlayerCombo( NULL )
, m_pAbuseContentLabel( NULL )
, m_pAbuseContentCombo( NULL )
, m_pAbuseTypeLabel( NULL )
, m_pAbuseTypeCombo( NULL )
, m_pScreenShotBitmap( NULL )
, m_pAvatarImage( NULL )
, m_pNoAvatarLabel( NULL )
, m_pCustomTextureImagePanel( NULL )
, m_pNoCustomTexturesLabel( NULL )
, m_pCustomTextureNextButton( NULL )
, m_pCustomTexturePrevButton( NULL )
, m_iUserImageIndex( 0 )
, m_pIncidentData( pIncidentData )
{
vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ClientScheme.res", "ClientScheme" );
SetScheme(scheme);
SetProportional( true );
//m_pContainer = new vgui::EditablePanel( this, "Container" );
Assert( g_AbuseReportDlg.Get() == NULL );
g_AbuseReportDlg.Set( this );
engine->ExecuteClientCmd("gameui_preventescape");
}
CAbuseReportDlg::~CAbuseReportDlg()
{
Assert( g_AbuseReportDlg.Get() == this );
if ( g_AbuseReportDlg.Get() == this )
{
engine->ExecuteClientCmd("gameui_allowescape");
g_AbuseReportDlg = NULL;
}
}
void CAbuseReportDlg::OnCommand( const char *command )
{
if ( !Q_stricmp( command, "cancel" ) )
{
Close();
return;
}
if ( !Q_stricmp( command, "discard" ) )
{
Close();
g_AbuseReportMgr->DestroyIncidentData();
return;
}
if ( !Q_stricmp( command, "submit" ) )
{
OnSubmitReport();
return;
}
if ( !Q_stricmp( command, "nextcustomtexture" ) )
{
++m_iUserImageIndex;
UpdateCustomTextures();
return;
}
if ( !Q_stricmp( command, "prevcustomtexture" ) )
{
--m_iUserImageIndex;
UpdateCustomTextures();
return;
}
}
void CAbuseReportDlg::MakeModal()
{
TFModalStack()->PushModal( this );
MakePopup();
MoveToFront();
SetKeyBoardInputEnabled( true );
SetMouseInputEnabled( true );
// !KLUDGE! Initially set the dialog to be hidden, so we can take a screenshot!
SetEnabled( m_pIncidentData != NULL );
//SetVisible( m_pIncidentData != NULL );
}
void CAbuseReportDlg::Close()
{
TFModalStack()->PopModal( this );
SetVisible( false );
MarkForDeletion();
}
const char *CAbuseReportDlg::GetResFilename()
{
return "Resource/UI/AbuseReportSubmitDialog.res";
//return "Resource/UI/QuickplayDialog.res";
}
void CAbuseReportDlg::PerformLayout()
{
BaseClass::PerformLayout();
// Center it, keeping requested size
int x, y, ww, wt, wide, tall;
vgui::surface()->GetWorkspaceBounds( x, y, ww, wt );
GetSize(wide, tall);
SetPos(x + ((ww - wide) / 2), y + ((wt - tall) / 2));
// @todo setup
}
class CCustomTextureImagePanel : public vgui::Panel
{
public:
CCustomTextureImagePanel( Panel *parent, const char *panelName ) : vgui::Panel( parent, panelName )
{
m_ugcHandle = 0;
}
uint64 m_ugcHandle;
virtual void Paint()
{
if ( m_ugcHandle == 0 )
{
return;
}
int iTextureHandle = GetCustomTextureGuiHandle( m_ugcHandle );
if ( iTextureHandle <= 0)
{
return;
}
vgui::surface()->DrawSetColor(COLOR_WHITE);
vgui::surface()->DrawSetTexture( iTextureHandle );
int iWide, iTall;
GetSize( iWide, iTall );
vgui::Vertex_t verts[4];
verts[0].Init( Vector2D( 0, 0 ), Vector2D( 0.0f, 0.0f ) );
verts[1].Init( Vector2D( iWide, 0 ), Vector2D( 1.0f, 0.0f ) );
verts[2].Init( Vector2D( iWide, iTall ), Vector2D( 1.0f, 1.0f ) );
verts[3].Init( Vector2D( 0, iTall ), Vector2D( 0.0f, 1.0f ) );
vgui::surface()->DrawTexturedPolygon( 4, verts );
vgui::surface()->DrawSetColor(COLOR_WHITE);
}
};
class CAbuseReportScreenShotPanel : public CBitmapPanel
{
public:
CAbuseReportScreenShotPanel( CAbuseReportDlg *pDlg, const char *panelName )
: CBitmapPanel( pDlg, panelName )
, m_pDlg( pDlg )
{}
CAbuseReportDlg *m_pDlg;
virtual void Paint()
{
CBitmapPanel::Paint();
const AbuseIncidentData_t::PlayerData_t *p = m_pDlg->GetAccusedPlayerPtr();
if ( p == NULL || !p->m_bRenderBoundsValid )
{
return;
}
int w, t;
GetSize( w, t );
int x0 = int( p->m_screenBoundsMin.x * (float)w );
int y0 = int( p->m_screenBoundsMin.y * (float)t );
int x1 = int( p->m_screenBoundsMax.x * (float)w );
int y1 = int( p->m_screenBoundsMax.y * (float)t );
vgui::surface()->DrawSetColor( Color(200, 10, 10, 200 ) );
vgui::surface()->DrawOutlinedRect( x0, y0, x1, y1 );
vgui::surface()->DrawSetColor( COLOR_WHITE );
}
};
void CAbuseReportDlg::ApplySchemeSettings( vgui::IScheme *pScheme )
{
EditablePanel::ApplySchemeSettings( pScheme );
m_pScreenShotBitmap = new CAbuseReportScreenShotPanel( this, "ScreenShotBitmap" );
m_pCustomTextureImagePanel = new CCustomTextureImagePanel( this, "CustomTextureImage" );
LoadControlSettings( GetResFilename() );
m_pPlayerRadio = dynamic_cast<vgui::RadioButton *>(FindChildByName( "PlayerRadio", true ));
Assert( m_pPlayerRadio );
if ( m_pPlayerRadio )
{
m_pPlayerRadio->SetVisible( m_pIncidentData->m_bCanReportGameServer );
}
m_pGameServerRadio = dynamic_cast<vgui::RadioButton *>(FindChildByName( "GameServerRadio", true ));
Assert( m_pGameServerRadio );
if ( m_pGameServerRadio )
{
m_pGameServerRadio->SetVisible( m_pIncidentData->m_bCanReportGameServer );
}
m_pPlayerLabel = FindChildByName( "PlayerLabel", true );
Assert( m_pPlayerLabel );
m_pScreenShotAttachCheckButton = dynamic_cast<vgui::CheckButton *>(FindChildByName( "ScreenShotAttachCheckButton", true ));
Assert( m_pScreenShotAttachCheckButton );
if ( m_pScreenShotAttachCheckButton )
{
m_pScreenShotAttachCheckButton->SetSelected( true );
}
m_pSubmitButton = dynamic_cast<vgui::Button *>(FindChildByName( "SubmitButton", true ));
Assert( m_pSubmitButton );
m_pDescriptionTextEntry = dynamic_cast<vgui::TextEntry *>(FindChildByName( "DescriptionTextEntry", true ));
Assert( m_pDescriptionTextEntry );
if ( m_pDescriptionTextEntry )
{
m_pDescriptionTextEntry->SetMultiline( true );
}
m_pAvatarImage = dynamic_cast<CAvatarImagePanel *>(FindChildByName( "AvatarImage", true ));
Assert( m_pAvatarImage );
m_pNoAvatarLabel = FindChildByName( "NoAvatarLabel", true );
Assert( m_pNoAvatarLabel );
m_pNoCustomTexturesLabel = FindChildByName( "NoCustomTexturesLabel", true );
Assert( m_pNoCustomTexturesLabel );
m_pCustomTextureNextButton = dynamic_cast<vgui::Button *>(FindChildByName( "CustomTextureNextButton", true ));
Assert( m_pCustomTextureNextButton );
m_pCustomTexturePrevButton = dynamic_cast<vgui::Button *>(FindChildByName( "CustomTexturePrevButton", true ));
Assert( m_pCustomTexturePrevButton );
m_pPlayerCombo = dynamic_cast<vgui::ComboBox *>(FindChildByName( "PlayerComboBox", true ));
Assert( m_pPlayerCombo );
m_pAbuseContentLabel = FindChildByName( "AbuseContentLabel", true );
Assert( m_pAbuseContentLabel );
m_pAbuseContentCombo = dynamic_cast<vgui::ComboBox *>(FindChildByName( "AbuseContentComboBox", true ));
Assert( m_pAbuseContentCombo );
if ( m_pAbuseContentCombo )
{
m_pAbuseContentCombo->AddItem( "#AbuseReport_SelectOne", new KeyValues( "AbuseContent", "code", k_EAbuseReportContentNoSelection ) );
m_pAbuseContentCombo->AddItem( "#AbuseReport_ContentAvatarImage", new KeyValues( "AbuseContent", "code", k_EAbuseReportContentAvatarImage ) );
m_pAbuseContentCombo->AddItem( "#AbuseReport_ContentPlayerName", new KeyValues( "AbuseContent", "code", k_EAbuseReportContentPersonaName ) );
m_pAbuseContentCombo->AddItem( "#AbuseReport_ContentItemDecal", new KeyValues( "AbuseContent", "code", k_EAbuseReportContentUGCImage ) );
m_pAbuseContentCombo->AddItem( "#AbuseReport_ContentChatText", new KeyValues( "AbuseContent", "code", k_EAbuseReportContentComments ) );
m_pAbuseContentCombo->AddItem( "#AbuseReport_ContentCheating", new KeyValues( "AbuseContent", "code", k_EAbuseReportContentCheating ) );
m_pAbuseContentCombo->AddItem( "#AbuseReport_ContentOther", new KeyValues( "AbuseContent", "code", k_EAbuseReportContentUnspecified ) );
m_pAbuseContentCombo->SilentActivateItemByRow( 0 );
m_pAbuseContentCombo->SetNumberOfEditLines( m_pAbuseContentCombo->GetItemCount() );
}
m_pAbuseTypeLabel = FindChildByName( "AbuseTypeLabel", true );
Assert( m_pAbuseTypeLabel );
m_pAbuseTypeCombo = dynamic_cast<vgui::ComboBox *>(FindChildByName( "AbuseTypeComboBox", true ));
Assert( m_pAbuseTypeCombo );
Assert( m_pScreenShotBitmap );
if ( m_pScreenShotBitmap && m_pIncidentData->m_bitmapScreenshot.IsValid() )
{
m_pScreenShotBitmap->SetBitmap( m_pIncidentData->m_bitmapScreenshot );
}
PopulatePlayerList();
SetIsAccusingGameServer( false );
SetEnabled( true );
SetVisible( true );
}
bool CAbuseReportDlg::IsAccusingGameServer()
{
return m_pIncidentData && m_pIncidentData->m_bCanReportGameServer && m_pGameServerRadio && m_pGameServerRadio->IsSelected();
}
EAbuseReportContentType CAbuseReportDlg::GetAbuseContentType()
{
if ( m_pAbuseContentCombo == NULL || IsAccusingGameServer() )
{
Assert( m_pAbuseContentCombo );
return k_EAbuseReportContentNoSelection;
}
KeyValues *pUserData = m_pAbuseContentCombo->GetActiveItemUserData();
if ( pUserData == NULL )
{
return k_EAbuseReportContentNoSelection;
}
return (EAbuseReportContentType)pUserData->GetInt( "code", k_EAbuseReportContentNoSelection );
}
EAbuseReportType CAbuseReportDlg::GetAbuseType()
{
if ( m_pAbuseTypeCombo == NULL || IsAccusingGameServer() )
{
Assert( m_pAbuseTypeCombo );
return k_EAbuseReportTypeNoSelection;
}
KeyValues *pUserData = m_pAbuseTypeCombo->GetActiveItemUserData();
if ( pUserData == NULL )
{
return k_EAbuseReportTypeNoSelection;
}
return (EAbuseReportType)pUserData->GetInt( "code", k_EAbuseReportTypeNoSelection );
}
CUtlString CAbuseReportDlg::GetAbuseDescription()
{
char buf[ 1024 ] = "";
if ( m_pDescriptionTextEntry )
{
m_pDescriptionTextEntry->GetText( buf, ARRAYSIZE(buf) );
}
return CUtlString( buf );
}
int CAbuseReportDlg::GetAccusedPlayerIndex()
{
// If accusing a game server, then there's no player
if ( IsAccusingGameServer() )
{
return -1;
}
if ( m_pPlayerCombo == NULL )
{
Assert( m_pPlayerCombo );
return -1;
}
// Item 0 is the "<select one>" item
return m_pPlayerCombo->GetActiveItem() - 1;
}
const AbuseIncidentData_t::PlayerData_t *CAbuseReportDlg::GetAccusedPlayerPtr()
{
int iPlayerIndex = GetAccusedPlayerIndex();
if ( iPlayerIndex < 0 )
return NULL;
return &m_pIncidentData->m_vecPlayers[ iPlayerIndex ];
}
bool CAbuseReportDlg::GetAttachScreenShot()
{
if ( m_pScreenShotAttachCheckButton == NULL )
{
return false;
}
if ( !m_pScreenShotAttachCheckButton->IsVisible() )
{
// We hide the checkbutton when the option is not applicable
return false;
}
return m_pScreenShotAttachCheckButton->IsSelected();
}
void CAbuseReportDlg::PopulatePlayerList()
{
if ( m_pIncidentData == NULL || m_pPlayerCombo == NULL )
{
Assert( m_pIncidentData );
Assert( m_pPlayerCombo );
return;
}
m_pPlayerCombo->RemoveAll();
m_pPlayerCombo->AddItem( "#AbuseReport_SelectOne", NULL );
for ( int i = 0 ; i < m_pIncidentData->m_vecPlayers.Count() ; ++i )
{
AbuseIncidentData_t::PlayerData_t *p = &m_pIncidentData->m_vecPlayers[i];
m_pPlayerCombo->AddItem( p->m_sPersona, NULL );
}
m_pPlayerCombo->SilentActivateItemByRow( 0 );
m_pPlayerCombo->SetNumberOfEditLines( MIN( m_pPlayerCombo->GetItemCount()+1, 12 ) );
}
void CAbuseReportDlg::UpdateSubmitButton()
{
if ( !m_pSubmitButton )
{
Assert( m_pSubmitButton );
return;
}
bool bEnable = false;
if ( IsAccusingGameServer() )
{
bEnable = true;
}
else
{
EAbuseReportContentType eContent = GetAbuseContentType();
const AbuseIncidentData_t::PlayerData_t *pAccused = GetAccusedPlayerPtr();
if (
eContent >= 0
&& GetAbuseType() >= 0
&& pAccused != NULL )
{
bEnable = true;
if ( eContent == k_EAbuseReportContentAvatarImage && pAccused->m_iSteamAvatarIndex <= 0 )
{
// Cannot accuse somebody of having a bad avatar image, if they
// don't have one set
bEnable = false;
}
}
}
if ( GetAbuseDescription().IsEmpty() )
{
bEnable = false;
}
m_pSubmitButton->SetEnabled( bEnable );
}
void CAbuseReportDlg::ContentTypeChanged()
{
// Save current abuse type. We want to keep it the same,
// if possible
EAbuseReportType abuseType = GetAbuseType();
EAbuseReportContentType contentType = GetAbuseContentType();
// Show/hide screen shot / image select
bool bShowScreenshot = false;
bool bShowAttach = false;
switch ( contentType )
{
default:
Assert( false );
case k_EAbuseReportContentNoSelection:
case k_EAbuseReportContentPersonaName:
bShowScreenshot = true;
bShowAttach = false;
break;
case k_EAbuseReportContentUnspecified:
case k_EAbuseReportContentComments:
case k_EAbuseReportContentCheating:
bShowScreenshot = true;
bShowAttach = true;
break;
case k_EAbuseReportContentAvatarImage:
case k_EAbuseReportContentUGCImage:
bShowScreenshot = false;
bShowAttach = false;
break;
}
bShowScreenshot = bShowScreenshot && m_pIncidentData->m_bitmapScreenshot.IsValid();
// Make sure we have everything we need to upload a screenshot
bShowAttach = bShowAttach
&& bShowScreenshot
&& ( GetAccusedPlayerIndex() >= 0 )
&& m_pIncidentData->m_bufScreenshotFileData.TellPut() > 0
&& steamapicontext
&& ( steamapicontext->SteamUtils() != NULL )
&& ( steamapicontext->SteamRemoteStorage() != NULL );
if ( m_pScreenShotBitmap )
{
m_pScreenShotBitmap->SetVisible( bShowScreenshot );
}
if ( m_pScreenShotAttachCheckButton )
{
m_pScreenShotAttachCheckButton->SetVisible( bShowAttach );
}
UpdateAvatarImage();
UpdateCustomTextures();
// Populate abuse type
if ( m_pAbuseTypeCombo )
{
// If the combo box was invisible, then they didn't really make a purposeful decision
if ( !m_pAbuseTypeCombo->IsVisible() )
{
abuseType = k_EAbuseReportTypeNoSelection;
}
m_pAbuseTypeCombo->RemoveAll();
switch ( contentType )
{
default:
Assert( false );
case k_EAbuseReportContentNoSelection:
m_pAbuseTypeCombo->SetVisible( false );
abuseType = k_EAbuseReportTypeNoSelection;
m_pAbuseTypeCombo->AddItem( "#AbuseReport_SelectOne", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeNoSelection ) );
break;
case k_EAbuseReportContentCheating:
m_pAbuseTypeCombo->SetVisible( false );
abuseType = k_EAbuseReportTypeCheating;
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeCheating", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeCheating ) );
break;
case k_EAbuseReportContentUnspecified:
case k_EAbuseReportContentComments:
case k_EAbuseReportContentPersonaName:
case k_EAbuseReportContentAvatarImage:
case k_EAbuseReportContentUGCImage:
m_pAbuseTypeCombo->SetVisible( true );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_SelectOne", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeNoSelection ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeSpam", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeSpamming ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeAdvertisement", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeAdvertisement ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeLanguage", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeLanguage ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeAdultContent", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeAdultContent ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeHarassment", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeHarassment ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeProhibited", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeProhibited ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeSpoofing", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeSpoofing ) );
//m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeCheating", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeCheating ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeInappropriate", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeInappropriate ) );
m_pAbuseTypeCombo->AddItem( "#AbuseReport_TypeOther", new KeyValues( "AbuseType", "code", k_EAbuseReportTypeUnspecified ) );
break;
}
// Now select the proper row
int sel = 0;
for ( int i = 0 ; i < m_pAbuseTypeCombo->GetItemCount() ; ++i ) {
if ( m_pAbuseTypeCombo->GetItemUserData(i)->GetInt("code") == abuseType )
{
sel = i;
break;
}
}
m_pAbuseTypeCombo->SilentActivateItemByRow( sel );
m_pAbuseTypeCombo->SetNumberOfEditLines( m_pAbuseTypeCombo->GetItemCount() );
if ( m_pAbuseTypeLabel )
{
m_pAbuseTypeLabel->SetVisible( m_pAbuseTypeCombo->IsVisible() );
}
}
UpdateSubmitButton();
}
void CAbuseReportDlg::OnRadioButtonChecked( vgui::Panel *panel )
{
if ( panel == m_pPlayerRadio )
{
SetIsAccusingGameServer( false );
}
else if ( panel == m_pGameServerRadio )
{
SetIsAccusingGameServer( true );
}
else
{
Assert( !"Clicked on unknown radio" );
}
}
void CAbuseReportDlg::SetIsAccusingGameServer( bool bAccuseGameServer )
{
if ( m_pGameServerRadio && m_pGameServerRadio->IsSelected() != bAccuseGameServer )
{
m_pGameServerRadio->SetSelected( bAccuseGameServer );
}
if ( m_pPlayerRadio && m_pPlayerRadio->IsSelected() == bAccuseGameServer)
{
m_pPlayerRadio->SetSelected( !bAccuseGameServer );
}
if ( m_pPlayerLabel )
{
m_pPlayerLabel->SetVisible( !bAccuseGameServer );
}
if ( m_pPlayerCombo )
{
m_pPlayerCombo->SetVisible( !bAccuseGameServer );
}
PlayerChanged();
}
void CAbuseReportDlg::PlayerChanged()
{
m_iUserImageIndex = 0;
bool bShow = ( GetAccusedPlayerIndex() >= 0 );
if ( m_pAbuseContentCombo != NULL )
{
m_pAbuseContentCombo->SetVisible( bShow );
}
if ( m_pAbuseContentLabel != NULL )
{
m_pAbuseContentLabel->SetVisible( bShow );
}
ContentTypeChanged();
}
void CAbuseReportDlg::UpdateAvatarImage()
{
if ( m_pAvatarImage == NULL || m_pNoAvatarLabel == NULL )
{
Assert( m_pAvatarImage );
Assert( m_pNoAvatarLabel );
return;
}
const AbuseIncidentData_t::PlayerData_t *pAccused = GetAccusedPlayerPtr();
if ( GetAbuseContentType() == k_EAbuseReportContentAvatarImage && pAccused != NULL )
{
if ( pAccused->m_iSteamAvatarIndex > 0 )
{
m_pAvatarImage->SetShouldDrawFriendIcon( false );
m_pAvatarImage->SetPlayer( pAccused->m_steamID, k_EAvatarSize184x184 );
m_pAvatarImage->SetVisible( true );
m_pNoAvatarLabel->SetVisible( false );
}
else
{
m_pAvatarImage->SetVisible( false );
m_pNoAvatarLabel->SetVisible( true );
}
}
else
{
m_pAvatarImage->SetVisible( false );
m_pNoAvatarLabel->SetVisible( false );
}
}
void CAbuseReportDlg::UpdateCustomTextures()
{
if ( m_pCustomTextureImagePanel == NULL || m_pNoCustomTexturesLabel == NULL || m_pCustomTextureNextButton == NULL || m_pCustomTexturePrevButton == NULL )
{
Assert( m_pCustomTextureImagePanel );
Assert( m_pNoCustomTexturesLabel );
Assert( m_pCustomTextureNextButton );
Assert( m_pCustomTexturePrevButton );
return;
}
const AbuseIncidentData_t::PlayerData_t *pAccused = GetAccusedPlayerPtr();
bool bShowScrollButtons = false;
if ( GetAbuseContentType() == k_EAbuseReportContentUGCImage && pAccused != NULL )
{
int iSelectedCustomImage = GetSelectedCustomImage();
if ( iSelectedCustomImage >= 0 )
{
// Currently the only thing we support...
Assert( pAccused->m_vecImages[ iSelectedCustomImage].m_eType == AbuseIncidentData_t::k_PlayerImageType_UGC );
m_pCustomTextureImagePanel->m_ugcHandle = pAccused->m_vecImages[ iSelectedCustomImage].m_hUGCHandle;
m_pCustomTextureImagePanel->SetVisible( true );
m_pNoCustomTexturesLabel->SetVisible( false );
int n = pAccused->m_vecImages.Count();
if ( n > 1 )
{
bShowScrollButtons = true;
m_pCustomTextureNextButton->SetEnabled( iSelectedCustomImage < n-1 );
m_pCustomTexturePrevButton->SetEnabled( iSelectedCustomImage > 0 );
}
}
else
{
m_pCustomTextureImagePanel->SetVisible( false );
m_pNoCustomTexturesLabel->SetVisible( true );
}
}
else
{
m_pCustomTextureImagePanel->SetVisible( false );
m_pNoCustomTexturesLabel->SetVisible( false );
}
m_pCustomTextureNextButton->SetVisible( bShowScrollButtons );
m_pCustomTexturePrevButton->SetVisible( bShowScrollButtons );
}
int CAbuseReportDlg::GetSelectedCustomImage()
{
if ( GetAbuseContentType() != k_EAbuseReportContentUGCImage )
{
m_iUserImageIndex = 0;
return -1;
}
const AbuseIncidentData_t::PlayerData_t *pAccused = GetAccusedPlayerPtr();
if ( pAccused == NULL )
{
m_iUserImageIndex = 0;
return -1;
}
int n = pAccused->m_vecImages.Count();
if ( n < 1 )
{
m_iUserImageIndex = 0;
return -1;
}
// Wrap currently selected index
m_iUserImageIndex = ( m_iUserImageIndex + n*10 ) % n;
// Return it
return m_iUserImageIndex;
}
void CAbuseReportDlg::OnTextChanged( vgui::Panel *panel )
{
if ( panel == m_pPlayerCombo )
{
PlayerChanged();
}
else if ( panel == m_pAbuseContentCombo )
{
ContentTypeChanged();
}
else
{
UpdateSubmitButton();
}
}
//-----------------------------------------------------------------------------
// Purpose: Job to do the async work of submitting the report
//-----------------------------------------------------------------------------
class CSubmitAbuseReportJob : public GCSDK::CGCClientJob
{
public:
bool m_bGameServer;
CSubmitAbuseReportJob( )
: GCSDK::CGCClientJob( GCClientSystem()->GetGCClient() )
{
m_bGameServer = false;
}
virtual bool BYieldingRunGCJob()
{
EResult result = RunJob();
// Tear down our dialogs
CloseWaitingDialog();
CAbuseReportDlg *pDlg = g_AbuseReportDlg.Get();
if ( pDlg )
{
pDlg->Close();
pDlg = NULL;
}
// And destroy the queued report!
g_AbuseReportMgr->DestroyIncidentData();
// now show a dialog box explaining the outcome
switch ( result )
{
case k_EResultOK:
ShowMessageBox( "#AbuseReport_SucceededTitle", "#AbuseReport_SucceededMessage", "#GameUI_OK" );
break;
case k_EResultLimitExceeded:
ShowMessageBox(
"#AbuseReport_TooMuchFailedTitle",
m_bGameServer ? "#AbuseReport_TooMuchFailedMessageGameServer" : "#AbuseReport_TooMuchFailedMessage",
"#GameUI_OK"
);
break;
default:
ShowMessageBox( "#AbuseReport_GenericFailureTitle", "#AbuseReport_GenericFailureMessage", "#GameUI_OK" );
break;
}
return true;
}
EResult RunJob()
{
CAbuseReportDlg *pDlg = g_AbuseReportDlg.Get();
if ( pDlg == NULL )
{
return k_EResultFail;
}
m_bGameServer = pDlg->IsAccusingGameServer();
EAbuseReportContentType eContentSelected = pDlg->GetAbuseContentType();
EAbuseReportContentType eContentReported = eContentSelected;
EAbuseReportType eAbuseType = pDlg->GetAbuseType();
const AbuseIncidentData_t::PlayerData_t *pAccused = pDlg->GetAccusedPlayerPtr();
const AbuseIncidentData_t *pIncidentData = g_AbuseReportMgr->GetIncidentData();
CUtlString sAbuseDescription = pDlg->GetAbuseDescription();
netadr_t adrGameServer = pIncidentData->m_adrGameServer;
CSteamID steamIDGameServer = pIncidentData->m_steamIDGameServer;
uint64 gid = 0;
// Check if we should upload the screenshot
if ( pDlg->GetAttachScreenShot() && steamapicontext && steamapicontext->SteamUtils() && steamapicontext->SteamRemoteStorage() )
{
// Write the local copy of the file
if ( !steamapicontext->SteamRemoteStorage()->FileWrite( CAbuseReportManager::k_rchScreenShotFilename, pIncidentData->m_bufScreenshotFileData.Base(), pIncidentData->m_bufScreenshotFileData.TellPut() ) )
{
Warning( "Failed to save local cloud copy of %s\n", CAbuseReportManager::k_rchScreenShotFilename );
return k_EResultFail;
}
// Share it. This initiates the upload to cloud
Msg( "Starting upload of %s to UFS....\n", CAbuseReportManager::k_rchScreenShotFilename );
SteamAPICall_t hFileShareApiCall = steamapicontext->SteamRemoteStorage()->FileShare( CAbuseReportManager::k_rchScreenShotFilename );
if ( hFileShareApiCall == k_uAPICallInvalid )
{
Warning( "Failed to share %s\n", CAbuseReportManager::k_rchScreenShotFilename );
return k_EResultFail;
}
// Check if we're busy
bool bFailed;
RemoteStorageFileShareResult_t result;
while ( !steamapicontext->SteamUtils()->GetAPICallResult(hFileShareApiCall,
&result, sizeof(result), RemoteStorageFileShareResult_t::k_iCallback, &bFailed) )
{
BYield();
}
// Clear pointer, it could have been destroyed while we were yielding, make sure we don't reference it
pDlg = NULL;
if ( bFailed || result.m_eResult != k_EResultOK )
{
Warning( "Failed to share %s; result code %d\n", CAbuseReportManager::k_rchScreenShotFilename, result.m_eResult );
return result.m_eResult;
}
Msg( "%s shared to UGC OK\n", CAbuseReportManager::k_rchScreenShotFilename );
gid = result.m_hFile;
// SWitch the content type being reported, so the support tool will know what to
// do with the GID.
eContentReported = k_EAbuseReportContentActorUGCImage;
}
else if ( eContentSelected == k_EAbuseReportContentUGCImage )
{
Assert( !m_bGameServer );
int iImageindex = pDlg->GetSelectedCustomImage();
Assert( iImageindex >= 0 );
gid = pAccused->m_vecImages[iImageindex].m_hUGCHandle;
}
//
// Fill out the report message
//
GCSDK::CProtoBufMsg<CMsgGCReportAbuse> msg( k_EMsgGC_ReportAbuse );
if ( m_bGameServer )
{
msg.Body().set_target_steam_id( steamIDGameServer.ConvertToUint64() );
msg.Body().set_target_game_server_ip( adrGameServer.GetIPHostByteOrder() );
msg.Body().set_target_game_server_port( adrGameServer.GetPort() );
}
else
{
msg.Body().set_target_steam_id( pAccused->m_steamID.ConvertToUint64() );
msg.Body().set_content_type( eContentReported );
msg.Body().set_abuse_type( eAbuseType );
}
msg.Body().set_description( sAbuseDescription );
if (gid != 0 )
{
msg.Body().set_gid( gid );
}
// Send the message to the GC, and await the reply
GCSDK::CProtoBufMsg<CMsgGCReportAbuseResponse> msgReply;
if ( !BYldSendMessageAndGetReply( msg, 10, &msgReply, k_EMsgGC_ReportAbuseResponse ) )
{
Warning( "Abuse report failed: Did not get reply from GC\n" );
return k_EResultTimeout;
}
EResult result = (EResult)msgReply.Body().result();
if ( result != k_EResultOK )
{
Warning( "Abuse report failed with failure code %d. %s\n", result, msgReply.Body().error_message().c_str() );
}
// OK
return result;
}
};
void CAbuseReportDlg::OnSubmitReport()
{
// throw up a waiting dialog
SetEnabled( false );
ShowWaitingDialog( new CGenericWaitingDialog( this ), "#AbuseReport_Busy", true, false, 0.0f );
// We need to be in the global singleton handle, because that's how the job knows
// to get to us (and how it knows if we've died)!
Assert( g_AbuseReportDlg.Get() == this );
// Start a job
CSubmitAbuseReportJob *pJob = new CSubmitAbuseReportJob();
pJob->StartJob( NULL );
}
-100
View File
@@ -1,100 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic in-game abuse reporting
//
// $NoKeywords: $
//=============================================================================//
#ifndef ABUSE_REPORT_UI_H
#define ABUSE_REPORT_UI_H
#ifdef _WIN32
#pragma once
#endif
#include "abuse_report.h"
#include <vgui_controls/EditablePanel.h>
class CAvatarImagePanel;
class CCustomTextureImagePanel;
class CAbuseReportScreenShotPanel;
class CAbuseReportDlg : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CAbuseReportDlg, vgui::EditablePanel );
public:
CAbuseReportDlg( vgui::Panel *parent, AbuseIncidentData_t *pIncidentData );
~CAbuseReportDlg();
virtual void OnCommand(const char *command);
virtual void Close();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void PerformLayout();
virtual void MakeModal();
bool IsAccusingGameServer();
EAbuseReportContentType GetAbuseContentType();
EAbuseReportType GetAbuseType();
int GetAccusedPlayerIndex();
const AbuseIncidentData_t::PlayerData_t *GetAccusedPlayerPtr();
int GetUserImageIndex();
int GetSelectedCustomImage();
CUtlString GetAbuseDescription();
bool GetAttachScreenShot();
protected:
MESSAGE_FUNC_PTR( OnRadioButtonChecked, "RadioButtonChecked", panel );
virtual const char *GetResFilename();
vgui::Button *m_pSubmitButton;
vgui::Button *m_pScreenShot;
vgui::CheckButton *m_pScreenShotAttachCheckButton;
vgui::Button *m_pCustomTextureNextButton;
vgui::Button *m_pCustomTexturePrevButton;
vgui::Button *m_pOffensiveImage;
vgui::TextEntry *m_pDescriptionTextEntry;
vgui::Panel *m_pPlayerLabel;
vgui::RadioButton *m_pPlayerRadio;
vgui::RadioButton *m_pGameServerRadio;
vgui::ComboBox *m_pPlayerCombo;
vgui::Panel *m_pAbuseContentLabel;
vgui::ComboBox *m_pAbuseContentCombo;
vgui::Panel *m_pAbuseTypeLabel;
vgui::ComboBox *m_pAbuseTypeCombo;
CAbuseReportScreenShotPanel *m_pScreenShotBitmap;
CAvatarImagePanel *m_pAvatarImage;
vgui::Panel *m_pNoAvatarLabel;
CCustomTextureImagePanel *m_pCustomTextureImagePanel;
vgui::Panel *m_pNoCustomTexturesLabel;
AbuseIncidentData_t *m_pIncidentData;
int m_iUserImageIndex;
MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel ); // send by combo box when it changes
void PopulatePlayerList();
void UpdateSubmitButton();
void SetIsAccusingGameServer( bool bAccuseGameServer );
void PlayerChanged();
void ContentTypeChanged();
void UpdateAvatarImage();
void UpdateCustomTextures();
virtual void OnSubmitReport();
};
/// Global pointer to the submission dialiog.
/// NULL if it's not displayed
extern vgui::DHANDLE<CAbuseReportDlg> g_AbuseReportDlg;
#endif // ABUSE_REPORT_UI_H
+17 -9
View File
@@ -85,7 +85,7 @@ void CAchievementNotificationPanel::PerformLayout( void )
SetBgColor( Color( 0, 0, 0, 0 ) );
m_pLabelHeading->SetBgColor( Color( 0, 0, 0, 0 ) );
m_pLabelTitle->SetBgColor( Color( 0, 0, 0, 0 ) );
m_pPanelBackground->SetBgColor( Color( 62,70,55, 200 ) );
m_pPanelBackground->SetBgColor( Color( 128, 128, 128, 128 ) );
}
//-----------------------------------------------------------------------------
@@ -94,19 +94,19 @@ void CAchievementNotificationPanel::PerformLayout( void )
void CAchievementNotificationPanel::FireGameEvent( IGameEvent * event )
{
const char *name = event->GetName();
if ( 0 == Q_strcmp( name, "achievement_event" ) )
if ( Q_strcmp( name, "achievement_event" ) == 0 )
{
const char *pchName = event->GetString( "achievement_name" );
int iCur = event->GetInt( "cur_val" );
int iMax = event->GetInt( "max_val" );
wchar_t szLocalizedName[256]=L"";
#if 0
#ifndef DISABLE_STEAM
if ( IsPC() )
{
// shouldn't ever get achievement progress if steam not running and user logged in, but check just in case
if ( !steamapicontext->SteamUserStats() )
{
{
Msg( "Steam not running, achievement progress notification not displayed\n" );
}
else
@@ -115,7 +115,7 @@ void CAchievementNotificationPanel::FireGameEvent( IGameEvent * event )
steamapicontext->SteamUserStats()->IndicateAchievementProgress( pchName, iCur, iMax );
}
}
else
else
#endif
{
// on X360 we need to show our own achievement progress UI
@@ -127,10 +127,17 @@ void CAchievementNotificationPanel::FireGameEvent( IGameEvent * event )
Q_wcsncpy( szLocalizedName, pchLocalizedName, sizeof( szLocalizedName ) );
// this is achievement progress, compose the message of form: "<name> (<#>/<max>)"
wchar_t szFmt[128]=L"";
wchar_t szText[512]=L"";
wchar_t szFmt[128]=L"";
wchar_t szNumFound[16]=L"";
wchar_t szNumTotal[16]=L"";
if( iCur >= iMax )
{
AddNotification( pchName, g_pVGuiLocalize->Find( "#GameUI_Achievement_Awarded" ), szLocalizedName );
return;
}
_snwprintf( szNumFound, ARRAYSIZE( szNumFound ), L"%i", iCur );
_snwprintf( szNumTotal, ARRAYSIZE( szNumTotal ), L"%i", iMax );
@@ -139,7 +146,8 @@ void CAchievementNotificationPanel::FireGameEvent( IGameEvent * event )
return;
Q_wcsncpy( szFmt, pchFmt, sizeof( szFmt ) );
g_pVGuiLocalize->ConstructString_safe( szText, szFmt, 3, szLocalizedName, szNumFound, szNumTotal );
g_pVGuiLocalize->ConstructString( szText, sizeof( szText ), szFmt, 3, szLocalizedName, szNumFound, szNumTotal );
AddNotification( pchName, g_pVGuiLocalize->Find( "#GameUI_Achievement_Progress" ), szText );
}
}
@@ -247,13 +255,13 @@ void CAchievementNotificationPanel::SetXAndWide( Panel *pPanel, int x, int wide
pPanel->SetWide( wide );
}
CON_COMMAND_F( achievement_notification_test, "Test the hud notification UI", FCVAR_CHEAT )
CON_COMMAND( achievement_notification_test, "Test the hud notification UI" )
{
static int iCount=0;
CAchievementNotificationPanel *pPanel = GET_HUDELEMENT( CAchievementNotificationPanel );
if ( pPanel )
{
{
pPanel->AddNotification( "HL2_KILL_ODESSAGUNSHIP", L"Achievement Progress", ( 0 == ( iCount % 2 ) ? L"Test Notification Message A (1/10)" :
L"Test Message B" ) );
}
-673
View File
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+15 -25
View File
@@ -11,8 +11,6 @@
#include "materialsystem/itexture.h"
#include "tier1/KeyValues.h"
#include "toolframework_client.h"
#include "tier0/minidump.h"
#include "tier0/stacktools.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -41,33 +39,25 @@ CBaseAnimatedTextureProxy::~CBaseAnimatedTextureProxy()
bool CBaseAnimatedTextureProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
char const* pAnimatedTextureVarName = pKeyValues->GetString( "animatedTextureVar" );
if( !pAnimatedTextureVarName )
return false;
if( pAnimatedTextureVarName )
{
bool foundVar;
bool foundVar;
m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false );
if( !foundVar )
return false;
m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false );
if( foundVar )
{
char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" );
char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" );
if( !pAnimatedTextureFrameNumVarName )
return false;
if( pAnimatedTextureFrameNumVarName )
{
m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false );
m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false );
if( !foundVar )
return false;
if( foundVar )
{
m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 );
m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 );
return true;
}
}
}
}
// Error - null out pointers.
Cleanup();
return false;
m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 );
m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 );
return true;
}
void CBaseAnimatedTextureProxy::Cleanup()
+2 -2
View File
@@ -831,8 +831,8 @@ void DrawSplineSegs( int noise_divisions, float *prgNoise,
}
else if ( flags & FBEAM_SHADEOUT )
{
float fadeFractionOut = fadeLength/length;
brightness = 1.0 - (fraction/ fadeFractionOut);
float fadeFraction = fadeLength/length;
brightness = 1.0 - (fraction/fadeFraction);
if (brightness < 0)
{
brightness = 0;
+1 -1
View File
@@ -170,4 +170,4 @@ class CEngineSprite *Draw_SetSpriteTexture( const model_t *pSpriteModel, int fra
//-----------------------------------------------------------------------------
void DrawSprite( const Vector &vecOrigin, float flWidth, float flHeight, color32 color );
#endif // BEAMDRAW_H
#endif // BEAMDRAW_H
-170
View File
@@ -1,170 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Exposes bsp tools to game for e.g. workshop use
//
// $NoKeywords: $
//===========================================================================//
#include "cbase.h"
#include <tier2/tier2.h>
#include "filesystem.h"
#include "bsp_utils.h"
#include "utlbuffer.h"
#include "igamesystem.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
bool BSP_SyncRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags )
{
// load the bsppack dll
IBSPPack *libBSPPack = NULL;
CSysModule *pModule = g_pFullFileSystem->LoadModule( "bsppack" );
if ( pModule )
{
CreateInterfaceFn BSPPackFactory = Sys_GetFactory( pModule );
if ( BSPPackFactory )
{
libBSPPack = ( IBSPPack * )BSPPackFactory( IBSPPACK_VERSION_STRING, NULL );
}
}
if( !libBSPPack )
{
Warning( "Can't load bsppack library - unable to compress bsp\n" );
return false;
}
Msg( "Repacking %s -> %s\n", pszInputMapFile, pszOutputMapFile );
if ( !g_pFullFileSystem->FileExists( pszInputMapFile ) )
{
Warning( "Couldn't open input file %s - BSP recompress failed\n", pszInputMapFile );
return false;
}
CUtlBuffer inputBuffer;
if ( !g_pFullFileSystem->ReadFile( pszInputMapFile, NULL, inputBuffer ) )
{
Warning( "Couldn't read file %s - BSP compression failed\n", pszInputMapFile );
return false;
}
CUtlBuffer outputBuffer;
if ( !libBSPPack->RepackBSP( inputBuffer, outputBuffer, eRepackFlags ) )
{
Warning( "Internal error compressing BSP\n" );
return false;
}
g_pFullFileSystem->WriteFile( pszOutputMapFile, NULL, outputBuffer );
Msg( "Successfully repacked %s as %s -- %u -> %u bytes\n",
pszInputMapFile, pszOutputMapFile, inputBuffer.TellPut(), outputBuffer.TellPut() );
return true;
}
// Helper to create a thread that calls SyncCompressMap, and clean it up when it exists
void BSP_BackgroundRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags )
{
// Make this a gamesystem and thread, so it can check for completion each frame and clean itself up. Run() is the
// background thread, Update() is the main thread tick.
class BackgroundBSPRepackThread : public CThread, public CAutoGameSystemPerFrame
{
public:
BackgroundBSPRepackThread( const char *pszInputFile, const char *pszOutputFile, IBSPPack::eRepackBSPFlags eRepackFlags )
: m_strInput( pszInputFile )
, m_strOutput( pszOutputFile )
, m_eRepackFlags( eRepackFlags )
{
Start();
}
// CThread job - returns 0 for success
virtual int Run() OVERRIDE
{
return BSP_SyncRepack( m_strInput.Get(), m_strOutput.Get(), m_eRepackFlags ) ? 0 : 1;
}
// GameSystem
virtual const char* Name( void ) OVERRIDE { return "BackgroundBSPRepackThread"; }
// Runs on main thread
void CheckFinished()
{
if ( !IsAlive() )
{
// Thread finished
if ( GetResult() != 0 )
{
Warning( "Map compression thread failed :(\n" );
}
// AutoGameSystem deregisters itself on destruction, we're done
delete this;
}
}
#ifdef CLIENT_DLL
virtual void Update( float frametime ) OVERRIDE { CheckFinished(); }
#else // GAME DLL
virtual void FrameUpdatePostEntityThink() OVERRIDE { CheckFinished(); }
#endif
private:
CUtlString m_strInput;
CUtlString m_strOutput;
IBSPPack::eRepackBSPFlags m_eRepackFlags;
};
Msg( "Starting BSP repack job %s -> %s\n", pszInputMapFile, pszOutputMapFile );
// Deletes itself up when done
new BackgroundBSPRepackThread( pszInputMapFile, pszOutputMapFile, eRepackFlags );
}
CON_COMMAND( bsp_repack, "Repack and output a (re)compressed version of a bsp file" )
{
#ifdef GAME_DLL
if ( !UTIL_IsCommandIssuedByServerAdmin() )
return;
#endif
// Handle -nocompress
bool bCompress = true;
const char *szInFilename = NULL;
const char *szOutFilename = NULL;
if ( args.ArgC() == 4 && V_strcasecmp( args.Arg( 1 ), "-nocompress" ) == 0 )
{
bCompress = false;
szInFilename = args.Arg( 2 );
szOutFilename = args.Arg( 3 );
}
else if ( args.ArgC() == 3 )
{
szInFilename = args.Arg( 1 );
szOutFilename = args.Arg( 2 );
}
if ( !szInFilename || !szOutFilename || !strlen( szInFilename ) || !strlen( szOutFilename ) )
{
Msg( "Usage: bsp_repack [-nocompress] map.bsp output_map.bsp\n" );
return;
}
if ( bCompress )
{
// Use default compress flags
BSP_BackgroundRepack( szInFilename, szOutFilename );
}
else
{
// No compression
BSP_BackgroundRepack( szInFilename, szOutFilename, (IBSPPack::eRepackBSPFlags)0 );
}
}
-21
View File
@@ -1,21 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Exposes bsp tools to game for e.g. workshop use
//
// $NoKeywords: $
//===========================================================================//
#include "../utils/common/bsplib.h"
#include "ibsppack.h"
// Loads bsppack module (IBSPPack) and calls RepackBSP()
bool BSP_SyncRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags = (IBSPPack::eRepackBSPFlags) ( IBSPPack::eRepackBSP_CompressLumps |
IBSPPack::eRepackBSP_CompressPackfile ) );
// Helper to spawn a background thread that runs SyncRepack
void BSP_BackgroundRepack( const char *pszInputMapFile,
const char *pszOutputMapFile,
IBSPPack::eRepackBSPFlags eRepackFlags = (IBSPPack::eRepackBSPFlags) ( IBSPPack::eRepackBSP_CompressLumps |
IBSPPack::eRepackBSP_CompressPackfile ) );
+7 -18
View File
@@ -135,12 +135,9 @@ void C_AI_BaseNPC::ClientThink( void )
int g = 255 * fFade;
int b = 0 * fFade;
if ( debugoverlay )
{
debugoverlay->AddLineOverlay( p1, p2, r, g, b, true, 0.05f );
debugoverlay->AddLineOverlay( p2, p3, r, g, b, true, 0.05f );
debugoverlay->AddLineOverlay( p3, p1, r, g, b, true, 0.05f );
}
debugoverlay->AddLineOverlay( p1, p2, r, g, b, true, 0.05f );
debugoverlay->AddLineOverlay( p2, p3, r, g, b, true, 0.05f );
debugoverlay->AddLineOverlay( p3, p1, r, g, b, true, 0.05f );
}
}
#endif
@@ -156,13 +153,9 @@ void C_AI_BaseNPC::OnDataChanged( DataUpdateType_t type )
}
}
bool C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
void C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
{
bool bRet = true;
if ( !ForceSetupBonesAtTime( pDeltaBones0, gpGlobals->curtime - boneDt ) )
bRet = false;
ForceSetupBonesAtTime( pDeltaBones0, gpGlobals->curtime - boneDt );
GetRagdollCurSequenceWithDeathPose( this, pDeltaBones1, gpGlobals->curtime, m_iDeathPose, m_iDeathFrame );
float ragdollCreateTime = PhysGetSyncCreateTime();
if ( ragdollCreateTime != gpGlobals->curtime )
@@ -171,15 +164,11 @@ bool C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x
// so initialize the ragdoll at that time so that it will reach the current
// position at curtime. Otherwise the ragdoll will simulate forward from curtime
// and pop into the future a bit at this point of transition
if ( !ForceSetupBonesAtTime( pCurrentBones, ragdollCreateTime ) )
bRet = false;
ForceSetupBonesAtTime( pCurrentBones, ragdollCreateTime );
}
else
{
if ( !SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime ) )
bRet = false;
SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
}
return bRet;
}
+2 -2
View File
@@ -14,7 +14,7 @@
#include "c_basecombatcharacter.h"
// NOTE: Moved all controller code into c_basestudiomodel
// NOTE: MOved all controller code into c_basestudiomodel
class C_AI_BaseNPC : public C_BaseCombatCharacter
{
DECLARE_CLASS( C_AI_BaseNPC, C_BaseCombatCharacter );
@@ -29,7 +29,7 @@ public:
bool ShouldAvoidObstacle( void ){ return m_bPerformAvoidance; }
virtual bool AddRagdollToFadeQueue( void ) { return m_bFadeCorpse; }
virtual bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) OVERRIDE;
virtual void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt );
int GetDeathPose( void ) { return m_iDeathPose; }
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -147,15 +147,12 @@ public:
virtual void UpdateIKLocks( float currentTime );
virtual void CalculateIKLocks( float currentTime );
virtual bool ShouldDraw();
virtual void UpdateVisibility() OVERRIDE;
virtual int DrawModel( int flags );
virtual int InternalDrawModel( int flags );
virtual bool OnInternalDrawModel( ClientModelRenderInfo_t *pInfo );
virtual bool OnPostInternalDrawModel( ClientModelRenderInfo_t *pInfo );
void DoInternalDrawModel( ClientModelRenderInfo_t *pInfo, DrawModelState_t *pState, matrix3x4_t *pBoneToWorldArray = NULL );
virtual IMaterial* GetEconWeaponMaterialOverride( int iTeam ) { return NULL; }
//
virtual CMouthInfo *GetMouth();
virtual void ControlMouth( CStudioHdr *pStudioHdr );
@@ -250,7 +247,7 @@ public:
void ForceClientSideAnimationOn();
void AddToClientSideAnimationList();
void RemoveFromClientSideAnimationList( bool bBeingDestroyed = false );
void RemoveFromClientSideAnimationList();
virtual bool IsSelfAnimating();
virtual void ResetLatched();
@@ -301,8 +298,8 @@ public:
virtual void Clear( void );
void ClearRagdoll();
void CreateUnragdollInfo( C_BaseAnimating *pRagdoll );
bool ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime );
virtual bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt );
void ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime );
virtual void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt );
// For shadows rendering the correct body + sequence...
virtual int GetBody() { return m_nBody; }
@@ -432,7 +429,6 @@ public:
// For prediction
int SelectWeightedSequence ( int activity );
int SelectWeightedSequenceFromModifiers( Activity activity, CUtlSymbol *pActivityModifiers, int iModifierCount );
void ResetSequenceInfo( void );
float SequenceDuration( void );
float SequenceDuration( CStudioHdr *pStudioHdr, int iSequence );
@@ -448,7 +444,6 @@ public:
virtual bool ShouldResetSequenceOnNewModel( void );
virtual bool IsViewModel() const;
virtual void UpdateOnRemove( void );
protected:
// View models scale their attachment positions to account for FOV. To get the unmodified
@@ -610,7 +605,7 @@ private:
// Calculated attachment points
CUtlVector<CAttachmentData> m_Attachments;
bool SetupBones_AttachmentHelper( CStudioHdr *pStudioHdr );
void SetupBones_AttachmentHelper( CStudioHdr *pStudioHdr );
EHANDLE m_hLightingOrigin;
EHANDLE m_hLightingOriginRelative;
@@ -620,7 +615,6 @@ private:
unsigned char m_nOldMuzzleFlashParity;
bool m_bInitModelEffects;
bool m_bDelayInitModelEffects;
// Dynamic models
bool m_bDynamicModelAllowed;
@@ -639,7 +633,6 @@ private:
mutable CStudioHdr *m_pStudioHdr;
mutable MDLHandle_t m_hStudioHdr;
CThreadFastMutex m_StudioHdrInitLock;
bool m_bHasAttachedParticles;
};
enum
@@ -765,12 +758,19 @@ inline CStudioHdr *C_BaseAnimating::GetModelPtr() const
inline void C_BaseAnimating::InvalidateMdlCache()
{
UnlockStudioHdr();
if ( m_pStudioHdr )
{
UnlockStudioHdr();
delete m_pStudioHdr;
m_pStudioHdr = NULL;
}
}
inline bool C_BaseAnimating::IsModelScaleFractional() const
inline bool C_BaseAnimating::IsModelScaleFractional() const /// very fast way to ask if the model scale is < 1.0f
{
return ( m_flModelScale < 1.0f );
COMPILE_TIME_ASSERT( sizeof( m_flModelScale ) == sizeof( int ) );
return *((const int *) &m_flModelScale) < 0x3f800000;
}
inline bool C_BaseAnimating::IsModelScaled() const
+2
View File
@@ -206,6 +206,8 @@ void C_BaseAnimatingOverlay::GetRenderBounds( Vector& theMins, Vector& theMaxs )
void C_BaseAnimatingOverlay::CheckForLayerChanges( CStudioHdr *hdr, float currentTime )
{
CDisableRangeChecks disableRangeChecks;
bool bLayersChanged = false;
// FIXME: damn, there has to be a better way than this.
+1 -18
View File
@@ -34,7 +34,6 @@ C_BaseCombatCharacter::C_BaseCombatCharacter()
m_pGlowEffect = NULL;
m_bGlowEnabled = false;
m_bOldGlowEnabled = false;
m_bClientSideGlowEnabled = false;
#endif // GLOWS_ENABLE
}
@@ -114,22 +113,6 @@ void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b )
*b = 0.76f;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
/*
void C_BaseCombatCharacter::EnableGlowEffect( float r, float g, float b )
{
// destroy the existing effect
if ( m_pGlowEffect )
{
DestroyGlowEffect();
}
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
}
*/
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@@ -142,7 +125,7 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
}
// create a new effect
if ( m_bGlowEnabled || m_bClientSideGlowEnabled )
if ( m_bGlowEnabled )
{
float r, g, b;
GetGlowEffectColor( &r, &g, &b );
+1 -6
View File
@@ -97,10 +97,6 @@ public:
#ifdef GLOWS_ENABLE
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
virtual void GetGlowEffectColor( float *r, float *g, float *b );
// void EnableGlowEffect( float r, float g, float b );
void SetClientSideGlowEnabled( bool bEnabled ){ m_bClientSideGlowEnabled = bEnabled; UpdateGlowEffect(); }
bool IsClientSideGlowEnabled( void ){ return m_bClientSideGlowEnabled; }
#endif // GLOWS_ENABLE
public:
@@ -125,8 +121,7 @@ private:
CHandle< C_BaseCombatWeapon > m_hActiveWeapon;
#ifdef GLOWS_ENABLE
bool m_bClientSideGlowEnabled; // client-side only value used for spectator
bool m_bGlowEnabled; // networked value
bool m_bGlowEnabled;
bool m_bOldGlowEnabled;
CGlowObject *m_pGlowEffect;
#endif // GLOWS_ENABLE
+9 -12
View File
@@ -163,10 +163,7 @@ void C_BaseCombatWeapon::OnDataChanged( DataUpdateType_t updateType )
}
}
if ( updateType == DATA_UPDATE_CREATED )
{
UpdateVisibility();
}
UpdateVisibility();
m_iOldState = m_iState;
@@ -261,8 +258,8 @@ void C_BaseCombatWeapon::DrawCrosshair()
}
*/
CHudCrosshair *pCrosshair = GET_HUDELEMENT( CHudCrosshair );
if ( !pCrosshair )
CHudCrosshair *crosshair = GET_HUDELEMENT( CHudCrosshair );
if ( !crosshair )
return;
// Find out if this weapon's auto-aimed onto a target
@@ -275,16 +272,16 @@ void C_BaseCombatWeapon::DrawCrosshair()
{
clr[3] = 255;
pCrosshair->SetCrosshair( GetWpnData().iconAutoaim, clr );
crosshair->SetCrosshair( GetWpnData().iconAutoaim, clr );
}
else if ( GetWpnData().iconCrosshair )
{
clr[3] = 255;
pCrosshair->SetCrosshair( GetWpnData().iconCrosshair, clr );
crosshair->SetCrosshair( GetWpnData().iconCrosshair, clr );
}
else
{
pCrosshair->ResetCrosshair();
crosshair->ResetCrosshair();
}
}
else
@@ -293,11 +290,11 @@ void C_BaseCombatWeapon::DrawCrosshair()
// zoomed crosshairs
if (bOnTarget && GetWpnData().iconZoomedAutoaim)
pCrosshair->SetCrosshair(GetWpnData().iconZoomedAutoaim, white);
crosshair->SetCrosshair(GetWpnData().iconZoomedAutoaim, white);
else if ( GetWpnData().iconZoomedCrosshair )
pCrosshair->SetCrosshair( GetWpnData().iconZoomedCrosshair, white );
crosshair->SetCrosshair( GetWpnData().iconZoomedCrosshair, white );
else
pCrosshair->ResetCrosshair();
crosshair->ResetCrosshair();
}
}
+107 -138
View File
@@ -41,10 +41,6 @@
#include "inetchannelinfo.h"
#include "proto_version.h"
#ifdef TF_CLIENT_DLL
#include "c_tf_player.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -80,7 +76,7 @@ void cc_cl_interp_all_changed( IConVar *pConVar, const char *pOldString, float f
static ConVar cl_extrapolate( "cl_extrapolate", "1", FCVAR_CHEAT, "Enable/disable extrapolation if interpolation history runs out." );
static ConVar cl_interp_npcs( "cl_interp_npcs", "0.0", FCVAR_USERINFO, "Interpolate NPC positions starting this many seconds in past (or cl_interp, if greater)" );
static ConVar cl_interp_all( "cl_interp_all", "0", 0, "Disable interpolation list optimizations.", 0, 0, 0, 0, cc_cl_interp_all_changed );
ConVar r_drawmodeldecals( "r_drawmodeldecals", "1", FCVAR_ALLOWED_IN_COMPETITIVE );
ConVar r_drawmodeldecals( "r_drawmodeldecals", "1" );
extern ConVar cl_showerror;
int C_BaseEntity::m_nPredictionRandomSeed = -1;
C_BasePlayer *C_BaseEntity::m_pPredictionPlayer = NULL;
@@ -575,8 +571,7 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar )
{
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
Vector v0(0, 0, 0);
CApparentVelocity<Vector> apparent(v0);
CApparentVelocity<Vector> apparent;
float prevtime = 0.0f;
while ( 1 )
{
@@ -599,8 +594,7 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
Vector v0(0, 0, 0);
CApparentVelocity<Vector> apparent(v0);
CApparentVelocity<Vector> apparent;
float newtime = 999999.0f;
Vector newVec( 0, 0, 0 );
bool bSpew = true;
@@ -668,7 +662,7 @@ void SpewInterpolatedVar( CInterpolatedVar< float > *pVar )
{
Msg( "--------------------------------------------------\n" );
int i = pVar->GetHead();
CApparentVelocity<float> apparent(0.0f);
CApparentVelocity<float> apparent;
while ( 1 )
{
float changetime;
@@ -690,8 +684,7 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float
flMax = -1e23;
int i = pVar->GetHead();
Vector v0(0, 0, 0);
CApparentVelocity<Vector> apparent(v0);
CApparentVelocity<Vector> apparent;
while ( 1 )
{
float changetime;
@@ -899,8 +892,6 @@ C_BaseEntity::C_BaseEntity() :
m_iv_angRotation( "C_BaseEntity::m_iv_angRotation" ),
m_iv_vecVelocity( "C_BaseEntity::m_iv_vecVelocity" )
{
m_pAttributes = NULL;
AddVar( &m_vecOrigin, &m_iv_vecOrigin, LATCH_SIMULATION_VAR );
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
// Removing this until we figure out why velocity introduces view hitching.
@@ -912,6 +903,7 @@ C_BaseEntity::C_BaseEntity() :
m_DataChangeEventRef = -1;
m_EntClientFlags = 0;
m_bEnableRenderingClipPlane = false;
m_iParentAttachment = 0;
m_nRenderFXBlend = 255;
@@ -949,10 +941,12 @@ C_BaseEntity::C_BaseEntity() :
#if !defined( NO_ENTITY_PREDICTION )
m_pPredictionContext = NULL;
#endif
//NOTE: not virtual! we are in the constructor!
C_BaseEntity::Clear();
SetModelName( NULL_STRING );
m_iClassname = NULL_STRING;
m_InterpolationListEntry = 0xFFFF;
m_TeleportListEntry = 0xFFFF;
@@ -993,7 +987,6 @@ C_BaseEntity::~C_BaseEntity()
void C_BaseEntity::Clear( void )
{
m_bDormant = true;
m_nCreationTick = -1;
m_RefEHandle.Term();
m_ModelInstance = MODEL_INSTANCE_INVALID;
@@ -1007,6 +1000,7 @@ void C_BaseEntity::Clear( void )
SetLocalOrigin( vec3_origin );
SetLocalAngles( vec3_angle );
model = NULL;
m_pOriginalData = NULL;
m_vecAbsOrigin.Init();
m_angAbsRotation.Init();
m_vecVelocity.Init();
@@ -1154,13 +1148,6 @@ bool C_BaseEntity::InitializeAsClientEntityByIndex( int iIndex, RenderGroup_t re
return true;
}
void C_BaseEntity::TrackAngRotation( bool bTrack )
{
if ( bTrack )
AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR );
else
RemoveVar( &m_angRotation, false );
}
void C_BaseEntity::Term()
{
@@ -1315,6 +1302,19 @@ bool C_BaseEntity::VPhysicsIsFlesh( void )
return false;
}
//-----------------------------------------------------------------------------
// Returns the health fraction
//-----------------------------------------------------------------------------
float C_BaseEntity::HealthFraction() const
{
if (GetMaxHealth() == 0)
return 1.0f;
float flFraction = (float)GetHealth() / (float)GetMaxHealth();
flFraction = clamp( flFraction, 0.0f, 1.0f );
return flFraction;
}
//-----------------------------------------------------------------------------
// Purpose: Retrieves the coordinate frame for this entity.
@@ -1749,9 +1749,9 @@ void C_BaseEntity::SetNetworkAngles( const QAngle& ang )
// Purpose:
// Input : index -
//-----------------------------------------------------------------------------
void C_BaseEntity::SetModelIndex( int index_ )
void C_BaseEntity::SetModelIndex( int index )
{
m_nModelIndex = index_;
m_nModelIndex = index;
const model_t *pModel = modelinfo->GetModel( m_nModelIndex );
SetModelPointer( pModel );
}
@@ -2043,7 +2043,7 @@ void C_BaseEntity::UpdatePartitionListEntry()
list |= PARTITION_CLIENT_RESPONSIVE_EDICTS;
// add the entity to the KD tree so we will collide against it
::partition->RemoveAndInsert( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, list, CollisionProp()->GetPartitionHandle() );
partition->RemoveAndInsert( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, list, CollisionProp()->GetPartitionHandle() );
}
@@ -2099,7 +2099,7 @@ void C_BaseEntity::NotifyShouldTransmit( ShouldTransmitState_t state )
SetDormant( true );
// remove the entity from the KD tree so we won't collide against it
::partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
}
break;
@@ -2173,7 +2173,6 @@ void C_BaseEntity::PreDataUpdate( DataUpdateType_t updateType )
}
m_ubOldInterpolationFrame = m_ubInterpolationFrame;
m_bOldShouldDraw = ShouldDraw();
}
const Vector& C_BaseEntity::GetOldOrigin()
@@ -2471,36 +2470,37 @@ void C_BaseEntity::UnlinkFromHierarchy()
void C_BaseEntity::ValidateModelIndex( void )
{
#ifdef TF_CLIENT_DLL
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_PYRO ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_PYRO] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_PYRO] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_ROME ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_ROME] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_ROME] );
return;
}
}
if ( m_nModelIndexOverrides[VISION_MODE_NONE] > 0 )
{
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_HALLOWEEN ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_HALLOWEEN] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_PYRO ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_PYRO] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_PYRO] );
return;
}
}
if ( IsLocalPlayerUsingVisionFilterFlags( TF_VISION_FILTER_ROME ) )
{
if ( m_nModelIndexOverrides[VISION_MODE_ROME] > 0 )
{
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_ROME] );
return;
}
}
SetModelByIndex( m_nModelIndexOverrides[VISION_MODE_NONE] );
return;
}
#endif
@@ -2625,23 +2625,6 @@ void C_BaseEntity::PostDataUpdate( DataUpdateType_t updateType )
{
UpdateVisibility();
}
// if ShouldDraw state changes, recalculate visibility
if ( m_bOldShouldDraw != ShouldDraw() )
{
UpdateVisibility();
}
}
//-----------------------------------------------------------------------------
// Purpose: Latch simulation values when the entity has not changed
//-----------------------------------------------------------------------------
void C_BaseEntity::OnDataUnchangedInPVS()
{
Assert( m_hNetworkMoveParent.Get() || !m_hNetworkMoveParent.IsValid() );
HierarchySetParent(m_hNetworkMoveParent);
MarkMessageReceived();
}
//-----------------------------------------------------------------------------
@@ -3323,6 +3306,7 @@ void C_BaseEntity::ComputeFxBlend( void )
if ( m_nFXComputeFrame == gpGlobals->framecount )
return;
MDLCACHE_CRITICAL_SECTION();
int blend=0;
float offset;
@@ -3760,7 +3744,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
case mod_brush:
{
color32 cColor32 = { (byte)cColor.r(), (byte)cColor.g(), (byte)cColor.b(), (byte)cColor.a() };
color32 cColor32 = { (uint8)cColor.r(), (uint8)cColor.g(), (uint8)cColor.b(), (uint8)cColor.a() };
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
}
break;
@@ -3859,7 +3843,7 @@ void C_BaseEntity::operator delete( void *pMem )
//========================================================================================
// TEAM HANDLING
//========================================================================================
C_Team *C_BaseEntity::GetTeam( void ) const
C_Team *C_BaseEntity::GetTeam( void )
{
return GetGlobalTeam( m_iTeamNum );
}
@@ -3884,7 +3868,7 @@ int C_BaseEntity::GetRenderTeamNumber( void )
//-----------------------------------------------------------------------------
// Purpose: Returns true if these entities are both in at least one team together
//-----------------------------------------------------------------------------
bool C_BaseEntity::InSameTeam( const C_BaseEntity *pEntity ) const
bool C_BaseEntity::InSameTeam( C_BaseEntity *pEntity )
{
if ( !pEntity )
return false;
@@ -5318,43 +5302,41 @@ int C_BaseEntity::GetIntermediateDataSize( void )
static int g_FieldSizes[FIELD_TYPECOUNT] =
{
0, // FIELD_VOID
sizeof(float), // FIELD_FLOAT
sizeof(int), // FIELD_STRING
sizeof(Vector), // FIELD_VECTOR
sizeof(Quaternion), // FIELD_QUATERNION
sizeof(int), // FIELD_INTEGER
sizeof(char), // FIELD_BOOLEAN
sizeof(short), // FIELD_SHORT
sizeof(char), // FIELD_CHARACTER
sizeof(color32), // FIELD_COLOR32
sizeof(int), // FIELD_EMBEDDED (handled specially)
sizeof(int), // FIELD_CUSTOM (handled specially)
FIELD_SIZE( FIELD_VOID ),
FIELD_SIZE( FIELD_FLOAT ),
FIELD_SIZE( FIELD_STRING ),
FIELD_SIZE( FIELD_VECTOR ),
FIELD_SIZE( FIELD_QUATERNION ),
FIELD_SIZE( FIELD_INTEGER ),
FIELD_SIZE( FIELD_BOOLEAN ),
FIELD_SIZE( FIELD_SHORT ),
FIELD_SIZE( FIELD_CHARACTER ),
FIELD_SIZE( FIELD_COLOR32 ),
FIELD_SIZE( FIELD_EMBEDDED ),
FIELD_SIZE( FIELD_CUSTOM ),
//---------------------------------
FIELD_SIZE( FIELD_CLASSPTR ),
FIELD_SIZE( FIELD_EHANDLE ),
FIELD_SIZE( FIELD_EDICT ),
sizeof(int), // FIELD_CLASSPTR
sizeof(EHANDLE), // FIELD_EHANDLE
sizeof(int), // FIELD_EDICT
FIELD_SIZE( FIELD_POSITION_VECTOR ),
FIELD_SIZE( FIELD_TIME ),
FIELD_SIZE( FIELD_TICK ),
FIELD_SIZE( FIELD_MODELNAME ),
FIELD_SIZE( FIELD_SOUNDNAME ),
sizeof(Vector), // FIELD_POSITION_VECTOR
sizeof(float), // FIELD_TIME
sizeof(int), // FIELD_TICK
sizeof(int), // FIELD_MODELNAME
sizeof(int), // FIELD_SOUNDNAME
FIELD_SIZE( FIELD_INPUT ),
FIELD_SIZE( FIELD_FUNCTION ),
FIELD_SIZE( FIELD_VMATRIX ),
FIELD_SIZE( FIELD_VMATRIX_WORLDSPACE ),
FIELD_SIZE( FIELD_MATRIX3X4_WORLDSPACE ),
FIELD_SIZE( FIELD_INTERVAL ),
FIELD_SIZE( FIELD_MODELINDEX ),
FIELD_SIZE( FIELD_MATERIALINDEX ),
sizeof(int), // FIELD_INPUT (uses custom type)
#ifdef GNUC
// pointer to members under gnuc are 8bytes if you have a virtual func
sizeof(uint64), // FIELD_FUNCTION
#else
sizeof(int *), // FIELD_FUNCTION
#endif
sizeof(VMatrix), // FIELD_VMATRIX
sizeof(VMatrix), // FIELD_VMATRIX_WORLDSPACE
sizeof(matrix3x4_t),// FIELD_MATRIX3X4_WORLDSPACE // NOTE: Use array(FIELD_FLOAT, 12) for matrix3x4_t NOT in worldspace
sizeof(interval_t), // FIELD_INTERVAL
sizeof(int), // FIELD_MODELINDEX
FIELD_SIZE( FIELD_VECTOR2D ),
FIELD_SIZE( FIELD_INTEGER64 ),
FIELD_SIZE( FIELD_POINTER ),
};
//-----------------------------------------------------------------------------
@@ -5598,22 +5580,16 @@ void C_BaseEntity::DrawBBoxVisualizations( void )
{
if ( m_fBBoxVisFlags & VISUALIZE_COLLISION_BOUNDS )
{
if ( debugoverlay )
{
debugoverlay->AddBoxOverlay( CollisionProp()->GetCollisionOrigin(), CollisionProp()->OBBMins(),
CollisionProp()->OBBMaxs(), CollisionProp()->GetCollisionAngles(), 190, 190, 0, 0, 0.01 );
}
debugoverlay->AddBoxOverlay( CollisionProp()->GetCollisionOrigin(), CollisionProp()->OBBMins(),
CollisionProp()->OBBMaxs(), CollisionProp()->GetCollisionAngles(), 190, 190, 0, 0, 0.01 );
}
if ( m_fBBoxVisFlags & VISUALIZE_SURROUNDING_BOUNDS )
{
Vector vecSurroundMins, vecSurroundMaxs;
CollisionProp()->WorldSpaceSurroundingBounds( &vecSurroundMins, &vecSurroundMaxs );
if ( debugoverlay )
{
debugoverlay->AddBoxOverlay( vec3_origin, vecSurroundMins,
vecSurroundMaxs, vec3_angle, 0, 255, 255, 0, 0.01 );
}
debugoverlay->AddBoxOverlay( vec3_origin, vecSurroundMins,
vecSurroundMaxs, vec3_angle, 0, 255, 255, 0, 0.01 );
}
if ( m_fBBoxVisFlags & VISUALIZE_RENDER_BOUNDS || r_drawrenderboxes.GetInt() )
@@ -5645,6 +5621,13 @@ RenderGroup_t C_BaseEntity::GetRenderGroup()
if ( m_nRenderMode == kRenderNone )
return RENDER_GROUP_OPAQUE_ENTITY;
// When an entity has a material proxy, we have to recompute
// translucency here because the proxy may have changed it.
if (modelinfo->ModelHasMaterialProxy( GetModel() ))
{
modelinfo->RecomputeTranslucency( const_cast<model_t*>(GetModel()), GetSkin(), GetBody(), GetClientRenderable() );
}
// NOTE: Bypassing the GetFXBlend protection logic because we want this to
// be able to be called from AddToLeafSystem.
int nTempComputeFrame = m_nFXComputeFrame;
@@ -6302,14 +6285,10 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
return true;
// Some wearables parent to the view model
C_TFPlayer *pPlayer = ToTFPlayer( pParent );
if ( pPlayer )
C_BasePlayer *pPlayer = ToBasePlayer( pParent );
if ( pPlayer && pPlayer->GetViewModel() == this )
{
if ( pPlayer->GetViewModel() == this )
return true;
if ( pPlayer->HasItem() && ( pPlayer->GetItem()->GetItemID() == TF_ITEM_CAPTURE_FLAG ) && ( pPlayer->GetItem() == this ) )
return true;
return true;
}
// always allow the briefcase model
@@ -6318,12 +6297,12 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
{
if ( FStrEq( pszModel, "models/flag/briefcase.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/props_doomsday/australium_container.mdl" ) )
return true;
// Temp for MVM testing
if ( FStrEq( pszModel, "models/buildables/sapper_placement.mdl" ) )
if ( FStrEq( pszModel, "models/buildables/sapper_placement_sentry1.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/props_td/atom_bomb.mdl" ) )
@@ -6331,16 +6310,6 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
if ( FStrEq( pszModel, "models/props_lakeside_event/bomb_temp_hat.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/props_moonbase/powersupply_flag.mdl" ) )
return true;
// The Halloween 2014 doomsday flag replacement
if ( FStrEq( pszModel, "models/flag/ticket_case.mdl" ) )
return true;
if ( FStrEq( pszModel, "models/weapons/c_models/c_grapple_proj/c_grapple_proj.mdl" ) )
return true;
}
// Any entity that's not an item parented to a player is invalid.
+5 -25
View File
@@ -58,7 +58,6 @@ class C_BaseCombatCharacter;
class CEntityMapData;
class ConVar;
class CDmgAccumulator;
class IHasAttributes;
struct CSoundParameters;
@@ -336,7 +335,6 @@ public:
// save out interpolated values
virtual void PreDataUpdate( DataUpdateType_t updateType );
virtual void PostDataUpdate( DataUpdateType_t updateType );
virtual void OnDataUnchangedInPVS();
virtual void ValidateModelIndex( void );
@@ -518,7 +516,6 @@ public:
// Used when the collision prop is told to ask game code for the world-space surrounding box
virtual void ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs );
virtual float GetHealthBarHeightOffset() const { return 0.f; }
// Returns the entity-to-world transform
matrix3x4_t &EntityToWorldTransform();
@@ -572,11 +569,11 @@ public:
virtual bool GetAttachmentVelocity( int number, Vector &originVel, Quaternion &angleVel );
// Team handling
virtual C_Team *GetTeam( void ) const;
virtual C_Team *GetTeam( void );
virtual int GetTeamNumber( void ) const;
virtual void ChangeTeam( int iTeamNum ); // Assign this entity to a team.
virtual int GetRenderTeamNumber( void );
virtual bool InSameTeam( const C_BaseEntity *pEntity ) const; // Returns true if the specified entity is on the same team as this one
virtual bool InSameTeam( C_BaseEntity *pEntity ); // Returns true if the specified entity is on the same team as this one
virtual bool InLocalTeam( void );
// ID Target handling
@@ -689,7 +686,7 @@ public:
virtual bool ShouldDraw();
inline bool IsVisible() const { return m_hRender != INVALID_CLIENT_RENDER_HANDLE; }
virtual void UpdateVisibility();
void UpdateVisibility();
// Returns true if the entity changes its position every frame on the server but it doesn't
// set animtime. In that case, the client returns true here so it copies the server time to
@@ -746,8 +743,7 @@ public:
virtual void SetHealth(int iHealth) {}
virtual int GetHealth() const { return 0; }
virtual int GetMaxHealth() const { return 1; }
virtual bool IsVisibleToTargetID( void ) const { return false; }
virtual bool IsHealthBarVisible( void ) const { return false; }
virtual bool IsVisibleToTargetID( void ) { return false; }
// Returns the health fraction
float HealthFraction() const;
@@ -1176,17 +1172,7 @@ public:
// Sets the origin + angles to match the last position received
void MoveToLastReceivedPosition( bool force = false );
// Return the IHasAttributes interface for this base entity. Removes the need for:
// dynamic_cast< IHasAttributes * >( pEntity );
// Which is remarkably slow.
// GetAttribInterface( CBaseEntity *pEntity ) in attribute_manager.h uses
// this function, tests for NULL, and Asserts m_pAttributes == dynamic_cast.
inline IHasAttributes *GetHasAttributesInterfacePtr() const { return m_pAttributes; }
protected:
// NOTE: m_pAttributes needs to be set in the leaf class constructor.
IHasAttributes *m_pAttributes;
// Only meant to be called from subclasses
void DestroyModelInstance();
@@ -1226,7 +1212,7 @@ protected:
public:
// Accessors for above
static int GetPredictionRandomSeed( bool bUseUnSyncedServerPlatTime = false );
static int GetPredictionRandomSeed( void );
static void SetPredictionRandomSeed( const CUserCmd *cmd );
static C_BasePlayer *GetPredictionPlayer( void );
static void SetPredictionPlayer( C_BasePlayer *player );
@@ -1394,7 +1380,6 @@ public:
virtual bool IsDeflectable() { return false; }
bool IsCombatCharacter() { return MyCombatCharacterPointer() == NULL ? false : true; }
protected:
int m_nFXComputeFrame;
@@ -1443,8 +1428,6 @@ public:
// a render handle, and is put into the spatial partition.
bool InitializeAsClientEntityByIndex( int iIndex, RenderGroup_t renderGroup );
void TrackAngRotation( bool bTrack );
private:
friend void OnRenderStart();
@@ -1704,9 +1687,6 @@ protected:
RenderMode_t m_PreviousRenderMode;
color32 m_PreviousRenderColor;
#endif
private:
bool m_bOldShouldDraw;
};
EXTERN_RECV_TABLE(DT_BaseEntity);
+24 -22
View File
@@ -92,7 +92,7 @@ bool GetHWMExpressionFileName( const char *pFilename, char *pHWMFilename )
// Find the hardware morph scene name and pass that along as well.
char szExpression[MAX_PATH];
V_strcpy_safe( szExpression, pFilename );
V_strcpy( szExpression, pFilename );
char szExpressionHWM[MAX_PATH];
szExpressionHWM[0] = '\0';
@@ -431,20 +431,21 @@ void *CFlexSceneFileManager::FindSceneFile( IHasLocalToGlobalFlexSettings *insta
{
char szFilename[MAX_PATH];
Assert( V_strlen( filename ) < MAX_PATH );
V_strcpy_safe( szFilename, filename );
V_strcpy( szFilename, filename );
#if defined( TF_CLIENT_DLL )
char szHWMFilename[MAX_PATH];
if ( GetHWMExpressionFileName( szFilename, szHWMFilename ) )
{
V_strcpy_safe( szFilename, szHWMFilename );
V_strcpy( szFilename, szHWMFilename );
}
#endif
Q_FixSlashes( szFilename );
// See if it's already loaded
for ( int i = 0; i < m_FileList.Count(); i++ )
int i;
for ( i = 0; i < m_FileList.Count(); i++ )
{
CFlexSceneFile *file = m_FileList[ i ];
if ( file && !Q_stricmp( file->filename, szFilename ) )
@@ -561,11 +562,11 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr )
m_iEyeUpdown = FindFlexController( "eyes_updown" );
m_iEyeRightleft = FindFlexController( "eyes_rightleft" );
if ( m_iEyeUpdown != LocalFlexController_t(-1) )
if ( m_iEyeUpdown != -1 )
{
pStudioHdr->pFlexcontroller( m_iEyeUpdown )->localToGlobal = AddGlobalFlexController( "eyes_updown" );
}
if ( m_iEyeRightleft != LocalFlexController_t(-1) )
if ( m_iEyeRightleft != -1 )
{
pStudioHdr->pFlexcontroller( m_iEyeRightleft )->localToGlobal = AddGlobalFlexController( "eyes_rightleft" );
}
@@ -593,13 +594,13 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr )
// calculate animated eye deflection
Vector eyeDeflect;
QAngle eyeAng( 0, 0, 0 );
if ( m_iEyeUpdown != LocalFlexController_t(-1) )
if ( m_iEyeUpdown != -1 )
{
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeUpdown );
eyeAng.x = g_flexweight[ pflex->localToGlobal ];
}
if ( m_iEyeRightleft != LocalFlexController_t(-1) )
if ( m_iEyeRightleft != -1 )
{
mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeRightleft );
eyeAng.y = g_flexweight[ pflex->localToGlobal ];
@@ -1056,7 +1057,7 @@ void C_BaseFlex::GetToolRecordingState( KeyValues *msg )
Vector viewtarget = m_viewtarget; // Use the unfiltered value
// HACK HACK: Unmap eyes right/left amounts
if (m_iEyeUpdown != LocalFlexController_t(-1) && m_iEyeRightleft != LocalFlexController_t(-1))
if (m_iEyeUpdown != -1 && m_iEyeRightleft != -1)
{
mstudioflexcontroller_t *flexupdown = hdr->pFlexcontroller( m_iEyeUpdown );
mstudioflexcontroller_t *flexrightleft = hdr->pFlexcontroller( m_iEyeRightleft );
@@ -1594,6 +1595,7 @@ void C_BaseFlex::RemoveSceneEvent( CChoreoScene *scene, CChoreoEvent *event, boo
info->m_bStarted = false;
m_SceneEvents.Remove( i );
return;
}
}
@@ -1630,15 +1632,15 @@ bool C_BaseFlex::CheckSceneEventCompletion( CSceneEventInfo *info, float current
return true;
}
void C_BaseFlex::SetFlexWeight( LocalFlexController_t index_, float value )
void C_BaseFlex::SetFlexWeight( LocalFlexController_t index, float value )
{
if ( index_ >= 0 && index_ < GetNumFlexControllers())
if (index >= 0 && index < GetNumFlexControllers())
{
CStudioHdr *pstudiohdr = GetModelPtr( );
if (! pstudiohdr)
return;
mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( index_ );
mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( index );
if (pflexcontroller->max != pflexcontroller->min)
{
@@ -1646,26 +1648,26 @@ void C_BaseFlex::SetFlexWeight( LocalFlexController_t index_, float value )
value = clamp( value, 0.0f, 1.0f );
}
m_flexWeight[index_] = value;
m_flexWeight[ index ] = value;
}
}
float C_BaseFlex::GetFlexWeight( LocalFlexController_t index_ )
float C_BaseFlex::GetFlexWeight( LocalFlexController_t index )
{
if ( index_ >= 0 && index_ < GetNumFlexControllers())
if (index >= 0 && index < GetNumFlexControllers())
{
CStudioHdr *pstudiohdr = GetModelPtr( );
if (! pstudiohdr)
return 0;
mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( index_ );
mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( index );
if (pflexcontroller->max != pflexcontroller->min)
{
return m_flexWeight[index_] * (pflexcontroller->max - pflexcontroller->min) + pflexcontroller->min;
return m_flexWeight[index] * (pflexcontroller->max - pflexcontroller->min) + pflexcontroller->min;
}
return m_flexWeight[index_];
return m_flexWeight[index];
}
return 0.0;
}
@@ -1833,8 +1835,8 @@ int C_BaseFlex::FlexControllerLocalToGlobal( const flexsettinghdr_t *pSettinghdr
FS_LocalToGlobal_t& result = m_LocalToGlobal[ idx ];
// Validate lookup
Assert( result.m_nCount != 0 && key < result.m_nCount );
int iMap = result.m_Mapping[ key ];
return iMap;
int index = result.m_Mapping[ key ];
return index;
}
//-----------------------------------------------------------------------------
@@ -1877,11 +1879,11 @@ void C_BaseFlex::AddFlexSetting( const char *expr, float scale,
{
// Translate to local flex controller
// this is translating from the settings's local index to the models local index
int iFlex = FlexControllerLocalToGlobal( pSettinghdr, pWeights->key );
int index = FlexControllerLocalToGlobal( pSettinghdr, pWeights->key );
// blend scaled weighting in to total (post networking g_flexweight!!!!)
float s = clamp( scale * pWeights->influence, 0.0f, 1.0f );
g_flexweight[iFlex] = g_flexweight[iFlex] * (1.0f - s) + pWeights->weight * s;
g_flexweight[index] = g_flexweight[index] * (1.0f - s) + pWeights->weight * s;
}
}
+1 -1
View File
@@ -91,7 +91,7 @@ struct FS_LocalToGlobal_t
const flexsettinghdr_t *m_Key;
int m_nCount;
int *m_Mapping;
int *m_Mapping = NULL;
};
bool FlexSettingLessFunc( const FS_LocalToGlobal_t& lhs, const FS_LocalToGlobal_t& rhs );
+34 -64
View File
@@ -50,10 +50,6 @@
#include "sourcevr/isourcevirtualreality.h"
#include "client_virtualreality.h"
#ifdef TF_CLIENT_DLL
#include "tf_gamerules.h"
#endif
#if defined USES_ECON_ITEMS
#include "econ_wearable.h"
#endif
@@ -115,7 +111,7 @@ ConVar spec_freeze_distance_min( "spec_freeze_distance_min", "96", FCVAR_CHEAT,
ConVar spec_freeze_distance_max( "spec_freeze_distance_max", "200", FCVAR_CHEAT, "Maximum random distance from the target to stop when framing them in observer freeze cam." );
#endif
static ConVar cl_first_person_uses_world_model ( "cl_first_person_uses_world_model", "0", FCVAR_NONE, "Causes the third person model to be drawn instead of the view model" );
static ConVar cl_first_person_uses_world_model ( "cl_first_person_uses_world_model", "0", FCVAR_ARCHIVE, "Causes the third person model to be drawn instead of the view model" );
ConVar demo_fov_override( "demo_fov_override", "0", FCVAR_CLIENTDLL | FCVAR_DONTRECORD, "If nonzero, this value will be used to override FOV during demo playback." );
@@ -126,9 +122,6 @@ ConVar demo_fov_override( "demo_fov_override", "0", FCVAR_CLIENTDLL | FCVAR_DONT
ConVar cl_meathook_neck_pivot_ingame_up( "cl_meathook_neck_pivot_ingame_up", "7.0" );
ConVar cl_meathook_neck_pivot_ingame_fwd( "cl_meathook_neck_pivot_ingame_fwd", "3.0" );
static ConVar cl_clean_textures_on_death( "cl_clean_textures_on_death", "0", FCVAR_DEVELOPMENTONLY, "If enabled, attempts to purge unused textures every time a freeze cam is shown" );
void RecvProxy_LocalVelocityX( const CRecvProxyData *pData, void *pStruct, void *pOut );
void RecvProxy_LocalVelocityY( const CRecvProxyData *pData, void *pStruct, void *pOut );
void RecvProxy_LocalVelocityZ( const CRecvProxyData *pData, void *pStruct, void *pOut );
@@ -345,7 +338,6 @@ BEGIN_PREDICTION_DATA_NO_BASE( CPlayerLocalData )
DEFINE_PRED_FIELD_TOL( m_flFallVelocity, FIELD_FLOAT, FTYPEDESC_INSENDTABLE, 0.5f ),
// DEFINE_PRED_FIELD( m_nOldButtons, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
DEFINE_FIELD( m_nOldButtons, FIELD_INTEGER ),
DEFINE_FIELD( m_flOldForwardMove, FIELD_FLOAT ),
DEFINE_PRED_FIELD( m_flStepSize, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ),
DEFINE_FIELD( m_flFOVRate, FIELD_FLOAT ),
@@ -444,7 +436,6 @@ C_BasePlayer::C_BasePlayer() : m_iv_vecViewOffset( "C_BasePlayer::m_iv_vecViewOf
m_bFiredWeapon = false;
m_nForceVisionFilterFlags = 0;
m_nLocalPlayerVisionFlags = 0;
ListenForGameEvent( "base_player_teleported" );
}
@@ -473,8 +464,8 @@ void C_BasePlayer::Spawn( void )
ClearFlags();
AddFlag( FL_CLIENT );
int fEffects = GetEffects() & EF_NOSHADOW;
SetEffects( fEffects );
int effects = GetEffects() & EF_NOSHADOW;
SetEffects( effects );
m_iFOV = 0; // init field of view.
@@ -550,7 +541,6 @@ CBaseEntity *C_BasePlayer::GetObserverTarget() const // returns players target o
case OBS_MODE_FIXED: // view from a fixed camera position
case OBS_MODE_IN_EYE: // follow a player in first person view
case OBS_MODE_CHASE: // follow a player in third person view
case OBS_MODE_POI: // PASSTIME point of interest - game objective, big fight, anything interesting
case OBS_MODE_ROAMING: // free roaming
return m_hObserverTarget;
break;
@@ -645,7 +635,6 @@ int C_BasePlayer::GetObserverMode() const
case OBS_MODE_FIXED: // view from a fixed camera position
case OBS_MODE_IN_EYE: // follow a player in first person view
case OBS_MODE_CHASE: // follow a player in third person view
case OBS_MODE_POI: // PASSTIME point of interest - game objective, big fight, anything interesting
case OBS_MODE_ROAMING: // free roaming
return m_iObserverMode;
break;
@@ -722,8 +711,8 @@ void C_BasePlayer::FireGameEvent( IGameEvent *event )
{
if ( FStrEq( event->GetName(), "base_player_teleported" ) )
{
const int index_ = event->GetInt( "entindex" );
if ( index_ == entindex() && IsLocalPlayer() )
const int index = event->GetInt( "entindex" );
if ( index == entindex() && IsLocalPlayer() )
{
// In VR, we want to make sure our head and body
// are aligned after we teleport.
@@ -891,10 +880,6 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
// Force the sound mixer to the freezecam mixer
ConVar *pVar = (ConVar *)cvar->FindVar( "snd_soundmixer" );
pVar->SetValue( "FreezeCam_Only" );
// When we start, give unused textures an opportunity to unload
if ( cl_clean_textures_on_death.GetBool() )
g_pMaterialSystem->UncacheUnusedMaterials( false );
}
else if ( m_bWasFreezeFraming && GetObserverMode() != OBS_MODE_FREEZECAM )
{
@@ -912,14 +897,6 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
m_nForceVisionFilterFlags = 0;
CalculateVisionUsingCurrentFlags();
}
// force calculate vision when the local vision flags changed
int nCurrentLocalPlayerVisionFlags = GetLocalPlayerVisionFilterFlags();
if ( m_nLocalPlayerVisionFlags != nCurrentLocalPlayerVisionFlags )
{
CalculateVisionUsingCurrentFlags();
m_nLocalPlayerVisionFlags = nCurrentLocalPlayerVisionFlags;
}
}
// If we are updated while paused, allow the player origin to be snapped by the
@@ -1594,11 +1571,11 @@ void C_BasePlayer::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float&
if ( spec_track.GetInt() > 0 )
{
C_BaseEntity *pTarget = ClientEntityList().GetBaseEntity( spec_track.GetInt() );
C_BaseEntity *target = ClientEntityList().GetBaseEntity( spec_track.GetInt() );
if ( pTarget )
if ( target )
{
Vector v = pTarget->GetAbsOrigin(); v.z += 54;
Vector v = target->GetAbsOrigin(); v.z += 54;
QAngle a; VectorAngles( v - eyeOrigin, a );
NormalizeAngles( a );
@@ -1892,14 +1869,6 @@ void C_BasePlayer::ThirdPersonSwitch( bool bThirdperson )
{
return false;
}
#ifdef TF_CLIENT_DLL
if ( TFGameRules() && TFGameRules()->IsCompetitiveMode() && TFGameRules()->PlayersAreOnMatchSummaryStage() )
{
return false;
}
#endif
int ObserverMode = pLocalPlayer->GetObserverMode();
if ( ( ObserverMode == OBS_MODE_NONE ) || ( ObserverMode == OBS_MODE_IN_EYE ) )
{
@@ -2109,7 +2078,7 @@ void C_BasePlayer::GetToolRecordingState( KeyValues *msg )
// then this code can (should!) be removed
if ( state.m_bThirdPerson )
{
const Vector& cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
Vector cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
QAngle camAngles;
camAngles[ PITCH ] = cam_ofs[ PITCH ];
@@ -2164,11 +2133,11 @@ void C_BasePlayer::Simulate()
// Consider using GetRenderedWeaponModel() instead - it will get the
// viewmodel or the active weapon as appropriate.
//-----------------------------------------------------------------------------
C_BaseViewModel *C_BasePlayer::GetViewModel( int index_ /*= 0*/, bool bObserverOK )
C_BaseViewModel *C_BasePlayer::GetViewModel( int index /*= 0*/, bool bObserverOK )
{
Assert( index_ >= 0 && index_ < MAX_VIEWMODELS );
Assert( index >= 0 && index < MAX_VIEWMODELS );
C_BaseViewModel *vm = m_hViewModel[index_];
C_BaseViewModel *vm = m_hViewModel[ index ];
if ( bObserverOK && GetObserverMode() == OBS_MODE_IN_EYE )
{
@@ -2177,7 +2146,7 @@ C_BaseViewModel *C_BasePlayer::GetViewModel( int index_ /*= 0*/, bool bObserverO
// get the targets viewmodel unless the target is an observer itself
if ( target && target != this && !target->IsObserver() )
{
vm = target->GetViewModel( index_ );
vm = target->GetViewModel( index );
}
}
@@ -2625,7 +2594,7 @@ void C_BasePlayer::NotePredictionError( const Vector &vDelta )
// offset curtime and setup bones at that time using fake interpolation
// fake interpolation means we don't have reliable interpolation history (the local player doesn't animate locally)
// so we just modify cycle and origin directly and use that as a fake guess
bool C_BasePlayer::ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset )
void C_BasePlayer::ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset )
{
// we don't have any interpolation data, so fake it
float cycle = m_flCycle;
@@ -2640,37 +2609,30 @@ bool C_BasePlayer::ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOu
m_flCycle = fmod( 10 + cycle + m_flPlaybackRate * curtimeOffset, 1.0f );
SetLocalOrigin( origin + curtimeOffset * GetLocalVelocity() );
// Setup bone state to extrapolate physics velocity
bool bSuccess = SetupBones( pBonesOut, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime + curtimeOffset );
SetupBones( pBonesOut, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime + curtimeOffset );
m_flCycle = cycle;
SetLocalOrigin( origin );
return bSuccess;
}
bool C_BasePlayer::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
void C_BasePlayer::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
{
if ( !IsLocalPlayer() )
return BaseClass::GetRagdollInitBoneArrays(pDeltaBones0, pDeltaBones1, pCurrentBones, boneDt);
bool bSuccess = true;
if ( !ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones0, -boneDt ) )
bSuccess = false;
if ( !ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones1, 0 ) )
bSuccess = false;
{
BaseClass::GetRagdollInitBoneArrays(pDeltaBones0, pDeltaBones1, pCurrentBones, boneDt);
return;
}
ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones0, -boneDt );
ForceSetupBonesAtTimeFakeInterpolation( pDeltaBones1, 0 );
float ragdollCreateTime = PhysGetSyncCreateTime();
if ( ragdollCreateTime != gpGlobals->curtime )
{
if ( !ForceSetupBonesAtTimeFakeInterpolation( pCurrentBones, ragdollCreateTime - gpGlobals->curtime ) )
bSuccess = false;
ForceSetupBonesAtTimeFakeInterpolation( pCurrentBones, ragdollCreateTime - gpGlobals->curtime );
}
else
{
if ( !SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime ) )
bSuccess = false;
SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
}
return bSuccess;
}
@@ -2846,7 +2808,16 @@ bool C_BasePlayer::GetSteamID( CSteamID *pID )
{
if ( pi.friendsID && steamapicontext && steamapicontext->SteamUtils() )
{
pID->InstancedSet( pi.friendsID, 1, GetUniverse(), k_EAccountTypeIndividual );
#if 1 // new
static EUniverse universe = k_EUniverseInvalid;
if ( universe == k_EUniverseInvalid )
universe = steamapicontext->SteamUtils()->GetConnectedUniverse();
pID->InstancedSet( pi.friendsID, 1, universe, k_EAccountTypeIndividual );
#else // old
pID->InstancedSet( pi.friendsID, 1, steamapicontext->SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
#endif
return true;
}
@@ -2867,7 +2838,6 @@ void C_BasePlayer::UpdateWearables( void )
{
pItem->ValidateModelIndex();
pItem->UpdateVisibility();
pItem->CreateShadow();
}
}
}
+3 -5
View File
@@ -169,7 +169,7 @@ public:
virtual IRagdoll* GetRepresentativeRagdoll() const;
// override the initial bone position for ragdolls
virtual bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) OVERRIDE;
virtual void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt );
// Returns eye vectors
void EyeVectors( Vector *pForward, Vector *pRight = NULL, Vector *pUp = NULL );
@@ -264,7 +264,6 @@ public:
virtual void UpdateClientData( void );
bool IsLerpingFOV( void ) const;
virtual float GetFOV( void );
int GetDefaultFOV( void ) const;
virtual bool IsZoomed( void ) { return false; }
@@ -389,7 +388,7 @@ public:
#if defined USES_ECON_ITEMS
// Wearables
virtual void UpdateWearables();
void UpdateWearables();
C_EconWearable *GetWearable( int i ) { return m_hMyWearables[i]; }
int GetNumWearables( void ) { return m_hMyWearables.Count(); }
#endif
@@ -586,7 +585,7 @@ protected:
virtual bool IsDucked( void ) const { return m_Local.m_bDucked; }
virtual bool IsDucking( void ) const { return m_Local.m_bDucking; }
virtual float GetFallVelocity( void ) { return m_Local.m_flFallVelocity; }
bool ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset );
void ForceSetupBonesAtTimeFakeInterpolation( matrix3x4_t *pBonesOut, float curtimeOffset );
float m_flLaggedMovementValue;
@@ -612,7 +611,6 @@ protected:
float m_flNextAchievementAnnounceTime;
int m_nForceVisionFilterFlags; // Force our vision filter to a specific setting
int m_nLocalPlayerVisionFlags;
#if defined USES_ECON_ITEMS
// Wearables
+17 -17
View File
@@ -92,11 +92,11 @@ void C_BaseTempEntity::Precache( void )
//-----------------------------------------------------------------------------
void C_BaseTempEntity::PrecacheTempEnts( void )
{
C_BaseTempEntity *pTe = GetList();
while ( pTe )
C_BaseTempEntity *te = GetList();
while ( te )
{
pTe->Precache();
pTe = pTe->GetNext();
te->Precache();
te = te->GetNext();
}
}
@@ -106,12 +106,12 @@ void C_BaseTempEntity::PrecacheTempEnts( void )
void C_BaseTempEntity::ClearDynamicTempEnts( void )
{
C_BaseTempEntity *next;
C_BaseTempEntity *pTe = s_pDynamicEntities;
while ( pTe )
C_BaseTempEntity *te = s_pDynamicEntities;
while ( te )
{
next = pTe->GetNextDynamic();
delete pTe;
pTe = next;
next = te->GetNextDynamic();
delete te;
te = next;
}
s_pDynamicEntities = NULL;
@@ -123,20 +123,20 @@ void C_BaseTempEntity::ClearDynamicTempEnts( void )
void C_BaseTempEntity::CheckDynamicTempEnts( void )
{
C_BaseTempEntity *next, *newlist = NULL;
C_BaseTempEntity *pTe = s_pDynamicEntities;
while ( pTe )
C_BaseTempEntity *te = s_pDynamicEntities;
while ( te )
{
next = pTe->GetNextDynamic();
if ( pTe->ShouldDestroy() )
next = te->GetNextDynamic();
if ( te->ShouldDestroy() )
{
delete pTe;
delete te;
}
else
{
pTe->m_pNextDynamic = newlist;
newlist = pTe;
te->m_pNextDynamic = newlist;
newlist = te;
}
pTe = next;
te = next;
}
s_pDynamicEntities = newlist;
-1
View File
@@ -55,7 +55,6 @@ public:
virtual void NotifyShouldTransmit( ShouldTransmitState_t state );
virtual void PreDataUpdate( DataUpdateType_t updateType );
virtual void PostDataUpdate( DataUpdateType_t updateType );
virtual void OnDataUnchangedInPVS( void ) { }
virtual void OnPreDataChanged( DataUpdateType_t updateType );
virtual void OnDataChanged( DataUpdateType_t updateType );
virtual void SetDormant( bool bDormant );
+3 -16
View File
@@ -18,9 +18,6 @@
#include "tools/bonelist.h"
#include <KeyValues.h>
#include "hltvcamera.h"
#ifdef TF_CLIENT_DLL
#include "tf_weaponbase.h"
#endif
#if defined( REPLAY_ENABLED )
#include "replay/replaycamera.h"
@@ -56,8 +53,8 @@ void FormatViewModelAttachment( Vector &vOrigin, bool bInverse )
// 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 = worldx / viewx;
float factorY = factorX;
// Get the coordinates in the viewer's space.
@@ -195,7 +192,7 @@ bool C_BaseViewModel::Interpolate( float currentTime )
}
bool C_BaseViewModel::ShouldFlipViewModel()
inline bool C_BaseViewModel::ShouldFlipViewModel()
{
#ifdef CSTRIKE_DLL
// If cl_righthand is set, then we want them all right-handed.
@@ -334,16 +331,6 @@ int C_BaseViewModel::DrawModel( int flags )
}
}
#ifdef TF_CLIENT_DLL
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 );
}
#endif
return ret;
}
+2 -5
View File
@@ -1875,14 +1875,11 @@ void CSnowFallManager::FindSnowVolumes( Vector &vecCenter, float flRadius, Vecto
{
for ( iSnow = 0; iSnow < m_nActiveSnowCount; ++iSnow )
{
Vector vecMin, vecMax;
Vector vecCenter, vecMin, vecMax;
vecCenter = ( m_aSnow[iSnow].m_vecMin, m_aSnow[iSnow].m_vecMax ) * 0.5;
vecMin = m_aSnow[iSnow].m_vecMin - vecCenter;
vecMax = m_aSnow[iSnow].m_vecMax - vecCenter;
if ( debugoverlay )
{
debugoverlay->AddBoxOverlay( vecCenter, vecMin, vecMax, QAngle( 0, 0, 0 ), 200, 0, 0, 25, r_SnowDebugBox.GetFloat() );
}
debugoverlay->AddBoxOverlay( vecCenter, vecMin, vecMax, QAngle( 0, 0, 0 ), 200, 0, 0, 25, r_SnowDebugBox.GetFloat() );
}
}
#endif
+3 -5
View File
@@ -228,6 +228,7 @@ void C_EntityDissolve::BuildTeslaEffect( mstudiobbox_t *pHitBox, const matrix3x4
{
// Move it towards the camera
Vector vecFlash = tr.endpos;
Vector vecForward;
AngleVectors( MainViewAngles(), &vecForward );
vecFlash -= (vecForward * 8);
@@ -555,7 +556,7 @@ void C_EntityDissolve::ClientThink( void )
// because when the server says to destroy it, the client won't be able to find it.
// ClientEntityList().RemoveEntity( GetClientHandle() );
::partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
RemoveFromLeafSystem();
@@ -574,10 +575,7 @@ void C_EntityDissolve::ClientThink( void )
#ifdef TF_CLIENT_DLL
else
{
// Hide the ragdoll -- don't actually delete it or else things get unhappy when
// we get a message from the server telling us to delete it
pEnt->AddEffects( EF_NODRAW );
pEnt->ParticleProp()->StopEmission();
pEnt->Release();
}
#endif
}
+1 -1
View File
@@ -217,7 +217,7 @@ void C_FireSmoke::RemoveClientOnly(void)
// Remove from the client entity list.
ClientEntityList().RemoveEntity( GetClientHandle() );
::partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
partition->Remove( PARTITION_CLIENT_SOLID_EDICTS | PARTITION_CLIENT_RESPONSIVE_EDICTS | PARTITION_CLIENT_NON_STATIC_EDICTS, CollisionProp()->GetPartitionHandle() );
RemoveFromLeafSystem();
}
+8 -11
View File
@@ -134,19 +134,16 @@ void C_Fish::ClientThink()
{
if (FishDebug.GetBool())
{
if ( debugoverlay )
debugoverlay->AddLineOverlay( m_pos, m_actualPos, 255, 0, 0, true, 0.1f );
switch( m_localLifeState )
{
debugoverlay->AddLineOverlay( m_pos, m_actualPos, 255, 0, 0, true, 0.1f );
switch( m_localLifeState )
{
case LIFE_DYING:
debugoverlay->AddTextOverlay( m_pos, 0.1f, "DYING" );
break;
case LIFE_DYING:
debugoverlay->AddTextOverlay( m_pos, 0.1f, "DYING" );
break;
case LIFE_DEAD:
debugoverlay->AddTextOverlay( m_pos, 0.1f, "DEAD" );
break;
}
case LIFE_DEAD:
debugoverlay->AddTextOverlay( m_pos, 0.1f, "DEAD" );
break;
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ public:
private:
int m_nOccluderIndex;
bool m_bActive;
bool m_bActive = false;
};
IMPLEMENT_CLIENTCLASS_DT( C_FuncOccluder, DT_FuncOccluder, CFuncOccluder )
+9 -9
View File
@@ -94,14 +94,14 @@ private:
return &m_pSmokeParticleInfos[GetSmokeParticleIndex(x,y,z)];
}
inline void GetParticleInfoXYZ(int index_, int &x, int &y, int &z)
inline void GetParticleInfoXYZ(int index, int &x, int &y, int &z)
{
Assert( index_ >= 0 && index_ < m_xCount * m_yCount * m_zCount );
z = index_ / (m_xCount*m_yCount);
Assert( index >= 0 && index < m_xCount * m_yCount * m_zCount );
z = index / (m_xCount*m_yCount);
int zIndex = z*m_xCount*m_yCount;
y = (index_ - zIndex) / m_xCount;
y = (index - zIndex) / m_xCount;
int yIndex = y*m_xCount;
x = index_ - zIndex - yIndex;
x = index - zIndex - yIndex;
Assert( IsValidXYZCoords( x, y, z ) );
}
@@ -118,10 +118,10 @@ private:
z * m_SpacingRadius * 2 + m_SpacingRadius );
}
inline Vector GetSmokeParticlePosIndex(int index_ )
inline Vector GetSmokeParticlePosIndex(int index)
{
int x, y, z;
GetParticleInfoXYZ( index_, x, y, z);
GetParticleInfoXYZ(index, x, y, z);
return GetSmokeParticlePos(x, y, z);
}
@@ -595,8 +595,8 @@ void C_FuncSmokeVolume::FillVolume()
#ifdef _DEBUG
int testX, testY, testZ;
int index_ = GetSmokeParticleIndex(x,y,z);
GetParticleInfoXYZ( index_, testX, testY, testZ);
int index = GetSmokeParticleIndex(x,y,z);
GetParticleInfoXYZ(index, testX, testY, testZ);
assert(testX == x && testY == y && testZ == z);
#endif
+16 -16
View File
@@ -128,13 +128,13 @@ private:
inline int GetSmokeParticleIndex(int x, int y, int z) {return z*m_xCount*m_yCount+y*m_yCount+x;}
inline SmokeParticleInfo* GetSmokeParticleInfo(int x, int y, int z) {return &m_SmokeParticleInfos[GetSmokeParticleIndex(x,y,z)];}
inline void GetParticleInfoXYZ(int index_, int &x, int &y, int &z)
inline void GetParticleInfoXYZ(int index, int &x, int &y, int &z)
{
z = index_ / (m_xCount*m_yCount);
z = index / (m_xCount*m_yCount);
int zIndex = z*m_xCount*m_yCount;
y = (index_ - zIndex) / m_yCount;
y = (index - zIndex) / m_yCount;
int yIndex = y*m_yCount;
x = index_ - zIndex - yIndex;
x = index - zIndex - yIndex;
}
inline bool IsValidXYZCoords(int x, int y, int z)
@@ -150,10 +150,10 @@ private:
((float)z / (m_zCount-1)) * m_SpacingRadius * 2 - m_SpacingRadius);
}
inline Vector GetSmokeParticlePosIndex(int index_)
inline Vector GetSmokeParticlePosIndex(int index)
{
int x, y, z;
GetParticleInfoXYZ( index_, x, y, z);
GetParticleInfoXYZ(index, x, y, z);
return GetSmokeParticlePos(x, y, z);
}
@@ -875,8 +875,8 @@ void C_ParticleSmokeGrenade::FillVolume()
#ifdef _DEBUG
int testX, testY, testZ;
int index_ = GetSmokeParticleIndex(x,y,z);
GetParticleInfoXYZ( index_, testX, testY, testZ);
int index = GetSmokeParticleIndex(x,y,z);
GetParticleInfoXYZ(index, testX, testY, testZ);
assert(testX == x && testY == y && testZ == z);
#endif
@@ -943,12 +943,12 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg )
int nId = AllocateToolParticleEffectId();
KeyValues *oldmsg = new KeyValues( "OldParticleSystem_Create" );
oldmsg->SetString( "name", "C_ParticleSmokeGrenade" );
oldmsg->SetInt( "id", nId );
oldmsg->SetFloat( "time", gpGlobals->curtime );
KeyValues *msg = new KeyValues( "OldParticleSystem_Create" );
msg->SetString( "name", "C_ParticleSmokeGrenade" );
msg->SetInt( "id", nId );
msg->SetFloat( "time", gpGlobals->curtime );
KeyValues *pEmitter = oldmsg->FindKey( "DmeSpriteEmitter", true );
KeyValues *pEmitter = msg->FindKey( "DmeSpriteEmitter", true );
pEmitter->SetInt( "count", NUM_PARTICLES_PER_DIMENSION * NUM_PARTICLES_PER_DIMENSION * NUM_PARTICLES_PER_DIMENSION );
pEmitter->SetFloat( "duration", 0 );
pEmitter->SetString( "material", "particle/particle_smokegrenade1" );
@@ -968,7 +968,7 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_FadeEndTime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() );
pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minRandomSpeed", 10 );
pVelocity->SetFloat( "maxRandomSpeed", 20 );
@@ -1025,8 +1025,8 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg )
pSmokeGrenadeUpdater->SetFloat( "radiusExpandTime", SMOKESPHERE_EXPAND_TIME );
pSmokeGrenadeUpdater->SetFloat( "cutoffFraction", 0.7f );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, oldmsg );
oldmsg->deleteThis();
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
}
+2 -9
View File
@@ -198,19 +198,12 @@ void ParticleEffectCallback( const CEffectData &data )
pEnt->ParticleProp()->StopEmission();
}
Vector vOffset = vec3_origin;
ParticleAttachment_t iAttachType = (ParticleAttachment_t)data.m_nDamageType;
if ( iAttachType == PATTACH_ABSORIGIN_FOLLOW || iAttachType == PATTACH_POINT_FOLLOW || iAttachType == PATTACH_ROOTBONE_FOLLOW )
{
vOffset = data.m_vStart;
}
pEffect = pEnt->ParticleProp()->Create( pszName, iAttachType, data.m_nAttachmentIndex, vOffset );
pEffect = pEnt->ParticleProp()->Create( pszName, (ParticleAttachment_t)data.m_nDamageType, data.m_nAttachmentIndex );
AssertMsg2( pEffect.IsValid() && pEffect->IsValid(), "%s could not create particle effect %s",
C_BaseEntity::Instance( data.m_hEntity )->GetDebugName(), pszName );
if ( pEffect.IsValid() && pEffect->IsValid() )
{
if ( iAttachType == PATTACH_CUSTOMORIGIN )
if ( (ParticleAttachment_t)data.m_nDamageType == PATTACH_CUSTOMORIGIN )
{
pEffect->SetSortOrigin( data.m_vOrigin );
pEffect->SetControlPoint( 0, data.m_vOrigin );
+4 -4
View File
@@ -21,7 +21,7 @@
static void PixelvisDrawChanged( IConVar *pPixelvisVar, const char *pOld, float flOldValue );
ConVar r_pixelvisibility_partial( "r_pixelvisibility_partial", "1" );
ConVar r_dopixelvisibility( "r_dopixelvisibility", "1", FCVAR_ALLOWED_IN_COMPETITIVE );
ConVar r_dopixelvisibility( "r_dopixelvisibility", "1" );
ConVar r_drawpixelvisibility( "r_drawpixelvisibility", "0", 0, "Show the occlusion proxies", PixelvisDrawChanged );
ConVar r_pixelvisibility_spew( "r_pixelvisibility_spew", "0" );
@@ -345,7 +345,7 @@ float CPixelVisibilityQuery::GetFractionVisible( float fadeTimeInv )
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) Pixels possible: %d (qh:%d) (frame:%d)\n", pixels, (int)m_queryHandle, pixelsPossible, (int)m_queryHandleCount, gpGlobals->framecount );
DevMsg( 1, "Pixels visible: %d (qh:%d) Pixels possible: %d (qh:%d) (frame:%d)\n", pixels, (int)(intp)m_queryHandle, pixelsPossible, (int)(intp)m_queryHandleCount, gpGlobals->framecount );
}
if ( pixels < 0 || pixelsPossible < 0 )
@@ -376,7 +376,7 @@ float CPixelVisibilityQuery::GetFractionVisible( float fadeTimeInv )
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) (frame:%d)\n", pixels, (int)m_queryHandle, gpGlobals->framecount );
DevMsg( 1, "Pixels visible: %d (qh:%d) (frame:%d)\n", pixels, (int)(intp)m_queryHandle, gpGlobals->framecount );
}
if ( pixels < 0 )
@@ -415,7 +415,7 @@ void CPixelVisibilityQuery::IssueQuery( IMatRenderContext *pRenderContext, float
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Draw Proxy: qh:%d org:<%d,%d,%d> (frame:%d)\n", (int)m_queryHandle, (int)m_origin[0], (int)m_origin[1], (int)m_origin[2], gpGlobals->framecount );
DevMsg( 1, "Draw Proxy: qh:%d org:<%d,%d,%d> (frame:%d)\n", (int)(intp)m_queryHandle, (int)m_origin[0], (int)m_origin[1], (int)m_origin[2], gpGlobals->framecount );
}
m_clipFraction = PixelVisibility_DrawProxy( pRenderContext, m_queryHandle, m_origin, proxySize, proxyAspect, pMaterial, sizeIsScreenSpace );
+3 -3
View File
@@ -464,10 +464,10 @@ void C_Plasma::Update( void )
C_BaseEntity *ent = cl_entitylist->GetEnt( 0 );
if ( ent )
{
int iDecal = decalsystem->GetDecalIndexForName( "PlasmaGlowFade" );
if ( iDecal >= 0 )
int index = decalsystem->GetDecalIndexForName( "PlasmaGlowFade" );
if ( index >= 0 )
{
effects->DecalShoot( iDecal, 0, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), GetAbsOrigin(), 0, 0 );
effects->DecalShoot( index, 0, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), GetAbsOrigin(), 0, 0 );
}
}
}
-1
View File
@@ -52,7 +52,6 @@ public:
int m_nStepside;
float m_flFallVelocity;
int m_nOldButtons;
float m_flOldForwardMove;
// Base velocity that was passed in to server physics so
// client can predict conveyors correctly. Server zeroes it, so we need to store here, too.
Vector m_vecClientBaseVelocity;
+26 -63
View File
@@ -26,8 +26,6 @@ IMPLEMENT_CLIENTCLASS_DT_NOBASE(C_PlayerResource, DT_PlayerResource, CPlayerReso
RecvPropArray3( RECVINFO_ARRAY(m_iTeam), RecvPropInt( RECVINFO(m_iTeam[0]))),
RecvPropArray3( RECVINFO_ARRAY(m_bAlive), RecvPropInt( RECVINFO(m_bAlive[0]))),
RecvPropArray3( RECVINFO_ARRAY(m_iHealth), RecvPropInt( RECVINFO(m_iHealth[0]))),
RecvPropArray3( RECVINFO_ARRAY(m_iAccountID), RecvPropInt( RECVINFO(m_iAccountID[0]))),
RecvPropArray3( RECVINFO_ARRAY(m_bValid), RecvPropInt( RECVINFO(m_bValid[0]))),
END_RECV_TABLE()
BEGIN_PREDICTION_DATA( C_PlayerResource )
@@ -40,8 +38,6 @@ BEGIN_PREDICTION_DATA( C_PlayerResource )
DEFINE_PRED_ARRAY( m_iTeam, FIELD_INTEGER, MAX_PLAYERS+1, FTYPEDESC_PRIVATE ),
DEFINE_PRED_ARRAY( m_bAlive, FIELD_BOOLEAN, MAX_PLAYERS+1, FTYPEDESC_PRIVATE ),
DEFINE_PRED_ARRAY( m_iHealth, FIELD_INTEGER, MAX_PLAYERS+1, FTYPEDESC_PRIVATE ),
DEFINE_PRED_ARRAY( m_iAccountID, FIELD_INTEGER, MAX_PLAYERS+1, FTYPEDESC_PRIVATE ),
DEFINE_PRED_ARRAY( m_bValid, FIELD_BOOLEAN, MAX_PLAYERS+1, FTYPEDESC_PRIVATE ),
END_PREDICTION_DATA()
@@ -62,8 +58,6 @@ C_PlayerResource::C_PlayerResource()
memset( m_iTeam, 0, sizeof( m_iTeam ) );
memset( m_bAlive, 0, sizeof( m_bAlive ) );
memset( m_iHealth, 0, sizeof( m_iHealth ) );
memset( m_iAccountID, 0, sizeof( m_iAccountID ) );
memset( m_bValid, 0, sizeof( m_bValid ) );
m_szUnconnectedName = 0;
for ( int i=0; i<MAX_TEAMS; i++ )
@@ -104,11 +98,8 @@ void C_PlayerResource::UpdatePlayerName( int slot )
Error( "UpdatePlayerName with bogus slot %d\n", slot );
return;
}
if ( !m_szUnconnectedName )
{
if (!m_szUnconnectedName )
m_szUnconnectedName = AllocPooledString( PLAYER_UNCONNECTED_NAME );
}
player_info_t sPlayerInfo;
if ( IsConnected( slot ) && engine->GetPlayerInfo( slot, &sPlayerInfo ) )
@@ -117,10 +108,7 @@ void C_PlayerResource::UpdatePlayerName( int slot )
}
else
{
if ( !IsValid( slot ) )
{
m_szName[slot] = m_szUnconnectedName;
}
m_szName[slot] = m_szUnconnectedName;
}
}
@@ -128,7 +116,7 @@ void C_PlayerResource::ClientThink()
{
BaseClass::ClientThink();
for ( int i = 1; i <= MAX_PLAYERS; ++i )
for ( int i = 1; i <= gpGlobals->maxClients; ++i )
{
UpdatePlayerName( i );
}
@@ -147,7 +135,7 @@ const char *C_PlayerResource::GetPlayerName( int iIndex )
return PLAYER_ERROR_NAME;
}
if ( !IsConnected( iIndex ) && !IsValid( iIndex ) )
if ( !IsConnected( iIndex ) )
return PLAYER_UNCONNECTED_NAME;
// X360TBD: Network - figure out why the name isn't set
@@ -179,9 +167,9 @@ int C_PlayerResource::GetTeam(int iIndex )
}
}
const char * C_PlayerResource::GetTeamName(int index_)
const char * C_PlayerResource::GetTeamName(int index)
{
C_Team *team = GetGlobalTeam( index_ );
C_Team *team = GetGlobalTeam( index );
if ( !team )
return "Unknown";
@@ -189,9 +177,9 @@ const char * C_PlayerResource::GetTeamName(int index_)
return team->Get_Name();
}
int C_PlayerResource::GetTeamScore(int index_ )
int C_PlayerResource::GetTeamScore(int index)
{
C_Team *team = GetGlobalTeam( index_ );
C_Team *team = GetGlobalTeam( index );
if ( !team )
return 0;
@@ -199,30 +187,30 @@ int C_PlayerResource::GetTeamScore(int index_ )
return team->Get_Score();
}
int C_PlayerResource::GetFrags(int index_ )
int C_PlayerResource::GetFrags(int index )
{
return 666;
}
bool C_PlayerResource::IsLocalPlayer(int index_ )
bool C_PlayerResource::IsLocalPlayer(int index)
{
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer )
return false;
return (index_ == pPlayer->entindex() );
return ( index == pPlayer->entindex() );
}
bool C_PlayerResource::IsHLTV(int index_ )
bool C_PlayerResource::IsHLTV(int index)
{
if ( !IsConnected( index_ ) && !IsValid( index_ ) )
if ( !IsConnected( index ) )
return false;
player_info_t sPlayerInfo;
if ( engine->GetPlayerInfo( index_, &sPlayerInfo ) )
if ( engine->GetPlayerInfo( index, &sPlayerInfo ) )
{
return sPlayerInfo.ishltv;
}
@@ -230,15 +218,15 @@ bool C_PlayerResource::IsHLTV(int index_ )
return false;
}
bool C_PlayerResource::IsReplay(int index_ )
bool C_PlayerResource::IsReplay(int index)
{
#if defined( REPLAY_ENABLED )
if ( !IsConnected( index_ ) && !IsValid( index_ ) )
if ( !IsConnected( index ) )
return false;
player_info_t sPlayerInfo;
if ( engine->GetPlayerInfo( index_, &sPlayerInfo ) )
if ( engine->GetPlayerInfo( index, &sPlayerInfo ) )
{
return sPlayerInfo.isreplay;
}
@@ -252,7 +240,7 @@ bool C_PlayerResource::IsReplay(int index_ )
//-----------------------------------------------------------------------------
bool C_PlayerResource::IsFakePlayer( int iIndex )
{
if ( !IsConnected( iIndex ) && !IsValid( iIndex ) )
if ( !IsConnected( iIndex ) )
return false;
// Yuck, make sure it's up to date
@@ -270,7 +258,7 @@ bool C_PlayerResource::IsFakePlayer( int iIndex )
//-----------------------------------------------------------------------------
int C_PlayerResource::GetPing( int iIndex )
{
if ( !IsConnected( iIndex ) && !IsValid( iIndex ) )
if ( !IsConnected( iIndex ) )
return 0;
return m_iPing[iIndex];
@@ -281,7 +269,7 @@ int C_PlayerResource::GetPing( int iIndex )
/*-----------------------------------------------------------------------------
int C_PlayerResource::GetPacketloss( int iIndex )
{
if ( !IsConnected( iIndex ) && !IsPreservedData( iIndex ) )
if ( !IsConnected( iIndex ) )
return 0;
return m_iPacketloss[iIndex];
@@ -292,7 +280,7 @@ int C_PlayerResource::GetPacketloss( int iIndex )
//-----------------------------------------------------------------------------
int C_PlayerResource::GetPlayerScore( int iIndex )
{
if ( !IsConnected( iIndex ) && !IsValid( iIndex ) )
if ( !IsConnected( iIndex ) )
return 0;
return m_iScore[iIndex];
@@ -303,7 +291,7 @@ int C_PlayerResource::GetPlayerScore( int iIndex )
//-----------------------------------------------------------------------------
int C_PlayerResource::GetDeaths( int iIndex )
{
if ( !IsConnected( iIndex ) && !IsValid( iIndex ) )
if ( !IsConnected( iIndex ) )
return 0;
return m_iDeaths[iIndex];
@@ -314,15 +302,15 @@ int C_PlayerResource::GetDeaths( int iIndex )
//-----------------------------------------------------------------------------
int C_PlayerResource::GetHealth( int iIndex )
{
if ( !IsConnected( iIndex ) && !IsValid( iIndex ) )
if ( !IsConnected( iIndex ) )
return 0;
return m_iHealth[iIndex];
}
const Color &C_PlayerResource::GetTeamColor(int index_ )
const Color &C_PlayerResource::GetTeamColor(int index )
{
if ( index_ < 0 || index_ >= MAX_TEAMS )
if ( index < 0 || index >= MAX_TEAMS )
{
Assert( false );
static Color blah;
@@ -330,7 +318,7 @@ const Color &C_PlayerResource::GetTeamColor(int index_ )
}
else
{
return m_Colors[index_];
return m_Colors[index];
}
}
@@ -344,28 +332,3 @@ bool C_PlayerResource::IsConnected( int iIndex )
else
return m_bConnected[iIndex];
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
uint32 C_PlayerResource::GetAccountID( int iIndex )
{
if ( ( iIndex < 0 ) || ( iIndex >= ARRAYSIZE( m_iAccountID ) ) )
return 0;
if ( !IsConnected( iIndex ) && !IsValid( iIndex ) )
return 0;
return m_iAccountID[iIndex];
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool C_PlayerResource::IsValid( int iIndex )
{
if ( ( iIndex < 0 ) || ( iIndex >= ARRAYSIZE( m_bValid ) ) )
return false;
return m_bValid[iIndex];
}
+2 -6
View File
@@ -29,7 +29,7 @@ public:
C_PlayerResource();
virtual ~C_PlayerResource();
public : // IGameResources interface
public : // IGameResources intreface
// Team data access
virtual int GetTeamScore( int index );
@@ -56,9 +56,6 @@ public : // IGameResources interface
virtual void ClientThink();
virtual void OnDataChanged(DataUpdateType_t updateType);
uint32 GetAccountID( int iIndex );
bool IsValid( int iIndex );
protected:
void UpdatePlayerName( int slot );
@@ -73,9 +70,8 @@ protected:
bool m_bAlive[MAX_PLAYERS+1];
int m_iHealth[MAX_PLAYERS+1];
Color m_Colors[MAX_TEAMS];
uint32 m_iAccountID[MAX_PLAYERS+1];
bool m_bValid[MAX_PLAYERS+1];
string_t m_szUnconnectedName;
};
extern C_PlayerResource *g_PR;
+11 -21
View File
@@ -12,7 +12,6 @@
#include "input.h"
#ifdef TF_CLIENT_DLL
#include "cdll_util.h"
#include "tf_gamerules.h"
#endif
#include "rope_helpers.h"
#include "engine/ivmodelinfo.h"
@@ -194,7 +193,7 @@ public:
if( pReturn == NULL )
{
int iMaxSize = m_QueuedRopeMemory[m_nCurrentStack].GetMaxSize();
Warning( "Overflowed rope queued rendering memory stack. Needed %llu, have %d/%d\n", (uint64)bytes, iMaxSize - m_QueuedRopeMemory[m_nCurrentStack].GetUsed(), iMaxSize );
Warning( "Overflowed rope queued rendering memory stack. Needed %d, have %d/%d\n", bytes, iMaxSize - m_QueuedRopeMemory[m_nCurrentStack].GetUsed(), iMaxSize );
pReturn = malloc( bytes );
m_DeleteOnSwitch[m_nCurrentStack].AddToTail( pReturn );
}
@@ -377,7 +376,7 @@ void CRopeManager::AddToRenderCache( C_RopeKeyframe *pRope )
// If we didn't find one, then allocate the mofo.
if ( iRenderCache == nRenderCacheCount )
{
iRenderCache = m_aRenderCache.AddToTail();
int iRenderCache = m_aRenderCache.AddToTail();
m_aRenderCache[iRenderCache].m_pSolidMaterial = pRope->GetSolidMaterial();
if ( m_aRenderCache[iRenderCache].m_pSolidMaterial )
{
@@ -641,15 +640,6 @@ bool CRopeManager::IsHolidayLightMode( void )
return false;
}
#ifdef TF_CLIENT_DLL
if ( TFGameRules() && TFGameRules()->IsPowerupMode() )
{
// We don't want to draw the lights for the grapple.
// They get left behind for a while and look bad.
return false;
}
#endif
bool bDrawHolidayLights = false;
#ifdef USES_ECON_ITEMS
@@ -1648,12 +1638,12 @@ struct catmull_t
};
// bake out the terms of the catmull rom spline
void Catmull_Rom_Spline_Matrix( const Vector &vecP1, const Vector &vecP2, const Vector &vecP3, const Vector &vecP4, catmull_t &output )
void Catmull_Rom_Spline_Matrix( const Vector &p1, const Vector &p2, const Vector &p3, const Vector &p4, catmull_t &output )
{
output.t3 = 0.5f * ( ( -1 * vecP1 ) + ( 3 * vecP2 ) + ( -3 * vecP3 ) + vecP4 ); // 0.5 t^3 * [ (-1*p1) + ( 3*p2) + (-3*p3) + p4 ]
output.t2 = 0.5f * ( ( 2 * vecP1 ) + ( -5 * vecP2 ) + ( 4 * vecP3 ) - vecP4 ); // 0.5 t^2 * [ ( 2*p1) + (-5*p2) + ( 4*p3) - p4 ]
output.t = 0.5f * ( ( -1 * vecP1 ) + vecP3 ); // 0.5 t * [ (-1*p1) + p3 ]
output.c = vecP2; // p2
output.t3 = 0.5f * ((-1*p1) + (3*p2) + (-3*p3) + p4); // 0.5 t^3 * [ (-1*p1) + ( 3*p2) + (-3*p3) + p4 ]
output.t2 = 0.5f * ((2*p1) + (-5*p2) + (4*p3) - p4); // 0.5 t^2 * [ ( 2*p1) + (-5*p2) + ( 4*p3) - p4 ]
output.t = 0.5f * ((-1*p1) + p3); // 0.5 t * [ (-1*p1) + p3 ]
output.c = p2; // p2
}
// evaluate one point on the spline, t is a vector of (t, t^2, t^3)
@@ -1701,7 +1691,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData, const Vector &vCurr
if ( !bQueued && RopeManager()->IsHolidayLightMode() && r_rope_holiday_light_scale.GetFloat() > 0.0f )
{
data.m_nMaterial = reinterpret_cast< int >( this );
data.m_nMaterial = (intp)this;
data.m_nHitBox = ( iNode << 8 );
data.m_flScale = r_rope_holiday_light_scale.GetFloat();
data.m_vOrigin = pSegmentData->m_Segments[nSegmentCount].m_vPos;
@@ -1927,10 +1917,10 @@ bool C_RopeKeyframe::CalculateEndPointAttachment( C_BaseEntity *pEnt, int iAttac
if ( !pModel )
return false;
int iAttachmentBuf = pModel->LookupAttachment( "buff_attach" );
int iAttachment = pModel->LookupAttachment( "buff_attach" );
if ( pAngles )
return pModel->GetAttachment( iAttachmentBuf, vPos, *pAngles );
return pModel->GetAttachment( iAttachmentBuf, vPos );
return pModel->GetAttachment( iAttachment, vPos, *pAngles );
return pModel->GetAttachment( iAttachment, vPos );
}
}
+2 -2
View File
@@ -166,7 +166,7 @@ void GenerateSquareWaveEffect( RumbleWaveform_t *pWaveform, const WaveGenParams_
while( i < NUM_WAVE_SAMPLES )
{
for( j = 0 ; j < steps ; j++ )
for( j = 0 ; j < steps && i < NUM_WAVE_SAMPLES; j++ )
{
if( params.leftChannel )
{
@@ -177,7 +177,7 @@ void GenerateSquareWaveEffect( RumbleWaveform_t *pWaveform, const WaveGenParams_
pWaveform->amplitude_right[i++] = params.minAmplitude;
}
}
for( j = 0 ; j < steps ; j++ )
for( j = 0 ; j < steps && i < NUM_WAVE_SAMPLES; j++ )
{
if( params.leftChannel )
{
+17 -19
View File
@@ -115,7 +115,7 @@ bool C_SceneEntity::GetHWMorphSceneFileName( const char *pFilename, char *pHWMFi
// Find the hardware morph scene name and pass that along as well.
char szScene[MAX_PATH];
V_strcpy_safe( szScene, pFilename );
V_strcpy( szScene, pFilename );
char szSceneHWM[MAX_PATH];
szSceneHWM[0] = '\0';
@@ -206,20 +206,20 @@ void C_SceneEntity::SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *p
char szFilename[128];
Assert( V_strlen( pszFilename ) < 128 );
V_strcpy_safe( szFilename, pszFilename );
V_strcpy( szFilename, pszFilename );
char szSceneHWM[128];
if ( GetHWMorphSceneFileName( szFilename, szSceneHWM ) )
{
V_strcpy_safe( szFilename, szSceneHWM );
V_strcpy( szFilename, szSceneHWM );
}
Assert( szFilename[ 0 ] );
if ( szFilename[ 0 ] )
Assert( szFilename && szFilename[ 0 ] );
if ( szFilename && szFilename[ 0 ] )
{
LoadSceneFromFile( szFilename );
if ( !HushAsserts() )
if (!CommandLine()->FindParm("-hushasserts"))
{
Assert( m_pScene );
}
@@ -257,7 +257,7 @@ void C_SceneEntity::SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *p
if ( m_hOwner.Get() )
{
if ( !HushAsserts() )
if (!CommandLine()->FindParm("-hushasserts"))
{
Assert( m_pScene );
}
@@ -320,7 +320,7 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
if ( str )
{
Assert( V_strlen( str ) < MAX_PATH );
V_strcpy_safe( szFilename, str );
V_strcpy( szFilename, str );
}
else
{
@@ -330,13 +330,13 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
char szSceneHWM[MAX_PATH];
if ( GetHWMorphSceneFileName( szFilename, szSceneHWM ) )
{
V_strcpy_safe( szFilename, szSceneHWM );
V_strcpy( szFilename, szSceneHWM );
}
if ( updateType == DATA_UPDATE_CREATED )
{
Assert( szFilename[ 0 ] );
if ( szFilename[ 0 ] )
Assert( szFilename && szFilename[ 0 ] );
if ( szFilename && szFilename[ 0 ] )
{
LoadSceneFromFile( szFilename );
@@ -373,8 +373,6 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType )
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
m_bWasPlaying = !m_bIsPlayingBack; // force it to be "changed"
}
// Playback state changed...
@@ -1108,7 +1106,7 @@ void C_SceneEntity::SetCurrentTime( float t, bool forceClientSync )
//-----------------------------------------------------------------------------
void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene )
{
if ( !HushAsserts() )
if (!CommandLine()->FindParm("-hushasserts"))
{
Assert( pScene && m_bMultiplayer );
}
@@ -1162,11 +1160,11 @@ void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene )
{
// Now look up the animblock
mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence );
for ( int iGroup = 0 ; iGroup < seqdesc.groupsize[ 0 ] ; ++iGroup )
for ( int i = 0 ; i < seqdesc.groupsize[ 0 ] ; ++i )
{
for ( int j = 0; j < seqdesc.groupsize[ 1 ]; ++j )
{
int iAnimation = seqdesc.anim( iGroup, j );
int iAnimation = seqdesc.anim( i, j );
int iBaseAnimation = pStudioHdr->iRelativeAnim( iSequence, iAnimation );
mstudioanimdesc_t &animdesc = pStudioHdr->pAnimdesc( iBaseAnimation );
@@ -1185,14 +1183,14 @@ void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene )
++nResident;
if ( nSpew > 1 )
{
Msg( "%s:%s[%i:%i] was resident\n", pStudioHdr->pszName(), animdesc.pszName(), iGroup, j );
Msg( "%s:%s[%i:%i] was resident\n", pStudioHdr->pszName(), animdesc.pszName(), i, j );
}
}
else
{
if ( nSpew != 0 )
{
Msg( "%s:%s[%i:%i] async load\n", pStudioHdr->pszName(), animdesc.pszName(), iGroup, j );
Msg( "%s:%s[%i:%i] async load\n", pStudioHdr->pszName(), animdesc.pszName(), i, j );
}
}
}
+4 -4
View File
@@ -272,8 +272,8 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void )
if ( bLoaded )
{
char szKeywords[ 256 ] = {0};
V_strcpy_safe( szKeywords, pMaterialKeys->GetString( "%keywords", "" ) );
char szKeywords[ 256 ];
Q_strcpy( szKeywords, pMaterialKeys->GetString( "%keywords", "" ) );
char *pchKeyword = szKeywords;
@@ -306,7 +306,7 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void )
{
// Couldn't find the list, so create it
iList = m_SlideMaterialLists.AddToTail( new SlideMaterialList_t );
V_strcpy_safe( m_SlideMaterialLists[iList]->szSlideKeyword, pchKeyword );
Q_strcpy( m_SlideMaterialLists[ iList ]->szSlideKeyword, pchKeyword );
}
// Add material index to this list
@@ -329,7 +329,7 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void )
{
// Couldn't find the generic list, so create it
iList = m_SlideMaterialLists.AddToHead( new SlideMaterialList_t );
V_strcpy_safe( m_SlideMaterialLists[iList]->szSlideKeyword, "" );
Q_strcpy( m_SlideMaterialLists[ iList ]->szSlideKeyword, "" );
}
// Add material index to this list
+34 -31
View File
@@ -396,12 +396,12 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
{
int nId = m_pSmokeEmitter->AllocateToolParticleEffectId();
KeyValues *oldmsg = new KeyValues( "OldParticleSystem_Create" );
oldmsg->SetString( "name", "C_SmokeTrail" );
oldmsg->SetInt( "id", nId );
oldmsg->SetFloat( "time", gpGlobals->curtime );
KeyValues *msg = new KeyValues( "OldParticleSystem_Create" );
msg->SetString( "name", "C_SmokeTrail" );
msg->SetInt( "id", nId );
msg->SetFloat( "time", gpGlobals->curtime );
KeyValues *pRandomEmitter = oldmsg->FindKey( "DmeRandomEmitter", true );
KeyValues *pRandomEmitter = msg->FindKey( "DmeRandomEmitter", true );
pRandomEmitter->SetInt( "count", m_SpawnRate ); // particles per second, when duration is < 0
pRandomEmitter->SetFloat( "duration", -1 );
pRandomEmitter->SetInt( "active", bEmitterActive );
@@ -418,7 +418,7 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
// FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", m_nAttachment );
pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x );
@@ -430,7 +430,7 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_ParticleLifetime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() );
pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minAttachmentSpeed", m_MinDirectedSpeed );
pVelocity->SetFloat( "maxAttachmentSpeed", m_MaxDirectedSpeed );
pVelocity->SetFloat( "minRandomSpeed", m_MinSpeed );
@@ -487,18 +487,18 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
pEmitter2->SetString( "material", "particle/particle_noisesphere" );
pEmitterParent2->AddSubKey( pEmitter2 );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, oldmsg );
oldmsg->deleteThis();
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
else
{
KeyValues *oldmsg = new KeyValues( "OldParticleSystem_ActivateEmitter" );
oldmsg->SetInt( "id", m_pSmokeEmitter->GetToolParticleEffectId() );
oldmsg->SetInt( "emitter", 0 );
oldmsg->SetInt( "active", bEmitterActive );
oldmsg->SetFloat( "time", gpGlobals->curtime );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, oldmsg );
oldmsg->deleteThis();
KeyValues *msg = new KeyValues( "OldParticleSystem_ActivateEmitter" );
msg->SetInt( "id", m_pSmokeEmitter->GetToolParticleEffectId() );
msg->SetInt( "emitter", 0 );
msg->SetInt( "active", bEmitterActive );
msg->SetFloat( "time", gpGlobals->curtime );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
}
@@ -771,6 +771,8 @@ void C_RocketTrail::Update( float fTimeDelta )
if ( m_bDamaged )
{
SimpleParticle *pParticle;
Vector offset;
Vector offsetColor;
CSmartPtr<CEmberEffect> pEmitter = CEmberEffect::Create("C_RocketTrail::damaged");
@@ -1507,6 +1509,7 @@ void C_FireTrail::Update( float fTimeDelta )
numPuffs = clamp( numPuffs, 1, 32 );
SimpleParticle *pParticle;
Vector offset;
Vector offsetColor;
float step = moveLength / numPuffs;
@@ -1915,12 +1918,12 @@ void C_DustTrail::CleanupToolRecordingState( KeyValues *msg )
{
int nId = m_pDustEmitter->AllocateToolParticleEffectId();
KeyValues *oldmsg = new KeyValues( "OldParticleSystem_Create" );
oldmsg->SetString( "name", "C_DustTrail" );
oldmsg->SetInt( "id", nId );
oldmsg->SetFloat( "time", gpGlobals->curtime );
KeyValues *msg = new KeyValues( "OldParticleSystem_Create" );
msg->SetString( "name", "C_DustTrail" );
msg->SetInt( "id", nId );
msg->SetFloat( "time", gpGlobals->curtime );
KeyValues *pEmitter = oldmsg->FindKey( "DmeSpriteEmitter", true );
KeyValues *pEmitter = msg->FindKey( "DmeSpriteEmitter", true );
pEmitter->SetString( "material", "particle/smokesprites_0001" );
pEmitter->SetInt( "count", m_SpawnRate ); // particles per second, when duration is < 0
pEmitter->SetFloat( "duration", -1 ); // FIXME
@@ -1930,7 +1933,7 @@ void C_DustTrail::CleanupToolRecordingState( KeyValues *msg )
// FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", GetParentAttachment() );
pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x );
@@ -1994,17 +1997,17 @@ void C_DustTrail::CleanupToolRecordingState( KeyValues *msg )
pUpdaters->FindKey( "DmeColorUpdater", true );
pUpdaters->FindKey( "DmeSizeUpdater", true );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, oldmsg );
oldmsg->deleteThis();
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
else
{
KeyValues *oldmsg = new KeyValues( "OldParticleSystem_ActivateEmitter" );
oldmsg->SetInt( "id", m_pDustEmitter->GetToolParticleEffectId() );
oldmsg->SetInt( "emitter", 0 );
oldmsg->SetInt( "active", bEmitterActive );
oldmsg->SetFloat( "time", gpGlobals->curtime );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, oldmsg );
oldmsg->deleteThis();
KeyValues *msg = new KeyValues( "OldParticleSystem_ActivateEmitter" );
msg->SetInt( "id", m_pDustEmitter->GetToolParticleEffectId() );
msg->SetInt( "emitter", 0 );
msg->SetInt( "active", bEmitterActive );
msg->SetFloat( "time", gpGlobals->curtime );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
}
+1
View File
@@ -463,6 +463,7 @@ void C_SmokeStack::SimulateParticles( CParticleSimulateIterator *pIterator )
else
{
// Transform.
Vector tPos;
if( m_bTwist )
{
Vector vTwist(
+1 -1
View File
@@ -150,7 +150,7 @@ public:
{
Msg( "- %d: %s\n", i, m_soundscapes[i]->GetName() );
}
if ( m_forcedSoundscapeIndex >= 0 )
if ( m_forcedSoundscapeIndex )
{
Msg( "- PLAYING DEBUG SOUNDSCAPE: %d [%s]\n", m_forcedSoundscapeIndex, SoundscapeNameByIndex(m_forcedSoundscapeIndex) );
}
+1 -1
View File
@@ -159,7 +159,7 @@ void StickRagdollNow( const Vector &vecOrigin, const Vector &vecDirection )
shotRay.Init( vecOrigin, vecEnd );
CRagdollBoltEnumerator ragdollEnum( shotRay, vecOrigin );
::partition->EnumerateElementsAlongRay( PARTITION_CLIENT_RESPONSIVE_EDICTS, shotRay, false, &ragdollEnum );
partition->EnumerateElementsAlongRay( PARTITION_CLIENT_RESPONSIVE_EDICTS, shotRay, false, &ragdollEnum );
CreateCrossbowBolt( vecOrigin, vecDirection );
}
+2 -2
View File
@@ -509,11 +509,11 @@ public:
}
}
virtual void PhysicsProp( IRecipientFilter& filter, float delay, int modelindex, int skin,
const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int fEffects )
const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int effects )
{
if ( !SuppressTE( filter ) )
{
TE_PhysicsProp( filter, delay, modelindex, skin, pos, angles, vel, flags, fEffects );
TE_PhysicsProp( filter, delay, modelindex, skin, pos, angles, vel, flags, effects );
}
}
virtual void ClientProjectile( IRecipientFilter& filter, float delay,
+8 -8
View File
@@ -173,18 +173,18 @@ void TE_BloodStream( IRecipientFilter& filter, float delay,
// 'chunkier' appearance.
for (count2 = 0; count2 < 2; count2++)
{
StandardParticle_t *pChunky = pRen->AddParticle();
if( pChunky )
StandardParticle_t *p = pRen->AddParticle();
if(p)
{
pRen->SetParticleLifetime( pChunky, 3);
pChunky->SetColor(random->RandomFloat(0.7, 1.0), g, b);
pChunky->SetAlpha(a);
pChunky->m_Pos.Init(
pRen->SetParticleLifetime(p, 3);
p->SetColor(random->RandomFloat(0.7, 1.0), g, b);
p->SetAlpha(a);
p->m_Pos.Init(
(*org)[0] + random->RandomFloat(-1,1),
(*org)[1] + random->RandomFloat(-1,1),
(*org)[2] + random->RandomFloat(-1,1));
pRen->SetParticleType( pChunky, pt_vox_slowgrav);
pRen->SetParticleType(p, pt_vox_slowgrav);
VectorCopy (dir, dirCopy);
@@ -192,7 +192,7 @@ void TE_BloodStream( IRecipientFilter& filter, float delay,
VectorScale (dirCopy, num, dirCopy);// randomize a bit
pChunky->m_Velocity = dirCopy * speedCopy;
p->m_Velocity = dirCopy * speedCopy;
}
}
}
+2 -2
View File
@@ -132,7 +132,7 @@ static void RecordEffect( const char *pEffectName, const CEffectData &data )
msg->SetInt( "attachmentindex", data.m_nAttachmentIndex );
// NOTE: Ptrs are our way of indicating it's an entindex
msg->SetPtr( "entindex", (void*)data.entindex() );
msg->SetPtr( "entindex", (void*)(intp)data.entindex() );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
@@ -213,7 +213,7 @@ void TE_DispatchEffect( IRecipientFilter& filter, float delay, KeyValues *pKeyVa
// NOTE: Ptrs are our way of indicating it's an entindex
ClientEntityHandle_t hWorld = ClientEntityList().EntIndexToHandle( 0 );
data.m_hEntity = (int)pKeyValues->GetPtr( "entindex", (void*)hWorld.ToInt() );
data.m_hEntity = (intp)pKeyValues->GetPtr( "entindex", (void*)(intp)hWorld.ToInt() );
const char *pEffectName = pKeyValues->GetString( "effectname" );
+1 -1
View File
@@ -173,7 +173,7 @@ void C_TEExplosion::AffectRagdolls( void )
return;
CRagdollExplosionEnumerator ragdollEnum( m_vecOrigin, m_nRadius, m_nMagnitude );
::partition->EnumerateElementsInSphere( PARTITION_CLIENT_RESPONSIVE_EDICTS, m_vecOrigin, m_nRadius, false, &ragdollEnum );
partition->EnumerateElementsInSphere( PARTITION_CLIENT_RESPONSIVE_EDICTS, m_vecOrigin, m_nRadius, false, &ragdollEnum );
}
//
+11 -10
View File
@@ -153,7 +153,7 @@ void C_LocalTempEntity::SetAcceleration( const Vector &vecVelocity )
// Purpose:
// Output : int
//-----------------------------------------------------------------------------
int C_LocalTempEntity::DrawStudioModel( int modelFlags )
int C_LocalTempEntity::DrawStudioModel( int flags )
{
VPROF_BUDGET( "C_LocalTempEntity::DrawStudioModel", VPROF_BUDGETGROUP_MODEL_RENDERING );
int drawn = 0;
@@ -168,12 +168,12 @@ int C_LocalTempEntity::DrawStudioModel( int modelFlags )
if ( m_pfnDrawHelper )
{
drawn = ( *m_pfnDrawHelper )( this, modelFlags);
drawn = ( *m_pfnDrawHelper )( this, flags );
}
else
{
drawn = modelrender->DrawModel(
modelFlags,
flags,
this,
MODEL_INSTANCE_INVALID,
index,
@@ -191,7 +191,7 @@ int C_LocalTempEntity::DrawStudioModel( int modelFlags )
// Purpose:
// Input : flags -
//-----------------------------------------------------------------------------
int C_LocalTempEntity::DrawModel( int modelFlags )
int C_LocalTempEntity::DrawModel( int flags )
{
int drawn = 0;
@@ -238,7 +238,7 @@ int C_LocalTempEntity::DrawModel( int modelFlags )
);
break;
case mod_studio:
drawn = DrawStudioModel( modelFlags );
drawn = DrawStudioModel( flags );
break;
default:
break;
@@ -1097,7 +1097,7 @@ void CTempEnts::BreakModel( const Vector &pos, const QAngle &angles, const Vecto
}
}
void CTempEnts::PhysicsProp( int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, int physFlags, int physEffects )
void CTempEnts::PhysicsProp( int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int effects )
{
C_PhysPropClientside *pEntity = C_PhysPropClientside::CreateNew();
@@ -1117,7 +1117,7 @@ void CTempEnts::PhysicsProp( int modelindex, int skin, const Vector& pos, const
pEntity->SetAbsOrigin( pos );
pEntity->SetAbsAngles( angles );
pEntity->SetPhysicsMode( PHYSICS_MULTIPLAYER_CLIENTSIDE );
pEntity->SetEffects( physEffects );
pEntity->SetEffects( effects );
if ( !pEntity->Initialize() )
{
@@ -1138,7 +1138,7 @@ void CTempEnts::PhysicsProp( int modelindex, int skin, const Vector& pos, const
return;
}
if ( physFlags & 1 )
if ( flags & 1 )
{
pEntity->SetHealth( 0 );
pEntity->Break();
@@ -1539,7 +1539,7 @@ void CTempEnts::BloodSprite( const Vector &org, int r, int g, int b, int a, int
{
C_LocalTempEntity *pTemp;
int frameCount = modelinfo->GetModelFrameCount( model );
color32 impactcolor = { (byte)r, (byte)g, (byte)b, (byte)a };
color32 impactcolor = { (uint8)r, (uint8)g, (uint8)b, (uint8)a };
//Large, single blood sprite is a high-priority tent
if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL )
@@ -2941,6 +2941,7 @@ void CTempEnts::MuzzleFlash_Shotgun_NPC( ClientEntityHandle_t hEntity, int attac
QAngle angles;
Vector forward;
int i;
// Setup the origin.
Vector origin;
@@ -3007,7 +3008,7 @@ void CTempEnts::MuzzleFlash_Shotgun_NPC( ClientEntityHandle_t hEntity, int attac
int numEmbers = random->RandomInt( 4, 8 );
for ( int i = 0; i < numEmbers; i++ )
for ( i = 0; i < numEmbers; i++ )
{
pTrailParticle = (TrailParticle *) pTrails->AddParticle( sizeof( TrailParticle ), g_Mat_SMG_Muzzleflash[0], origin );
+3 -3
View File
@@ -123,10 +123,10 @@ static inline void RecordPhysicsProp( const Vector& start, const QAngle &angles,
// Purpose:
//-----------------------------------------------------------------------------
void TE_PhysicsProp( IRecipientFilter& filter, float delay,
int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, bool breakmodel, int fEffects )
int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, bool breakmodel, int effects )
{
tempents->PhysicsProp( modelindex, skin, pos, angles, vel, breakmodel, fEffects );
RecordPhysicsProp( pos, angles, vel, modelindex, breakmodel, skin, fEffects );
tempents->PhysicsProp( modelindex, skin, pos, angles, vel, breakmodel, effects );
RecordPhysicsProp( pos, angles, vel, modelindex, breakmodel, skin, effects );
}
//-----------------------------------------------------------------------------
+1 -1
View File
@@ -240,7 +240,7 @@ void TE_PlayerDecal( IRecipientFilter& filter, float delay,
color32 rgbaColor = { 255, 255, 255, 255 };
effects->PlayerDecalShoot(
logo,
(void *)player,
(void *)(intp)player,
entity,
ent->GetModel(),
ent->GetAbsOrigin(),
+25 -25
View File
@@ -248,12 +248,12 @@ void C_BaseTeamObjectiveResource::OnDataChanged( DataUpdateType_t updateType )
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_BaseTeamObjectiveResource::UpdateControlPoint( const char *pszEvent, int index_ )
void C_BaseTeamObjectiveResource::UpdateControlPoint( const char *pszEvent, int index )
{
IGameEvent *event = gameeventmanager->CreateEvent( pszEvent );
if ( event )
{
event->SetInt( "index", index_ );
event->SetInt( "index", index );
gameeventmanager->FireEventClientSide( event );
}
}
@@ -261,16 +261,16 @@ void C_BaseTeamObjectiveResource::UpdateControlPoint( const char *pszEvent, int
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float C_BaseTeamObjectiveResource::GetCPCapPercentage( int index_ )
float C_BaseTeamObjectiveResource::GetCPCapPercentage( int index )
{
Assert( 0 <= index_ && index_ <= m_iNumControlPoints );
Assert( 0 <= index && index <= m_iNumControlPoints );
float flCapLength = m_flTeamCapTime[ TEAM_ARRAY(index_,m_iCappingTeam[index_]) ];
float flCapLength = m_flTeamCapTime[ TEAM_ARRAY(index,m_iCappingTeam[index]) ];
if( flCapLength <= 0 )
return 0.0f;
float flElapsedTime = flCapLength - m_flCapTimeLeft[index_];
float flElapsedTime = flCapLength - m_flCapTimeLeft[index];
if( flElapsedTime > flCapLength )
return 1.0f;
@@ -303,41 +303,41 @@ int C_BaseTeamObjectiveResource::GetNumControlPointsOwned( void )
// Purpose:
// team -
//-----------------------------------------------------------------------------
void C_BaseTeamObjectiveResource::SetOwningTeam( int index_, int team )
void C_BaseTeamObjectiveResource::SetOwningTeam( int index, int team )
{
if ( team == m_iCappingTeam[index_] )
if ( team == m_iCappingTeam[index] )
{
// successful cap, reset things
m_iCappingTeam[index_] = TEAM_UNASSIGNED;
m_flCapTimeLeft[index_] = 0.0f;
m_flCapLastThinkTime[index_] = 0;
m_iCappingTeam[index] = TEAM_UNASSIGNED;
m_flCapTimeLeft[index] = 0.0f;
m_flCapLastThinkTime[index] = 0;
}
m_iOwner[index_] = team;
m_iOwner[index] = team;
UpdateControlPoint( "controlpoint_updateowner", index_ );
UpdateControlPoint( "controlpoint_updateowner", index );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_BaseTeamObjectiveResource::SetCappingTeam( int index_, int team )
void C_BaseTeamObjectiveResource::SetCappingTeam( int index, int team )
{
if ( team != GetOwningTeam( index_ ) && ( team > LAST_SHARED_TEAM ) )
if ( team != GetOwningTeam( index ) && ( team > LAST_SHARED_TEAM ) )
{
m_flCapTimeLeft[index_] = m_flTeamCapTime[ TEAM_ARRAY( index_,team) ];
m_flCapTimeLeft[index] = m_flTeamCapTime[ TEAM_ARRAY(index,team) ];
}
else
{
m_flCapTimeLeft[index_] = 0.0;
m_flCapTimeLeft[index] = 0.0;
}
m_iCappingTeam[index_] = team;
m_bWarnedOnFinalCap[index_] = false;
m_iCappingTeam[index] = team;
m_bWarnedOnFinalCap[index] = false;
m_flCapLastThinkTime[index_] = gpGlobals->curtime;
m_flCapLastThinkTime[index] = gpGlobals->curtime;
SetNextClientThink( gpGlobals->curtime + RESOURCE_THINK_TIME );
UpdateControlPoint( "controlpoint_updatecapping", index_ );
UpdateControlPoint( "controlpoint_updatecapping", index );
}
//-----------------------------------------------------------------------------
@@ -353,14 +353,14 @@ void C_BaseTeamObjectiveResource::SetCapLayout( const char *pszLayout )
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool C_BaseTeamObjectiveResource::CapIsBlocked( int index_ )
bool C_BaseTeamObjectiveResource::CapIsBlocked( int index )
{
Assert( 0 <= index_ && index_ <= m_iNumControlPoints );
Assert( 0 <= index && index <= m_iNumControlPoints );
if ( m_flCapTimeLeft[index_] )
if ( m_flCapTimeLeft[index] )
{
// Blocked caps have capping teams & cap times, but no players on the point
if ( GetNumPlayersInArea( index_, m_iCappingTeam[index_] ) == 0 )
if ( GetNumPlayersInArea( index, m_iCappingTeam[index] ) == 0 )
return true;
}
+72 -72
View File
@@ -45,94 +45,94 @@ public:
void SetCapLayout( const char *pszLayout );
// Is the point visible in the objective display
bool IsCPVisible( int index_ )
bool IsCPVisible( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_bCPIsVisible[index_];
Assert( index < m_iNumControlPoints );
return m_bCPIsVisible[index];
}
bool IsCPBlocked( int index_ )
bool IsCPBlocked( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_bBlocked[index_];
Assert( index < m_iNumControlPoints );
return m_bBlocked[index];
}
// Get the world location of this control point
Vector& GetCPPosition( int index_ )
Vector& GetCPPosition( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_vCPPositions[index_];
Assert( index < m_iNumControlPoints );
return m_vCPPositions[index];
}
int GetOwningTeam( int index_ )
int GetOwningTeam( int index )
{
if ( index_ >= m_iNumControlPoints )
if ( index >= m_iNumControlPoints )
return TEAM_UNASSIGNED;
return m_iOwner[index_];
return m_iOwner[index];
}
int GetCappingTeam( int index_ )
int GetCappingTeam( int index )
{
if ( index_ >= m_iNumControlPoints )
if ( index >= m_iNumControlPoints )
return TEAM_UNASSIGNED;
return m_iCappingTeam[index_];
return m_iCappingTeam[index];
}
int GetTeamInZone( int index_ )
int GetTeamInZone( int index )
{
if ( index_ >= m_iNumControlPoints )
if ( index >= m_iNumControlPoints )
return TEAM_UNASSIGNED;
return m_iTeamInZone[index_];
return m_iTeamInZone[index];
}
// Icons
int GetCPCurrentOwnerIcon( int index_, int iOwner )
int GetCPCurrentOwnerIcon( int index, int iOwner )
{
Assert( index_ < m_iNumControlPoints );
Assert( index < m_iNumControlPoints );
return GetIconForTeam( index_, iOwner );
return GetIconForTeam( index, iOwner );
}
int GetCPCappingIcon( int index_ )
int GetCPCappingIcon( int index )
{
Assert( index_ < m_iNumControlPoints );
Assert( index < m_iNumControlPoints );
int iCapper = GetCappingTeam( index_ );
int iCapper = GetCappingTeam(index);
Assert( iCapper != TEAM_UNASSIGNED );
return GetIconForTeam( index_, iCapper );
return GetIconForTeam( index, iCapper );;
}
// Icon for the specified team
int GetIconForTeam( int index_, int team )
int GetIconForTeam( int index, int team )
{
Assert( index_ < m_iNumControlPoints );
return m_iTeamIcons[ TEAM_ARRAY( index_,team) ];
Assert( index < m_iNumControlPoints );
return m_iTeamIcons[ TEAM_ARRAY(index,team) ];
}
// Overlay for the specified team
int GetOverlayForTeam( int index_, int team )
int GetOverlayForTeam( int index, int team )
{
Assert( index_ < m_iNumControlPoints );
return m_iTeamOverlays[ TEAM_ARRAY( index_,team) ];
Assert( index < m_iNumControlPoints );
return m_iTeamOverlays[ TEAM_ARRAY(index,team) ];
}
// Number of players in the area
int GetNumPlayersInArea( int index_, int team )
int GetNumPlayersInArea( int index, int team )
{
Assert( index_ < m_iNumControlPoints );
return m_iNumTeamMembers[ TEAM_ARRAY( index_,team) ];
Assert( index < m_iNumControlPoints );
return m_iNumTeamMembers[ TEAM_ARRAY(index,team) ];
}
// get the required cappers for the passed team
int GetRequiredCappers( int index_, int team )
int GetRequiredCappers( int index, int team )
{
Assert( index_ < m_iNumControlPoints );
return m_iTeamReqCappers[ TEAM_ARRAY( index_,team) ];
Assert( index < m_iNumControlPoints );
return m_iTeamReqCappers[ TEAM_ARRAY(index,team) ];
}
// Base Icon for the specified team
@@ -148,84 +148,84 @@ public:
return m_iBaseControlPoints[iTeam];
}
int GetPreviousPointForPoint( int index_, int team, int iPrevIndex )
int GetPreviousPointForPoint( int index, int team, int iPrevIndex )
{
Assert( index_ < m_iNumControlPoints );
Assert( index < m_iNumControlPoints );
Assert( iPrevIndex >= 0 && iPrevIndex < MAX_PREVIOUS_POINTS );
int iIntIndex = iPrevIndex + (index_ * MAX_PREVIOUS_POINTS) + (team * MAX_CONTROL_POINTS * MAX_PREVIOUS_POINTS);
int iIntIndex = iPrevIndex + (index * MAX_PREVIOUS_POINTS) + (team * MAX_CONTROL_POINTS * MAX_PREVIOUS_POINTS);
return m_iPreviousPoints[ iIntIndex ];
}
bool TeamCanCapPoint( int index_, int team )
bool TeamCanCapPoint( int index, int team )
{
Assert( index_ < m_iNumControlPoints );
return m_bTeamCanCap[ TEAM_ARRAY( index_, team ) ];
Assert( index < m_iNumControlPoints );
return m_bTeamCanCap[ TEAM_ARRAY( index, team ) ];
}
const char *GetCapLayoutInHUD( void ) { return m_pszCapLayoutInHUD; }
void GetCapLayoutCustomPosition( float& flCustomPositionX, float& flCustomPositionY ) { flCustomPositionX = m_flCustomPositionX; flCustomPositionY = m_flCustomPositionY; }
bool PlayingMiniRounds( void ){ return m_bPlayingMiniRounds; }
bool IsInMiniRound( int index_ ) { return m_bInMiniRound[index_]; }
bool IsInMiniRound( int index ) { return m_bInMiniRound[index]; }
int GetCapWarningLevel( int index_ )
int GetCapWarningLevel( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_iWarnOnCap[index_];
Assert( index < m_iNumControlPoints );
return m_iWarnOnCap[index];
}
int GetCPGroup( int index_ )
int GetCPGroup( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_iCPGroup[index_];
Assert( index < m_iNumControlPoints );
return m_iCPGroup[index];
}
const char *GetWarnSound( int index_ )
const char *GetWarnSound( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_iszWarnSound[index_];
Assert( index < m_iNumControlPoints );
return m_iszWarnSound[index];
}
virtual const char *GetGameSpecificCPCappingSwipe( int index_, int iCappingTeam )
virtual const char *GetGameSpecificCPCappingSwipe( int index, int iCappingTeam )
{
// You need to implement this in your game's objective resource.
Assert(0);
return NULL;
}
virtual const char *GetGameSpecificCPBarFG( int index_, int iOwningTeam )
virtual const char *GetGameSpecificCPBarFG( int index, int iOwningTeam )
{
// You need to implement this in your game's objective resource.
Assert(0);
return NULL;
}
virtual const char *GetGameSpecificCPBarBG( int index_, int iCappingTeam )
virtual const char *GetGameSpecificCPBarBG( int index, int iCappingTeam )
{
// You need to implement this in your game's objective resource.
Assert(0);
return NULL;
}
bool CapIsBlocked( int index_ );
bool CapIsBlocked( int index );
int GetTimerToShowInHUD( void ) { return m_iTimerToShowInHUD; }
int GetStopWatchTimer( void ) { return m_iStopWatchTimer; }
float GetPathDistance( int index_ )
float GetPathDistance( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_flPathDistance[index_];
Assert( index < m_iNumControlPoints );
return m_flPathDistance[index];
}
bool GetCPLocked( int index_ )
bool GetCPLocked( int index )
{
Assert( index_ < m_iNumControlPoints );
return m_bCPLocked[index_];
Assert( index < m_iNumControlPoints );
return m_bCPLocked[index];
}
bool GetTrackAlarm( int index_ )
bool GetTrackAlarm( int index )
{
Assert( index_ < TEAM_TRAIN_MAX_TEAMS );
return m_bTrackAlarm[index_];
Assert( index < TEAM_TRAIN_MAX_TEAMS );
return m_bTrackAlarm[index];
}
int GetNumNodeHillData( int team ){ return ( team < TEAM_TRAIN_MAX_TEAMS ) ? m_nNumNodeHillData[team] : 0; }
@@ -234,11 +234,11 @@ public:
{
if ( hill < TEAM_TRAIN_MAX_HILLS && team < TEAM_TRAIN_MAX_TEAMS )
{
int index_ = ( hill * TEAM_TRAIN_FLOATS_PER_HILL ) + ( team * TEAM_TRAIN_MAX_HILLS * TEAM_TRAIN_FLOATS_PER_HILL );
if ( index_ < TEAM_TRAIN_HILLS_ARRAY_SIZE - 1 ) // - 1 because we want to look at 2 entries
int index = ( hill * TEAM_TRAIN_FLOATS_PER_HILL ) + ( team * TEAM_TRAIN_MAX_HILLS * TEAM_TRAIN_FLOATS_PER_HILL );
if ( index < TEAM_TRAIN_HILLS_ARRAY_SIZE - 1 ) // - 1 because we want to look at 2 entries
{
flStart = m_flNodeHillData[index_];
flEnd = m_flNodeHillData[index_ +1];
flStart = m_flNodeHillData[index];
flEnd = m_flNodeHillData[index+1];
}
}
}
@@ -247,8 +247,8 @@ public:
{
if ( team < TEAM_TRAIN_MAX_TEAMS && hill < TEAM_TRAIN_MAX_HILLS )
{
int index_ = hill + ( team * TEAM_TRAIN_MAX_HILLS );
m_bTrainOnHill[index_] = state;
int index = hill + ( team * TEAM_TRAIN_MAX_HILLS );
m_bTrainOnHill[index] = state;
}
}
+9 -4
View File
@@ -163,13 +163,18 @@ void C_TeamTrainWatcher::OnDataChanged( DataUpdateType_t updateType )
int nNumHills = ObjectiveResource()->GetNumNodeHillData( GetTeamNumber() );
if ( nNumHills > 0 )
{
float flStart = 0, flEnd = 0;
float flStart, flEnd;
for ( int i = 0 ; i < nNumHills ; i++ )
{
ObjectiveResource()->GetHillData( GetTeamNumber(), i, flStart, flEnd );
bool state = ( m_flTotalProgress >= flStart && m_flTotalProgress <= flEnd );
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, state );
if ( m_flTotalProgress >= flStart && m_flTotalProgress<= flEnd )
{
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, true );
}
else
{
ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, false );
}
}
}
}
+38 -2
View File
@@ -42,6 +42,41 @@ CLIENTEFFECT_REGISTER_BEGIN( PrecacheEffectVGuiScreen )
CLIENTEFFECT_MATERIAL( "engine/writez" )
CLIENTEFFECT_REGISTER_END()
// ----------------------------------------------------------------------------- //
// This is a cache of preloaded keyvalues.
// ----------------------------------------------------------------------------- //
CUtlDict<KeyValues*, int> g_KeyValuesCache;
KeyValues* CacheKeyValuesForFile( const char *pFilename )
{
MEM_ALLOC_CREDIT();
int i = g_KeyValuesCache.Find( pFilename );
if ( i == g_KeyValuesCache.InvalidIndex() )
{
KeyValues *rDat = new KeyValues( pFilename );
rDat->LoadFromFile( filesystem, pFilename, NULL );
g_KeyValuesCache.Insert( pFilename, rDat );
return rDat;
}
else
{
return g_KeyValuesCache[i];
}
}
void ClearKeyValuesCache()
{
MEM_ALLOC_CREDIT();
for ( int i=g_KeyValuesCache.First(); i != g_KeyValuesCache.InvalidIndex(); i=g_KeyValuesCache.Next( i ) )
{
g_KeyValuesCache[i]->deleteThis();
}
g_KeyValuesCache.Purge();
}
IMPLEMENT_CLIENTCLASS_DT(C_VGuiScreen, DT_VGuiScreen, CVGuiScreen)
RecvPropFloat( RECVINFO(m_flWidth) ),
RecvPropFloat( RECVINFO(m_flHeight) ),
@@ -671,7 +706,7 @@ C_BaseEntity *FindNearbyVguiScreen( const Vector &viewPosition, const QAngle &vi
// Look for vgui screens that are close to the player
CVGuiScreenEnumerator localScreens;
::partition->EnumerateElementsInSphere( PARTITION_CLIENT_NON_STATIC_EDICTS, viewPosition, VGUI_SCREEN_MODE_RADIUS, false, &localScreens );
partition->EnumerateElementsInSphere( PARTITION_CLIENT_NON_STATIC_EDICTS, viewPosition, VGUI_SCREEN_MODE_RADIUS, false, &localScreens );
Vector vecOut, vecViewDelta;
@@ -781,7 +816,8 @@ bool CVGuiScreenPanel::Init( KeyValues* pKeyValues, VGuiScreenInitData_t* pInitD
const char *pResFile = pKeyValues->GetString( "resfile" );
if (pResFile[0] != 0)
{
LoadControlSettings( pResFile, NULL, NULL );
KeyValues *pCachedKeyValues = CacheKeyValuesForFile( pResFile );
LoadControlSettings( pResFile, NULL, pCachedKeyValues );
}
// Dimensions in pixels
+4
View File
@@ -179,5 +179,9 @@ void DeactivateVguiScreen( C_BaseEntity *pVguiScreen );
void SetVGuiScreenButtonState( C_BaseEntity *pVguiScreen, int nButtonState );
// Called at shutdown.
void ClearKeyValuesCache();
#endif // C_VGUISCREEN_H
+9 -11
View File
@@ -30,10 +30,10 @@ END_RECV_TABLE()
void C_VoteController::RecvProxy_VoteType( const CRecvProxyData *pData, void *pStruct, void *pOut )
{
C_VoteController *pMe = (C_VoteController *)pStruct;
if( pMe->m_iActiveIssueIndex == pData->m_Value.m_Int )
if( memcmp( &pMe->m_iActiveIssueIndex, &pData->m_Value.m_Int, sizeof(pData->m_Value.m_Int)) == 0 )
return;
pMe->m_iActiveIssueIndex = pData->m_Value.m_Int;
memcpy( &pMe->m_iActiveIssueIndex, &pData->m_Value.m_Int, sizeof(pData->m_Value.m_Int) );
pMe->m_bTypeDirty = true;
// Since the contents of a new vote are in three parts, we can't directly send an event to the Hud
@@ -81,10 +81,10 @@ C_VoteController::~C_VoteController()
void C_VoteController::ResetData()
{
m_iActiveIssueIndex = INVALID_ISSUE;
m_iOnlyTeamToVote = TEAM_UNASSIGNED;
for( int i = 0; i < MAX_VOTE_OPTIONS; i++ )
m_iOnlyTeamToVote = TEAM_INVALID;
for( int index = 0; index < MAX_VOTE_OPTIONS; index++ )
{
m_nVoteOptionCount[i] = 0;
m_nVoteOptionCount[index] = 0;
}
m_nPotentialVotes = 0;
m_bVotesDirty = false;
@@ -118,24 +118,22 @@ void C_VoteController::ClientThink()
{
if ( m_nPotentialVotes > 0 )
{
#ifdef STAGING_ONLY
// Currently hard-coded to MAX_VOTE_COUNT options per issue
DevMsg( "Votes: Option1 - %d, Option2 - %d, Option3 - %d, Option4 - %d, Option5 - %d\n",
m_nVoteOptionCount[0], m_nVoteOptionCount[1], m_nVoteOptionCount[2], m_nVoteOptionCount[3], m_nVoteOptionCount[4] );
#endif // STAGING_ONLY
IGameEvent *event = gameeventmanager->CreateEvent( "vote_changed" );
if ( event )
{
for ( int i = 0; i < MAX_VOTE_OPTIONS; i++ )
for ( int index = 0; index < MAX_VOTE_OPTIONS; index++ )
{
char szOption[2];
Q_snprintf( szOption, sizeof( szOption ), "%i", i + 1 );
Q_snprintf( szOption, sizeof( szOption ), "%i", index + 1 );
char szVoteOption[13] = "vote_option";
Q_strncat( szVoteOption, szOption, sizeof( szVoteOption ), COPY_ALL_CHARACTERS );
event->SetInt( szVoteOption, m_nVoteOptionCount[i] );
event->SetInt( szVoteOption, m_nVoteOptionCount[index] );
}
event->SetInt( "potentialVotes", m_nPotentialVotes );
gameeventmanager->FireEventClientSide( event );
@@ -188,4 +186,4 @@ void C_VoteController::FireGameEvent( IGameEvent *event )
}
}
}
}
}
-1
View File
@@ -20,7 +20,6 @@ struct studiohdr_t;
#include <tier0/dbg.h>
#include <tier1/strtools.h>
#include <tier1/fmtstr.h>
#include <vstdlib/random.h>
#include <utlvector.h>
+3 -3
View File
@@ -66,7 +66,7 @@ public:
CBoundedCvar_InterpRatio() :
ConVar_ServerBounded( "cl_interp_ratio",
"2.0",
FCVAR_USERINFO | FCVAR_NOT_CONNECTED | FCVAR_ARCHIVE,
FCVAR_USERINFO | FCVAR_NOT_CONNECTED,
"Sets the interpolation amount (final amount is cl_interp_ratio / cl_updaterate)." )
{
}
@@ -100,7 +100,7 @@ public:
CBoundedCvar_Interp() :
ConVar_ServerBounded( "cl_interp",
"0.1",
FCVAR_USERINFO | FCVAR_NOT_CONNECTED | FCVAR_ARCHIVE,
FCVAR_USERINFO | FCVAR_NOT_CONNECTED,
"Sets the interpolation amount (bounded on low side by server interp ratio settings).", true, 0.0f, true, 0.5f )
{
}
@@ -133,7 +133,7 @@ float GetClientInterpAmount()
}
else
{
if ( !HushAsserts() )
if (!CommandLine()->FindParm("-hushasserts"))
{
AssertMsgOnce( false, "GetInterpolationAmount: can't get cl_updaterate cvar." );
}
+54 -58
View File
@@ -117,7 +117,6 @@
#include "tf_hud_disconnect_prompt.h"
#include "../engine/audio/public/sound.h"
#include "tf_shared_content_manager.h"
#include "tf_gamerules.h"
#endif
#include "clientsteamcontext.h"
#include "renamed_recvtable_compat.h"
@@ -125,8 +124,6 @@
#include "sourcevr/isourcevirtualreality.h"
#include "client_virtualreality.h"
#include "mumble.h"
#include "vgui_controls/BuildGroup.h"
#include "touch.h"
// NVNT includes
#include "hud_macros.h"
@@ -144,13 +141,14 @@
#if defined( TF_CLIENT_DLL )
#include "econ/tool_items/custom_texture_cache.h"
#endif
#ifdef WORKSHOP_IMPORT_ENABLED
#include "fbxsystem/fbxsystem.h"
#endif
#include "touch.h"
extern vgui::IInputInternal *g_InputInternal;
//=============================================================================
@@ -572,8 +570,7 @@ void DisplayBoneSetupEnts()
if ( pEnt->m_Count >= 3 )
{
printInfo.color[0] = 1;
printInfo.color[1] = 0;
printInfo.color[2] = 0;
printInfo.color[1] = printInfo.color[2] = 0;
}
else if ( pEnt->m_Count == 2 )
{
@@ -583,9 +580,7 @@ void DisplayBoneSetupEnts()
}
else
{
printInfo.color[0] = 1;
printInfo.color[1] = 1;
printInfo.color[2] = 1;
printInfo.color[0] = printInfo.color[0] = printInfo.color[0] = 1;
}
engine->Con_NXPrintf( &printInfo, "%25s / %3d / %3d", pEnt->m_ModelName, pEnt->m_Count, pEnt->m_Index );
printInfo.index++;
@@ -730,12 +725,12 @@ public:
// Returns true if the disconnect command has been handled by the client
virtual bool DisconnectAttempt( void );
public:
void PrecacheMaterial( const char *pMaterialName );
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar );
virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 );
virtual void IN_TouchEvent( int type, int fingerId, int x, int y );
private:
void UncacheAllMaterials( );
void ResetStringTablePointers();
@@ -906,7 +901,7 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
return false;
if ( (networkstringtable = (INetworkStringTableContainer *)appSystemFactory(INTERFACENAME_NETWORKSTRINGTABLECLIENT,NULL)) == NULL )
return false;
if ( (::partition = (ISpatialPartition *)appSystemFactory(INTERFACEVERSION_SPATIALPARTITION, NULL)) == NULL )
if ( (partition = (ISpatialPartition *)appSystemFactory(INTERFACEVERSION_SPATIALPARTITION, NULL)) == NULL )
return false;
if ( (shadowmgr = (IShadowMgr *)appSystemFactory(ENGINE_SHADOWMGR_INTERFACE_VERSION, NULL)) == NULL )
return false;
@@ -956,8 +951,7 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
#endif
// it's ok if this is NULL. That just means the sourcevr.dll wasn't found
if ( CommandLine()->CheckParm( "-vr" ) )
g_pSourceVR = (ISourceVirtualReality *)appSystemFactory(SOURCE_VIRTUAL_REALITY_INTERFACE_VERSION, NULL);
g_pSourceVR = (ISourceVirtualReality *)appSystemFactory(SOURCE_VIRTUAL_REALITY_INTERFACE_VERSION, NULL);
factorylist_t factories;
factories.appSystemFactory = appSystemFactory;
@@ -1040,7 +1034,6 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
g_pClientMode->InitViewport();
gHUD.Init();
gTouch.Init();
g_pClientMode->Init();
@@ -1210,7 +1203,7 @@ void CHLClient::Shutdown( void )
ParticleMgr()->Term();
vgui::BuildGroup::ClearResFileCache();
ClearKeyValuesCache();
#ifndef NO_STEAM
ClientSteamContext().Shutdown();
@@ -1424,23 +1417,8 @@ int CHLClient::IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszC
return input->KeyEvent( eventcode, keynum, pszCurrentBinding );
}
void CHLClient::IN_TouchEvent( int type, int fingerId, int x, int y )
{
if( enginevgui->IsGameUIVisible() )
return;
touch_event_t ev;
ev.type = type;
ev.fingerid = fingerId;
ev.x = x;
ev.y = y;
gTouch.ProcessEvent( &ev );
}
void CHLClient::ExtraMouseSample( float frametime, bool active )
{
{
Assert( C_BaseEntity::IsAbsRecomputationsEnabled() );
Assert( C_BaseEntity::IsAbsQueriesValid() );
@@ -1772,10 +1750,10 @@ void CHLClient::LevelShutdown( void )
//-----------------------------------------------------------------------------
void CHLClient::SetCrosshairAngle( const QAngle& angle )
{
CHudCrosshair *pCrosshair = GET_HUDELEMENT( CHudCrosshair );
if ( pCrosshair )
CHudCrosshair *crosshair = GET_HUDELEMENT( CHudCrosshair );
if ( crosshair )
{
pCrosshair->SetCrosshairAngle( angle );
crosshair->SetCrosshairAngle( angle );
}
}
@@ -2132,11 +2110,10 @@ void OnRenderStart()
g_pPortalRender->UpdatePortalPixelVisibility(); //updating this one or two lines before querying again just isn't cutting it. Update as soon as it's cheap to do so.
#endif
::partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, true );
partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, true );
C_BaseEntity::SetAbsQueriesValid( false );
Rope_ResetCounters();
UpdateLocalPlayerVisionFlags();
// Interpolate server entities and move aiments.
{
@@ -2176,7 +2153,7 @@ void OnRenderStart()
// This will place all entities in the correct position in world space and in the KD-tree
C_BaseAnimating::UpdateClientSideAnimations();
::partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false );
partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false );
// Process OnDataChanged events.
ProcessOnDataChangedEvents();
@@ -2289,7 +2266,7 @@ void CHLClient::FrameStageNotify( ClientFrameStage_t curStage )
C_BaseEntity::EnableAbsRecomputations( false );
C_BaseEntity::SetAbsQueriesValid( false );
Interpolation_SetLastPacketTimeStamp( engine->GetLastTimeStamp() );
::partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, true );
partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, true );
PREDICTION_STARTTRACKVALUE( "netupdate" );
}
@@ -2301,7 +2278,7 @@ void CHLClient::FrameStageNotify( ClientFrameStage_t curStage )
// reenable abs recomputation since now all entities have been updated
C_BaseEntity::EnableAbsRecomputations( true );
C_BaseEntity::SetAbsQueriesValid( true );
::partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false );
partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false );
PREDICTION_ENDTRACKVALUE();
}
@@ -2463,18 +2440,10 @@ bool CHLClient::CanRecordDemo( char *errorMsg, int length ) const
void CHLClient::OnDemoRecordStart( char const* pDemoBaseName )
{
if ( GetClientModeNormal() )
{
return GetClientModeNormal()->OnDemoRecordStart( pDemoBaseName );
}
}
void CHLClient::OnDemoRecordStop()
{
if ( GetClientModeNormal() )
{
return GetClientModeNormal()->OnDemoRecordStop();
}
}
void CHLClient::OnDemoPlaybackStart( char const* pDemoBaseName )
@@ -2597,22 +2566,26 @@ void CHLClient::ClientAdjustStartSoundParams( StartSoundParams_t& params )
// Halloween voice futzery?
else
{
float flVoicePitchScale = 1.f;
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pEntity, flVoicePitchScale, voice_pitch_scale );
float flHeadScale = 1.f;
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pEntity, flHeadScale, head_scale );
int iHalloweenVoiceSpell = 0;
if ( TF_IsHolidayActive( kHoliday_HalloweenOrFullMoon ) )
{
CALL_ATTRIB_HOOK_INT_ON_OTHER( pEntity, iHalloweenVoiceSpell, halloween_voice_modulation );
}
CALL_ATTRIB_HOOK_INT_ON_OTHER( pEntity, iHalloweenVoiceSpell, halloween_voice_modulation );
if ( iHalloweenVoiceSpell > 0 )
{
params.pitch *= 0.8f;
}
else if( flVoicePitchScale != 1.f )
else if( flHeadScale != 1.f )
{
params.pitch *= flVoicePitchScale;
// Big head, deep voice
if( flHeadScale > 1.f )
{
params.pitch *= 0.8f;
}
else // Small head, high voice
{
params.pitch *= 1.3f;
}
}
}
}
@@ -2654,7 +2627,7 @@ CSteamID GetSteamIDForPlayerIndex( int iPlayerIndex )
{
if ( pi.friendsID )
{
return CSteamID( pi.friendsID, 1, GetUniverse(), k_EAccountTypeIndividual );
return CSteamID( pi.friendsID, 1, steamapicontext->SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
}
}
}
@@ -2662,3 +2635,26 @@ CSteamID GetSteamIDForPlayerIndex( int iPlayerIndex )
}
#endif
void CHLClient::IN_TouchEvent( uint data, uint data2, uint data3, uint data4 )
{
if( enginevgui->IsGameUIVisible() )
return;
touch_event_t ev;
ev.type = data & 0xFFFF;
ev.fingerid = (data >> 16) & 0xFFFF;
ev.x = (double)((data2 >> 16) & 0xFFFF) / 0xFFFF;
ev.y = (double)(data2 & 0xFFFF) / 0xFFFF;
union{uint i;float f;} ifconv;
ifconv.i = data3;
ev.dx = ifconv.f;
ifconv.i = data4;
ev.dy = ifconv.f;
gTouch.ProcessEvent( &ev );
}
+52 -48
View File
@@ -27,7 +27,6 @@
#include <vgui/ILocalize.h>
#include "view.h"
#include "ixboxsystem.h"
#include "inputsystem/iinputsystem.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -83,24 +82,14 @@ int GetLocalPlayerIndex( void )
return 0; // game not started yet
}
// NOTE: cache these because this gets executed hundreds of times per frame
static int g_nLocalPlayerVisionFlagsWeaponsCheck = 0;
static int g_nLocalPlayerVisionFlags = 0;
int GetLocalPlayerVisionFilterFlags( bool bWeaponsCheck /*= false */ )
{
return bWeaponsCheck ? g_nLocalPlayerVisionFlagsWeaponsCheck : g_nLocalPlayerVisionFlags;
}
C_BasePlayer * player = C_BasePlayer::GetLocalPlayer();
void UpdateLocalPlayerVisionFlags()
{
g_nLocalPlayerVisionFlagsWeaponsCheck = 0;
g_nLocalPlayerVisionFlags = 0;
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( pPlayer )
{
g_nLocalPlayerVisionFlagsWeaponsCheck = pPlayer->GetVisionFilterFlags( true );
g_nLocalPlayerVisionFlags = pPlayer->GetVisionFilterFlags( false );
}
if ( player )
return player->GetVisionFilterFlags( bWeaponsCheck );
else
return 0;
}
bool IsLocalPlayerUsingVisionFilterFlags( int nFlags, bool bWeaponsCheck /* = false */ )
@@ -674,7 +663,7 @@ IterationRetval_t CFlaggedEntitiesEnum::EnumElement( IHandleEntity *pHandleEntit
int UTIL_EntitiesInBox( C_BaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask, int partitionMask )
{
CFlaggedEntitiesEnum boxEnum( pList, listMax, flagMask );
::partition->EnumerateElementsInBox( partitionMask, mins, maxs, false, &boxEnum );
partition->EnumerateElementsInBox( partitionMask, mins, maxs, false, &boxEnum );
return boxEnum.GetCount();
@@ -692,7 +681,7 @@ int UTIL_EntitiesInBox( C_BaseEntity **pList, int listMax, const Vector &mins, c
int UTIL_EntitiesInSphere( C_BaseEntity **pList, int listMax, const Vector &center, float radius, int flagMask, int partitionMask )
{
CFlaggedEntitiesEnum sphereEnum( pList, listMax, flagMask );
::partition->EnumerateElementsInSphere( partitionMask, center, radius, false, &sphereEnum );
partition->EnumerateElementsInSphere( partitionMask, center, radius, false, &sphereEnum );
return sphereEnum.GetCount();
@@ -709,7 +698,7 @@ int UTIL_EntitiesInSphere( C_BaseEntity **pList, int listMax, const Vector &cent
int UTIL_EntitiesAlongRay( C_BaseEntity **pList, int listMax, const Ray_t &ray, int flagMask, int partitionMask )
{
CFlaggedEntitiesEnum rayEnum( pList, listMax, flagMask );
::partition->EnumerateElementsAlongRay( partitionMask, ray, false, &rayEnum );
partition->EnumerateElementsAlongRay( partitionMask, ray, false, &rayEnum );
return rayEnum.GetCount();
}
@@ -727,6 +716,48 @@ CBaseEntity *CEntitySphereQuery::GetCurrentEntity()
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Slightly modified strtok. Does not modify the input string. Does
// not skip over more than one separator at a time. This allows parsing
// strings where tokens between separators may or may not be present:
//
// Door01,,,0 would be parsed as "Door01" "" "" "0"
// Door01,Open,,0 would be parsed as "Door01" "Open" "" "0"
//
// Input : token - Returns with a token, or zero length if the token was missing.
// str - String to parse.
// sep - Character to use as separator. UNDONE: allow multiple separator chars
// Output : Returns a pointer to the next token to be parsed.
//-----------------------------------------------------------------------------
const char *nexttoken(char *token, const char *str, char sep)
{
if ((str == NULL) || (*str == '\0'))
{
*token = '\0';
return(NULL);
}
//
// Copy everything up to the first separator into the return buffer.
// Do not include separators in the return buffer.
//
while ((*str != sep) && (*str != '\0'))
{
*token++ = *str++;
}
*token = '\0';
//
// Advance the pointer unless we hit the end of the input string.
//
if (*str == '\0')
{
return(str);
}
return(++str);
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : font -
@@ -860,12 +891,8 @@ const char * UTIL_SafeName( const char *oldName )
// for consistency with other APIs. If inbufsizebytes is 0 a NULL-terminated
// input buffer is assumed, or you can pass the size of the input buffer if
// not NULL-terminated.
//
// If actionset is other than GAME_ACTION_SET_NONE (the default), then a lookup is first
// attempted for a Steam Controller binding in the given action set. If none if found, fallback
// is to the usual keyboard binding path.
//-----------------------------------------------------------------------------
void UTIL_ReplaceKeyBindings( const wchar_t *inbuf, int inbufsizebytes, OUT_Z_BYTECAP(outbufsizebytes) wchar_t *outbuf, int outbufsizebytes, GameActionSet_t actionset )
void UTIL_ReplaceKeyBindings( const wchar_t *inbuf, int inbufsizebytes, OUT_Z_BYTECAP(outbufsizebytes) wchar_t *outbuf, int outbufsizebytes )
{
Assert( outbufsizebytes >= sizeof(outbuf[0]) );
// copy to a new buf if there are vars
@@ -901,18 +928,6 @@ void UTIL_ReplaceKeyBindings( const wchar_t *inbuf, int inbufsizebytes, OUT_Z_BY
char binding[64];
g_pVGuiLocalize->ConvertUnicodeToANSI( token, binding, sizeof(binding) );
// Find a Steam Controller mapping, if an action set was specified.
const wchar_t* sc_origin = nullptr;
if ( actionset != GAME_ACTION_SET_NONE)
{
auto origin = g_pInputSystem->GetSteamControllerActionOrigin( *binding == '+' ? binding + 1 : binding, actionset );
if ( origin != k_EControllerActionOrigin_None )
{
sc_origin = g_pInputSystem->GetSteamControllerDescriptionForActionOrigin( origin );
}
}
// Find also the keyboard mapping
const char *key = engine->Key_LookupBinding( *binding == '+' ? binding + 1 : binding );
if ( !key )
{
@@ -940,18 +955,7 @@ void UTIL_ReplaceKeyBindings( const wchar_t *inbuf, int inbufsizebytes, OUT_Z_BY
}
Q_strupr( friendlyName );
const wchar_t* locName = nullptr;
// If we got a Steam Controller key description, use that, otherwise use the (possibly localized) key name
if ( sc_origin )
{
locName = sc_origin;
}
else
{
locName = g_pVGuiLocalize->Find( friendlyName );
}
wchar_t *locName = g_pVGuiLocalize->Find( friendlyName );
if ( !locName || wcslen(locName) <= 0)
{
g_pVGuiLocalize->ConvertANSIToUnicode( friendlyName, token, sizeof(token) );
+3 -3
View File
@@ -21,7 +21,6 @@
#include "bitmap/imageformat.h"
#include "ispatialpartition.h"
#include "materialsystem/MaterialSystemUtil.h"
#include "inputsystem/InputEnums.h"
class Vector;
class QAngle;
@@ -67,7 +66,7 @@ byte *UTIL_LoadFileForMe( const char *filename, int *pLength );
void UTIL_FreeFile( byte *buffer );
void UTIL_MakeSafeName( const char *oldName, OUT_Z_CAP(newNameBufSize) char *newName, int newNameBufSize ); ///< Cleans up player names for putting in vgui controls (cleaned names can be up to original*2+1 in length)
const char *UTIL_SafeName( const char *oldName ); ///< Wraps UTIL_MakeSafeName, and returns a static buffer
void UTIL_ReplaceKeyBindings( const wchar_t *inbuf, int inbufsizebytes, OUT_Z_BYTECAP(outbufsizebytes) wchar_t *outbuf, int outbufsizebytes, GameActionSet_t action_set = GAME_ACTION_SET_NONE );
void UTIL_ReplaceKeyBindings( const wchar_t *inbuf, int inbufsizebytes, OUT_Z_BYTECAP(outbufsizebytes) wchar_t *outbuf, int outbufsizebytes );
// Fade out an entity based on distance fades
unsigned char UTIL_ComputeEntityFade( C_BaseEntity *pEntity, float flMinDist, float flMaxDist, float flFadeScale );
@@ -81,7 +80,6 @@ char *VarArgs( PRINTF_FORMAT_STRING const char *format, ... );
int GetSpectatorTarget();
int GetSpectatorMode( void );
bool IsPlayerIndex( int index );
void UpdateLocalPlayerVisionFlags();
int GetLocalPlayerIndex( void );
int GetLocalPlayerVisionFilterFlags( bool bWeaponsCheck = false );
bool IsLocalPlayerUsingVisionFilterFlags( int nFlags, bool bWeaponsCheck = false );
@@ -91,6 +89,8 @@ void NormalizeAngles( QAngle& angles );
void InterpolateAngles( const QAngle& start, const QAngle& end, QAngle& output, float frac );
void InterpolateVector( float frac, const Vector& src, const Vector& dest, Vector& output );
const char *nexttoken(char *token, const char *str, char sep);
//-----------------------------------------------------------------------------
// Base light indices to avoid index collision
//-----------------------------------------------------------------------------
+18 -19
View File
@@ -21,8 +21,8 @@ $Configuration "Debug"
{
$General
{
$OutputDirectory ".\Debug_$GAMENAME" [$WINDOWS]
$IntermediateDirectory ".\Debug_$GAMENAME" [$WINDOWS]
$OutputDirectory ".\Debug_$GAMENAME" [$WIN32]
$IntermediateDirectory ".\Debug_$GAMENAME" [$WIN32]
$OutputDirectory ".\Debug_$GAMENAME_360" [$X360]
$IntermediateDirectory ".\Debug_$GAMENAME_360" [$X360]
@@ -33,9 +33,8 @@ $Configuration "Release"
{
$General
{
// Windows generator doesn't sandbox these directories per configuration but others do :-/
$OutputDirectory ".\Release_$GAMENAME" [$WINDOWS]
$IntermediateDirectory ".\Release_$GAMENAME" [$WINDOWS]
$OutputDirectory ".\Release_$GAMENAME" [$WIN32]
$IntermediateDirectory ".\Release_$GAMENAME" [$WIN32]
$OutputDirectory ".\Release_$GAMENAME_360" [$X360]
$IntermediateDirectory ".\Release_$GAMENAME_360" [$X360]
@@ -46,16 +45,17 @@ $Configuration
{
$General
{
$OutputDirectory ".\$GAMENAME"
$IntermediateDirectory ".\$GAMENAME"
$OutputDirectory ".\$GAMENAME" [$OSXALL]
}
$Compiler
{
$AdditionalIncludeDirectories ".\;$BASE;$SRCDIR\vgui2\include;$SRCDIR\vgui2\controls;$SRCDIR\game\shared;.\game_controls;$SRCDIR\thirdparty\sixensesdk\include"
$PreprocessorDefinitions "$BASE;NO_STRING_T;CLIENT_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead"
$PreprocessorDefinitions "$BASE;fopen=dont_use_fopen" [$WIN32]
$PreprocessorDefinitions "$BASE;USE_WEBM_FOR_REPLAY;" [$LINUXALL]
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;fopen=dont_use_fopen" [$WIN32]
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$OSXALL]
$PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;USE_WEBM_FOR_REPLAY;" [$LINUXALL]
$PreprocessorDefinitions "$BASE;CURL_STATICLIB" [$WIN32 && $BUILD_REPLAY]
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
$Create/UsePCHThroughFile "cbase.h"
$PrecompiledHeaderFile "$(IntDir)/client.pch"
@@ -68,7 +68,7 @@ $Configuration
$SystemLibraries "rt" [$LINUXALL]
$IgnoreImportLibrary "TRUE"
$AdditionalDependencies "$BASE winmm.lib" [$WIN32]
$AdditionalDependencies "$BASE wsock32.lib Ws2_32.lib" [$BUILD_REPLAY&&$WIN32]
$AdditionalDependencies "$BASE wsock32.lib Ws2_32.lib" [$BUILD_REPLAY]
}
}
@@ -100,9 +100,6 @@ $Project
$File "$SRCDIR\game\shared\replay_gamestats_shared.cpp" [$BUILD_REPLAY]
$File "$SRCDIR\game\shared\replay_gamestats_shared.h" [$BUILD_REPLAY]
$File "$SRCDIR\game\client\youtubeapi.h" [$BUILD_REPLAY]
$File "$SRCDIR\game\client\youtubeapi.cpp" [$BUILD_REPLAY]
{
$Configuration
{
$Compiler
@@ -148,10 +145,6 @@ $Project
$File "replay\vgui\replayrenderoverlay.h"
$File "replay\vgui\replayreminderpanel.cpp"
$File "replay\vgui\replayreminderpanel.h"
$File "replay\replayyoutubeapi.cpp"
$File "replay\replayyoutubeapi.h"
$File "replay\replayyoutubeapi_key.cpp" [!$SOURCESDK]
$File "replay\replayyoutubeapi_key_sdk.cpp" [$SOURCESDK]
$File "game_controls\slideshowpanel.cpp"
$File "game_controls\slideshowpanel.h"
@@ -372,7 +365,6 @@ $Project
$File "in_camera.cpp"
$File "in_joystick.cpp"
$File "in_main.cpp"
$File "in_steamcontroller.cpp"
$File "initializer.cpp"
$File "interpolatedvar.cpp"
$File "IsNPCProxy.cpp"
@@ -534,7 +526,6 @@ $Project
"$SRCDIR\common\language.cpp" \
"$SRCDIR\public\networkvar.cpp" \
"$SRCDIR\common\randoverride.cpp" \
"$SRCDIR\common\steamid.cpp" \
"$SRCDIR\public\rope_physics.cpp" \
"$SRCDIR\public\scratchpad3d.cpp" \
"$SRCDIR\public\ScratchPadUtils.cpp" \
@@ -1256,9 +1247,17 @@ $Project
$Lib vtf
$ImpLib steam_api
$Lib $LIBCOMMON/libcrypto [$POSIX]
$ImpLib "$LIBCOMMON\curl" [$OSXALL]
$Lib "$LIBCOMMON\libcurl" [$WIN32]
$Lib "libz" [$WIN32]
$Libexternal libz [$LINUXALL]
$Libexternal "$LIBCOMMON/libcurl" [$LINUXALL]
$Libexternal "$LIBCOMMON/libcurlssl" [$LINUXALL]
$Libexternal "$LIBCOMMON/libssl" [$LINUXALL]
}
}
-186
View File
@@ -1,186 +0,0 @@
//-----------------------------------------------------------------------------
// CLIENT_ECON_BASE.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Include "$SRCDIR\gcsdk\gcsdk_game_include.vpc"
$Include "$SRCDIR\game\shared\base_gcmessages_include.vpc"
$Include "$SRCDIR\game\shared\econ_gcmessages_include.vpc"
$include "$SRCDIR\vpc_scripts\source_cryptlib_include.vpc"
$Configuration
{
$Compiler
{
$AdditionalIncludeDirectories "$BASE;$SRCDIR\game\shared\econ;$SRCDIR\gcsdk\steamextra;.\econ"
$PreprocessorDefinitions "$BASE;USES_ECON_ITEMS"
}
$Linker
{
$SystemLibraries "$BASE;z" [$OSXALL]
}
}
$Project
{
$Folder "Source Files"
{
$Folder "Economy"
{
$File "$SRCDIR\game\shared\econ\econ_item_view.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_view.h"
$File "$SRCDIR\game\shared\econ\econ_item_interface.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_interface.h"
$File "$SRCDIR\game\shared\econ\econ_item_description.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_description.h"
$File "$SRCDIR\game\shared\econ\econ_item_system.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_system.h"
$File "$SRCDIR\game\shared\econ\attribute_manager.cpp"
$File "$SRCDIR\game\shared\econ\attribute_manager.h"
$File "$SRCDIR\game\shared\econ\ihasattributes.h"
$File "$SRCDIR\game\shared\econ\econ_entity.cpp"
$File "$SRCDIR\game\shared\econ\econ_entity.h"
$File "$SRCDIR\game\shared\econ\econ_entity_creation.cpp"
$File "$SRCDIR\game\shared\econ\econ_entity_creation.h"
$File "$SRCDIR\game\shared\econ\econ_item_inventory.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_inventory.h"
$File "$SRCDIR\game\shared\econ\econ_gcmessages.h"
$File "$SRCDIR\game\shared\econ\econ_wearable.cpp"
$File "$SRCDIR\game\shared\econ\econ_wearable.h"
$File "$SRCDIR\game\shared\econ\econ_holidays.cpp"
$File "$SRCDIR\game\shared\econ\econ_holidays.h"
$File "$SRCDIR\game\shared\econ\econ_item.cpp"
$File "$SRCDIR\game\shared\econ\econ_item.h"
$File "$SRCDIR\game\shared\econ\econ_item_preset.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_preset.h"
$File "$SRCDIR\game\shared\econ\econ_item_constants.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_constants.h"
$File "$SRCDIR\game\shared\econ\econ_item_schema.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_schema.h"
$File "$SRCDIR\game\shared\econ\econ_item_tools.cpp"
$File "$SRCDIR\game\shared\econ\econ_item_tools.h"
$File "$SRCDIR\game\shared\econ\econ_store.cpp"
$File "$SRCDIR\game\shared\econ\econ_store.h"
$File "$SRCDIR\game\shared\econ\econ_storecategory.cpp"
$File "$SRCDIR\game\shared\econ\econ_storecategory.h"
$File "$SRCDIR\game\shared\econ\item_selection_criteria.cpp"
$File "$SRCDIR\game\shared\econ\item_selection_criteria.h"
$File "$SRCDIR\game\shared\econ\econ_dynamic_recipe.cpp"
$File "$SRCDIR\game\shared\econ\econ_dynamic_recipe.h"
$File "$SRCDIR\game\shared\econ\econ_quests.cpp"
$File "$SRCDIR\game\shared\econ\econ_quests.h"
$File "$SRCDIR\game\client\econ\econ_consumables.cpp"
$File "$SRCDIR\game\shared\gc_clientsystem.h"
$File "$SRCDIR\game\shared\gc_clientsystem.cpp"
$File "$SRCDIR\game\shared\gc_replicated_convars.cpp"
$File "$SRCDIR\game\shared\econ\localization_provider.cpp"
$File "$SRCDIR\game\shared\econ\localization_provider.h"
}
$Folder "Economy Client"
{
$File "econ\econ_ui.h"
$File "econ\backpack_panel.cpp"
$File "econ\backpack_panel.h"
$File "econ\base_loadout_panel.cpp"
$File "econ\base_loadout_panel.h"
$File "econ\trading_start_dialog.cpp"
$File "econ\trading_start_dialog.h"
$File "econ\iconrenderreceiver.h"
$File "econ\item_model_panel.cpp"
$File "econ\item_model_panel.h"
$File "econ\item_pickup_panel.cpp"
$File "econ\item_pickup_panel.h"
$File "econ\confirm_dialog.cpp"
$File "econ\confirm_dialog.h"
$File "econ\confirm_delete_dialog.cpp"
$File "econ\confirm_delete_dialog.h"
$File "econ\item_confirm_delete_dialog.cpp"
$File "econ\item_confirm_delete_dialog.h"
$File "econ\item_style_select_dialog.cpp"
$File "econ\item_style_select_dialog.h"
$File "econ\econ_controls.cpp"
$File "econ\econ_controls.h"
$File "econ\econ_notifications.cpp"
$File "econ\econ_notifications.h"
$File "econ\item_rental_ui.cpp"
$File "econ\item_rental_ui.h"
$File "econ\client_community_market.cpp"
$File "econ\client_community_market.h"
$File "econ\local_steam_shared_object_listener.cpp"
$File "econ\local_steam_shared_object_listener.h"
// Temp UI to allow you to test
$File "econ\econ_sample_rootui.cpp"
$File "econ\econ_sample_rootui.h"
$Folder "Trading"
{
$File "econ\econ_trading.cpp"
$File "econ\econ_trading.h"
}
$Folder "VGUI dependencies"
{
$File "game_controls\navigationpanel.cpp"
$File "game_controls\navigationpanel.h"
}
$Folder "Store"
{
$File "econ\store\store_page.cpp"
$File "econ\store\store_page.h"
$File "econ\store\store_page_new.cpp"
$File "econ\store\store_page_new.h"
$File "econ\store\store_panel.cpp"
$File "econ\store\store_panel.h"
$File "econ\store\store_preview_item.cpp"
$File "econ\store\store_preview_item.h"
$File "econ\store\store_viewcart.cpp"
$File "econ\store\store_viewcart.h"
}
$Folder "tool_items"
{
$File "econ\tool_items\tool_items.cpp"
$File "econ\tool_items\tool_items.h"
$File "econ\tool_items\rename_tool_ui.cpp"
$File "econ\tool_items\rename_tool_ui.h"
$File "econ\tool_items\decoder_ring_tool.cpp"
$File "econ\tool_items\decoder_ring_tool.h"
$File "econ\tool_items\paint_can_tool.cpp"
$File "econ\tool_items\paint_can_tool.h"
$File "econ\tool_items\custom_texture_cache.cpp"
$File "econ\tool_items\custom_texture_cache.h"
$File "econ\tool_items\custom_texture_tool.cpp"
$File "econ\tool_items\gift_wrap_tool.cpp"
$File "econ\tool_items\gift_wrap_tool.h"
}
}
// For item image stamping
$File "$SRCDIR\common\imageutils.h"
$File "$SRCDIR\common\imageutils.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Not Using Precompiled Headers"
}
}
}
}
$Folder "Link Libraries"
{
$Lib "$LIBCOMMON/libjpeg"
$Lib libpng [!$VS2015]
$Lib $LIBCOMMON/libpng [$VS2015]
$Lib libz
}
}
-115
View File
@@ -1,115 +0,0 @@
//-----------------------------------------------------------------------------
// CLIENT_LOSTCOAST.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro GAMENAME "lostcoast"
$Include "$SRCDIR\game\client\client_base.vpc"
$Configuration
{
$Compiler
{
$AdditionalIncludeDirectories "$BASE;hl2,.\hl2\elements,$SRCDIR\game\shared\hl2"
$PreprocessorDefinitions "$BASE;HL2_CLIENT_DLL;HL2_LOSTCOAST"
}
}
$Project "Client (LostCoast)"
{
$Folder "Source Files"
{
$File "hud_chat.cpp"
$File "c_team_objectiveresource.cpp"
$File "c_team_objectiveresource.h"
$Folder "HL2 DLL"
{
$File "$SRCDIR\game\shared\hl2\basehlcombatweapon_shared.cpp"
$File "$SRCDIR\game\shared\hl2\achievements_hl2.cpp"
$File "hl2\c_antlion_dust.cpp"
$File "hl2\c_ar2_explosion.cpp"
$File "hl2\c_barnacle.cpp"
$File "hl2\c_barney.cpp"
$File "hl2\c_basehelicopter.cpp"
$File "hl2\c_basehelicopter.h"
$File "hl2\c_basehlcombatweapon.cpp"
$File "hl2\c_basehlcombatweapon.h"
$File "hl2\c_basehlplayer.cpp"
$File "hl2\c_basehlplayer.h"
$File "hl2\c_citadel_effects.cpp"
$File "hl2\c_corpse.cpp"
$File "hl2\c_corpse.h"
$File "hl2\c_env_alyxtemp.cpp"
$File "hl2\c_env_headcrabcanister.cpp"
$File "hl2\c_env_starfield.cpp"
$File "hl2\c_func_tankmortar.cpp"
$File "hl2\c_hl2_playerlocaldata.cpp"
$File "hl2\c_hl2_playerlocaldata.h"
$File "hl2\c_info_teleporter_countdown.cpp"
$File "hl2\c_npc_antlionguard.cpp"
$File "hl2\c_npc_combinegunship.cpp"
$File "hl2\c_npc_manhack.cpp"
$File "hl2\c_npc_rollermine.cpp"
$File "hl2\c_plasma_beam_node.cpp"
$File "hl2\c_prop_combine_ball.cpp"
$File "hl2\c_prop_combine_ball.h"
$File "hl2\c_rotorwash.cpp"
$File "hl2\c_script_intro.cpp"
$File "$SRCDIR\game\shared\script_intro_shared.cpp"
$File "hl2\c_strider.cpp"
$File "hl2\c_te_concussiveexplosion.cpp"
$File "hl2\c_te_flare.cpp"
$File "hl2\c_thumper_dust.cpp"
$File "hl2\c_vehicle_airboat.cpp"
$File "hl2\c_vehicle_cannon.cpp"
$File "hl2\c_vehicle_crane.cpp"
$File "hl2\c_vehicle_crane.h"
$File "hl2\c_vehicle_prisoner_pod.cpp"
$File "hl2\c_weapon__stubs_hl2.cpp"
$File "hl2\c_weapon_crossbow.cpp"
$File "hl2\c_weapon_physcannon.cpp"
$File "hl2\c_weapon_stunstick.cpp"
$File "$SRCDIR\game\shared\hl2\citadel_effects_shared.h"
$File "hl2\clientmode_hlnormal.cpp"
$File "hl2\clientmode_hlnormal.h"
$File "death.cpp"
$File "$SRCDIR\game\shared\hl2\env_headcrabcanister_shared.cpp"
$File "$SRCDIR\game\shared\hl2\env_headcrabcanister_shared.h"
$File "hl2\fx_antlion.cpp"
$File "hl2\fx_bugbait.cpp"
$File "hl2\fx_hl2_impacts.cpp"
$File "hl2\fx_hl2_tracers.cpp"
$File "hl2\hl2_clientmode.cpp"
$File "$SRCDIR\game\shared\hl2\hl2_gamerules.cpp"
$File "$SRCDIR\game\shared\hl2\hl2_gamerules.h"
$File "$SRCDIR\game\shared\hl2\hl2_shareddefs.h"
$File "$SRCDIR\game\shared\hl2\hl2_usermessages.cpp"
$File "$SRCDIR\game\shared\hl2\hl_gamemovement.cpp"
$File "$SRCDIR\game\shared\hl2\hl_gamemovement.h"
$File "hl2\hl_in_main.cpp"
$File "hl2\hl_prediction.cpp"
$File "hl2\hud_ammo.cpp"
$File "hl2\hud_battery.cpp"
$File "hl2\hud_blood.cpp"
$File "hl2\hud_credits.cpp"
$File "hl2\hud_damageindicator.cpp"
$File "hl2\hud_flashlight.cpp"
$File "hl2\hud_health.cpp"
$File "hl2\hud_poisondamageindicator.cpp"
$File "hud_posture.cpp"
$File "hl2\hud_quickinfo.cpp"
$File "hud_squadstatus.cpp"
$File "hl2\hud_suitpower.cpp"
$File "hl2\hud_suitpower.h"
$File "hl2\hud_weaponselection.cpp"
$File "hl2\hud_zoom.cpp"
$File "hl2\shieldproxy.cpp"
$File "hl2\vgui_rootpanel_hl2.cpp"
$File "episodic\c_vort_charge_token.cpp"
}
}
}
-909
View File
@@ -1,909 +0,0 @@
//-----------------------------------------------------------------------------
// CLIENT_TF.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro GAMENAME "tf"
// This code currently only builds on Windows (itemtest_lib and dependencies)
$Macro WORKSHOP_IMPORT_ENABLE $WINDOWS
$Include "$SRCDIR\game\client\client_base.vpc"
$include "$SRCDIR\game\shared\tf\tf_gcmessages_include.vpc"
$Include "$SRCDIR\game\client\client_econ_base.vpc"
$Include "$SRCDIR\vpc_scripts\source_saxxyawards.vpc"
$Include "$SRCDIR\utils\itemtest_lib\itemtest_lib_support.vpc" [$WORKSHOP_IMPORT_ENABLE]
$Include "$SRCDIR\game\protobuf_include.vpc"
$Configuration
{
$Compiler
{
$AdditionalIncludeDirectories ".\hl2;.\hl2\elements;.\tf;.\tf\vgui;..\statemachine;$SRCDIR\game\shared\multiplayer;$SRCDIR\game\shared\tf;$SRCDIR\gcsdk\steamextra;$BASE;.\econ"
$PreprocessorDefinitions "$BASE;TF_CLIENT_DLL;USES_ECON_ITEMS;ENABLE_GC_MATCHMAKING;GLOWS_ENABLE;USE_DYNAMIC_ASSET_LOADING;SIXENSE;VOTING_ENABLED;NEXT_BOT"
$PreprocessorDefinitions "$BASE;SAXXYMAINMENU_ENABLED" [$SAXXYAWARDS_ENABLE]
$PreprocessorDefinitions "$BASE;WORKSHOP_IMPORT_ENABLED" [$WORKSHOP_IMPORT_ENABLE]
}
}
$Project "Client (TF)"
{
$Folder "Source Files"
{
-$File "$SRCDIR\game\shared\weapon_parse_default.cpp"
}
$Folder "Source Files"
{
$File "$SRCDIR\game\shared\basecombatweapon_shared.h"
$File "$SRCDIR\game\client\abuse_report.cpp"
$File "$SRCDIR\game\client\abuse_report.h"
$File "$SRCDIR\game\client\abuse_report_ui.cpp"
$File "$SRCDIR\game\client\abuse_report_ui.h"
$File "tf\tf_abuse_report.cpp"
$File "tf\tf_abuse_report.h"
$File "c_team_objectiveresource.cpp"
$File "c_team_objectiveresource.h"
$File "c_team_train_watcher.cpp"
$File "c_team_train_watcher.h"
$File "hud_base_account.cpp"
$File "hud_base_account.h"
$File "tf\hud_basedeathnotice.cpp"
$File "tf\hud_basedeathnotice.h"
$File "hud_controlpointicons.cpp"
$File "hud_voicestatus.cpp"
$File "hud_vguiscreencursor.cpp"
$File "hud_baseachievement_tracker.cpp"
$File "hud_baseachievement_tracker.h"
$File "$SRCDIR\game\client\hud_vote.h"
$File "$SRCDIR\game\client\hud_vote.cpp"
$File "$SRCDIR\game\shared\motd.cpp"
$File "$SRCDIR\game\shared\motd.h"
$File "$SRCDIR\game\shared\playerclass_info_parse.cpp"
$File "$SRCDIR\game\shared\playerclass_info_parse.h"
$File "$SRCDIR\game\shared\teamplay_round_timer.cpp"
$File "$SRCDIR\game\shared\teamplay_round_timer.h"
$File "$SRCDIR\common\ServerBrowser\blacklisted_server_manager.h"
$File "$SRCDIR\common\ServerBrowser\blacklisted_server_manager.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Not Using Precompiled Headers"
}
}
}
$File "TeamBitmapImage.cpp"
$File "voice_menu.cpp"
$File "$SRCDIR\common\GameUI\scriptobject.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Not Using Precompiled Headers"
}
}
}
$File "$SRCDIR\common\GameUI\scriptobject.h"
$File "$SRCDIR\common\GameUI\cvarslider.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Not Using Precompiled Headers"
}
}
}
$File "$SRCDIR\common\GameUI\cvarslider.h"
$Folder "Economy"
{
$File "$SRCDIR\game\shared\tf\tf_item_inventory.cpp"
$File "$SRCDIR\game\shared\tf\tf_item_inventory.h"
$File "$SRCDIR\game\shared\tf\tf_item_wearable.cpp"
$File "$SRCDIR\game\shared\tf\tf_item_wearable.h"
$File "$SRCDIR\game\shared\tf\tf_item_system.cpp"
$File "$SRCDIR\game\shared\tf\tf_item_system.h"
$File "$SRCDIR\game\shared\tf\tf_item_schema.cpp"
$File "$SRCDIR\game\shared\tf\tf_item_schema.h"
$File "$SRCDIR\game\shared\tf\tf_quest_editor_panel.h"
$File "$SRCDIR\game\shared\tf\tf_quest_editor_panel.cpp"
$File "$SRCDIR\game\shared\tf\tf_quest_restriction.h"
$File "$SRCDIR\game\shared\tf\tf_quest_restriction.cpp"
$File "$SRCDIR\game\shared\tf\tf_wardata.h"
$File "$SRCDIR\game\shared\tf\tf_wardata.cpp"
$File "$SRCDIR\game\shared\tf\tf_rating_data.h"
$File "$SRCDIR\game\shared\tf\tf_rating_data.cpp"
$File "$SRCDIR\game\shared\tf\tf_ladder_data.h"
$File "$SRCDIR\game\shared\tf\tf_ladder_data.cpp"
$File "$SRCDIR\game\shared\tf\tf_survey_questions.h"
$File "$SRCDIR\game\shared\tf\tf_survey_questions.cpp"
$File "$SRCDIR\game\shared\tf\tf_xp_source.h"
$File "$SRCDIR\game\shared\tf\tf_xp_source.cpp"
$File "$SRCDIR\game\shared\tf\tf_notification.h"
$File "$SRCDIR\game\shared\tf\tf_notification.cpp"
}
$Folder "Economy Client"
{
$File "econ\item_selection_panel.cpp"
$File "econ\item_selection_panel.h"
$Folder "Store"
{
$File "econ\store\store_page_halloween.cpp"
$File "econ\store\store_page_halloween.h"
}
}
$Folder "TF Economy Client Overrides"
{
$File "tf\vgui\tf_item_pickup_panel.cpp"
$File "tf\vgui\tf_item_pickup_panel.h"
$File "tf\vgui\store\tf_store.cpp"
$File "tf\vgui\store\tf_store.h"
$File "tf\vgui\store\tf_store_panel_base.h"
$File "tf\vgui\store\tf_store_panel_base.cpp"
$File "tf\vgui\store\tf_store_page_base.cpp"
$File "tf\vgui\store\tf_store_page_base.h"
$File "tf\vgui\store\tf_store_preview_item_base.cpp"
$File "tf\vgui\store\tf_store_preview_item_base.h"
$Folder "v1"
{
$File "tf\vgui\store\v1\tf_store_page.cpp"
$File "tf\vgui\store\v1\tf_store_page.h"
$File "tf\vgui\store\v1\tf_store_panel.cpp"
$File "tf\vgui\store\v1\tf_store_panel.h"
$File "tf\vgui\store\v1\tf_store_preview_item.cpp"
$File "tf\vgui\store\v1\tf_store_preview_item.h"
$File "tf\vgui\store\v1\tf_store_page_maps.cpp"
$File "tf\vgui\store\v1\tf_store_page_maps.h"
}
$Folder "v2"
{
$File "tf\vgui\store\v2\tf_store_page2.cpp"
$File "tf\vgui\store\v2\tf_store_page2.h"
$File "tf\vgui\store\v2\tf_store_panel2.cpp"
$File "tf\vgui\store\v2\tf_store_panel2.h"
$File "tf\vgui\store\v2\tf_store_preview_item2.cpp"
$File "tf\vgui\store\v2\tf_store_preview_item2.h"
$File "tf\vgui\store\v2\tf_store_page_maps2.cpp"
$File "tf\vgui\store\v2\tf_store_page_maps2.h"
$File "tf\vgui\store\v2\tf_store_mapstamps_info_dialog.cpp"
$File "tf\vgui\store\v2\tf_store_mapstamps_info_dialog.h"
}
}
$Folder "TF"
{
$File "$SRCDIR\game\shared\tf\tf_weapon_passtime_gun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_passtime_gun.h"
$File "$SRCDIR\game\shared\tf\passtime_game_events.cpp"
$File "$SRCDIR\game\shared\tf\passtime_game_events.h"
$File "$SRCDIR\game\shared\tf\passtime_convars.cpp"
$File "$SRCDIR\game\shared\tf\passtime_convars.h"
$File "tf\c_func_passtime_goal.cpp"
$File "tf\c_func_passtime_goal.h"
$File "tf\c_tf_passtime_ball.cpp"
$File "tf\c_tf_passtime_ball.h"
$File "tf\c_tf_passtime_logic.cpp"
$File "tf\c_tf_passtime_logic.h"
$File "tf\tf_hud_passtime.cpp"
$File "tf\tf_hud_passtime.h"
$File "tf\tf_hud_passtime_ball_offscreen_arrow.cpp"
$File "tf\tf_hud_passtime_ball_offscreen_arrow.h"
$File "tf\tf_hud_passtime_reticle.cpp"
$File "tf\tf_hud_passtime_reticle.h"
$File "tf\c_tf_glow.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf.h"
$File "$SRCDIR\game\shared\tf\achievements_tf_demoman.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_engineer.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_heavy.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_medic.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_pyro.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_scout.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_sniper.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_soldier.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_spy.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_replay.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_maps.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_mvm.cpp"
$File "$SRCDIR\game\shared\tf\achievements_tf_halloween.cpp"
$File "$SRCDIR\game\shared\tf\baseobject_shared.cpp"
$File "$SRCDIR\game\shared\tf\baseobject_shared.h"
$File "tf\tf_autorp.cpp"
$File "tf\tf_autorp.h"
$File "tf\c_baseobject.cpp"
$File "tf\c_baseobject.h"
$File "tf\c_entity_bird.cpp"
$File "tf\c_entity_currencypack.cpp"
$File "tf\c_entity_currencypack.h"
$File "tf\c_func_forcefield.cpp"
$File "tf\c_func_respawnroom.cpp"
$File "tf\c_func_capture_zone.cpp"
$File "tf\c_func_capture_zone.h"
$File "tf\c_obj_dispenser.cpp"
$File "tf\c_obj_dispenser.h"
$File "tf\c_obj_sapper.cpp"
$File "tf\c_obj_sapper.h"
$File "tf\c_obj_sentrygun.cpp"
$File "tf\c_obj_sentrygun.h"
$File "tf\c_obj_teleporter.cpp"
$File "tf\c_obj_teleporter.h"
$File "tf\c_tf_stickybolt.cpp"
$File "tf\c_tf_death_callingcard.cpp"
$File "tf\c_playerattachedmodel.cpp"
$File "tf\c_playerattachedmodel.h"
$File "tf\c_playerrelativemodel.cpp"
$File "tf\c_playerrelativemodel.h"
$File "tf\c_tf_ammo_pack.cpp"
$File "tf\c_tf_ammo_pack.h"
$File "tf\c_tf_buff_banner.cpp"
$File "tf\c_tf_buff_banner.h"
$File "tf\c_tf_fx.cpp"
$File "tf\c_tf_fx.h"
$File "tf\c_tf_haptics.cpp"
$File "tf\c_tf_haptics.h"
$File "tf\c_tf_objective_resource.cpp"
$File "tf\c_tf_objective_resource.h"
$File "tf\c_tf_player.cpp"
$File "tf\c_tf_player.h"
$File "tf\c_tf_playerclass.h"
$File "tf\c_tf_playerresource.cpp"
$File "tf\c_tf_playerresource.h"
$File "tf\c_tf_team.cpp"
$File "tf\c_tf_team.h"
$File "tf\clientmode_tf.cpp"
$File "tf\clientmode_tf.h"
$File "$SRCDIR\game\shared\tf\entity_capture_flag.cpp"
$File "$SRCDIR\game\shared\tf\entity_capture_flag.h"
$File "$SRCDIR\game\shared\Multiplayer\multiplayer_animstate.cpp"
$File "$SRCDIR\game\shared\Multiplayer\multiplayer_animstate.h"
$File "tf\teammaterialproxy.cpp"
$File "tf\tf_demo_support.cpp"
$File "tf\tf_demo_support.h"
$File "tf\tf_fx_blood.cpp"
$File "tf\tf_fx_christmaslights.cpp"
$File "tf\tf_fx_ejectbrass.cpp"
$File "tf\tf_fx_impacts.cpp"
$File "tf\tf_fx_explosions.cpp"
$File "tf\tf_fx_muzzleflash.cpp"
$File "tf\tf_fx_muzzleflash.h"
$File "tf\tf_fx_particleeffect.cpp"
$File "tf\tf_fx_taunteffects.cpp"
$File "$SRCDIR\game\shared\tf\tf_fx_shared.cpp"
$File "$SRCDIR\game\shared\tf\tf_fx_shared.h"
$File "tf\tf_fx_tracers.cpp"
$File "$SRCDIR\game\shared\tf\tf_gamemovement.cpp"
$File "$SRCDIR\game\shared\tf\tf_gamerules.cpp"
$File "$SRCDIR\game\shared\tf\tf_gamerules.h"
$File "$SRCDIR\game\shared\tf\tf_classdata.cpp"
$File "$SRCDIR\game\shared\tf\tf_classdata.h"
$File "tf\tf_hud_account.cpp"
$File "tf\tf_hud_achievement_tracker.cpp"
$File "tf\tf_hud_alert.cpp"
$File "tf\tf_hud_ammostatus.cpp"
$File "tf\tf_hud_ammostatus.h"
$File "tf\tf_hud_annotationspanel.cpp"
$File "tf\tf_hud_annotationspanel.h"
$File "tf\tf_hud_arena_capturepoint.cpp"
$File "tf\tf_hud_arena_class_layout.cpp"
$File "tf\tf_hud_arena_class_layout.h"
$File "tf\tf_hud_item_progress_tracker.h"
$File "tf\tf_hud_item_progress_tracker.cpp"
$File "tf\tf_hud_arena_notification.cpp"
$File "tf\tf_hud_arena_player_count.cpp"
$File "tf\tf_hud_arena_player_count.h"
$File "tf\tf_hud_arena_vs_panel.cpp"
$File "tf\tf_hud_arena_vs_panel.h"
$File "tf\tf_hud_arena_winpanel.cpp"
$File "tf\tf_hud_arena_winpanel.h"
$File "tf\tf_hud_bowcharge.cpp"
$File "$SRCDIR\game\shared\tf\entity_bonuspack.cpp"
$File "$SRCDIR\game\shared\tf\entity_bonuspack.h"
$File "$SRCDIR\game\shared\tf\entity_halloween_pickup.cpp"
$File "$SRCDIR\game\shared\tf\entity_halloween_pickup.h"
$File "tf\tf_hud_boss_health.cpp"
$File "tf\tf_hud_boss_health.h"
$File "tf\tf_hud_building_status.cpp"
$File "tf\tf_hud_building_status.h"
$File "tf\tf_hud_chat.cpp"
$File "tf\tf_hud_chat.h"
$File "tf\tf_hud_match_status.cpp"
$File "tf\tf_hud_match_status.h"
$File "tf\tf_hud_crosshair.cpp"
$File "tf\tf_hud_crosshair.h"
$File "tf\tf_hud_damageindicator.cpp"
$File "tf\tf_hud_demomancharge.cpp"
$File "tf\tf_hud_demomanpipes.cpp"
$File "tf\tf_hud_deathnotice.cpp"
$File "tf\tf_hud_disguise_status.cpp"
$File "tf\tf_hud_escort.cpp"
$File "tf\tf_hud_escort.h"
$File "tf\tf_hud_flagstatus.cpp"
$File "tf\tf_hud_flagstatus.h"
$File "tf\tf_hud_robot_destruction_status.cpp"
$File "tf\tf_hud_robot_destruction_status.h"
$File "tf\tf_hud_freezepanel.cpp"
$File "tf\tf_hud_freezepanel.h"
$File "tf\tf_hud_inspectpanel.cpp"
$File "tf\tf_hud_inspectpanel.h"
$File "tf\tf_hud_itemeffectmeter.cpp"
$File "tf\tf_hud_itemeffectmeter.h"
$File "tf\tf_hud_mediccallers.cpp"
$File "tf\tf_hud_mediccallers.h"
$File "tf\tf_hud_mediccharge.cpp"
$File "tf\tf_hud_base_build_menu.h"
$File "tf\tf_hud_menu_engy_build.cpp"
$File "tf\tf_hud_menu_engy_build.h"
$File "tf\tf_hud_menu_eureka_teleport.cpp"
$File "tf\tf_hud_menu_eureka_teleport.h"
$File "tf\tf_hud_menu_engy_destroy.cpp"
$File "tf\tf_hud_menu_engy_destroy.h"
$File "tf\tf_hud_menu_spy_build.cpp"
$File "tf\tf_hud_menu_spy_build.h"
$File "tf\tf_hud_menu_spy_disguise.cpp"
$File "tf\tf_hud_menu_spy_disguise.h"
$File "tf\tf_hud_menu_taunt_selection.cpp"
$File "tf\tf_hud_menu_taunt_selection.h"
$File "tf\tf_hud_notification_panel.cpp"
$File "tf\tf_hud_notification_panel.h"
$File "tf\tf_hud_objectivestatus.cpp"
$File "tf\tf_hud_objectivestatus.h"
$File "tf\tf_hud_playerstatus.cpp"
$File "tf\tf_hud_playerstatus.h"
$File "tf\tf_hud_pve_winpanel.cpp"
$File "tf\tf_hud_pve_winpanel.h"
$File "tf\tf_hud_sapper_charge.cpp"
$File "tf\tf_hud_scope.cpp"
$File "tf\tf_hud_stalemate.cpp"
$File "tf\tf_hud_tournament.cpp"
$File "tf\tf_hud_tournament.h"
$File "tf\tf_hud_statpanel.cpp"
$File "tf\tf_hud_statpanel.h"
$File "tf\tf_hud_mann_vs_machine_loss.cpp"
$File "tf\tf_hud_mann_vs_machine_loss.h"
$File "tf\tf_hud_mann_vs_machine_stats.cpp"
$File "tf\tf_hud_mann_vs_machine_stats.h"
$File "tf\tf_hud_mann_vs_machine_status.cpp"
$File "tf\tf_hud_mann_vs_machine_status.h"
$File "tf\tf_hud_mann_vs_machine_scoreboard.cpp"
$File "tf\tf_hud_mann_vs_machine_scoreboard.h"
$File "tf\tf_hud_mann_vs_machine_victory.cpp"
$File "tf\tf_hud_mann_vs_machine_victory.h"
$File "tf\tf_hud_disconnect_prompt.h"
$File "tf\tf_hud_disconnect_prompt.cpp"
$File "tf\tf_hud_training.cpp"
$File "tf\tf_hud_training.h"
$File "tf\c_tf_gamestats.cpp"
$File "tf\c_tf_gamestats.h"
$File "$SRCDIR\game\shared\tf\tf_gamestats_shared.h"
$File "tf\tf_hud_mainmenuoverride.cpp"
$File "tf\tf_hud_mainmenuoverride.h"
$File "tf\tf_hud_minigame.cpp"
$File "tf\tf_hud_minigame.h"
$File "tf\tf_hud_saxxycontest.cpp"
$File "tf\tf_hud_saxxycontest.h"
$File "tf\tf_hud_spectator_extras.cpp"
$File "tf\tf_hud_spectator_extras.h"
$File "tf\tf_hud_target_id.cpp"
$File "tf\tf_hud_target_id.h"
$File "tf\tf_hud_teamgoal.cpp"
$File "tf\tf_hud_teamgoal_tournament.cpp"
$File "tf\tf_hud_teamgoal_tournament.h"
$File "tf\tf_hud_teamswitch.cpp"
$File "tf\tf_hud_teamswitch.h"
$File "tf\tf_hud_trainingmessage.cpp"
$File "tf\tf_hud_training_complete.cpp"
$File "tf\tf_hud_waitingforplayers_panel.cpp"
$File "tf\tf_hud_weaponselection.cpp"
$File "tf\tf_hud_winpanel.cpp"
$File "tf\tf_hud_winpanel.h"
$File "tf\vgui\tf_imagepanel.cpp"
$File "tf\vgui\tf_imagepanel.h"
$File "tf\vgui\tf_item_card_panel.cpp"
$File "tf\vgui\tf_item_card_panel.h"
$File "tf\vgui\tf_item_inspection_panel.cpp"
$File "tf\vgui\tf_item_inspection_panel.h"
$File "tf\vgui\tf_particlepanel.cpp"
$File "tf\vgui\tf_particlepanel.h"
$File "tf\vgui\tf_ping_panel.cpp"
$File "tf\vgui\tf_ping_panel.h"
$File "tf\tf_input_main.cpp"
$File "tf\tf_presence.cpp"
$File "tf\tf_presence.h"
$File "tf\tf_proxyentity.cpp"
$File "tf\tf_proxyentity.h"
$File "tf\tf_proxyplayer.cpp"
$File "tf\tf_rendertargets.cpp"
$File "tf\tf_rendertargets.h"
$File "$SRCDIR\game\shared\tf\tf_revive.cpp"
$File "$SRCDIR\game\shared\tf\tf_revive.h"
$File "tf\tf_shared_content_manager.cpp"
$File "tf\tf_shared_content_manager.h"
$File "tf\tf_steamstats.cpp"
$File "tf\tf_steamstats.h"
$File "tf\tf_teamstatus.cpp"
$File "tf\tf_teamstatus.h"
$File "tf\tf_time_panel.cpp"
$File "tf\tf_time_panel.h"
$File "tf\tf_tips.cpp"
$File "tf\tf_tips.h"
$File "tf\tf_viewrender.cpp"
$File "tf\tf_viewrender.h"
$File "tf\tf_coaching.cpp"
$File "tf\tf_gameserver_management.cpp"
$File "tf\tf_consumables.cpp"
$File "$SRCDIR\game\shared\tf\tf_mapinfo.h"
$File "$SRCDIR\game\shared\tf\tf_mapinfo.cpp"
$File "tf\c_tf_halloween.cpp"
$File "tf\c_monster_resource.cpp"
$File "tf\c_monster_resource.h"
$File "tf\c_tf_freeaccount.h"
$File "tf\c_tf_freeaccount.cpp"
$File "tf\c_tf_mvm_boss_progress_user.h"
$File "tf\c_tf_mvm_boss_progress_user.cpp"
$File "tf\c_tf_notification.h"
$File "tf\c_tf_notification.cpp"
$File "tf\c_tf_taunt_prop.h"
$File "tf\c_tf_taunt_prop.cpp"
$File "$SRCDIR\game\shared\tf\quest_objective_trackers.cpp"
$File "$SRCDIR\game\shared\tf\quest_objective_manager.cpp"
$File "$SRCDIR\game\shared\tf\quest_objective_manager.h"
$File "$SRCDIR\game\shared\tf\shared_object_tracker.cpp"
$File "$SRCDIR\game\shared\tf\shared_object_tracker.h"
$File "$SRCDIR\game\shared\tf\tf_halloween_souls_pickup.cpp"
$File "$SRCDIR\game\shared\tf\tf_halloween_souls_pickup.h"
$File "$SRCDIR\game\shared\tf\tf_item.cpp"
$File "$SRCDIR\game\shared\tf\tf_item.h"
$File "$SRCDIR\game\shared\tf\tf_obj_baseupgrade_shared.cpp"
$File "$SRCDIR\game\shared\tf\tf_obj_baseupgrade_shared.h"
$File "$SRCDIR\game\shared\tf\tf_item_powerup_bottle.cpp"
$File "$SRCDIR\game\shared\tf\tf_item_powerup_bottle.h"
$File "$SRCDIR\game\shared\tf\tf_condition.cpp"
$File "$SRCDIR\game\shared\tf\tf_condition.h"
$File "$SRCDIR\game\shared\tf\tf_player_shared.cpp"
$File "$SRCDIR\game\shared\tf\tf_player_shared.h"
$File "$SRCDIR\game\shared\tf\tf_playeranimstate.cpp"
$File "$SRCDIR\game\shared\tf\tf_playeranimstate.h"
$File "$SRCDIR\game\shared\tf\tf_playerclass_info_parse.cpp"
$File "$SRCDIR\game\shared\tf\tf_playerclass_shared.cpp"
$File "$SRCDIR\game\shared\tf\tf_playerclass_shared.h"
$File "tf\tf_prediction.cpp"
$File "$SRCDIR\game\shared\tf\tf_projectile_base.cpp"
$File "$SRCDIR\game\shared\tf\tf_projectile_base.h"
$File "$SRCDIR\game\shared\tf\tf_projectile_nail.cpp"
$File "$SRCDIR\game\shared\tf\tf_projectile_nail.h"
$File "$SRCDIR\game\shared\tf\tf_shareddefs.cpp"
$File "$SRCDIR\game\shared\tf\tf_shareddefs.h"
$File "$SRCDIR\game\shared\tf\tf_duckleaderboard.cpp"
$File "$SRCDIR\game\shared\tf\tf_duckleaderboard.h"
$File "$SRCDIR\game\shared\tf\tf_usermessages.cpp"
$File "$SRCDIR\game\shared\tf\tf_viewmodel.cpp"
$File "$SRCDIR\game\shared\tf\tf_viewmodel.h"
$File "$SRCDIR\game\shared\tf\tf_generic_bomb.cpp"
$File "$SRCDIR\game\shared\tf\tf_generic_bomb.h"
$File "$SRCDIR\game\shared\tf\tf_pumpkin_bomb.cpp"
$File "$SRCDIR\game\shared\tf\tf_pumpkin_bomb.h"
//$File "$SRCDIR\game\shared\tf\tf_target_dummy.cpp"
//$File "$SRCDIR\game\shared\tf\tf_target_dummy.h"
$File "$SRCDIR\game\shared\tf\tf_item_constants.h"
$File "$SRCDIR\game\shared\steamworks_gamestats.cpp"
$File "$SRCDIR\game\shared\steamworks_gamestats.h"
$File "$SRCDIR\game\shared\tf\tf_logic_halloween_2014.h"
$File "$SRCDIR\game\shared\tf\tf_logic_halloween_2014.cpp"
$File "$SRCDIR\game\shared\tf\tf_logic_robot_destruction.cpp"
$File "$SRCDIR\game\shared\tf\tf_logic_robot_destruction.h"
$File "$SRCDIR\game\shared\tf\tf_robot_destruction_robot.cpp"
$File "$SRCDIR\game\shared\tf\tf_robot_destruction_robot.h"
$File "$SRCDIR\game\shared\tf\tf_logic_player_destruction.cpp"
$File "$SRCDIR\game\shared\tf\tf_logic_player_destruction.h"
$File "$SRCDIR\game\shared\tf\tf_gamestats_shared.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Not Using Precompiled Headers"
}
}
}
$Folder "Weapon"
{
$File "tf\c_tf_projectile_arrow.cpp"
$File "tf\c_tf_projectile_arrow.h"
$File "tf\c_tf_projectile_energy_ball.cpp"
$File "tf\c_tf_projectile_energy_ball.h"
$File "$SRCDIR\game\shared\tf\tf_projectile_energy_ring.cpp"
$File "$SRCDIR\game\shared\tf\tf_projectile_energy_ring.h"
$File "tf\c_tf_projectile_flare.cpp"
$File "tf\c_tf_projectile_flare.h"
$File "tf\c_tf_projectile_rocket.cpp"
$File "tf\c_tf_projectile_rocket.h"
$File "tf\c_tf_weapon_builder.cpp"
$File "tf\c_tf_weapon_builder.h"
$File "$SRCDIR\game\shared\tf\tf_dropped_weapon.cpp"
$File "$SRCDIR\game\shared\tf\tf_dropped_weapon.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_bat.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_bat.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_bonesaw.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_bonesaw.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_bottle.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_bottle.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_buff_item.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_buff_item.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_club.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_club.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_compound_bow.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_compound_bow.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_fireaxe.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_fireaxe.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_fists.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_fists.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_flamethrower.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_flamethrower.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_grapplinghook.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_grapplinghook.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_grenade_pipebomb.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_grenade_pipebomb.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_grenadelauncher.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_grenadelauncher.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_invis.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_invis.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_jar.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_jar.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_knife.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_knife.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_laser_pointer.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_laser_pointer.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_lunchbox.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_lunchbox.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_medigun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_medigun.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_minigun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_minigun.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_parse.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_parse.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_parachute.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_parachute.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_particle_cannon.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_particle_cannon.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_pda.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_pda.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_pipebomblauncher.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_pipebomblauncher.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_pistol.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_pistol.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_raygun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_raygun.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_revolver.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_revolver.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_rocketlauncher.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_rocketlauncher.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_shotgun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_shotgun.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_shovel.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_shovel.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_smg.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_smg.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_sniperrifle.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_sniperrifle.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_sword.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_sword.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_syringegun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_syringegun.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_throwable.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_throwable.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_wrench.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_wrench.h"
$File "$SRCDIR\game\shared\tf\tf_weaponbase.cpp"
$File "$SRCDIR\game\shared\tf\tf_weaponbase.h"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_grenadeproj.cpp"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_grenadeproj.h"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_merasmus_grenade.cpp"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_merasmus_grenade.h"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_gun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_gun.h"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_melee.cpp"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_melee.h"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_rocket.cpp"
$File "$SRCDIR\game\shared\tf\tf_weaponbase_rocket.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_flaregun.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_flaregun.h"
$File "$SRCDIR\game\shared\tf\tf_wearable_item_demoshield.cpp"
$File "$SRCDIR\game\shared\tf\tf_wearable_item_demoshield.h"
$File "$SRCDIR\game\shared\tf\tf_wearable_levelable_item.cpp"
$File "$SRCDIR\game\shared\tf\tf_wearable_levelable_item.h"
$File "$SRCDIR\game\shared\tf\tf_weapon_mechanical_arm.cpp"
$File "$SRCDIR\game\shared\tf\tf_weapon_mechanical_arm.h"
}
$Folder "Economy"
{
$File "$SRCDIR\game\shared\econ\econ_claimcode.cpp"
$File "$SRCDIR\game\shared\econ\econ_claimcode.h"
}
$Folder "Steam Workshop"
{
$File "$SRCDIR\game\shared\workshop\ugc_utils.h"
$File "$SRCDIR\game\shared\workshop\ugc_utils.cpp"
$File "$SRCDIR\game\client\steampublishedfiles\publish_file_dialog.h"
$File "$SRCDIR\game\client\steampublishedfiles\publish_file_dialog.cpp"
$File "$SRCDIR\game\client\tf\workshop\published_files.cpp"
$File "$SRCDIR\game\client\tf\workshop\item_import.h" [$WORKSHOP_IMPORT_ENABLE]
$File "$SRCDIR\game\client\tf\workshop\item_import.cpp" [$WORKSHOP_IMPORT_ENABLE]
$File "$SRCDIR\game\client\bsp_utils.cpp"
$File "$SRCDIR\game\client\bsp_utils.h"
}
$Folder "vgui"
{
$File "tf\vgui\backgroundpanel.cpp"
$File "tf\vgui\backgroundpanel.h"
$File "tf\vgui\blueprint_panel.cpp"
$File "tf\vgui\blueprint_panel.h"
$File "tf\vgui\crafting_panel.cpp"
$File "tf\vgui\crafting_panel.h"
$File "tf\vgui\character_info_panel.cpp"
$File "tf\vgui\character_info_panel.h"
$File "tf\vgui\charinfo_armory_subpanel.cpp"
$File "tf\vgui\charinfo_armory_subpanel.h"
$File "tf\vgui\charinfo_loadout_subpanel.cpp"
$File "tf\vgui\charinfo_loadout_subpanel.h"
$File "tf\vgui\class_loadout_panel.cpp"
$File "tf\vgui\class_loadout_panel.h"
$File "tf\vgui\dynamic_recipe_subpanel.cpp"
$File "tf\vgui\dynamic_recipe_subpanel.h"
$File "tf\vgui\drawing_panel.cpp"
$File "tf\vgui\drawing_panel.h"
$File "tf\vgui\crate_detail_panels.cpp"
$File "tf\vgui\crate_detail_panels.h"
$File "tf\vgui\quest_log_panel.cpp"
$File "tf\vgui\quest_log_panel.h"
$File "tf\vgui\quest_item_panel.cpp"
$File "tf\vgui\quest_item_panel.h"
$File "tf\vgui\quest_notification_panel.cpp"
$File "tf\vgui\quest_notification_panel.h"
$File "tf\vgui\item_ad_panel.cpp"
$File "tf\vgui\item_ad_panel.h"
$File "tf\vgui\item_quickswitch.cpp"
$File "tf\vgui\item_quickswitch.h"
$File "tf\vgui\item_slot_panel.cpp"
$File "tf\vgui\item_slot_panel.h"
$File "tf\vgui\loadout_preset_panel.cpp"
$File "tf\vgui\loadout_preset_panel.h"
$File "tf\vgui\tf_match_join_handlers.cpp"
$File "tf\vgui\tf_match_join_handlers.h"
$File "tf\vgui\tf_matchmaking_dashboard_new_match_found.cpp"
$File "tf\vgui\tf_matchmaking_dashboard_next_map_voting.cpp"
$File "tf\vgui\tf_matchmaking_dashboard_next_map_winner.cpp"
$File "tf\vgui\tf_matchmaking_dashboard.cpp"
$File "tf\vgui\tf_matchmaking_dashboard.h"
$File "tf\vgui\modelimagepanel.cpp"
$File "tf\vgui\modelimagepanel.h"
$File "tf\vgui\ObjectControlPanel.cpp"
$File "tf\vgui\ObjectControlPanel.h"
$File "tf\vgui\softline.cpp"
$File "tf\vgui\softline.h"
$File "tf\vgui\testitem_root.cpp"
$File "tf\vgui\testitem_root.h"
$File "tf\vgui\testitem_dialog.cpp"
$File "tf\vgui\testitem_dialog.h"
$File "tf\vgui\tf_badge_panel.cpp"
$File "tf\vgui\tf_badge_panel.h"
$File "tf\vgui\tf_classmenu.cpp"
$File "tf\vgui\tf_classmenu.h"
$File "tf\vgui\tf_clientscoreboard.cpp"
$File "tf\vgui\tf_clientscoreboard.h"
$File "tf\vgui\tf_controls.cpp"
$File "tf\vgui\tf_controls.h"
$File "tf\vgui\tf_giveawayitempanel.cpp"
$File "tf\vgui\tf_giveawayitempanel.h"
$File "tf\vgui\tf_mapinfomenu.cpp"
$File "tf\vgui\tf_mapinfomenu.h"
$File "tf\vgui\tf_playermodelpanel.cpp"
$File "tf\vgui\tf_playermodelpanel.h"
$File "tf\vgui\tf_intromenu.cpp"
$File "tf\vgui\tf_intromenu.h"
$File "tf\vgui\tf_match_summary.cpp"
$File "tf\vgui\tf_match_summary.h"
$File "tf\vgui\tf_roundinfo.cpp"
$File "tf\vgui\tf_roundinfo.h"
$File "tf\vgui\tf_spectatorgui.cpp"
$File "tf\vgui\tf_spectatorgui.h"
$File "tf\vgui\tf_playerpanel.cpp"
$File "tf\vgui\tf_playerpanel.h"
$File "tf\vgui\tf_teammenu.cpp"
$File "tf\vgui\tf_teammenu.h"
$File "tf\vgui\tf_arenateammenu.cpp"
$File "tf\vgui\tf_arenateammenu.h"
$File "tf\vgui\tf_statsummary.cpp"
$File "tf\vgui\tf_statsummary.h"
$File "tf\vgui\tf_textwindow.cpp"
$File "tf\vgui\tf_textwindow.h"
$File "tf\vgui\tf_viewport.cpp"
$File "tf\vgui\tf_viewport.h"
$File "tf\vgui\tf_vgui_video.cpp"
$File "tf\vgui\tf_vgui_video.h"
$File "tf\vgui\select_player_dialog.cpp"
$File "tf\vgui\select_player_dialog.h"
$File "tf\vgui\vgui_critpanel.cpp"
$File "tf\vgui\vgui_pda_panel.cpp"
$File "tf\vgui\vgui_rootpanel_tf.cpp"
$File "tf\vgui\vgui_rootpanel_tf.h"
$File "tf\vgui\vgui_rotation_slider.cpp"
$File "tf\vgui\vgui_rotation_slider.h"
$File "tf\vgui\tf_training_ui.cpp"
$File "tf\vgui\tf_mouseforwardingpanel.cpp"
$File "tf\vgui\tf_mouseforwardingpanel.h"
$File "tf\vgui\tf_lobbypanel.h"
$File "tf\vgui\tf_lobbypanel.cpp"
$File "tf\vgui\tf_lobbypanel_mvm.h"
$File "tf\vgui\tf_lobbypanel_mvm.cpp"
$File "tf\vgui\tf_lobbypanel_comp.h"
$File "tf\vgui\tf_lobbypanel_comp.cpp"
$File "tf\vgui\tf_lobbypanel_casual.h"
$File "tf\vgui\tf_lobbypanel_casual.cpp"
$File "tf\vgui\tf_lobby_container_frame.h"
$File "tf\vgui\tf_lobby_container_frame.cpp"
$File "tf\vgui\tf_lobby_container_frame_comp.h"
$File "tf\vgui\tf_lobby_container_frame_comp.cpp"
$File "tf\vgui\tf_lobby_container_frame_casual.h"
$File "tf\vgui\tf_lobby_container_frame_casual.cpp"
$File "tf\vgui\tf_lobby_container_frame_mvm.h"
$File "tf\vgui\tf_lobby_container_frame_mvm.cpp"
$File "tf\vgui\tf_layeredmappanel.cpp"
$File "tf\vgui\tf_layeredmappanel.h"
$File "tf\vgui\tf_pvp_rank_panel.h"
$File "tf\vgui\tf_pvp_rank_panel.cpp"
$File "tf\vgui\tf_warinfopanel.cpp"
$File "tf\vgui\tf_warinfopanel.h"
$File "tf\vgui\tf_asyncpanel.cpp"
$File "tf\vgui\tf_asyncpanel.h"
$File "tf\vgui\tf_leaderboardpanel.cpp"
$File "tf\vgui\tf_leaderboardpanel.h"
$File "tf\vgui\strange_count_transfer_panel.cpp"
$File "tf\vgui\strange_count_transfer_panel.h"
$File "tf\vgui\collection_crafting_panel.cpp"
$File "tf\vgui\collection_crafting_panel.h"
$File "tf\vgui\halloween_offering_panel.cpp"
$File "tf\vgui\halloween_offering_panel.h"
$File "tf\vgui\sc_hinticon.cpp"
$File "tf\vgui\sc_hinticon.h"
$File "tf\vgui\report_player_dialog.cpp"
$File "tf\vgui\report_player_dialog.h"
$File "tf\tf_streams.h"
$File "tf\tf_streams.cpp"
}
$Folder "halloween"
{
$File "tf\halloween\c_headless_hatman.cpp"
$File "tf\halloween\c_headless_hatman.h"
$File "tf\halloween\c_eyeball_boss.cpp"
$File "tf\halloween\c_eyeball_boss.h"
$File "tf\halloween\c_merasmus.cpp"
$File "tf\halloween\c_merasmus.h"
$File "tf\halloween\c_merasmus_dancer.cpp"
$File "tf\halloween\c_merasmus_dancer.h"
$File "tf\halloween\c_zombie.cpp"
$File "tf\halloween\c_zombie.h"
$File "$SRCDIR\game\shared\tf\halloween\eyeball_boss\teleport_vortex.cpp"
$File "$SRCDIR\game\shared\tf\halloween\eyeball_boss\teleport_vortex.h"
$File "$SRCDIR\game\shared\tf\halloween\tf_weapon_spellbook.cpp"
$File "$SRCDIR\game\shared\tf\halloween\tf_weapon_spellbook.h"
}
$Folder "Bot NPC"
{
$File "tf\bot_npc\c_bot_npc.cpp"
$File "tf\bot_npc\c_bot_npc.h"
$File "tf\bot_npc\c_bot_npc_minion.cpp"
$File "tf\bot_npc\c_bot_npc_minion.h"
$Folder "MapEntities"
{
$File "tf\bot_npc\map_entities\c_tf_bot_hint_engineer_nest.cpp"
$File "tf\bot_npc\map_entities\c_tf_bot_hint_engineer_nest.h"
}
}
$Folder "NextBot"
{
$File "NextBot\C_NextBot.cpp"
$File "NextBot\C_NextBot.h"
}
$Folder "PvE"
{
$File "tf\player_vs_environment\c_boss_alpha.cpp"
$File "tf\player_vs_environment\c_boss_alpha.h"
$File "tf\player_vs_environment\c_tf_base_boss.cpp"
$File "tf\player_vs_environment\c_tf_base_boss.h"
$File "tf\player_vs_environment\c_tf_tank_boss.cpp"
$File "tf\player_vs_environment\c_tf_tank_boss.h"
$File "tf\player_vs_environment\c_tf_upgrades.cpp"
$File "tf\player_vs_environment\c_tf_upgrades.h"
$File "$SRCDIR\game\shared\tf\tf_mann_vs_machine_stats.cpp"
$File "$SRCDIR\game\shared\tf\tf_mann_vs_machine_stats.h"
$File "$SRCDIR\game\shared\tf\tf_upgrades_shared.cpp"
$File "$SRCDIR\game\shared\tf\tf_upgrades_shared.h"
}
$Folder "Matchmaking"
{
$File "$SRCDIR\game\client\tf\tf_gc_client.cpp"
$File "$SRCDIR\game\client\tf\tf_gc_client.h"
$File "$SRCDIR\game\shared\party.cpp"
$File "$SRCDIR\game\shared\party.h"
$File "$SRCDIR\game\shared\playergroup.cpp"
$File "$SRCDIR\game\shared\playergroup.h"
$File "$SRCDIR\game\shared\lobby.cpp"
$File "$SRCDIR\game\shared\lobby.h"
$File "$SRCDIR\game\shared\tf\tf_party.cpp"
$File "$SRCDIR\game\shared\tf\tf_party.h"
// For now, clients are subscribed to the server lobby object. In the future we want to give clients a
// smaller subset, at which point we don't need this file (and the file should be moved shared->server)
$File "$SRCDIR\game\shared\tf\tf_lobby_server.cpp"
$File "$SRCDIR\game\shared\tf\tf_lobby_server.h"
$File "$SRCDIR\game\shared\tf\tf_matchmaking_shared.h"
$File "$SRCDIR\game\shared\tf\tf_matchmaking_shared.cpp"
$File "$SRCDIR\game\shared\tf\tf_match_description.cpp"
$File "$SRCDIR\game\shared\tf\tf_match_description.h"
$File "$SRCDIR\game\shared\tf\tf_gc_shared.h"
}
}
$Folder "game_controls"
{
$File "game_controls\buymenu.cpp"
$File "game_controls\buysubmenu.cpp"
$File "game_controls\classmenu.cpp"
}
$Folder "IFM"
{
$File "$SRCDIR\game\shared\weapon_ifmbase.cpp"
$File "$SRCDIR\game\shared\weapon_ifmbase.h"
$File "$SRCDIR\game\shared\weapon_ifmbasecamera.cpp"
$File "$SRCDIR\game\shared\weapon_ifmbasecamera.h"
$File "$SRCDIR\game\shared\weapon_ifmsteadycam.cpp"
}
$Folder "Replay"
{
$File "tf/tf_replay.cpp"
$File "tf/tf_replay.h"
}
}
$Folder "Useful non-source files" [!$ANALYZE && !$BUILDBOT]
{
$File "$SRCDIR\..\game\tf\scripts\HudAnimations_tf.txt"
$File "$SRCDIR\..\game\tf\resource\tf_english.txt"
$File "$SRCDIR\..\game\tf\resource\ModEvents.res"
$File "$SRCDIR\..\game\tf\resource\ClientScheme.res"
}
$Folder "Link libraries"
{
$ImplibExternal "steamnetworkingsockets"
}
}
+2 -4
View File
@@ -213,7 +213,6 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj )
Assert ( proj.m[3][2] == -1.0f );
Assert ( proj.m[3][3] == 0.0f );
/*
// The math here:
// A view-space vector (x,y,z,1) is transformed by the projection matrix
// / xscale 0 xoffset 0 \
@@ -228,7 +227,6 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj )
// = xscale*(x/z) + xoffset (I flipped the signs of both sides)
// => (+-1 - xoffset)/xscale = x/z
// ...and x/z is tan(theta), and theta is the half-FOV.
*/
float fov_px = 2.0f * RAD2DEG ( atanf ( fabsf ( ( 1.0f - xoffset ) / xscale ) ) );
float fov_nx = 2.0f * RAD2DEG ( atanf ( fabsf ( ( -1.0f - xoffset ) / xscale ) ) );
@@ -414,8 +412,8 @@ void CClientVirtualReality::DrawMainMenu()
// render both eyes
for( int nView = STEREO_EYE_LEFT; nView <= STEREO_EYE_RIGHT; nView++ )
{
CMatRenderContextPtr pRenderContextMat( materials );
PIXEvent pixEvent( pRenderContextMat, nView == STEREO_EYE_LEFT ? "left eye" : "right eye" );
CMatRenderContextPtr pRenderContext( materials );
PIXEvent pixEvent( pRenderContext, nView == STEREO_EYE_LEFT ? "left eye" : "right eye" );
ITexture *pColor = g_pSourceVR->GetRenderTarget( (ISourceVirtualReality::VREye)(nView-1), ISourceVirtualReality::RT_Color );
ITexture *pDepth = g_pSourceVR->GetRenderTarget( (ISourceVirtualReality::VREye)(nView-1), ISourceVirtualReality::RT_Depth );
+1 -69
View File
@@ -354,67 +354,6 @@ void CClientEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle )
}
#if defined( STAGING_ONLY )
// Defined in tier1 / interface.cpp for Windows and native for POSIX platforms.
extern "C" int backtrace( void **buffer, int size );
static struct
{
int entnum;
float time;
C_BaseEntity *pBaseEntity;
void *backtrace_addrs[ 16 ];
} g_RemoveEntityBacktraces[ 1024 ];
static uint32 g_RemoveEntityBacktracesIndex = 0;
static void OnRemoveEntityBacktraceHook( int entnum, C_BaseEntity *pBaseEntity )
{
int index = g_RemoveEntityBacktracesIndex++;
if ( g_RemoveEntityBacktracesIndex >= ARRAYSIZE( g_RemoveEntityBacktraces ) )
g_RemoveEntityBacktracesIndex = 0;
g_RemoveEntityBacktraces[ index ].entnum = entnum;
g_RemoveEntityBacktraces[ index ].time = gpGlobals->curtime;
g_RemoveEntityBacktraces[ index ].pBaseEntity = pBaseEntity;
memset( g_RemoveEntityBacktraces[ index ].backtrace_addrs, 0, sizeof( g_RemoveEntityBacktraces[ index ].backtrace_addrs ) );
backtrace( g_RemoveEntityBacktraces[ index ].backtrace_addrs, ARRAYSIZE( g_RemoveEntityBacktraces[ index ].backtrace_addrs ) );
}
// Should help us track down CL_PreserveExistingEntity Host_Error() issues:
// 1. Set cl_removeentity_backtrace_capture to 1.
// 2. When error hits, run "cl_removeentity_backtrace_dump [entnum]".
// 3. In debugger, track down what functions the spewed addresses refer to.
static ConVar cl_removeentity_backtrace_capture( "cl_removeentity_backtrace_capture", "0", 0,
"For debugging. Capture backtraces for CClientEntityList::OnRemoveEntity calls." );
CON_COMMAND( cl_removeentity_backtrace_dump, "Dump backtraces for client OnRemoveEntity calls." )
{
if ( !cl_removeentity_backtrace_capture.GetBool() )
{
Msg( "cl_removeentity_backtrace_dump error: cl_removeentity_backtrace_capture not enabled. Backtraces not captured.\n" );
return;
}
int entnum = ( args.ArgC() >= 2 ) ? atoi( args[ 1 ] ) : -1;
for ( int i = 0; i < ARRAYSIZE( g_RemoveEntityBacktraces ); i++ )
{
if ( g_RemoveEntityBacktraces[ i ].time &&
( entnum == -1 || g_RemoveEntityBacktraces[ i ].entnum == entnum ) )
{
Msg( "%d: time:%.2f pBaseEntity:%p\n", g_RemoveEntityBacktraces[i].entnum,
g_RemoveEntityBacktraces[ i ].time, g_RemoveEntityBacktraces[ i ].pBaseEntity );
for ( int j = 0; j < ARRAYSIZE( g_RemoveEntityBacktraces[ i ].backtrace_addrs ); j++ )
{
Msg( " %p\n", g_RemoveEntityBacktraces[ i ].backtrace_addrs[ j ] );
}
}
}
}
#endif // STAGING_ONLY
void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle )
{
@@ -441,13 +380,6 @@ void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle
C_BaseEntity *pBaseEntity = pUnknown->GetBaseEntity();
#if defined( STAGING_ONLY )
if ( cl_removeentity_backtrace_capture.GetBool() )
{
OnRemoveEntityBacktraceHook( entnum, pBaseEntity );
}
#endif // STAGING_ONLY
if ( pBaseEntity )
{
if ( pBaseEntity->ObjectCaps() & FCAP_SAVE_NON_NETWORKABLE )
@@ -570,4 +502,4 @@ C_BaseEntity* C_BaseEntityIterator::Next()
}
return NULL;
}
}
+15 -63
View File
@@ -132,7 +132,7 @@ public:
// methods of ISpatialLeafEnumerator
public:
bool EnumerateLeaf( int leaf, int context );
bool EnumerateLeaf( int leaf, intp context );
// Adds a shadow to a leaf
void AddShadowToLeaf( int leaf, ClientLeafShadowHandle_t handle );
@@ -189,12 +189,12 @@ private:
void RemoveShadowFromLeaves( ClientLeafShadowHandle_t handle );
// Methods associated with the various bi-directional sets
static unsigned int& FirstRenderableInLeaf( int leaf )
static unsigned short& FirstRenderableInLeaf( int leaf )
{
return s_ClientLeafSystem.m_Leaf[leaf].m_FirstElement;
}
static unsigned int& FirstLeafInRenderable( unsigned short renderable )
static unsigned short& FirstLeafInRenderable( unsigned short renderable )
{
return s_ClientLeafSystem.m_Renderables[renderable].m_LeafList;
}
@@ -248,8 +248,8 @@ private:
int m_RenderFrame2;
int m_EnumCount; // Have I been added to a particular shadow yet?
int m_TranslucencyCalculated;
unsigned int m_LeafList; // What leafs is it in?
unsigned int m_RenderLeaf; // What leaf do I render in?
unsigned short m_LeafList; // What leafs is it in?
unsigned short m_RenderLeaf; // What leaf do I render in?
unsigned char m_Flags; // rendering flags
unsigned char m_RenderGroup; // RenderGroup_t type
unsigned short m_FirstShadow; // The first shadow caster that cast on it
@@ -260,7 +260,7 @@ private:
// The leaf contains an index into a list of renderables
struct ClientLeaf_t
{
unsigned int m_FirstElement;
unsigned short m_FirstElement;
unsigned short m_FirstShadow;
unsigned short m_FirstDetailProp;
@@ -302,7 +302,7 @@ private:
CUtlLinkedList< ShadowInfo_t, ClientLeafShadowHandle_t, false, unsigned int > m_Shadows;
// Maintains the list of all renderables in a particular leaf
CBidirectionalSet< int, ClientRenderHandle_t, unsigned int, unsigned int > m_RenderablesInLeaf;
CBidirectionalSet< int, ClientRenderHandle_t, unsigned short, unsigned int > m_RenderablesInLeaf;
// Maintains a list of all shadows in a particular leaf
CBidirectionalSet< int, ClientLeafShadowHandle_t, unsigned short, unsigned int > m_ShadowsInLeaf;
@@ -343,8 +343,7 @@ void DefaultRenderBoundsWorldspace( IClientRenderable *pRenderable, Vector &absM
{
// Tracker 37433: This fixes a bug where if the stunstick is being wielded by a combine soldier, the fact that the stick was
// attached to the soldier's hand would move it such that it would get frustum culled near the edge of the screen.
IClientUnknown *pUnk = pRenderable->GetIClientUnknown();
C_BaseEntity *pEnt = pUnk->GetBaseEntity();
C_BaseEntity *pEnt = pRenderable->GetIClientUnknown()->GetBaseEntity();
if ( pEnt && pEnt->IsFollowingEntity() )
{
C_BaseEntity *pParent = pEnt->GetFollowedEntity();
@@ -630,7 +629,7 @@ void CClientLeafSystem::NewRenderable( IClientRenderable* pRenderable, RenderGro
info.m_Flags = flags;
info.m_RenderGroup = (unsigned char)type;
info.m_EnumCount = 0;
info.m_RenderLeaf = m_RenderablesInLeaf.InvalidIndex();
info.m_RenderLeaf = 0xFFFF;
if ( IsViewModelRenderGroup( (RenderGroup_t)info.m_RenderGroup ) )
{
AddToViewModelList( handle );
@@ -987,7 +986,7 @@ void CClientLeafSystem::AddShadowToLeaf( int leaf, ClientLeafShadowHandle_t shad
m_ShadowsInLeaf.AddElementToBucket( leaf, shadow );
// Add the shadow exactly once to all renderables in the leaf
unsigned int i = m_RenderablesInLeaf.FirstElement( leaf );
unsigned short i = m_RenderablesInLeaf.FirstElement( leaf );
while ( i != m_RenderablesInLeaf.InvalidIndex() )
{
ClientRenderHandle_t renderable = m_RenderablesInLeaf.Element(i);
@@ -1093,54 +1092,7 @@ void CClientLeafSystem::AddRenderableToLeaf( int leaf, ClientRenderHandle_t rend
#ifdef VALIDATE_CLIENT_LEAF_SYSTEM
m_RenderablesInLeaf.ValidateAddElementToBucket( leaf, renderable );
#endif
#ifdef DUMP_RENDERABLE_LEAFS
static uint32 count = 0;
if (count < m_RenderablesInLeaf.NumAllocated())
{
count = m_RenderablesInLeaf.NumAllocated();
Msg("********** frame: %d count:%u ***************\n", gpGlobals->framecount, count );
if (count >= 20000)
{
for (int j = 0; j < m_RenderablesInLeaf.NumAllocated(); j++)
{
const ClientRenderHandle_t& renderable = m_RenderablesInLeaf.Element(j);
RenderableInfo_t& info = m_Renderables[renderable];
char pTemp[256];
const char *pClassName = "<unknown renderable>";
C_BaseEntity *pEnt = info.m_pRenderable->GetIClientUnknown()->GetBaseEntity();
if ( pEnt )
{
pClassName = pEnt->GetClassname();
}
else
{
CNewParticleEffect *pEffect = dynamic_cast< CNewParticleEffect*>( info.m_pRenderable );
if ( pEffect )
{
Vector mins, maxs;
pEffect->GetRenderBounds(mins, maxs);
Q_snprintf( pTemp, sizeof(pTemp), "ps: %s %.2f,%.2f", pEffect->GetEffectName(), maxs.x - mins.x, maxs.y - mins.y );
pClassName = pTemp;
}
else if ( dynamic_cast< CParticleEffectBinding* >( info.m_pRenderable ) )
{
pClassName = "<old particle system>";
}
}
Msg(" %d: %p group:%d %s %d %d TransCalc:%d renderframe:%d\n", j, info.m_pRenderable, info.m_RenderGroup, pClassName,
info.m_LeafList, info.m_RenderLeaf, info.m_TranslucencyCalculated, info.m_RenderFrame);
}
DebuggerBreak();
}
}
#endif // DUMP_RENDERABLE_LEAFS
m_RenderablesInLeaf.AddElementToBucket(leaf, renderable);
m_RenderablesInLeaf.AddElementToBucket( leaf, renderable );
if ( !ShouldRenderableReceiveShadow( renderable, SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ) )
return;
@@ -1180,7 +1132,7 @@ void CClientLeafSystem::AddRenderableToLeaves( ClientRenderHandle_t handle, int
//-----------------------------------------------------------------------------
// Inserts an element into the tree
//-----------------------------------------------------------------------------
bool CClientLeafSystem::EnumerateLeaf( int leaf, int context )
bool CClientLeafSystem::EnumerateLeaf( int leaf, intp context )
{
EnumResultList_t *pList = (EnumResultList_t *)context;
if ( ThreadInMainThread() )
@@ -1216,7 +1168,7 @@ void CClientLeafSystem::InsertIntoTree( ClientRenderHandle_t &handle )
Assert( absMins.IsValid() && absMaxs.IsValid() );
ISpatialQuery* pQuery = engine->GetBSPTreeQuery();
pQuery->EnumerateLeavesInBox( absMins, absMaxs, this, (int)&list );
pQuery->EnumerateLeavesInBox( absMins, absMaxs, this, (intp)&list );
if ( list.pHead )
{
@@ -1392,7 +1344,7 @@ void CClientLeafSystem::ComputeTranslucentRenderLeaf( int count, const LeafIndex
orderedList.AddToTail( LeafToMarker( leaf ) );
// iterate over all elements in this leaf
unsigned int idx = m_RenderablesInLeaf.FirstElement(leaf);
unsigned short idx = m_RenderablesInLeaf.FirstElement(leaf);
while (idx != m_RenderablesInLeaf.InvalidIndex())
{
RenderableInfo_t& info = m_Renderables[m_RenderablesInLeaf.Element(idx)];
@@ -1560,7 +1512,7 @@ void CClientLeafSystem::CollateRenderablesInLeaf( int leaf, int worldListLeafInd
AddRenderableToRenderList( *info.m_pRenderList, NULL, worldListLeafIndex, RENDER_GROUP_OPAQUE_ENTITY, NULL );
// Collate everything.
unsigned int idx = m_RenderablesInLeaf.FirstElement(leaf);
unsigned short idx = m_RenderablesInLeaf.FirstElement(leaf);
for ( ;idx != m_RenderablesInLeaf.InvalidIndex(); idx = m_RenderablesInLeaf.NextElement(idx) )
{
ClientRenderHandle_t handle = m_RenderablesInLeaf.Element(idx);
+42 -158
View File
@@ -52,6 +52,7 @@
#include "replay/vgui/replaymessagepanel.h"
#include "econ/econ_controls.h"
#include "econ/confirm_dialog.h"
extern IClientReplayContext *g_pClientReplayContext;
extern ConVar replay_rendersetting_renderglow;
#endif
@@ -63,7 +64,6 @@ extern ConVar replay_rendersetting_renderglow;
#if defined( TF_CLIENT_DLL )
#include "c_tf_player.h"
#include "econ_item_description.h"
#include "c_tf_team.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
@@ -86,12 +86,6 @@ extern ConVar v_viewmodel_fov;
extern ConVar voice_modenable;
extern bool IsInCommentaryMode( void );
extern const char* GetWearLocalizationString( float flWear );
CON_COMMAND( cl_reload_localization_files, "Reloads all localization files" )
{
g_pVGuiLocalize->ReloadLocalizationFiles();
}
#ifdef VOICE_VOX_ENABLE
void VoxCallback( IConVar *var, const char *oldString, float oldFloat )
@@ -148,7 +142,19 @@ CON_COMMAND( hud_reloadscheme, "Reloads hud layout and animation scripts." )
if ( !mode )
return;
mode->ReloadScheme(true);
mode->ReloadScheme();
}
CON_COMMAND( messagemode, "Opens chat dialog" )
{
ClientModeShared *mode = ( ClientModeShared * )GetClientModeNormal();
mode->StartMessageMode( MM_SAY );
}
CON_COMMAND( messagemode2, "Opens chat dialog" )
{
ClientModeShared *mode = ( ClientModeShared * )GetClientModeNormal();
mode->StartMessageMode( MM_SAY_TEAM );
}
#ifdef _DEBUG
@@ -255,13 +261,6 @@ static void __MsgFunc_VGUIMenu( bf_read &msg )
{
gHUD.SetScreenShotTime( gpGlobals->curtime + 1.0 ); // take a screenshot in 1 second
}
IGameEvent *event = gameeventmanager->CreateEvent( "ds_screenshot" );
if ( event )
{
event->SetFloat( "delay", 0.5f );
gameeventmanager->FireEventClientSide( event );
}
}
// is the server trying to show an MOTD panel? Check that it's allowed right now.
@@ -306,17 +305,10 @@ ClientModeShared::~ClientModeShared()
delete m_pViewport;
}
void ClientModeShared::ReloadScheme( bool flushLowLevel )
void ClientModeShared::ReloadScheme( void )
{
// Invalidate the global cache first.
if (flushLowLevel)
{
KeyValuesSystem()->InvalidateCache();
}
BuildGroup::ClearResFileCache();
m_pViewport->ReloadScheme( "resource/ClientScheme.res" );
ClearKeyValuesCache();
}
@@ -356,7 +348,7 @@ void ClientModeShared::Init()
Assert( m_pReplayReminderPanel );
#endif
ListenForGameEvent( "player_connect_client" );
ListenForGameEvent( "player_connect" );
ListenForGameEvent( "player_disconnect" );
ListenForGameEvent( "player_team" );
ListenForGameEvent( "server_cvar" );
@@ -442,7 +434,7 @@ void ClientModeShared::OverrideView( CViewSetup *pSetup )
if( ::input->CAM_IsThirdPerson() )
{
const Vector& cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
Vector cam_ofs = g_ThirdPersonManager.GetCameraOffsetAngles();
Vector cam_ofs_distance = g_ThirdPersonManager.GetFinalCameraOffset();
cam_ofs_distance *= g_ThirdPersonManager.GetDistanceFraction();
@@ -491,17 +483,8 @@ bool ClientModeShared::ShouldDrawEntity(C_BaseEntity *pEnt)
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool ClientModeShared::ShouldDrawParticles( )
{
#ifdef TF_CLIENT_DLL
C_TFPlayer *pTFPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( pTFPlayer && !pTFPlayer->ShouldPlayerDrawParticles() )
return false;
#endif // TF_CLIENT_DLL
return true;
}
@@ -662,28 +645,6 @@ int ClientModeShared::KeyInput( int down, ButtonCode_t keynum, const char *pszCu
if ( engine->Con_IsVisible() )
return 1;
// Should we start typing a message?
if ( pszCurrentBinding &&
( Q_strcmp( pszCurrentBinding, "messagemode" ) == 0 ||
Q_strcmp( pszCurrentBinding, "say" ) == 0 ) )
{
if ( down )
{
StartMessageMode( MM_SAY );
}
return 0;
}
else if ( pszCurrentBinding &&
( Q_strcmp( pszCurrentBinding, "messagemode2" ) == 0 ||
Q_strcmp( pszCurrentBinding, "say_team" ) == 0 ) )
{
if ( down )
{
StartMessageMode( MM_SAY_TEAM );
}
return 0;
}
// If we're voting...
#ifdef VOTING_ENABLED
CHudVote *pHudVote = GET_HUDELEMENT( CHudVote );
@@ -888,7 +849,7 @@ void ClientModeShared::LevelShutdown( void )
void ClientModeShared::Enable()
{
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();;
// Add our viewport to the root panel.
if( pRoot != 0 )
@@ -915,7 +876,7 @@ void ClientModeShared::Enable()
void ClientModeShared::Disable()
{
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();
vgui::VPANEL pRoot = VGui_GetClientDLLRootPanel();;
// Remove our viewport from the root panel.
if( pRoot != 0 )
@@ -944,7 +905,7 @@ void ClientModeShared::Layout()
m_pViewport->SetBounds(0, 0, wide, tall);
if ( changed )
{
ReloadScheme(false);
ReloadScheme();
}
}
}
@@ -976,7 +937,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
const char *eventname = event->GetName();
if ( Q_strcmp( "player_connect_client", eventname ) == 0 )
if ( Q_strcmp( "player_connect", eventname ) == 0 )
{
if ( !hudChat )
return;
@@ -988,7 +949,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
wchar_t wszLocalized[100];
wchar_t wszPlayerName[MAX_PLAYER_NAME_LENGTH];
g_pVGuiLocalize->ConvertANSIToUnicode( event->GetString("name"), wszPlayerName, sizeof(wszPlayerName) );
g_pVGuiLocalize->ConstructString_safe( wszLocalized, g_pVGuiLocalize->Find( "#game_player_joined_game" ), 1, wszPlayerName );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_joined_game" ), 1, wszPlayerName );
char szLocalized[100];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalized, szLocalized, sizeof(szLocalized) );
@@ -1024,11 +985,11 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
wchar_t wszLocalized[100];
if (IsPC())
{
g_pVGuiLocalize->ConstructString_safe( wszLocalized, g_pVGuiLocalize->Find( "#game_player_left_game" ), 2, wszPlayerName, wszReason );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_left_game" ), 2, wszPlayerName, wszReason );
}
else
{
g_pVGuiLocalize->ConstructString_safe( wszLocalized, g_pVGuiLocalize->Find( "#game_player_left_game" ), 1, wszPlayerName );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_left_game" ), 1, wszPlayerName );
}
char szLocalized[100];
@@ -1061,12 +1022,6 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
wchar_t wszPlayerName[MAX_PLAYER_NAME_LENGTH];
g_pVGuiLocalize->ConvertANSIToUnicode( pszName, wszPlayerName, sizeof(wszPlayerName) );
bool bUsingCustomTeamName = false;
#ifdef TF_CLIENT_DLL
C_TFTeam *pTeam = GetGlobalTFTeam( team );
const wchar_t *wszTeam = pTeam ? pTeam->Get_Localized_Name() : L"";
bUsingCustomTeamName = pTeam ? pTeam->IsUsingCustomTeamName() : false;
#else
wchar_t wszTeam[64];
C_Team *pTeam = GetGlobalTeam( team );
if ( pTeam )
@@ -1077,18 +1032,17 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
{
_snwprintf ( wszTeam, sizeof( wszTeam ) / sizeof( wchar_t ), L"%d", team );
}
#endif
if ( !IsInCommentaryMode() )
{
wchar_t wszLocalized[100];
if ( bAutoTeamed )
{
g_pVGuiLocalize->ConstructString_safe( wszLocalized, bUsingCustomTeamName ? g_pVGuiLocalize->Find( "#game_player_joined_autoteam_party_leader" ) : g_pVGuiLocalize->Find( "#game_player_joined_autoteam" ), 2, wszPlayerName, wszTeam );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_joined_autoteam" ), 2, wszPlayerName, wszTeam );
}
else
{
g_pVGuiLocalize->ConstructString_safe( wszLocalized, bUsingCustomTeamName ? g_pVGuiLocalize->Find( "#game_player_joined_team_party_leader" ) : g_pVGuiLocalize->Find( "#game_player_joined_team" ), 2, wszPlayerName, wszTeam );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_joined_team" ), 2, wszPlayerName, wszTeam );
}
char szLocalized[100];
@@ -1120,7 +1074,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
g_pVGuiLocalize->ConvertANSIToUnicode( event->GetString( "newname" ), wszNewName, sizeof(wszNewName) );
wchar_t wszLocalized[100];
g_pVGuiLocalize->ConstructString_safe( wszLocalized, g_pVGuiLocalize->Find( "#game_player_changed_name" ), 2, wszOldName, wszNewName );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_player_changed_name" ), 2, wszOldName, wszNewName );
char szLocalized[100];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalized, szLocalized, sizeof(szLocalized) );
@@ -1134,14 +1088,16 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
bool bValidTeam = false;
if ( (GetLocalTeam() && GetLocalTeam()->GetTeamNumber() == team) )
{
bValidTeam = true;
}
//If we're in the spectator team then we should be getting whatever messages the person I'm spectating gets.
if ( bValidTeam == false )
{
CBasePlayer *pSpectatorTarget = UTIL_PlayerByIndex( GetSpectatorTarget() );
if ( pSpectatorTarget && (GetSpectatorMode() == OBS_MODE_IN_EYE || GetSpectatorMode() == OBS_MODE_CHASE || GetSpectatorMode() == OBS_MODE_POI) )
if ( pSpectatorTarget && (GetSpectatorMode() == OBS_MODE_IN_EYE || GetSpectatorMode() == OBS_MODE_CHASE) )
{
if ( pSpectatorTarget->GetTeamNumber() == team )
{
@@ -1177,7 +1133,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
g_pVGuiLocalize->ConvertANSIToUnicode( event->GetString("cvarvalue"), wszCvarValue, sizeof(wszCvarValue) );
wchar_t wszLocalized[256];
g_pVGuiLocalize->ConstructString_safe( wszLocalized, g_pVGuiLocalize->Find( "#game_server_cvar_changed" ), 2, wszCvarName, wszCvarValue );
g_pVGuiLocalize->ConstructString( wszLocalized, sizeof( wszLocalized ), g_pVGuiLocalize->Find( "#game_server_cvar_changed" ), 2, wszCvarName, wszCvarValue );
char szLocalized[256];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalized, szLocalized, sizeof(szLocalized) );
@@ -1226,7 +1182,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
if ( pchLocalizedAchievement )
{
wchar_t wszLocalizedString[128];
g_pVGuiLocalize->ConstructString_safe( wszLocalizedString, g_pVGuiLocalize->Find( "#Achievement_Earned" ), 2, wszPlayerName, pchLocalizedAchievement );
g_pVGuiLocalize->ConstructString( wszLocalizedString, sizeof( wszLocalizedString ), g_pVGuiLocalize->Find( "#Achievement_Earned" ), 2, wszPlayerName, pchLocalizedAchievement );
char szLocalized[128];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalizedString, szLocalized, sizeof( szLocalized ) );
@@ -1244,14 +1200,10 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
entityquality_t iItemQuality = event->GetInt( "quality" );
int iMethod = event->GetInt( "method" );
int iItemDef = event->GetInt( "itemdef" );
bool bIsStrange = event->GetInt( "isstrange" );
bool bIsUnusual = event->GetInt( "isunusual" );
float flWear = event->GetFloat( "wear" );
C_BasePlayer *pPlayer = UTIL_PlayerByIndex( iPlayerIndex );
const GameItemDefinition_t *pItemDefinition = dynamic_cast<GameItemDefinition_t *>( GetItemSchema()->GetItemDefinition( iItemDef ) );
if ( !pPlayer || !pItemDefinition || pItemDefinition->IsHidden() )
if ( !pPlayer || !pItemDefinition )
return;
if ( g_PR )
@@ -1271,85 +1223,19 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
_snwprintf( wszItemFound, ARRAYSIZE( wszItemFound ), L"%ls", g_pVGuiLocalize->Find( pszLocString ) );
wchar_t *colorMarker = wcsstr( wszItemFound, L"::" );
const CEconItemRarityDefinition* pItemRarity = GetItemSchema()->GetRarityDefinition( pItemDefinition->GetRarity() );
if ( colorMarker )
{
if ( pItemRarity )
{
const char *pszQualityColorString = EconQuality_GetColorString( (EEconItemQuality)iItemQuality );
if ( pszQualityColorString )
{
attrib_colors_t colorRarity = pItemRarity->GetAttribColor();
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( scheme );
Color color = pScheme->GetColor( GetColorNameForAttribColor( colorRarity ), Color( 255, 255, 255, 255 ) );
hudChat->SetCustomColor( color );
hudChat->SetCustomColor( pszQualityColorString );
*(colorMarker+1) = COLOR_CUSTOM;
}
else
{
const char *pszQualityColorString = EconQuality_GetColorString( (EEconItemQuality)iItemQuality );
if ( pszQualityColorString )
{
hudChat->SetCustomColor( pszQualityColorString );
}
}
*(colorMarker+1) = COLOR_CUSTOM;
}
// TODO: Update the localization strings to only have two format parameters since that's all we need.
locchar_t wszLocalizedString[256];
locchar_t szItemname[64] = LOCCHAR( "" );
locchar_t szRarity[64] = LOCCHAR( "" );
locchar_t szWear[64] = LOCCHAR( "" );
locchar_t szStrange[64] = LOCCHAR( "" );
locchar_t szUnusual[64] = LOCCHAR( "" );
loc_scpy_safe(
szItemname,
CConstructLocalizedString(g_pVGuiLocalize->Find("TFUI_InvTooltip_ItemFound_Itemname"),
CEconItemLocalizedFullNameGenerator(GLocalizationProvider(), pItemDefinition, iItemQuality).GetFullName() )
);
/*g_pVGuiLocalize->ConstructString_safe(
szItemname,
LOCCHAR( "%s1 " ),
1,
CEconItemLocalizedFullNameGenerator( GLocalizationProvider(), pItemDefinition, iItemQuality ).GetFullName()
);*/
locchar_t tempName[MAX_ITEM_NAME_LENGTH];
// If items have rarity
if ( pItemRarity )
{
// Weapon Wear
if ( !IsWearableSlot( pItemDefinition->GetDefaultLoadoutSlot() ) )
{
loc_scpy_safe(szWear, CConstructLocalizedString( g_pVGuiLocalize->Find("TFUI_InvTooltip_ItemFound_Wear"), g_pVGuiLocalize->Find(GetWearLocalizationString(flWear) ) ) );
}
// Rarity / grade
loc_scpy_safe(szRarity, CConstructLocalizedString(g_pVGuiLocalize->Find("TFUI_InvTooltip_ItemFound_Rarity"), g_pVGuiLocalize->Find(pItemRarity->GetLocKey() ) ) );
}
if ( bIsUnusual )
{
loc_scpy_safe(szUnusual, CConstructLocalizedString(g_pVGuiLocalize->Find("TFUI_InvTooltip_ItemFound_Unusual"), g_pVGuiLocalize->Find("rarity4")));
}
if ( bIsStrange )
{
loc_scpy_safe(szStrange, CConstructLocalizedString(g_pVGuiLocalize->Find("TFUI_InvTooltip_ItemFound_Strange"), g_pVGuiLocalize->Find("strange")));
}
// // Strange Unusual Item Grade
loc_scpy_safe( wszLocalizedString, CConstructLocalizedString( g_pVGuiLocalize->Find( "TFUI_InvTooltip_ItemFound" ), szStrange, szUnusual, szItemname, szRarity, szWear ) );
loc_scpy_safe( tempName, wszLocalizedString );
g_pVGuiLocalize->ConstructString_safe(
wszLocalizedString,
wszItemFound,
3,
wszPlayerName, tempName, L"" );
wchar_t wszLocalizedString[256];
g_pVGuiLocalize->ConstructString( wszLocalizedString, sizeof( wszLocalizedString ), wszItemFound, 3, wszPlayerName, CEconItemLocalizedFullNameGenerator( GLocalizationProvider(), pItemDefinition, iItemQuality ).GetFullName(), L"" );
char szLocalized[256];
g_pVGuiLocalize->ConvertUnicodeToANSI( wszLocalizedString, szLocalized, sizeof( szLocalized ) );
@@ -1482,7 +1368,7 @@ void ClientModeShared::DisplayReplayMessage( const char *pLocalizeName, float fl
void ClientModeShared::DisplayReplayReminder()
{
#if defined( REPLAY_ENABLED )
if ( m_pReplayReminderPanel && g_pReplay->IsRecording() && !::input->IsSteamControllerActive() )
if ( m_pReplayReminderPanel && g_pReplay->IsRecording() )
{
// Only display the panel if we haven't already requested a replay for the given life
CReplay *pCurLifeReplay = static_cast< CReplay * >( g_pClientReplayContext->GetReplayManager()->GetReplayForCurrentLife() );
@@ -1509,5 +1395,3 @@ void ClientModeShared::DeactivateInGameVGuiContext()
vgui::ivgui()->ActivateContext( DEFAULT_VGUI_CONTEXT );
}
+3 -9
View File
@@ -66,7 +66,7 @@ public:
virtual void Disable();
virtual void Layout();
virtual void ReloadScheme( bool flushLowLevel );
virtual void ReloadScheme( void );
virtual void OverrideView( CViewSetup *pSetup );
virtual bool ShouldDrawDetailObjects( );
virtual bool ShouldDrawEntity(C_BaseEntity *pEnt);
@@ -117,9 +117,9 @@ public:
//=============================================================================
virtual wchar_t* GetServerName() { return NULL; }
virtual void SetServerName(wchar_t* name) {}
virtual void SetServerName(wchar_t* name) {};
virtual wchar_t* GetMapName() { return NULL; }
virtual void SetMapName(wchar_t* name) {}
virtual void SetMapName(wchar_t* name) {};
//=============================================================================
// HPE_END
@@ -134,12 +134,6 @@ public:
virtual void InfoPanelDisplayed() OVERRIDE { }
virtual bool IsHTMLInfoPanelAllowed() OVERRIDE { return true; }
bool IsAnyPanelVisibleExceptScores() { return m_pViewport->IsAnyPanelVisibleExceptScores(); }
bool IsPanelVisible( const char* panel ) { return m_pViewport->IsPanelVisible( panel ); }
virtual void OnDemoRecordStart( char const* pDemoBaseName ) OVERRIDE {}
virtual void OnDemoRecordStop() OVERRIDE {}
protected:
CBaseViewport *m_pViewport;
+18 -26
View File
@@ -91,7 +91,7 @@ static ConVar r_flashlightmodels( "r_flashlightmodels", "1" );
static ConVar r_shadowrendertotexture( "r_shadowrendertotexture", "0" );
static ConVar r_flashlight_version2( "r_flashlight_version2", "0", FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY );
ConVar r_flashlightdepthtexture( "r_flashlightdepthtexture", "1", FCVAR_ALLOWED_IN_COMPETITIVE );
ConVar r_flashlightdepthtexture( "r_flashlightdepthtexture", "1" );
#if defined( _X360 )
ConVar r_flashlightdepthres( "r_flashlightdepthres", "512" );
@@ -1180,6 +1180,7 @@ CClientShadowMgr::CClientShadowMgr() :
//-----------------------------------------------------------------------------
CON_COMMAND_F( r_shadowdir, "Set shadow direction", FCVAR_CHEAT )
{
Vector dir;
if ( args.ArgC() == 1 )
{
Vector dir = s_ClientShadowMgr.GetShadowDirection();
@@ -1189,7 +1190,6 @@ CON_COMMAND_F( r_shadowdir, "Set shadow direction", FCVAR_CHEAT )
if ( args.ArgC() == 4 )
{
Vector dir;
dir.x = atof( args[1] );
dir.y = atof( args[2] );
dir.z = atof( args[3] );
@@ -1199,6 +1199,8 @@ CON_COMMAND_F( r_shadowdir, "Set shadow direction", FCVAR_CHEAT )
CON_COMMAND_F( r_shadowangles, "Set shadow angles", FCVAR_CHEAT )
{
Vector dir;
QAngle angles;
if (args.ArgC() == 1)
{
Vector dir = s_ClientShadowMgr.GetShadowDirection();
@@ -1210,8 +1212,6 @@ CON_COMMAND_F( r_shadowangles, "Set shadow angles", FCVAR_CHEAT )
if (args.ArgC() == 4)
{
Vector dir;
QAngle angles;
angles.x = atof( args[1] );
angles.y = atof( args[2] );
angles.z = atof( args[3] );
@@ -1802,9 +1802,6 @@ ClientShadowHandle_t CClientShadowMgr::CreateProjectedTexture( ClientEntityHandl
if( !( flags & SHADOW_FLAGS_FLASHLIGHT ) )
{
IClientRenderable *pRenderable = ClientEntityList().GetClientRenderableFromHandle( entity );
if ( !pRenderable )
return m_Shadows.InvalidIndex();
int modelType = modelinfo->GetModelType( pRenderable->GetModel() );
if (modelType == mod_brush)
{
@@ -2247,7 +2244,7 @@ inline ShadowType_t CClientShadowMgr::GetActualShadowCastType( IClientRenderable
class CShadowLeafEnum : public ISpatialLeafEnumerator
{
public:
bool EnumerateLeaf( int leaf, int context )
bool EnumerateLeaf( int leaf, intp context )
{
m_LeafList.AddToTail( leaf );
return true;
@@ -2387,10 +2384,7 @@ void CClientShadowMgr::BuildOrthoShadow( IClientRenderable* pRenderable,
// Visualization....
//-----------------------------------------------------------------------------
void CClientShadowMgr::DrawRenderToTextureDebugInfo( IClientRenderable* pRenderable, const Vector& mins, const Vector& maxs )
{
if ( !debugoverlay )
return;
{
// Get the object's basis
Vector vec[3];
AngleVectors( pRenderable->GetRenderAngles(), &vec[0], &vec[1], &vec[2] );
@@ -2572,11 +2566,8 @@ static void LineDrawHelper( const Vector &startShadowSpace, const Vector &endSha
Vector3DMultiplyPositionProjective( shadowToWorld, startShadowSpace, startWorldSpace );
Vector3DMultiplyPositionProjective( shadowToWorld, endShadowSpace, endWorldSpace );
if ( debugoverlay )
{
debugoverlay->AddLineOverlay( startWorldSpace + Vector( 0.0f, 0.0f, 1.0f ),
endWorldSpace + Vector( 0.0f, 0.0f, 1.0f ), r, g, b, false, -1 );
}
debugoverlay->AddLineOverlay( startWorldSpace + Vector( 0.0f, 0.0f, 1.0f ),
endWorldSpace + Vector( 0.0f, 0.0f, 1.0f ), r, g, b, false, -1 );
}
static void DebugDrawFrustum( const Vector &vOrigin, const VMatrix &matWorldToFlashlight )
@@ -2940,6 +2931,7 @@ void CClientShadowMgr::PreRender()
unsigned short i = m_DirtyShadows.FirstInorder();
while ( i != m_DirtyShadows.InvalidIndex() )
{
MDLCACHE_CRITICAL_SECTION();
ClientShadowHandle_t& handle = m_DirtyShadows[ i ];
Assert( m_Shadows.IsValidIndex( handle ) );
UpdateProjectedTextureInternal( handle, false );
@@ -2949,7 +2941,7 @@ void CClientShadowMgr::PreRender()
// Transparent shadows must remain dirty, since they were not re-projected
int nCount = m_TransparentShadows.Count();
for ( i = 0; i < nCount; ++i )
for ( int i = 0; i < nCount; ++i )
{
m_DirtyShadows.Insert( m_TransparentShadows[i] );
}
@@ -3179,9 +3171,9 @@ void CClientShadowMgr::UpdateProjectedTextureInternal( ClientShadowHandle_t hand
VPROF_BUDGET( "CClientShadowMgr::UpdateProjectedTextureInternal", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
Assert( ( shadow.m_Flags & SHADOW_FLAGS_SHADOW ) == 0 );
ClientShadow_t& shadowClient = m_Shadows[handle];
ClientShadow_t& shadow = m_Shadows[handle];
shadowmgr->EnableShadow( shadowClient.m_ShadowHandle, true );
shadowmgr->EnableShadow( shadow.m_ShadowHandle, true );
// FIXME: What's the difference between brush and model shadows for light projectors? Answer: nothing.
UpdateBrushShadow( NULL, handle );
@@ -3975,8 +3967,8 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup )
}
// Set depth bias factors specific to this flashlight
CMatRenderContextPtr pRenderContextMat( materials );
pRenderContextMat->SetShadowDepthBiasFactors( flashlightState.m_flShadowSlopeScaleDepthBias, flashlightState.m_flShadowDepthBias );
CMatRenderContextPtr pRenderContext( materials );
pRenderContext->SetShadowDepthBiasFactors( flashlightState.m_flShadowSlopeScaleDepthBias, flashlightState.m_flShadowDepthBias );
// Render to the shadow depth texture with appropriate view
view->UpdateShadowDepthTexture( m_DummyColorTexture, shadowDepthTexture, shadowView );
@@ -3998,7 +3990,7 @@ static void SetupBonesOnBaseAnimating( C_BaseAnimating *&pBaseAnimating )
}
void CClientShadowMgr::ComputeShadowTextures( const CViewSetup &viewShadow, int leafCount, LeafIndex_t* pLeafList )
void CClientShadowMgr::ComputeShadowTextures( const CViewSetup &view, int leafCount, LeafIndex_t* pLeafList )
{
VPROF_BUDGET( "CClientShadowMgr::ComputeShadowTextures", VPROF_BUDGETGROUP_SHADOW_RENDERING );
@@ -4009,7 +4001,7 @@ void CClientShadowMgr::ComputeShadowTextures( const CViewSetup &viewShadow, int
MDLCACHE_CRITICAL_SECTION();
// First grab all shadow textures we may want to render
int nCount = s_VisibleShadowList.FindShadows( &viewShadow, leafCount, pLeafList );
int nCount = s_VisibleShadowList.FindShadows( &view, leafCount, pLeafList );
if ( nCount == 0 )
return;
@@ -4225,7 +4217,7 @@ bool CShadowProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
void CShadowProxy::OnBind( void *pProxyData )
{
unsigned short clientShadowHandle = ( unsigned short )(int)pProxyData&0xffff;
unsigned short clientShadowHandle = ( unsigned short )(intp)pProxyData&0xffff;
ITexture* pTex = s_ClientShadowMgr.GetShadowTexture( clientShadowHandle );
m_BaseTextureVar->SetTextureValue( pTex );
if ( ToolsEnabled() )
@@ -4309,7 +4301,7 @@ bool CShadowModelProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
void CShadowModelProxy::OnBind( void *pProxyData )
{
unsigned short clientShadowHandle = ( unsigned short )((int)pProxyData&0xffff);
unsigned short clientShadowHandle = ( unsigned short )((intp)pProxyData&0xffff);
ITexture* pTex = s_ClientShadowMgr.GetShadowTexture( clientShadowHandle );
m_BaseTextureVar->SetTextureValue( pTex );
-27
View File
@@ -68,15 +68,6 @@ const char *CClientSideEffect::GetName( void )
return m_pszName;
}
//-----------------------------------------------------------------------------
// Purpose: Set the name of effect
// Input : const char
//-----------------------------------------------------------------------------
void CClientSideEffect::SetEffectName( const char *pszName )
{
m_pszName = pszName;
}
//-----------------------------------------------------------------------------
// Purpose: Is effect still active?
// Output : Returns true on success, false on failure.
@@ -108,7 +99,6 @@ public:
// Add an effect to the effects list
void AddEffect( CClientSideEffect *effect );
// Remove the specified effect
void RemoveEffect( CClientSideEffect *effect );
// Draw/update all effects in the current list
void DrawEffects( double frametime );
// Flush out all effects from the list
@@ -170,23 +160,6 @@ void CEffectsList::AddEffect( CClientSideEffect *effect )
m_rgEffects[ m_nEffects++ ] = effect;
}
//-----------------------------------------------------------------------------
void CEffectsList::RemoveEffect( CClientSideEffect *effect )
{
Assert( effect );
CClientSideEffect **end = &m_rgEffects[m_nEffects];
for( CClientSideEffect **p = &m_rgEffects[0]; p < end; ++p)
{
if ( *p == effect )
{
RemoveEffect( p - &m_rgEffects[0] ); // todo remove this crutch
return;
}
}
Assert( false ); // don't know this effect
}
//-----------------------------------------------------------------------------
// Purpose: Remove specified effect by index
// Input : effectIndex -
+1 -6
View File
@@ -32,10 +32,7 @@ public:
virtual bool IsActive( void );
// Sets the effect to inactive so it can be destroed
virtual void Destroy( void );
// Sets the effect name (useful for debugging).
virtual void SetEffectName( const char *pszName );
private:
// Name of effect ( static data )
const char *m_pszName;
@@ -53,8 +50,6 @@ public:
// Add an effect to the list of effects
virtual void AddEffect( CClientSideEffect *effect ) = 0;
// Remove the specified effect
virtual void RemoveEffect( CClientSideEffect *effect ) = 0;
// Simulate/Update/Draw effects on list
virtual void DrawEffects( double frametime ) = 0;
// Flush out all effects fbrom the list
-52
View File
@@ -20,9 +20,6 @@ CClientSteamContext::CClientSteamContext()
m_CallbackSteamServersDisconnected( this, &CClientSteamContext::OnSteamServersDisconnected ),
m_CallbackSteamServerConnectFailure( this, &CClientSteamContext::OnSteamServerConnectFailure ),
m_CallbackSteamServersConnected( this, &CClientSteamContext::OnSteamServersConnected )
#ifdef TF_CLIENT_DLL
, m_GameJoinRequested( this, &CClientSteamContext::OnGameJoinRequested )
#endif // TF_CLIENT_DLL
#endif
{
m_bActive = false;
@@ -113,55 +110,6 @@ void CClientSteamContext::OnSteamServersConnected( SteamServersConnected_t *pCon
UpdateLoggedOnState();
Msg( "CClientSteamContext OnSteamServersConnected logged on = %d\n", m_bLoggedOn );
}
#ifdef TF_CLIENT_DLL
void CClientSteamContext::OnGameJoinRequested( GameRichPresenceJoinRequested_t *pCallback )
{
if ( pCallback && pCallback->m_rgchConnect && ( pCallback->m_rgchConnect[0] == '+' ) )
{
char const *szConCommand = pCallback->m_rgchConnect + 1;
//
// Work around Steam Overlay bug that it doesn't replace %20 characters
//
CFmtStr fmtCommand;
if ( StringHasPrefix( szConCommand, "tf_econ_item_preview%20" ) )
{
fmtCommand.AppendFormat( "%s", szConCommand );
while ( char *pszReplace = strstr( fmtCommand.Access(), "%20" ) )
{
*pszReplace = ' ';
Q_memmove( pszReplace + 1, pszReplace + 3, Q_strlen( pszReplace + 3 ) + 1 );
}
szConCommand = fmtCommand.Access();
}
//
// End of Steam Overlay bug workaround
//
if ( char const *szItemId = StringAfterPrefix( szConCommand, "tf_econ_item_preview " ) )
{
Msg( "CClientSteamContext OnGameJoinRequested tf_econ_item_preview" );
bool bItemIdValid = ( pCallback->m_steamIDFriend.GetAccountID() == ~0u );
while ( *szItemId )
{
if ( ( ( *szItemId >= '0' ) && ( *szItemId <= '9' ) ) ||
( ( *szItemId >= 'A' ) && ( *szItemId <= 'S' ) ) )
++szItemId; // support new encoding for owner steamid and assetid
else
{
bItemIdValid = false;
break;
}
}
if ( bItemIdValid )
{
engine->ClientCmd( szConCommand );
}
}
}
}
#endif // TF_CLIENT_DLL
#endif // !defined(NO_STEAM)
void CClientSteamContext::InstallCallback( CUtlDelegate< void ( const SteamLoggedOnChange_t & ) > delegate )
-3
View File
@@ -27,9 +27,6 @@ public:
STEAM_CALLBACK( CClientSteamContext, OnSteamServersDisconnected, SteamServersDisconnected_t, m_CallbackSteamServersDisconnected );
STEAM_CALLBACK( CClientSteamContext, OnSteamServerConnectFailure, SteamServerConnectFailure_t, m_CallbackSteamServerConnectFailure );
STEAM_CALLBACK( CClientSteamContext, OnSteamServersConnected, SteamServersConnected_t, m_CallbackSteamServersConnected );
#ifdef TF_CLIENT_DLL
STEAM_CALLBACK( CClientSteamContext, OnGameJoinRequested, GameRichPresenceJoinRequested_t, m_GameJoinRequested );
#endif // TF_CLIENT_DLL
#endif
bool BLoggedOn() { return m_bLoggedOn; }
@@ -135,7 +135,7 @@ int BuyPresetListBox::computeVPixelsNeeded( void )
/**
* Adds an item to the end of the listbox. UserData is assumed to be a pointer that can be freed by the listbox if non-NULL.
*/
int BuyPresetListBox::AddItem( vgui::Panel *panel, void * userData )
int BuyPresetListBox::AddItem( vgui::Panel *panel, IBuyPresetListBoxUserData * userData )
{
assert(panel);
@@ -192,7 +192,7 @@ Panel * BuyPresetListBox::GetItemPanel(int index) const
/**
* Returns the userData in the given index, or NULL
*/
void * BuyPresetListBox::GetItemUserData(int index)
auto BuyPresetListBox::GetItemUserData(int index) -> IBuyPresetListBoxUserData *
{
if ( index < 0 || index >= m_items.Count() )
{
@@ -206,7 +206,7 @@ void * BuyPresetListBox::GetItemUserData(int index)
/**
* Sets the userData in the given index
*/
void BuyPresetListBox::SetItemUserData( int index, void * userData )
void BuyPresetListBox::SetItemUserData( int index, IBuyPresetListBoxUserData * userData )
{
if ( index < 0 || index >= m_items.Count() )
return;
+11 -4
View File
@@ -27,14 +27,21 @@ public:
BuyPresetListBox( vgui::Panel *parent, char const *panelName );
~BuyPresetListBox();
virtual int AddItem( vgui::Panel *panel, void * userData ); ///< Adds an item to the end of the listbox. UserData is assumed to be a pointer that can be freed by the listbox if non-NULL.
class IBuyPresetListBoxUserData
{
protected:
friend BuyPresetListBox;
virtual ~IBuyPresetListBoxUserData() {};
};
virtual int AddItem( vgui::Panel *panel, IBuyPresetListBoxUserData *userData ); ///< Adds an item to the end of the listbox. UserData is assumed to be a pointer that will be deleted by the listbox if non-NULL.
virtual int GetItemCount( void ) const; ///< Returns the number of items in the listbox
void SwapItems( int index1, int index2 ); ///< Exchanges two items in the listbox
void MakeItemVisible( int index ); ///< Try to ensure that the given index is visible
vgui::Panel * GetItemPanel( int index ) const; ///< Returns the panel in the given index, or NULL
void * GetItemUserData( int index ); ///< Returns the userData in the given index, or NULL
void SetItemUserData( int index, void * userData ); ///< Sets the userData in the given index
IBuyPresetListBoxUserData * GetItemUserData( int index ); ///< Returns the userData in the given index, or NULL
void SetItemUserData( int index, IBuyPresetListBoxUserData * userData ); ///< Sets the userData in the given index
virtual void RemoveItem( int index ); ///< Removes an item from the table (changing the indices of all following items), deleting the panel and userData
virtual void DeleteAllItems(); ///< clears the listbox, deleting all panels and userData
@@ -60,7 +67,7 @@ private:
typedef struct dataitem_s
{
vgui::Panel *panel;
void * userData;
IBuyPresetListBoxUserData * userData;
} DataItem;
CUtlVector< DataItem > m_items;
+1 -1
View File
@@ -93,7 +93,7 @@ public:
KeyValues *line = lines->GetFirstValue();
while ( line )
{
const char *str = line->GetString( NULL, "" );
const char *str = line->GetString( nullptr, "" );
Vector4D p;
int numPoints = sscanf( str, "%f %f %f %f", &p[0], &p[1], &p[2], &p[3] );
if ( numPoints == 4 )
+3 -3
View File
@@ -199,7 +199,7 @@ public:
int GetPlayerEntIndex() const;
IRagdoll* GetIRagdoll() const;
bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) OVERRIDE;
void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) OVERRIDE;
void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
@@ -265,12 +265,12 @@ C_CSRagdoll::~C_CSRagdoll()
PhysCleanupFrictionSounds( this );
}
bool C_CSRagdoll::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
void C_CSRagdoll::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt )
{
// otherwise use the death pose to set up the ragdoll
ForceSetupBonesAtTime( pDeltaBones0, gpGlobals->curtime - boneDt );
GetRagdollCurSequenceWithDeathPose( this, pDeltaBones1, gpGlobals->curtime, m_iDeathPose, m_iDeathFrame );
return SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
SetupBones( pCurrentBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
}
void C_CSRagdoll::Interp_Copy( C_BaseAnimatingOverlay *pSourceEntity )
+30 -9
View File
@@ -405,7 +405,7 @@ public:
void BeginTranslucentDetailRendering( );
// Method of ISpatialLeafEnumerator
bool EnumerateLeaf( int leaf, int context );
bool EnumerateLeaf( int leaf, intp context );
DetailPropLightstylesLump_t& DetailLighting( int i ) { return m_DetailLighting[i]; }
DetailPropSpriteDict_t& DetailSpriteDict( int i ) { return m_DetailSpriteDict[i]; }
@@ -464,7 +464,7 @@ private:
int SortSpritesBackToFront( int nLeaf, const Vector &viewOrigin, const Vector &viewForward, SortInfo_t *pSortInfo );
// For fast detail object insertion
IterationRetval_t EnumElement( int userId, int context );
IterationRetval_t EnumElement( int userId, intp context );
CUtlVector<DetailModelDict_t> m_DetailObjectDict;
CUtlVector<CDetailModel> m_DetailObjects;
@@ -1491,7 +1491,7 @@ void CDetailObjectSystem::LevelInitPreEntity()
}
int detailPropLightingLump;
if( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
if( g_pMaterialSystemHardwareConfig->GetHDREnabled() )
{
detailPropLightingLump = GAMELUMP_DETAIL_PROP_LIGHTING_HDR;
}
@@ -2322,7 +2322,7 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec
FastSpriteQuadBuildoutBufferNonSIMDView_t const *pquad = pQuadBuffer+nSIMDIdx;
// voodoo - since everything is in 4s, offset structure pointer by a couple of floats to handle sub-index
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (int) ( pquad ) )+ ( nSubIdx << 2 ) );
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (intp) ( pquad ) )+ ( nSubIdx << 2 ) );
uint8 const *pColorsCasted = reinterpret_cast<uint8 const *> ( pquad->m_Alpha );
uint8 color[4];
@@ -2331,7 +2331,16 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec
color[2] = pquad->m_RGBColor[0][2];
color[3] = pColorsCasted[MANTISSA_LSB_OFFSET];
DetailPropSpriteDict_t *pDict = pquad->m_pSpriteDefs[0];
DetailPropSpriteDict_t *pDict;
#ifdef PLATFORM_64BITS
if( nSubIdx == 1 )
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad+4))->m_pSpriteDefs[0];
else if( nSubIdx == 3 )
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad-4))->m_pSpriteDefs[0];
else
#endif
pDict = pquad->m_pSpriteDefs[0];
meshBuilder.Position3f( pquad->m_flX0[0], pquad->m_flY0[0], pquad->m_flZ0[0] );
meshBuilder.Color4ubv( color );
@@ -2545,6 +2554,7 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector
int nToDraw = MIN( nCount, nQuadsRemaining );
nCount -= nToDraw;
nQuadsRemaining -= nToDraw;
while( nToDraw-- )
{
// draw the sucker
@@ -2553,17 +2563,28 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector
FastSpriteQuadBuildoutBufferNonSIMDView_t const *pquad = pQuadBuffer+nSIMDIdx;
// voodoo - since everything is in 4s, offset structure pointer by a couple of floats to handle sub-index
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (int) ( pquad ) )+ ( nSubIdx << 2 ) );
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (intp) ( pquad ) )+ ( nSubIdx << 2 ) );
uint8 const *pColorsCasted = reinterpret_cast<uint8 const *> ( pquad->m_Alpha );
uint8 color[4];
color[0] = pquad->m_RGBColor[0][0];
color[1] = pquad->m_RGBColor[0][1];
color[2] = pquad->m_RGBColor[0][2];
color[3] = pColorsCasted[MANTISSA_LSB_OFFSET];
DetailPropSpriteDict_t *pDict = pquad->m_pSpriteDefs[0];
DetailPropSpriteDict_t *pDict;
#ifdef PLATFORM_64BITS
if( nSubIdx == 1 )
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad+4))->m_pSpriteDefs[0];
else if( nSubIdx == 3 )
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad-4))->m_pSpriteDefs[0];
else
#endif
pDict = pquad->m_pSpriteDefs[0];
meshBuilder.Position3f( pquad->m_flX0[0], pquad->m_flY0[0], pquad->m_flZ0[0] );
meshBuilder.Color4ubv( color );
@@ -2707,7 +2728,7 @@ void CDetailObjectSystem::RenderTranslucentDetailObjectsInLeaf( const Vector &vi
//-----------------------------------------------------------------------------
// Gets called each view
//-----------------------------------------------------------------------------
bool CDetailObjectSystem::EnumerateLeaf( int leaf, int context )
bool CDetailObjectSystem::EnumerateLeaf( int leaf, intp context )
{
VPROF_BUDGET( "CDetailObjectSystem::EnumerateLeaf", VPROF_BUDGETGROUP_DETAILPROP_RENDERING );
Vector v;
@@ -2806,6 +2827,6 @@ void CDetailObjectSystem::BuildDetailObjectRenderLists( const Vector &vViewOrigi
ISpatialQuery* pQuery = engine->GetBSPTreeQuery();
pQuery->EnumerateLeavesInSphere( CurrentViewOrigin(),
cl_detaildist.GetFloat(), this, (int)&ctx );
cl_detaildist.GetFloat(), this, (intp)&ctx );
}
File diff suppressed because it is too large Load Diff
-268
View File
@@ -1,268 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef BACKPACK_PANEL_H
#define BACKPACK_PANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "base_loadout_panel.h"
#include "tf_item_inspection_panel.h"
#define BACKPACK_SLOTS_PER_PAGE 50
#define BACKPACK_ROWS 5
#define BACKPACK_COLUMNS (BACKPACK_SLOTS_PER_PAGE / BACKPACK_ROWS)
#define BACKPACK_MAX_PAGES (MAX_NUM_BACKPACK_SLOTS / BACKPACK_SLOTS_PER_PAGE)
class CDynamicRecipePanel;
class CItemSlotPanel;
class CStrangeCountTransferPanel;
class CCollectionCraftingPanel;
class CHalloweenOfferingPanel;
class CCraftCommonStatClockPanel;
class CTFStorePreviewItemPanel2;
//-----------------------------------------------------------------------------
// An inventory screen that handles displaying the backpack
//-----------------------------------------------------------------------------
class CBackpackPanel : public CBaseLoadoutPanel
{
DECLARE_CLASS_SIMPLE( CBackpackPanel, CBaseLoadoutPanel );
public:
CBackpackPanel( vgui::Panel *parent, const char *panelName );
virtual ~CBackpackPanel();
virtual const char *GetResFile( void ) { return "Resource/UI/econ/BackpackPanel.res"; }
virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
virtual void ApplySettings( KeyValues *inResourceData ) OVERRIDE;
virtual void PerformLayout( void ) OVERRIDE;
virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;
virtual void UpdateModelPanels( void );
virtual int GetNumItemPanels( void ) { return BACKPACK_SLOTS_PER_PAGE; };
virtual void OnShowPanel( bool bVisible, bool bReturningFromArmory );
virtual void PostShowPanel( bool bVisible );
virtual bool UsesRarityControls( void ) { return true; }
virtual bool AllowSelection( void ) { return true; }
virtual bool AllowDragging( CItemModelPanel *panel ) { return true; }
virtual int GetNumSlotsPerPage( void ) OVERRIDE { return BACKPACK_SLOTS_PER_PAGE; }
virtual int GetNumColumns( void ) OVERRIDE { return BACKPACK_COLUMNS; }
virtual int GetNumRows( void ) OVERRIDE { return BACKPACK_ROWS; }
virtual int GetNumPages( void ) OVERRIDE;
virtual void SetCurrentPage( int nNewPage ) OVERRIDE;
virtual void AssignItemToPanel( CItemModelPanel *pPanel, int iIndex );
virtual void OnItemPanelEntered( vgui::Panel *panel ) OVERRIDE;
virtual void OpenContextMenu();
MESSAGE_FUNC_PTR( OnItemPanelMousePressed, "ItemPanelMousePressed", panel );
MESSAGE_FUNC_PTR( OnItemPanelMouseReleased, "ItemPanelMouseReleased", panel );
MESSAGE_FUNC_PTR( OnItemPanelMouseRightRelease, "ItemPanelMouseRightRelease", panel );
MESSAGE_FUNC_INT_INT( OnCursorMoved, "OnCursorMoved", x, y );
MESSAGE_FUNC_INT_INT( OnItemPanelCursorMoved, "ItemPanelCursorMoved", x, y );
MESSAGE_FUNC_PARAMS( OnConfirmDelete, "ConfirmDlgResult", data );
MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", data );
MESSAGE_FUNC_PARAMS( OnButtonChecked, "CheckButtonChecked", pData );
MESSAGE_FUNC( OnCancelSelection, "CancelSelection" );
MESSAGE_FUNC( DoTradeToPlayer, "DoTradeToPlayer" );
MESSAGE_FUNC( DoSellMarketplace, "DoSellMarketplace" );
MESSAGE_FUNC( DoDescription, "DoDescription" );
MESSAGE_FUNC( DoRename, "DoRename" );
MESSAGE_FUNC( DoDelete, "DoDelete" );
MESSAGE_FUNC( DoApplyOnItem, "Context_ApplyOnItem" );
MESSAGE_FUNC( DoUseConsumableItem, "Context_UseConsumableItem" );
MESSAGE_FUNC( DoUnwrapItem, "Context_UnwrapItem" );
MESSAGE_FUNC( DoDeliverItem, "Context_DeliverItem" );
MESSAGE_FUNC( DoApplyByItem, "Context_ApplyByItem" );
MESSAGE_FUNC( DoShuffle, "Context_Shuffle" );
MESSAGE_FUNC( DoEditSlot, "Context_EditSlot" );
MESSAGE_FUNC( DoRefurbishItem, "Context_RefurbishItem" );
MESSAGE_FUNC( DoGetItemFromStore, "Context_GetItemFromStore" );
MESSAGE_FUNC( DoOpenDuckLeaderboards, "Context_OpenDuckLeaderboards" );
MESSAGE_FUNC( DoInspectModel, "Context_InspectModel" );
MESSAGE_FUNC( DoBuyKeyAndOpenCrate, "Context_BuyKeyAndOpenCrate" );
MESSAGE_FUNC( DoOpenCrateWithKey, "Context_OpenCrateWithKey" );
MESSAGE_FUNC( DoStrangeCountTransfer, "Context_OpenStrangeCountTransfer" );
MESSAGE_FUNC( DoCraftUpCollection, "Context_CraftUpCollection" );
MESSAGE_FUNC( DoHalloweenOffering, "Context_HalloweenOffering" );
MESSAGE_FUNC( DoCraftCommonStatClock, "Context_CraftCommonStatClock" );
void DoEquipForClass( int nClass );
void DoPaint( int nPaintItemIndex, bool bUseStore, bool bUseMarket );
void DoStrangePart( int nStrangePartIndex, bool bUseMarket );
enum ESelection
{
SELECT_FIRST,
SELECT_ALL
};
bool AttemptToUseItem( item_definition_index_t iItemDefIndex );
void AttemptToShowItemInStore( item_definition_index_t iItemDefIndex );
void AttemptToShowItemInMarket( item_definition_index_t iItemDefIndex );
void GetSelectedPanels( ESelection eSelection, CUtlVector< CItemModelPanel* >& m_vecSelected ) const;
virtual void OnCommand( const char *command );
virtual void OnTick( void );
virtual void OnThink( void );
virtual void OnKeyCodePressed( vgui::KeyCode code ) OVERRIDE;
virtual void OnKeyCodeReleased( vgui::KeyCode code ) OVERRIDE;
virtual void OnKeyCodeTyped(vgui::KeyCode code) OVERRIDE;
virtual void OnMouseReleased(vgui::MouseCode code) OVERRIDE;
virtual void OnMouseMismatchedRelease( vgui::MouseCode code, Panel* pPressedPanel ) OVERRIDE;
virtual void OnMouseCaptureLost() OVERRIDE;
void OnItemContentsChanged( CEconItemView *pEconItemView );
virtual void OpenArmory( CEconItemView* item );
void ToggleSelectBackpackItemPanel( CItemModelPanel *pPanel );
void DeSelectAllBackpackItemPanels( void );
CEconItemView* GetComboBoxOverlayUISeletionItem() { return &m_ComboBoxOverlaySelectionItem; }
void SetComboBoxOverlaySelectionItem( const CEconItemView *pEconItemView ) { m_ComboBoxOverlaySelectionItem = *pEconItemView; }
void SetCurrentTransactionID( uint64 nTxnID );
void CheckForQuickOpenKey();
void MarkItemIDDirty( itemid_t itemID );
void OpenInspectModelPanelAndCopyItem( CEconItemView *pItemView );
CCollectionCraftingPanel *GetCollectionCraftPanel();
protected:
virtual void StartDrag( int x, int y );
virtual void StopDrag( bool bSucceeded );
virtual bool CanDragTo( CItemModelPanel *pItemPanel, int iPanelIndex ) { return true; }
virtual void HandleDragTo( CItemModelPanel *pItemPanel, int iPanelIndex );
virtual int GetBackpackPosForPanelIndex( int iPanelIndex ) { return iPanelIndex + 1 + (GetCurrentPage() * GetNumSlotsPerPage()); }
virtual bool NeedsDerivedTickSignal( void ) { return false; }
int GetBackpackPositionForPanel( CItemModelPanel *pItemPanel );
virtual const char *GetGreyOutItemPanelReason( CItemModelPanel *pItemPanel );
virtual void SetBorderForItem( CItemModelPanel *pItemPanel, bool bMouseOver );
virtual bool IsIgnoringItemPanelEnters( void ) { return m_bDragging; }
virtual void AddNewItemPanel( int iPanelIndex );
virtual CItemModelPanel *GetItemPanelAtPos( int x, int y );
virtual void PositionItemPanel( CItemModelPanel *pPanel, int iIndex );
void CancelToolSelection( void );
void SetShowBaseItems( bool bShow );
virtual ConVar *GetExplanationConVar( void );
bool ShouldShowExplanations( void ) { return (!m_bItemsOnly && !InToolSelectionMode()); }
bool InToolSelectionMode() const { return m_eSelectionMode != StandardSelection; }
void SetupToolSelectionItem();
void HandleToolItemSelection( CEconItemView *pItem );
void ClearNameFilter( bool bUpdateModelPanels );
bool HasNameFilter() const { return m_wNameFilter.Count() > 0; }
const wchar_t* GetNameFilter() const { return HasNameFilter() ? m_wNameFilter.Base() : NULL; }
void UpdateFilteringItems();
int GetItemQualityForBorder( CItemModelPanel* pItemPanel ) const;
int GetNumMaxPages() const { return BACKPACK_MAX_PAGES; }
int GetPageButtonIndexAtPos( int x, int y );
void SetPageButtonTextColorBasedOnContents();
void AddPaintToContextMenu( Menu *pPaintSubMenu, item_definition_index_t iPaintDef, bool bAddCommerce );
void AddCommerceToContextMenu( Menu *pMenu, const char* pszActionFmt, item_definition_index_t iItemDefIndex, bool bAddMarket, bool bAddStore );
void AddCommerceSubmenus( Menu *pSubMenu, item_definition_index_t iItemDef, const char* pszActionFmt );
void DoGiftToPlayer( );
protected:
vgui::TextEntry *m_pNameFilterTextEntry;
CUtlVector<wchar_t> m_wNameFilter;
float m_flFilterItemTime;
CUtlMap< int, CEconItemView*, int > m_mapFilteringItems;
CUtlMap< itemid_t, char > m_mapSeenItems;
bool m_bInitializedSeenItems;
CUtlVector< itemid_t > m_vecDirtyItems;
CExButton *m_pNextPageButton;
CExButton *m_pPrevPageButton;
CExButton *m_pShowExplanationsButton;
vgui::Label *m_pCurPageLabel;
vgui::ComboBox *m_pSortByComboBox;
vgui::ComboBox *m_pShowRarityComboBox;
vgui::CheckButton *m_pShowBaseItemsCheckbox;
CExButton *m_pDragToNextPageButton;
CExButton *m_pDragToPrevPageButton;
float m_flPreventDragPageSwitchUntil;
float m_flStartExplanationsAt;
// Dragging support
float m_flMouseDownTime;
int m_iMouseDownX;
int m_iMouseDownY;
CItemModelPanel *m_pItemDraggedFromPanel;
int m_iDraggedFromPage;
bool m_bMouseDownOnItemPanel;
bool m_bDragging;
CItemModelPanel *m_pMouseDragItemPanel;
int m_iDragOffsetX;
int m_iDragOffsetY;
CItemModelPanel *m_pPrevDragOverItemPanel;
// Deletion
vgui::EditablePanel *m_pConfirmDeleteDialog;
// Tool support
enum SelectionMode_t
{
StandardSelection,
ToolSelection,
};
SelectionMode_t m_eSelectionMode;
int m_nLastToolPage;
CEconItemView m_ToolSelectionItem;
CExButton *m_pCancelToolButton;
vgui::ScalableImagePanel *m_pToolIcon;
CEconItemView m_ComboBoxOverlaySelectionItem;
CExButton *m_pCraftButton;
// base items or backpack items
bool m_bShowBaseItems;
// positions of all our item panels, so we can handle drag & drop
struct backpackitempos_t
{
int x,y;
};
CUtlVector<backpackitempos_t> m_ItemModelPanelPos;
KeyValues *m_pPageButtonKVs;
int m_nNumActivePages;
CUtlVector< EditablePanel* > m_Pages;
CUtlVector<backpackitempos_t> m_PageButtonPos;
CDynamicRecipePanel* m_pDynamicRecipePanel;
CItemSlotPanel* m_pItemSlotPanel;
CUtlVector< item_definition_index_t > m_vecPaintCans;
CUtlVector< item_definition_index_t > m_vecStrangeParts;
DHANDLE<CStrangeCountTransferPanel> m_pStrangeToolPanel;
DHANDLE<CCollectionCraftingPanel> m_pCollectionCraftPanel;
DHANDLE<CHalloweenOfferingPanel> m_pHalloweenOfferingPanel;
DHANDLE<CCraftCommonStatClockPanel> m_pMannCoTradePanel; // Make this Panel Generic
CTFItemInspectionPanel *m_pInspectPanel;
CTFStorePreviewItemPanel2 *m_pInspectCosmeticPanel;
vgui::Menu *m_pContextMenu;
CEconItemViewHandle m_hQuickOpenCrate;
uint64 m_nQuickOpenTxn;
CPanelAnimationVarAliasType( int, m_iPageButtonYPos, "page_button_y", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iPageButtonXDelta, "page_button_x_delta", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iPageButtonYDelta, "page_button_y_delta", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iPageButtonPerRow, "page_button_per_row", "20", "int" );
CPanelAnimationVarAliasType( int, m_iPageButtonHeight, "page_button_height", "0", "proportional_int" );
};
#endif // BACKPACK_PANEL_H
-803
View File
@@ -1,803 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "base_loadout_panel.h"
#include "item_confirm_delete_dialog.h"
#include "vgui/ISurface.h"
#include "gamestringpool.h"
#include "iclientmode.h"
#include "econ_item_inventory.h"
#include "ienginevgui.h"
#include <vgui/ILocalize.h>
#include "vgui_controls/TextImage.h"
#include "vgui_controls/CheckButton.h"
#include "vgui_controls/ComboBox.h"
#include "vgui/IInput.h"
#include "econ_ui.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
#ifdef STAGING_ONLY
ConVar tf_use_card_tooltips( "tf_use_card_tooltips", "0", FCVAR_ARCHIVE );
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBaseLoadoutPanel::CBaseLoadoutPanel( vgui::Panel *parent, const char *panelName ) : EditablePanel(parent, panelName )
{
SetParent( parent );
// Use the client scheme
vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ClientScheme.res", "ClientScheme");
SetScheme(scheme);
SetProportional( true );
m_pItemModelPanelKVs = NULL;
m_pMouseOverItemPanel = vgui::SETUP_PANEL( new CItemModelPanel( this, "mouseoveritempanel" ) );
m_pMouseOverTooltip = new CItemModelPanelToolTip( this );
m_pMouseOverTooltip->SetupPanels( this, m_pMouseOverItemPanel );
#ifdef STAGING_ONLY
m_pMouseOverCardPanel = vgui::SETUP_PANEL( new CTFItemCardPanel( this, "mouseovercardpanel" ) );
m_pMouseOverCardTooltip = new CItemCardPanelToolTip( this );
m_pMouseOverCardTooltip->SetupPanels( this, m_pMouseOverCardPanel );
#endif
m_pItemPanelBeingMousedOver = NULL;
m_pCaratLabel = NULL;
m_pClassLabel = NULL;
m_nCurrentPage = 0;
m_bTooltipKeyPressed = false;
SetMouseInputEnabled( true );
SetKeyBoardInputEnabled( true );
ListenForGameEvent( "inventory_updated" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBaseLoadoutPanel::~CBaseLoadoutPanel()
{
if ( m_pItemModelPanelKVs )
{
m_pItemModelPanelKVs->deleteThis();
m_pItemModelPanelKVs = NULL;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
m_pCaratLabel = dynamic_cast<vgui::Label*>( FindChildByName("CaratLabel") );
m_pClassLabel = dynamic_cast<vgui::Label*>( FindChildByName("ClassLabel") );
m_bReapplyItemKVs = true;
for ( int i = 0; i < m_pItemModelPanels.Count(); i++ )
{
SetBorderForItem( m_pItemModelPanels[i], false );
}
m_pMouseOverItemPanel->SetBorder( pScheme->GetBorder("LoadoutItemPopupBorder") );
CreateItemPanels();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::ApplySettings( KeyValues *inResourceData )
{
BaseClass::ApplySettings( inResourceData );
KeyValues *pItemKV = inResourceData->FindKey( "modelpanels_kv" );
if ( pItemKV )
{
if ( m_pItemModelPanelKVs )
{
m_pItemModelPanelKVs->deleteThis();
}
m_pItemModelPanelKVs = new KeyValues("modelpanels_kv");
pItemKV->CopySubkeys( m_pItemModelPanelKVs );
}
}
extern const char *g_szItemBorders[AE_MAX_TYPES][5];
extern ConVar cl_showbackpackrarities;
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::SetBorderForItem( CItemModelPanel *pItemPanel, bool bMouseOver )
{
if ( !pItemPanel )
return;
const char *pszBorder = NULL;
if ( pItemPanel->IsGreyedOut() )
{
if( pItemPanel->IsSelected() )
{
pszBorder = "BackpackItemGrayedOut_Selected";
}
else
{
pszBorder = "BackpackItemGrayedOut";
}
}
else
{
int iRarity = 0;
if ( pItemPanel->HasItem() && cl_showbackpackrarities.GetBool() )
{
iRarity = pItemPanel->GetItem()->GetItemQuality() ;
uint8 nRarity = pItemPanel->GetItem()->GetItemDefinition()->GetRarity();
if ( ( nRarity != k_unItemRarity_Any ) && ( iRarity != AE_SELFMADE ) )
{
// translate this quality to rarity
iRarity = nRarity + AE_RARITY_DEFAULT;
}
}
if ( pItemPanel->IsSelected() )
{
pszBorder = g_szItemBorders[iRarity][2];
}
if ( bMouseOver )
{
pszBorder = g_szItemBorders[iRarity][1];
}
else
{
pszBorder = g_szItemBorders[iRarity][0];
}
}
vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( GetScheme() );
pItemPanel->SetBorder( pScheme->GetBorder( pszBorder ) );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::ApplyKVsToItemPanels( void )
{
if ( m_pItemModelPanelKVs )
{
for ( int i = 0; i < m_pItemModelPanels.Count(); i++ )
{
m_pItemModelPanels[i]->ApplySettings( m_pItemModelPanelKVs );
SetBorderForItem( m_pItemModelPanels[i], false );
m_pItemModelPanels[i]->InvalidateLayout();
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::PerformLayout( void )
{
if ( m_bReapplyItemKVs )
{
m_bReapplyItemKVs = false;
ApplyKVsToItemPanels();
}
BaseClass::PerformLayout();
// If we're items only, we hide various elements
if ( m_pCaratLabel )
{
m_pCaratLabel->SetVisible( !m_bItemsOnly );
}
if ( m_pClassLabel )
{
m_pClassLabel->SetVisible( !m_bItemsOnly );
}
if ( m_pMouseOverItemPanel->IsVisible() )
{
// The mouseover panel was visible. Fake a panel entry into the original panel to get it to show up again properly.
if ( m_pItemPanelBeingMousedOver )
{
OnItemPanelEntered( m_pItemPanelBeingMousedOver );
}
else
{
HideMouseOverPanel();
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::AddNewItemPanel( int iPanelIndex )
{
CItemModelPanel *pPanel = vgui::SETUP_PANEL( new CItemModelPanel( this, VarArgs("modelpanel%d", iPanelIndex) ) );
pPanel->SetActAsButton( true, true );
m_pItemModelPanels.AddToTail( pPanel );
#ifdef STAGING_ONLY
if ( tf_use_card_tooltips.GetBool() )
{
pPanel->SetTooltip( m_pMouseOverCardTooltip, "" );
}
else
#endif
pPanel->SetTooltip( m_pMouseOverTooltip, "" );
Assert( iPanelIndex == (m_pItemModelPanels.Count()-1) );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::CreateItemPanels( void )
{
int iNumPanels = GetNumItemPanels();
if ( m_pItemModelPanels.Count() < iNumPanels )
{
for ( int i = m_pItemModelPanels.Count(); i < iNumPanels; i++ )
{
AddNewItemPanel(i);
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::ShowPanel( int iClass, bool bBackpack, bool bReturningFromArmory )
{
bool bShow = (iClass != 0 || bBackpack);
OnShowPanel( bShow, bReturningFromArmory );
SetVisible( bShow );
if ( bShow )
{
HideMouseOverPanel();
CreateItemPanels();
UpdateModelPanels();
// make the first slot be selected so controller input will work
static ConVarRef joystick( "joystick" );
if( joystick.IsValid() && joystick.GetBool() && m_pItemModelPanels.Count() && m_pItemModelPanels[0] )
{
m_pItemModelPanels[0]->SetSelected( true );
m_pItemModelPanels[0]->RequestFocus();
}
}
else
{
// clear items from panels to make sure that items get invalidate on show panel
FOR_EACH_VEC( m_pItemModelPanels, i )
{
m_pItemModelPanels[i]->SetItem( NULL );
}
}
if ( !bReturningFromArmory )
{
PostShowPanel( bShow );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::OnCommand( const char *command )
{
engine->ClientCmd( const_cast<char *>( command ) );
BaseClass::OnCommand( command );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::FireGameEvent( IGameEvent *event )
{
// If we're not visible, ignore all events
if ( !IsVisible() )
return;
const char *type = event->GetName();
if ( Q_strcmp( "inventory_updated", type ) == 0 )
{
// We need to refresh our model panels, because the items may have changed.
UpdateModelPanels();
}
}
CItemModelPanel *CBaseLoadoutPanel::FindBestPanelNavigationForDirection( const CItemModelPanel *pCurrentPanel, const Vector2D &vPos, const Vector2D &vDirection )
{
CItemModelPanel *pBestPanel = NULL;
// Start with the worst allowable score
float flDistance = GetWide() + GetTall();
float flDot = -1.0f;
float flClosenessScore = flDistance * ( 1.5f - flDot );
for ( int j = 0; j < m_pItemModelPanels.Count(); j++ )
{
CItemModelPanel *pTempPanel = m_pItemModelPanels[ j ];
if ( !pTempPanel || pTempPanel == pCurrentPanel )
continue;
// Get temp center position
int nX, nY;
pTempPanel->GetPos( nX, nY );
nX += pTempPanel->GetWide() / 2;
nY += pTempPanel->GetTall() / 2;
Vector2D vTempPos( nX, nY );
// Get distance and dot
Vector2D vDiff = vTempPos - vPos;
float flTempDistance = Vector2DNormalize( vDiff );
float flTempDot = vDiff.Dot( vDirection );
// Must be somewhat in the correct direction
if ( flTempDot <= 0.0f )
continue;
float flTempScore = flTempDistance * ( 1.5f - flTempDot );
if ( flClosenessScore > flTempScore )
{
flClosenessScore = flTempScore;
flDistance = flTempDistance;
flDot = flTempDot;
pBestPanel = pTempPanel;
}
}
return pBestPanel;
}
void CBaseLoadoutPanel::LinkModelPanelControllerNavigation( bool bForceRelink )
{
if ( m_pItemModelPanels.Count() < 2 )
return;
// first unlink everything
if( bForceRelink )
{
for ( int i = 0; i < m_pItemModelPanels.Count(); i++ )
{
CItemModelPanel *pCurrentPanel = m_pItemModelPanels[ i ];
if ( !pCurrentPanel )
continue;
pCurrentPanel->SetNavUp( (vgui::Panel*)NULL );
pCurrentPanel->SetNavDown( (vgui::Panel*)NULL );
pCurrentPanel->SetNavLeft( (vgui::Panel*)NULL );
pCurrentPanel->SetNavRight( (vgui::Panel*)NULL );
}
}
for ( int i = 0; i < m_pItemModelPanels.Count(); i++ )
{
CItemModelPanel *pCurrentPanel = m_pItemModelPanels[ i ];
if ( !pCurrentPanel )
continue;
// Get center position
int nX, nY;
pCurrentPanel->GetPos( nX, nY );
nX += pCurrentPanel->GetWide() / 2;
nY += pCurrentPanel->GetTall() / 2;
Vector2D vPos( nX, nY );
if ( !pCurrentPanel->GetNavUpName() || pCurrentPanel->GetNavUpName()[ 0 ] == '\0' )
{
CItemModelPanel *pBestPanel = FindBestPanelNavigationForDirection( pCurrentPanel, vPos, Vector2D( 0, -1 ) );
if ( pBestPanel )
{
pCurrentPanel->SetNavUp( pBestPanel->GetName() );
pBestPanel->SetNavDown( pCurrentPanel->GetName() );
}
}
if ( !pCurrentPanel->GetNavDownName() || pCurrentPanel->GetNavDownName()[ 0 ] == '\0' )
{
CItemModelPanel *pBestPanel = FindBestPanelNavigationForDirection( pCurrentPanel, vPos, Vector2D( 0, 1 ) );
if ( pBestPanel )
{
pCurrentPanel->SetNavDown( pBestPanel->GetName() );
pBestPanel->SetNavUp( pCurrentPanel->GetName() );
}
}
if ( !pCurrentPanel->GetNavLeftName() || pCurrentPanel->GetNavLeftName()[ 0 ] == '\0' )
{
CItemModelPanel *pBestPanel = FindBestPanelNavigationForDirection( pCurrentPanel, vPos, Vector2D( -1, 0 ) );
if ( pBestPanel )
{
pCurrentPanel->SetNavLeft( pBestPanel->GetName() );
pBestPanel->SetNavRight( pCurrentPanel->GetName() );
}
}
if ( !pCurrentPanel->GetNavRightName() || pCurrentPanel->GetNavRightName()[ 0 ] == '\0' )
{
CItemModelPanel *pBestPanel = FindBestPanelNavigationForDirection( pCurrentPanel, vPos, Vector2D( 1, 0 ) );
if ( pBestPanel )
{
pCurrentPanel->SetNavRight( pBestPanel->GetName() );
pBestPanel->SetNavLeft( pCurrentPanel->GetName() );
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::OnItemPanelEntered( vgui::Panel *panel )
{
CItemModelPanel *pItemPanel = dynamic_cast < CItemModelPanel * > ( panel );
if ( pItemPanel && IsVisible() )
{
CEconItemView *pItem = pItemPanel->GetItem();
if ( pItem && !IsIgnoringItemPanelEnters() && !pItemPanel->IsGreyedOut() )
{
m_pItemPanelBeingMousedOver = pItemPanel;
}
if ( !pItemPanel->IsSelected() )
{
SetBorderForItem( pItemPanel, true );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::OnItemPanelExited( vgui::Panel *panel )
{
CItemModelPanel *pItemPanel = dynamic_cast < CItemModelPanel * > ( panel );
if ( pItemPanel && IsVisible() )
{
if ( !pItemPanel->IsSelected() )
{
SetBorderForItem( pItemPanel, false );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::HideMouseOverPanel( void )
{
if ( m_pMouseOverItemPanel->IsVisible() )
{
m_pMouseOverItemPanel->SetVisible( false );
m_pItemPanelBeingMousedOver = NULL;
}
#ifdef STAGING_ONLY
if ( m_pMouseOverCardPanel->IsVisible() )
{
m_pMouseOverCardPanel->SetVisible( false );
m_pItemPanelBeingMousedOver = NULL;
}
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Returns the index of the first selected item.
//-----------------------------------------------------------------------------
int CBaseLoadoutPanel::GetFirstSelectedItemIndex( bool bIncludeEmptySlots )
{
for ( int i = 0; i < m_pItemModelPanels.Count(); i++ )
{
if ( m_pItemModelPanels[i]->IsSelected() && ( bIncludeEmptySlots || m_pItemModelPanels[i]->HasItem() ) )
{
return i;
}
}
return -1;
}
//-----------------------------------------------------------------------------
// Purpose: Returns the first selected item model panel or NULL if there is no
// such panel.
//-----------------------------------------------------------------------------
CItemModelPanel *CBaseLoadoutPanel::GetFirstSelectedItemModelPanel (bool bIncludeEmptySlots )
{
int i = GetFirstSelectedItemIndex( bIncludeEmptySlots );
if( i == -1 )
return NULL;
else
return m_pItemModelPanels[ i ];
}
//-----------------------------------------------------------------------------
// Purpose: Returns the first selected econ item view or NULL if there is no
// selected item
//-----------------------------------------------------------------------------
CEconItemView *CBaseLoadoutPanel::GetFirstSelectedItem()
{
CItemModelPanel *pItemModelPanel = GetFirstSelectedItemModelPanel( false );
if( pItemModelPanel )
return pItemModelPanel->GetItem();
else
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Returns the next item in the specified direction, possibly switching
// pages to get there
//-----------------------------------------------------------------------------
bool CBaseLoadoutPanel::GetAdjacentItemIndex( int nIndex, int nPage, int *pnNewIndex, int *pnNewPage, int dx, int dy )
{
// if we don't have a valid index the right answer is always the first item on the first page
if( nIndex == -1 )
{
*pnNewIndex = 0;
*pnNewPage = nPage;
return true;
}
int nRow = nIndex / GetNumColumns() + dy;
int nColumn = nIndex % GetNumColumns() + dx;
// just limit us to the top and bottom edges
if( nRow < 0 || nRow >= GetNumRows() )
return false;
// for columns, try to switch pages
int nNewPage = nPage;
while( nColumn < 0 )
{
if( nNewPage == 0 )
break;
nNewPage--;
nColumn += GetNumColumns();
}
while( nColumn >= GetNumColumns() )
{
if( nNewPage == GetNumPages() - 1 )
break;
nNewPage++;
nColumn -= GetNumColumns();
}
if( nColumn < 0 )
{
if( nNewPage != nPage )
{
nColumn = 0;
}
else
{
return false;
}
}
else if( nColumn >= GetNumColumns() )
{
if( nNewPage != nPage )
{
nColumn = GetNumColumns() - 1;
}
else
{
return false;
}
}
// never change to an invisible panel
int nNewIndex = nRow * GetNumColumns() + nColumn;
if( nNewIndex >= m_pItemModelPanels.Count() || !m_pItemModelPanels[ nNewIndex ]->IsVisible() )
{
// try to find a model panel that's still valid so we find the last one on the last valid row
while( nNewIndex >= 0 && !m_pItemModelPanels[ nNewIndex ]->IsVisible() )
nNewIndex--;
if( nNewIndex < 0 || nNewIndex == nIndex )
return false;
}
*pnNewPage = nNewPage;
*pnNewIndex = nNewIndex;
return true;
}
//-----------------------------------------------------------------------------
// Purpose: selects the next item in the specified direction, possibly switching
// pages to get there
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::SelectAdjacentItem( int dx, int dy )
{
int nSelected = GetFirstSelectedItemIndex( true );
int nNewPage, nNewSelected;
bool bFoundNext = GetAdjacentItemIndex( nSelected, m_nCurrentPage, &nNewSelected, &nNewPage, dx, dy );
if( !bFoundNext )
{
vgui::surface()->PlaySound( "player/suit_denydevice.wav" );
return;
}
// change pages
if( nNewPage != m_nCurrentPage )
{
Assert( nNewPage >= 0 && nNewPage < GetNumPages() );
SetCurrentPage( nNewPage );
UpdateModelPanels();
}
// select the new model
if( nSelected != nNewSelected )
{
if( nSelected != -1 && m_pItemModelPanels[ nSelected ]->IsSelected() )
{
m_pItemModelPanels[ nSelected ]->SetSelected( false );
SetBorderForItem( m_pItemModelPanels[ nSelected ], false );
}
if( nNewSelected != -1 && !m_pItemModelPanels[ nNewSelected ]->IsSelected() )
{
m_pItemModelPanels[ nNewSelected ]->SetSelected( true );
SetBorderForItem( m_pItemModelPanels[ nNewSelected ], false );
if( m_bTooltipKeyPressed )
{
if( m_pItemModelPanels[ nNewSelected ]->HasItem() )
{
m_pMouseOverTooltip->ShowTooltip( m_pItemModelPanels[ nNewSelected ] );
}
else
{
m_pMouseOverTooltip->HideTooltip();
}
}
}
}
OnItemSelectionChanged();
}
//-----------------------------------------------------------------------------
// Purpose: Processes up/down/left/right keys for selecting items in the panel
//-----------------------------------------------------------------------------
bool CBaseLoadoutPanel::HandleItemSelectionKeyPressed( vgui::KeyCode code )
{
ButtonCode_t nButtonCode = GetBaseButtonCode( code );
if ( nButtonCode == KEY_XBUTTON_UP ||
nButtonCode == KEY_XSTICK1_UP ||
nButtonCode == KEY_XSTICK2_UP ||
nButtonCode == KEY_UP )
{
SelectAdjacentItem( 0, -1 );
return true;
}
else if ( nButtonCode == KEY_XBUTTON_DOWN ||
nButtonCode == KEY_XSTICK1_DOWN ||
nButtonCode == KEY_XSTICK2_DOWN ||
nButtonCode == STEAMCONTROLLER_DPAD_DOWN ||
nButtonCode == KEY_DOWN )
{
SelectAdjacentItem( 0, 1 );
return true;
}
else if ( nButtonCode == KEY_XBUTTON_RIGHT ||
nButtonCode == KEY_XSTICK1_RIGHT ||
nButtonCode == KEY_XSTICK2_RIGHT ||
nButtonCode == STEAMCONTROLLER_DPAD_RIGHT ||
nButtonCode == KEY_RIGHT )
{
SelectAdjacentItem( 1, 0 );
return true;
}
else if ( nButtonCode == KEY_XBUTTON_LEFT ||
nButtonCode == KEY_XSTICK1_LEFT ||
nButtonCode == KEY_XSTICK2_LEFT ||
nButtonCode == STEAMCONTROLLER_DPAD_LEFT ||
nButtonCode == KEY_LEFT )
{
SelectAdjacentItem( -1, 0 );
return true;
}
else if ( code == KEY_PAGEDOWN ||
nButtonCode == KEY_XBUTTON_RIGHT_SHOULDER )
{
if( m_nCurrentPage < GetNumPages() - 1 )
{
SetCurrentPage( m_nCurrentPage + 1 );
UpdateModelPanels();
}
return true;
}
else if ( code == KEY_PAGEUP ||
nButtonCode == KEY_XBUTTON_LEFT_SHOULDER )
{
if( m_nCurrentPage > 0 )
{
SetCurrentPage( m_nCurrentPage - 1 );
UpdateModelPanels();
}
return true;
}
else if ( nButtonCode == KEY_XBUTTON_Y )
{
m_bTooltipKeyPressed = true;
CItemModelPanel *pSelection = GetFirstSelectedItemModelPanel( false );
if( pSelection )
{
m_pMouseOverTooltip->ResetDelay();
m_pMouseOverTooltip->ShowTooltip( pSelection );
}
return true;
}
else
{
return false;
}
}
//-----------------------------------------------------------------------------
// Purpose: Processes up/down/left/right keys for selecting items in the panel
//-----------------------------------------------------------------------------
bool CBaseLoadoutPanel::HandleItemSelectionKeyReleased( vgui::KeyCode code )
{
ButtonCode_t nButtonCode = GetBaseButtonCode( code );
if( nButtonCode == KEY_XBUTTON_Y )
{
m_bTooltipKeyPressed = false;
m_pMouseOverTooltip->HideTooltip();
return true;
}
else
{
return false;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseLoadoutPanel::SetCurrentPage( int nNewPage )
{
if( nNewPage < 0 || nNewPage >= GetNumPages() )
return;
m_nCurrentPage = nNewPage;
}
-115
View File
@@ -1,115 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef BASE_LOADOUT_PANEL_H
#define BASE_LOADOUT_PANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "econ_controls.h"
#include "item_pickup_panel.h"
#include "GameEventListener.h"
#include "tf_item_card_panel.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CBaseLoadoutPanel : public vgui::EditablePanel, public CGameEventListener
{
DECLARE_CLASS_SIMPLE( CBaseLoadoutPanel, vgui::EditablePanel );
public:
CBaseLoadoutPanel( vgui::Panel *parent, const char *panelName );
virtual ~CBaseLoadoutPanel();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void ApplySettings( KeyValues *inResourceData );
virtual void PerformLayout( void );
virtual void OnCommand( const char *command );
void ShowPanel( int iClass, bool bBackpack, bool bReturningFromArmory = false );
virtual void FireGameEvent( IGameEvent *event );
virtual int GetNumSlotsPerPage( void ) { return 1; }
virtual int GetNumColumns( void ) { return 99; }
virtual int GetNumRows( void ) { return 99; }
virtual int GetNumPages( void ) { return 1; }
virtual int GetCurrentPage() const { return m_nCurrentPage; }
virtual void SetCurrentPage( int nNewPage );
virtual int GetNumItemPanels( void ) { Assert(0); return 0; };
virtual void OnShowPanel( bool bVisible, bool bReturningFromArmory ) { return; }
virtual void PostShowPanel( bool bVisible ) { return; }
CItemModelPanel *FindBestPanelNavigationForDirection( const CItemModelPanel *pCurrentPanel, const Vector2D &vPos, const Vector2D &vDirection );
void LinkModelPanelControllerNavigation( bool bForceRelink );
virtual void AddNewItemPanel( int iPanelIndex );
MESSAGE_FUNC_PTR( OnItemPanelEntered, "ItemPanelEntered", panel );
MESSAGE_FUNC_PTR( OnItemPanelExited, "ItemPanelExited", panel );
void HideMouseOverPanel( void );
CItemModelPanel *GetMouseOverPanel( void ) { return m_pMouseOverItemPanel; }
CItemModelPanelToolTip *GetMouseOverToolTipPanel( void ) { return m_pMouseOverTooltip; }
protected:
virtual void UpdateModelPanels( void ) { return; }
virtual void SetBorderForItem( CItemModelPanel *pItemPanel, bool bMouseOver );
virtual bool IsIgnoringItemPanelEnters( void ) { return false; }
virtual void ApplyKVsToItemPanels( void );
virtual void CreateItemPanels( void );
virtual void OnItemSelectionChanged() {}
bool HandleItemSelectionKeyPressed( vgui::KeyCode code ) ;
bool HandleItemSelectionKeyReleased( vgui::KeyCode code ) ;
// helpers to get selected items
int GetFirstSelectedItemIndex( bool bIncludeEmptySlots );
CItemModelPanel *GetFirstSelectedItemModelPanel( bool bIncludeEmptySlots );
CEconItemView *GetFirstSelectedItem();
bool GetAdjacentItemIndex( int nIndex, int nPage, int *pnNewIndex, int *pnNewPage, int dx, int dy );
void SelectAdjacentItem( int dx, int dy );
protected:
CUtlVector<CItemModelPanel*> m_pItemModelPanels;
vgui::Label *m_pTitleLabel;
KeyValues *m_pItemModelPanelKVs;
bool m_bReapplyItemKVs;
bool m_bTooltipKeyPressed;
int m_nCurrentPage;
vgui::Label *m_pCaratLabel;
vgui::Label *m_pClassLabel;
CPanelAnimationVarAliasType( int, m_iItemXPosOffcenterA, "item_xpos_offcenter_a", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iItemXPosOffcenterB, "item_xpos_offcenter_b", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iItemYPos, "item_ypos", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iItemYDelta, "item_ydelta", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iButtonXPosOffcenter, "button_xpos_offcenter", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iButtonYPos, "button_ypos", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iButtonYDelta, "button_ydelta", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iItemBackpackOffcenterX, "item_backpack_offcenter_x", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iItemBackpackXDelta, "item_backpack_xdelta", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iItemBackpackYDelta, "item_backpack_ydelta", "0", "proportional_int" );
CPanelAnimationVar( bool, m_bItemsOnly, "items_only", "0" );
CPanelAnimationVar( bool, m_bForceShowBackpackRarities, "force_show_backpack_rarities", "0" );
CPanelAnimationVarAliasType( int, m_iDeleteButtonXPos, "button_override_delete_xpos", "0", "proportional_int" );
protected:
CItemModelPanel *m_pMouseOverItemPanel;
CItemModelPanelToolTip *m_pMouseOverTooltip;
CItemModelPanel *m_pItemPanelBeingMousedOver;
#ifdef STAGING_ONLY
CTFItemCardPanel *m_pMouseOverCardPanel;
CItemCardPanelToolTip *m_pMouseOverCardTooltip;
#endif
};
#endif // BASE_LOADOUT_PANEL_H
@@ -1,107 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
#include "cbase.h"
#include "econ_gcmessages.h"
#include "econ_item_system.h"
#include "econ_ui.h"
#include "store/store_panel.h"
#include "gc_clientsystem.h"
#include "client_community_market.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
static const float s_fUpdateTimeInSeconds = 60.0f * 15.0f;
typedef CUtlMap< steam_market_gc_identifier_t, client_market_data_t, unsigned int > ClientMarketDataMap_t;
static ClientMarketDataMap_t s_mapClientMarketData;
static float g_fClientMarketDataLastUpdateTime = -s_fUpdateTimeInSeconds;
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
static void ClientMarketData_Refresh()
{
if ( !EconUI() || !EconUI()->GetStorePanel() )
return;
GCSDK::CProtoBufMsg<CMsgGCClientMarketDataRequest> msg( k_EMsgGCClientRequestMarketData );
msg.Body().set_user_currency( EconUI()->GetStorePanel()->GetCurrency() );
GCClientSystem()->BSendMessage( msg );
g_fClientMarketDataLastUpdateTime = engine->Time();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const client_market_data_t *GetClientMarketData( const steam_market_gc_identifier_t& ident )
{
// If our data is out of date, request fresh data from the GC. We don't need up-to-the-minute
// numbers but we don't want to fall too far behind. THe GC itself doesn't update in realtime
// so constantly querying for updates isn't really useful. We'll still use whatever data if any
// we have for this call.
if ( (engine->Time() - g_fClientMarketDataLastUpdateTime) >= s_fUpdateTimeInSeconds )
{
ClientMarketData_Refresh();
}
// Not having any data on this item isn't an error. We might be requesting something for an
// unlistable item, or we might not have current information from the GC yet.
if ( s_mapClientMarketData.Count() == 0 )
return NULL;
// Remap this index?
steam_market_gc_identifier_t searchIdent = ident;
searchIdent.m_unDefIndex = GetItemSchema()->GetCommunityMarketRemappedDefinitionIndex( ident.m_unDefIndex );
ClientMarketDataMap_t::IndexType_t index = s_mapClientMarketData.Find( searchIdent );
if ( index == s_mapClientMarketData.InvalidIndex() )
return NULL;
return &s_mapClientMarketData[index];
}
//-----------------------------------------------------------------------------
const client_market_data_t *GetClientMarketData( item_definition_index_t iItemDef, uint8 unQuality )
{
steam_market_gc_identifier_t ident;
ident.m_unDefIndex = iItemDef;
ident.m_unQuality = unQuality;
return GetClientMarketData( ident );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CGCClientRequestMarketDataResponse : public GCSDK::CGCClientJob
{
public:
CGCClientRequestMarketDataResponse( GCSDK::CGCClient *pClient ) : GCSDK::CGCClientJob( pClient ) {}
virtual bool BYieldingRunGCJob( GCSDK::IMsgNetPacket *pNetPacket )
{
GCSDK::CProtoBufMsg<CMsgGCClientMarketData> msg( pNetPacket );
s_mapClientMarketData.RemoveAll();
s_mapClientMarketData.SetLessFunc( DefLessFunc( ClientMarketDataMap_t::KeyType_t ) );
for ( int i = 0; i < msg.Body().entries_size(); i++ )
{
const CMsgGCClientMarketDataEntry& entry = msg.Body().entries( i );
steam_market_gc_identifier_t ident;
ident.m_unDefIndex = entry.item_def_index();
ident.m_unQuality = entry.item_quality();
client_market_data_t data;
data.m_unQuantityAvailable = entry.item_sell_listings();
data.m_unLowestPrice = entry.price_in_local_currency();
s_mapClientMarketData.Insert( ident, data );
}
return true;
}
};
GC_REG_JOB( GCSDK::CGCClient, CGCClientRequestMarketDataResponse, "CGCClientRequestMarketDataResponse", k_EMsgGCClientRequestMarketDataResponse, GCSDK::k_EServerTypeGCClient );
@@ -1,19 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
#ifndef CLIENT_COMMUNITY_MARKET_H
#define CLIENT_COMMUNITY_MARKET_H
#ifdef _WIN32
#pragma once
#endif
struct client_market_data_t
{
uint32 m_unQuantityAvailable;
float m_unLowestPrice;
};
const client_market_data_t *GetClientMarketData( item_definition_index_t iItemDef, uint8 unQuality );
const client_market_data_t *GetClientMarketData( const steam_market_gc_identifier_t& ident );
#endif // CLIENT_COMMUNITY_MARKET_H
@@ -1,37 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "confirm_delete_dialog.h"
#include "vgui_controls/TextImage.h"
#include "econ_controls.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CConfirmDeleteDialog::CConfirmDeleteDialog( vgui::Panel *parent )
: BaseClass(parent)
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDeleteDialog::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
// Set the X to be bright, and the rest dull
if ( m_pConfirmButton )
{
m_pConfirmButton->SetText( "#X_DeleteConfirmButton" );
SetXToRed( m_pConfirmButton );
}
}
-28
View File
@@ -1,28 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef CONFIRM_DELETE_DIALOG_H
#define CONFIRM_DELETE_DIALOG_H
#ifdef _WIN32
#pragma once
#endif
#include "confirm_dialog.h"
//-----------------------------------------------------------------------------
// Purpose: A generic delete confirmation dialog - see CConfirmDialog.
//-----------------------------------------------------------------------------
class CConfirmDeleteDialog : public CConfirmDialog
{
DECLARE_CLASS_SIMPLE( CConfirmDeleteDialog,CConfirmDialog );
public:
CConfirmDeleteDialog( vgui::Panel *parent );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
};
#endif // CONFIRM_DELETE_DIALOG_H
-932
View File
@@ -1,932 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "confirm_dialog.h"
#include "ienginevgui.h"
#include "econ_controls.h"
#include "vgui/IInput.h"
#include "vgui/ISurface.h"
#include "vgui_controls/TextImage.h"
#include "vgui_controls/CheckButton.h"
#include "econ_ui.h"
#include "store/store_panel.h"
#ifdef TF_CLIENT_DLL
#include "tf_playerpanel.h"
#endif // TF_CLIENT_DLL
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
static const wchar_t* GetSCGlyph( const char* action )
{
auto origin = g_pInputSystem->GetSteamControllerActionOrigin( action, GAME_ACTION_SET_FPSCONTROLS );
return g_pInputSystem->GetSteamControllerFontCharacterForActionOrigin( origin );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CConfirmDialog::CConfirmDialog( vgui::Panel *parent )
: BaseClass( parent, "ConfirmDialog" ),
m_pCancelButton( NULL ),
m_pConfirmButton( NULL ),
m_pIcon( NULL )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDialog::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
LoadControlSettings( GetResFile(), "GAME" );
SetBorder( pScheme->GetBorder("EconItemBorder") );
// Cache off button ptrs
m_pConfirmButton = dynamic_cast< CExButton* >( FindChildByName( "ConfirmButton" ) );
m_pCancelButton = dynamic_cast< CExButton* >( FindChildByName( "CancelButton" ) );
m_pIcon = dynamic_cast< vgui::ImagePanel* >( FindChildByName( "Icon" ) );
SetDialogVariable( "text", GetText() );
if ( ::input->IsSteamControllerActive() )
{
auto iconConfirm = GetSCGlyph( "cl_trigger_first_notification" );
auto iconCancel = GetSCGlyph( "cl_decline_first_notification" );
auto confirmHint = dynamic_cast< CExLabel* >( FindChildByName( "ConfirmButtonHintIcon" ) );
auto cancelHint = dynamic_cast< CExLabel* >( FindChildByName( "CancelButtonHintIcon" ) );
if ( confirmHint )
{
confirmHint->SetText( iconConfirm );
}
if ( cancelHint )
{
cancelHint->SetText( iconCancel );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDialog::Show( bool bMakePopup )
{
SetVisible( true );
if ( bMakePopup )
{
MakePopup();
}
MoveToFront();
SetKeyBoardInputEnabled( true );
InvalidateLayout( true, true );
if ( ::input->IsSteamControllerActive() )
{
auto iconConfirm = GetSCGlyph( "vote_option1" );
auto iconCancel = GetSCGlyph( "vote_option2" );
bool bControllerMapped = iconConfirm[0] && iconCancel[0];
if ( bControllerMapped )
{
SetMouseInputEnabled( false );
}
else
{
SetMouseInputEnabled( true );
}
}
else
{
SetMouseInputEnabled( true );
}
TFModalStack()->PushModal( this );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDialog::SetIconImage( const char *pszIcon )
{
Assert( m_pIcon );
if ( m_pIcon )
{
m_pIcon->SetImage( pszIcon );
m_pIcon->SetVisible( ( pszIcon ? true : false ) );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDialog::OnCommand( const char *command )
{
if ( !Q_strnicmp( command, "cancel", 6 ) )
{
FinishUp();
PostMessage( GetParent(), new KeyValues( "ConfirmDlgResult", "confirmed", 0 ) );
}
else if ( !Q_strnicmp( command, "confirm", 7 ) )
{
FinishUp();
PostMessage( GetParent(), new KeyValues( "ConfirmDlgResult", "confirmed", 1 ) );
}
else
{
engine->ClientCmd( const_cast<char *>( command ) );
}
BaseClass::OnCommand( command );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDialog::OnKeyCodeTyped( vgui::KeyCode code )
{
if( code == KEY_ESCAPE )
{
OnCommand( "cancel" );
}
else
{
BaseClass::OnKeyCodePressed( code );
}
}
///-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDialog::OnKeyCodePressed( vgui::KeyCode code )
{
ButtonCode_t nButtonCode = GetBaseButtonCode( code );
// We map the voting action buttons to the pseudo-buttons F1/F2 so that players can use them to interact with dialogs on the fly
if( nButtonCode == KEY_XBUTTON_B || nButtonCode == STEAMCONTROLLER_F2 || nButtonCode == STEAMCONTROLLER_B )
{
OnCommand( "cancel" );
}
else if ( nButtonCode == KEY_ENTER || nButtonCode == KEY_SPACE || nButtonCode == KEY_XBUTTON_A || nButtonCode == STEAMCONTROLLER_F1 || nButtonCode == STEAMCONTROLLER_A )
{
OnCommand( "confirm" );
}
else
{
BaseClass::OnKeyCodePressed( code );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const char *CConfirmDialog::GetResFile()
{
if ( ::input->IsSteamControllerActive() )
{
return "Resource/UI/econ/ConfirmDialog_SC.res";
}
else
{
return "Resource/UI/econ/ConfirmDialog.res";
}
}
//-----------------------------------------------------------------------------
// Purpose: Hide the panel, mark for deletion, remove from modal stack.
//-----------------------------------------------------------------------------
void CConfirmDialog::FinishUp()
{
SetVisible( false );
TFModalStack()->PopModal( this );
MarkForDeletion();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CConfirmDialog::OnSizeChanged( int nNewWide, int nNewTall )
{
int nX, nY;
// Shift buttons up
if ( m_pCancelButton )
{
m_pCancelButton->GetPos( nX, nY );
m_pCancelButton->SetPos( nX, nNewTall - m_pCancelButton->GetTall() - YRES(15) );
}
if ( m_pConfirmButton )
{
m_pConfirmButton->GetPos( nX, nY );
m_pConfirmButton->SetPos( nX, nNewTall - m_pConfirmButton->GetTall() - YRES(15) );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFGenericConfirmDialog::CTFGenericConfirmDialog( const char *pTitle, const char *pTextKey,
const char *pConfirmBtnText, const char *pCancelBtnText,
GenericConfirmDialogCallback callback, vgui::Panel *pParent )
: BaseClass( pParent ),
m_pTextKey( pTextKey )
{
CommonInit( pTitle, pConfirmBtnText, pCancelBtnText, callback, pParent );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFGenericConfirmDialog::CTFGenericConfirmDialog( const char *pTitle, const wchar_t *pText,
const char *pConfirmBtnText, const char *pCancelBtnText,
GenericConfirmDialogCallback callback, vgui::Panel *pParent )
: BaseClass( pParent ),
m_pTextKey( NULL )
{
CommonInit( pTitle, pConfirmBtnText, pCancelBtnText, callback, pParent );
V_wcsncpy( m_wszBuffer, pText, sizeof( m_wszBuffer ) );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmDialog::CommonInit( const char *pTitle, const char *pConfirmBtnText, const char *pCancelBtnText,
GenericConfirmDialogCallback callback, vgui::Panel *pParent )
{
if ( pParent == NULL )
{
vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ClientScheme.res", "ClientScheme");
SetScheme(scheme);
SetProportional( true );
}
m_pTitle = pTitle;
m_pConfirmBtnText = pConfirmBtnText;
m_pCancelBtnText = pCancelBtnText;
m_pCallback = callback;
m_pContext = NULL;
m_pKeyValues = NULL;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFGenericConfirmDialog::~CTFGenericConfirmDialog()
{
if ( m_pKeyValues )
{
m_pKeyValues->deleteThis();
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const wchar_t *CTFGenericConfirmDialog::GetText()
{
if ( m_pTextKey )
{
g_pVGuiLocalize->ConstructString_safe( m_wszBuffer, m_pTextKey, m_pKeyValues );
return m_wszBuffer;
}
return m_wszBuffer;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmDialog::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
if ( m_pConfirmButton && m_pConfirmBtnText )
{
m_pConfirmButton->SetText( m_pConfirmBtnText );
}
if ( m_pCancelButton && m_pCancelBtnText )
{
m_pCancelButton->SetText (m_pCancelBtnText );
}
SetXToRed( m_pConfirmButton );
SetXToRed( m_pCancelButton );
CExLabel *pTitle = dynamic_cast< CExLabel* >( FindChildByName( "TitleLabel" ) );
if ( pTitle )
{
pTitle->SetText( m_pTitle );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmDialog::PerformLayout()
{
// Center it, keeping requested size
int x, y, ww, wt, wide, tall;
vgui::surface()->GetWorkspaceBounds( x, y, ww, wt );
GetSize(wide, tall);
SetPos(x + ((ww - wide) / 2), y + ((wt - tall) / 2));
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmDialog::OnCommand( const char *command )
{
bool bFinishUp = false;
bool bConfirmed = false;
if ( !Q_strnicmp( command, "cancel", 6 ) )
{
bConfirmed = false;
bFinishUp = true;
}
else if ( !Q_strnicmp( command, "confirm", 7 ) )
{
bConfirmed = true;
bFinishUp = true;
}
if ( bFinishUp )
{
FinishUp();
if ( m_pCallback )
{
m_pCallback( bConfirmed, m_pContext );
}
return;
}
BaseClass::OnCommand( command );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmDialog::SetStringTokens( KeyValues *pKeyValues )
{
if ( m_pKeyValues != NULL )
{
m_pKeyValues->deleteThis();
}
m_pKeyValues = pKeyValues->MakeCopy();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmDialog::AddStringToken( const char* pToken, const wchar_t* pValue )
{
if ( m_pKeyValues == NULL )
{
m_pKeyValues = new KeyValues( "GenericConfirmDialog" );
}
m_pKeyValues->SetWString( pToken, pValue );
InvalidateLayout( false, true );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmDialog::SetContext( void *pContext )
{
m_pContext = pContext;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFGenericConfirmOptOutDialog::CTFGenericConfirmOptOutDialog( const char *pTitle,
const char *pText,
const char *pConfirmBtnText,
const char *pCancelBtnText,
const char *pOptOutText,
const char *pOptOutConVarName,
GenericConfirmDialogCallback callback,
vgui::Panel *parent ) :
CTFGenericConfirmDialog( pTitle, pText, pConfirmBtnText, pCancelBtnText, callback, parent )
{
m_optOutText = pOptOutText;
m_optOutCheckbox = NULL;
m_optOutConVarName = pOptOutConVarName;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmOptOutDialog::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
m_optOutCheckbox = dynamic_cast< vgui::CheckButton * >( FindChildByName( "OptOutCheckbox" ) );
if ( m_optOutCheckbox && m_optOutText )
{
m_optOutCheckbox->SetMouseInputEnabled( true );
m_optOutCheckbox->SetText( m_optOutText );
// center horizontally
vgui::Panel *parent = m_optOutCheckbox->GetParent();
if ( parent )
{
float parentWidth = parent->GetWide();
int checkBoxWidth, checkBoxHeight;
m_optOutCheckbox->GetContentSize( checkBoxWidth, checkBoxHeight );
// fudge in checkbox width
checkBoxWidth += 34.0f;
int checkX, checkY;
m_optOutCheckbox->GetPos( checkX, checkY );
m_optOutCheckbox->SetPos( ( parentWidth - checkBoxWidth ) / 2.0f, checkY );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const char *CTFGenericConfirmOptOutDialog::GetResFile()
{
return "Resource/UI/econ/ConfirmDialogOptOut.res";
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGenericConfirmOptOutDialog::OnButtonChecked( KeyValues *pData )
{
ConVarRef var( m_optOutConVarName );
if ( !var.IsValid() )
return;
if ( !m_optOutCheckbox )
return;
var.SetValue( m_optOutCheckbox->IsSelected() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFUpgradeBoxDialog::OnCommand( const char *command )
{
if ( !Q_stricmp( command, "upgrade" ) )
{
FinishUp();
// Open the store, and show the upgrade advice
EconUI()->CloseEconUI();
EconUI()->OpenStorePanel( STOREPANEL_SHOW_UPGRADESTEPS, false );
}
else
{
BaseClass::OnCommand( command );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFGenericConfirmDialog *ShowConfirmDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, const char *pCancelBtnText, GenericConfirmDialogCallback callback,
vgui::Panel *parent/*=NULL*/, void *pContext/*=NULL*/, const char *pSound/*=NULL*/ )
{
CTFGenericConfirmDialog *pDialog = vgui::SETUP_PANEL(
new CTFGenericConfirmDialog(
pTitle, pText,
pConfirmBtnText, pCancelBtnText,
callback, parent
)
);
if ( pDialog )
{
pDialog->Show();
// Play a sound, if one was supplied.
if ( pSound && pSound[0] )
{
vgui::surface()->PlaySound( pSound );
}
}
if ( pContext )
{
pDialog->SetContext( pContext );
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialog *ShowMessageBox( const char *pTitle, const char *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent, void *pContext )
{
return ShowMessageBox( pTitle, pText, NULL, pConfirmBtnText, callback, parent, pContext );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialog *ShowMessageBox( const char *pTitle, const wchar_t *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent , void *pContext)
{
CTFMessageBoxDialog *pDialog = vgui::SETUP_PANEL(
new CTFMessageBoxDialog(
pTitle, pText,
pConfirmBtnText,
callback, parent
)
);
if ( pDialog )
{
if ( pContext )
{
pDialog->SetContext( pContext );
}
pDialog->Show();
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialog *ShowMessageBox( const char *pTitle, const char *pText, KeyValues *pKeyValues, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent , void *pContext)
{
CTFMessageBoxDialog *pDialog = vgui::SETUP_PANEL( new CTFMessageBoxDialog( pTitle, pText,
pConfirmBtnText,
callback, parent ) );
if ( pDialog )
{
if ( pContext )
{
pDialog->SetContext( pContext );
}
if ( pKeyValues )
{
pDialog->SetStringTokens( pKeyValues );
pDialog->SetDialogVariable( "text", pDialog->GetText() );
}
pDialog->Show();
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose: Pop up a model yes/no dialog with an "opt out" checkbox that persists via a ConVar
//-----------------------------------------------------------------------------
CTFGenericConfirmOptOutDialog *ShowConfirmOptOutDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, const char *pCancelBtnText, const char *pOptOutText, const char *pOptOutConVarName, GenericConfirmDialogCallback callback, vgui::Panel *parent)
{
CTFGenericConfirmOptOutDialog *pDialog = vgui::SETUP_PANEL( new CTFGenericConfirmOptOutDialog( pTitle, pText,
pConfirmBtnText, pCancelBtnText,
pOptOutText, pOptOutConVarName,
callback, parent ) );
if ( pDialog )
{
pDialog->Show();
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialog *ShowUpgradeMessageBox( const char *pTitle, const char *pText,
const char *pConfirmBtnText,
GenericConfirmDialogCallback callback,
vgui::Panel *parent, void *pContext )
{
CTFMessageBoxDialog *pDialog = vgui::SETUP_PANEL(
new CTFUpgradeBoxDialog(
pTitle, pText,
pConfirmBtnText, callback, parent
)
);
if ( pDialog )
{
pDialog->SetContext( pContext );
pDialog->Show();
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose: Pop up a dialog prompting the player to go to the store to upgrade
//-----------------------------------------------------------------------------
CTFMessageBoxDialog *ShowUpgradeMessageBox( const char *pTitle, const char *pText )
{
return ShowUpgradeMessageBox( pTitle, pText, "#GameUI_OK", NULL, NULL, NULL );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialogWithSound *ShowMessageBoxWithSound( const char *pTitle, const char *pText, const char *pszSound, float flDelay, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent, void *pContext )
{
return ShowMessageBoxWithSound( pTitle, pText, NULL, pszSound, flDelay, pConfirmBtnText, callback, parent, pContext );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialogWithSound *ShowMessageBoxWithSound( const char *pTitle, const wchar_t *pText, const char *pszSound, float flDelay, const char *pConfirmBtnText , GenericConfirmDialogCallback callback, vgui::Panel *parent, void *pContext )
{
CTFMessageBoxDialogWithSound *pDialog = vgui::SETUP_PANEL( new CTFMessageBoxDialogWithSound( pTitle, pText, pszSound, flDelay, pConfirmBtnText, callback, parent ) );
if ( pDialog )
{
if ( pContext )
{
pDialog->SetContext( pContext );
}
pDialog->Show();
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialogWithSound *ShowMessageBoxWithSound( const char *pTitle, const char *pText, KeyValues *pKeyValues, const char *pszSound, float flDelay, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent, void *pContext )
{
CTFMessageBoxDialogWithSound *pDialog = vgui::SETUP_PANEL( new CTFMessageBoxDialogWithSound( pTitle, pText, pszSound, flDelay, pConfirmBtnText, callback, parent ) );
if ( pDialog )
{
if ( pContext )
{
pDialog->SetContext( pContext );
}
if ( pKeyValues )
{
pDialog->SetStringTokens( pKeyValues );
pDialog->SetDialogVariable( "text", pDialog->GetText() );
}
pDialog->Show();
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialogWithSound::CTFMessageBoxDialogWithSound( const char *pTitle, const char *pText, const char *pszSound, float flDelay, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent )
: CTFMessageBoxDialog( pTitle, pText, pConfirmBtnText, callback, parent )
{
m_szSound[0] = 0;
if ( pszSound )
{
V_strcpy_safe( m_szSound, pszSound );
}
m_flSoundTime = gpGlobals->curtime + flDelay;
m_bPlayedSound = false;
vgui::ivgui()->AddTickSignal( GetVPanel(), 50 );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFMessageBoxDialogWithSound::CTFMessageBoxDialogWithSound( const char *pTitle, const wchar_t *pText, const char *pszSound, float flDelay, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent )
: CTFMessageBoxDialog( pTitle, pText, pConfirmBtnText, callback, parent )
{
m_szSound[0] = 0;
if ( pszSound )
{
V_strcpy_safe( m_szSound, pszSound );
}
m_flSoundTime = gpGlobals->curtime + flDelay;
m_bPlayedSound = false;
vgui::ivgui()->AddTickSignal( GetVPanel(), 50 );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFMessageBoxDialogWithSound::OnTick()
{
BaseClass::OnTick();
if ( !m_bPlayedSound && ( m_flSoundTime < gpGlobals->curtime ) )
{
m_bPlayedSound = true;
if ( Q_strlen( m_szSound ) > 0 )
{
C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
if ( pLocalPlayer )
{
pLocalPlayer->EmitSound( m_szSound );
}
}
}
}
#ifdef TF_CLIENT_DLL
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFReviveDialog::CTFReviveDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent )
: CTFMessageBoxDialog( pTitle, pText, pConfirmBtnText, callback, parent )
{
m_pTargetHealth = new CTFSpectatorGUIHealth( this, "SpectatorGUIHealth" );
m_pTargetHealth->SetAllowAnimations( false );
m_pTargetHealth->HideHealthBonusImage();
vgui::ivgui()->AddTickSignal( GetVPanel(), 50 );
OnTick();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFReviveDialog::PerformLayout()
{
// Skipping base class
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFReviveDialog::OnTick()
{
BaseClass::OnTick();
if ( !m_pTargetHealth )
return;
if ( !m_hEntity )
return;
float flHealth = m_hEntity->GetHealth();
if ( flHealth != m_flPrevHealth )
{
float flMaxHealth = m_hEntity->GetMaxHealth();
m_pTargetHealth->SetHealth( flHealth, flMaxHealth, flMaxHealth );
m_flPrevHealth = flHealth;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFReviveDialog::SetOwner( CBaseEntity *pEntity )
{
if ( pEntity )
{
m_hEntity = pEntity;
}
}
//-----------------------------------------------------------------------------
// Purpose: In-game dialog that avoids the crosshair area and is much smaller
//-----------------------------------------------------------------------------
CTFReviveDialog *ShowRevivePrompt( CBaseEntity *pOwner,
const char *pTitle,
const char *pText,
const char *pConfirmBtnText,
GenericConfirmDialogCallback callback,
vgui::Panel *parent, void *pContext )
{
CTFReviveDialog *pDialog = vgui::SETUP_PANEL( new CTFReviveDialog( pTitle, pText, pConfirmBtnText, callback, parent ) );
if ( pDialog )
{
if ( pContext )
{
pDialog->SetContext( pContext );
}
pDialog->SetOwner( pOwner );
pDialog->Show();
}
return pDialog;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CEconRequirementDialog::CEconRequirementDialog( const char *pTitle, const char *pTextKey, const char *pItemDefName )
: CTFGenericConfirmDialog( pTitle, pTextKey, NULL, NULL, NULL, NULL )
, m_hItemDef( pItemDefName )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const char *CEconRequirementDialog::GetResFile()
{
return "Resource/UI/MvMEconRequirementDialog.res";
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconRequirementDialog::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
vgui::ImagePanel *pItemImagePanel = dynamic_cast<vgui::ImagePanel *>( FindChildByName( "ItemImagePanel", true ) ); Assert( pItemImagePanel );
Assert( pItemImagePanel );
if ( pItemImagePanel && m_hItemDef )
{
pItemImagePanel->SetImage( CFmtStr( "../%s_large", m_hItemDef->GetInventoryImage() ) );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconRequirementDialog::OnCommand( const char *command )
{
if ( m_hItemDef && !Q_stricmp( command, "show_in_store" ) )
{
FinishUp();
// Open the store, and show the upgrade advice
EconUI()->CloseEconUI();
EconUI()->OpenStorePanel( m_hItemDef->GetDefinitionIndex(), false );
}
else
{
BaseClass::OnCommand( command );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ShowEconRequirementDialog( const char *pTitle, const char *pText, const char *pItemDefName )
{
CEconRequirementDialog *pDialog = vgui::SETUP_PANEL( new CEconRequirementDialog( pTitle, pText, pItemDefName ) );
if ( pDialog )
{
pDialog->Show();
}
}
//-----------------------------------------------------------------------------
// Purpose: Get the correct res file to use (depends on Steam Controller state)
//-----------------------------------------------------------------------------
const char* CTFMessageBoxDialog::GetResFile()
{
if ( ::input->IsSteamControllerActive() )
{
return "Resource/UI/econ/MessageBoxDialog_SC.res";
}
else
{
return "Resource/UI/econ/MessageBoxDialog.res";
}
}
#endif // TF_CLIENT_DLL
-230
View File
@@ -1,230 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef CONFIRM_DIALOG_H
#define CONFIRM_DIALOG_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/CheckButton.h"
#include "inputsystem/iinputsystem.h"
//-----------------------------------------------------------------------------
// Purpose:
// - Basic confirm dialog - derive from this and implement GetText().
// - The user will have two options, essentially yes or no.
// - A "ConfirmDlgResult" message is sent to the parent with the result.
// Check the "confirmed" parameter.
// - Panel deletes itself.
// - See CConfirmDeleteDialog for a generic delete confirmation dialog.
//-----------------------------------------------------------------------------
class CExButton;
#ifdef TF_CLIENT_DLL
class CTFSpectatorGUIHealth;
#endif // TF_CLIENT_DLL
class CConfirmDialog : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CConfirmDialog, vgui::EditablePanel );
public:
CConfirmDialog( vgui::Panel *parent );
virtual const wchar_t *GetText() = 0;
void Show( bool bMakePopup = true );
void SetIconImage( const char *pszIcon );
protected:
virtual void OnSizeChanged(int nNewWide, int nNewTall );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void OnCommand( const char *command );
virtual void OnKeyCodeTyped( vgui::KeyCode code );
virtual void OnKeyCodePressed( vgui::KeyCode code );
virtual const char *GetResFile();
void FinishUp(); // Hide the panel, mark for deletion, remove from modal stack.
CExButton *m_pConfirmButton;
CExButton *m_pCancelButton;
vgui::ImagePanel *m_pIcon;
};
//-----------------------------------------------------------------------------
typedef void (*GenericConfirmDialogCallback)( bool bConfirmed, void *pContext );
// An implementation of the Confirm Dialog that is "generic"
class CTFGenericConfirmDialog : public CConfirmDialog
{
DECLARE_CLASS_SIMPLE( CTFGenericConfirmDialog, CConfirmDialog );
public:
CTFGenericConfirmDialog( const char *pTitle, const char *pTextKey, const char *pConfirmBtnText,
const char *pCancelBtnText, GenericConfirmDialogCallback callback, vgui::Panel *pParent );
CTFGenericConfirmDialog( const char *pTitle, const wchar_t *pText, const char *pConfirmBtnText,
const char *pCancelBtnText, GenericConfirmDialogCallback callback, vgui::Panel *pParent );
virtual ~CTFGenericConfirmDialog();
virtual const wchar_t *GetText();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void PerformLayout();
virtual void OnCommand( const char *command );
void SetStringTokens( KeyValues *pKeyValues );
void AddStringToken( const char* pToken, const wchar_t* pValue );
void SetContext( void *pContext );
protected:
void CommonInit( const char *pTitle, const char *pConfirmBtnText, const char *pCancelBtnText,
GenericConfirmDialogCallback callback, vgui::Panel *pParent );
const char *m_pTitle;
const char *m_pTextKey;
const char *m_pConfirmBtnText;
const char *m_pCancelBtnText;
KeyValues *m_pKeyValues;
wchar_t m_wszBuffer[1024];
GenericConfirmDialogCallback m_pCallback;
void *m_pContext;
};
// A generic message dialog, which is just a generic confirm dialog w/o the cancel button
class CTFMessageBoxDialog : public CTFGenericConfirmDialog
{
DECLARE_CLASS_SIMPLE( CTFMessageBoxDialog, CTFGenericConfirmDialog );
public:
CTFMessageBoxDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent )
: CTFGenericConfirmDialog( pTitle, pText, pConfirmBtnText, NULL, callback, parent ) {}
CTFMessageBoxDialog( const char *pTitle, const wchar_t *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent )
: CTFGenericConfirmDialog( pTitle, pText, pConfirmBtnText, NULL, callback, parent ) {}
virtual const char* GetResFile();
};
// A generic message dialog, which is just a generic confirm dialog w/o the cancel button that plays a sound with optional delay
class CTFMessageBoxDialogWithSound : public CTFMessageBoxDialog
{
DECLARE_CLASS_SIMPLE( CTFMessageBoxDialogWithSound, CTFMessageBoxDialog );
public:
CTFMessageBoxDialogWithSound( const char *pTitle, const char *pText, const char *pszSound, float flDelay, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent );
CTFMessageBoxDialogWithSound( const char *pTitle, const wchar_t *pText, const char *pszSound, float flDelay, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent );
virtual void OnTick() OVERRIDE;
private:
char m_szSound[MAX_PATH];
float m_flSoundTime;
bool m_bPlayedSound;
};
// A dialog with an upgrade button that takes them to the mann co store
class CTFUpgradeBoxDialog : public CTFMessageBoxDialog
{
DECLARE_CLASS_SIMPLE( CTFUpgradeBoxDialog, CTFMessageBoxDialog );
public:
CTFUpgradeBoxDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent )
: CTFMessageBoxDialog( pTitle, pText, pConfirmBtnText, callback, parent ) {}
CTFUpgradeBoxDialog( const char *pTitle, const wchar_t *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent )
: CTFMessageBoxDialog( pTitle, pText, pConfirmBtnText, callback, parent ) {}
virtual const char *GetResFile()
{
return "Resource/UI/UpgradeBoxDialog.res";
}
virtual void OnCommand( const char *command );
};
// An implementation of the Confirm Dialog with a persistant "opt out" checkbox stored via ConVar
class CTFGenericConfirmOptOutDialog : public CTFGenericConfirmDialog
{
DECLARE_CLASS_SIMPLE( CTFGenericConfirmOptOutDialog, CTFGenericConfirmDialog );
public:
CTFGenericConfirmOptOutDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, const char *pCancelBtnText, const char *pOptOutText, const char *pOptOutConVarName, GenericConfirmDialogCallback callback, vgui::Panel *parent ) ;
virtual ~CTFGenericConfirmOptOutDialog() { }
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
MESSAGE_FUNC_PARAMS( OnButtonChecked, "CheckButtonChecked", pData );
protected:
virtual const char *GetResFile();
const char *m_optOutText;
vgui::CheckButton *m_optOutCheckbox;
const char *m_optOutConVarName;
};
#ifdef TF_CLIENT_DLL
// A dialog presented to dead players when being revived
class CTFReviveDialog : public CTFMessageBoxDialog
{
DECLARE_CLASS_SIMPLE( CTFReviveDialog, CTFMessageBoxDialog );
public:
CTFReviveDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent );
virtual ~CTFReviveDialog() { }
virtual void PerformLayout() OVERRIDE;
virtual void OnTick() OVERRIDE;
virtual const char *GetResFile() OVERRIDE { return "Resource/UI/ReviveDialog.res"; }
void SetOwner( CBaseEntity *pEntity );
CTFSpectatorGUIHealth *m_pTargetHealth;
CHandle< C_BaseEntity > m_hEntity;
float m_flPrevHealth;
};
CTFReviveDialog *ShowRevivePrompt( CBaseEntity *pOwner,
const char *pTitle = "#TF_Prompt_Revive_Title",
const char *pText = "#TF_Prompt_Revive_Message",
const char *pConfirmBtnText = "#TF_Prompt_Revive_Cancel",
GenericConfirmDialogCallback callback = NULL,
vgui::Panel *parent = NULL,
void *pContext = NULL );
// A generic message dialog, which is just a generic confirm dialog w/o the cancel button
class CEconRequirementDialog : public CTFGenericConfirmDialog
{
DECLARE_CLASS_SIMPLE( CEconRequirementDialog, CTFGenericConfirmDialog );
public:
CEconRequirementDialog( const char *pTitle, const char *pTextKey, const char *pItemDefName );
virtual const char *GetResFile() OVERRIDE;
virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
virtual void OnCommand( const char *command ) OVERRIDE;
CSchemaItemDefHandle m_hItemDef;
};
void ShowEconRequirementDialog( const char *pTitle, const char *pText, const char *pItemDefName );
#endif // TF_CLIENT_DLL
//-----------------------------------------------------------------------------
CTFGenericConfirmOptOutDialog *ShowConfirmOptOutDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, const char *pCancelBtnText, const char *pOptOutText, const char *pOptOutConVarName, GenericConfirmDialogCallback callback, vgui::Panel *parent = NULL );
//-----------------------------------------------------------------------------
CTFGenericConfirmDialog *ShowConfirmDialog( const char *pTitle, const char *pText, const char *pConfirmBtnText, const char *pCancelBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent = NULL, void *pContext = NULL, const char *pSound = NULL );
//-----------------------------------------------------------------------------
CTFMessageBoxDialog *ShowMessageBox( const char *pTitle, const char *pText, const char *pConfirmBtnText = "#GameUI_OK", GenericConfirmDialogCallback callback = NULL, vgui::Panel *parent = NULL, void *pContext = NULL );
CTFMessageBoxDialog *ShowMessageBox( const char *pTitle, const wchar_t *pText, const char *pConfirmBtnText = "#GameUI_OK", GenericConfirmDialogCallback callback = NULL, vgui::Panel *parent = NULL, void *pContext = NULL );
CTFMessageBoxDialog *ShowMessageBox( const char *pTitle, const char *pText, KeyValues *pKeyValues, const char *pConfirmBtnText = "#GameUI_OK", GenericConfirmDialogCallback callback = NULL, vgui::Panel *parent = NULL, void *pContext = NULL );
CTFMessageBoxDialog *ShowUpgradeMessageBox( const char *pTitle, const char *pText );
CTFMessageBoxDialog *ShowUpgradeMessageBox( const char *pTitle, const char *pText, const char *pConfirmBtnText, GenericConfirmDialogCallback callback, vgui::Panel *parent = NULL, void *pContext = NULL );
//-----------------------------------------------------------------------------
CTFMessageBoxDialogWithSound *ShowMessageBoxWithSound( const char *pTitle, const char *pText, const char *pszSound, float flDelay = 0.0, const char *pConfirmBtnText = "#GameUI_OK", GenericConfirmDialogCallback callback = NULL, vgui::Panel *parent = NULL, void *pContext = NULL );
CTFMessageBoxDialogWithSound *ShowMessageBoxWithSound( const char *pTitle, const wchar_t *pText, const char *pszSound, float flDelay = 0.0, const char *pConfirmBtnText = "#GameUI_OK", GenericConfirmDialogCallback callback = NULL, vgui::Panel *parent = NULL, void *pContext = NULL );
CTFMessageBoxDialogWithSound *ShowMessageBoxWithSound( const char *pTitle, const char *pText, KeyValues *pKeyValues, const char *pszSound, float flDelay = 0.0, const char *pConfirmBtnText = "#GameUI_OK", GenericConfirmDialogCallback callback = NULL, vgui::Panel *parent = NULL, void *pContext = NULL );
#endif // CONFIRM_DIALOG_H
-266
View File
@@ -1,266 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
#include "cbase.h"
#include "econ_item_tools.h"
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
const char *IEconTool::GetUseCommandLocalizationToken( const IEconItemInterface *pItem, int i ) const
{
Assert( i == 0 ); // Default only has 1 use, so this should be 0.
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
// If we have a custom schema-specified use string, use that.
return GetUseString();
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
const char* IEconTool::GetUseCommand( const IEconItemInterface *pItem, int i ) const
{
Assert( i == 0 ); // Default only has 1 use, so this should be 0.
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
const bool bIsGCConsumable = ( ( pItem->GetItemDefinition()->GetCapabilities() & ITEM_CAP_USABLE_GC ) != 0 );
return bIsGCConsumable ? "Context_UseConsumableItem" : "Context_ApplyOnItem";
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
bool IsLocalPlayerWrappedGift( const IEconItemInterface *pItem )
{
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetTypedEconTool<CEconTool_WrappedGift>() );
static CSchemaAttributeDefHandle pAttr_GifterAccountID( "gifter account id" );
uint32 unGifterAccountID;
if ( !pItem->FindAttribute( pAttr_GifterAccountID, &unGifterAccountID ) )
return false;
const uint32 unLocalAccountID = steamapicontext->SteamUser()->GetSteamID().GetAccountID();
return unGifterAccountID == unLocalAccountID;
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
bool CEconTool_WrappedGift::CanBeUsedNow( const IEconItemInterface *pItem ) const
{
static CSchemaItemDefHandle pItemDef_WrappedGiftapultPackage( "Wrapped Giftapult Package" );
static CSchemaItemDefHandle pItemDef_DeliveredGiftapultPackage( "Delivered Giftapult Package" );
static CSchemaItemDefHandle pItemDef_CompetitiveBetaPassGift( "Competitive Matchmaking Beta Giftable Invite" );
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
if ( ( pItem->GetItemDefinition() == pItemDef_WrappedGiftapultPackage ) ||
( pItem->GetItemDefinition() == pItemDef_CompetitiveBetaPassGift ) ||
( pItem->GetItemDefinition() == pItemDef_DeliveredGiftapultPackage ) )
return true;
return pItem->IsTradable();
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
bool CEconTool_WrappedGift::ShouldShowContainedItemPanel( const IEconItemInterface *pItem ) const
{
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
return IsLocalPlayerWrappedGift( pItem );
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
const char *CEconTool_WrappedGift::GetUseCommandLocalizationToken( const IEconItemInterface *pItem, int i ) const
{
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
Assert( i == 0 || ( IsLocalPlayerWrappedGift( pItem ) && i == 1 ) );
// NOTE! Keep in sync with CEconTool_WrappedGift::GetUseCommand
if ( BIsDirectGift() ||
( IsLocalPlayerWrappedGift( pItem ) && i == 0 ) )
return "#DeliverGift";
return "#UnwrapGift";
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
int CEconTool_WrappedGift::GetUseCommandCount( const IEconItemInterface *pItem ) const
{
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
if ( IsLocalPlayerWrappedGift( pItem ) )
return 2;
return 1;
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
const char* CEconTool_WrappedGift::GetUseCommand( const IEconItemInterface *pItem, int i ) const
{
// NOTE! Keep in sync with CEconTool_WrappedGift::GetUseCommandLocalizationToken
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
Assert( i == 0 || ( IsLocalPlayerWrappedGift( pItem ) && i == 1 ) );
// NOTE! Keep in sync with CEconTool_WrappedGift::GetUseCommand
if ( BIsDirectGift() ||
( IsLocalPlayerWrappedGift( pItem ) && i == 0 ) )
return "Context_DeliverItem";
return "Context_UnwrapItem";
}
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
const char *CEconTool_WeddingRing::GetUseCommandLocalizationToken( const IEconItemInterface *pItem, int i ) const
{
Assert( i == 0 ); // We only have one action.
Assert( pItem );
Assert( pItem->GetItemDefinition() );
Assert( pItem->GetItemDefinition()->GetEconTool() == this );
// If the wedding ring has been gifted to us, we can use it to accept/reject the proposal.
// If it hasn't been gifted we can't use it at all.
static CSchemaAttributeDefHandle pAttrDef_GifterAccountID( "gifter account id" );
if ( !pItem->FindAttribute( pAttrDef_GifterAccountID ) )
return NULL;
return "#ToolAction_WeddingRing_AcceptReject";
}
#ifndef TF_CLIENT_DLL
//---------------------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------------------
void CEconTool_Noisemaker::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_Noisemaker::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_WrappedGift::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_WrappedGift::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_WeddingRing::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_WeddingRing::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_BackpackExpander::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_BackpackExpander::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_AccountUpgradeToPremium::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_AccountUpgradeToPremium::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_ClaimCode::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_ClaimCode::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_Collection::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_Collection::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_StrangifierBase::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_StrangifierBase::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_PaintCan::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_PaintCan::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_Gift::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_Gift::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_DuelingMinigame::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_DuelingMinigame::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
void CEconTool_DuckToken::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_DuckToken::OnClientUseConsumable() is unimplemented!" );
}
//-----------------------------------------------------------------------------
void CEconTool_GrantOperationPass::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_DuckToken::CEconTool_GrantOperationPass() is unimplemented!" );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEconTool_Default::OnClientUseConsumable( CEconItemView *pItem, vgui::Panel *pParent ) const
{
Assert( !"CEconTool_Default::OnClientUseConsumable() is unimplemented!" );
}
#endif // !defined( TF_CLIENT_DLL )
File diff suppressed because it is too large Load Diff
-429
View File
@@ -1,429 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef ECON_CONTROLS_H
#define ECON_CONTROLS_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui/IScheme.h>
#include <vgui/KeyCode.h>
#include <KeyValues.h>
#include <vgui/IVGui.h>
#include <vgui_controls/ScrollBar.h>
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/Button.h>
#include <vgui_controls/Label.h>
#include <vgui_controls/RichText.h>
#include <vgui_controls/ImagePanel.h>
#include "utlvector.h"
#include "vgui_controls/PHandle.h"
#include <vgui_controls/Tooltip.h>
#include "GameEventListener.h"
//-----------------------------------------------------------------------------
// Purpose: Changes the visibility of the child panel if it is different.
// Returns true if the child exists, false otherwise.
//-----------------------------------------------------------------------------
bool SetChildPanelVisible( vgui::Panel *pParent, const char *pChildName, bool bVisible, bool bSearchForChildRecursively = false );
//-----------------------------------------------------------------------------
// Purpose: Changes the enable state of the child panel if it is different.
// Returns true if the child exists, false otherwise.
//-----------------------------------------------------------------------------
bool SetChildPanelEnabled( vgui::Panel *pParent, const char *pChildName, bool bEnabled, bool bSearchForChildRecursively = false );
//-----------------------------------------------------------------------------
// Purpose: Changes the selected state of the child button if it is different.
// Returns true if the child exists, false otherwise.
//-----------------------------------------------------------------------------
bool SetChildButtonSelected( vgui::Panel *pParent, const char *pChildName, bool bSelected, bool bSearchForChildRecursively = false );
//-----------------------------------------------------------------------------
// Purpose: Returns true if the child button exists and is selected, false otherwise.
//-----------------------------------------------------------------------------
bool IsChildButtonSelected( vgui::Panel *pParent, const char *pChildName, bool bSearchForChildRecursively = false );
//-----------------------------------------------------------------------------
// Purpose: Adds the child panel as an action signal target. Returns true if the child exists, false otherwise.
//-----------------------------------------------------------------------------
bool AddChildActionSignalTarget( vgui::Panel *pParent, const char *pChildName, vgui::Panel *messageTarget, bool bSearchForChildRecursively = false );
//-----------------------------------------------------------------------------
// Purpose: Modify the color of a label/button's text - if it starts with "X "
// or "x ", set the X to red.
//-----------------------------------------------------------------------------
bool SetXToRed( vgui::Label *pPanel );
//-----------------------------------------------------------------------------
// Purpose: Simple panel tooltip. Just calls setvisible on the other panel.
// Ignores all other input.
//-----------------------------------------------------------------------------
class CSimplePanelToolTip : public vgui::BaseTooltip
{
DECLARE_CLASS_SIMPLE( CSimplePanelToolTip, vgui::BaseTooltip );
public:
CSimplePanelToolTip(vgui::Panel *parent, const char *text = NULL) : vgui::BaseTooltip( parent, text )
{
m_pControlledPanel = NULL;
}
void SetText(const char *text) { return; }
const char *GetText() { return NULL; }
virtual void ShowTooltip( vgui::Panel *currentPanel ) { if ( m_pControlledPanel ) m_pControlledPanel->SetVisible( true ); }
virtual void HideTooltip() { if ( m_pControlledPanel ) m_pControlledPanel->SetVisible( false ); }
void SetControlledPanel( vgui::EditablePanel *pPanel ) { m_pControlledPanel = pPanel; }
protected:
vgui::Panel *m_pControlledPanel;
};
//-----------------------------------------------------------------------------
// Purpose: Expanded Button class that allows font & color overriding in .res files
//-----------------------------------------------------------------------------
class CExButton : public vgui::Button
{
public:
DECLARE_CLASS_SIMPLE( CExButton, vgui::Button );
CExButton( vgui::Panel *parent, const char *name, const char *text, vgui::Panel *pActionSignalTarget = NULL, const char *cmd = NULL );
CExButton( vgui::Panel *parent, const char *name, const wchar_t *wszText, vgui::Panel *pActionSignalTarget = NULL, const char *cmd = NULL );
virtual void ApplySettings( KeyValues *inResourceData );
void SetFontStr( const char *pFont );
void SetColorStr( const char *pColor );
virtual vgui::IBorder *GetBorder(bool depressed, bool armed, bool selected, bool keyfocus);
virtual void OnMouseFocusTicked() OVERRIDE;
virtual void OnCursorEntered() OVERRIDE;
virtual void OnCursorExited() OVERRIDE;
void PassMouseTicksTo( vgui::Panel *pPanel, bool bCursorEnterExitEvent = false )
{
m_hMouseTickTarget.Set( pPanel ? pPanel->GetVPanel() : NULL );
m_bbCursorEnterExitEvent = bCursorEnterExitEvent;
}
private:
char m_szFont[64];
char m_szColor[64];
vgui::IBorder *m_pArmedBorder;
vgui::IBorder *m_pDefaultBorderOverride;
vgui::IBorder *m_pSelectedBorder;
vgui::IBorder *m_pDisabledBorder;
vgui::VPanelHandle m_hMouseTickTarget;
bool m_bbCursorEnterExitEvent;
};
//-----------------------------------------------------------------------------
// Purpose: Expanded image button, that handles images per button state, and color control in the .res file
//-----------------------------------------------------------------------------
class CExImageButton : public CExButton
{
public:
DECLARE_CLASS_SIMPLE( CExImageButton, CExButton );
CExImageButton( vgui::Panel *parent, const char *name, const char *text = "", vgui::Panel *pActionSignalTarget = NULL, const char *cmd = NULL );
CExImageButton( vgui::Panel *parent, const char *name, const wchar_t *wszText = L"", vgui::Panel *pActionSignalTarget = NULL, const char *cmd = NULL );
~CExImageButton( void );
virtual void ApplySettings( KeyValues *inResourceData );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void SetArmed(bool state);
virtual void SetEnabled(bool state);
virtual void SetSelected(bool state);
void SetSubImage( const char *pszImage );
void SetImageDefault( const char *pszImageDefault );
void SetImageArmed( const char *pszImageArmed );
void SetImageSelected( const char *pszImageSelected );
Color GetImageColor( void );
vgui::ImagePanel *GetImage( void ) { return m_pEmbeddedImagePanel; }
private:
// Embedded image panels
vgui::ImagePanel *m_pEmbeddedImagePanel;
Color m_ImageDrawColor;
Color m_ImageArmedColor;
Color m_ImageDisabledColor;
Color m_ImageSelectedColor;
Color m_ImageDepressedColor;
char m_szImageDefault[MAX_PATH];
char m_szImageArmed[MAX_PATH];
char m_szImageSelected[MAX_PATH];
};
//-----------------------------------------------------------------------------
// Purpose: Expanded Label class that allows color control in .res files
//-----------------------------------------------------------------------------
class CExLabel : public vgui::Label
{
public:
DECLARE_CLASS_SIMPLE( CExLabel, vgui::Label );
CExLabel( vgui::Panel *parent, const char *panelName, const char *text );
CExLabel( vgui::Panel *parent, const char *panelName, const wchar_t *wszText );
virtual void ApplySettings( KeyValues *inResourceData );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
void SetColorStr( const char *pColor );
void SetColorStr( Color cColor );
private:
char m_szColor[64];
};
//-----------------------------------------------------------------------------
// Purpose: Expanded Richtext control that allows customization of scrollbar display, font, and color .res controls.
//-----------------------------------------------------------------------------
class CExRichText : public vgui::RichText
{
public:
DECLARE_CLASS_SIMPLE( CExRichText, vgui::RichText );
CExRichText( vgui::Panel *parent, const char *panelName );
virtual void ApplySettings( KeyValues *inResourceData );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void PerformLayout();
virtual void SetText( const char *text );
virtual void SetText( const wchar_t *text );
virtual void OnTick( void );
void SetScrollBarImagesVisible( bool visible );
void SetFontStr( const char *pFont );
void SetColorStr( const char *pColor );
void SetCustomImage( vgui::Panel *pImage, const char *pszImage, char *pszStorage );
void CreateImagePanels( void );
protected:
char m_szFont[64];
char m_szColor[64];
char m_szImageUpArrow[MAX_PATH];
char m_szImageDownArrow[MAX_PATH];
char m_szImageLine[MAX_PATH];
char m_szImageBox[MAX_PATH];
bool m_bUseImageBorders;
CExImageButton *m_pUpArrow;
vgui::Panel *m_pLine;
CExImageButton *m_pDownArrow;
vgui::Panel *m_pBox;
};
//-----------------------------------------------------------------------------
// Purpose: Rich text control that knows how to fill itself with information
// that describes a specific item definition.
//-----------------------------------------------------------------------------
class CRichTextWithScrollbarBorders : public CExRichText
{
public:
DECLARE_CLASS_SIMPLE( CRichTextWithScrollbarBorders, CExRichText );
CRichTextWithScrollbarBorders( vgui::Panel *parent, const char *panelName ) : BaseClass( parent, panelName )
{
m_bUseImageBorders = true;
}
};
//-----------------------------------------------------------------------------
// Purpose: Rich text control that knows how to fill itself with information
// that describes a specific item definition.
//-----------------------------------------------------------------------------
class CEconItemDetailsRichText : public CRichTextWithScrollbarBorders
{
public:
DECLARE_CLASS_SIMPLE( CEconItemDetailsRichText, CRichTextWithScrollbarBorders );
CEconItemDetailsRichText( vgui::Panel *parent, const char *panelName );
virtual void ApplySettings( KeyValues *inResourceData );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
void UpdateDetailsForItem( const CEconItemDefinition *pDef );
void AllowItemSetLinks( bool bAllow ) { m_bAllowItemSetLinks = bAllow; }
void SetLimitedItem( bool bLimited ) { m_bLimitedItem = bLimited; }
private:
void InsertItemLink( const wchar_t *pwzItemName, int nItemIndex, Color *pColorOverride = NULL );
void AddDataText( const char *pszText, bool bAddPostLines = true, const wchar_t *wpszArg = NULL, const wchar_t *wpszArg2 = NULL, const int *pItemDefIndex = NULL );
void DataText_AppendStoreFlags( const CEconItemDefinition *pDef );
void DataText_AppendItemData( const CEconItemDefinition *pDef );
void DataText_AppendBundleData( const CEconItemDefinition *pDef );
void DataText_AppendUsageData( const CEconItemDefinition *pBaseDef );
void DataText_AppendAttributeData( const CEconItemDefinition *pDef );
void DataText_AppendSetData( const CEconItemDefinition *pDef );
void DataText_AppendToolUsage( const CEconItemDefinition *pDef );
void UpdateToolList( void );
private:
Color m_colTextHighlight;
Color m_colItemSet;
Color m_colLink;
bool m_bAllowItemSetLinks;
vgui::HFont m_hLinkFont;
CUtlVector<item_definition_index_t> m_ToolList;
bool m_bLimitedItem;
};
#define EXC_SIDE_TOP 0
#define EXC_SIDE_RIGHT 1
#define EXC_SIDE_BOTTOM 2
#define EXC_SIDE_LEFT 3
//-----------------------------------------------------------------------------
// Purpose: A small callout arrow that's created by a CExplanationPopup to
// connect to the point that the explanation is referring to.
//-----------------------------------------------------------------------------
class CExplanationPopupCalloutArrow : public vgui::Panel
{
public:
CExplanationPopupCalloutArrow( Panel *parent ) : vgui::Panel( parent, "calloutarrow" )
{
SetPaintBackgroundEnabled( false );
SetMouseInputEnabled( false );
PrecacheMaterial( "vgui/callout_tail" );
}
void SetArrowPoints( int iAx, int iAy, int iBx, int iBy, int iCx, int iCy )
{
m_iArrowA[0] = iAx;
m_iArrowA[1] = iAy;
m_iArrowB[0] = iBx;
m_iArrowB[1] = iBy;
m_iArrowC[0] = iCx;
m_iArrowC[1] = iCy;
}
virtual void Paint( void );
private:
int m_iArrowA[2];
int m_iArrowB[2];
int m_iArrowC[2];
};
//-----------------------------------------------------------------------------
// Purpose: A bubble that contains a blob of text and an arrow to a specific place onscreen
//-----------------------------------------------------------------------------
class CExplanationPopup : public vgui::EditablePanel, public CGameEventListener
{
DECLARE_CLASS_SIMPLE( CExplanationPopup, vgui::EditablePanel );
public:
CExplanationPopup(Panel *parent, const char *panelName);
~CExplanationPopup( void );
void SetCalloutInParentsX( int nXPos ) { m_iCalloutInParentsX = nXPos; }
void SetCalloutInParentsY( int nYPos ) { m_iCalloutInParentsY = nYPos; }
void Popup( int iPosition = 0, int iTotalPanels = 0 );
void Hide( int iExplanationDelta = 0 );
const char *GetNextExplanation( void ) { return m_szNextExplanation; }
void SetPrevExplanation( const char *pszPrev );
virtual void ApplySettings( KeyValues *inResourceData );
virtual void OnCommand( const char *command );
virtual void OnTick( void );
virtual void OnKeyCodeTyped( vgui::KeyCode code );
virtual void OnKeyCodePressed( vgui::KeyCode code );
void PositionCallout( float flElapsed );
virtual void FireGameEvent( IGameEvent *event );
private:
int m_iCalloutSide;
float m_flStartTime;
float m_flEndTime;
char m_szNextExplanation[128];
char m_szPrevExplanation[128];
CExplanationPopupCalloutArrow *m_pCallout;
int m_iPositionInChain;
int m_iTotalInChain;
bool m_bFinishedPopup;
CPanelAnimationVar( bool, m_bForceClose, "force_close", "0" );
CPanelAnimationVarAliasType( int, m_iCalloutInParentsX, "callout_inparents_x", "0", "proportional_xpos" );
CPanelAnimationVarAliasType( int, m_iCalloutInParentsY, "callout_inparents_y", "0", "proportional_ypos" );
CPanelAnimationVarAliasType( int, m_iStartX, "start_x", "0", "proportional_xpos" );
CPanelAnimationVarAliasType( int, m_iStartY, "start_y", "0", "proportional_ypos" );
CPanelAnimationVarAliasType( int, m_iStartW, "start_wide", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iStartH, "start_tall", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iEndX, "end_x", "0", "proportional_xpos" );
CPanelAnimationVarAliasType( int, m_iEndY, "end_y", "0", "proportional_ypos" );
CPanelAnimationVarAliasType( int, m_iEndW, "end_wide", "0", "proportional_int" );
CPanelAnimationVarAliasType( int, m_iEndH, "end_tall", "0", "proportional_int" );
};
//-----------------------------------------------------------------------------
// Purpose: A stack to keep track of the modal dialogs that have been popped up.
//-----------------------------------------------------------------------------
class CPanelModalStack
{
public:
void PushModal( vgui::Panel *pDialog );
void PopModal( vgui::Panel *pDialog );
void Update( void );
vgui::VPanelHandle Top();
bool IsEmpty() const;
private:
void PopModal( int iIdx );
private:
CUtlVector<vgui::VPanelHandle> m_pDialogs;
};
CPanelModalStack *TFModalStack( void );
//-----------------------------------------------------------------------------
// Purpose: Generic waiting dialog
//-----------------------------------------------------------------------------
class CGenericWaitingDialog : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CGenericWaitingDialog, vgui::EditablePanel );
public:
CGenericWaitingDialog( vgui::Panel *pParent );
void Close();
void ShowStatusUpdate( bool bAnimateEllipses, bool bAllowClose, float flMaxWaitTime = 0 );
protected:
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void OnCommand( const char *command );
virtual void OnTick( void );
virtual void OnTimeout();
virtual void OnUserClose();
virtual const char *GetResFile() const { return "resource/UI/econ/GenericWaitingDialog.res"; }
virtual const char *GetResFilePathId() const { return "MOD"; }
bool m_bAnimateEllipses;
int m_iNumEllipses;
CountdownTimer m_timer;
};
void ShowWaitingDialog( CGenericWaitingDialog *pWaitingDialog, const char* pUpdateText, bool bAnimate, bool bShowCancel, float flMaxDuration );
void CloseWaitingDialog();
#endif // ECON_CONTROLS_H

Some files were not shown because too many files have changed in this diff Show More