mirror of
https://github.com/holub/mame
synced 2025-05-18 11:39:29 +03:00
More of it from Haze ...
This commit is contained in:
parent
e610067415
commit
0b6aa86b59
@ -685,6 +685,26 @@ static WRITE32_HANDLER( deco32_buffer_spriteram_w )
|
||||
memcpy(state->spriteram16_buffered, state->spriteram16, 0x1000);
|
||||
}
|
||||
|
||||
static READ32_HANDLER( deco32_spriteram2_r )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
return state->spriteram16_2[offset] ^ 0xffff0000;
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( deco32_spriteram2_w )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
data &= 0x0000ffff;
|
||||
mem_mask &= 0x0000ffff;
|
||||
COMBINE_DATA(&state->spriteram16_2[offset]);
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( deco32_buffer_spriteram2_w )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
memcpy(state->spriteram16_2_buffered, state->spriteram16_2, 0x1000);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( captaven_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
|
||||
@ -900,14 +920,14 @@ static ADDRESS_MAP_START( tattass_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x16c000, 0x16c003) AM_WRITENOP
|
||||
AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(deco32_palette_dma_w)
|
||||
|
||||
AM_RANGE(0x170000, 0x171fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x170000, 0x171fff) AM_READWRITE(deco32_spriteram_r, deco32_spriteram_w)
|
||||
AM_RANGE(0x174000, 0x174003) AM_WRITENOP /* Sprite DMA mode (2) */
|
||||
AM_RANGE(0x174010, 0x174013) AM_WRITE(buffer_spriteram32_w)
|
||||
AM_RANGE(0x174010, 0x174013) AM_WRITE(deco32_buffer_spriteram_w)
|
||||
AM_RANGE(0x174018, 0x17401b) AM_WRITENOP /* Sprite 'CPU' (unused) */
|
||||
AM_RANGE(0x178000, 0x179fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram2)
|
||||
|
||||
AM_RANGE(0x178000, 0x179fff) AM_READWRITE(deco32_spriteram2_r, deco32_spriteram2_w)
|
||||
AM_RANGE(0x17c000, 0x17c003) AM_WRITENOP /* Sprite DMA mode (2) */
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram32_2_w)
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(deco32_buffer_spriteram2_w)
|
||||
AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */
|
||||
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
@ -941,13 +961,14 @@ static ADDRESS_MAP_START( nslasher_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x16c000, 0x16c003) AM_WRITENOP
|
||||
AM_RANGE(0x16c008, 0x16c00b) AM_WRITE(deco32_palette_dma_w)
|
||||
|
||||
AM_RANGE(0x170000, 0x171fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x170000, 0x171fff) AM_READWRITE(deco32_spriteram_r, deco32_spriteram_w)
|
||||
AM_RANGE(0x174000, 0x174003) AM_WRITENOP /* Sprite DMA mode (2) */
|
||||
AM_RANGE(0x174010, 0x174013) AM_WRITE(buffer_spriteram32_w)
|
||||
AM_RANGE(0x174010, 0x174013) AM_WRITE(deco32_buffer_spriteram_w)
|
||||
AM_RANGE(0x174018, 0x17401b) AM_WRITENOP /* Sprite 'CPU' (unused) */
|
||||
AM_RANGE(0x178000, 0x179fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram2)
|
||||
|
||||
AM_RANGE(0x178000, 0x179fff) AM_READWRITE(deco32_spriteram2_r, deco32_spriteram2_w)
|
||||
AM_RANGE(0x17c000, 0x17c003) AM_WRITENOP /* Sprite DMA mode (2) */
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram32_2_w)
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(deco32_buffer_spriteram2_w)
|
||||
AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */
|
||||
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
@ -1545,7 +1566,7 @@ static const gfx_layout tilelayout2 =
|
||||
64*8
|
||||
};
|
||||
|
||||
static const gfx_layout spritelayout2 =
|
||||
static const gfx_layout spritelayout_5bpp_alt =
|
||||
{
|
||||
16,16,
|
||||
RGN_FRAC(1,5),
|
||||
@ -1611,7 +1632,7 @@ static GFXDECODE_START( tattass )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 32 ) /* Characters 8x8 */
|
||||
GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 32 ) /* Tiles 16x16 */
|
||||
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 512, 32 ) /* Tiles 16x16 */
|
||||
GFXDECODE_ENTRY( "gfx3", 0, spritelayout2, 1536, 16 ) /* Sprites 16x16 */
|
||||
GFXDECODE_ENTRY( "gfx3", 0, spritelayout_5bpp_alt, 1536, 16 ) /* Sprites 16x16 */
|
||||
GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 1024+256, 32 ) /* Sprites 16x16 */
|
||||
GFXDECODE_END
|
||||
|
||||
@ -1965,16 +1986,21 @@ static MACHINE_CONFIG_START( tattass, deco32_state )
|
||||
|
||||
MCFG_EEPROM_ADD("eeprom", eeprom_interface_tattass)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
|
||||
MCFG_SCREEN_SIZE(42*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
|
||||
|
||||
MCFG_SCREEN_UPDATE(nslasher)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen1", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 3);
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen2", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 4);
|
||||
|
||||
|
||||
MCFG_GFXDECODE(tattass)
|
||||
MCFG_PALETTE_LENGTH(2048)
|
||||
|
||||
@ -2004,9 +2030,6 @@ static MACHINE_CONFIG_START( nslasher, deco32_state )
|
||||
|
||||
MCFG_EEPROM_93C46_ADD("eeprom")
|
||||
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
|
||||
@ -2014,6 +2037,12 @@ static MACHINE_CONFIG_START( nslasher, deco32_state )
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
|
||||
MCFG_SCREEN_UPDATE(nslasher)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen1", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 3);
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen2", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 4);
|
||||
|
||||
MCFG_GFXDECODE(nslasher)
|
||||
MCFG_PALETTE_LENGTH(2048)
|
||||
|
||||
|
@ -53,8 +53,6 @@ public:
|
||||
int pf2_colourbank;
|
||||
int pf4_colourbank;
|
||||
int pri;
|
||||
bitmap_t *sprite0_mix_bitmap;
|
||||
bitmap_t *sprite1_mix_bitmap;
|
||||
bitmap_t *tilemap_alpha_bitmap;
|
||||
UINT32 dragngun_sprite_ctrl;
|
||||
int ace_ram_dirty;
|
||||
@ -63,6 +61,8 @@ public:
|
||||
|
||||
UINT16 spriteram16[0x1000];
|
||||
UINT16 spriteram16_buffered[0x1000];
|
||||
UINT16 spriteram16_2[0x1000];
|
||||
UINT16 spriteram16_2_buffered[0x1000];
|
||||
|
||||
};
|
||||
|
||||
|
@ -184,120 +184,6 @@ WRITE32_HANDLER( deco32_palette_dma_w )
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
This renders sprites to a 16 bit bitmap, for later mixing.
|
||||
Bottom 8 bits per pixel is palettised sprite data, top 8 is
|
||||
colour/alpha/priority.
|
||||
*/
|
||||
static void deco32_draw_sprite(bitmap_t *dest,const rectangle *clip,const gfx_element *gfx,
|
||||
UINT32 code,UINT32 priority,int flipx,int flipy,int sx,int sy)
|
||||
{
|
||||
const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements);
|
||||
int ox,oy,cx,cy;
|
||||
int x_index,y_index,x,y;
|
||||
|
||||
/* check bounds */
|
||||
ox = sx;
|
||||
oy = sy;
|
||||
|
||||
if (sx>319 || sy>247 || sx<-15 || sy<-7)
|
||||
return;
|
||||
|
||||
if (sy<0) sy=0;
|
||||
if (sx<0) sx=0;
|
||||
if (sx>319) cx=319;
|
||||
else cx=ox+16;
|
||||
|
||||
cy=(sy-oy);
|
||||
|
||||
if (flipy) y_index=15-cy; else y_index=cy;
|
||||
|
||||
for( y=0; y<16-cy; y++ )
|
||||
{
|
||||
const UINT8 *source = code_base + y_index * gfx->line_modulo;
|
||||
UINT16 *destb = BITMAP_ADDR16(dest, sy, 0);
|
||||
|
||||
if (flipx) { source+=15-(sx-ox); x_index=-1; } else { x_index=1; source+=(sx-ox); }
|
||||
|
||||
for (x=sx; x<cx; x++)
|
||||
{
|
||||
int c = *source;
|
||||
if( c )
|
||||
destb[x] = c | priority;
|
||||
|
||||
source+=x_index;
|
||||
}
|
||||
|
||||
sy++;
|
||||
if (sy>247)
|
||||
return;
|
||||
if (flipy) y_index--; else y_index++;
|
||||
}
|
||||
}
|
||||
|
||||
// Merge with Tattass & Fghthist sprite routines later
|
||||
static void nslasher_draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT32 *spritedata, int gfxbank)
|
||||
{
|
||||
int offs;
|
||||
|
||||
// Draw sprites back to front saving priority & alpha data per pixel for later mixing
|
||||
for (offs = 0; offs<0x400; offs+=4)
|
||||
{
|
||||
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult; /*,pri=0,spri=0;*/
|
||||
//int trans;
|
||||
|
||||
sprite = spritedata[offs+1] & 0xffff;
|
||||
|
||||
y = spritedata[offs];
|
||||
flash=y&0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1)) continue;
|
||||
|
||||
//trans=TRANSPARENCY_PEN;
|
||||
x = spritedata[offs+2];
|
||||
|
||||
// Prepare colour, priority and alpha info
|
||||
colour = (x>>9) & 0x7f;
|
||||
if (y&0x8000)
|
||||
colour|=0x80;
|
||||
colour<<=8;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
mult=+16;
|
||||
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
deco32_draw_sprite(bitmap,cliprect,machine->gfx[gfxbank],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void dragngun_drawgfxzoom(
|
||||
bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx,
|
||||
UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
|
||||
@ -900,10 +786,11 @@ VIDEO_START( nslasher )
|
||||
|
||||
width = machine->primary_screen->width();
|
||||
height = machine->primary_screen->height();
|
||||
state->sprite0_mix_bitmap=auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 );
|
||||
state->sprite1_mix_bitmap=auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 );
|
||||
state->tilemap_alpha_bitmap=auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16 );
|
||||
|
||||
machine->device<decospr_device>("spritegen1")->alloc_sprite_bitmap(machine);
|
||||
machine->device<decospr_device>("spritegen2")->alloc_sprite_bitmap(machine);
|
||||
|
||||
tilemap_set_transparent_pen(state->pf1_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf2_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf3_tilemap,0);
|
||||
@ -1265,12 +1152,15 @@ static void mixDualAlphaSprites(bitmap_t *bitmap, const rectangle *cliprect, con
|
||||
const pen_t *pal1 = &pens[gfx1->color_base];
|
||||
const pen_t *pal2 = &pens[machine->gfx[(state->pri&1) ? 1 : 2]->color_base];
|
||||
int x,y;
|
||||
bitmap_t* sprite0_mix_bitmap = machine->device<decospr_device>("spritegen1")->get_sprite_temp_bitmap();
|
||||
bitmap_t* sprite1_mix_bitmap = machine->device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
|
||||
|
||||
|
||||
/* Mix sprites into main bitmap, based on priority & alpha */
|
||||
for (y=8; y<248; y++) {
|
||||
UINT8* tilemapPri=BITMAP_ADDR8(machine->priority_bitmap, y, 0);
|
||||
UINT16* sprite0=BITMAP_ADDR16(state->sprite0_mix_bitmap, y, 0);
|
||||
UINT16* sprite1=BITMAP_ADDR16(state->sprite1_mix_bitmap, y, 0);
|
||||
UINT16* sprite0=BITMAP_ADDR16(sprite0_mix_bitmap, y, 0);
|
||||
UINT16* sprite1=BITMAP_ADDR16(sprite1_mix_bitmap, y, 0);
|
||||
UINT32* destLine=BITMAP_ADDR32(bitmap, y, 0);
|
||||
UINT16* alphaTilemap=BITMAP_ADDR16(state->tilemap_alpha_bitmap, y, 0);
|
||||
|
||||
@ -1430,15 +1320,18 @@ SCREEN_UPDATE( nslasher )
|
||||
if (state->ace_ram_dirty)
|
||||
updateAceRam(screen->machine);
|
||||
|
||||
bitmap_fill(state->sprite0_mix_bitmap,cliprect,0);
|
||||
bitmap_fill(state->sprite1_mix_bitmap,cliprect,0);
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
if ((state->pf34_control[5]&0x8000)==0)
|
||||
bitmap_fill(bitmap,cliprect,screen->machine->pens[0x200]);
|
||||
|
||||
/* Draw sprites to temporary bitmaps, saving alpha & priority info for later mixing */
|
||||
nslasher_draw_sprites(screen->machine,state->sprite0_mix_bitmap,cliprect,screen->machine->generic.buffered_spriteram.u32,3);
|
||||
nslasher_draw_sprites(screen->machine,state->sprite1_mix_bitmap,cliprect,screen->machine->generic.buffered_spriteram2.u32,4);
|
||||
screen->machine->device<decospr_device>("spritegen1")->set_pix_raw_shift(8);
|
||||
screen->machine->device<decospr_device>("spritegen2")->set_pix_raw_shift(8);
|
||||
|
||||
screen->machine->device<decospr_device>("spritegen1")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram16_buffered, 0x800, true);
|
||||
screen->machine->device<decospr_device>("spritegen2")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram16_2_buffered, 0x800, true);
|
||||
|
||||
|
||||
/* Render alpha-blended tilemap to seperate buffer for proper mixing */
|
||||
bitmap_fill(state->tilemap_alpha_bitmap,cliprect,0);
|
||||
|
@ -32,6 +32,10 @@
|
||||
dassault.c - complex video mixing
|
||||
boogwing.c - complex video mixing
|
||||
|
||||
notes:
|
||||
does the chip natively support 5bpp (tattass / nslasher) in hw, or is it done with doubled up chips?
|
||||
the information in deco16ic lists 3x sprite chips on those games, but there are only 2 spritelists.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@ -158,6 +162,8 @@ void decospr_device::device_start()
|
||||
// printf("decospr_device::device_start()\n");
|
||||
m_sprite_bitmap = 0;
|
||||
m_alt_format = 0;
|
||||
m_pixmask = 0xf;
|
||||
m_raw_shift = 4; // set to 8 on tattass / nslashers for the custom mixing (because they have 5bpp sprites, and shifting by 4 isn't good enough)
|
||||
}
|
||||
|
||||
void decospr_device::device_reset()
|
||||
@ -347,7 +353,7 @@ void decospr_device::draw_sprites( running_machine *machine, bitmap_t *bitmap, c
|
||||
// if we have a sprite bitmap draw raw data to it for manual mixing
|
||||
drawgfx_transpen_raw(m_sprite_bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
sprite - multi * inc,
|
||||
colour*0x10,
|
||||
colour<<m_raw_shift,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
0);
|
||||
@ -355,7 +361,7 @@ void decospr_device::draw_sprites( running_machine *machine, bitmap_t *bitmap, c
|
||||
{
|
||||
drawgfx_transpen_raw(m_sprite_bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
(sprite - multi * inc)-mult2,
|
||||
colour*0x10,
|
||||
colour<<m_raw_shift,
|
||||
fx,fy,
|
||||
x-16,y + mult * multi,
|
||||
0);
|
||||
@ -467,7 +473,7 @@ void decospr_device::draw_sprites( running_machine *machine, bitmap_t *bitmap, c
|
||||
{
|
||||
drawgfx_transpen_raw(m_sprite_bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
sprite + yy + h * xx,
|
||||
colour*0x10,
|
||||
colour<<m_raw_shift,
|
||||
fx,fy,
|
||||
x + mult * (w-xx),y + mult2 * (h-yy),
|
||||
0);
|
||||
@ -475,7 +481,7 @@ void decospr_device::draw_sprites( running_machine *machine, bitmap_t *bitmap, c
|
||||
// wrap-around y
|
||||
drawgfx_transpen_raw(m_sprite_bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
sprite + yy + h * xx,
|
||||
colour*0x10,
|
||||
colour<<m_raw_shift,
|
||||
fx,fy,
|
||||
x + mult * (w-xx),y + mult2 * (h-yy) - 512,
|
||||
0);
|
||||
@ -528,7 +534,7 @@ void decospr_device::inefficient_copy_sprite_bitmap(running_machine* machine, bi
|
||||
{
|
||||
UINT16 pix = srcline[x];
|
||||
|
||||
if (pix&0xf)
|
||||
if (pix&m_pixmask)
|
||||
{
|
||||
if ((pix & priority_mask) ==pri )
|
||||
{
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
void set_pri_callback(decospr_priority_callback_func callback);
|
||||
void set_gfxregion(int region) { m_gfxregion = region; };
|
||||
void set_alt_format(bool alt) { m_alt_format = alt; };
|
||||
void set_pix_mix_mask(UINT16 mask) { m_pixmask = mask; };
|
||||
void set_pix_raw_shift(UINT16 shift) { m_raw_shift = shift; };
|
||||
void alloc_sprite_bitmap(running_machine* machine);
|
||||
void inefficient_copy_sprite_bitmap(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 pri, UINT16 priority_mask, UINT16 colbase, UINT16 palmask, UINT8 alpha = 0xff);
|
||||
bitmap_t* get_sprite_temp_bitmap(void) { return m_sprite_bitmap; };
|
||||
@ -38,6 +40,8 @@ protected:
|
||||
decospr_priority_callback_func m_pricallback;
|
||||
bitmap_t *m_sprite_bitmap;// optional sprite bitmap (should be INDEXED16)
|
||||
bool m_alt_format;
|
||||
UINT16 m_pixmask;
|
||||
UINT16 m_raw_shift;
|
||||
private:
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user