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

« back to all changes in this revision

Viewing changes to src/mame/video/stactics.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:
91
91
 
92
92
WRITE8_HANDLER( stactics_scroll_ram_w )
93
93
{
94
 
        stactics_state *state = space->machine->driver_data<stactics_state>();
 
94
        stactics_state *state = space->machine().driver_data<stactics_state>();
95
95
 
96
96
        if (data & 0x01)
97
97
        {
98
98
                switch (offset >> 8)
99
99
                {
100
 
                        case 4: state->y_scroll_d = offset & 0xff; break;
101
 
                        case 5: state->y_scroll_e = offset & 0xff; break;
102
 
                        case 6: state->y_scroll_f = offset & 0xff; break;
 
100
                        case 4: state->m_y_scroll_d = offset & 0xff; break;
 
101
                        case 5: state->m_y_scroll_e = offset & 0xff; break;
 
102
                        case 6: state->m_y_scroll_f = offset & 0xff; break;
103
103
                }
104
104
        }
105
105
}
114
114
 
115
115
CUSTOM_INPUT( stactics_get_frame_count_d3 )
116
116
{
117
 
        stactics_state *state = field->port->machine->driver_data<stactics_state>();
 
117
        stactics_state *state = field->port->machine().driver_data<stactics_state>();
118
118
 
119
 
        return (state->frame_count >> 3) & 0x01;
 
119
        return (state->m_frame_count >> 3) & 0x01;
120
120
}
121
121
 
122
122
 
129
129
 
130
130
WRITE8_HANDLER( stactics_speed_latch_w )
131
131
{
132
 
        stactics_state *state = space->machine->driver_data<stactics_state>();
 
132
        stactics_state *state = space->machine().driver_data<stactics_state>();
133
133
 
134
134
        /* This writes to a shift register which is clocked by   */
135
135
        /* a 555 oscillator.  This value determines the speed of */
150
150
                        num_rising_edges++;
151
151
        }
152
152
 
153
 
        state->beam_states_per_frame = num_rising_edges*19/8;
 
153
        state->m_beam_states_per_frame = num_rising_edges*19/8;
154
154
}
155
155
 
156
156
 
157
157
WRITE8_HANDLER( stactics_shot_trigger_w )
158
158
{
159
 
        stactics_state *state = space->machine->driver_data<stactics_state>();
 
159
        stactics_state *state = space->machine().driver_data<stactics_state>();
160
160
 
161
 
        state->shot_standby = 0;
 
161
        state->m_shot_standby = 0;
162
162
}
163
163
 
164
164
 
165
165
WRITE8_HANDLER( stactics_shot_flag_clear_w )
166
166
{
167
 
        stactics_state *state = space->machine->driver_data<stactics_state>();
 
167
        stactics_state *state = space->machine().driver_data<stactics_state>();
168
168
 
169
 
        state->shot_arrive = 0;
 
169
        state->m_shot_arrive = 0;
170
170
}
171
171
 
172
172
 
173
173
CUSTOM_INPUT( stactics_get_shot_standby )
174
174
{
175
 
        stactics_state *state = field->port->machine->driver_data<stactics_state>();
 
175
        stactics_state *state = field->port->machine().driver_data<stactics_state>();
176
176
 
177
 
        return state->shot_standby;
 
177
        return state->m_shot_standby;
178
178
}
179
179
 
180
180
 
181
181
CUSTOM_INPUT( stactics_get_not_shot_arrive )
182
182
{
183
 
        stactics_state *state = field->port->machine->driver_data<stactics_state>();
 
183
        stactics_state *state = field->port->machine().driver_data<stactics_state>();
184
184
 
185
 
        return !state->shot_arrive;
 
185
        return !state->m_shot_arrive;
186
186
}
187
187
 
188
188
 
189
189
static void update_beam(stactics_state *state)
190
190
{
191
191
        /* first, update the firebeam state */
192
 
        state->old_beam_state = state->beam_state;
193
 
        if (state->shot_standby == 0)
194
 
                state->beam_state = state->beam_state + state->beam_states_per_frame;
 
192
        state->m_old_beam_state = state->m_beam_state;
 
193
        if (state->m_shot_standby == 0)
 
194
                state->m_beam_state = state->m_beam_state + state->m_beam_states_per_frame;
195
195
 
196
196
        /* These are thresholds for the two shots from the LED fire ROM */
197
197
        /* (Note: There are two more for sound triggers, */
198
198
        /*        whenever that gets implemented)        */
199
 
        if ((state->old_beam_state < 0x8b) & (state->beam_state >= 0x8b))
200
 
                state->shot_arrive = 1;
201
 
 
202
 
        if ((state->old_beam_state < 0xca) & (state->beam_state >= 0xca))
203
 
                state->shot_arrive = 1;
204
 
 
205
 
        if (state->beam_state >= 0x100)
 
199
        if ((state->m_old_beam_state < 0x8b) & (state->m_beam_state >= 0x8b))
 
200
                state->m_shot_arrive = 1;
 
201
 
 
202
        if ((state->m_old_beam_state < 0xca) & (state->m_beam_state >= 0xca))
 
203
                state->m_shot_arrive = 1;
 
204
 
 
205
        if (state->m_beam_state >= 0x100)
206
206
        {
207
 
                state->beam_state = 0;
208
 
                state->shot_standby = 1;
 
207
                state->m_beam_state = 0;
 
208
                state->m_shot_standby = 1;
209
209
        }
210
210
}
211
211
 
251
251
                for (x = 0; x < 0x100; x++)
252
252
                {
253
253
                        /* get the pixels for the four planes */
254
 
                        int pixel_b = get_pixel_on_plane(state->videoram_b, y, x, 0);
255
 
                        int pixel_d = get_pixel_on_plane(state->videoram_d, y, x, state->y_scroll_d);
256
 
                        int pixel_e = get_pixel_on_plane(state->videoram_e, y, x, state->y_scroll_e);
257
 
                        int pixel_f = get_pixel_on_plane(state->videoram_f, y, x, state->y_scroll_f);
 
254
                        int pixel_b = get_pixel_on_plane(state->m_videoram_b, y, x, 0);
 
255
                        int pixel_d = get_pixel_on_plane(state->m_videoram_d, y, x, state->m_y_scroll_d);
 
256
                        int pixel_e = get_pixel_on_plane(state->m_videoram_e, y, x, state->m_y_scroll_e);
 
257
                        int pixel_f = get_pixel_on_plane(state->m_videoram_f, y, x, state->m_y_scroll_f);
258
258
 
259
259
                        /* get the color for this pixel */
260
 
                        UINT8 color = state->videoram_b[((y >> 3) << 5) | (x >> 3)] >> 4;
 
260
                        UINT8 color = state->m_videoram_b[((y >> 3) << 5) | (x >> 3)] >> 4;
261
261
 
262
262
                        /* assemble the pen index */
263
263
                        int pen = color |
265
265
                                          (pixel_f << 5) |
266
266
                                          (pixel_e << 6) |
267
267
                                          (pixel_d << 7) |
268
 
                                          ((state->palette[0] & 0x01) << 8) |
269
 
                                          ((state->palette[1] & 0x01) << 9);
 
268
                                          ((state->m_palette[0] & 0x01) << 8) |
 
269
                                          ((state->m_palette[1] & 0x01) << 9);
270
270
 
271
271
                        /* compute the effective pixel coordinate after adjusting for the
272
272
               mirror movement - this is mechanical on the real machine */
273
 
                        int sy = y + state->vert_pos;
274
 
                        int sx = x - state->horiz_pos;
 
273
                        int sy = y + state->m_vert_pos;
 
274
                        int sx = x - state->m_horiz_pos;
275
275
 
276
276
                        /* plot if visible */
277
277
                        if ((sy >= 0) && (sy < 0x100) && (sx >= 0) && (sx < 0x100))
309
309
}
310
310
 
311
311
 
312
 
static void update_artwork(running_machine *machine, stactics_state *state)
 
312
static void update_artwork(running_machine &machine, stactics_state *state)
313
313
{
314
314
        int i;
315
 
        UINT8 *beam_region = machine->region("user1")->base();
 
315
        UINT8 *beam_region = machine.region("user1")->base();
316
316
 
317
317
        /* set the lamps first */
318
 
        output_set_indexed_value("base_lamp", 4, state->lamps[0] & 0x01);
319
 
        output_set_indexed_value("base_lamp", 3, state->lamps[1] & 0x01);
320
 
        output_set_indexed_value("base_lamp", 2, state->lamps[2] & 0x01);
321
 
        output_set_indexed_value("base_lamp", 1, state->lamps[3] & 0x01);
322
 
        output_set_indexed_value("base_lamp", 0, state->lamps[4] & 0x01);
323
 
        output_set_value("start_lamp",   state->lamps[5] & 0x01);
324
 
        output_set_value("barrier_lamp", state->lamps[6] & 0x01);  /* this needs to flash on/off, not implemented */
 
318
        output_set_indexed_value("base_lamp", 4, state->m_lamps[0] & 0x01);
 
319
        output_set_indexed_value("base_lamp", 3, state->m_lamps[1] & 0x01);
 
320
        output_set_indexed_value("base_lamp", 2, state->m_lamps[2] & 0x01);
 
321
        output_set_indexed_value("base_lamp", 1, state->m_lamps[3] & 0x01);
 
322
        output_set_indexed_value("base_lamp", 0, state->m_lamps[4] & 0x01);
 
323
        output_set_value("start_lamp",   state->m_lamps[5] & 0x01);
 
324
        output_set_value("barrier_lamp", state->m_lamps[6] & 0x01);  /* this needs to flash on/off, not implemented */
325
325
 
326
326
        /* laser beam - loop for each LED */
327
327
        for (i = 0; i < 0x40; i++)
328
328
        {
329
 
                offs_t beam_data_offs = ((i & 0x08) << 7) | ((i & 0x30) << 4) | state->beam_state;
 
329
                offs_t beam_data_offs = ((i & 0x08) << 7) | ((i & 0x30) << 4) | state->m_beam_state;
330
330
                UINT8 beam_data = beam_region[beam_data_offs];
331
331
                int on = (beam_data >> (i & 0x07)) & 0x01;
332
332
 
335
335
        }
336
336
 
337
337
        /* sight LED */
338
 
        output_set_value("sight_led", *state->motor_on & 0x01);
 
338
        output_set_value("sight_led", *state->m_motor_on & 0x01);
339
339
 
340
340
        /* score display */
341
341
        for (i = 0x01; i < 0x07; i++)
342
 
                output_set_digit_value(i - 1, to_7seg[~state->display_buffer[i] & 0x0f]);
 
342
                output_set_digit_value(i - 1, to_7seg[~state->m_display_buffer[i] & 0x0f]);
343
343
 
344
344
        /* credits indicator */
345
 
        set_indicator_leds(state->display_buffer[0x07], "credit_led", 0x00);
346
 
        set_indicator_leds(state->display_buffer[0x08], "credit_led", 0x04);
 
345
        set_indicator_leds(state->m_display_buffer[0x07], "credit_led", 0x00);
 
346
        set_indicator_leds(state->m_display_buffer[0x08], "credit_led", 0x04);
347
347
 
348
348
        /* barriers indicator */
349
 
        set_indicator_leds(state->display_buffer[0x09], "barrier_led", 0x00);
350
 
        set_indicator_leds(state->display_buffer[0x0a], "barrier_led", 0x04);
351
 
        set_indicator_leds(state->display_buffer[0x0b], "barrier_led", 0x08);
 
349
        set_indicator_leds(state->m_display_buffer[0x09], "barrier_led", 0x00);
 
350
        set_indicator_leds(state->m_display_buffer[0x0a], "barrier_led", 0x04);
 
351
        set_indicator_leds(state->m_display_buffer[0x0b], "barrier_led", 0x08);
352
352
 
353
353
        /* rounds indicator */
354
 
        set_indicator_leds(state->display_buffer[0x0c], "round_led", 0x00);
355
 
        set_indicator_leds(state->display_buffer[0x0d], "round_led", 0x04);
356
 
        set_indicator_leds(state->display_buffer[0x0e], "round_led", 0x08);
357
 
        set_indicator_leds(state->display_buffer[0x0f], "round_led", 0x0c);
 
354
        set_indicator_leds(state->m_display_buffer[0x0c], "round_led", 0x00);
 
355
        set_indicator_leds(state->m_display_buffer[0x0d], "round_led", 0x04);
 
356
        set_indicator_leds(state->m_display_buffer[0x0e], "round_led", 0x08);
 
357
        set_indicator_leds(state->m_display_buffer[0x0f], "round_led", 0x0c);
358
358
}
359
359
 
360
360
 
367
367
 
368
368
static VIDEO_START( stactics )
369
369
{
370
 
        stactics_state *state = machine->driver_data<stactics_state>();
371
 
 
372
 
        state->y_scroll_d = 0;
373
 
        state->y_scroll_e = 0;
374
 
        state->y_scroll_f = 0;
375
 
 
376
 
        state->frame_count = 0;
377
 
        state->shot_standby = 1;
378
 
        state->shot_arrive = 0;
379
 
        state->beam_state = 0;
380
 
        state->old_beam_state = 0;
 
370
        stactics_state *state = machine.driver_data<stactics_state>();
 
371
 
 
372
        state->m_y_scroll_d = 0;
 
373
        state->m_y_scroll_e = 0;
 
374
        state->m_y_scroll_f = 0;
 
375
 
 
376
        state->m_frame_count = 0;
 
377
        state->m_shot_standby = 1;
 
378
        state->m_shot_arrive = 0;
 
379
        state->m_beam_state = 0;
 
380
        state->m_old_beam_state = 0;
381
381
}
382
382
 
383
383
 
388
388
 *
389
389
 *************************************/
390
390
 
391
 
static VIDEO_UPDATE( stactics )
 
391
static SCREEN_UPDATE( stactics )
392
392
{
393
 
        stactics_state *state = screen->machine->driver_data<stactics_state>();
 
393
        stactics_state *state = screen->machine().driver_data<stactics_state>();
394
394
 
395
395
        update_beam(state);
396
396
        draw_background(state, bitmap, cliprect);
397
 
        update_artwork(screen->machine, state);
 
397
        update_artwork(screen->machine(), state);
398
398
 
399
 
        state->frame_count = (state->frame_count + 1) & 0x0f;
 
399
        state->m_frame_count = (state->m_frame_count + 1) & 0x0f;
400
400
 
401
401
        return 0;
402
402
}
419
419
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
420
420
        MCFG_SCREEN_SIZE(32*8, 32*8)
421
421
        MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1)
 
422
        MCFG_SCREEN_UPDATE(stactics)
422
423
 
423
424
        MCFG_PALETTE_LENGTH(0x400)
424
425
 
425
426
        MCFG_PALETTE_INIT(stactics)
426
427
        MCFG_VIDEO_START(stactics)
427
 
        MCFG_VIDEO_UPDATE(stactics)
428
428
MACHINE_CONFIG_END