progress: move private definitions out of the header

This commit is contained in:
Andrei Alexeyev 2023-07-30 03:13:44 +02:00
parent 6cc8bf2d47
commit 42cbdc7005
No known key found for this signature in database
GPG key ID: 72D26128040B9690
2 changed files with 37 additions and 53 deletions

View file

@ -31,38 +31,42 @@
If the checksum is incorrect, the whole progress file is deemed invalid and ignored.
All commands are optional and the array may be empty. In that case, the checksum may be omitted as well.
Currently implemented commands (see also the ProgfileCommand enum in progress.h):
- PCMD_UNLOCK_STAGES:
Unlocks one or more stages. Only works for stages with fixed difficulty.
- PCMD_UNLOCK_STAGES_WITH_DIFFICULTY:
Unlocks one or more stages, each on a specific difficulty
- PCMD_HISCORE
Sets the "Hi-Score" (highest score ever attained in one game session)
- PCMD_STAGE_PLAYINFO
Sets the times played and times cleared counters for a list of stage/difficulty combinations
- PCMD_ENDINGS
Sets the the number of times an ending was achieved for a list of endings
- PCMD_GAME_SETTINGS
Sets the last picked difficulty, character and shot mode
- PCMD_GAME_VERSION
Sets the game version this file was last written with
- PCMD_UNLOCK_BGMS
Unlocks BGMs in the music room
- PCMD_UNLOCK_CUTSCENES
Unlocks cutscenes in the cutscenes menu
*/
/*
* Currently implemented commands:
*/
typedef enum ProgfileCommand {
// NOTE: These values must never change to preserve compatibility with old progress files!
// Unlocks one or more stages. Only works for stages with fixed difficulty.
PCMD_UNLOCK_STAGES = 0x00,
// Unlocks one or more stages, each on a specific difficulty
PCMD_UNLOCK_STAGES_WITH_DIFFICULTY = 0x01,
// Sets the "Hi-Score" (highest score ever attained in one game session)
PCMD_HISCORE = 0x02,
// Sets the times played and times cleared counters for a list of stage/difficulty combinations
PCMD_STAGE_PLAYINFO = 0x03,
// Sets the the number of times an ending was achieved for a list of endings
PCMD_ENDINGS = 0x04,
// Sets the last picked difficulty, character and shot mode
PCMD_GAME_SETTINGS = 0x05,
// Sets the game version this file was last written with
PCMD_GAME_VERSION = 0x06,
// Unlocks BGMs in the music room
PCMD_UNLOCK_BGMS = 0x07,
// Unlocks cutscenes in the cutscenes menu
PCMD_UNLOCK_CUTSCENES = 0x08,
} ProgfileCommand;
/*
Now in case you wonder why I decided to do it this way instead of stuffing everything in the config file, here are a couple of reasons:
@ -79,6 +83,9 @@
*/
#define PROGRESS_FILE "storage/progress.dat"
#define PROGRESS_MAXFILESIZE 4096
GlobalProgress progress;
static uint8_t progress_magic_bytes[] = {

View file

@ -9,27 +9,8 @@
#pragma once
#include "taisei.h"
#include <SDL.h>
#include "cutscenes/cutscene.h"
#define PROGRESS_FILE "storage/progress.dat"
#define PROGRESS_MAXFILESIZE 4096
typedef enum ProgfileCommand {
// Do not reorder this!
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,
PCMD_UNLOCK_BGMS = 0x07,
PCMD_UNLOCK_CUTSCENES = 0x08,
} ProgfileCommand;
typedef struct StageProgress {
// Keep this struct small if you can
// See stage_get_progress_from_info() in stage.c for more information
@ -65,8 +46,6 @@ typedef enum ProgressBGMID {
PBGM_INTRO,
} ProgressBGMID;
struct UnknownCmd;
typedef enum EndingID {
// WARNING: Reordering this will break current progress files.
@ -103,8 +82,6 @@ typedef struct GlobalProgress {
} game_settings;
} GlobalProgress;
extern GlobalProgress progress;
void progress_load(void);