From c2eae7a9fe637dea1fa729a764642ca7a3d394e7 Mon Sep 17 00:00:00 2001 From: Linus Probert Date: Sat, 27 Oct 2018 13:28:48 +0200 Subject: [PATCH] Adds arcade game leaderboard - Also fixes an ASSASSIN hidden state issue where the monster would dissappear even if it's stunned. --- src/main.c | 3 +++ src/monster.c | 8 ++------ src/steam/steamworks_api_wrapper.c | 13 +++++++++++++ src/steam/steamworks_api_wrapper.h | 5 ++++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 2c3c9d3..294c8c5 100644 --- a/src/main.c +++ b/src/main.c @@ -1009,6 +1009,9 @@ register_scores(void) if (quickGame) { steam_register_qp_score((int) gPlayer->gold, (int32_t*) &details, 1); } + if (arcadeGame) { + steam_register_arcade_score((int)gPlayer->gold, (int32_t)&details, 1); + } if (gPlayer->class == ROGUE) { steam_set_achievement(ROGUE_LIKE); steam_register_rogue_score((int) gPlayer->gold, (int32_t*) &details, 1); diff --git a/src/monster.c b/src/monster.c index f92c249..34e5adb 100644 --- a/src/monster.c +++ b/src/monster.c @@ -157,6 +157,8 @@ assassin_cloak_effect(Monster *m, bool cloak) else gui_log("%s reappears, filled with rage", m->label); particle_engine_fire_explosion(m->sprite->pos, DIM(TILE_DIMENSION, TILE_DIMENSION)); + m->sprite->hidden = cloak; + m->stateIndicator.sprite->hidden = cloak; } @@ -727,9 +729,6 @@ monster_render(Monster *m, Camera *cam) if (m->stats.hp <= 0) return; - if (m->behaviour == ASSASSIN && m->state.current != AGRESSIVE) - return; - sprite_render(m->sprite, cam); } @@ -739,9 +738,6 @@ monster_render_top_layer(Monster *m, RoomMatrix *rm, Camera *cam) if (m->stats.hp <= 0) return; - if (m->behaviour == ASSASSIN && m->state.current != AGRESSIVE) - return; - Position mPos = position_to_matrix_coords(&m->sprite->pos); mPos.y -= 1; if (rm->spaces[mPos.x][mPos.y].player) { diff --git a/src/steam/steamworks_api_wrapper.c b/src/steam/steamworks_api_wrapper.c index c5c3ffc..e51e863 100644 --- a/src/steam/steamworks_api_wrapper.c +++ b/src/steam/steamworks_api_wrapper.c @@ -9,6 +9,7 @@ static const char *LB_HIGHSCORE = "Highscore"; static const char *LB_QUICKPLAY_HIGHSCORE = "Quickplay Highscore"; +static const char *LB_ARCADE_HIGHSCORE = "Arcade Highscore"; static const char *LB_ROGUE_HIGHSCORE = "Rogue Highscore"; static const char *LB_WARRIOR_HIGHSCORE = "Warrior Highscore"; static const char *LB_KILLS = "Most Kills"; @@ -28,6 +29,7 @@ static bool m_bStatsReceived = false; static Sint64 m_AppID = 0; static Sint64 m_hHighscoreLeaderboard = 0; static Sint64 m_hQpHighscoreLeaderboard = 0; +static Sint64 m_hArcadeHighscoreLeaderboard = 0; static Sint64 m_hKillsLeaderboard = 0; static Sint64 m_hRogueHighscore = 0; static Sint64 m_hWarriorHighscore = 0; @@ -69,6 +71,8 @@ leaderboard_received(Sint64 hLeaderboard, const char *name) m_hWarriorHighscore = hLeaderboard; else if (strcmp(LB_QUICKPLAY_HIGHSCORE, name) == 0) m_hQpHighscoreLeaderboard = hLeaderboard; + else if (strcmp(LB_ARCADE_HIGHSCORE, name) == 0) + m_hArcadeHighscoreLeaderboard = hLeaderboard; } bool @@ -106,6 +110,8 @@ request_data_queue_run(void) c_SteamUserStats_FindLeaderboard(LB_HIGHSCORE); else if (!m_hQpHighscoreLeaderboard) c_SteamUserStats_FindLeaderboard(LB_QUICKPLAY_HIGHSCORE); + else if (!m_hArcadeHighscoreLeaderboard) + c_SteamUserStats_FindLeaderboard(LB_ARCADE_HIGHSCORE); else if (!m_hKillsLeaderboard) c_SteamUserStats_FindLeaderboard(LB_KILLS); else if (!m_hRogueHighscore) @@ -150,6 +156,13 @@ void steam_register_qp_score(Sint32 nScore, const int32_t *details, int32_t nDet c_SteamUserStats_UploadLeaderboardScore(m_hQpHighscoreLeaderboard, nScore, details, nDetails); } +void steam_register_arcade_score(Sint32 nScore, const int32_t * details, int32_t nDetails) +{ + if (!m_hArcadeHighscoreLeaderboard) + return; + c_SteamUserStats_UploadLeaderboardScore(m_hArcadeHighscoreLeaderboard, nScore, details, nDetails); +} + void steam_register_warrior_score(Sint32 nScore, const int32_t * details, int32_t nDetails) { if (!m_hWarriorHighscore) diff --git a/src/steam/steamworks_api_wrapper.h b/src/steam/steamworks_api_wrapper.h index b4febfd..efe8b55 100644 --- a/src/steam/steamworks_api_wrapper.h +++ b/src/steam/steamworks_api_wrapper.h @@ -12,7 +12,8 @@ typedef enum EAchievement DRAGON_SLAYER = 6, BUGGFIXER = 7, BUGGCREATOR = 8, - ROGUE_LIKE = 9 + ROGUE_LIKE = 9, + ARCADE_HACK = 10 } EAchievement; @@ -40,6 +41,8 @@ void steam_register_score(Sint32 nScore, const int32_t *details, int32_t nDetail void steam_register_qp_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_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);