From a9d9c324054329b1abdce09e54d5033f0d7ef98d Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 29 Aug 2026 08:28:26 +0900 Subject: [PATCH] Gakuen KING: Draw key wait icon from GAKUEN.COM --- src/sys/ags.h | 2 ++ src/sys/ags_window.cpp | 4 ++-- src/sys/nact_gakuenking.cpp | 25 ++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/sys/ags.h b/src/sys/ags.h index c8177a6..39ac8e0 100644 --- a/src/sys/ags.h +++ b/src/sys/ags.h @@ -144,6 +144,7 @@ public: void clear_text_window(int index, bool erase); bool return_text_line(int index); void draw_push(int index); + void set_push_bitmap(const uint8_t* bitmap) { push_bitmap = bitmap; } void open_text_window(int index, bool erase); void close_text_window(int index, bool update); void set_text_window(int index, int sx, int sy, int ex, int ey, bool save) { @@ -262,6 +263,7 @@ private: Dri acg; const char* bmp_prefix = NULL; + const uint8_t* push_bitmap = nullptr; }; extern "C" void ags_setAntialiasedStringMode(int on); diff --git a/src/sys/ags_window.cpp b/src/sys/ags_window.cpp index c14052d..eddd63c 100644 --- a/src/sys/ags_window.cpp +++ b/src/sys/ags_window.cpp @@ -145,7 +145,7 @@ bool AGS::return_text_line(int index) void AGS::draw_push(int index) { - const uint8_t push_bitmap[32] = { + static const uint8_t builtin_bitmap[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x90, 0x00, 0x99, 0x74, 0xe9, 0x44, 0x89, 0x77, @@ -155,7 +155,7 @@ void AGS::draw_push(int index) Window& w = text_w[index - 1]; int x = w.ex - 16; int y = w.ey - 16; - draw_gaiji(0, x, y, push_bitmap, 16, text.font_color); + draw_gaiji(0, x, y, push_bitmap ? push_bitmap : builtin_bitmap, 16, text.font_color); draw_screen(x, y, 16, 16); } diff --git a/src/sys/nact_gakuenking.cpp b/src/sys/nact_gakuenking.cpp index fd5d259..dc6bb26 100644 --- a/src/sys/nact_gakuenking.cpp +++ b/src/sys/nact_gakuenking.cpp @@ -55,6 +55,7 @@ public: private: void cmd_a() override { + set_push_bitmap(); NACT::cmd_a(); map_overview_rebuild_pending = true; } @@ -93,7 +94,7 @@ private: exec_y(14, param); break; case 25: - fixed_cursor_shape = (param == 1); + fixed_shapes = (param == 1); if (0 <= param && param <= 4) { ags->menu.back_color = ags->text.back_color = (param == 1 || param == 2) ? 0 : 1; @@ -214,6 +215,7 @@ private: } load_digit_font(exe); load_mouse_cursors(exe); + load_push_bitmaps(exe); load_credit_text(exe); } @@ -1327,7 +1329,7 @@ private: }; MouseCursor mouse_cursor[NR_MOUSE_CURSORS] = {}; - bool fixed_cursor_shape = false; // set by Y 25,1 + bool fixed_shapes = false; // set by Y 25,1 void load_mouse_cursors(const std::vector& exe) { const uint8_t* p = &exe[MOUSE_CURSOR_OFFSET]; @@ -1340,7 +1342,7 @@ private: } int pick_cursor_shape() { - if (fixed_cursor_shape) + if (fixed_shapes) return 5; int r = random(100); return r < 5 ? r : 1; @@ -1359,6 +1361,23 @@ private: ags->draw_screen(x, y, MOUSE_CURSOR_SIZE, MOUSE_CURSOR_SIZE); } + // --- A key wait icon -------------------------------------------------- + + static constexpr int PUSH_BITMAP_OFFSET = 0x08aa; + static constexpr int NR_PUSH_BITMAPS = 4; + + uint8_t push_bitmap[NR_PUSH_BITMAPS][32] = {}; + + void load_push_bitmaps(const std::vector& exe) { + memcpy(push_bitmap, &exe[PUSH_BITMAP_OFFSET], sizeof(push_bitmap)); + } + + void set_push_bitmap() { + int r = random(100); + r = r < NR_PUSH_BITMAPS ? r : 0; + ags->set_push_bitmap(fixed_shapes ? nullptr : push_bitmap[r]); + } + // --- I grid selection ------------------------------------------------- // I 2 composes its overlays over the background CG on the work screen and