From c3a9816e6013d1d8d59d2ecb95e3a1e2eee4b815 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Wed, 1 Jan 2020 21:17:50 +0100 Subject: [PATCH] [Maintenance] [th04/th05] Declare a little-endian BCD score type Only in C land though; doing the same in ASM land actually makes digit accesses harder to read. Part of P0065, funded by Touhou Patch Center. --- th04/formats/scoredat.h | 6 ++++-- th04/score.h | 7 +++++++ th04/shared.hpp | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/th04/formats/scoredat.h b/th04/formats/scoredat.h index e6005d55..06c24f1b 100644 --- a/th04/formats/scoredat.h +++ b/th04/formats/scoredat.h @@ -1,4 +1,4 @@ -#include "th02/score.h" +#include "th04/score.h" #if GAME == 5 # define SCOREDAT_PLACES 5 @@ -14,9 +14,10 @@ #define SCOREDAT_NAME_LEN 8 +#pragma option -a1 typedef struct { unsigned char g_name[SCOREDAT_PLACES][SCOREDAT_NAME_LEN + 1]; - unsigned char g_points[SCOREDAT_PLACES][SCORE_DIGITS]; + score_lebcd_t g_points[SCOREDAT_PLACES]; #if GAME == 5 unsigned char g_stage[SCOREDAT_PLACES]; @@ -29,6 +30,7 @@ typedef struct { unsigned char unused_2[SCOREDAT_PLACES]; #endif } scoredat_t; +#pragma option -a. typedef struct { int8_t key1; diff --git a/th04/score.h b/th04/score.h index cf57e4e2..52305d89 100644 --- a/th04/score.h +++ b/th04/score.h @@ -1 +1,8 @@ +#include "th02/score.h" + +typedef union { + unsigned char continues_used; + unsigned char digits[SCORE_DIGITS]; +} score_lebcd_t; + extern unsigned char extends_gained; diff --git a/th04/shared.hpp b/th04/shared.hpp index e2f269e1..5f364f3c 100644 --- a/th04/shared.hpp +++ b/th04/shared.hpp @@ -32,6 +32,7 @@ int pascal far select_for_rank( /// Player /// ------ #include "th04/player/player.h" +#include "th04/score.h" /// ------ /// Stages