game: make achievements work without steam

This commit is contained in:
nillerusr
2022-04-16 13:08:46 +03:00
parent ab5c1c0b3a
commit a5e9cdcbe2
5 changed files with 44 additions and 28 deletions
+8 -3
View File
@@ -950,8 +950,8 @@ void CAchievementMgr::AwardAchievement( int iAchievementID )
SetDirty( true );
if ( IsPC() )
{
#ifndef NO_STEAM
{
#ifndef DISABLE_STEAM
if ( steamapicontext->SteamUserStats() )
{
VPROF_BUDGET( "AwardAchievement", VPROF_BUDGETGROUP_STEAM );
@@ -963,8 +963,9 @@ void CAchievementMgr::AwardAchievement( int iAchievementID )
m_AchievementsAwarded.AddToTail( iAchievementID );
}
}
m_AchievementsAwarded.AddToTail( iAchievementID );
#endif
}
}
else if ( IsX360() )
{
#ifdef _X360
@@ -1033,12 +1034,16 @@ extern bool IsInCommentaryMode( void );
//-----------------------------------------------------------------------------
bool CAchievementMgr::CheckAchievementsEnabled()
{
return true;
// if PC, Steam must be running and user logged in
#ifndef DISABLE_STEAM
if ( IsPC() && !LoggedIntoSteam() )
{
Msg( "Achievements disabled: Steam not running.\n" );
return false;
}
#endif
#if defined( _X360 )
uint state = XUserGetSigninState( XBX_GetPrimaryUserId() );
+14 -17
View File
@@ -231,7 +231,7 @@ void CBaseAchievement::IncrementCount( int iOptIncrement )
Msg( "Achievement count increased for %s: %d/%d\n", GetName(), m_iCount, m_iGoal );
}
#ifndef NO_STEAM
#ifndef DISABLE_STEAM
// if this achievement's progress should be stored in Steam, set the steam stat for it
if ( StoreProgressInSteam() && steamapicontext->SteamUserStats() )
{
@@ -255,7 +255,7 @@ void CBaseAchievement::IncrementCount( int iOptIncrement )
AwardAchievement();
}
else
{
{
HandleProgressUpdate();
}
}
@@ -275,20 +275,16 @@ void CBaseAchievement::SetShowOnHUD( bool bShow )
void CBaseAchievement::HandleProgressUpdate()
{
// if we've hit the right # of progress steps to show a progress notification, show it
if ( ( m_iProgressMsgIncrement > 0 ) && m_iCount >= m_iProgressMsgMinimum && ( 0 == ( m_iCount % m_iProgressMsgIncrement ) ) )
// which notification is this
int iProgress = m_iCount / m_iProgressMsgIncrement;
// if we haven't already shown this progress step, show it
if ( iProgress > m_iProgressShown || m_iCount == 1 )
{
// which notification is this
int iProgress = m_iCount / m_iProgressMsgIncrement;
// if we haven't already shown this progress step, show it
if ( iProgress > m_iProgressShown )
{
ShowProgressNotification();
// remember progress step shown so we don't show it again if the player loads an earlier save game
// and gets past this point again
m_iProgressShown = iProgress;
m_pAchievementMgr->SetDirty( true );
}
ShowProgressNotification();
// remember progress step shown so we don't show it again if the player loads an earlier save game
// and gets past this point again
m_iProgressShown = iProgress;
m_pAchievementMgr->SetDirty( true );
}
}
@@ -383,6 +379,7 @@ void CBaseAchievement::AwardAchievement()
if ( IsAchieved() )
return;
ShowProgressNotification();
m_pAchievementMgr->AwardAchievement( m_iAchievementID );
}
@@ -438,7 +435,7 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber )
}
ShowProgressNotification();
}
}
}
else
{
@@ -748,4 +745,4 @@ void CAchievement_AchievedCount::SetAchievementsRequired( int iNumRequired, int
m_iNumRequired = iNumRequired;
m_iLowRange = iLowRange;
m_iHighRange = iHighRange;
}
}
+3 -1
View File
@@ -519,9 +519,11 @@ class CAchievementPortalFindAllDinosaurs : public CBaseAchievement
if ( id >= 0 && id < m_iNumComponents )
{
EnsureComponentBitSetAndEvaluate( id );
#ifndef DISABLE_STEAM
// Update our Steam stat
steamapicontext->SteamUserStats()->SetStat( "PORTAL_TRANSMISSION_RECEIVED_STAT", m_iCount );
#endif
}
else
{