Adds steam achievements and LB for the Mage class

This commit is contained in:
Linus Probert 2019-06-10 11:19:40 +02:00
parent 9aefed0d00
commit 6d323ca500
3 changed files with 24 additions and 4 deletions

View File

@ -1086,10 +1086,13 @@ register_scores(void)
steam_set_achievement(ROGUE_LIKE); steam_set_achievement(ROGUE_LIKE);
steam_register_rogue_score((int) gPlayer->gold, steam_register_rogue_score((int) gPlayer->gold,
(int32_t*) &details, 1); (int32_t*) &details, 1);
} } else if (gPlayer->class == WARRIOR) {
else if (gPlayer->class == WARRIOR) {
steam_register_warrior_score((int) gPlayer->gold, steam_register_warrior_score((int) gPlayer->gold,
(int32_t*) &details, 1); (int32_t*) &details, 1);
} else if (gPlayer->class == MAGE) {
steam_set_achievement(MAGICAL);
steam_register_mage_score((int) gPlayer->gold,
(int32_t*) &details, 1);
} }
} }
#endif #endif

View File

@ -12,6 +12,7 @@ static const char *LB_HIGHSCORE = "Highscore";
static const char *LB_QUICKPLAY_HIGHSCORE = "Quickplay Highscore"; static const char *LB_QUICKPLAY_HIGHSCORE = "Quickplay Highscore";
static const char *LB_ARCADE_HIGHSCORE = "Arcade Highscore"; static const char *LB_ARCADE_HIGHSCORE = "Arcade Highscore";
static const char *LB_ROGUE_HIGHSCORE = "Rogue Highscore"; static const char *LB_ROGUE_HIGHSCORE = "Rogue Highscore";
static const char *LB_MAGE_HIGHSCORE = "Mage Highscore";
static const char *LB_WARRIOR_HIGHSCORE = "Warrior Highscore"; static const char *LB_WARRIOR_HIGHSCORE = "Warrior Highscore";
static const char *LB_KILLS = "Most Kills"; static const char *LB_KILLS = "Most Kills";
static char *lb_weekly = NULL; static char *lb_weekly = NULL;
@ -22,7 +23,8 @@ static Achievement g_Achievements[] = {
_ACH_ID(LIGHTS_ON, "Omnidirectional light"), _ACH_ID(LIGHTS_ON, "Omnidirectional light"),
_ACH_ID(BACK_TO_WORK, "Back to work"), _ACH_ID(BACK_TO_WORK, "Back to work"),
_ACH_ID(DRAGON_SLAYER, "Platinum dragon slayer"), _ACH_ID(DRAGON_SLAYER, "Platinum dragon slayer"),
_ACH_ID(ROGUE_LIKE, "Rogue-like") _ACH_ID(ROGUE_LIKE, "Rogue-like"),
_ACH_ID(MAGICAL, "Magical")
}; };
static Uint8 numAchievements = 6; static Uint8 numAchievements = 6;
@ -35,6 +37,7 @@ static Sint64 m_hArcadeHighscoreLeaderboard = 0;
static Sint64 m_hKillsLeaderboard = 0; static Sint64 m_hKillsLeaderboard = 0;
static Sint64 m_hRogueHighscore = 0; static Sint64 m_hRogueHighscore = 0;
static Sint64 m_hWarriorHighscore = 0; static Sint64 m_hWarriorHighscore = 0;
static Sint64 m_hMageHighscore = 0;
static Sint64 m_hWeeklyHighscore = 0; static Sint64 m_hWeeklyHighscore = 0;
static Timer *requestDataTimer = NULL; static Timer *requestDataTimer = NULL;
@ -70,6 +73,8 @@ leaderboard_received(Sint64 hLeaderboard, const char *name)
m_hKillsLeaderboard = hLeaderboard; m_hKillsLeaderboard = hLeaderboard;
else if (strcmp(LB_ROGUE_HIGHSCORE, name) == 0) else if (strcmp(LB_ROGUE_HIGHSCORE, name) == 0)
m_hRogueHighscore = hLeaderboard; m_hRogueHighscore = hLeaderboard;
else if (strcmp(LB_MAGE_HIGHSCORE, name) == 0)
m_hMageHighscore = hLeaderboard;
else if (strcmp(LB_WARRIOR_HIGHSCORE, name) == 0) else if (strcmp(LB_WARRIOR_HIGHSCORE, name) == 0)
m_hWarriorHighscore = hLeaderboard; m_hWarriorHighscore = hLeaderboard;
else if (strcmp(LB_QUICKPLAY_HIGHSCORE, name) == 0) else if (strcmp(LB_QUICKPLAY_HIGHSCORE, name) == 0)
@ -124,6 +129,8 @@ request_data_queue_run(void)
c_SteamUserStats_FindLeaderboard(LB_KILLS); c_SteamUserStats_FindLeaderboard(LB_KILLS);
else if (!m_hRogueHighscore) else if (!m_hRogueHighscore)
c_SteamUserStats_FindLeaderboard(LB_ROGUE_HIGHSCORE); c_SteamUserStats_FindLeaderboard(LB_ROGUE_HIGHSCORE);
else if (!m_hMageHighscore)
c_SteamUserStats_FindLeaderboard(LB_MAGE_HIGHSCORE);
else if (!m_hWarriorHighscore) else if (!m_hWarriorHighscore)
c_SteamUserStats_FindLeaderboard(LB_WARRIOR_HIGHSCORE); c_SteamUserStats_FindLeaderboard(LB_WARRIOR_HIGHSCORE);
else if (!m_hWeeklyHighscore) else if (!m_hWeeklyHighscore)
@ -183,6 +190,13 @@ void steam_register_arcade_score(Sint32 nScore, const int32_t * details, int32_t
c_SteamUserStats_UploadLeaderboardScore(m_hArcadeHighscoreLeaderboard, nScore, details, nDetails); c_SteamUserStats_UploadLeaderboardScore(m_hArcadeHighscoreLeaderboard, nScore, details, nDetails);
} }
void steam_register_mage_score(Sint32 nScore, const int32_t * details, int32_t nDetails)
{
if (!m_hMageHighscore)
return;
c_SteamUserStats_UploadLeaderboardScore(m_hMageHighscore, nScore, details, nDetails);
}
void steam_register_warrior_score(Sint32 nScore, const int32_t * details, int32_t nDetails) void steam_register_warrior_score(Sint32 nScore, const int32_t * details, int32_t nDetails)
{ {
if (!m_hWarriorHighscore) if (!m_hWarriorHighscore)

View File

@ -13,7 +13,8 @@ typedef enum EAchievement
BUGGFIXER = 7, BUGGFIXER = 7,
BUGGCREATOR = 8, BUGGCREATOR = 8,
ROGUE_LIKE = 9, ROGUE_LIKE = 9,
ARCADE_HACK = 10 MAGICAL = 10,
ARCADE_HACK = 11
} EAchievement; } EAchievement;
@ -45,6 +46,8 @@ void steam_register_weekly_score(Sint32 nScore, const int32_t *details, int32_t
void steam_register_arcade_score(Sint32 nScore, const int32_t *details, int32_t nDetails); void steam_register_arcade_score(Sint32 nScore, const int32_t *details, int32_t nDetails);
void steam_register_mage_score(Sint32 nScore, const int32_t *details, int32_t nDetails);
void steam_register_warrior_score(Sint32 nScore, const int32_t *details, int32_t nDetails); void steam_register_warrior_score(Sint32 nScore, const int32_t *details, int32_t nDetails);
void steam_register_rogue_score(Sint32 nScore, const int32_t *details, int32_t nDetails); void steam_register_rogue_score(Sint32 nScore, const int32_t *details, int32_t nDetails);