mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-27 09:34:55 -04:00
implement achievements, console supports copy to clipboard
This commit is contained in:
parent
f5450c0f92
commit
936bafca5a
12 changed files with 133 additions and 25 deletions
|
@ -1,29 +1,66 @@
|
|||
#include "ach_events.h"
|
||||
#include <platform/achievements.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <libs/event.h>
|
||||
#include "globals.h"
|
||||
|
||||
#define DEFACH(x) static const char * x = #x; static char reported_##x = 0
|
||||
#define IS_ACH_REPORTED(x) (reported_##x)
|
||||
|
||||
DEFACH(ACH_ALL_PARTY);
|
||||
DEFACH(ACH_END_GAME);
|
||||
DEFACH(ACH_FIRE);
|
||||
DEFACH(ACH_FIRST_KILL);
|
||||
DEFACH(ACH_FOUNTAIN);
|
||||
DEFACH(ACH_HAMMER);
|
||||
DEFACH(ACH_HEART);
|
||||
DEFACH(ACH_ORC_TREASURE);
|
||||
DEFACH(ACH_SCROLL);
|
||||
|
||||
#define item_orc_treasure 72
|
||||
#define item_scroll_victory 152
|
||||
#define item_hearth_earth 150
|
||||
#define item_wind_hammer 149
|
||||
#define item_mitchel_water 151
|
||||
#define item_eternal_fire 148
|
||||
|
||||
|
||||
|
||||
static char achievements_enabled = 0;
|
||||
|
||||
#define UNLOCK_ACH(x) do {if (achievements_enabled && !reported_##x) set_achievement(x); reported_##x = 1;} while(0)
|
||||
|
||||
void enable_achievements(char enable) {
|
||||
|
||||
achievements_enabled = enable;
|
||||
}
|
||||
|
||||
void ach_event_kill_monster(int id) {
|
||||
wzprintf("(event) kill monster %d\n", id);
|
||||
(void)id;
|
||||
UNLOCK_ACH(ACH_FIRST_KILL);
|
||||
}
|
||||
void ach_event_pick_item(int id) {
|
||||
wzprintf("(event) pick item %d\n", id);
|
||||
switch (id) {
|
||||
case item_orc_treasure: UNLOCK_ACH(ACH_ORC_TREASURE); break;
|
||||
case item_eternal_fire: UNLOCK_ACH(ACH_FIRE); break;
|
||||
case item_hearth_earth: UNLOCK_ACH(ACH_HEART);break;
|
||||
case item_mitchel_water: UNLOCK_ACH(ACH_FOUNTAIN);break;
|
||||
case item_scroll_victory: UNLOCK_ACH(ACH_SCROLL);break;
|
||||
case item_wind_hammer: UNLOCK_ACH(ACH_HAMMER);break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
void ach_event_end_game() {
|
||||
wzprintf("(event) end_game\n");
|
||||
UNLOCK_ACH(ACH_END_GAME);
|
||||
}
|
||||
void ach_event_inv_add(int id) {
|
||||
wzprintf("(event) inventory add %d\n", id);
|
||||
(void)id;
|
||||
//wzprintf("(event) inventory add %d\n", id);
|
||||
}
|
||||
void ach_event_dialog_paragraph(int pgf) {
|
||||
wzprintf("(event) dialog paragraph %d\n", pgf);
|
||||
(void)pgf;
|
||||
//wzprintf("(event) dialog paragraph %d\n", pgf);
|
||||
}
|
||||
void ach_event_full_party() {
|
||||
wzprintf("(event) full party\n");
|
||||
UNLOCK_ACH(ACH_ALL_PARTY);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue