2017-02-11 10:52:37 +01:00
|
|
|
/*
|
2019-08-03 19:43:48 +02:00
|
|
|
* This software is licensed under the terms of the MIT License.
|
2017-09-12 03:28:15 +02:00
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
2019-01-23 21:10:43 +01:00
|
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
2019-07-03 20:00:56 +02:00
|
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
|
2017-09-12 03:28:15 +02:00
|
|
|
*/
|
2017-02-11 10:52:37 +01:00
|
|
|
|
2019-01-23 21:10:43 +01:00
|
|
|
#ifndef IGUARD_progress_h
|
|
|
|
#define IGUARD_progress_h
|
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
#include "taisei.h"
|
2017-02-11 10:52:37 +01:00
|
|
|
|
2017-02-11 12:38:50 +01:00
|
|
|
#include <SDL.h>
|
2019-11-22 04:37:11 +01:00
|
|
|
|
2017-04-07 19:34:35 +02:00
|
|
|
#include "ending.h"
|
2017-02-11 10:52:37 +01:00
|
|
|
|
2017-04-18 21:48:18 +02:00
|
|
|
#define PROGRESS_FILE "storage/progress.dat"
|
2017-02-11 10:52:37 +01:00
|
|
|
#define PROGRESS_MAXFILESIZE 4096
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2018-01-12 19:26:07 +01:00
|
|
|
// #define PROGRESS_UNLOCK_ALL
|
2017-02-11 10:52:37 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum ProgfileCommand {
|
2019-03-11 00:21:43 +01:00
|
|
|
// Do not reorder this!
|
2017-04-06 02:58:57 +02:00
|
|
|
|
2018-01-12 19:26:07 +01:00
|
|
|
PCMD_UNLOCK_STAGES = 0x00,
|
|
|
|
PCMD_UNLOCK_STAGES_WITH_DIFFICULTY = 0x01,
|
|
|
|
PCMD_HISCORE = 0x02,
|
|
|
|
PCMD_STAGE_PLAYINFO = 0x03,
|
|
|
|
PCMD_ENDINGS = 0x04,
|
|
|
|
PCMD_GAME_SETTINGS = 0x05,
|
|
|
|
PCMD_GAME_VERSION = 0x06,
|
2019-03-11 00:21:43 +01:00
|
|
|
PCMD_UNLOCK_BGMS = 0x07,
|
2017-02-11 10:52:37 +01:00
|
|
|
} ProgfileCommand;
|
|
|
|
|
2017-02-11 12:38:50 +01:00
|
|
|
typedef struct StageProgress {
|
2019-03-11 00:21:43 +01:00
|
|
|
// Keep this struct small if you can
|
|
|
|
// See stage_get_progress_from_info() in stage.c for more information
|
2017-02-11 12:38:50 +01:00
|
|
|
|
2018-01-12 19:26:07 +01:00
|
|
|
uint32_t num_played;
|
|
|
|
uint32_t num_cleared;
|
2019-03-11 00:21:43 +01:00
|
|
|
uchar unlocked : 1;
|
2017-02-11 12:38:50 +01:00
|
|
|
} StageProgress;
|
|
|
|
|
2019-03-11 00:21:43 +01:00
|
|
|
typedef enum ProgressBGMID {
|
|
|
|
// Do not reorder! Append at the end only, reserve space if removing.
|
|
|
|
|
|
|
|
PBGM_MENU,
|
|
|
|
PBGM_STAGE1,
|
|
|
|
PBGM_STAGE1_BOSS,
|
|
|
|
PBGM_STAGE2,
|
|
|
|
PBGM_STAGE2_BOSS,
|
|
|
|
PBGM_STAGE3,
|
|
|
|
PBGM_STAGE3_BOSS,
|
|
|
|
PBGM_STAGE4,
|
|
|
|
PBGM_STAGE4_BOSS,
|
|
|
|
PBGM_STAGE5,
|
|
|
|
PBGM_STAGE5_BOSS,
|
|
|
|
PBGM_STAGE6,
|
|
|
|
PBGM_STAGE6_BOSS1,
|
|
|
|
PBGM_STAGE6_BOSS2,
|
|
|
|
PBGM_STAGE6_BOSS3,
|
|
|
|
PBGM_ENDING,
|
|
|
|
PBGM_CREDITS,
|
|
|
|
PBGM_BONUS0, // old Iku theme
|
|
|
|
PBGM_BONUS1, // Scuttle theme
|
|
|
|
} ProgressBGMID;
|
|
|
|
|
2017-03-29 22:14:04 +02:00
|
|
|
struct UnknownCmd;
|
|
|
|
|
2017-03-20 06:29:22 +01:00
|
|
|
typedef struct GlobalProgress {
|
2018-01-12 19:26:07 +01:00
|
|
|
uint32_t hiscore;
|
|
|
|
uint32_t achieved_endings[NUM_ENDINGS];
|
2019-03-11 00:21:43 +01:00
|
|
|
uint64_t unlocked_bgms;
|
2018-01-12 19:26:07 +01:00
|
|
|
struct UnknownCmd *unknown;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint8_t difficulty;
|
|
|
|
uint8_t character;
|
|
|
|
uint8_t shotmode;
|
|
|
|
} game_settings;
|
2017-03-20 06:29:22 +01:00
|
|
|
} GlobalProgress;
|
|
|
|
|
|
|
|
extern GlobalProgress progress;
|
|
|
|
|
2017-02-11 10:52:37 +01:00
|
|
|
void progress_load(void);
|
|
|
|
void progress_save(void);
|
2017-03-29 22:14:04 +02:00
|
|
|
void progress_unload(void);
|
2019-01-05 22:40:50 +01:00
|
|
|
|
|
|
|
uint32_t progress_times_any_ending_achieved(void);
|
|
|
|
uint32_t progress_times_any_good_ending_achieved(void);
|
2019-01-23 21:10:43 +01:00
|
|
|
|
2019-03-11 00:21:43 +01:00
|
|
|
bool progress_is_bgm_unlocked(const char *name);
|
|
|
|
void progress_unlock_bgm(const char *name);
|
|
|
|
|
2019-01-23 21:10:43 +01:00
|
|
|
#endif // IGUARD_progress_h
|