2017-02-11 10:52:37 +01:00
|
|
|
/*
|
2017-09-12 03:28:15 +02:00
|
|
|
* This software is licensed under the terms of the MIT-License
|
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
2018-01-04 18:14:31 +01:00
|
|
|
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
|
|
|
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
2017-09-12 03:28:15 +02:00
|
|
|
*/
|
2017-02-11 10:52:37 +01:00
|
|
|
|
2017-09-27 14:14:53 +02:00
|
|
|
#pragma once
|
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 <stdbool.h>
|
|
|
|
#include <SDL.h>
|
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
|
2017-04-06 02:58:57 +02:00
|
|
|
// #define PROGRESS_UNLOCK_ALL
|
2017-02-11 10:52:37 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum ProgfileCommand {
|
2017-04-06 02:58:57 +02:00
|
|
|
// do not reorder this!
|
|
|
|
|
|
|
|
PCMD_UNLOCK_STAGES = 0x00,
|
|
|
|
PCMD_UNLOCK_STAGES_WITH_DIFFICULTY = 0x01,
|
|
|
|
PCMD_HISCORE = 0x02,
|
|
|
|
PCMD_STAGE_PLAYINFO = 0x03,
|
2017-04-07 19:34:35 +02:00
|
|
|
PCMD_ENDINGS = 0x04,
|
2017-10-10 07:09:16 +02:00
|
|
|
PCMD_GAME_SETTINGS = 0x05,
|
2017-10-10 08:13:07 +02:00
|
|
|
PCMD_GAME_VERSION = 0x06,
|
2017-02-11 10:52:37 +01:00
|
|
|
} ProgfileCommand;
|
|
|
|
|
2017-02-11 12:38:50 +01:00
|
|
|
typedef struct StageProgress {
|
2017-04-06 02:58:57 +02:00
|
|
|
// keep this struct small if you can
|
|
|
|
// see stage_get_progress_from_info() in stage.c for more information
|
|
|
|
|
|
|
|
unsigned int unlocked : 1;
|
2017-02-11 12:38:50 +01:00
|
|
|
|
2017-04-06 02:58:57 +02:00
|
|
|
uint32_t num_played;
|
|
|
|
uint32_t num_cleared;
|
2017-02-11 12:38:50 +01:00
|
|
|
} StageProgress;
|
|
|
|
|
2017-03-29 22:14:04 +02:00
|
|
|
struct UnknownCmd;
|
|
|
|
|
2017-03-20 06:29:22 +01:00
|
|
|
typedef struct GlobalProgress {
|
|
|
|
uint32_t hiscore;
|
2017-04-07 19:34:35 +02:00
|
|
|
uint32_t achieved_endings[NUM_ENDINGS];
|
2017-03-29 22:14:04 +02:00
|
|
|
struct UnknownCmd *unknown;
|
2017-10-10 07:09:16 +02:00
|
|
|
|
|
|
|
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);
|