1 // license:BSD-3-Clause
2 // copyright-holders:Luca Elia, David Haywood
3 /***************************************************************************
4 
5     (legacy metro.cpp, currently contains Blazing Tornado overrides,
6      to be moved into its own driver file!)
7 
8 ***************************************************************************/
9 
10 #include "emu.h"
11 #include "includes/metro.h"
12 
TILE_GET_INFO_MEMBER(metro_state::k053936_get_tile_info)13 TILE_GET_INFO_MEMBER(metro_state::k053936_get_tile_info)
14 {
15 	int code = m_k053936_ram[tile_index];
16 
17 	tileinfo.set(0,
18 			code & 0x7fff,
19 			0xe,
20 			0);
21 }
22 
TILE_GET_INFO_MEMBER(metro_state::k053936_gstrik2_get_tile_info)23 TILE_GET_INFO_MEMBER(metro_state::k053936_gstrik2_get_tile_info)
24 {
25 	int code = m_k053936_ram[tile_index];
26 
27 	tileinfo.set(0,
28 			(code & 0x7fff)>>2,
29 			0xe,
30 			0);
31 }
32 
k053936_w(offs_t offset,uint16_t data,uint16_t mem_mask)33 void metro_state::k053936_w(offs_t offset, uint16_t data, uint16_t mem_mask)
34 {
35 	COMBINE_DATA(&m_k053936_ram[offset]);
36 	m_k053936_tilemap->mark_tile_dirty(offset);
37 }
38 
TILEMAP_MAPPER_MEMBER(metro_state::tilemap_scan_gstrik2)39 TILEMAP_MAPPER_MEMBER(metro_state::tilemap_scan_gstrik2)
40 {
41 	/* logical (col,row) -> memory offset */
42 	return ((row & 0x40) >> 6) | (col << 1) | ((row & 0x80) << 1) | ((row & 0x3f) << 9);
43 }
44 
VIDEO_START_MEMBER(metro_state,blzntrnd)45 VIDEO_START_MEMBER(metro_state,blzntrnd)
46 {
47 	m_k053936_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(metro_state::k053936_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 256, 512);
48 }
49 
VIDEO_START_MEMBER(metro_state,gstrik2)50 VIDEO_START_MEMBER(metro_state,gstrik2)
51 {
52 	m_k053936_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(metro_state::k053936_gstrik2_get_tile_info)), tilemap_mapper_delegate(*this, FUNC(metro_state::tilemap_scan_gstrik2)), 16, 16, 128, 256);
53 }
54 
screen_update_psac_vdp2_mix(screen_device & screen,bitmap_rgb32 & bitmap,const rectangle & cliprect)55 uint32_t metro_state::screen_update_psac_vdp2_mix(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
56 {
57 	/* TODO: bit 5 of reg 7 is off when ROZ is supposed to be disabled
58 	 * (Blazing Tornado title screen/character select/ending and Grand Striker 2 title/how to play transition)
59 	 */
60 
61 	bitmap.fill(m_vdp2->get_background_pen(), cliprect);
62 	m_k053936->zoom_draw(screen, bitmap, cliprect, m_k053936_tilemap, 0, 0, 1); // FIXME!!!
63 	m_vdp2->draw_foreground(screen, bitmap, cliprect);
64 
65 	return 0;
66 }
67