diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c index 85dbea54e51..dd10db14280 100644 --- a/src/mame/drivers/gaiden.c +++ b/src/mame/drivers/gaiden.c @@ -771,7 +771,7 @@ static MACHINE_CONFIG_START( shadoww, gaiden_state ) MCFG_TECMO_SPRITE_GFX_REGION(3) MCFG_DEVICE_ADD("mixer", TECMO_MIXER, 0) - MCFG_TECMO_MIXER_SHIFTS(10,9,4) // wrong + MCFG_TECMO_MIXER_SHIFTS(10,9,4) MCFG_TECMO_MIXER_BLENDCOLS( 0x0400 + 0x300, 0x0400 + 0x200, 0x0400 + 0x100, 0x0400 + 0x000 ) MCFG_TECMO_MIXER_REGULARCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 ) MCFG_TECMO_MIXER_BLENDSOUCE( 0x0800 + 0x000, 0x0800 + 0x200) diff --git a/src/mame/drivers/tecmo16.c b/src/mame/drivers/tecmo16.c index 30fa3e31ce5..3922f9870bd 100644 --- a/src/mame/drivers/tecmo16.c +++ b/src/mame/drivers/tecmo16.c @@ -355,8 +355,8 @@ static const gfx_layout spritelayout = static GFXDECODE_START( tecmo16 ) GFXDECODE_ENTRY( "gfx1", 0, charlayout, 1*16*16, 16 ) - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 2*16*16, 16*2 ) - GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0*16*16, 16 ) + GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 0x1000 ) + GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0, 0x1000 ) GFXDECODE_END /******************************************************************************/ @@ -389,10 +389,12 @@ static MACHINE_CONFIG_START( fstarfrc, tecmo16_state ) MCFG_TECMO_SPRITE_GFX_REGION(2) MCFG_DEVICE_ADD("mixer", TECMO_MIXER, 0) - MCFG_TECMO_MIXER_SHIFTS(8,10,4) // wrong + MCFG_TECMO_MIXER_SHIFTS(10,9,4) MCFG_TECMO_MIXER_BLENDCOLS( 0x0400 + 0x300, 0x0400 + 0x200, 0x0400 + 0x100, 0x0400 + 0x000 ) MCFG_TECMO_MIXER_REGULARCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 ) MCFG_TECMO_MIXER_BLENDSOUCE( 0x0800 + 0x000, 0x0800 + 0x100) // riot seems to set palettes in 0x800 + 0x200, could be more to this.. + MCFG_TECMO_MIXER_REVSPRITETILE + MCFG_TECMO_MIXER_BGPEN(0x000 + 0x300) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/video/gaiden.c b/src/mame/video/gaiden.c index 73742be5067..d60290f6c26 100644 --- a/src/mame/video/gaiden.c +++ b/src/mame/video/gaiden.c @@ -377,7 +377,7 @@ UINT32 gaiden_state::screen_update_raiga(screen_device &screen, bitmap_rgb32 &bi m_sprite_bitmap.fill(0, cliprect); bitmap.fill(0, cliprect); - m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, m_tile_bitmap_bg, m_tile_bitmap_fg, m_tile_bitmap_fg, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen(), -2, m_sprite_bitmap); + m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen(), m_sprite_bitmap); m_background->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); m_foreground->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); diff --git a/src/mame/video/spbactn.c b/src/mame/video/spbactn.c index 22c980025fa..612414f88bb 100644 --- a/src/mame/video/spbactn.c +++ b/src/mame/video/spbactn.c @@ -123,7 +123,7 @@ int spbactn_state::draw_video(screen_device &screen, bitmap_rgb32 &bitmap, const m_sprite_bitmap.fill(0, cliprect); bitmap.fill(0, cliprect); - m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, m_tile_bitmap_bg, m_tile_bitmap_fg, m_tile_bitmap_fg, cliprect, m_spvideoram, 0, 0, flip_screen(), -2, m_sprite_bitmap); + m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, cliprect, m_spvideoram, 0, 0, flip_screen(), m_sprite_bitmap); m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); diff --git a/src/mame/video/tecmo16.c b/src/mame/video/tecmo16.c index e35d14cbd42..937bbe66d5d 100644 --- a/src/mame/video/tecmo16.c +++ b/src/mame/video/tecmo16.c @@ -17,21 +17,21 @@ TILE_GET_INFO_MEMBER(tecmo16_state::fg_get_tile_info) { int tile = m_videoram[tile_index] & 0x1fff; - int color = m_colorram[tile_index] & 0x0f; + int color = m_colorram[tile_index] & 0x1f; /* bit 4 controls blending */ - tileinfo.category = (m_colorram[tile_index] & 0x10) >> 4; + //tileinfo.category = (m_colorram[tile_index] & 0x10) >> 4; SET_TILE_INFO_MEMBER(1, tile, - color | (tileinfo.category ? 0x70 : 0x00), + color, 0); } TILE_GET_INFO_MEMBER(tecmo16_state::bg_get_tile_info) { int tile = m_videoram2[tile_index] & 0x1fff; - int color = (m_colorram2[tile_index] & 0x0f)+0x10; + int color = (m_colorram2[tile_index] & 0x0f); SET_TILE_INFO_MEMBER(1, tile, @@ -235,26 +235,22 @@ void tecmo16_state::blendbitmaps(bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_in UINT32 tecmo16_state::screen_update_tecmo16(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - screen.priority().fill(0, cliprect); - - m_tile_bitmap_bg.fill(0x300, cliprect); + m_tile_bitmap_bg.fill(0, cliprect); m_tile_bitmap_fg.fill(0, cliprect); m_sprite_bitmap.fill(0, cliprect); + bitmap.fill(0, cliprect); - /* draw tilemaps into a 16-bit bitmap */ - m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 1); - m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 2); - /* draw the blended tiles at a lower priority - so sprites covered by them will still be drawn */ - m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 1, 0); - m_tx_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 4); + if (m_game_is_riot) m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, cliprect, m_spriteram, 0, 0, flip_screen(), m_sprite_bitmap); + else m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, cliprect, m_spriteram, 2, 0, flip_screen(), m_sprite_bitmap); - /* draw sprites into a 16-bit bitmap */ - if (m_game_is_riot) m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, 0, 0, flip_screen(), -1, m_sprite_bitmap); - else m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, 2, 0, flip_screen(), -1, m_sprite_bitmap); + m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); + m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); + + m_mixer->mix_bitmaps(screen, bitmap, cliprect, m_palette, &m_tile_bitmap_bg, &m_tile_bitmap_fg, (bitmap_ind16*)0, &m_sprite_bitmap); + + // todo, this should go through the mixer! + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); - /* mix & blend the tilemaps and sprites into a 32-bit bitmap */ - blendbitmaps(bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect); return 0; } diff --git a/src/mame/video/tecmo_spr.c b/src/mame/video/tecmo_spr.c index 08ff77da182..b92f0c39b41 100644 --- a/src/mame/video/tecmo_spr.c +++ b/src/mame/video/tecmo_spr.c @@ -74,25 +74,17 @@ static const UINT8 layout[8][8] = #define NUM_SPRITES 256 -int tecmo_spr_device::gaiden_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, bitmap_ind16 &bitmap_bg, bitmap_ind16 &bitmap_fg, bitmap_ind16 &bitmap_sp, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flip_screen, int pri_hack, bitmap_ind16 &bitmap_prihack ) +void tecmo_spr_device::gaiden_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flip_screen, bitmap_ind16 &sprite_bitmap ) { gfx_element *gfx = gfxdecode->gfx(m_gfxregion); UINT16 *source; int sourceinc; - if (pri_hack == -2) - { - source = spriteram; - sourceinc = 8; - } - else - { - source = (NUM_SPRITES - 1) * 8 + spriteram; - sourceinc = -8; - } + source = spriteram; + sourceinc = 8; + int count = NUM_SPRITES; - int drawn = 0; int screenwidth = screen.width(); @@ -114,13 +106,10 @@ int tecmo_spr_device::gaiden_draw_sprites( screen_device &screen, gfxdecode_devi while (count--) { UINT32 attributes = source[attributes_word]; - UINT32 priority_mask; int col,row; if (source[enable_word] & 0x04) - { - UINT32 priority = (attributes >> 6) & 3; - + { UINT32 flipx = (attributes & 1); UINT32 flipy = (attributes & 2); @@ -163,40 +152,16 @@ int tecmo_spr_device::gaiden_draw_sprites( screen_device &screen, gfxdecode_devi ypos += 512; } - /* bg: 1; fg:2; text: 4 */ - switch( priority ) - { - default: - case 0x0: priority_mask = 0; break; - case 0x1: priority_mask = 0xf0; break; /* obscured by text layer */ - case 0x2: priority_mask = 0xf0 | 0xcc; break; /* obscured by foreground */ - case 0x3: priority_mask = 0xf0 | 0xcc | 0xaa; break; /* obscured by bg and fg */ - } bitmap_ind16* bitmap; - if (pri_hack == -1) // this is what the majority of the current drivers use - { - /* blending */ - if (attributes & 0x20) - { - color |= 0x80; - bitmap = &bitmap_sp; - } - else - { - bitmap = (priority >= 2) ? &bitmap_bg : &bitmap_fg; - } - } - else // render to a single bitmap, with all priority / colour data mixed in for later processing (assumings sprites can't blend sprites we should probably be doing this) - { - // this contains the blend bit and the priority bits, the spbactn proto uses 0x0300 for priority, spbactn uses 0x0030, others use 0x00c0 - color |= (source[attributes_word] & 0x03f0); - bitmap = &bitmap_prihack; - } + // this contains the blend bit and the priority bits, the spbactn proto uses 0x0300 for priority, spbactn uses 0x0030, others use 0x00c0 + color |= (source[attributes_word] & 0x03f0); + bitmap = &sprite_bitmap; + for (row = 0; row < sizey; row++) { @@ -205,34 +170,18 @@ int tecmo_spr_device::gaiden_draw_sprites( screen_device &screen, gfxdecode_devi int sx = xpos + 8 * (flipx ? (sizex - 1 - col) : col); int sy = ypos + 8 * (flipy ? (sizey - 1 - row) : row); - if (pri_hack == -1) - { - gfx->prio_transpen_raw(*bitmap, cliprect, - number + layout[row][col], - gfx->colorbase() + color * gfx->granularity(), - flipx, flipy, - sx, sy, - screen.priority(), priority_mask, 0); - } - else // spbactn - { - gfx->transpen_raw(*bitmap, cliprect, - number + layout[row][col], - gfx->colorbase() + color * gfx->granularity(), - flipx, flipy, - sx, sy, - 0); - } + gfx->transpen_raw(*bitmap, cliprect, + number + layout[row][col], + gfx->colorbase() + color * gfx->granularity(), + flipx, flipy, + sx, sy, + 0); + } } - - drawn++; - } source += sourceinc; } - - return drawn; } // comad bootleg of spbactn diff --git a/src/mame/video/tecmo_spr.h b/src/mame/video/tecmo_spr.h index f9f6d562611..62f7262579a 100644 --- a/src/mame/video/tecmo_spr.h +++ b/src/mame/video/tecmo_spr.h @@ -10,8 +10,7 @@ public: static void set_gfx_region(device_t &device, int gfxregion); void galspnbl_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, UINT16* spriteram, int spriteram_bytes ); - int gaiden_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, bitmap_ind16 &bitmap_bg, bitmap_ind16 &bitmap_fg, bitmap_ind16 &bitmap_sp, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flipscreen, int pri_hack, bitmap_ind16 &bitmap_prihack ); - + void gaiden_draw_sprites(screen_device &screen, gfxdecode_device *gfxdecode, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flip_screen, bitmap_ind16 &sprite_bitmap); protected: virtual void device_start();