1 /***************************************************************************
2
3 Atari "Round" hardware
4
5 ****************************************************************************/
6
7 #include "driver.h"
8 #include "machine/atarigen.h"
9 #include "offtwall.h"
10
11
12
13 /*************************************
14 *
15 * Tilemap callbacks
16 *
17 *************************************/
18
get_playfield_tile_info(int tile_index)19 static void get_playfield_tile_info(int tile_index)
20 {
21 UINT16 data1 = atarigen_playfield[tile_index];
22 UINT16 data2 = atarigen_playfield_upper[tile_index] >> 8;
23 int code = data1 & 0x7fff;
24 int color = 0x10 + (data2 & 0x0f);
25 SET_TILE_INFO(0, code, color, (data1 >> 15) & 1);
26 }
27
28
29
30 /*************************************
31 *
32 * Video system start
33 *
34 *************************************/
35
VIDEO_START(offtwall)36 VIDEO_START( offtwall )
37 {
38 static const struct atarimo_desc modesc =
39 {
40 0, /* index to which gfx system */
41 1, /* number of motion object banks */
42 1, /* are the entries linked? */
43 0, /* are the entries split? */
44 0, /* render in reverse order? */
45 0, /* render in swapped X/Y order? */
46 0, /* does the neighbor bit affect the next object? */
47 8, /* pixels per SLIP entry (0 for no-slip) */
48 0, /* pixel offset for SLIPs */
49 0, /* maximum number of links to visit/scanline (0=all) */
50
51 0x100, /* base palette entry */
52 0x100, /* maximum number of colors */
53 0, /* transparent pen index */
54
55 {{ 0x00ff,0,0,0 }}, /* mask for the link */
56 {{ 0 }}, /* mask for the graphics bank */
57 {{ 0,0x7fff,0,0 }}, /* mask for the code index */
58 {{ 0 }}, /* mask for the upper code index */
59 {{ 0,0,0x000f,0 }}, /* mask for the color */
60 {{ 0,0,0xff80,0 }}, /* mask for the X position */
61 {{ 0,0,0,0xff80 }}, /* mask for the Y position */
62 {{ 0,0,0,0x0070 }}, /* mask for the width, in tiles*/
63 {{ 0,0,0,0x0007 }}, /* mask for the height, in tiles */
64 {{ 0,0x8000,0,0 }}, /* mask for the horizontal flip */
65 {{ 0 }}, /* mask for the vertical flip */
66 {{ 0 }}, /* mask for the priority */
67 {{ 0 }}, /* mask for the neighbor */
68 {{ 0 }}, /* mask for absolute coordinates */
69
70 {{ 0 }}, /* mask for the special value */
71 0, /* resulting value to indicate "special" */
72 0 /* callback routine for special entries */
73 };
74
75 /* initialize the playfield */
76 atarigen_playfield_tilemap = tilemap_create(get_playfield_tile_info, tilemap_scan_cols, TILEMAP_OPAQUE, 8,8, 64,64);
77 if (!atarigen_playfield_tilemap)
78 return 1;
79
80 /* initialize the motion objects */
81 if (!atarimo_init(0, &modesc))
82 return 1;
83 return 0;
84 }
85
86
87
88 /*************************************
89 *
90 * Main refresh
91 *
92 *************************************/
93
VIDEO_UPDATE(offtwall)94 VIDEO_UPDATE( offtwall )
95 {
96 struct atarimo_rect_list rectlist;
97 struct mame_bitmap *mobitmap;
98 int x, y, r;
99
100 /* draw the playfield */
101 tilemap_draw(bitmap, cliprect, atarigen_playfield_tilemap, 0, 0);
102
103 /* draw and merge the MO */
104 mobitmap = atarimo_render(0, cliprect, &rectlist);
105 for (r = 0; r < rectlist.numrects; r++, rectlist.rect++)
106 for (y = rectlist.rect->min_y; y <= rectlist.rect->max_y; y++)
107 {
108 UINT16 *mo = (UINT16 *)mobitmap->base + mobitmap->rowpixels * y;
109 UINT16 *pf = (UINT16 *)bitmap->base + bitmap->rowpixels * y;
110 for (x = rectlist.rect->min_x; x <= rectlist.rect->max_x; x++)
111 if (mo[x])
112 {
113 /* not yet verified
114 */
115 pf[x] = mo[x];
116
117 /* erase behind ourselves */
118 mo[x] = 0;
119 }
120 }
121 }
122