Adds hooks for all achievements
This commit is contained in:
parent
28b3980fe6
commit
d2ced6cef1
|
@ -866,6 +866,9 @@ run_game(void)
|
|||
gui_log("Your break is over!");
|
||||
gui_event_message("Well done!");
|
||||
end_game_details();
|
||||
#ifdef STEAM_BUILD
|
||||
steam_set_achievement(BACK_TO_WORK);
|
||||
#endif // STEAM_BUILD
|
||||
}
|
||||
}
|
||||
|
||||
|
|
15
src/player.c
15
src/player.c
|
@ -36,6 +36,10 @@
|
|||
#include "animation.h"
|
||||
#include "trap.h"
|
||||
|
||||
#ifdef STEAM_BUILD
|
||||
#include "steam/steamworks_api_wrapper.h"
|
||||
#endif // STEAM_BUILD
|
||||
|
||||
#define ENGINEER_STATS { 12, 12, 5, 7, 2, 2, 1, false, false }
|
||||
#define MAGE_STATS { 12, 12, 5, 7, 1, 2, 1, false, false }
|
||||
#define PALADIN_STATS { 12, 12, 8, 9, 3, 1, 1, false, false }
|
||||
|
@ -514,6 +518,17 @@ player_monster_kill_check(Player *player, Monster *monster)
|
|||
if (!monster)
|
||||
return;
|
||||
|
||||
#ifdef STEAM_BUILD
|
||||
if (strcmp("The Shadow", monster->label) == 0)
|
||||
steam_set_achievement(LIGHTS_ON);
|
||||
else if (strcmp("The Hell Hound", monster->label) == 0)
|
||||
steam_set_achievement(BAD_DOG);
|
||||
else if (strcmp("Platino", monster->label) == 0)
|
||||
steam_set_achievement(DRAGON_SLAYER);
|
||||
else if (strcmp("The Cleric", monster->label) == 0)
|
||||
steam_set_achievement(THE_DOCTOR_IS_OUT);
|
||||
#endif // STEAM_BUILD
|
||||
|
||||
if (monster->stats.hp <= 0) {
|
||||
unsigned int gained_xp = 5 * monster->stats.lvl;
|
||||
player->stat_data.kills += 1;
|
||||
|
|
|
@ -28,18 +28,13 @@ steam_request_stats()
|
|||
static void
|
||||
stats_received(void)
|
||||
{
|
||||
debug("Stats received");
|
||||
for (Uint8 i = 0; i < numAchievements; ++i) {
|
||||
Achievement *a = &g_Achievements[i];
|
||||
c_SteamUserStats_GetAchievement(a->m_pchAchievementID, &a->m_bAchieved);
|
||||
gui_log("You just earned the \"%s\" achievement", c_SteamUserStats_GetAchievementDisplayAttribute(a->m_pchAchievementID, "name"));
|
||||
}
|
||||
debug("Steam stats received");
|
||||
}
|
||||
|
||||
static void
|
||||
stats_stored(void)
|
||||
{
|
||||
debug("Stats stored");
|
||||
debug("Steam stats stored");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -67,7 +62,10 @@ void steam_run_callbacks(void)
|
|||
void steam_set_achievement(EAchievement eAch)
|
||||
{
|
||||
for (Uint8 i = 0; i < numAchievements; ++i) {
|
||||
if (g_Achievements[i].m_eAchievementID == eAch)
|
||||
Achievement *a = &g_Achievements[i];
|
||||
if (a->m_eAchievementID == eAch && !a->m_bAchieved) {
|
||||
c_SteamUserStats_SetAchievement(g_Achievements[i].m_pchAchievementID);
|
||||
gui_log("You just earned the \"%s\" achievement", a->m_rgchName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue