mirror of
https://github.com/holub/mame
synced 2025-06-01 02:21:48 +03:00
Removed render_container_set_palette_alpha() hack. Now the alpha value
can be set directly in the palette entry and will be respected for laserdisc overlays.
This commit is contained in:
parent
3959354577
commit
2a3301d0b9
@ -2826,18 +2826,6 @@ render_container *render_container_get_screen(const device_config *screen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
render_container_set_palette_alpha - set the
|
|
||||||
opacity of a given palette entry
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
void render_container_set_palette_alpha(render_container *container, UINT32 entry, UINT8 alpha)
|
|
||||||
{
|
|
||||||
assert(entry < ARRAY_LENGTH(container->bcglookup));
|
|
||||||
container->bcglookup[entry] = (alpha << 24) | (container->bcglookup[entry] & 0x00ffffff);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
render_container_item_add_generic - add a
|
render_container_item_add_generic - add a
|
||||||
generic item to a container
|
generic item to a container
|
||||||
@ -2984,7 +2972,7 @@ static void render_container_recompute_lookups(render_container *container)
|
|||||||
for (i = 0; i < colors; i++)
|
for (i = 0; i < colors; i++)
|
||||||
{
|
{
|
||||||
pen_t newval = adjusted_palette[i];
|
pen_t newval = adjusted_palette[i];
|
||||||
container->bcglookup[i] = (container->bcglookup[i] & 0xff000000) |
|
container->bcglookup[i] = (newval & 0xff000000) |
|
||||||
container->bcglookup256[0x200 + RGB_RED(newval)] |
|
container->bcglookup256[0x200 + RGB_RED(newval)] |
|
||||||
container->bcglookup256[0x100 + RGB_GREEN(newval)] |
|
container->bcglookup256[0x100 + RGB_GREEN(newval)] |
|
||||||
container->bcglookup256[0x000 + RGB_BLUE(newval)];
|
container->bcglookup256[0x000 + RGB_BLUE(newval)];
|
||||||
@ -3029,7 +3017,7 @@ static void render_container_update_palette(render_container *container)
|
|||||||
{
|
{
|
||||||
UINT32 finalentry = entry32 * 32 + entry;
|
UINT32 finalentry = entry32 * 32 + entry;
|
||||||
rgb_t newval = adjusted_palette[finalentry];
|
rgb_t newval = adjusted_palette[finalentry];
|
||||||
container->bcglookup[finalentry] = (container->bcglookup[finalentry] & 0xff000000) |
|
container->bcglookup[finalentry] = (newval & 0xff000000) |
|
||||||
container->bcglookup256[0x200 + RGB_RED(newval)] |
|
container->bcglookup256[0x200 + RGB_RED(newval)] |
|
||||||
container->bcglookup256[0x100 + RGB_GREEN(newval)] |
|
container->bcglookup256[0x100 + RGB_GREEN(newval)] |
|
||||||
container->bcglookup256[0x000 + RGB_BLUE(newval)];
|
container->bcglookup256[0x000 + RGB_BLUE(newval)];
|
||||||
|
@ -454,9 +454,6 @@ render_container *render_container_get_ui(void);
|
|||||||
/* return a pointer to the container for the given screen */
|
/* return a pointer to the container for the given screen */
|
||||||
render_container *render_container_get_screen(const device_config *screen);
|
render_container *render_container_get_screen(const device_config *screen);
|
||||||
|
|
||||||
/* set the opacity of a given palette entry */
|
|
||||||
void render_container_set_palette_alpha(render_container *container, UINT32 entry, UINT8 alpha);
|
|
||||||
|
|
||||||
/* add a line item to the specified container */
|
/* add a line item to the specified container */
|
||||||
void render_container_add_line(render_container *container, float x0, float y0, float x1, float y1, float width, rgb_t argb, UINT32 flags);
|
void render_container_add_line(render_container *container, float x0, float y0, float x1, float y1, float width, rgb_t argb, UINT32 flags);
|
||||||
|
|
||||||
|
@ -392,8 +392,13 @@ void TMS9928A_set_spriteslimit (int limit) {
|
|||||||
*/
|
*/
|
||||||
VIDEO_UPDATE( tms9928a )
|
VIDEO_UPDATE( tms9928a )
|
||||||
{
|
{
|
||||||
INT32 BackColour = tms.Regs[7] & 15; if (!BackColour) BackColour=1;
|
INT32 BackColour = tms.Regs[7] & 15;
|
||||||
palette_set_color(screen->machine, 0, TMS9928A_palette[BackColour]);
|
rgb_t oldcolor = palette_get_color(screen->machine, 0);
|
||||||
|
|
||||||
|
if (!BackColour) BackColour=1;
|
||||||
|
/* note we preserve the alpha here; this is so that it can be controlled independently */
|
||||||
|
/* see cliffhgr.c for an example */
|
||||||
|
palette_set_color(screen->machine, 0, (TMS9928A_palette[BackColour] & MAKE_ARGB(0,255,255,255)) | (oldcolor & MAKE_ARGB(255,0,0,0)));
|
||||||
|
|
||||||
if (! (tms.Regs[1] & 0x40))
|
if (! (tms.Regs[1] & 0x40))
|
||||||
fillbitmap(bitmap, screen->machine->pens[BackColour], cliprect);
|
fillbitmap(bitmap, screen->machine->pens[BackColour], cliprect);
|
||||||
|
@ -71,7 +71,7 @@ static VIDEO_START( alg )
|
|||||||
VIDEO_START_CALL(amiga);
|
VIDEO_START_CALL(amiga);
|
||||||
|
|
||||||
/* configure pen 4096 as transparent in the renderer and use it for the genlock color */
|
/* configure pen 4096 as transparent in the renderer and use it for the genlock color */
|
||||||
render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), 4096, 0x00);
|
palette_set_color(machine, 4096, MAKE_ARGB(0,0,0,0));
|
||||||
amiga_set_genlock_color(4096);
|
amiga_set_genlock_color(4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,21 +147,22 @@ static WRITE8_HANDLER( cliff_sound_overlay_w )
|
|||||||
int overlay = ( data & 0x10 ) ? 1 : 0;
|
int overlay = ( data & 0x10 ) ? 1 : 0;
|
||||||
|
|
||||||
/* configure pen 0 and 1 as transparent in the renderer and use it as the compositing color */
|
/* configure pen 0 and 1 as transparent in the renderer and use it as the compositing color */
|
||||||
render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), 0, overlay ? 0x00 : 0xff );
|
if (overlay)
|
||||||
render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), 1, overlay ? 0x00 : 0xff );
|
{
|
||||||
|
palette_set_color(machine, 0, palette_get_color(machine, 0) & MAKE_ARGB(0,255,255,255));
|
||||||
|
palette_set_color(machine, 1, palette_get_color(machine, 1) & MAKE_ARGB(0,255,255,255));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
palette_set_color(machine, 0, palette_get_color(machine, 0) | MAKE_ARGB(255,0,0,0));
|
||||||
|
palette_set_color(machine, 1, palette_get_color(machine, 1) | MAKE_ARGB(255,0,0,0));
|
||||||
|
}
|
||||||
|
|
||||||
/* audio */
|
/* audio */
|
||||||
discrete_sound_w(machine, CLIFF_ENABLE_SND_1, sound&1);
|
discrete_sound_w(machine, CLIFF_ENABLE_SND_1, sound&1);
|
||||||
discrete_sound_w(machine, CLIFF_ENABLE_SND_2, (sound>>1)&1);
|
discrete_sound_w(machine, CLIFF_ENABLE_SND_2, (sound>>1)&1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNUSED_FUNCTION
|
|
||||||
static WRITE8_HANDLER( cliff_irqack_w )
|
|
||||||
{
|
|
||||||
phillips_code = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static WRITE8_HANDLER( cliff_ldwire_w )
|
static WRITE8_HANDLER( cliff_ldwire_w )
|
||||||
{
|
{
|
||||||
laserdisc_line_w(laserdisc,LASERDISC_LINE_CONTROL,(data&1) ? ASSERT_LINE : CLEAR_LINE );
|
laserdisc_line_w(laserdisc,LASERDISC_LINE_CONTROL,(data&1) ? ASSERT_LINE : CLEAR_LINE );
|
||||||
|
@ -81,8 +81,6 @@ static VIDEO_START( cubeqst )
|
|||||||
{
|
{
|
||||||
video_field = 0;
|
video_field = 0;
|
||||||
depth_buffer = auto_malloc(512);
|
depth_buffer = auto_malloc(512);
|
||||||
|
|
||||||
render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), ALPHA_PEN, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Use resistor values */
|
/* TODO: Use resistor values */
|
||||||
@ -101,6 +99,9 @@ static PALETTE_INIT( cubeqst )
|
|||||||
|
|
||||||
palette_set_color_rgb(machine, i, y*r, y*g, y*b);
|
palette_set_color_rgb(machine, i, y*r, y*g, y*b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* use pen 8192 for transparent */
|
||||||
|
palette_set_color(machine, 8192, MAKE_ARGB(0,0,0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: This is a simplified version of what actually happens */
|
/* TODO: This is a simplified version of what actually happens */
|
||||||
|
@ -42,8 +42,6 @@ static VIDEO_UPDATE( esh )
|
|||||||
{
|
{
|
||||||
int charx, chary;
|
int charx, chary;
|
||||||
|
|
||||||
render_container_set_palette_alpha(render_container_get_screen(screen), 0, 0x00);
|
|
||||||
|
|
||||||
/* clear */
|
/* clear */
|
||||||
fillbitmap(bitmap, 0, cliprect);
|
fillbitmap(bitmap, 0, cliprect);
|
||||||
|
|
||||||
@ -239,6 +237,9 @@ static PALETTE_INIT( esh )
|
|||||||
|
|
||||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make color 0 transparent */
|
||||||
|
palette_set_color(machine, 0, MAKE_ARGB(0,0,0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gfx_layout esh_gfx_layout =
|
static const gfx_layout esh_gfx_layout =
|
||||||
|
@ -203,8 +203,6 @@ static void gpworld_draw_sprites(running_machine *machine, bitmap_t *bitmap, con
|
|||||||
|
|
||||||
static VIDEO_UPDATE( gpworld )
|
static VIDEO_UPDATE( gpworld )
|
||||||
{
|
{
|
||||||
render_container_set_palette_alpha(render_container_get_screen(screen), 0, 0x00);
|
|
||||||
|
|
||||||
fillbitmap(bitmap, 0, cliprect);
|
fillbitmap(bitmap, 0, cliprect);
|
||||||
|
|
||||||
gpworld_draw_tiles(screen->machine, bitmap, cliprect);
|
gpworld_draw_tiles(screen->machine, bitmap, cliprect);
|
||||||
@ -245,7 +243,7 @@ static WRITE8_HANDLER( misc_io_write )
|
|||||||
static WRITE8_HANDLER( palette_write )
|
static WRITE8_HANDLER( palette_write )
|
||||||
{
|
{
|
||||||
/* This is all just a (bad) guess */
|
/* This is all just a (bad) guess */
|
||||||
int pal_index, r, g, b;
|
int pal_index, r, g, b, a;
|
||||||
|
|
||||||
palette_RAM[offset] = data;
|
palette_RAM[offset] = data;
|
||||||
|
|
||||||
@ -255,11 +253,11 @@ static WRITE8_HANDLER( palette_write )
|
|||||||
b = (palette_RAM[pal_index] & 0xf0) << 0;
|
b = (palette_RAM[pal_index] & 0xf0) << 0;
|
||||||
g = (palette_RAM[pal_index] & 0x0f) << 4;
|
g = (palette_RAM[pal_index] & 0x0f) << 4;
|
||||||
r = (palette_RAM[pal_index+1] & 0x0f) << 4;
|
r = (palette_RAM[pal_index+1] & 0x0f) << 4;
|
||||||
/* int dunno = (palette_RAM[pal_index+1] & 0x80) >> 7; */
|
a = (palette_RAM[pal_index+1] & 0x80) ? 0 : 255; /* guess */
|
||||||
|
|
||||||
/* logerror("PAL WRITE index : %x rgb : %d %d %d (real %x) at %x\n", pal_index, r,g,b, data, offset); */
|
/* logerror("PAL WRITE index : %x rgb : %d %d %d (real %x) at %x\n", pal_index, r,g,b, data, offset); */
|
||||||
|
|
||||||
palette_set_color(machine, pal_index, MAKE_RGB(r, g, b));
|
palette_set_color(machine, pal_index, MAKE_ARGB(a, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PROGRAM MAP */
|
/* PROGRAM MAP */
|
||||||
|
@ -44,8 +44,6 @@ static VIDEO_UPDATE( istellar )
|
|||||||
{
|
{
|
||||||
int charx, chary;
|
int charx, chary;
|
||||||
|
|
||||||
render_container_set_palette_alpha(render_container_get_screen(screen), 0, 0x00);
|
|
||||||
|
|
||||||
/* clear */
|
/* clear */
|
||||||
fillbitmap(bitmap, 0, cliprect);
|
fillbitmap(bitmap, 0, cliprect);
|
||||||
|
|
||||||
@ -291,6 +289,9 @@ static PALETTE_INIT( istellar )
|
|||||||
|
|
||||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make color 0 transparent */
|
||||||
|
palette_set_color(machine, 0, MAKE_ARGB(0,0,0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gfx_layout istellar_gfx_layout =
|
static const gfx_layout istellar_gfx_layout =
|
||||||
|
@ -83,7 +83,8 @@ static VIDEO_UPDATE( lgp )
|
|||||||
{
|
{
|
||||||
int charx, chary;
|
int charx, chary;
|
||||||
|
|
||||||
render_container_set_palette_alpha(render_container_get_screen(screen), 0, 0x00);
|
/* make color 0 transparent */
|
||||||
|
palette_set_color(screen->machine, 0, MAKE_ARGB(0,0,0,0));
|
||||||
|
|
||||||
/* clear */
|
/* clear */
|
||||||
fillbitmap(bitmap, 0, cliprect);
|
fillbitmap(bitmap, 0, cliprect);
|
||||||
|
@ -80,8 +80,6 @@ static void astron_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect)
|
|||||||
|
|
||||||
static VIDEO_UPDATE( astron )
|
static VIDEO_UPDATE( astron )
|
||||||
{
|
{
|
||||||
render_container_set_palette_alpha(render_container_get_screen(screen), 0, 0x00);
|
|
||||||
|
|
||||||
fillbitmap(bitmap, 0, cliprect);
|
fillbitmap(bitmap, 0, cliprect);
|
||||||
|
|
||||||
astron_draw_characters(screen->machine, bitmap, cliprect);
|
astron_draw_characters(screen->machine, bitmap, cliprect);
|
||||||
@ -178,7 +176,7 @@ static WRITE8_HANDLER( astron_OBJ_write )
|
|||||||
|
|
||||||
static WRITE8_HANDLER( astron_COLOR_write )
|
static WRITE8_HANDLER( astron_COLOR_write )
|
||||||
{
|
{
|
||||||
UINT8 r, g, b;
|
UINT8 r, g, b, a;
|
||||||
UINT8 highBits, lowBits;
|
UINT8 highBits, lowBits;
|
||||||
const UINT8 palIndex = offset >> 1;
|
const UINT8 palIndex = offset >> 1;
|
||||||
|
|
||||||
@ -193,8 +191,9 @@ static WRITE8_HANDLER( astron_COLOR_write )
|
|||||||
r = (lowBits & 0x0f);
|
r = (lowBits & 0x0f);
|
||||||
g = (lowBits & 0xf0) >> 4;
|
g = (lowBits & 0xf0) >> 4;
|
||||||
b = (highBits & 0x0f);
|
b = (highBits & 0x0f);
|
||||||
|
a = (highBits & 0x80) ? 0 : 255;
|
||||||
|
|
||||||
/* palette_set_color(machine, palIndex, r, g, b); */
|
palette_set_color(machine, palIndex, MAKE_ARGB(a, r, g, b));
|
||||||
logerror("COLOR write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, activecpu_get_pc());
|
logerror("COLOR write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, activecpu_get_pc());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,6 @@ static VIDEO_START( superdq )
|
|||||||
|
|
||||||
static VIDEO_UPDATE( superdq )
|
static VIDEO_UPDATE( superdq )
|
||||||
{
|
{
|
||||||
render_container_set_palette_alpha(render_container_get_screen(screen), 0, 0x00);
|
|
||||||
|
|
||||||
tilemap_draw(bitmap,cliprect,superdq_tilemap,0,0);
|
tilemap_draw(bitmap,cliprect,superdq_tilemap,0,0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -142,8 +140,14 @@ static WRITE8_HANDLER( superdq_io_w )
|
|||||||
|
|
||||||
superdq_color_bank = ( data & 2 ) ? 1 : 0;
|
superdq_color_bank = ( data & 2 ) ? 1 : 0;
|
||||||
|
|
||||||
for( i = 0; i < sizeof( black_color_entries ); i++ )
|
for( i = 0; i < ARRAY_LENGTH( black_color_entries ); i++ )
|
||||||
render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), black_color_entries[i], (data&0x80) ? 0x00 : 0xff );
|
{
|
||||||
|
int index = black_color_entries[i];
|
||||||
|
if (data & 0x80)
|
||||||
|
palette_set_color(machine, index, palette_get_color(machine, index) & MAKE_ARGB(0,255,255,255));
|
||||||
|
else
|
||||||
|
palette_set_color(machine, index, palette_get_color(machine, index) | MAKE_ARGB(255,0,0,0));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
bit 5 = DISP1?
|
bit 5 = DISP1?
|
||||||
|
@ -16,6 +16,7 @@ UINT8 gottlieb_gfxcharhi;
|
|||||||
|
|
||||||
static UINT8 background_priority = 0;
|
static UINT8 background_priority = 0;
|
||||||
static UINT8 spritebank;
|
static UINT8 spritebank;
|
||||||
|
static UINT8 transparent0;
|
||||||
|
|
||||||
static tilemap *bg_tilemap;
|
static tilemap *bg_tilemap;
|
||||||
static double weights[4];
|
static double weights[4];
|
||||||
@ -29,7 +30,7 @@ static double weights[4];
|
|||||||
|
|
||||||
WRITE8_HANDLER( gottlieb_paletteram_w )
|
WRITE8_HANDLER( gottlieb_paletteram_w )
|
||||||
{
|
{
|
||||||
int r, g, b, val;
|
int r, g, b, a, val;
|
||||||
|
|
||||||
paletteram[offset] = data;
|
paletteram[offset] = data;
|
||||||
|
|
||||||
@ -42,7 +43,9 @@ WRITE8_HANDLER( gottlieb_paletteram_w )
|
|||||||
val = paletteram[offset | 1];
|
val = paletteram[offset | 1];
|
||||||
r = combine_4_weights(weights, (val >> 0) & 1, (val >> 1) & 1, (val >> 2) & 1, (val >> 3) & 1);
|
r = combine_4_weights(weights, (val >> 0) & 1, (val >> 1) & 1, (val >> 2) & 1, (val >> 3) & 1);
|
||||||
|
|
||||||
palette_set_color(machine, offset / 2, MAKE_ARGB(((offset & ~1) == 0) ? 0x00 : 0xff, r, g, b));
|
/* alpha is set to 0 if laserdisc video is enabled */
|
||||||
|
a = (transparent0 && offset / 2 == 0) ? 0 : 255;
|
||||||
|
palette_set_color(machine, offset / 2, MAKE_ARGB(a, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,8 +96,10 @@ WRITE8_HANDLER( gottlieb_laserdisc_video_control_w )
|
|||||||
/* bit 3 genlock control (1 = show laserdisc image) */
|
/* bit 3 genlock control (1 = show laserdisc image) */
|
||||||
laserdisc_overlay_enable(laserdisc, (data & 0x04) ? TRUE : FALSE);
|
laserdisc_overlay_enable(laserdisc, (data & 0x04) ? TRUE : FALSE);
|
||||||
laserdisc_video_enable(laserdisc, ((data & 0x0c) == 0x0c) ? TRUE : FALSE);
|
laserdisc_video_enable(laserdisc, ((data & 0x0c) == 0x0c) ? TRUE : FALSE);
|
||||||
|
|
||||||
render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), 0, (data & 0x08) ? 0x00 : 0xff);
|
/* configure the palette if the laserdisc is enabled */
|
||||||
|
transparent0 = (data >> 3) & 1;
|
||||||
|
gottlieb_paletteram_w(machine, 0, paletteram[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -151,6 +156,7 @@ VIDEO_START( gottlieb )
|
|||||||
4, resistances, weights, 180, 0,
|
4, resistances, weights, 180, 0,
|
||||||
4, resistances, weights, 180, 0,
|
4, resistances, weights, 180, 0,
|
||||||
4, resistances, weights, 180, 0);
|
4, resistances, weights, 180, 0);
|
||||||
|
transparent0 = FALSE;
|
||||||
|
|
||||||
/* configure the background tilemap */
|
/* configure the background tilemap */
|
||||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||||
@ -160,6 +166,7 @@ VIDEO_START( gottlieb )
|
|||||||
/* save some state */
|
/* save some state */
|
||||||
state_save_register_global(background_priority);
|
state_save_register_global(background_priority);
|
||||||
state_save_register_global(spritebank);
|
state_save_register_global(spritebank);
|
||||||
|
state_save_register_global(transparent0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user