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

« back to all changes in this revision

Viewing changes to src/mame/video/mikie.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:
39
39
                        4, resistances, bweights, 470, 0);
40
40
 
41
41
        /* allocate the colortable */
42
 
        machine->colortable = colortable_alloc(machine, 0x100);
 
42
        machine.colortable = colortable_alloc(machine, 0x100);
43
43
 
44
44
        /* create a lookup table for the palette */
45
45
        for (i = 0; i < 0x100; i++)
68
68
                bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
69
69
                b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
70
70
 
71
 
                colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
 
71
                colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b));
72
72
        }
73
73
 
74
74
        /* color_prom now points to the beginning of the lookup table,*/
82
82
                for (j = 0; j < 8; j++)
83
83
                {
84
84
                        UINT8 ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
85
 
                        colortable_entry_set_value(machine->colortable, ((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
 
85
                        colortable_entry_set_value(machine.colortable, ((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
86
86
                }
87
87
        }
88
88
}
89
89
 
90
90
WRITE8_HANDLER( mikie_videoram_w )
91
91
{
92
 
        mikie_state *state = space->machine->driver_data<mikie_state>();
 
92
        mikie_state *state = space->machine().driver_data<mikie_state>();
93
93
 
94
 
        state->videoram[offset] = data;
95
 
        tilemap_mark_tile_dirty(state->bg_tilemap, offset);
 
94
        state->m_videoram[offset] = data;
 
95
        tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
96
96
}
97
97
 
98
98
WRITE8_HANDLER( mikie_colorram_w )
99
99
{
100
 
        mikie_state *state = space->machine->driver_data<mikie_state>();
 
100
        mikie_state *state = space->machine().driver_data<mikie_state>();
101
101
 
102
 
        state->colorram[offset] = data;
103
 
        tilemap_mark_tile_dirty(state->bg_tilemap, offset);
 
102
        state->m_colorram[offset] = data;
 
103
        tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
104
104
}
105
105
 
106
106
WRITE8_HANDLER( mikie_palettebank_w )
107
107
{
108
 
        mikie_state *state = space->machine->driver_data<mikie_state>();
 
108
        mikie_state *state = space->machine().driver_data<mikie_state>();
109
109
 
110
 
        if (state->palettebank != (data & 0x07))
 
110
        if (state->m_palettebank != (data & 0x07))
111
111
        {
112
 
                state->palettebank = data & 0x07;
113
 
                tilemap_mark_all_tiles_dirty_all(space->machine);
 
112
                state->m_palettebank = data & 0x07;
 
113
                tilemap_mark_all_tiles_dirty_all(space->machine());
114
114
        }
115
115
}
116
116
 
117
117
WRITE8_HANDLER( mikie_flipscreen_w )
118
118
{
119
 
        if (flip_screen_get(space->machine) != (data & 0x01))
 
119
        if (flip_screen_get(space->machine()) != (data & 0x01))
120
120
        {
121
 
                flip_screen_set(space->machine, data & 0x01);
122
 
                tilemap_mark_all_tiles_dirty_all(space->machine);
 
121
                flip_screen_set(space->machine(), data & 0x01);
 
122
                tilemap_mark_all_tiles_dirty_all(space->machine());
123
123
        }
124
124
}
125
125
 
126
126
static TILE_GET_INFO( get_bg_tile_info )
127
127
{
128
 
        mikie_state *state = machine->driver_data<mikie_state>();
129
 
        int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x20) << 3);
130
 
        int color = (state->colorram[tile_index] & 0x0f) + 16 * state->palettebank;
131
 
        int flags = ((state->colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((state->colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
132
 
        if (state->colorram[tile_index] & 0x10)
 
128
        mikie_state *state = machine.driver_data<mikie_state>();
 
129
        int code = state->m_videoram[tile_index] + ((state->m_colorram[tile_index] & 0x20) << 3);
 
130
        int color = (state->m_colorram[tile_index] & 0x0f) + 16 * state->m_palettebank;
 
131
        int flags = ((state->m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((state->m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
 
132
        if (state->m_colorram[tile_index] & 0x10)
133
133
                tileinfo->category = 1;
134
134
        else
135
135
                tileinfo->category = 0;
141
141
 
142
142
VIDEO_START( mikie )
143
143
{
144
 
        mikie_state *state = machine->driver_data<mikie_state>();
145
 
        state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
 
144
        mikie_state *state = machine.driver_data<mikie_state>();
 
145
        state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
146
146
}
147
147
 
148
 
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
 
148
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
149
149
{
150
 
        mikie_state *state = machine->driver_data<mikie_state>();
151
 
        UINT8 *spriteram = state->spriteram;
 
150
        mikie_state *state = machine.driver_data<mikie_state>();
 
151
        UINT8 *spriteram = state->m_spriteram;
152
152
        int offs;
153
153
 
154
 
        for (offs = 0; offs < state->spriteram_size; offs += 4)
 
154
        for (offs = 0; offs < state->m_spriteram_size; offs += 4)
155
155
        {
156
156
                int gfxbank = (spriteram[offs + 2] & 0x40) ? 2 : 1;
157
157
                int code = (spriteram[offs + 2] & 0x3f) + ((spriteram[offs + 2] & 0x80) >> 1) + ((spriteram[offs] & 0x40) << 1);
158
 
                int color = (spriteram[offs] & 0x0f) + 16 * state->palettebank;
 
158
                int color = (spriteram[offs] & 0x0f) + 16 * state->m_palettebank;
159
159
                int sx = spriteram[offs + 3];
160
160
                int sy = 244 - spriteram[offs + 1];
161
161
                int flipx = ~spriteram[offs] & 0x10;
168
168
                }
169
169
 
170
170
                drawgfx_transpen(bitmap, cliprect,
171
 
                        machine->gfx[gfxbank],
 
171
                        machine.gfx[gfxbank],
172
172
                        code, color,
173
173
                        flipx,flipy,
174
174
                        sx,sy, 0);
175
175
        }
176
176
}
177
177
 
178
 
VIDEO_UPDATE( mikie )
 
178
SCREEN_UPDATE( mikie )
179
179
{
180
 
        mikie_state *state = screen->machine->driver_data<mikie_state>();
181
 
        tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_CATEGORY(0), 0);
182
 
        draw_sprites(screen->machine, bitmap, cliprect);
183
 
        tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_CATEGORY(1), 0);
 
180
        mikie_state *state = screen->machine().driver_data<mikie_state>();
 
181
        tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, TILEMAP_DRAW_CATEGORY(0), 0);
 
182
        draw_sprites(screen->machine(), bitmap, cliprect);
 
183
        tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, TILEMAP_DRAW_CATEGORY(1), 0);
184
184
        return 0;
185
185
}