add a Sega Mega Drive / Genesis drawing mode
This commit is contained in:
16
src/graph.c
16
src/graph.c
@@ -3413,24 +3413,33 @@ done:
|
||||
/// Paint a pixel with GBC constraints
|
||||
///
|
||||
/// Same 4 color palette for all pixels in a 8x8 block.
|
||||
///
|
||||
/// Megadrive constraints are nearly the same : same 16 color palette in a 8x8 tile
|
||||
static void Pixel_in_screen_gbc_with_opt_preview(word x,word y,byte color,int preview)
|
||||
{
|
||||
word startx = x & ~7;
|
||||
word starty = y & ~7;
|
||||
word x2, y2;
|
||||
byte palette;
|
||||
byte col_mask, pal_mask;
|
||||
|
||||
if (Main.backups->Pages->Image_mode == IMAGE_MODE_MEGADRIVE)
|
||||
col_mask = 15;
|
||||
else
|
||||
col_mask = 3;
|
||||
pal_mask = ~col_mask;
|
||||
|
||||
// first set the pixel
|
||||
Pixel_in_screen_layered_with_opt_preview(x,y,color,preview);
|
||||
palette = color & ~3;
|
||||
palette = color & pal_mask;
|
||||
// force all pixels of the block to the same palette
|
||||
for (y2 = 0; y2 < 8; y2++)
|
||||
{
|
||||
for (x2 = 0; x2 < 8; x2++)
|
||||
{
|
||||
byte col = Read_pixel_from_current_layer(startx+x2, starty+y2);
|
||||
if ((col & ~3) != palette)
|
||||
Pixel_in_screen_layered_with_opt_preview(startx+x2, starty+y2, palette | (col & 3), preview);
|
||||
if ((col & pal_mask) != palette)
|
||||
Pixel_in_screen_layered_with_opt_preview(startx+x2, starty+y2, palette | (col & col_mask), preview);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3912,6 +3921,7 @@ void Update_pixel_renderer(void)
|
||||
Pixel_in_current_screen_with_opt_preview = Pixel_in_screen_thomson_with_opt_preview;
|
||||
break;
|
||||
case IMAGE_MODE_GBC:
|
||||
case IMAGE_MODE_MEGADRIVE:
|
||||
Pixel_in_current_screen_with_opt_preview = Pixel_in_screen_gbc_with_opt_preview;
|
||||
break;
|
||||
case IMAGE_MODE_C64HIRES:
|
||||
|
||||
Reference in New Issue
Block a user