diff --git a/src/sys/ags.h b/src/sys/ags.h index 5d6a92c..640ffe0 100644 --- a/src/sys/ags.h +++ b/src/sys/ags.h @@ -129,7 +129,6 @@ public: int transparent_color = -1); void gcopy(int gsc, int gde, int glx, int gly, int gsw); void paint(int x, int y, uint8 color); - void draw_box(int index); void draw_mesh(int sx, int sy, int width, int height); void box_fill(int dest, int sx, int sy, int ex, int ey, uint8 color); void box_line(int dest, int sx, int sy, int ex, int ey, uint8 color); @@ -162,10 +161,6 @@ public: menu_w[index - 1].frame = frame; } - void set_box(int index, uint8 color, int sx, int sy, int ex, int ey) { - box[index - 1] = {color, sx, sy, ex, ey}; - } - void load_cursor(int page); void select_cursor(); void translate_mouse_coords(int* x, int* y); @@ -248,16 +243,6 @@ public: private: void init_windows(); - // Box (E and Y7 commands) - struct Box { - uint8 color = 0; - int sx = 0; - int sy = 0; - int ex = 639; - int ey = 399; - }; - Box box[20]; - Dri acg; const char* bmp_prefix = NULL; const uint8_t* push_bitmap = nullptr; diff --git a/src/sys/ags_draw.cpp b/src/sys/ags_draw.cpp index 84c1eaf..8626459 100644 --- a/src/sys/ags_draw.cpp +++ b/src/sys/ags_draw.cpp @@ -216,22 +216,6 @@ void AGS::paint(int x, int y, uint8 color) invalidate_screen(minx, miny, maxx - minx + 1, maxy - miny + 1); } -void AGS::draw_box(int index) -{ - if(index == 0) { - // 全画面消去 - box_fill(dest_screen, 0, 0, 639, 479, 0); - return; - } - - Box& b = box[index - 1]; - if (1 <= index && index <= 10) { - box_fill(dest_screen, b.sx, b.sy, b.ex, b.ey, b.color); - } else if (11 <= index && index <= 20) { - box_line(dest_screen, b.sx, b.sy, b.ex, b.ey, b.color); - } -} - void AGS::draw_mesh(int sx, int sy, int width, int height) { // super d.p.s diff --git a/src/sys/nact.h b/src/sys/nact.h index a2bf869..59ba0bf 100644 --- a/src/sys/nact.h +++ b/src/sys/nact.h @@ -122,6 +122,17 @@ protected: bool show_push = true; // Push表示 bool clear_text = true; // メニュー後のメッセージウィンドウ消去 + // Box (E and Y7 commands) + struct Box { + uint8 color = 0; + int sx = 0; + int sy = 0; + int ex = 639; + int ey = 399; + }; + Box box[20]; + void draw_box(int index); + struct MenuItem { uint16_t addr; uint8_t verb; diff --git a/src/sys/nact_gakuenking.cpp b/src/sys/nact_gakuenking.cpp index aec2b2a..c160a1a 100644 --- a/src/sys/nact_gakuenking.cpp +++ b/src/sys/nact_gakuenking.cpp @@ -42,8 +42,8 @@ public: NACT_GakuenKing(const Config& config, const GameId& game_id) : NACT_Sys3(config, game_id) { text_wait_time = 0; // Y 13 and Y 14 set this - ags->set_box(1, 0, 16, 8, 367, 295); - ags->set_box(2, 0, 40, 0, 599, 298); + box[0] = {0, 16, 8, 367, 295}; + box[1] = {0, 40, 0, 599, 298}; load_executable_data(); amap.open("AMAP.DAT"); map_base.fill(0); diff --git a/src/sys/nact_sys1.cpp b/src/sys/nact_sys1.cpp index 0a4e13b..1910745 100644 --- a/src/sys/nact_sys1.cpp +++ b/src/sys/nact_sys1.cpp @@ -547,7 +547,7 @@ public: WAIT(2000); ags->load_cg(38, -1); cmd_a(); - ags->draw_box(0); + draw_box(0); } }; @@ -883,7 +883,7 @@ public: ags->load_cg(180, -1); WAIT(2000); - ags->draw_box(0); + draw_box(0); ags->dest_screen = 1; ags->load_cg(173, -1); ags->dest_screen = 0; @@ -902,7 +902,7 @@ public: ags->gcopy(i + 0x2306, i + 0x2306, 1, 165, 3); } WAIT_KEYQUIT(6000); - ags->draw_box(param); + draw_box(param); break; default: exec_y(cmd, param); diff --git a/src/sys/nact_sys2.cpp b/src/sys/nact_sys2.cpp index 8fe7325..3814a15 100644 --- a/src/sys/nact_sys2.cpp +++ b/src/sys/nact_sys2.cpp @@ -86,18 +86,18 @@ NACT_Sys2::NACT_Sys2(const Config& config, const GameId& game_id) : NACT(config, game_id) { if (game_id.is(GameId::SDPS_TONO) || game_id.is(GameId::SDPS_KAIZOKU)) { - ags->set_box(1, 0, 40, 8, 598, 271); + box[0] = {0, 40, 8, 598, 271}; } else if (game_id.is(GameId::PROG_FD)) { - ags->set_box(1, 0, 64, 13, 407, 289); - ags->set_box(2, 0, 24, 298, 111, 390); - ags->set_box(3, 0, 0, 0, 639, 307); - ags->set_box(4, 0, 0, 0, 319, 399); - ags->set_box(5, 0, (16*8), 310, ((77*8)-1), 390); - ags->set_box(6, 0, (4*8), 310, ((76*8)-1), 390); - ags->set_box(7, 0, (2*8), 317, ((56*8)-1), 389); - ags->set_box(8, 15, 64, 13, 407, 289); - ags->set_box(9, 0, 0, 0, 319, 399); - ags->set_box(10, 0, 320, 0, 639, 40); + box[0] = {0, 64, 13, 407, 289}; + box[1] = {0, 24, 298, 111, 390}; + box[2] = {0, 0, 0, 639, 307}; + box[3] = {0, 0, 0, 319, 399}; + box[4] = {0, (16*8), 310, ((77*8)-1), 390}; + box[5] = {0, (4*8), 310, ((76*8)-1), 390}; + box[6] = {0, (2*8), 317, ((56*8)-1), 389}; + box[7] = {15, 64, 13, 407, 289}; + box[8] = {0, 0, 0, 319, 399}; + box[9] = {0, 320, 0, 639, 40}; } } @@ -733,7 +733,7 @@ void NACT_Sys2::cmd_y() break; case 7: if (!game_id.is(GameId::SDPS_MARIA)) { - ags->draw_box(param); + draw_box(param); } break; case 8: diff --git a/src/sys/nact_sys3.cpp b/src/sys/nact_sys3.cpp index 667a8ad..e7408cc 100644 --- a/src/sys/nact_sys3.cpp +++ b/src/sys/nact_sys3.cpp @@ -241,7 +241,7 @@ void NACT_Sys3::cmd_e() sx = sx * 8; ex = ex * 8 - 1; } - ags->set_box(index, color, sx, sy, ex, ey); + box[index - 1] = {color, sx, sy, ex, ey}; } void NACT_Sys3::cmd_g() @@ -720,7 +720,7 @@ void NACT_Sys3::exec_y(int cmd, int param) case 6: break; case 7: - ags->draw_box(param); + draw_box(param); break; case 8: tvar_index = param; diff --git a/src/sys/nact_window.cpp b/src/sys/nact_window.cpp index e7559e6..3898cdd 100644 --- a/src/sys/nact_window.cpp +++ b/src/sys/nact_window.cpp @@ -78,3 +78,19 @@ void NACT::save_display_state(FILEIO* fio) fio->putw(0); } } + +void NACT::draw_box(int index) +{ + if (index == 0) { + // Clear the entire screen + ags->box_fill(ags->dest_screen, 0, 0, 639, 479, 0); + return; + } + + Box& b = box[index - 1]; + if (1 <= index && index <= 10) { + ags->box_fill(ags->dest_screen, b.sx, b.sy, b.ex, b.ey, b.color); + } else if (11 <= index && index <= 20) { + ags->box_line(ags->dest_screen, b.sx, b.sy, b.ex, b.ey, b.color); + } +}