~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/mame/video/vulgus.c

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#include "emu.h"
10
10
#include "includes/vulgus.h"
11
11
 
12
 
UINT8 *vulgus_fgvideoram,*vulgus_bgvideoram;
13
 
UINT8 *vulgus_scroll_low,*vulgus_scroll_high;
14
 
 
15
 
static int vulgus_palette_bank;
16
 
static tilemap_t *fg_tilemap, *bg_tilemap;
17
 
 
18
12
 
19
13
/***************************************************************************
20
14
 
26
20
{
27
21
        int i;
28
22
 
29
 
        machine->colortable = colortable_alloc(machine, 256);
 
23
        machine.colortable = colortable_alloc(machine, 256);
30
24
 
31
25
        for (i = 0;i < 256;i++)
32
26
        {
48
42
                bit3 = (color_prom[2*256] >> 3) & 0x01;
49
43
                b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
50
44
 
51
 
                colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
 
45
                colortable_palette_set_color(machine.colortable,i,MAKE_RGB(r,g,b));
52
46
                color_prom++;
53
47
        }
54
48
 
57
51
 
58
52
 
59
53
        /* characters use colors 32-47 (?) */
60
 
        for (i = 0;i < machine->gfx[0]->total_colors * machine->gfx[0]->color_granularity;i++)
61
 
                colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, 32 + *color_prom++);
 
54
        for (i = 0;i < machine.gfx[0]->total_colors * machine.gfx[0]->color_granularity;i++)
 
55
                colortable_entry_set_value(machine.colortable, machine.gfx[0]->color_base + i, 32 + *color_prom++);
62
56
 
63
57
        /* sprites use colors 16-31 */
64
 
        for (i = 0;i < machine->gfx[2]->total_colors * machine->gfx[2]->color_granularity;i++)
65
 
                colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i, 16 + *color_prom++);
 
58
        for (i = 0;i < machine.gfx[2]->total_colors * machine.gfx[2]->color_granularity;i++)
 
59
                colortable_entry_set_value(machine.colortable, machine.gfx[2]->color_base + i, 16 + *color_prom++);
66
60
 
67
61
        /* background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks */
68
 
        for (i = 0;i < machine->gfx[1]->total_colors * machine->gfx[1]->color_granularity / 4;i++)
 
62
        for (i = 0;i < machine.gfx[1]->total_colors * machine.gfx[1]->color_granularity / 4;i++)
69
63
        {
70
 
                colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 0*32*8 + i, *color_prom);
71
 
                colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 1*32*8 + i, *color_prom + 64);
72
 
                colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 2*32*8 + i, *color_prom + 128);
73
 
                colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 3*32*8 + i, *color_prom + 192);
 
64
                colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 0*32*8 + i, *color_prom);
 
65
                colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 1*32*8 + i, *color_prom + 64);
 
66
                colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 2*32*8 + i, *color_prom + 128);
 
67
                colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 3*32*8 + i, *color_prom + 192);
74
68
                color_prom++;
75
69
        }
76
70
}
84
78
 
85
79
static TILE_GET_INFO( get_fg_tile_info )
86
80
{
 
81
        vulgus_state *state = machine.driver_data<vulgus_state>();
87
82
        int code, color;
88
83
 
89
 
        code = vulgus_fgvideoram[tile_index];
90
 
        color = vulgus_fgvideoram[tile_index + 0x400];
 
84
        code = state->m_fgvideoram[tile_index];
 
85
        color = state->m_fgvideoram[tile_index + 0x400];
91
86
        SET_TILE_INFO(
92
87
                        0,
93
88
                        code + ((color & 0x80) << 1),
98
93
 
99
94
static TILE_GET_INFO( get_bg_tile_info )
100
95
{
 
96
        vulgus_state *state = machine.driver_data<vulgus_state>();
101
97
        int code, color;
102
98
 
103
 
        code = vulgus_bgvideoram[tile_index];
104
 
        color = vulgus_bgvideoram[tile_index + 0x400];
 
99
        code = state->m_bgvideoram[tile_index];
 
100
        color = state->m_bgvideoram[tile_index + 0x400];
105
101
        SET_TILE_INFO(
106
102
                        1,
107
103
                        code + ((color & 0x80) << 1),
108
 
                        (color & 0x1f) + (0x20 * vulgus_palette_bank),
 
104
                        (color & 0x1f) + (0x20 * state->m_palette_bank),
109
105
                        TILE_FLIPYX((color & 0x60) >> 5));
110
106
}
111
107
 
118
114
 
119
115
VIDEO_START( vulgus )
120
116
{
121
 
        fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows, 8, 8,32,32);
122
 
        bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,16,16,32,32);
 
117
        vulgus_state *state = machine.driver_data<vulgus_state>();
 
118
        state->m_fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows, 8, 8,32,32);
 
119
        state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,16,16,32,32);
123
120
 
124
 
        colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 47);
 
121
        colortable_configure_tilemap_groups(machine.colortable, state->m_fg_tilemap, machine.gfx[0], 47);
125
122
}
126
123
 
127
124
 
133
130
 
134
131
WRITE8_HANDLER( vulgus_fgvideoram_w )
135
132
{
136
 
        vulgus_fgvideoram[offset] = data;
137
 
        tilemap_mark_tile_dirty(fg_tilemap,offset & 0x3ff);
 
133
        vulgus_state *state = space->machine().driver_data<vulgus_state>();
 
134
        state->m_fgvideoram[offset] = data;
 
135
        tilemap_mark_tile_dirty(state->m_fg_tilemap,offset & 0x3ff);
138
136
}
139
137
 
140
138
WRITE8_HANDLER( vulgus_bgvideoram_w )
141
139
{
142
 
        vulgus_bgvideoram[offset] = data;
143
 
        tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff);
 
140
        vulgus_state *state = space->machine().driver_data<vulgus_state>();
 
141
        state->m_bgvideoram[offset] = data;
 
142
        tilemap_mark_tile_dirty(state->m_bg_tilemap,offset & 0x3ff);
144
143
}
145
144
 
146
145
 
147
146
WRITE8_HANDLER( vulgus_c804_w )
148
147
{
149
148
        /* bits 0 and 1 are coin counters */
150
 
        coin_counter_w(space->machine, 0, data & 0x01);
151
 
        coin_counter_w(space->machine, 1, data & 0x02);
 
149
        coin_counter_w(space->machine(), 0, data & 0x01);
 
150
        coin_counter_w(space->machine(), 1, data & 0x02);
152
151
 
153
152
        /* bit 7 flips screen */
154
 
        flip_screen_set(space->machine, data & 0x80);
 
153
        flip_screen_set(space->machine(), data & 0x80);
155
154
}
156
155
 
157
156
 
158
157
WRITE8_HANDLER( vulgus_palette_bank_w )
159
158
{
160
 
        if (vulgus_palette_bank != (data & 3))
 
159
        vulgus_state *state = space->machine().driver_data<vulgus_state>();
 
160
        if (state->m_palette_bank != (data & 3))
161
161
        {
162
 
                vulgus_palette_bank = data & 3;
163
 
                tilemap_mark_all_tiles_dirty(bg_tilemap);
 
162
                state->m_palette_bank = data & 3;
 
163
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
164
164
        }
165
165
}
166
166
 
171
171
 
172
172
***************************************************************************/
173
173
 
174
 
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
 
174
static void draw_sprites(running_machine &machine, bitmap_t *bitmap,const rectangle *cliprect)
175
175
{
176
 
        UINT8 *spriteram = machine->generic.spriteram.u8;
 
176
        vulgus_state *state = machine.driver_data<vulgus_state>();
 
177
        UINT8 *spriteram = state->m_spriteram;
177
178
        int offs;
178
179
 
179
180
 
180
 
        for (offs = machine->generic.spriteram_size - 4;offs >= 0;offs -= 4)
 
181
        for (offs = state->m_spriteram_size - 4;offs >= 0;offs -= 4)
181
182
        {
182
183
                int code,i,col,sx,sy,dir;
183
184
 
199
200
 
200
201
                do
201
202
                {
202
 
                        drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
 
203
                        drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
203
204
                                        code + i,
204
205
                                        col,
205
206
                                        flip_screen_get(machine),flip_screen_get(machine),
206
207
                                        sx, sy + 16 * i * dir,15);
207
208
 
208
209
                        /* draw again with wraparound */
209
 
                        drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
 
210
                        drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
210
211
                                        code + i,
211
212
                                        col,
212
213
                                        flip_screen_get(machine),flip_screen_get(machine),
216
217
        }
217
218
}
218
219
 
219
 
VIDEO_UPDATE( vulgus )
 
220
SCREEN_UPDATE( vulgus )
220
221
{
221
 
        tilemap_set_scrollx(bg_tilemap, 0, vulgus_scroll_low[1] + 256 * vulgus_scroll_high[1]);
222
 
        tilemap_set_scrolly(bg_tilemap, 0, vulgus_scroll_low[0] + 256 * vulgus_scroll_high[0]);
 
222
        vulgus_state *state = screen->machine().driver_data<vulgus_state>();
 
223
        tilemap_set_scrollx(state->m_bg_tilemap, 0, state->m_scroll_low[1] + 256 * state->m_scroll_high[1]);
 
224
        tilemap_set_scrolly(state->m_bg_tilemap, 0, state->m_scroll_low[0] + 256 * state->m_scroll_high[0]);
223
225
 
224
 
        tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
225
 
        draw_sprites(screen->machine, bitmap,cliprect);
226
 
        tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
 
226
        tilemap_draw(bitmap,cliprect,state->m_bg_tilemap,0,0);
 
227
        draw_sprites(screen->machine(), bitmap,cliprect);
 
228
        tilemap_draw(bitmap,cliprect,state->m_fg_tilemap,0,0);
227
229
        return 0;
228
230
}