From 15c9d0e820bb9b8da5e2cb283953d7c0594ec427 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Thu, 2 Jan 2025 21:48:29 +0900 Subject: [PATCH] RottenBlock's changes for Rance 2 Hint Disk --- src/sys/ags_draw.cpp | 2 ++ src/sys/game_id.cpp | 6 ++++++ src/sys/game_id.h | 5 +++++ src/sys/nact.h | 2 ++ src/sys/nact_sys1.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+) diff --git a/src/sys/ags_draw.cpp b/src/sys/ags_draw.cpp index 2002357..fc6cbf7 100644 --- a/src/sys/ags_draw.cpp +++ b/src/sys/ags_draw.cpp @@ -142,6 +142,8 @@ void AGS::gcopy(int gsc, int gde, int glx, int gly, int gsw) void AGS::paint(int x, int y, uint8 color) { + if (x < 0 || y < 0) return; + int old_color = vram[0][y][x]; if (old_color == color) return; diff --git a/src/sys/game_id.cpp b/src/sys/game_id.cpp index 71870fd..b2db747 100644 --- a/src/sys/game_id.cpp +++ b/src/sys/game_id.cpp @@ -73,6 +73,9 @@ #define CRC32_NINGYO 0xd491e7ab // 人魚 -蘿子- #define CRC32_MUGENHOUYOU 0xbb27d1ba // 夢幻泡影 +#define CRC32_RANCE2 0x12345678 +#define CRC32_RANCE2_HINT 0x34567890 + namespace { const struct CRCTable { @@ -143,6 +146,9 @@ const struct CRCTable { {GameId::NINGYO, "ningyo", 3, "人魚 -蘿子-", JAPANESE, CRC32_NINGYO}, {GameId::MUGEN, "mugen", 3, "夢幻泡影", JAPANESE, CRC32_MUGENHOUYOU}, + {GameId::RANCE2, "rance2", 1, "Rance 2", ENGLISH, CRC32_RANCE2}, + {GameId::RANCE2_HINT, "rance2_hint", 1, "Rance 2 Hint Disk", ENGLISH, CRC32_RANCE2_HINT}, + {GameId::UNKNOWN, NULL, 0, NULL, JAPANESE, 0}, }; diff --git a/src/sys/game_id.h b/src/sys/game_id.h index fcb5d44..54b4a66 100644 --- a/src/sys/game_id.h +++ b/src/sys/game_id.h @@ -17,6 +17,8 @@ struct GameId { // System 1 BUNKASAI, CRESCENT, + RANCE2, + RANCE2_HINT, DPS, DPS_SG_FAHREN, DPS_SG_KATEI, @@ -88,6 +90,9 @@ struct GameId { bool is_sdps() const { return game == SDPS_MARIA || game == SDPS_TONO || game == SDPS_KAIZOKU; } + bool is_rance2() const { + return game == RANCE2 || game == RANCE2_HINT; + } bool is_rance4x() const { return game == RANCE41 || game == RANCE42; } diff --git a/src/sys/nact.h b/src/sys/nact.h index 64f1eda..5ce3245 100644 --- a/src/sys/nact.h +++ b/src/sys/nact.h @@ -228,6 +228,8 @@ protected: void platform_initialize(); void platform_finalize(); + int last_paint_x = -1, last_paint_y = -1; + public: int mainloop(); void sys_sleep(int ms); diff --git a/src/sys/nact_sys1.cpp b/src/sys/nact_sys1.cpp index 474a6c5..4bc0581 100644 --- a/src/sys/nact_sys1.cpp +++ b/src/sys/nact_sys1.cpp @@ -431,6 +431,9 @@ void NACT_Sys1::cmd_g() map_page = page; } } + + last_paint_x = -1; + last_paint_y = -1; } void NACT_Sys1::cmd_h() @@ -540,6 +543,9 @@ void NACT_Sys1::cmd_u() } else { ags->load_cg(page, transparent); } + + last_paint_x = -1; + last_paint_y = -1; } void NACT_Sys1::cmd_v() @@ -701,6 +707,31 @@ void NACT_Sys1::cmd_y() ags->box_fill(0, 40, 8, 598, 270, 0); } } + else if (game_id.is_rance2()) { + if (param == 0) { + // Unknown + } + else if (param == 6) { + ags->box_fill(0, 0, 0, 424, 276, 0); + } + else if (param == 7) { + ags->box_fill(0, 0, 0, 640, 276, 0); + } + } + break; + case 12: // Rance 2 / Rance 2 hint disk + // Y 12, 0: is supposed to activate an automatic text + // progression feature, but it doesn't seem to work on the + // PC-98? + case 13: // Rance 2 + // Sets the speed of the auto text progression feature (Y 12). + // The options in Rance 2 are 1 (the fastest), 5, and 10 (the + // slowest). Not available in the Hint Disk. + case 20: // Rance 2 / Rance 2 hint disk + ags->load_cg(param, -1); + + last_paint_x = -1; + last_paint_y = -1; break; case 130: if (game_id.is(GameId::TENGU)) { @@ -889,6 +920,14 @@ void NACT_Sys1::cmd_z() ags->copy(x + 2, 182, x + 38, 224, x, 210); ags->src_screen = 0; } + break; + case GameId::RANCE2: + case GameId::RANCE2_HINT: + ags->paint(last_paint_x, last_paint_y, 0); + ags->paint(cmd, param, 3); + last_paint_x = cmd; + last_paint_y = param; + break; } }