Skip to content
Open
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
10 changes: 10 additions & 0 deletions src/game/shared/achievementmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ static void WriteAchievementGlobalState( KeyValues *pKV, bool bPersistToSteamClo
if (pData)
{
// Read in the data from the file system GameState.txt file
#ifdef NEO
FileHandle_t handle = filesystem->Open(szFilename, "rb");
#else
FileHandle_t handle = filesystem->Open(szFilename, "r");
#endif

if (handle)
{
Expand All @@ -154,6 +158,12 @@ static void WriteAchievementGlobalState( KeyValues *pKV, bool bPersistToSteamClo
// Write out the data to steam cloud
pRemoteStorage->FileWrite(szFilename, pData, filesize);
}
#ifdef NEO
else
{
Warning("CAchievementMgr: Failed to write to steam cloud! Expected size %d got size %d\n", filesize, nRead);
}
#endif
}

// Delete the data array
Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/achievementmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class CAchievementMgr : public CAutoGameSystemPerFrame, public CGameEventListene
SteamCloudPersist_On,
};

#ifdef NEO
CAchievementMgr( SteamCloudPersisting ePersistToSteamCloud = SteamCloudPersist_On );
#else
CAchievementMgr( SteamCloudPersisting ePersistToSteamCloud = SteamCloudPersist_Off );
#endif

//=============================================================================
// HPE_END
Expand Down
19 changes: 19 additions & 0 deletions src/game/shared/baseachievement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,25 @@ void CBaseAchievement::SetComponentBits( uint64 iComponentBits )
iComponentBits >>= 1;
}
m_iCount = iNumBitsSet;

#ifdef NEO
#ifndef NO_STEAM
// if this achievement's progress should be stored in Steam, set the steam stat for it
if ( StoreProgressInSteam() && steamapicontext->SteamUserStats() )
{
// Set the Steam stat with the same name as the achievement. Only cached locally until we upload it.
char pszProgressName[1024];
Q_snprintf( pszProgressName, 1024, "%s_STAT", GetStat() );
bool bRet = steamapicontext->SteamUserStats()->SetStat( pszProgressName, m_iCount );
if ( !bRet )
{
DevMsg( "ISteamUserStats::GetStat failed to set progress value in Steam for achievement %s\n", pszProgressName );
}

m_pAchievementMgr->SetDirty( true );
}
#endif // NO_STEAM
#endif // NEO
}

//-----------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/baseachievement.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class CBaseAchievement : public CGameEventListener, public IAchievement
virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event );

int GetAchievementID() { return m_iAchievementID; }
#ifdef NEO // NEO NOTE DG: Must be larger than 0. ALWAYS!
void SetAchievementID( int iAchievementID ) { Assert( iAchievementID > 0 ); m_iAchievementID = iAchievementID; }
#else
void SetAchievementID( int iAchievementID ) { m_iAchievementID = iAchievementID; }
#endif
void SetName( const char *pszName ) { m_pszName = pszName; }
const char *GetName() { return m_pszName; }
const char *GetStat() { return m_pszStat?m_pszStat:GetName(); }
Expand Down
1 change: 1 addition & 0 deletions src/game/shared/neo/achievements_neo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CAchievementNEO_TutorialComplete : public CBaseAchievement
SetFlags( ACH_SAVE_GLOBAL | ACH_HAS_COMPONENTS | ACH_LISTEN_COMPONENT_EVENTS );
SetGoal( m_iNumComponents );
SetMapNameFilter( "ntre_class_tut" );
SetStoreProgressInSteam( true );
}
};
DECLARE_NEO_ACHIEVEMENT( CAchievementNEO_TutorialComplete, ACHIEVEMENT_NEO_TUTORIAL_COMPLETE, "NEO_TUTORIAL_COMPLETE" );
Expand Down
3 changes: 2 additions & 1 deletion src/game/shared/neo/neo_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ static const constexpr short NEO_ENVIRON_KILLED = -1;

enum NeoAchievementID
{
ACHIEVEMENT_NEO_TUTORIAL_COMPLETE = 0,
// Must start greater than 0 always
ACHIEVEMENT_NEO_TUTORIAL_COMPLETE = 1,
ACHIEVEMENT_NEO_TRIAL_50_SECONDS,
ACHIEVEMENT_NEO_TRIAL_40_SECONDS,
};