1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Bryan McPhail
3 #include "emu.h"
4 #include "includes/pktgaldx.h"
5 #include "screen.h"
6
7 /* Video on the orginal */
8
screen_update_pktgaldx(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)9 uint32_t pktgaldx_state::screen_update_pktgaldx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
10 {
11 uint16_t flip = m_deco_tilegen->pf_control_r(0);
12
13 // sprites are flipped relative to tilemaps
14 flip_screen_set(BIT(flip, 7));
15 m_sprgen->set_flip_screen(!BIT(flip, 7));
16 m_deco_tilegen->pf_update(m_pf1_rowscroll, m_pf2_rowscroll);
17
18 bitmap.fill(0, cliprect); /* not Confirmed */
19 screen.priority().fill(0);
20
21 m_deco_tilegen->tilemap_2_draw(screen, bitmap, cliprect, 0, 0);
22 m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram, 0x400);
23 m_deco_tilegen->tilemap_1_draw(screen, bitmap, cliprect, 0, 0);
24 return 0;
25 }
26
27 /* Video for the bootleg */
28
screen_update_pktgaldb(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)29 uint32_t pktgaldx_state::screen_update_pktgaldb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
30 {
31 int x, y;
32 int offset = 0;
33 int tileno;
34 int colour;
35
36 bitmap.fill(m_palette->black_pen(), cliprect);
37
38 /* the bootleg seems to treat the tilemaps as sprites */
39 for (offset = 0; offset < 0x1600 / 2; offset += 8)
40 {
41 tileno = m_pktgaldb_sprites[offset + 3] | (m_pktgaldb_sprites[offset + 2] << 16);
42 colour = m_pktgaldb_sprites[offset + 1] >> 1;
43 x = m_pktgaldb_sprites[offset + 0];
44 y = m_pktgaldb_sprites[offset + 4];
45
46 x -= 0xc2;
47 y &= 0x1ff;
48 y -= 8;
49
50 m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, tileno ^ 0x1000, colour, 0, 0, x, y, 0);
51 }
52
53 for (offset = 0x1600/2; offset < 0x2000 / 2; offset += 8)
54 {
55 tileno = m_pktgaldb_sprites[offset + 3] | (m_pktgaldb_sprites[offset + 2] << 16);
56 colour = m_pktgaldb_sprites[offset + 1] >> 1;
57 x = m_pktgaldb_sprites[offset + 0] & 0x1ff;
58 y = m_pktgaldb_sprites[offset + 4] & 0x0ff;
59
60 x -= 0xc2;
61 y &= 0x1ff;
62 y -= 8;
63
64 m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, tileno ^ 0x4000, colour, 0, 0, x, y, 0);
65 }
66
67 for (offset = 0x2000/2; offset < 0x4000 / 2; offset += 8)
68 {
69 tileno = m_pktgaldb_sprites[offset + 3] | (m_pktgaldb_sprites[offset + 2] << 16);
70 colour = m_pktgaldb_sprites[offset + 1] >> 1;
71 x = m_pktgaldb_sprites[offset + 0] & 0x1ff;
72 y = m_pktgaldb_sprites[offset + 4] & 0x0ff;
73
74 x -= 0xc2;
75 y &= 0x1ff;
76 y -= 8;
77
78 m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, tileno ^ 0x3000, colour, 0, 0, x, y, 0);
79 }
80
81 return 0;
82 }
83