diff --git a/th02/gaiji/boldfont.h b/th02/gaiji/boldfont.h new file mode 100644 index 000000000..5a06a4338 --- /dev/null +++ b/th02/gaiji/boldfont.h @@ -0,0 +1,47 @@ +// In TH02, ZUN messed up and swapped M and N in MIKOFT.BFT for both regular +// and bold fonts. Therefore, other code shouldn't really use the +// straightforward solution of just adding char literals to a defined start +// offset, as it may suggest that this also works for M and N (which it +// doesn't). This was fixed in later games. +#if (GAME == 2) +# define gb_MN_BUG gb_N_, gb_M_ +#else +# define gb_MN_BUG gb_M_, gb_N_ +#endif + +#define gaiji_boldfont(start) \ + gb_0_ = start, \ + gb_1_, \ + gb_2_, \ + gb_3_, \ + gb_4_, \ + gb_5_, \ + gb_6_, \ + gb_7_, \ + gb_8_, \ + gb_9_, \ + gb_A_, \ + gb_B_, \ + gb_C_, \ + gb_D_, \ + gb_E_, \ + gb_F_, \ + gb_G_, \ + gb_H_, \ + gb_I_, \ + gb_J_, \ + gb_K_, \ + gb_L_, \ + gb_MN_BUG, \ + gb_O_, \ + gb_P_, \ + gb_Q_, \ + gb_R_, \ + gb_S_, \ + gb_T_, \ + gb_U_, \ + gb_V_, \ + gb_W_, \ + gb_X_, \ + gb_Y_, \ + gb_Z_ diff --git a/th02/gaiji/gaiji.h b/th02/gaiji/gaiji.h new file mode 100644 index 000000000..ee14b7af5 --- /dev/null +++ b/th02/gaiji/gaiji.h @@ -0,0 +1,36 @@ +// ReC98 +// ----- +// Gaiji available to TH02 + +#include "th02/gaiji/boldfont.h" + +typedef enum { + gs_YINYANG = 0x02, // ☯ + gs_BOMB, // ◉? ⦿? 🎯? 🖸? Or simply 💣? + + gaiji_boldfont(0xA0), + + gb_SP = 0xCF, + gs_BULLET = 0xDA, // • + gs_PERIOD, // . + gs_EXCLAMATION, // ! + gs_QUESTION, // ? + gs_ELLIPSIS, // … + gs_COPYRIGHT, // © + gs_HEART, // 🎔 + gs_SKULL, // 💀 + gs_GHOST, // 👻 + gs_SIDDHAM_HAM, // Siddhaṃ seed syllable HĀṂ (I don't even) + gs_SPACE, // ␠ + gs_ARROW_LEFT, // ← + gs_ARROW_RIGHT, // → + gs_END, // "End" + + // Unused 32x16 rank sprites + gs_EA, gs_SY, // "Ea", "sy" + gs_NOR, gs_MAL, // "Nor, "mal" + gs_HA, gs_RD, // "Ha, "rd" + gs_LUN, gs_ATIC, // "Lun", "atic" + + gs_ALL, // "All" +} gaiji_th02_t; diff --git a/th02/maine_04.c b/th02/maine_04.c index ddb2217f9..4a8ae2df2 100644 --- a/th02/maine_04.c +++ b/th02/maine_04.c @@ -4,6 +4,7 @@ */ #include "th02/th02.h" +#include "th02/gaiji/gaiji.h" #include "th02/score.h" #include "th02/score.c" #include "th02/scoreenc.c" @@ -49,7 +50,7 @@ void pascal score_points_put(unsigned y, long points, unsigned atrb) for(x = 26; x < 26 + (8 * 2); x += 2) { result = (points / divisor) % 10; divisor /= 10; - digit = result + GB_DIGITS; + digit = result + gb_0_; if(result) { putting = 1; } @@ -84,7 +85,7 @@ void pascal near scores_put(int place_to_highlight) gaiji_putsa(10, 6+i, (const char*)hi.score.g_name[i], atrb); score_points_put(6+i, hi.score.points[i], atrb); if(hi.score.stage[i] != STAGE_ALL) { - gaiji_putca(44, 6+i, hi.score.stage[i] + GB_DIGITS, atrb); + gaiji_putca(44, 6+i, hi.score.stage[i] + gb_0_, atrb); } else { gaiji_putca(44, 6+i, gs_ALL, atrb); } @@ -92,7 +93,7 @@ void pascal near scores_put(int place_to_highlight) for(i = 0; i < SCOREDAT_PLACES; i++) { ATRB_SET(i); if(i != 9) { - gaiji_putca(6, 6+i, GB_DIGITS+i+1, atrb); + gaiji_putca(6, 6+i, gb_1_ + i, atrb); } else { gaiji_putca(4, 15, gb_1_, atrb); gaiji_putca(6, 15, gb_0_, atrb); diff --git a/th02/op_01.c b/th02/op_01.c index 27c998f65..adb12db47 100644 --- a/th02/op_01.c +++ b/th02/op_01.c @@ -10,6 +10,7 @@ #include "th02/formats/cfg.h" #include "th02/formats/pi.h" #include "th02/snd/snd.h" +#include "th02/gaiji/gaiji.h" #pragma option -d -a2 @@ -465,14 +466,14 @@ void pascal near option_put(int sel, unsigned int atrb) graph_gaiji_puts(380, 276, 16, gbcBGM_MODE[snd_bgm_mode], 0); } else if(sel == 2) { gaiji_putsa(24, 18, gbPLAYER, atrb); - gaiji_putca(49, 18, lives + 1 + GB_DIGITS, atrb); + gaiji_putca(49, 18, lives + 1 + gb_0_, atrb); graph_copy_rect_1_to_0(392, 292, 32, 16); - graph_gaiji_putc(396, 292, lives + 1 + GB_DIGITS, 0); + graph_gaiji_putc(396, 292, lives + 1 + gb_0_, 0); } else if(sel == 3) { gaiji_putsa(24, 19, gbBOMB, atrb); - gaiji_putca(49, 19, bombs + GB_DIGITS, atrb); + gaiji_putca(49, 19, bombs + gb_0_, atrb); graph_copy_rect_1_to_0(392, 308, 32, 16); - graph_gaiji_putc(396, 308, bombs + GB_DIGITS, 0); + graph_gaiji_putc(396, 308, bombs + gb_0_, 0); } else if(sel == 4) { text_putsa(24, 20, PERF_TITLE, atrb); text_putsa(45, 20, PERF_OPTIONS[resident->perf], atrb); diff --git a/th02/op_04.c b/th02/op_04.c index 8ed4dd8ee..1ceb44ff3 100644 --- a/th02/op_04.c +++ b/th02/op_04.c @@ -6,6 +6,7 @@ #include #include #include "th02/th02.h" +#include "th02/gaiji/gaiji.h" char rank = RANK_NORMAL; int8_t rank_padding = 0; @@ -34,7 +35,7 @@ unsigned int score_duration; // Slightly differs from the same function in MAINE.EXE! void pascal near score_points_put(unsigned y, long points, unsigned atrb) { - unsigned digit = GB_DIGITS; + unsigned digit = gb_0_; long divisor = 10000000; long result; char putting = 0; @@ -42,7 +43,7 @@ void pascal near score_points_put(unsigned y, long points, unsigned atrb) for(i = 0; i < 8; i++) { result = divisor ? (points / divisor) % 10 : points % 10; divisor /= 10; - digit = result + GB_DIGITS; + digit = result + gb_0_; if(result) { putting = 1; } @@ -104,7 +105,7 @@ void pascal near scores_put(int place_to_highlight) gaiji_putsa(12, 7+i, hi.score.g_name[i], atrb); score_points_put(7+i, hi.score.points[i], atrb); if(hi.score.stage[i] != STAGE_ALL) { - gaiji_putca(44, 7+i, hi.score.stage[i] + GB_DIGITS, atrb); + gaiji_putca(44, 7+i, hi.score.stage[i] + gb_0_, atrb); } else { gaiji_putca(44, 7+i, gs_ALL, atrb); } @@ -114,7 +115,7 @@ void pascal near scores_put(int place_to_highlight) for(i = 0; i < SCOREDAT_PLACES; i++) { ATRB_SET(i); if(i != 9) { - gaiji_putca(9, 7+i, GB_DIGITS+i+1, atrb); + gaiji_putca(9, 7+i, gb_1_ + i, atrb); } else { gaiji_putca(8, 16, gb_1_, atrb); gaiji_putca(10, 16, gb_0_, atrb); diff --git a/th02/th02.h b/th02/th02.h index 1e8bae00a..035e4f868 100644 --- a/th02/th02.h +++ b/th02/th02.h @@ -44,85 +44,6 @@ void pascal mptn_free(void); void pascal graph_copy_rect_1_to_0(int x, int y, int w, int h); // ------- -// Gaiji characters -// ---------------- -/* ZUN messed up and swapped M and N in MIKOFT.BFT for both regular and bold - * fonts. Therefore, other code shouldn't really use the straightforward - * solution of just adding char literals to a defined start offset, as it may - * suggest that this also works for M and N (which it doesn't). So... - */ -typedef enum { - GB_DIGITS = 160, - gb_0_ = GB_DIGITS, - gb_1_, - gb_2_, - gb_3_, - gb_4_, - gb_5_, - gb_6_, - gb_7_, - gb_8_, - gb_9_, - - GB_LETTERS = 105, - gb_A_ = GB_LETTERS + 'A', - gb_B_, - gb_C_, - gb_D_, - gb_E_, - gb_F_, - gb_G_, - gb_H_, - gb_I_, - gb_J_, - gb_K_, - gb_L_, - gb_M_ = GB_LETTERS + 'N', - gb_N_ = GB_LETTERS + 'M', - gb_O_ = GB_LETTERS + 'O', - gb_P_, - gb_Q_, - gb_R_, - gb_S_, - gb_T_, - gb_U_, - gb_V_, - gb_W_, - gb_X_, - gb_Y_, - gb_Z_, - - gb_SP = 207, -} gaiji_bold_t; - -typedef enum { - gs_YINYANG = 2, // ☯ - gs_BOMB, // ◉? ⦿? 🎯? 🖸? Or simply 💣? - gs_BULLET = 218, // • - gs_PERIOD, // . - gs_EXCLAMATION, // ! - gs_QUESTION, // ? - gs_ELLIPSIS, // … - gs_COPYRIGHT, // © - gs_HEART, // 🎔 - gs_SKULL, // 💀 - gs_GHOST, // 👻 - gs_SIDDHAM_HAM, // Siddhaṃ seed syllable HĀṂ (I don't even) - gs_SPACE, // ␠ - gs_ARROW_LEFT, // ← - gs_ARROW_RIGHT, // → - gs_END, // "End" - - // Unused 32x16 rank sprites - gs_EA, gs_SY, // "Ea", "sy" - gs_NOR, gs_MAL, // "Nor, "mal" - gs_HA, gs_RD, // "Ha, "rd" - gs_LUN, gs_ATIC, // "Lun", "atic" - - gs_ALL, // "All" -} gaiji_symbols_t; -// ---------------- - typedef enum { INPUT_UP = 0x1, INPUT_DOWN = 0x2, diff --git a/th02/zun_res3.c b/th02/zun_res3.c index 7ced4a8e6..090a9fccf 100644 --- a/th02/zun_res3.c +++ b/th02/zun_res3.c @@ -4,6 +4,7 @@ */ #include "th02/th02.h" +#include "th02/gaiji/gaiji.h" extern scoredat_section_t hi; extern const char *SCOREDAT_FN; diff --git a/th03/gaiji/bar.h b/th03/gaiji/bar.h new file mode 100644 index 000000000..190aeb6ac --- /dev/null +++ b/th03/gaiji/bar.h @@ -0,0 +1,20 @@ +// Enemy health / dream / power bars, with the given width in pixels. +#define gaiji_bar(start) \ + g_BAR_01W = start, \ + g_BAR_02W, \ + g_BAR_03W, \ + g_BAR_04W, \ + g_BAR_05W, \ + g_BAR_06W, \ + g_BAR_07W, \ + g_BAR_08W, \ + g_BAR_09W, \ + g_BAR_10W, \ + g_BAR_11W, \ + g_BAR_12W, \ + g_BAR_13W, \ + g_BAR_14W, \ + g_BAR_15W, \ + g_BAR_16W + +#define BAR_GAIJI_MAX 16 diff --git a/th03/gaiji/bar.inc b/th03/gaiji/bar.inc index 14273c5b8..90ed36536 100644 --- a/th03/gaiji/bar.inc +++ b/th03/gaiji/bar.inc @@ -1,4 +1,3 @@ -; Enemy health / dream / power bars G_BAR = 020h g_BAR_01W = 020h g_BAR_02W = 021h @@ -18,17 +17,3 @@ g_BAR_15W = 02Eh g_BAR_16W = 02Fh BAR_GAIJI_MAX = 16 - -if GAME ge 4 - ; 8 regular bar cell sprites with 16 pixels filled in TH04. TH05 has *MAX♡ - ; drawn on the last three. - g_BAR_MAX = 030h - g_BAR_MAX_0 = 030h - g_BAR_MAX_1 = 031h - g_BAR_MAX_2 = 032h - g_BAR_MAX_3 = 033h - g_BAR_MAX_4 = 034h - g_BAR_MAX_5 = 035h - g_BAR_MAX_6 = 036h - g_BAR_MAX_7 = 037h -endif diff --git a/th03/gaiji/gaiji.h b/th03/gaiji/gaiji.h index 55e8ba315..8b563942c 100644 --- a/th03/gaiji/gaiji.h +++ b/th03/gaiji/gaiji.h @@ -2,9 +2,12 @@ // ----- // Gaiji available to TH03 -// 1P/2P selection cursor -#define gc_GAIJI_W 2 +#include "th03/gaiji/bar.h" + typedef enum { + // 1P/2P selection cursor + #define gc_GAIJI_W 2 + gc_P1_TOP_1 = 0x12, gc_P1_TOP_2 = 0x13, gc_P1_BOTTOM_1 = 0x14, @@ -13,4 +16,6 @@ typedef enum { gc_P2_TOP_2 = 0x17, gc_P2_BOTTOM_1 = 0x18, gc_P2_BOTTOM_2 = 0x19, -} gaiji_cursor_t; + gaiji_bar(0x20), + gaiji_boldfont(0xA0), +} gaiji_th03_t; diff --git a/th04/gaiji/bar.h b/th04/gaiji/bar.h new file mode 100644 index 000000000..d5db0d8bd --- /dev/null +++ b/th04/gaiji/bar.h @@ -0,0 +1,14 @@ +#include "th03/gaiji/bar.h" + +// A completely filled, 128-pixel bar, stored in 8 consecutive gaiji +// characters. TH05 has *MAX♡ drawn on the last three. +#define G_BAR_MAX(sprite) +#define gaiji_bar_max(start) \ + g_BAR_MAX_0 = start, \ + g_BAR_MAX_1, \ + g_BAR_MAX_2, \ + g_BAR_MAX_3, \ + g_BAR_MAX_4, \ + g_BAR_MAX_5, \ + g_BAR_MAX_6, \ + g_BAR_MAX_7 diff --git a/th04/gaiji/bar.inc b/th04/gaiji/bar.inc new file mode 100644 index 000000000..cf271e839 --- /dev/null +++ b/th04/gaiji/bar.inc @@ -0,0 +1,11 @@ +include th03/gaiji/bar.inc + + g_BAR_MAX = 030h +g_BAR_MAX_0 = 030h +g_BAR_MAX_1 = 031h +g_BAR_MAX_2 = 032h +g_BAR_MAX_3 = 033h +g_BAR_MAX_4 = 034h +g_BAR_MAX_5 = 035h +g_BAR_MAX_6 = 036h +g_BAR_MAX_7 = 037h diff --git a/th04/gaiji/gaiji.h b/th04/gaiji/gaiji.h new file mode 100644 index 000000000..2cfd6b792 --- /dev/null +++ b/th04/gaiji/gaiji.h @@ -0,0 +1,17 @@ +// ReC98 +// ----- +// Gaiji available to TH04 + +#include "th02/gaiji/boldfont.h" +#include "th04/gaiji/bar.h" + +typedef enum { + g_EMPTY = 0x02, + gaiji_bar(0x20), + gaiji_bar_max(0x30), + gaiji_boldfont(0xA0), + gs_DOT = 0xC4, + gs_ALL = 0xE9, + g_HISCORE_STAGE_EMPTY = 0xEF, + g_NONE = 0xFF, +} gaiji_th04_t; diff --git a/th04/gaiji/gaiji.inc b/th04/gaiji/gaiji.inc index e2e31c94d..ccfdd50bd 100644 --- a/th04/gaiji/gaiji.inc +++ b/th04/gaiji/gaiji.inc @@ -3,7 +3,7 @@ ; Gaiji available to TH04 and TH05 g_EMPTY = 2 -include th03/gaiji/bar.inc +include th04/gaiji/bar.inc include th02/gaiji/boldfont.inc gs_DOT = 0C4h gs_ALL = 0E9h