Includes player and dungeon level in steam leaderboards.

- Intended for use in the in game leaderboard view once I make that.
This commit is contained in:
Linus Probert 2018-09-02 23:44:48 +02:00
parent ad2d0af79b
commit 37518c100d
6 changed files with 14 additions and 13 deletions

View File

@ -7,7 +7,7 @@ project(breakhack C)
set(breakhack_GAME_TITLE "BreakHack")
set(breakhack_MAJOR_VERSION 1)
set(breakhack_MINOR_VERSION 0)
set(breakhack_PATCH_VERSION 2)
set(breakhack_PATCH_VERSION 3)
set(breakhack_RELEASE_TYPE "")
include(FindLua)

View File

@ -894,8 +894,9 @@ run_game(void)
createInGameGameOverMenu();
hiscore_register(gPlayer, cLevel);
#ifdef STEAM_BUILD
steam_register_score((int)hiscore_get_top_gold());
steam_register_kills((int) gPlayer->stat_data.kills);
uint8_t details[4] = { (uint8_t) gPlayer->stats.lvl, (uint8_t) cLevel, 0, 0 };
steam_register_score((int) gPlayer->gold, &details, 1);
steam_register_kills((int) gPlayer->stat_data.kills, (int32_t*) &details, 1);
#endif // STEAM_BUILD
} else {

View File

@ -111,16 +111,16 @@ void steam_set_achievement(EAchievement eAch)
}
}
void steam_register_score(Sint32 nScore)
void steam_register_score(Sint32 nScore, const int32_t *details, int32_t nDetails)
{
if (!m_hHighscoreLeaderboard)
return;
c_SteamUserStats_UploadLeaderboardScore(m_hHighscoreLeaderboard, nScore);
c_SteamUserStats_UploadLeaderboardScore(m_hHighscoreLeaderboard, nScore, details, nDetails);
}
void steam_register_kills(Sint32 nKills)
void steam_register_kills(Sint32 nKills, const int32_t *details, int32_t nDetails)
{
if (!m_hKillsLeaderboard)
return;
c_SteamUserStats_UploadLeaderboardScore(m_hKillsLeaderboard, nKills);
c_SteamUserStats_UploadLeaderboardScore(m_hKillsLeaderboard, nKills, details, nDetails);
}

View File

@ -31,6 +31,6 @@ void steam_run_callbacks(void);
void steam_set_achievement(EAchievement eAch);
void steam_register_score(Sint32 nScore);
void steam_register_score(Sint32 nScore, const int32_t *details, int32_t nDetails);
void steam_register_kills(Sint32 nKills);
void steam_register_kills(Sint32 nKills, const int32_t *details, int32_t nDetails);

View File

@ -99,10 +99,10 @@ c_SteamUserStats_FindLeaderboard(const char * name)
m_CallbackHandler->m_FindLeaderboardCallResult.Set(hSteamAPICall, m_CallbackHandler, &CallbackHandler::OnFindLeaderboard);
}
extern "C" void c_SteamUserStats_UploadLeaderboardScore(int64_t hLeaderboard, int32_t nScore)
extern "C" void c_SteamUserStats_UploadLeaderboardScore(int64_t hLeaderboard, int32_t nScore, int32_t *details, int32_t nDetails)
{
if (!hLeaderboard || !m_Initiated)
return;
SteamUserStats()->UploadLeaderboardScore(hLeaderboard, k_ELeaderboardUploadScoreMethodKeepBest, nScore, nullptr, 0);
SteamUserStats()->UploadLeaderboardScore(hLeaderboard, k_ELeaderboardUploadScoreMethodKeepBest, nScore, details, nDetails);
}

View File

@ -30,7 +30,7 @@ void
c_SteamUserStats_FindLeaderboard(const char *name);
void
c_SteamUserStats_UploadLeaderboardScore(int64_t hLeaderboard, int32_t nScore);
c_SteamUserStats_UploadLeaderboardScore(int64_t hLeaderboard, int32_t nScore, int32_t *details, int32_t nDetails);
void
c_SteamAPI_Shutdown(void);
c_SteamAPI_Shutdown(void);