2020-03-20 19:24:39 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* Code segment #19 of TH01's REIIDEN.EXE
|
|
|
|
*/
|
|
|
|
|
2020-10-03 16:20:41 +00:00
|
|
|
#pragma option -d
|
2020-03-20 19:24:39 +00:00
|
|
|
|
2020-05-18 19:29:12 +00:00
|
|
|
#include <io.h>
|
|
|
|
#include <stdio.h>
|
2021-01-26 15:33:06 +00:00
|
|
|
#include <string.h>
|
2021-09-19 18:51:21 +00:00
|
|
|
#include "platform.h"
|
2021-02-07 20:03:00 +00:00
|
|
|
#include "x86real.h"
|
2021-09-19 18:51:21 +00:00
|
|
|
#include "pc98.h"
|
|
|
|
#include "planar.h"
|
2021-09-06 18:16:39 +00:00
|
|
|
#include "decomp.hpp"
|
2021-01-12 20:09:19 +00:00
|
|
|
#include "twobyte.h"
|
2021-01-26 15:33:06 +00:00
|
|
|
#include "master.hpp"
|
2021-11-22 10:48:24 +00:00
|
|
|
#include "th01/rank.h"
|
2022-04-02 04:19:18 +00:00
|
|
|
extern "C" {
|
2020-05-22 17:27:50 +00:00
|
|
|
#include "th01/formats/grp.h"
|
|
|
|
#include "th01/hardware/palette.h"
|
2021-10-13 13:25:30 +00:00
|
|
|
#include "th01/hardware/input.hpp"
|
2020-03-28 11:04:05 +00:00
|
|
|
#include "th01/hardware/graph.h"
|
2022-05-21 16:21:43 +00:00
|
|
|
}
|
2020-03-20 19:24:39 +00:00
|
|
|
#include "th01/hiscore/scoredat.hpp"
|
|
|
|
|
|
|
|
extern char rank;
|
|
|
|
|
2022-03-11 23:48:15 +00:00
|
|
|
#define scoredat_declare()
|
2020-03-20 19:24:39 +00:00
|
|
|
#define scoredat_cli()
|
|
|
|
#define scoredat_sti()
|
|
|
|
#define scoredat_error(str)
|
|
|
|
#define scoredat_exist(fn) file_exist(fn)
|
|
|
|
#define scoredat_create(fn) file_create(fn)
|
|
|
|
#define scoredat_ropen(fn) file_ropen(fn)
|
|
|
|
#define scoredat_read(buf, size) file_read(buf, size)
|
|
|
|
#define scoredat_write(buf, size) file_write(buf, size)
|
|
|
|
#define scoredat_close() file_close()
|
|
|
|
#include "th01/hiscore/scorelod.cpp"
|
|
|
|
|
2021-11-01 16:32:20 +00:00
|
|
|
// Returns the high score for the difficulty previously loaded by
|
|
|
|
// scoredat_load().
|
2020-03-20 19:24:39 +00:00
|
|
|
uint32_t scoredat_hiscore_get()
|
|
|
|
{
|
2021-12-17 21:19:17 +00:00
|
|
|
return scoredat_score[0];
|
2020-03-20 19:24:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "th01/hiscore/score_nm.cpp"
|
2020-03-28 11:04:05 +00:00
|
|
|
|
|
|
|
void pascal near str_from_kanji(char str[3], uint16_t kanji)
|
|
|
|
{
|
|
|
|
char tmp;
|
|
|
|
(reinterpret_cast<uint16_t *>(str))[0] = kanji;
|
|
|
|
tmp = str[1];
|
|
|
|
str[1] = str[0];
|
|
|
|
str[0] = tmp;
|
|
|
|
str[2] = '\0';
|
|
|
|
}
|
|
|
|
|
2022-03-11 23:48:15 +00:00
|
|
|
#define graph_putkanji_fx_declare() char kanji_str[3];
|
2020-10-26 13:30:35 +00:00
|
|
|
#define graph_putkanji_fx(left, top, col_and_fx, fmt_instance, kanji) \
|
2020-03-28 11:04:05 +00:00
|
|
|
str_from_kanji(kanji_str, kanji); \
|
2020-10-26 13:30:35 +00:00
|
|
|
graph_putsa_fx(left, top, col_and_fx, kanji_str);
|
2020-03-28 11:04:05 +00:00
|
|
|
#define graph_printf_fx graph_putsa_fx
|
|
|
|
|
2020-10-26 13:30:35 +00:00
|
|
|
#define graph_printf_s_fx(left, top, col_and_fx, fmt_instance, str) \
|
|
|
|
graph_putsa_fx(left, top, col_and_fx, str);
|
2020-05-16 19:21:02 +00:00
|
|
|
|
2020-10-26 13:30:35 +00:00
|
|
|
#define regist_route_put(left, top, col_and_fx, char_1, char_2) \
|
2020-05-14 18:52:40 +00:00
|
|
|
unsigned char route[sizeof(twobyte_t) + 1]; \
|
|
|
|
route[2] = '\0'; \
|
|
|
|
route[0] = char_1; \
|
|
|
|
route[1] = char_2; \
|
2020-10-26 13:30:35 +00:00
|
|
|
graph_putsa_fx(left, top, col_and_fx, route); \
|
2020-05-14 18:52:40 +00:00
|
|
|
|
2020-05-15 17:32:39 +00:00
|
|
|
#define ALPHABET_SPACE_0 ALPHABET_SPACE
|
|
|
|
#define ALPHABET_LEFT_0 ALPHABET_LEFT
|
|
|
|
#define ALPHABET_RIGHT_0 ALPHABET_RIGHT
|
|
|
|
#define ALPHABET_ENTER_0 ALPHABET_ENTER
|
|
|
|
|
2020-05-19 19:08:46 +00:00
|
|
|
// A completely hidden timeout that force-enters a high score name after
|
|
|
|
// 1000... *keyboard inputs*? Not frames? Why. Like, how do even you
|
|
|
|
// realistically get to such a number.
|
|
|
|
// (Best guess: It's a hidden easter egg to amuse players who place drinking
|
|
|
|
// glasses on cursor keys. Or beer bottles.)
|
|
|
|
#define regist_input_timeout_declare() unsigned int timeout;
|
|
|
|
#define regist_input_timeout_reset() timeout = 0;
|
|
|
|
#define regist_input_timeout_inc() timeout++;
|
|
|
|
#define regist_input_timeout_if_reached(then) if(timeout > 1000) then
|
|
|
|
|
2020-05-22 17:27:50 +00:00
|
|
|
#define regist_bg_put(stage) { \
|
|
|
|
extern const char REGIST_BG_NOT_CLEARED[]; \
|
|
|
|
extern const char REGIST_BG_CLEARED[]; \
|
|
|
|
z_graph_clear_0(); \
|
|
|
|
z_palette_black(); \
|
|
|
|
graph_accesspage_func(1); \
|
|
|
|
\
|
|
|
|
if(stage < SCOREDAT_NOT_CLEARED) { \
|
|
|
|
grp_put_palette_show(REGIST_BG_NOT_CLEARED); \
|
|
|
|
} else { \
|
|
|
|
grp_put(REGIST_BG_CLEARED); \
|
|
|
|
} \
|
2021-11-07 17:26:03 +00:00
|
|
|
graph_copy_accessed_page_to_other(); \
|
2020-05-22 17:27:50 +00:00
|
|
|
z_palette_black_in(); \
|
|
|
|
}
|
|
|
|
|
2020-10-26 13:30:35 +00:00
|
|
|
#define regist_title_put(left, stage, ranks, col_and_fx) { \
|
2020-05-22 17:27:50 +00:00
|
|
|
extern const char REGIST_TITLE_1[]; \
|
|
|
|
extern const char REGIST_TITLE_2[]; \
|
|
|
|
if(stage < SCOREDAT_NOT_CLEARED) { \
|
2020-10-26 13:30:35 +00:00
|
|
|
graph_putsa_fx(left + 0, TITLE_BACK_TOP, col_and_fx, REGIST_TITLE_1); \
|
|
|
|
graph_putsa_fx(left + 192, TITLE_BACK_TOP, col_and_fx, ranks[rank]); \
|
2020-05-22 17:27:50 +00:00
|
|
|
} else { \
|
2020-10-26 13:30:35 +00:00
|
|
|
graph_putsa_fx(left + 0, TITLE_TOP, col_and_fx, REGIST_TITLE_2); \
|
|
|
|
graph_putsa_fx(left + 192, TITLE_TOP, col_and_fx, ranks[rank]); \
|
2020-05-22 17:27:50 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2020-05-14 18:52:40 +00:00
|
|
|
#include "th01/hiscore/regist.cpp"
|