Incorporates quickplay leaderboard
Also fixed a bug when hitting esc from the "New Game" char select menu after getting killed.
This commit is contained in:
parent
deb4638847
commit
a38a21a344
|
@ -662,6 +662,10 @@ handle_main_input(void)
|
||||||
characterSelectScreen = NULL;
|
characterSelectScreen = NULL;
|
||||||
menu_destroy(charSelectMenu);
|
menu_destroy(charSelectMenu);
|
||||||
charSelectMenu = NULL;
|
charSelectMenu = NULL;
|
||||||
|
if (mainMenu == NULL) {
|
||||||
|
resetGame();
|
||||||
|
initMainMenu();
|
||||||
|
}
|
||||||
gGameState = MENU;
|
gGameState = MENU;
|
||||||
break;
|
break;
|
||||||
case MENU:
|
case MENU:
|
||||||
|
@ -940,9 +944,12 @@ run_game_render(void)
|
||||||
static inline void
|
static inline void
|
||||||
register_scores(void)
|
register_scores(void)
|
||||||
{
|
{
|
||||||
uint8_t details[4] = { (uint8_t) gPlayer->stats.lvl, (uint8_t) cLevel, 0, 0 };
|
uint8_t details[4] = { (uint8_t) gPlayer->stats.lvl, (uint8_t) cLevel, (uint8_t) (gPlayer->class + 1), 0 };
|
||||||
steam_register_score((int) gPlayer->gold, (int32_t*) &details, 1);
|
steam_register_score((int) gPlayer->gold, (int32_t*) &details, 1);
|
||||||
steam_register_kills((int) gPlayer->stat_data.kills, (int32_t*) &details, 1);
|
steam_register_kills((int) gPlayer->stat_data.kills, (int32_t*) &details, 1);
|
||||||
|
if (quickGame) {
|
||||||
|
steam_register_qp_score((int) gPlayer->gold, (int32_t*) &details, 1);
|
||||||
|
}
|
||||||
if (gPlayer->class == ROGUE) {
|
if (gPlayer->class == ROGUE) {
|
||||||
steam_set_achievement(ROGUE_LIKE);
|
steam_set_achievement(ROGUE_LIKE);
|
||||||
steam_register_rogue_score((int) gPlayer->gold, (int32_t*) &details, 1);
|
steam_register_rogue_score((int) gPlayer->gold, (int32_t*) &details, 1);
|
||||||
|
|
|
@ -7,10 +7,11 @@
|
||||||
#include "../gui.h"
|
#include "../gui.h"
|
||||||
#include "../timer.h"
|
#include "../timer.h"
|
||||||
|
|
||||||
static const char *LB_HIGHSCORE = "Highscore";
|
static const char *LB_HIGHSCORE = "Highscore";
|
||||||
static const char *LB_ROGUE_HIGHSCORE = "Rogue Highscore";
|
static const char *LB_QUICKPLAY_HIGHSCORE = "Quickplay Highscore";
|
||||||
static const char *LB_WARRIOR_HIGHSCORE = "Warrior Highscore";
|
static const char *LB_ROGUE_HIGHSCORE = "Rogue Highscore";
|
||||||
static const char *LB_KILLS = "Most Kills";
|
static const char *LB_WARRIOR_HIGHSCORE = "Warrior Highscore";
|
||||||
|
static const char *LB_KILLS = "Most Kills";
|
||||||
|
|
||||||
static Achievement g_Achievements[] = {
|
static Achievement g_Achievements[] = {
|
||||||
_ACH_ID(BAD_DOG, "Bad Dog"),
|
_ACH_ID(BAD_DOG, "Bad Dog"),
|
||||||
|
@ -26,6 +27,7 @@ static bool m_Initiated = false;
|
||||||
static bool m_bStatsReceived = false;
|
static bool m_bStatsReceived = false;
|
||||||
static Sint64 m_AppID = 0;
|
static Sint64 m_AppID = 0;
|
||||||
static Sint64 m_hHighscoreLeaderboard = 0;
|
static Sint64 m_hHighscoreLeaderboard = 0;
|
||||||
|
static Sint64 m_hQpHighscoreLeaderboard = 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;
|
||||||
|
@ -65,6 +67,8 @@ leaderboard_received(Sint64 hLeaderboard, const char *name)
|
||||||
m_hRogueHighscore = hLeaderboard;
|
m_hRogueHighscore = 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)
|
||||||
|
m_hQpHighscoreLeaderboard = hLeaderboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -100,6 +104,8 @@ request_data_queue_run(void)
|
||||||
steam_request_stats();
|
steam_request_stats();
|
||||||
else if (!m_hHighscoreLeaderboard)
|
else if (!m_hHighscoreLeaderboard)
|
||||||
c_SteamUserStats_FindLeaderboard(LB_HIGHSCORE);
|
c_SteamUserStats_FindLeaderboard(LB_HIGHSCORE);
|
||||||
|
else if (!m_hQpHighscoreLeaderboard)
|
||||||
|
c_SteamUserStats_FindLeaderboard(LB_QUICKPLAY_HIGHSCORE);
|
||||||
else if (!m_hKillsLeaderboard)
|
else if (!m_hKillsLeaderboard)
|
||||||
c_SteamUserStats_FindLeaderboard(LB_KILLS);
|
c_SteamUserStats_FindLeaderboard(LB_KILLS);
|
||||||
else if (!m_hRogueHighscore)
|
else if (!m_hRogueHighscore)
|
||||||
|
@ -137,6 +143,13 @@ void steam_register_score(Sint32 nScore, const int32_t *details, int32_t nDetail
|
||||||
c_SteamUserStats_UploadLeaderboardScore(m_hHighscoreLeaderboard, nScore, details, nDetails);
|
c_SteamUserStats_UploadLeaderboardScore(m_hHighscoreLeaderboard, nScore, details, nDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void steam_register_qp_score(Sint32 nScore, const int32_t *details, int32_t nDetails)
|
||||||
|
{
|
||||||
|
if (!m_hQpHighscoreLeaderboard)
|
||||||
|
return;
|
||||||
|
c_SteamUserStats_UploadLeaderboardScore(m_hQpHighscoreLeaderboard, 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)
|
||||||
|
|
|
@ -38,6 +38,8 @@ void steam_set_achievement(EAchievement eAch);
|
||||||
|
|
||||||
void steam_register_score(Sint32 nScore, const int32_t *details, int32_t nDetails);
|
void steam_register_score(Sint32 nScore, const int32_t *details, int32_t nDetails);
|
||||||
|
|
||||||
|
void steam_register_qp_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);
|
||||||
|
|
Loading…
Reference in New Issue