1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 #include "emu.h"
4 #include "includes/taxidriv.h"
5
6
spritectrl_w(offs_t offset,uint8_t data)7 void taxidriv_state::spritectrl_w(offs_t offset, uint8_t data)
8 {
9 m_spritectrl[offset] = data;
10 }
11
12
13
screen_update(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)14 uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
15 {
16 if (m_bghide)
17 {
18 bitmap.fill(0, cliprect);
19
20
21 /* kludge to fix scroll after death */
22 m_scroll[0] = m_scroll[1] = m_scroll[2] = m_scroll[3] = 0;
23 m_spritectrl[2] = m_spritectrl[5] = m_spritectrl[8] = 0;
24 }
25 else
26 {
27 for (int offs = 0;offs < 0x400;offs++)
28 {
29 int sx = offs % 32;
30 int sy = offs / 32;
31
32 m_gfxdecode->gfx(3)->opaque(bitmap,cliprect,
33 m_vram3[offs],
34 0,
35 0,0,
36 (sx*8-m_scroll[0])&0xff,(sy*8-m_scroll[1])&0xff);
37 }
38
39 for (int offs = 0;offs < 0x400;offs++)
40 {
41 int sx = offs % 32;
42 int sy = offs / 32;
43
44 m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
45 m_vram2[offs]+256*m_vram2[offs+0x400],
46 0,
47 0,0,
48 (sx*8-m_scroll[2])&0xff,(sy*8-m_scroll[3])&0xff,0);
49 }
50
51 if (m_spritectrl[2] & 4)
52 {
53 for (int offs = 0;offs < 0x1000;offs++)
54 {
55 int sx = ((offs/2) % 64-m_spritectrl[0]-256*(m_spritectrl[2]&1))&0x1ff;
56 int sy = ((offs/2) / 64-m_spritectrl[1]-128*(m_spritectrl[2]&2))&0x1ff;
57
58 int color = (m_vram5[offs/4]>>(2*(offs&3)))&0x03;
59 if (color)
60 {
61 if (sx > 0 && sx < 256 && sy > 0 && sy < 256)
62 bitmap.pix(sy, sx) = color;
63 }
64 }
65 }
66
67 if (m_spritectrl[5] & 4)
68 {
69 for (int offs = 0;offs < 0x1000;offs++)
70 {
71 int sx = ((offs/2) % 64-m_spritectrl[3]-256*(m_spritectrl[5]&1))&0x1ff;
72 int sy = ((offs/2) / 64-m_spritectrl[4]-128*(m_spritectrl[5]&2))&0x1ff;
73
74 int color = (m_vram6[offs/4]>>(2*(offs&3)))&0x03;
75 if (color)
76 {
77 if (sx > 0 && sx < 256 && sy > 0 && sy < 256)
78 bitmap.pix(sy, sx) = color;
79 }
80 }
81 }
82
83 if (m_spritectrl[8] & 4)
84 {
85 for (int offs = 0;offs < 0x1000;offs++)
86 {
87 int sx = ((offs/2) % 64-m_spritectrl[6]-256*(m_spritectrl[8]&1))&0x1ff;
88 int sy = ((offs/2) / 64-m_spritectrl[7]-128*(m_spritectrl[8]&2))&0x1ff;
89
90 int color = (m_vram7[offs/4]>>(2*(offs&3)))&0x03;
91 if (color)
92 {
93 if (sx > 0 && sx < 256 && sy > 0 && sy < 256)
94 bitmap.pix(sy, sx) = color;
95 }
96 }
97 }
98
99 for (int offs = 0;offs < 0x400;offs++)
100 {
101 int sx = offs % 32;
102 int sy = offs / 32;
103
104 m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
105 m_vram1[offs],
106 0,
107 0,0,
108 sx*8,sy*8,0);
109 }
110
111 for (int offs = 0;offs < 0x2000;offs++)
112 {
113 int sx = (offs/2) % 64;
114 int sy = (offs/2) / 64;
115
116 int color = (m_vram4[offs/4]>>(2*(offs&3)))&0x03;
117 if (color)
118 {
119 bitmap.pix(sy, sx) = 2 * color;
120 }
121 }
122 }
123
124 for (int offs = 0;offs < 0x400;offs++)
125 {
126 int sx = offs % 32;
127 int sy = offs / 32;
128
129 m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
130 m_vram0[offs],
131 0,
132 0,0,
133 sx*8,sy*8,0);
134 }
135 return 0;
136 }
137