Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/game/client/achievement_notification_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,22 @@ void CAchievementNotificationPanel::FireGameEvent( IGameEvent * event )
if ( IsPC() )
{
// shouldn't ever get achievement progress if steam not running and user logged in, but check just in case
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( !SteamUserStats() )
#else
if ( !SteamUserStats() )
#endif
{
Msg( "Steam not running, achievement progress notification not displayed\n" );
}
else
{
// use Steam to show achievement progress UI
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
SteamUserStats()->IndicateAchievementProgress( pchName, iCur, iMax );
#else
SteamUserStats()->IndicateAchievementProgress( pchName, iCur, iMax );
#endif
}
}
else
Expand Down
11 changes: 10 additions & 1 deletion src/game/client/cdll_client_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,18 @@ bool InitGameSystems( CreateInterfaceFn appSystemFactory )

// SteamUtils wasn't ready yet when we initialized the ConVar, so check it again
extern ConVar rd_represented_country;
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( SteamUtils() && rd_represented_country.GetString()[0] == '\0' )
#else
if ( SteamUtils() && rd_represented_country.GetString()[0] == '\0' )
#endif
{
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
rd_represented_country.SetValue( SteamUtils()->GetIPCountry() );
#else
rd_represented_country.SetValue( SteamUtils()->GetIPCountry() );
#endif
}

// Load the ClientScheme just once
vgui::scheme()->LoadSchemeFromFileEx( VGui_GetFullscreenRootVPANEL(), "resource/ClientScheme.res", "ClientScheme");
Expand Down Expand Up @@ -3075,4 +3085,3 @@ class CClientMaterialSystem : public IClientMaterialSystem
static CClientMaterialSystem s_ClientMaterialSystem;
IClientMaterialSystem *g_pClientMaterialSystem = &s_ClientMaterialSystem;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CClientMaterialSystem, IClientMaterialSystem, VCLIENTMATERIALSYSTEM_INTERFACE_VERSION, s_ClientMaterialSystem );

12 changes: 12 additions & 0 deletions src/game/client/game_controls/ClientScoreBoardDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,17 +551,29 @@ bool CClientScoreBoardDialog::GetPlayerScoreInfo(int playerIndex, KeyValues *kv)
void CClientScoreBoardDialog::UpdatePlayerAvatar( int playerIndex, KeyValues *kv )
{
// Update their avatar
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( kv && ShowAvatars() && SteamFriends() && SteamUtils() )
#else
if ( kv && ShowAvatars() && SteamFriends() && SteamUtils() )
#endif
{
player_info_t pi;
if ( engine->GetPlayerInfo( playerIndex, &pi ) )
{
if ( pi.friendsID )
{
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
CSteamID steamIDForPlayer( pi.friendsID, 1, SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
#else
CSteamID steamIDForPlayer( pi.friendsID, 1, SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
#endif

// See if the avatar's changed
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
int iAvatar = SteamFriends()->GetSmallFriendAvatar( steamIDForPlayer );
#else
int iAvatar = SteamFriends()->GetSmallFriendAvatar( steamIDForPlayer );
#endif
if ( m_iImageAvatars[playerIndex] != iAvatar )
{
m_iImageAvatars[playerIndex] = iAvatar;
Expand Down
4 changes: 4 additions & 0 deletions src/game/client/swarm/asw_briefing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,11 @@ CSteamID CASW_Briefing::GetCommanderSteamID( int nLobbySlot )
{
if ( pi.friendsID )
{
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
CSteamID steamIDForPlayer( pi.friendsID, 1, SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
#else
CSteamID steamIDForPlayer( pi.friendsID, 1, SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
#endif
return steamIDForPlayer;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/game/client/swarm/asw_in_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,11 @@ void CASWInput::Init_All( void )
CInput::Init_All();
m_iOrderingMarine = 0;

#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( IsX360() || ( SteamUtils() && SteamUtils()->IsSteamInBigPictureMode() ) )
#else
if ( IsX360() || ( SteamUtils() && SteamUtils()->IsSteamInBigPictureMode() ) )
#endif
{
EngageControllerMode();
SetControllerModeMouse( true );
Expand Down
27 changes: 25 additions & 2 deletions src/game/client/swarm/asw_medal_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,25 @@ void C_ASW_Medal_Store::LoadMedalStore()
#if defined(NO_STEAM)
AssertMsg( false, "SteamCloud not available." );
#else
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
ISteamRemoteStorage *pRemoteStorage = SteamRemoteStorage();
#else
ISteamRemoteStorage *pRemoteStorage = SteamRemoteStorage();
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
ISteamUser *pSteamUser = SteamUser();
#else
ISteamUser *pSteamUser = SteamUser();
#endif
if ( !pSteamUser )
return;

char szMedalFile[256];
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
Q_snprintf( szMedalFile, sizeof( szMedalFile ), "cfg/clientc_%I64u.dat", pSteamUser->GetSteamID().ConvertToUint64() );
#else
Q_snprintf( szMedalFile, sizeof( szMedalFile ), "cfg/clientc_%I64u.dat", pSteamUser->GetSteamID().ConvertToUint64() );
#endif
int len = Q_strlen( szMedalFile );
for ( int i = 0; i < len; i++ )
{
Expand Down Expand Up @@ -347,12 +359,20 @@ bool C_ASW_Medal_Store::SaveMedalStore()
}
UTIL_EncodeICE( ( unsigned char * )buf.Base(), buf.TellPut(), g_ucMedalStoreEncryptionKey );

#if defined( STEAMAPPS_INTERFACE_VERSION008 )
ISteamUser *pSteamUser = SteamUser();
#else
ISteamUser *pSteamUser = SteamUser();
#endif
if ( !pSteamUser )
return false;

char szMedalFile[256];
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
Q_snprintf( szMedalFile, sizeof( szMedalFile ), "cfg/clientc_%I64u.dat", pSteamUser->GetSteamID().ConvertToUint64() );
#else
Q_snprintf( szMedalFile, sizeof( szMedalFile ), "cfg/clientc_%I64u.dat", pSteamUser->GetSteamID().ConvertToUint64() );
#endif
int len = Q_strlen( szMedalFile );
for ( int i = 0; i < len; i++ )
{
Expand All @@ -365,8 +385,12 @@ bool C_ASW_Medal_Store::SaveMedalStore()
{
#if defined(NO_STEAM)
AssertMsg( false, "SteamCloud not available." );
#else
#else
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
ISteamRemoteStorage *pRemoteStorage = SteamRemoteStorage();
#else
ISteamRemoteStorage *pRemoteStorage = SteamRemoteStorage();
#endif

if ( asw_steam_cloud.GetBool() && pRemoteStorage )
{
Expand Down Expand Up @@ -894,4 +918,3 @@ int C_ASW_Medal_Store::GetPromotion()
}
return m_iPromotion;
}

9 changes: 8 additions & 1 deletion src/game/client/swarm/asw_view_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,17 @@ bool CLanguagePreferenceProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues
}

const char *szTextureName = pKeyValues->GetString( "default", NULL );
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( SteamApps() )
{
szTextureName = pKeyValues->GetString( SteamApps()->GetCurrentGameLanguage(), szTextureName);
}
#else
if ( SteamApps() )
{
szTextureName = pKeyValues->GetString( SteamApps()->GetCurrentGameLanguage(), szTextureName);
}
#endif

if ( !szTextureName )
{
Expand Down Expand Up @@ -620,4 +627,4 @@ void CASWViewRender::PerformNightVisionEffect( const CViewSetup &setup )
render->ViewDrawFade( overlaycolor, pMaterial );
}
}
}
}
14 changes: 13 additions & 1 deletion src/game/client/swarm/c_asw_campaign_save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,20 @@ bool GetFileFromRemoteStorage( ISteamRemoteStorage *pRemoteStorage, const char *
bool bSuccess = false;

// check if file exists in Steam Cloud first
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
int32 nFileSize = pRemoteStorage->GetFileSize( pszRemoteFileName );
#else
int32 nFileSize = pRemoteStorage->GetFileSize( pszRemoteFileName );
#endif

if ( nFileSize > 0 )
{
CUtlMemory<char> buf( 0, nFileSize );
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( pRemoteStorage->FileRead( pszRemoteFileName, buf.Base(), nFileSize ) == nFileSize )
#else
if ( pRemoteStorage->FileRead( pszRemoteFileName, buf.Base(), nFileSize ) == nFileSize )
#endif
{
FileHandle_t hFile = g_pFullFileSystem->Open( pszLocalFileName, "wb", "MOD" );
if( hFile )
Expand Down Expand Up @@ -123,7 +131,11 @@ bool WriteFileToRemoteStorage( ISteamRemoteStorage *pRemoteStorage, const char *
byte *pBuffer = (byte*) malloc( unSize );
if ( g_pFullFileSystem->Read( pBuffer, unSize, hFile ) == (int) unSize )
{
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
bSuccess = pRemoteStorage->FileWrite( pszRemoteFileName, pBuffer, unSize );
#else
bSuccess = pRemoteStorage->FileWrite( pszRemoteFileName, pBuffer, unSize );
#endif
}
free( pBuffer );
g_pFullFileSystem->Close( hFile );
Expand All @@ -143,4 +155,4 @@ bool WriteFileToRemoteStorage( ISteamRemoteStorage *pRemoteStorage, const char *
}

return bSuccess;
}
}
40 changes: 40 additions & 0 deletions src/game/client/swarm/c_asw_concommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,23 @@ ConCommand asw_debug_spectator( "asw_debug_spectator", asw_debug_spectator_f, "P
// TODO: Remove this before ship?
void reset_steam_stats_f()
{
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
Assert( SteamUserStats() );
#else
Assert( SteamUserStats() );
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( !SteamUserStats() )
#else
if ( !SteamUserStats() )
#endif
return;

#if defined( STEAMAPPS_INTERFACE_VERSION008 )
SteamUserStats()->ResetAllStats( false );
#else
SteamUserStats()->ResetAllStats( false );
#endif

C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
if ( pPlayer )
Expand All @@ -829,20 +841,48 @@ void rd_reset_level_and_promotion_f()
{
Msg( "Resetting your level and promotion...\n" );

#if defined( STEAMAPPS_INTERFACE_VERSION008 )
Assert( SteamUserStats() );
#else
Assert( SteamUserStats() );
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
if ( !SteamUserStats() )
#else
if ( !SteamUserStats() )
#endif
{
Msg( "Error. Cannot access SteamUserStats()\n" );
return;
}

int32 m_iExperience = 0, m_iPromotion = 0;

#if defined( STEAMAPPS_INTERFACE_VERSION008 )
SteamUserStats()->SetStat( "experience", m_iExperience );
#else
SteamUserStats()->SetStat( "experience", m_iExperience );
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
SteamUserStats()->SetStat( "promotion", m_iPromotion );
#else
SteamUserStats()->SetStat( "promotion", m_iPromotion );
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
SteamUserStats()->SetStat( "level", 1 );
#else
SteamUserStats()->SetStat( "level", 1 );
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
SteamUserStats()->SetStat( "level.xprequired", 0 );
#else
SteamUserStats()->SetStat( "level.xprequired", 0 );
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
SteamUserStats()->StoreStats();
#else
SteamUserStats()->StoreStats();
#endif

C_ASW_Medal_Store *pStore = GetMedalStore();

Expand Down
4 changes: 4 additions & 0 deletions src/game/client/swarm/c_asw_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2992,7 +2992,11 @@ CSteamID C_ASW_Player::GetSteamID()
{
if ( pi.friendsID )
{
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
CSteamID steamIDForPlayer( pi.friendsID, 1, SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
#else
CSteamID steamIDForPlayer( pi.friendsID, 1, SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
#endif
return steamIDForPlayer;
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/game/client/swarm/c_asw_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,16 @@ class C_ASW_Player : public C_BasePlayer, public IASWPlayerAnimStateHelpers
CUtlVector<int> m_aNonLocalPlayerAchievementsEarned; // list of achievements earned by this non-local player

#if !defined(NO_STEAM)
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
STEAM_CALLBACK( C_ASW_Player, Steam_OnUserStatsReceived, UserStatsReceived_t );
#else
STEAM_CALLBACK( C_ASW_Player, Steam_OnUserStatsReceived, UserStatsReceived_t );
#endif
#if defined( STEAMAPPS_INTERFACE_VERSION008 )
STEAM_CALLBACK( C_ASW_Player, Steam_OnUserStatsStored, UserStatsStored_t );
#else
STEAM_CALLBACK( C_ASW_Player, Steam_OnUserStatsStored, UserStatsStored_t );
#endif
#endif

int m_iChallengeScratch;
Expand Down
Loading