Untangles the Fire Truck driver -- what a nightmare...

Many uses of PORT_CUSTOM and PORT_CHANGED, including another good use case for the gear shift logic
This commit is contained in:
Zsolt Vasvari 2008-03-05 04:25:29 +00:00
parent 793cf2e715
commit d41cb7ebce
4 changed files with 806 additions and 1011 deletions

View File

@ -11,17 +11,20 @@
WRITE8_HANDLER( firetrk_skid_reset_w )
{
if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG)
{
firetrk_skid[0] = 0;
firetrk_skid[1] = 0;
}
firetrk_skid[0] = 0;
firetrk_skid[1] = 0;
// also SUPERBUG_SKID_EN and MONTECAR_SKID_EN
// also SUPERBUG_SKID_EN
discrete_sound_w(FIRETRUCK_SKID_EN, 1);
}
WRITE8_HANDLER( montecar_skid_reset_w )
{
discrete_sound_w(MONTECAR_SKID_EN, 1);
}
WRITE8_HANDLER( firetrk_crash_snd_w )
{
// also SUPERBUG_CRASH_DATA and MONTECAR_CRASH_DATA
@ -38,14 +41,17 @@ WRITE8_HANDLER( firetrk_skid_snd_w )
WRITE8_HANDLER( firetrk_motor_snd_w )
{
if (GAME_IS_FIRETRUCK || GAME_IS_MONTECARLO)
{
// also MONTECAR_DRONE_MOTOR_DATA
discrete_sound_w(FIRETRUCK_SIREN_DATA, data >> 4);
}
// also MONTECAR_DRONE_MOTOR_DATA
discrete_sound_w(FIRETRUCK_SIREN_DATA, data >> 4);
// also SUPERBUG_SPEED_DATA and MONTECAR_MOTOR_DATA
discrete_sound_w(FIRETRUCK_MOTOR_DATA, data & 0x0f);
// also MONTECAR_MOTOR_DATA
discrete_sound_w(FIRETRUCK_MOTOR_DATA, data & 0x0f);
}
WRITE8_HANDLER( superbug_motor_snd_w )
{
discrete_sound_w(SUPERBUG_SPEED_DATA, data & 0x0f);
}
@ -55,24 +61,10 @@ WRITE8_HANDLER( firetrk_xtndply_w )
}
WRITE8_HANDLER( firetrk_asr_w )
WRITE8_HANDLER( superbug_asr_w )
{
if (GAME_IS_SUPERBUG)
{
popmessage("ASR");
discrete_sound_w(SUPERBUG_ASR_EN, 1); /* ASR */
}
}
WRITE8_HANDLER( firetrk_out2_w )
{
firetrk_set_flash(data & 0x80);
if (GAME_IS_MONTECARLO)
{
discrete_sound_w(MONTECAR_BEEPER_EN, data & 0x10); /* Beep */
discrete_sound_w(MONTECAR_DRONE_LOUD_DATA, data & 0x0f); /* Drone Motor Volume */
}
}

File diff suppressed because it is too large Load Diff

View File

@ -29,28 +29,17 @@ Atari Fire Truck + Super Bug + Monte Carlo driver
#define MONTECAR_BEEPER_EN FIRETRUCK_XTNDPLY_EN
#define MONTECAR_ATTRACT_INV FIRETRUCK_ATTRACT_EN
#define GAME_IS_FIRETRUCK (firetrk_game == 1)
#define GAME_IS_SUPERBUG (firetrk_game == 2)
#define GAME_IS_MONTECARLO (firetrk_game == 3)
/*----------- defined in drivers/firetrk.c -----------*/
extern int firetrk_game;
extern UINT32 firetrk_color1_mask;
extern UINT32 firetrk_color2_mask;
/*----------- defined in audio/firetrk.c -----------*/
WRITE8_HANDLER( firetrk_skid_reset_w );
WRITE8_HANDLER( montecar_skid_reset_w );
WRITE8_HANDLER( firetrk_crash_snd_w );
WRITE8_HANDLER( firetrk_skid_snd_w );
WRITE8_HANDLER( firetrk_motor_snd_w );
WRITE8_HANDLER( superbug_motor_snd_w );
WRITE8_HANDLER( firetrk_xtndply_w );
WRITE8_HANDLER( firetrk_asr_w );
WRITE8_HANDLER( firetrk_out2_w );
WRITE8_HANDLER( superbug_asr_w );
DISCRETE_SOUND_EXTERN( firetrk );
DISCRETE_SOUND_EXTERN( superbug );
@ -59,23 +48,25 @@ DISCRETE_SOUND_EXTERN( montecar );
/*----------- defined in video/firetrk.c -----------*/
extern VIDEO_UPDATE( firetrk );
extern VIDEO_START( firetrk );
extern VIDEO_EOF( firetrk );
PALETTE_INIT( firetrk );
PALETTE_INIT( montecar );
VIDEO_START( firetrk );
VIDEO_START( superbug );
VIDEO_START( montecar );
VIDEO_UPDATE( firetrk );
VIDEO_UPDATE( superbug );
VIDEO_UPDATE( montecar );
extern WRITE8_HANDLER( firetrk_vert_w );
extern WRITE8_HANDLER( firetrk_horz_w );
extern WRITE8_HANDLER( firetrk_drone_hpos_w );
extern WRITE8_HANDLER( firetrk_drone_vpos_w );
extern WRITE8_HANDLER( firetrk_drone_rot_w );
extern WRITE8_HANDLER( firetrk_playfield_w );
extern WRITE8_HANDLER( firetrk_car_rot_w );
extern UINT8 *firetrk_alpha_num_ram;
extern UINT8 *firetrk_playfield_ram;
extern UINT8 *firetrk_scroll_x;
extern UINT8 *firetrk_scroll_y;
extern UINT8 *firetrk_car_rot;
extern UINT8 *firetrk_drone_rot;
extern UINT8 *firetrk_drone_x;
extern UINT8 *firetrk_drone_y;
extern UINT8 *firetrk_blink;
extern UINT8 firetrk_flash;
extern void firetrk_set_flash(int flag);
extern void firetrk_set_blink(int flag);
extern UINT8* firetrk_alpha_num_ram;
extern UINT8* firetrk_playfield_ram;
extern int firetrk_crash[2];
extern int firetrk_skid[2];
extern UINT8 firetrk_crash[2];
extern UINT8 firetrk_skid[2];

View File

@ -7,463 +7,450 @@ Atari Fire Truck + Super Bug + Monte Carlo video emulation
#include "driver.h"
#include "firetrk.h"
UINT8* firetrk_alpha_num_ram;
UINT8* firetrk_playfield_ram;
int firetrk_skid[2];
int firetrk_crash[2];
UINT8 *firetrk_alpha_num_ram;
UINT8 *firetrk_playfield_ram;
UINT8 *firetrk_scroll_x;
UINT8 *firetrk_scroll_y;
UINT8 *firetrk_car_rot;
UINT8 *firetrk_drone_rot;
UINT8 *firetrk_drone_x;
UINT8 *firetrk_drone_y;
UINT8 *firetrk_blink;
UINT8 firetrk_flash;
UINT8 firetrk_skid[2];
UINT8 firetrk_crash[2];
static bitmap_t *helper1;
static bitmap_t *helper2;
static int blink;
static int flash;
static int drone_hpos;
static int drone_vpos;
static UINT32 color1_mask;
static UINT32 color2_mask;
static const rectangle playfield_window = { 0x02A, 0x115, 0x000, 0x0FF };
struct sprite_data
static const rectangle playfield_window = { 0x02a, 0x115, 0x000, 0x0ff };
static tilemap *tilemap1; /* for screen display */
static tilemap *tilemap2; /* for collision detection */
PALETTE_INIT( firetrk )
{
int layout;
int number;
int x;
int y;
int flipx;
int flipy;
int color;
};
int i;
static struct sprite_data car[2];
static tilemap* tilemap1; /* for screen display */
static tilemap* tilemap2; /* for collision detection */
INLINE int arrow_code(int c)
{
if (GAME_IS_FIRETRUCK)
static const UINT8 colortable_source[] =
{
return (c & 0x3F) >= 0x4 && (c & 0x3F) <= 0xB;
}
if (GAME_IS_SUPERBUG)
0, 0, 1, 0,
2, 0, 3, 0,
3, 3, 2, 3,
1, 3, 0, 3,
0, 0, 1, 0,
2, 0, 0, 3,
3, 0, 0, 3
};
static const rgb_t palette_source[] =
{
return (c & 0x3F) >= 0x8 && (c & 0x3F) <= 0xF;
}
RGB_BLACK,
MAKE_RGB(0x5b, 0x5b, 0x5b),
MAKE_RGB(0xa4, 0xa4, 0xa4),
RGB_WHITE
};
return 0;
color1_mask = color2_mask = 0;
for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
{
UINT8 color = colortable_source[i];
if (color == 1)
color1_mask |= 1 << i;
else if (color == 2)
color2_mask |= 1 << i;
palette_set_color(machine, i, palette_source[color]);
}
}
void firetrk_set_flash(int flag)
static void prom_to_palette(running_machine *machine, int number, UINT8 val)
{
tilemap_mark_all_tiles_dirty(tilemap1);
if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG)
{
if (flag)
{
car[0].color = 1;
car[1].color = 1;
}
else
{
car[0].color = 0;
car[1].color = 0;
}
}
flash = flag;
palette_set_color(machine, number, MAKE_RGB(pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0)));
}
void firetrk_set_blink(int flag)
PALETTE_INIT( montecar )
{
int offset;
int i;
for (offset = 0; offset < 0x100; offset++)
static const UINT8 colortable_source[] =
{
if (arrow_code(firetrk_playfield_ram[offset]))
{
tilemap_mark_tile_dirty(tilemap1, offset);
}
0x00, 0x00, 0x00, 0x01,
0x00, 0x02, 0x00, 0x03,
0x03, 0x03, 0x03, 0x02,
0x03, 0x01, 0x03, 0x00,
0x00, 0x00, 0x02, 0x00,
0x02, 0x01, 0x02, 0x02,
0x00, 0x10, 0x20, 0x30,
0x00, 0x04, 0x08, 0x0c,
0x00, 0x44, 0x48, 0x4c,
0x00, 0x84, 0x88, 0x8c,
0x00, 0xc4, 0xc8, 0xcc
};
/*
* The color PROM is addressed as follows:
*
* A0 => PLAYFIELD 1
* A1 => PLAYFIELD 2
* A2 => DRONE 1
* A3 => DRONE 2
* A4 => CAR 1
* A5 => CAR 2
* A6 => DRONE COLOR 1
* A7 => DRONE COLOR 2
* A8 => PLAYFIELD WINDOW
*
* This driver hard-codes some behavior which actually depends
* on the PROM, like priorities, clipping and transparency.
*
*/
color1_mask = color2_mask = 0;
for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
{
UINT8 color = colortable_source[i];
if (color == 1)
color1_mask |= 1 << i;
else if (color == 2)
color2_mask |= 1 << i;
prom_to_palette(machine, i, color_prom[0x100 + colortable_source[i]]);
}
blink = flag;
palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 0, RGB_BLACK);
palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 1, RGB_WHITE);
}
static TILE_GET_INFO( get_tile_info1 )
static TILE_GET_INFO( firetrk_get_tile_info1 )
{
UINT8 code = firetrk_playfield_ram[tile_index];
int code = firetrk_playfield_ram[tile_index] & 0x3f;
int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03;
int color = code >> 6;
if (blink && arrow_code(code))
{
if (*firetrk_blink && (code >= 0x04) && (code <= 0x0b))
color = 0;
}
if (flash)
{
color |= 4;
}
SET_TILE_INFO(1, code & 0x3f, color, 0);
if (firetrk_flash)
color = color | 0x04;
SET_TILE_INFO(1, code, color, 0);
}
static TILE_GET_INFO( get_tile_info2 )
static TILE_GET_INFO( superbug_get_tile_info1 )
{
UINT8 code = firetrk_playfield_ram[tile_index];
int code = firetrk_playfield_ram[tile_index] & 0x3f;
int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03;
if (*firetrk_blink && (code >= 0x08) && (code <= 0x0f))
color = 0;
if (firetrk_flash)
color = color | 0x04;
SET_TILE_INFO(1, code, color, 0);
}
static TILE_GET_INFO( montecar_get_tile_info1 )
{
int code = firetrk_playfield_ram[tile_index] & 0x3f;
int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03;
if (firetrk_flash)
color = color | 0x04;
SET_TILE_INFO(1, code, color, 0);
}
static TILE_GET_INFO( firetrk_get_tile_info2 )
{
UINT8 code = firetrk_playfield_ram[tile_index] & 0x3f;
int color = 0;
/* palette 1 for crash and palette 2 for skid */
if (((code & 0x30) != 0x00) || ((code & 0x0c) == 0x00))
color = 1; /* palette 0, 1 */
if (GAME_IS_FIRETRUCK)
{
if ((code & 0x30) != 0x00 || (code & 0x0c) == 0x00)
{
color = 1; /* palette 0, 1 */
}
if ((code & 0x3c) == 0x0c)
{
color = 2; /* palette 0, 2 */
}
}
if ((code & 0x3c) == 0x0c)
color = 2; /* palette 0, 2 */
if (GAME_IS_SUPERBUG)
{
if ((code & 0x30) != 0x00)
{
color = 1; /* palette 0, 1 */
}
if ((code & 0x38) == 0x00)
{
color = 2; /* palette 0, 2 */
}
}
SET_TILE_INFO(2, code, color, 0);
}
if (GAME_IS_MONTECARLO)
{
if ((code & 0xc0) == 0x40 || (code & 0xc0) == 0x80)
{
color = 2; /* palette 2, 1 */
}
if ((code & 0xc0) == 0xc0)
{
color = 1; /* palette 2, 0 */
}
if ((code & 0xc0) == 0x00)
{
color = 3; /* palette 2, 2 */
}
if ((code & 0x30) == 0x30)
{
color = 0; /* palette 0, 0 */
}
}
static TILE_GET_INFO( superbug_get_tile_info2 )
{
UINT8 code = firetrk_playfield_ram[tile_index] & 0x3f;
int color = 0;
/* palette 1 for crash and palette 2 for skid */
if ((code & 0x30) != 0x00)
color = 1; /* palette 0, 1 */
if ((code & 0x38) == 0x00)
color = 2; /* palette 0, 2 */
SET_TILE_INFO(2, code, color, 0);
}
static TILE_GET_INFO( montecar_get_tile_info2 )
{
UINT8 code = firetrk_playfield_ram[tile_index];
int color = 0;
/* palette 1 for crash and palette 2 for skid */
if (((code & 0xc0) == 0x40) || ((code & 0xc0) == 0x80))
color = 2; /* palette 2, 1 */
if ((code & 0xc0) == 0xc0)
color = 1; /* palette 2, 0 */
if ((code & 0xc0) == 0x00)
color = 3; /* palette 2, 2 */
if ((code & 0x30) == 0x30)
color = 0; /* palette 0, 0 */
SET_TILE_INFO(2, code & 0x3f, color, 0);
}
WRITE8_HANDLER( firetrk_vert_w )
{
tilemap_set_scrolly(tilemap1, 0, data);
tilemap_set_scrolly(tilemap2, 0, data);
}
WRITE8_HANDLER( firetrk_horz_w )
{
tilemap_set_scrollx(tilemap1, 0, data - 37);
tilemap_set_scrollx(tilemap2, 0, data - 37);
}
WRITE8_HANDLER( firetrk_drone_hpos_w )
{
drone_hpos = data;
}
WRITE8_HANDLER( firetrk_drone_vpos_w )
{
drone_vpos = data;
}
WRITE8_HANDLER( firetrk_car_rot_w )
{
if (GAME_IS_FIRETRUCK)
{
car[0].number = data & 0x03;
if (data & 0x10) /* swap xy */
{
car[0].layout = 4;
}
else
{
car[0].layout = 3;
}
car[0].flipx = data & 0x04;
car[0].flipy = data & 0x08;
}
if (GAME_IS_SUPERBUG)
{
car[0].number = (data & 0x03) ^ 3;
if (data & 0x10) /* swap xy */
{
car[0].layout = 4;
}
else
{
car[0].layout = 3;
}
car[0].flipx = data & 0x04;
car[0].flipy = data & 0x08;
}
if (GAME_IS_MONTECARLO)
{
car[0].number = data & 0x07;
if (data & 0x80)
{
car[1].color |= 2;
}
else
{
car[1].color &= ~2;
}
car[0].flipx = data & 0x10;
car[0].flipy = data & 0x08;
}
}
WRITE8_HANDLER( firetrk_drone_rot_w )
{
car[1].number = data & 0x07;
if (GAME_IS_FIRETRUCK)
{
car[1].flipx = data & 0x08;
car[1].flipy = data & 0x10;
}
if (GAME_IS_MONTECARLO)
{
car[1].flipx = data & 0x10;
car[1].flipy = data & 0x08;
if (data & 0x80)
{
car[1].color |= 1;
}
else
{
car[1].color &= ~1;
}
}
}
WRITE8_HANDLER( firetrk_playfield_w )
{
firetrk_playfield_ram[offset] = data;
tilemap_mark_tile_dirty(tilemap1, offset);
tilemap_mark_tile_dirty(tilemap2, offset);
}
VIDEO_START( firetrk )
{
helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
tilemap1 = tilemap_create(get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16);
tilemap2 = tilemap_create(get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16);
memset(&car[0], 0, sizeof (struct sprite_data));
memset(&car[1], 0, sizeof (struct sprite_data));
if (GAME_IS_FIRETRUCK)
{
car[0].layout = 3;
car[1].layout = 5;
}
if (GAME_IS_SUPERBUG)
{
car[0].layout = 3;
car[1].layout = 0;
}
if (GAME_IS_MONTECARLO)
{
car[0].layout = 3;
car[1].layout = 4;
}
tilemap1 = tilemap_create(firetrk_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16);
tilemap2 = tilemap_create(firetrk_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16);
}
static void calc_car_positions(void)
VIDEO_START( superbug )
{
car[0].x = 144;
car[0].y = 104;
helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
if (GAME_IS_FIRETRUCK)
{
car[1].x = car[1].flipx ? drone_hpos - 63 : 192 - drone_hpos;
car[1].y = car[1].flipy ? drone_vpos - 63 : 192 - drone_vpos;
car[1].x += 36;
}
if (GAME_IS_MONTECARLO)
{
car[1].x = car[1].flipx ? drone_hpos - 31 : 224 - drone_hpos;
car[1].y = car[1].flipy ? drone_vpos - 31 : 224 - drone_vpos;
car[1].x += 34;
}
tilemap1 = tilemap_create(superbug_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16);
tilemap2 = tilemap_create(superbug_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16);
}
static void draw_text(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
VIDEO_START( montecar )
{
const UINT8* p = firetrk_alpha_num_ram;
helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
tilemap1 = tilemap_create(montecar_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16);
tilemap2 = tilemap_create(montecar_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16);
}
static void firetrk_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int which, int flash)
{
int gfx_bank, code, color, flip_x, flip_y, x, y;
if (which)
{
gfx_bank = 5;
code = *firetrk_drone_rot & 0x07;
color = flash ? 1 : 0;
flip_x = *firetrk_drone_rot & 0x08;
flip_y = *firetrk_drone_rot & 0x10;
x = (flip_x ? *firetrk_drone_x - 63 : 192 - *firetrk_drone_x) + 36;
y = flip_y ? *firetrk_drone_y - 63 : 192 - *firetrk_drone_y;
}
else
{
gfx_bank = (*firetrk_car_rot & 0x10) ? 4 : 3;
code = *firetrk_car_rot & 0x03;
color = flash ? 1 : 0;
flip_x = *firetrk_car_rot & 0x04;
flip_y = *firetrk_car_rot & 0x08;
x = 144;
y = 104;
}
drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PEN, 0);
}
static void superbug_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int flash)
{
int gfx_bank = (*firetrk_car_rot & 0x10) ? 4 : 3;
int code = ~*firetrk_car_rot & 0x03;
int color = flash ? 1 : 0;
int flip_x = *firetrk_car_rot & 0x04;
int flip_y = *firetrk_car_rot & 0x08;
drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, 144, 104, cliprect, TRANSPARENCY_PEN, 0);
}
static void montecar_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int which, int is_collision_detection)
{
int gfx_bank, code, color, flip_x, flip_y, x, y;
if (which)
{
gfx_bank = 4;
code = *firetrk_drone_rot & 0x07;
color = is_collision_detection ? 0 : (((*firetrk_car_rot & 0x80) >> 6) | ((*firetrk_drone_rot & 0x80) >> 7));
flip_x = *firetrk_drone_rot & 0x10;
flip_y = *firetrk_drone_rot & 0x08;
x = (flip_x ? *firetrk_drone_x - 31 : 224 - *firetrk_drone_x) + 34;
y = flip_y ? *firetrk_drone_y - 31 : 224 - *firetrk_drone_y;
}
else
{
gfx_bank = 3;
code = *firetrk_car_rot & 0x07;
color = 0;
flip_x = *firetrk_car_rot & 0x10;
flip_y = *firetrk_car_rot & 0x08;
x = 144;
y = 104;
}
drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PEN, 0);
}
static void draw_text(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *alpha_ram,
int x, int count, int height)
{
int i;
for (i = 0; i < 2; i++)
{
int x = 0;
int y = 0;
for (i = 0; i < count; i++)
drawgfx(bitmap, gfx[0], alpha_ram[i], 0, 0, 0, x, i * height, cliprect, TRANSPARENCY_NONE, 0);
}
if (GAME_IS_SUPERBUG || GAME_IS_FIRETRUCK)
{
x = (i == 0) ? 296 : 8;
}
if (GAME_IS_MONTECARLO)
{
x = (i == 0) ? 24 : 16;
}
for (y = 0; y < 256; y += machine->gfx[0]->width)
static void check_collision(int which)
{
int y, x;
for (y = playfield_window.min_y; y <= playfield_window.max_y; y++)
for (x = playfield_window.min_x; x <= playfield_window.max_x; x++)
{
drawgfx(bitmap, machine->gfx[0], *p++, 0, 0, 0,
x, y, cliprect, TRANSPARENCY_NONE, 0);
pen_t a = *BITMAP_ADDR16(helper1, y, x);
pen_t b = *BITMAP_ADDR16(helper2, y, x);
if (b != 0xff && (color1_mask >> a) & 1)
firetrk_crash[which] = 1;
if (b != 0xff && (color2_mask >> a) & 1)
firetrk_skid[which] = 1;
}
}
}
VIDEO_UPDATE( firetrk )
{
int i;
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37);
tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37);
tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y);
tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y);
fillbitmap(bitmap, 0, cliprect);
tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0);
firetrk_draw_car(machine->gfx, bitmap, &playfield_window, 0, firetrk_flash);
firetrk_draw_car(machine->gfx, bitmap, &playfield_window, 1, firetrk_flash);
draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 296, 0x10, 0x10);
draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x10, 8, 0x10, 0x10);
calc_car_positions();
for (i = 1; i >= 0; i--)
if (cliprect->max_y == machine->screen[screen].visarea.max_y)
{
if (GAME_IS_SUPERBUG && i == 1)
{
continue;
}
tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
drawgfx(bitmap,
machine->gfx[car[i].layout],
car[i].number,
car[i].color,
car[i].flipx,
car[i].flipy,
car[i].x,
car[i].y,
&playfield_window,
TRANSPARENCY_PEN, 0);
fillbitmap(helper2, 0xff, &playfield_window);
firetrk_draw_car(machine->gfx, helper2, &playfield_window, 0, FALSE);
check_collision(0);
fillbitmap(helper2, 0xff, &playfield_window);
firetrk_draw_car(machine->gfx, helper2, &playfield_window, 1, FALSE);
check_collision(1);
*firetrk_blink = FALSE;
}
draw_text(machine, bitmap, cliprect);
return 0;
}
VIDEO_EOF( firetrk )
VIDEO_UPDATE( superbug )
{
int i;
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37);
tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37);
tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y);
tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y);
tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
fillbitmap(bitmap, 0, cliprect);
tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0);
superbug_draw_car(machine->gfx, bitmap, &playfield_window, firetrk_flash);
draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 296, 0x10, 0x10);
draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x10, 8, 0x10, 0x10);
calc_car_positions();
for (i = 1; i >= 0; i--)
if (cliprect->max_y == machine->screen[screen].visarea.max_y)
{
int width = machine->gfx[car[i].layout]->width;
int height = machine->gfx[car[i].layout]->height;
tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
int x;
int y;
fillbitmap(helper2, 0xff, &playfield_window);
superbug_draw_car(machine->gfx, helper2, &playfield_window, FALSE);
check_collision(0);
if (GAME_IS_SUPERBUG && i == 1)
{
continue;
}
fillbitmap(helper2, 0xff, NULL);
drawgfx(helper2,
machine->gfx[car[i].layout],
car[i].number,
0,
car[i].flipx,
car[i].flipy,
car[i].x,
car[i].y,
&playfield_window,
TRANSPARENCY_PEN, 0);
for (y = car[i].y; y < car[i].y + height; y++)
{
for (x = car[i].x; x < car[i].x + width; x++)
{
pen_t a;
pen_t b;
if (x < playfield_window.min_x)
continue;
if (x > playfield_window.max_x)
continue;
if (y < playfield_window.min_y)
continue;
if (y > playfield_window.max_y)
continue;
a = *BITMAP_ADDR16(helper1, y, x);
b = *BITMAP_ADDR16(helper2, y, x);
if (b != 0xff && (firetrk_color1_mask >> a) & 1)
{
firetrk_crash[i] = 1;
}
if (b != 0xff && (firetrk_color2_mask >> a) & 1)
{
firetrk_skid[i] = 1;
}
}
}
*firetrk_blink = FALSE;
}
if (blink)
{
firetrk_set_blink(0);
}
return 0;
}
VIDEO_UPDATE( montecar )
{
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37);
tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37);
tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y);
tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y);
fillbitmap(bitmap, 0x2c, cliprect);
tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0);
montecar_draw_car(machine->gfx, bitmap, &playfield_window, 0, FALSE);
montecar_draw_car(machine->gfx, bitmap, &playfield_window, 1, FALSE);
draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 24, 0x20, 0x08);
draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x20, 16, 0x20, 0x08);
if (cliprect->max_y == machine->screen[screen].visarea.max_y)
{
tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
fillbitmap(helper2, 0xff, &playfield_window);
montecar_draw_car(machine->gfx, helper2, &playfield_window, 0, TRUE);
check_collision(0);
fillbitmap(helper2, 0xff, &playfield_window);
montecar_draw_car(machine->gfx, helper2, &playfield_window, 1, TRUE);
check_collision(1);
}
return 0;
}