mirror of
https://github.com/holub/mame
synced 2025-04-29 11:30:28 +03:00
jalblend.c: converted to be a device (nw)
This commit is contained in:
parent
202d316cdb
commit
e166b8f2a4
@ -549,6 +549,8 @@ static MACHINE_CONFIG_START( argus, argus_state )
|
|||||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", argus)
|
MCFG_GFXDECODE_ADD("gfxdecode", "palette", argus)
|
||||||
MCFG_PALETTE_ADD("palette", 896)
|
MCFG_PALETTE_ADD("palette", 896)
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("blend", JALECO_BLEND, 0)
|
||||||
|
|
||||||
MCFG_VIDEO_START_OVERRIDE(argus_state,argus)
|
MCFG_VIDEO_START_OVERRIDE(argus_state,argus)
|
||||||
MCFG_VIDEO_RESET_OVERRIDE(argus_state,argus)
|
MCFG_VIDEO_RESET_OVERRIDE(argus_state,argus)
|
||||||
|
|
||||||
@ -593,6 +595,8 @@ static MACHINE_CONFIG_START( valtric, argus_state )
|
|||||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", valtric)
|
MCFG_GFXDECODE_ADD("gfxdecode", "palette", valtric)
|
||||||
MCFG_PALETTE_ADD("palette", 768)
|
MCFG_PALETTE_ADD("palette", 768)
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("blend", JALECO_BLEND, 0)
|
||||||
|
|
||||||
MCFG_VIDEO_START_OVERRIDE(argus_state,valtric)
|
MCFG_VIDEO_START_OVERRIDE(argus_state,valtric)
|
||||||
MCFG_VIDEO_RESET_OVERRIDE(argus_state,valtric)
|
MCFG_VIDEO_RESET_OVERRIDE(argus_state,valtric)
|
||||||
|
|
||||||
@ -637,6 +641,8 @@ static MACHINE_CONFIG_START( butasan, argus_state )
|
|||||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", butasan)
|
MCFG_GFXDECODE_ADD("gfxdecode", "palette", butasan)
|
||||||
MCFG_PALETTE_ADD("palette", 768)
|
MCFG_PALETTE_ADD("palette", 768)
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("blend", JALECO_BLEND, 0)
|
||||||
|
|
||||||
MCFG_VIDEO_START_OVERRIDE(argus_state,butasan)
|
MCFG_VIDEO_START_OVERRIDE(argus_state,butasan)
|
||||||
MCFG_VIDEO_RESET_OVERRIDE(argus_state,butasan)
|
MCFG_VIDEO_RESET_OVERRIDE(argus_state,butasan)
|
||||||
|
|
||||||
|
@ -722,6 +722,8 @@ static MACHINE_CONFIG_START( psychic5, psychic5_state )
|
|||||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", psychic5)
|
MCFG_GFXDECODE_ADD("gfxdecode", "palette", psychic5)
|
||||||
MCFG_PALETTE_ADD("palette", 768)
|
MCFG_PALETTE_ADD("palette", 768)
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("blend", JALECO_BLEND, 0)
|
||||||
|
|
||||||
MCFG_VIDEO_START_OVERRIDE(psychic5_state,psychic5)
|
MCFG_VIDEO_START_OVERRIDE(psychic5_state,psychic5)
|
||||||
MCFG_VIDEO_RESET_OVERRIDE(psychic5_state,psychic5)
|
MCFG_VIDEO_RESET_OVERRIDE(psychic5_state,psychic5)
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "video/jalblend.h"
|
||||||
|
|
||||||
class argus_state : public driver_device
|
class argus_state : public driver_device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -8,6 +10,7 @@ public:
|
|||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_screen(*this, "screen"),
|
m_screen(*this, "screen"),
|
||||||
m_palette(*this, "palette"),
|
m_palette(*this, "palette"),
|
||||||
|
m_blend(*this, "blend"),
|
||||||
m_bg0_scrollx(*this, "bg0_scrollx"),
|
m_bg0_scrollx(*this, "bg0_scrollx"),
|
||||||
m_bg0_scrolly(*this, "bg0_scrolly"),
|
m_bg0_scrolly(*this, "bg0_scrolly"),
|
||||||
m_bg1_scrollx(*this, "bg1_scrollx"),
|
m_bg1_scrollx(*this, "bg1_scrollx"),
|
||||||
@ -23,6 +26,7 @@ public:
|
|||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
required_device<screen_device> m_screen;
|
required_device<screen_device> m_screen;
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
|
required_device<jaleco_blend_device> m_blend;
|
||||||
|
|
||||||
optional_shared_ptr<UINT8> m_bg0_scrollx;
|
optional_shared_ptr<UINT8> m_bg0_scrollx;
|
||||||
optional_shared_ptr<UINT8> m_bg0_scrolly;
|
optional_shared_ptr<UINT8> m_bg0_scrolly;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "machine/bankdev.h"
|
#include "machine/bankdev.h"
|
||||||
|
#include "video/jalblend.h"
|
||||||
|
|
||||||
class psychic5_state : public driver_device
|
class psychic5_state : public driver_device
|
||||||
{
|
{
|
||||||
@ -10,6 +11,7 @@ public:
|
|||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_palette(*this, "palette"),
|
m_palette(*this, "palette"),
|
||||||
m_vrambank(*this, "vrambank"),
|
m_vrambank(*this, "vrambank"),
|
||||||
|
m_blend(*this, "blend"),
|
||||||
m_spriteram(*this, "spriteram"),
|
m_spriteram(*this, "spriteram"),
|
||||||
m_fg_videoram(*this, "fg_videoram"),
|
m_fg_videoram(*this, "fg_videoram"),
|
||||||
m_bg_videoram(*this, "bg_videoram"),
|
m_bg_videoram(*this, "bg_videoram"),
|
||||||
@ -25,6 +27,8 @@ public:
|
|||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
optional_device<address_map_bank_device> m_vrambank;
|
optional_device<address_map_bank_device> m_vrambank;
|
||||||
|
optional_device<jaleco_blend_device> m_blend;
|
||||||
|
|
||||||
required_shared_ptr<UINT8> m_spriteram;
|
required_shared_ptr<UINT8> m_spriteram;
|
||||||
required_shared_ptr<UINT8> m_fg_videoram;
|
required_shared_ptr<UINT8> m_fg_videoram;
|
||||||
required_shared_ptr<UINT8> m_bg_videoram;
|
required_shared_ptr<UINT8> m_bg_videoram;
|
||||||
@ -83,5 +87,5 @@ public:
|
|||||||
void change_bg_palette(int color, int lo_offs, int hi_offs);
|
void change_bg_palette(int color, int lo_offs, int hi_offs);
|
||||||
void set_background_palette_intensity();
|
void set_background_palette_intensity();
|
||||||
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
void draw_background(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
void draw_background(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); //only used by psychic5
|
||||||
};
|
};
|
||||||
|
@ -114,7 +114,6 @@ BG0 palette intensity ( $C47F, $C4FF )
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "video/jalblend.h"
|
|
||||||
#include "includes/argus.h"
|
#include "includes/argus.h"
|
||||||
|
|
||||||
|
|
||||||
@ -271,8 +270,6 @@ VIDEO_START_MEMBER(argus_state,argus)
|
|||||||
/* dummy RAM for back ground */
|
/* dummy RAM for back ground */
|
||||||
m_dummy_bg0ram = auto_alloc_array(machine(), UINT8, 0x800);
|
m_dummy_bg0ram = auto_alloc_array(machine(), UINT8, 0x800);
|
||||||
|
|
||||||
jal_blend_init(machine(), 1);
|
|
||||||
|
|
||||||
save_item(NAME(m_bg_status));
|
save_item(NAME(m_bg_status));
|
||||||
save_item(NAME(m_flipscreen));
|
save_item(NAME(m_flipscreen));
|
||||||
save_item(NAME(m_palette_intensity));
|
save_item(NAME(m_palette_intensity));
|
||||||
@ -301,8 +298,6 @@ VIDEO_START_MEMBER(argus_state,valtric)
|
|||||||
|
|
||||||
m_screen->register_screen_bitmap(m_mosaicbitmap);
|
m_screen->register_screen_bitmap(m_mosaicbitmap);
|
||||||
|
|
||||||
jal_blend_init(machine(), 1);
|
|
||||||
|
|
||||||
save_item(NAME(m_bg_status));
|
save_item(NAME(m_bg_status));
|
||||||
save_item(NAME(m_flipscreen));
|
save_item(NAME(m_flipscreen));
|
||||||
save_item(NAME(m_palette_intensity));
|
save_item(NAME(m_palette_intensity));
|
||||||
@ -335,8 +330,6 @@ VIDEO_START_MEMBER(argus_state,butasan)
|
|||||||
m_butasan_txram = &m_butasan_pagedram[1][0x000];
|
m_butasan_txram = &m_butasan_pagedram[1][0x000];
|
||||||
m_butasan_txbackram = &m_butasan_pagedram[1][0x800];
|
m_butasan_txbackram = &m_butasan_pagedram[1][0x800];
|
||||||
|
|
||||||
jal_blend_init(machine(), 1);
|
|
||||||
|
|
||||||
save_item(NAME(m_bg_status));
|
save_item(NAME(m_bg_status));
|
||||||
save_item(NAME(m_flipscreen));
|
save_item(NAME(m_flipscreen));
|
||||||
save_item(NAME(m_palette_intensity));
|
save_item(NAME(m_palette_intensity));
|
||||||
@ -390,7 +383,7 @@ void argus_state::change_palette(int color, int lo_offs, int hi_offs)
|
|||||||
{
|
{
|
||||||
UINT8 lo = m_paletteram[lo_offs];
|
UINT8 lo = m_paletteram[lo_offs];
|
||||||
UINT8 hi = m_paletteram[hi_offs];
|
UINT8 hi = m_paletteram[hi_offs];
|
||||||
jal_blend_set(color, hi & 0x0f);
|
m_blend->set(color, hi & 0x0f);
|
||||||
m_palette->set_pen_color(color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
|
m_palette->set_pen_color(color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +419,7 @@ void argus_state::change_bg_palette(int color, int lo_offs, int hi_offs)
|
|||||||
rgb = rgb_t(r,g,b);
|
rgb = rgb_t(r,g,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb = jal_blend_func(rgb,irgb,ix);
|
rgb = m_blend->func(rgb,irgb,ix);
|
||||||
|
|
||||||
m_palette->set_pen_color(color,rgb);
|
m_palette->set_pen_color(color,rgb);
|
||||||
}
|
}
|
||||||
@ -832,7 +825,7 @@ void argus_state::argus_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &clip
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (priority != pri)
|
if (priority != pri)
|
||||||
jal_blend_drawgfx(m_palette,
|
m_blend->drawgfx(m_palette,
|
||||||
bitmap,cliprect,m_gfxdecode->gfx(0),
|
bitmap,cliprect,m_gfxdecode->gfx(0),
|
||||||
tile,
|
tile,
|
||||||
color,
|
color,
|
||||||
@ -956,7 +949,7 @@ void argus_state::valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cl
|
|||||||
flipy = !flipy;
|
flipy = !flipy;
|
||||||
}
|
}
|
||||||
|
|
||||||
jal_blend_drawgfx(m_palette,
|
m_blend->drawgfx(m_palette,
|
||||||
bitmap,cliprect,m_gfxdecode->gfx(0),
|
bitmap,cliprect,m_gfxdecode->gfx(0),
|
||||||
tile,
|
tile,
|
||||||
color,
|
color,
|
||||||
@ -1004,7 +997,7 @@ void argus_state::butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cl
|
|||||||
|
|
||||||
if ((offs >= 0x100 && offs <= 0x2ff) || (offs >= 0x400 && offs <= 0x57f))
|
if ((offs >= 0x100 && offs <= 0x2ff) || (offs >= 0x400 && offs <= 0x57f))
|
||||||
{
|
{
|
||||||
jal_blend_drawgfx(m_palette,
|
m_blend->drawgfx(m_palette,
|
||||||
bitmap,cliprect,m_gfxdecode->gfx(0),
|
bitmap,cliprect,m_gfxdecode->gfx(0),
|
||||||
tile,
|
tile,
|
||||||
color,
|
color,
|
||||||
@ -1018,7 +1011,7 @@ void argus_state::butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cl
|
|||||||
{
|
{
|
||||||
td = (fx) ? (1 - i) : i;
|
td = (fx) ? (1 - i) : i;
|
||||||
|
|
||||||
jal_blend_drawgfx(m_palette,
|
m_blend->drawgfx(m_palette,
|
||||||
bitmap,cliprect,m_gfxdecode->gfx(0),
|
bitmap,cliprect,m_gfxdecode->gfx(0),
|
||||||
tile + td,
|
tile + td,
|
||||||
color,
|
color,
|
||||||
@ -1038,7 +1031,7 @@ void argus_state::butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cl
|
|||||||
else
|
else
|
||||||
td = (fx) ? (i * 2) + 1 - j : i * 2 + j;
|
td = (fx) ? (i * 2) + 1 - j : i * 2 + j;
|
||||||
|
|
||||||
jal_blend_drawgfx(m_palette,
|
m_blend->drawgfx(m_palette,
|
||||||
bitmap,cliprect,m_gfxdecode->gfx(0),
|
bitmap,cliprect,m_gfxdecode->gfx(0),
|
||||||
tile + td,
|
tile + td,
|
||||||
color,
|
color,
|
||||||
@ -1059,7 +1052,7 @@ void argus_state::butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cl
|
|||||||
else
|
else
|
||||||
td = (fx) ? (i * 4) + 3 - j : i * 4 + j;
|
td = (fx) ? (i * 4) + 3 - j : i * 4 + j;
|
||||||
|
|
||||||
jal_blend_drawgfx(m_palette,
|
m_blend->drawgfx(m_palette,
|
||||||
bitmap,cliprect,m_gfxdecode->gfx(0),
|
bitmap,cliprect,m_gfxdecode->gfx(0),
|
||||||
tile + td,
|
tile + td,
|
||||||
color,
|
color,
|
||||||
|
@ -14,33 +14,43 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "jalblend.h"
|
#include "jalblend.h"
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
/* each palette entry contains a fourth 'alpha' value */
|
DEVICE INTERFACE
|
||||||
static UINT8 *jal_blend_table;
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
static void jal_blend_reset(running_machine &machine)
|
|
||||||
|
const device_type JALECO_BLEND = &device_creator<jaleco_blend_device>;
|
||||||
|
|
||||||
|
jaleco_blend_device::jaleco_blend_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||||
|
: device_t(mconfig, JALECO_BLEND, "Jaleco Blending Device", tag, owner, clock, "jaleco_blend", __FILE__),
|
||||||
|
m_table(NULL)
|
||||||
{
|
{
|
||||||
memset(jal_blend_table, 0, 0xc00);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void jal_blend_init(running_machine &machine, int enable)
|
//-------------------------------------------------
|
||||||
|
// device_start - device-specific startup
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void jaleco_blend_device::device_start()
|
||||||
{
|
{
|
||||||
if (enable)
|
m_table = auto_alloc_array_clear(machine(), UINT8, 0xc00);
|
||||||
{
|
|
||||||
jal_blend_table = auto_alloc_array_clear(machine, UINT8, 0xc00);
|
save_pointer(NAME(m_table), 0xc00);
|
||||||
machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(jal_blend_reset), &machine));
|
|
||||||
machine.save().save_pointer(NAME(jal_blend_table), 0xc00);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jal_blend_table = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void jal_blend_set(int color, UINT8 val)
|
//-------------------------------------------------
|
||||||
|
// device_reset - device-specific startup
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void jaleco_blend_device::device_reset()
|
||||||
{
|
{
|
||||||
if (jal_blend_table) jal_blend_table[color] = val;
|
memset(m_table, 0, 0xc00);
|
||||||
|
}
|
||||||
|
|
||||||
|
void jaleco_blend_device::set(int color, UINT8 val)
|
||||||
|
{
|
||||||
|
m_table[color] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -56,7 +66,7 @@ void jal_blend_set(int color, UINT8 val)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* basically an add/subtract function with clamping */
|
/* basically an add/subtract function with clamping */
|
||||||
rgb_t jal_blend_func(rgb_t dest, rgb_t addMe, UINT8 alpha)
|
rgb_t jaleco_blend_device::func(rgb_t dest, rgb_t addMe, UINT8 alpha)
|
||||||
{
|
{
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
int ir, ig, ib;
|
int ir, ig, ib;
|
||||||
@ -86,21 +96,13 @@ rgb_t jal_blend_func(rgb_t dest, rgb_t addMe, UINT8 alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _BitmapClass>
|
template<class _BitmapClass>
|
||||||
void jal_blend_drawgfx_common(palette_device &palette,_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
void jaleco_blend_device::drawgfx_common(palette_device &palette,_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||||
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||||
int transparent_color)
|
int transparent_color)
|
||||||
{
|
{
|
||||||
if (jal_blend_table == NULL)
|
|
||||||
{
|
|
||||||
gfx->transpen(dest_bmp,clip,code,color,flipx,flipy,offsx,offsy,transparent_color);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start drawing */
|
/* Start drawing */
|
||||||
if (gfx)
|
|
||||||
{
|
|
||||||
const pen_t *pal = &palette.pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
|
const pen_t *pal = &palette.pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
|
||||||
const UINT8 *alpha = &jal_blend_table[gfx->granularity() * (color % gfx->colors())];
|
const UINT8 *alpha = &m_table[gfx->granularity() * (color % gfx->colors())];
|
||||||
const UINT8 *source_base = gfx->get_data(code % gfx->elements());
|
const UINT8 *source_base = gfx->get_data(code % gfx->elements());
|
||||||
int x_index_base, y_index, sx, sy, ex, ey;
|
int x_index_base, y_index, sx, sy, ex, ey;
|
||||||
int xinc, yinc;
|
int xinc, yinc;
|
||||||
@ -159,7 +161,7 @@ void jal_blend_drawgfx_common(palette_device &palette,_BitmapClass &dest_bmp,con
|
|||||||
if (alpha[c] & 8)
|
if (alpha[c] & 8)
|
||||||
{
|
{
|
||||||
// Comp with clamp
|
// Comp with clamp
|
||||||
dest[x] = jal_blend_func(dest[x], pal[c], alpha[c]);
|
dest[x] = jaleco_blend_device::func(dest[x], pal[c], alpha[c]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -172,14 +174,13 @@ void jal_blend_drawgfx_common(palette_device &palette,_BitmapClass &dest_bmp,con
|
|||||||
y_index += yinc;
|
y_index += yinc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void jal_blend_drawgfx(palette_device &palette,bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
void jaleco_blend_device::drawgfx(palette_device &palette,bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||||
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||||
int transparent_color)
|
int transparent_color)
|
||||||
{ jal_blend_drawgfx_common(palette,dest_bmp, clip, gfx, code, color, flipx, flipy, offsx, offsy, transparent_color); }
|
{ jaleco_blend_device::drawgfx_common(palette,dest_bmp, clip, gfx, code, color, flipx, flipy, offsx, offsy, transparent_color); }
|
||||||
void jal_blend_drawgfx(palette_device &palette,bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
void jaleco_blend_device::drawgfx(palette_device &palette,bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||||
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||||
int transparent_color)
|
int transparent_color)
|
||||||
{ jal_blend_drawgfx_common(palette,dest_bmp, clip, gfx, code, color, flipx, flipy, offsx, offsy, transparent_color); }
|
{ jaleco_blend_device::drawgfx_common(palette,dest_bmp, clip, gfx, code, color, flipx, flipy, offsx, offsy, transparent_color); }
|
||||||
|
@ -1,10 +1,31 @@
|
|||||||
void jal_blend_init(running_machine &machine, int enable);
|
class jaleco_blend_device : public device_t
|
||||||
void jal_blend_set(int color, UINT8 val);
|
{
|
||||||
|
public:
|
||||||
|
jaleco_blend_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||||
|
~jaleco_blend_device() {}
|
||||||
|
|
||||||
rgb_t jal_blend_func(rgb_t dest, rgb_t addMe, UINT8 alpha);
|
void set(int color, UINT8 val);
|
||||||
void jal_blend_drawgfx(palette_device &palette,bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
rgb_t func(rgb_t dest, rgb_t addMe, UINT8 alpha);
|
||||||
|
void drawgfx(palette_device &palette,bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||||
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||||
int transparent_color);
|
int transparent_color);
|
||||||
void jal_blend_drawgfx(palette_device &palette,bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
void drawgfx(palette_device &palette,bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||||
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||||
int transparent_color);
|
int transparent_color);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device-level overrides
|
||||||
|
virtual void device_start();
|
||||||
|
virtual void device_reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* each palette entry contains a fourth 'alpha' value */
|
||||||
|
UINT8 *m_table;
|
||||||
|
|
||||||
|
template<class _BitmapClass>
|
||||||
|
void drawgfx_common(palette_device &palette,_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||||
|
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||||
|
int transparent_color);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const device_type JALECO_BLEND;
|
@ -7,7 +7,6 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "video/jalblend.h"
|
|
||||||
#include "includes/psychic5.h"
|
#include "includes/psychic5.h"
|
||||||
|
|
||||||
|
|
||||||
@ -26,7 +25,9 @@ void psychic5_state::change_palette(int offset, UINT8* palram, int palbase)
|
|||||||
|
|
||||||
int color = offset >> 1;
|
int color = offset >> 1;
|
||||||
|
|
||||||
jal_blend_set(palbase + color, hi & 0x0f);
|
if (m_blend)
|
||||||
|
m_blend->set(palbase + color, hi & 0x0f);
|
||||||
|
|
||||||
m_palette->set_pen_color(palbase + color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
|
m_palette->set_pen_color(palbase + color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ void psychic5_state::change_bg_palette(int color, int lo_offs, int hi_offs)
|
|||||||
{
|
{
|
||||||
UINT8 val = (r + g + b) / 3; /* Grey */
|
UINT8 val = (r + g + b) / 3; /* Grey */
|
||||||
/* Just leave plain grey */
|
/* Just leave plain grey */
|
||||||
m_palette->set_pen_color(color,jal_blend_func(rgb_t(val,val,val),irgb,ix));
|
m_palette->set_pen_color(color,m_blend->func(rgb_t(val,val,val),irgb,ix));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -64,7 +65,7 @@ void psychic5_state::change_bg_palette(int color, int lo_offs, int hi_offs)
|
|||||||
if (!(m_title_screen & 1))
|
if (!(m_title_screen & 1))
|
||||||
{
|
{
|
||||||
/* Leave the world as-is */
|
/* Leave the world as-is */
|
||||||
m_palette->set_pen_color(color,jal_blend_func(rgb_t(r,g,b),irgb,ix));
|
m_palette->set_pen_color(color,m_blend->func(rgb_t(r,g,b),irgb,ix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +192,6 @@ VIDEO_START_MEMBER(psychic5_state,psychic5)
|
|||||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 64, 32);
|
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 64, 32);
|
||||||
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
|
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
|
||||||
m_fg_tilemap->set_transparent_pen(15);
|
m_fg_tilemap->set_transparent_pen(15);
|
||||||
jal_blend_init(machine(), 1);
|
|
||||||
|
|
||||||
save_item(NAME(m_title_screen));
|
save_item(NAME(m_title_screen));
|
||||||
|
|
||||||
@ -204,7 +204,6 @@ VIDEO_START_MEMBER(psychic5_state,bombsa)
|
|||||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 32);
|
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 32);
|
||||||
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
|
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
|
||||||
m_fg_tilemap->set_transparent_pen(15);
|
m_fg_tilemap->set_transparent_pen(15);
|
||||||
jal_blend_init(machine(), 0);
|
|
||||||
|
|
||||||
save_item(NAME(m_bombsa_unknown));
|
save_item(NAME(m_bombsa_unknown));
|
||||||
}
|
}
|
||||||
@ -223,7 +222,11 @@ VIDEO_RESET_MEMBER(psychic5_state,psychic5)
|
|||||||
Screen refresh
|
Screen refresh
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#define DRAW_SPRITE(code, sx, sy) jal_blend_drawgfx(m_palette, bitmap, cliprect, m_gfxdecode->gfx(0), code, color, flipx, flipy, sx, sy, 15);
|
#define DRAW_SPRITE(code, sx, sy) \
|
||||||
|
if (m_blend) \
|
||||||
|
m_blend->drawgfx(m_palette, bitmap, cliprect, m_gfxdecode->gfx(0), code, color, flipx, flipy, sx, sy, 15); \
|
||||||
|
else \
|
||||||
|
m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, code, color, flipx, flipy, sx, sy, 15);
|
||||||
|
|
||||||
void psychic5_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
void psychic5_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user