diff --git a/ReC98.h b/ReC98.h index f8b46504..4578d984 100644 --- a/ReC98.h +++ b/ReC98.h @@ -14,17 +14,12 @@ palette_entry_rgb(fn); \ palette_show(); -// RGB color triple, used for the Palettes structure -typedef union { - struct { - unsigned char r, g, b; - } c; - unsigned char v[3]; -} rgb_t; - -typedef struct { - rgb_t colors[16]; -} palette_t; +#ifdef __cplusplus + // master.lib palettes use twice the bits per RGB component for more + // toning precision + typedef RGB RGB8; + typedef Palette Palette8; +#endif // --------------------- // Macros diff --git a/pc98.h b/pc98.h index a82049a0..8894aa93 100644 --- a/pc98.h +++ b/pc98.h @@ -15,6 +15,32 @@ #define RES_Y 400 #define ROW_SIZE (RES_X / 8) #define PLANE_SIZE (ROW_SIZE * RES_Y) + +#define COLOR_COUNT 16 + +#pragma option -a1 + +#ifdef __cplusplus + template union RGB { + struct { + ComponentType r, g, b; + } c; + ComponentType v[3]; + }; + + template struct Palette { + RGBType colors[COLOR_COUNT]; + }; + + // The 16-color mode supports 4 bits per RGB component, for a total of + // 4,096 colors + typedef int8_t uint4_t; + + typedef RGB RGB4; + typedef Palette Palette4; +#endif + +#pragma option -a. /// -------- /// Keyboard diff --git a/pc98.inc b/pc98.inc index b1eee647..55d49dfb 100644 --- a/pc98.inc +++ b/pc98.inc @@ -16,4 +16,5 @@ RES_Y = 400 ROW_SIZE = (RES_X / 8) ; Collides with master.lib's bfnt_entry_pat.asm ; PLANE_SIZE = (ROW_SIZE * RES_Y) +COLOR_COUNT = 16 ; ======== diff --git a/th03/main_01.cpp b/th03/main_01.cpp index 095a26f3..7833628a 100644 --- a/th03/main_01.cpp +++ b/th03/main_01.cpp @@ -5,6 +5,7 @@ extern "C" { +#include "platform.h" #include "pc98.h" #include "th03/sprite16.hpp" #include "th03/playfld.hpp" diff --git a/th04/zunsoft.h b/th04/zunsoft.h index 02463fd6..128f798c 100644 --- a/th04/zunsoft.h +++ b/th04/zunsoft.h @@ -1,7 +1,7 @@ // Copy of the palette used during the logo, to allow non-blocking fades in // contrast to master.lib's blocking palette_black_in() and palette_black_out() // functions. (Then again, master.lib has the PaletteTone global for that...) -extern rgb_t zunsoft_palette[16]; +extern Palette8 zunsoft_palette; // Spawns [n] new explosions at the given screen-coordinate [origin] position. void pascal zunsoft_pyro_new(Point screen_origin, int n, char patnum_base);