2020-03-20 17:40:56 +00:00
|
|
|
#define SCOREDAT_MAGIC "HISCORE"
|
|
|
|
#define SCOREDAT_PLACES 10
|
|
|
|
#define SCOREDAT_NAME_KANJI 8
|
2022-08-15 10:53:06 +00:00
|
|
|
|
|
|
|
// Actually creates slightly different assembly compared to sizeof() on an
|
2020-03-20 17:40:56 +00:00
|
|
|
// int8_t array!
|
|
|
|
#define SCOREDAT_NAME_BYTES (SCOREDAT_NAME_KANJI * 2)
|
2020-05-18 19:29:12 +00:00
|
|
|
#define SCOREDAT_NAMES_SIZE (SCOREDAT_PLACES * SCOREDAT_NAME_BYTES)
|
2020-05-14 18:52:40 +00:00
|
|
|
#define SCOREDAT_ROUTE_LEN 2
|
2020-03-20 17:40:56 +00:00
|
|
|
|
|
|
|
#define SCOREDAT_CLEARED 40
|
|
|
|
#define SCOREDAT_CLEARED_MAKAI (SCOREDAT_CLEARED + 10)
|
|
|
|
#define SCOREDAT_CLEARED_JIGOKU (SCOREDAT_CLEARED + 20)
|
|
|
|
|
|
|
|
#define SCOREDAT_NAME_KEY 0x9C
|
|
|
|
|
|
|
|
// Encodes or decodes a single name byte.
|
|
|
|
int8_t scoredat_name_byte_encode(int8_t byte);
|
|
|
|
int8_t scoredat_name_byte_decode(int8_t byte);
|
|
|
|
|
2022-08-09 01:24:33 +00:00
|
|
|
#if 0
|
2020-03-20 17:40:56 +00:00
|
|
|
// On-disk structure of the REYHI*.DAT files.
|
|
|
|
// For reference, never actually used by the game itself
|
|
|
|
struct scoredat_t {
|
|
|
|
// Not null-terminated!
|
|
|
|
char magic[sizeof(SCOREDAT_MAGIC) - 1];
|
2021-09-06 18:16:39 +00:00
|
|
|
|
|
|
|
// Not null-terminated.
|
2022-08-09 01:24:33 +00:00
|
|
|
shiftjis_kanji_t name[SCOREDAT_PLACES][SCOREDAT_NAME_KANJI];
|
2021-09-06 18:16:39 +00:00
|
|
|
|
2021-12-17 21:19:17 +00:00
|
|
|
uint32_t score[SCOREDAT_PLACES];
|
2020-03-20 17:40:56 +00:00
|
|
|
int16_t stage[SCOREDAT_PLACES];
|
2022-08-09 01:24:33 +00:00
|
|
|
shiftjis_kanji_t route[SCOREDAT_PLACES];
|
2020-03-20 17:40:56 +00:00
|
|
|
};
|
2022-08-09 01:24:33 +00:00
|
|
|
#endif
|
2020-03-20 17:40:56 +00:00
|
|
|
|
2020-03-20 19:24:39 +00:00
|
|
|
// Loads the score file for the current [rank], recreating it if necessary.
|
|
|
|
// Returns 0 on success, 1 on failure.
|
|
|
|
int scoredat_load();
|
|
|
|
|
2021-11-01 16:32:20 +00:00
|
|
|
// Loads only the high score for the current [rank] into the resident
|
|
|
|
// structure.
|
|
|
|
void scoredat_load_hiscore();
|
2020-03-20 17:40:56 +00:00
|
|
|
|
|
|
|
// Sets [str] to the null-terminated name at the given [place] for the
|
2020-03-20 19:24:39 +00:00
|
|
|
// difficulty previously loaded by scoredat_load().
|
2020-03-20 17:40:56 +00:00
|
|
|
void scoredat_name_get(int place, char str[SCOREDAT_NAME_BYTES + 1]);
|