2020-03-20 19:24:39 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* Code segment #19 of TH01's REIIDEN.EXE
|
|
|
|
*/
|
|
|
|
|
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-01-26 15:33:06 +00:00
|
|
|
#include "master.hpp"
|
2022-08-09 01:24:33 +00:00
|
|
|
#include "shiftjis.hpp"
|
2021-11-22 10:48:24 +00:00
|
|
|
#include "th01/rank.h"
|
2023-02-01 03:29:07 +00:00
|
|
|
#include "th01/resident.hpp"
|
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"
|
2023-01-29 19:57:40 +00:00
|
|
|
#include "th01/hardware/grp_text.hpp"
|
2022-08-07 00:01:37 +00:00
|
|
|
#include "th01/shiftjis/fns.hpp"
|
|
|
|
#include "th01/shiftjis/regist.hpp"
|
2021-11-01 11:16:07 +00:00
|
|
|
#include "th01/formats/scoredat.hpp"
|
2020-03-20 19:24:39 +00:00
|
|
|
|
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().
|
2023-02-01 03:29:07 +00:00
|
|
|
score_t scoredat_hiscore_get()
|
2020-03-20 19:24:39 +00:00
|
|
|
{
|
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
|
|
|
|
2022-08-09 01:24:33 +00:00
|
|
|
void pascal near str_from_swapped_kanji(
|
|
|
|
shiftjis_t str[3], shiftjis_kanji_swapped_t kanji
|
|
|
|
)
|
2020-03-28 11:04:05 +00:00
|
|
|
{
|
2022-08-09 01:24:33 +00:00
|
|
|
uint8_t tmp;
|
|
|
|
(reinterpret_cast<shiftjis_kanji_t *>(str))[0] = kanji;
|
2020-03-28 11:04:05 +00:00
|
|
|
tmp = str[1];
|
|
|
|
str[1] = str[0];
|
|
|
|
str[0] = tmp;
|
|
|
|
str[2] = '\0';
|
|
|
|
}
|
|
|
|
|
2022-08-09 01:24:33 +00:00
|
|
|
#define graph_putkanji_fx_declare() shiftjis_t kanji_str[3];
|
2022-08-07 00:01:37 +00:00
|
|
|
#define graph_putkanji_fx(left, top, col_and_fx, kanji) { \
|
2022-08-09 01:24:33 +00:00
|
|
|
str_from_swapped_kanji(kanji_str, kanji); \
|
2022-08-07 00:01:37 +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
|
2022-08-07 00:01:37 +00:00
|
|
|
#define graph_printf_s_fx graph_putsa_fx
|
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) \
|
2022-08-09 01:24:33 +00:00
|
|
|
unsigned char route[sizeof(shiftjis_kanji_t) + 1]; \
|
2020-05-14 18:52:40 +00:00
|
|
|
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-19 19:08:46 +00:00
|
|
|
// A completely hidden timeout that force-enters a high score name after
|
2023-04-17 01:53:29 +00:00
|
|
|
// 1000... *keyboard inputs*? Not frames? Why. Like, how do you even
|
2020-05-19 19:08:46 +00:00
|
|
|
// 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
|
|
|
|
|
2022-08-14 04:21:01 +00:00
|
|
|
#define regist_bg_put(stage_num_or_scoredat_constant) { \
|
2020-05-22 17:27:50 +00:00
|
|
|
z_graph_clear_0(); \
|
|
|
|
z_palette_black(); \
|
|
|
|
graph_accesspage_func(1); \
|
|
|
|
\
|
2022-08-14 04:21:01 +00:00
|
|
|
if(stage_num_or_scoredat_constant < SCOREDAT_NOT_CLEARED) { \
|
2022-08-07 00:01:37 +00:00
|
|
|
grp_put_palette_show("game_o.grp"); \
|
2020-05-22 17:27:50 +00:00
|
|
|
} 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(); \
|
|
|
|
}
|
|
|
|
|
2022-08-14 04:21:01 +00:00
|
|
|
#define regist_title_put( \
|
|
|
|
left, stage_num_or_scoredat_constant, ranks, col_and_fx \
|
|
|
|
) { \
|
|
|
|
if(stage_num_or_scoredat_constant < SCOREDAT_NOT_CLEARED) { \
|
2022-08-07 00:01:37 +00:00
|
|
|
graph_putsa_fx( \
|
|
|
|
left, TITLE_BACK_TOP, col_and_fx, REGIST_TITLE_WITH_SPACE \
|
|
|
|
); \
|
|
|
|
graph_putsa_fx( \
|
|
|
|
(left + REGIST_TITLE_W), TITLE_BACK_TOP, col_and_fx, ranks[rank] \
|
|
|
|
); \
|
2020-05-22 17:27:50 +00:00
|
|
|
} else { \
|
2022-08-07 00:01:37 +00:00
|
|
|
graph_putsa_fx(left, TITLE_TOP, col_and_fx, REGIST_TITLE); \
|
|
|
|
graph_putsa_fx( \
|
|
|
|
(left + REGIST_TITLE_W), 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"
|
2021-10-31 19:51:32 +00:00
|
|
|
#include "th01/main/hiscore.cpp"
|
2022-08-10 16:10:53 +00:00
|
|
|
|
|
|
|
static int32_t unused; // ZUN bloat
|