Skip to content

Commit

Permalink
pending: experimental changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercoms committed Mar 19, 2023
1 parent 6e05696 commit 05bf222
Show file tree
Hide file tree
Showing 56 changed files with 335 additions and 169 deletions.
2 changes: 1 addition & 1 deletion src/engine/enginetool.cpp
Expand Up @@ -444,7 +444,7 @@ void CEngineTool::SetGamePaused( bool paused )

float CEngineTool::GetTimescale()
{
return host_timescale.GetFloat();
return host_timescale.GetFloat() ? host_timescale.GetFloat() : 1.0f;
}

void CEngineTool::SetTimescale( float scale )
Expand Down
5 changes: 4 additions & 1 deletion src/engine/host.cpp
Expand Up @@ -585,7 +585,7 @@ static ConVar host_profile( "host_profile","0" );

ConVar host_limitlocal( "host_limitlocal", "0", 0, "Apply cl_cmdrate and cl_updaterate to loopback connection" );
ConVar host_framerate( "host_framerate","0", 0, "Set to lock per-frame time elapse." );
ConVar host_timescale( "host_timescale","1.0", FCVAR_REPLICATED, "Prescale the clock by this amount." );
ConVar host_timescale( "host_timescale","0.0", FCVAR_REPLICATED, "Prescale the clock by this amount." );
ConVar host_speeds( "host_speeds","0", 0, "Show general system running times." ); // set for running times

ConVar host_flush_threshold( "host_flush_threshold", "20", 0, "Memory threshold below which the host should flush caches between server instances" );
Expand Down Expand Up @@ -1758,7 +1758,10 @@ void Host_ReadPreStartupConfiguration()
{
"sv_unlockedchapters", // needed to display the startup graphic while loading
"snd_legacy_surround", // needed to init the sound system
#if defined( _X360 ) || defined( STAGING_ONLY )
"gameui_xbox", // needed to initialize the correct UI
#endif
"cl_hud_minmode", // needed to initialize the correct UI
"save_in_memory" // needed to preread data from the correct location in UI
};

Expand Down
4 changes: 2 additions & 2 deletions src/engine/host.h
Expand Up @@ -149,10 +149,10 @@ extern int host_currentframetick;

// PERFORMANCE INFO
#define MIN_FPS 0.1 // Host minimum fps value for maxfps.
#define MAX_FPS 1000.0 // Upper limit for maxfps.
#define MAX_FPS 10000.0 // Upper limit for maxfps.

#define MAX_FRAMETIME 0.1
#define MIN_FRAMETIME 0.001
#define MIN_FRAMETIME 0.0001

#define TIME_TO_TICKS( dt ) ( (int)( 0.5f + (float)(dt) / host_state.interval_per_tick ) )
#define TICKS_TO_TIME( dt ) ( host_state.interval_per_tick * (float)(dt) )
Expand Down
20 changes: 10 additions & 10 deletions src/engine/l_studio.cpp
Expand Up @@ -2785,11 +2785,11 @@ struct rbatch_t
// ----------------------------------------
*/

inline int FindModel( const CUtlVector<rmodel_t> &list, const model_t *pModel )
inline int FindModel( const rmodel_t* pList, int listCount, const model_t* pModel )
{
for ( int j = list.Count(); --j >= 0 ; )
for ( int j = listCount; --j >= 0 ; )
{
if ( list[j].pModel == pModel )
if ( pList[j].pModel == pModel )
return j;
}
return -1;
Expand All @@ -2806,13 +2806,13 @@ int CModelRender::DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int c
#ifndef SWDS
MDLCACHE_CRITICAL_SECTION_( g_pMDLCache );
CMatRenderContextPtr pRenderContext( materials );
const int MAX_OBJECTS = 1024;
const int MAX_OBJECTS = 2048;
CUtlSortVector<robject_t, CRobjectLess> objectList(0, MAX_OBJECTS);
CUtlVector<rmodel_t> modelList(0,256);
CUtlVector<short> lightObjects(0,256);
CUtlVector<short> shadowObjects(0,64);
CUtlVector<rdecalmodel_t> decalObjects(0,64);
CUtlVector<LightingState_t> lightStates(0,256);
CUtlVectorFixedGrowable<rmodel_t, 256> modelList;
CUtlVectorFixedGrowable<short, 256> lightObjects;
CUtlVectorFixedGrowable<short, 64> shadowObjects;
CUtlVectorFixedGrowable<rdecalmodel_t, 64> decalObjects;
CUtlVectorFixedGrowable<LightingState_t, 256> lightStates;
bool bForceCubemap = r_showenvcubemap.GetBool();
int drawnCount = 0;
int forcedLodSetting = r_lod.GetInt();
Expand All @@ -2826,7 +2826,7 @@ int CModelRender::DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int c
{
drawnCount++;
// UNDONE: This is a perf hit in some scenes! Use a hash?
int modelIndex = FindModel( modelList, pProps[i].pModel );
int modelIndex = FindModel( modelList.Base(), modelList.Count(), pProps[i].pModel );
if ( modelIndex < 0 )
{
modelIndex = modelList.AddToTail();
Expand Down
8 changes: 1 addition & 7 deletions src/engine/modelloader.cpp
Expand Up @@ -62,13 +62,7 @@

ConVar mat_loadtextures( "mat_loadtextures", "1", FCVAR_CHEAT );

// OS X and Linux are blowing up right now due to this. Benefits vs possible regressions on DX less clear.
#if defined( DX_TO_GL_ABSTRACTION ) || defined( STAGING_ONLY )
#define CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH "1"
#else
#define CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH "0"
#endif
static ConVar mod_offline_hdr_switch( "mod_offline_hdr_switch", CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH, FCVAR_INTERNAL_USE,
static ConVar mod_offline_hdr_switch( "mod_offline_hdr_switch", "1", FCVAR_INTERNAL_USE,
"Re-order the HDR/LDR mode switch to do most of the material system "
"reloading with the device offline. This reduces unnecessary device "
"resource uploads and may drastically reduce load time and memory pressure "
Expand Down
10 changes: 9 additions & 1 deletion src/engine/net_ws.cpp
Expand Up @@ -2960,7 +2960,15 @@ void NET_SetTime( double flRealtime )
}

// adjust network time so fakelag works with host_timescale
net_time += frametime * host_timescale.GetFloat();
const float timescale = host_timescale.GetFloat();
if (timescale > 0)
{
net_time += frametime * timescale;
}
else
{
net_time += frametime;
}
}

/*
Expand Down
6 changes: 4 additions & 2 deletions src/engine/vgui_baseui_interface.cpp
Expand Up @@ -124,7 +124,9 @@ IGameConsole *staticGameConsole = NULL;
bool s_bWindowsInputEnabled = true;

ConVar r_drawvgui( "r_drawvgui", "1", FCVAR_CHEAT, "Enable the rendering of vgui panels" );
#if defined( _X360 ) || defined( STAGING_ONLY )
ConVar gameui_xbox( "gameui_xbox", "0", 0 );
#endif

void Con_CreateConsolePanel( vgui::Panel *parent );
void CL_CreateEntityReportPanel( vgui::Panel *parent );
Expand Down Expand Up @@ -2142,11 +2144,11 @@ void VGui_FindNamedPanels( CUtlVector< vgui::VPANEL >& panelList, char const *pa
VGui_RecursiveFindPanels( panelList, embedded, panelname );
}

CON_COMMAND( vgui_togglepanel, "show/hide vgui panel by name." )
CON_COMMAND_F( vgui_togglepanel, "show/hide vgui panel by name.", FCVAR_CHEAT )
{
if ( args.ArgC() < 2 )
{
ConMsg( "Usage: vgui_showpanel panelname\n" );
ConMsg( "Usage: vgui_togglepanel panelname\n" );
return;
}

Expand Down
2 changes: 2 additions & 0 deletions src/game/client/c_vguiscreen.cpp
Expand Up @@ -650,6 +650,8 @@ C_BaseEntity *FindNearbyVguiScreen( const Vector &viewPosition, const QAngle &vi
// X360TBD: Turn this on if feature actually used
return NULL;
}
// Feature not used, causes crashes if entity exists anyway...
return NULL;

C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();

Expand Down
6 changes: 3 additions & 3 deletions src/game/client/game_controls/MapOverview.cpp
Expand Up @@ -1019,7 +1019,7 @@ void CMapOverview::SetMode(int mode)
{
ShowPanel( false );

g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapOff" );
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapOff", true, true );
}
else if ( mode == MAP_MODE_INSET )
{
Expand All @@ -1041,7 +1041,7 @@ void CMapOverview::SetMode(int mode)

if ( mode != m_nMode && RunHudAnimations() )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapZoomToSmall" );
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapZoomToSmall", true, true );
}
}
else if ( mode == MAP_MODE_FULL )
Expand All @@ -1061,7 +1061,7 @@ void CMapOverview::SetMode(int mode)

if ( mode != m_nMode && RunHudAnimations() )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapZoomToLarge" );
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapZoomToLarge", true, true );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/game/client/game_controls/baseviewport.cpp
Expand Up @@ -79,7 +79,7 @@ void hud_autoreloadscript_callback( IConVar *var, const char *pOldValue, float f

static ConVar cl_leveloverviewmarker( "cl_leveloverviewmarker", "0", FCVAR_CHEAT );

CON_COMMAND( showpanel, "Shows a viewport panel <name>" )
CON_COMMAND_F( showpanel, "Shows a viewport panel <name>", FCVAR_CHEAT )
{
if ( !gViewPortInterface )
return;
Expand All @@ -90,7 +90,7 @@ CON_COMMAND( showpanel, "Shows a viewport panel <name>" )
gViewPortInterface->ShowPanel( args[ 1 ], true );
}

CON_COMMAND( hidepanel, "Hides a viewport panel <name>" )
CON_COMMAND_F( hidepanel, "Hides a viewport panel <name>", FCVAR_CHEAT )
{
if ( !gViewPortInterface )
return;
Expand Down
6 changes: 3 additions & 3 deletions src/game/client/hud_base_account.cpp
Expand Up @@ -28,7 +28,7 @@ void CHudBaseAccount::LevelInit( void )
m_pszLastAnimationName = NULL;
m_pszQueuedAnimationName = NULL;

GetAnimationController()->StartAnimationSequence("AccountMoneyInvisible");
GetAnimationController()->StartAnimationSequence(this, "AccountMoneyInvisible", true, true);
}

void CHudBaseAccount::ApplySchemeSettings(vgui::IScheme *pScheme)
Expand Down Expand Up @@ -91,14 +91,14 @@ void CHudBaseAccount::Paint()
{
m_pszLastAnimationName = "AccountMoneyAdded";
}
GetAnimationController()->StartAnimationSequence( m_pszLastAnimationName );
GetAnimationController()->StartAnimationSequence( this, m_pszLastAnimationName, true, true );
m_flLastAnimationEnd = gpGlobals->curtime + GetAnimationController()->GetAnimationSequenceLength( m_pszLastAnimationName );

m_iPreviousAccount = account;
}
else if ( m_pszQueuedAnimationName )
{
GetAnimationController()->StartAnimationSequence( m_pszQueuedAnimationName );
GetAnimationController()->StartAnimationSequence( this, m_pszQueuedAnimationName, true, true );
m_pszQueuedAnimationName = NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/client/hud_controlpointicons.cpp
Expand Up @@ -551,7 +551,7 @@ void CControlPointIcon::PerformLayout( void )
if ( m_pCapNumPlayers )
{
m_pCapNumPlayers->SetVisible( (iPlayers>1) );
SetDialogVariable( "numcappers", iPlayers );
SetDialogVariable( "numcappers", iPlayers, false );

m_pCapNumPlayers->SetFgColor( Color(0,0,0,255) );
}
Expand Down
12 changes: 6 additions & 6 deletions src/game/client/menu.cpp
Expand Up @@ -256,12 +256,12 @@ void CHudMenu::SelectMenuItem( int menu_item )

m_nSelectedItem = menu_item;
// Pulse the selection
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuPulse");
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuPulse", true, true);

// remove the menu quickly
m_bMenuTakesInput = false;
m_flShutoffTime = gpGlobals->realtime + m_flOpenCloseTime;
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuClose");
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuClose", true, true);
}
}

Expand Down Expand Up @@ -365,7 +365,7 @@ void CHudMenu::HideMenu( void )
{
m_bMenuTakesInput = false;
m_flShutoffTime = gpGlobals->realtime + m_flOpenCloseTime;
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuClose");
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuClose", true, true);
}

//-----------------------------------------------------------------------------
Expand All @@ -384,7 +384,7 @@ void CHudMenu::ShowMenu( const char * menuName, int validSlots )

Q_strncpy( g_szPrelocalisedMenuString, menuName, sizeof( g_szPrelocalisedMenuString ) );

g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuOpen");
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuOpen", true, true);
m_nSelectedItem = -1;

// we have the whole string, so we can localise it now
Expand All @@ -409,7 +409,7 @@ void CHudMenu::ShowMenu_KeyValueItems( KeyValues *pKV )
m_fWaitingForMore = 0;
m_bitsValidSlots = 0;

g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuOpen");
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuOpen", true, true);
m_nSelectedItem = -1;

g_szMenuString[0] = '\0';
Expand Down Expand Up @@ -489,7 +489,7 @@ void CHudMenu::MsgFunc_ShowMenu( bf_read &msg)

if ( !NeedMore )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuOpen");
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuOpen", true, true);
m_nSelectedItem = -1;

// we have the whole string, so we can localise it now
Expand Down
24 changes: 20 additions & 4 deletions src/game/client/tf/c_tf_player.cpp
Expand Up @@ -2922,7 +2922,9 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
}

C_BaseEntity *pBaseEntity = pRend->GetIClientUnknown()->GetBaseEntity();
const CEconItemView *pItem = dynamic_cast< CEconItemView* >( pRend );
CEconItemView *pItem = dynamic_cast< CEconItemView* >( pRend );

CEconItemViewDataCacher itemDataCacher(pItem);

uint32 unAttrValue = 0;
uint32 unEffectValue = 0;
Expand Down Expand Up @@ -2974,6 +2976,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
if ( pWearable )
{
pItem = pWearable->GetAttributeContainer()->GetItem();
itemDataCacher.SetItem(pItem);
pTFPlayer = ToTFPlayer( pWearable->GetOwnerEntity() );
break;
}
Expand All @@ -2983,6 +2986,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
if ( pModel->GetOuter() )
{
pItem = pModel->GetOuter()->GetAttributeContainer()->GetItem();
itemDataCacher.SetItem(pItem);
pBaseEntity = pBaseEntity->GetOwnerEntity();
if ( pItem )
{
Expand All @@ -3005,6 +3009,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
if ( pWeapon )
{
pItem = pWeapon->GetAttributeContainer()->GetItem();
itemDataCacher.SetItem(pItem);
pBaseEntity = pWeapon;
}
bIsFirstPerson = true;
Expand All @@ -3017,6 +3022,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
if ( pWeapon )
{
pItem = pWeapon->GetAttributeContainer()->GetItem();
itemDataCacher.SetItem(pItem);
pBaseEntity = pWeapon;
}
}
Expand All @@ -3025,6 +3031,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
else
{
pItem = pWeapon->GetAttributeContainer()->GetItem();
itemDataCacher.SetItem(pItem);
pBaseEntity = pWeapon;
pTFPlayer = ToTFPlayer( pWeapon->GetOwner() );
}
Expand All @@ -3046,6 +3053,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
if ( pTFPlayer && pTFPlayer->m_Shared.GetDisguiseWeapon() )
{
pItem = pTFPlayer->m_Shared.GetDisguiseWeapon()->GetAttributeContainer()->GetItem();
itemDataCacher.SetItem(pItem);
pBaseEntity = pTFPlayer->m_Shared.GetDisguiseWeapon();
}
}
Expand Down Expand Up @@ -3170,11 +3178,13 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy
int iShaderIndex = sheenParams.m_iShaderIndex;

// Australium weapons always use iShaderIndex 1
pItem->CacheSOCData();
const CEconStyleInfo *pStyle = pItem->GetStaticData()->GetStyleInfo( pItem->GetItemStyle() );
if ( pStyle && !pStyle->IsSelectable() )
{
iShaderIndex = 1;
}
pItem->UncacheSOCData();

#ifdef STAGING_ONLY
if ( tf_sheen_shader_override.GetInt() > 0 )
Expand Down Expand Up @@ -3728,6 +3738,8 @@ class CWeaponSkinProxy : public IMaterialProxy
if ( !pItem )
return;

CEconItemViewDataCacher dataCacher(pItem);

C_TFPlayer *pOwner = GetOwnerFromProxyEntity( pC_BaseEntity );
int desiredW = m_pBaseTextureOrig->GetActualWidth();
int desiredH = m_pBaseTextureOrig->GetActualHeight();
Expand Down Expand Up @@ -7493,8 +7505,8 @@ void C_TFPlayer::UpdateIDTarget()

trace_t tr;
Vector vecStart, vecEnd;
VectorMA( MainViewOrigin(), MAX_TRACE_LENGTH, MainViewForward(), vecEnd );
VectorMA( MainViewOrigin(), 10, MainViewForward(), vecStart );
VectorMA( MainViewOrigin(), 8192.0f, MainViewForward(), vecEnd );
VectorMA( MainViewOrigin(), 10.0f, MainViewForward(), vecStart );

// If we're in observer mode, ignore our observer target. Otherwise, ignore ourselves.
if ( IsObserver() )
Expand All @@ -7511,7 +7523,11 @@ void C_TFPlayer::UpdateIDTarget()
iReviveMedic = 1;
}

int nMask = MASK_SOLID | CONTENTS_DEBRIS;
int nMask = MASK_SOLID;
if ( iReviveMedic == 1)
{
nMask |= CONTENTS_DEBRIS;
}
UTIL_TraceLine( vecStart, vecEnd, nMask, this, COLLISION_GROUP_NONE, &tr );
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/client/tf/tf_hud_arena_vs_panel.cpp
Expand Up @@ -121,7 +121,7 @@ void CHudArenaVsPanel::FireGameEvent( IGameEvent * event )

if ( m_bVisible )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "ArenaVsPanelOnShow" );
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "ArenaVsPanelOnShow", true, true );

m_flHideTime = gpGlobals->curtime + 10.0f;

Expand Down

0 comments on commit 05bf222

Please sign in to comment.