2020-01-06 11:07:53 +00:00
|
|
|
/// Current palette
|
|
|
|
/// ---------------
|
2020-01-04 22:32:03 +00:00
|
|
|
extern Palette4 z_Palettes;
|
2020-01-05 12:08:24 +00:00
|
|
|
|
|
|
|
// Sets the given hardware [col] to the given RGB value.
|
2020-01-06 11:07:53 +00:00
|
|
|
#define UINT4 int
|
|
|
|
void z_palette_show_single(uint4_t col, UINT4 r, UINT4 g, UINT4 b);
|
|
|
|
#define z_palette_show_single_col(col, rgb) \
|
|
|
|
z_palette_show_single(col, rgb.c.r, rgb.c.g, rgb.c.b);
|
|
|
|
#undef UINT4
|
2020-01-05 12:08:24 +00:00
|
|
|
|
|
|
|
// Clamps #[r][g][b] to the 4-bit 0-15 range, then sets the given [col] in
|
|
|
|
// both z_Palettes and the hardware palette to that value.
|
|
|
|
void z_palette_set_show(uint4_t col, int r, int g, int b);
|
|
|
|
|
|
|
|
// Sets all hardware colors to #000, without touching z_Palettes.
|
|
|
|
void z_palette_black(void);
|
|
|
|
|
|
|
|
// Sets all hardware colors to #FFF, without touching z_Palettes.
|
|
|
|
void z_palette_white(void);
|
[Decompilation] [th01] master.lib resident palette function reimplementations
Which store colors as GRB, as suggested by the structure's ID string.
Even master.lib's own functions add an additional XCHG AH, AL
instruction to get colors into and out of this format. MASTER.MAN
suggests that it's some sort of standard on PC-98. It does match the
order of ths hardware's palette register ports, after all.
(0AAh = green, 0ACh = red, 0AEh = blue)
Now we also know why __seg* wasn't used more commonly, as lamented in
c8e8e98. Turbo C++ simply doesn't support a lot of arithmetic on
segment pointers.
And then that undecompilable far call to a function within the same
segment, but inside a different translation unit…
Also, thanks again to Egor for the SCOPY@ hack that debuted in 0460072.
Would have probably struggled with this a lot more without that.
And *then* you realize that TH01 effectively doesn't even use the
resident palette. 😐
And yes, we're procrastinating the whole issue of potentially using
a single translation unit for all three binaries by using a common
segment name, because it *really* isn't that easy.
Completes P0066, funded by Keyblade Wiedling Neko and Splashman.
2020-01-05 15:10:00 +00:00
|
|
|
|
2020-01-06 11:07:53 +00:00
|
|
|
// Fades each hardware palette color from the given RGB value to its
|
|
|
|
// respective value in z_Palettes, blocking [step_ms] milliseconds at each of
|
|
|
|
// the 16 fade steps. If [keep] is nonzero for a specific color number, that
|
|
|
|
// color is excluded from the fade calculation and will stay at its z_Palettes
|
|
|
|
// value throughout the function.
|
|
|
|
void z_palette_fade_from(
|
|
|
|
uint4_t from_r, uint4_t from_g, uint4_t from_b,
|
|
|
|
int keep[COLOR_COUNT],
|
|
|
|
unsigned int step_ms
|
|
|
|
);
|
|
|
|
/// ---------------
|
|
|
|
|
[Decompilation] [th01] master.lib resident palette function reimplementations
Which store colors as GRB, as suggested by the structure's ID string.
Even master.lib's own functions add an additional XCHG AH, AL
instruction to get colors into and out of this format. MASTER.MAN
suggests that it's some sort of standard on PC-98. It does match the
order of ths hardware's palette register ports, after all.
(0AAh = green, 0ACh = red, 0AEh = blue)
Now we also know why __seg* wasn't used more commonly, as lamented in
c8e8e98. Turbo C++ simply doesn't support a lot of arithmetic on
segment pointers.
And then that undecompilable far call to a function within the same
segment, but inside a different translation unit…
Also, thanks again to Egor for the SCOPY@ hack that debuted in 0460072.
Would have probably struggled with this a lot more without that.
And *then* you realize that TH01 effectively doesn't even use the
resident palette. 😐
And yes, we're procrastinating the whole issue of potentially using
a single translation unit for all three binaries by using a common
segment name, because it *really* isn't that easy.
Completes P0066, funded by Keyblade Wiedling Neko and Splashman.
2020-01-05 15:10:00 +00:00
|
|
|
/// Resident palette
|
|
|
|
/// ----------------
|
|
|
|
// Copies the resident palette to z_Palettes and sets all hardware colors.
|
|
|
|
// Returns 1 on success, 0 on failure.
|
|
|
|
int z_respal_get_show(void);
|
|
|
|
// Copies z_Palettes to the resident palette. Returns 1 on success, 0 on
|
|
|
|
// failure.
|
|
|
|
int z_respal_set(void);
|
|
|
|
/// ----------------
|