From 3ee848f4560b4813ccacc7216a504d649572b6e2 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sat, 24 Oct 2020 19:30:47 +0200 Subject: [PATCH] [Maintenance] [th05] Use master.hpp for the character selection menu 6149 LoC with the original master.h, vs. 2524 LoC *and* additional semantic sugar with master.hpp. Nice! (Yes, *semantic* sugar.) Part of P0124, funded by [Anonymous] and Blue Bolt. --- master.hpp | 9 ++++++++- th05/m_char.cpp | 18 +++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/master.hpp b/master.hpp index 42b1a5a7..71abe558 100644 --- a/master.hpp +++ b/master.hpp @@ -176,7 +176,9 @@ void MASTER_RET grcg_off(void); void MASTER_RET grcg_round_boxfill( int x1, int y1, int x2, int y2, unsigned r ); - void MASTER_RET grcg_byteboxfill_x(int x1, int y1, int x2, int y2); + void MASTER_RET grcg_byteboxfill_x( + vram_x_t left, vram_y_t top, vram_x_t right, vram_y_t bottom + ); // Circles void MASTER_RET grcg_circle(int x, int y, unsigned r); @@ -289,6 +291,11 @@ void MASTER_RET vsync_end(void); /// Inlined extensions /// ------------------ +#define grcg_boxfill_8(left, top, right, bottom) \ + grcg_byteboxfill_x( \ + ((left) / BYTE_DOTS), top, ((right) / BYTE_DOTS), bottom \ + ) + #define palette_entry_rgb_show(fn) \ palette_entry_rgb(fn); \ palette_show(); diff --git a/th05/m_char.cpp b/th05/m_char.cpp index 56f18e29..4154c0c8 100644 --- a/th05/m_char.cpp +++ b/th05/m_char.cpp @@ -6,7 +6,11 @@ #pragma codeseg op_01_TEXT extern "C" { -#include "ReC98.h" +#include +#include "platform.h" +#include "pc98.h" +#include "planar.h" +#include "master.hpp" #include "th01/ranks.h" #include "th02/hardware/frmdelay.h" #include "th04/formats/cdg.h" @@ -112,16 +116,16 @@ void pascal near pic_put(bool16 darkened) // Drop shadow grcg_setcolor(GC_RMW, 1); - grcg_byteboxfill_x( - ((pic_raised_left + PIC_W) / BYTE_DOTS), + grcg_boxfill_8( + (pic_raised_left + PIC_W), pic_top, - ((pic_left + PIC_W - 1) / BYTE_DOTS), + (pic_left + PIC_W - 1), (pic_raised_top + PIC_H - 1) ); - grcg_byteboxfill_x( - (pic_left / BYTE_DOTS), + grcg_boxfill_8( + pic_left, (pic_raised_top + PIC_H), - ((pic_left + PIC_W - 1) / BYTE_DOTS), + (pic_left + PIC_W - 1), (pic_top + PIC_H - 1) ); grcg_off();