mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
- Color table removal
- Cleaned up the 'special case' mess this driver has become
This commit is contained in:
parent
d124d81521
commit
3f9150918d
@ -192,13 +192,14 @@ WRITE8_HANDLER( rallyx_scrollx_w );
|
||||
WRITE8_HANDLER( rallyx_scrolly_w );
|
||||
WRITE8_HANDLER( tactcian_starson_w );
|
||||
PALETTE_INIT( rallyx );
|
||||
PALETTE_INIT( jungler );
|
||||
VIDEO_START( rallyx );
|
||||
VIDEO_START( jungler );
|
||||
VIDEO_START( locomotn );
|
||||
VIDEO_START( commsega );
|
||||
VIDEO_UPDATE( rallyx );
|
||||
DRIVER_INIT( rallyx );
|
||||
DRIVER_INIT( jungler );
|
||||
DRIVER_INIT( tactcian );
|
||||
DRIVER_INIT( locomotn );
|
||||
DRIVER_INIT( commsega );
|
||||
VIDEO_UPDATE( jungler );
|
||||
VIDEO_UPDATE( locomotn );
|
||||
|
||||
|
||||
static WRITE8_HANDLER( rallyx_interrupt_vector_w )
|
||||
@ -327,7 +328,7 @@ static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( locomotn_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
static ADDRESS_MAP_START( jungler_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8fff) AM_READWRITE(MRA8_RAM, rallyx_videoram_w) AM_BASE(&rallyx_videoram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM
|
||||
@ -850,8 +851,7 @@ static MACHINE_DRIVER_START( rallyx )
|
||||
MDRV_SCREEN_SIZE(36*8, 32*8)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 2*8, 30*8-1)
|
||||
MDRV_GFXDECODE(rallyx)
|
||||
MDRV_PALETTE_LENGTH(32)
|
||||
MDRV_COLORTABLE_LENGTH(64*4+4)
|
||||
MDRV_PALETTE_LENGTH(64*4+4)
|
||||
|
||||
MDRV_PALETTE_INIT(rallyx)
|
||||
MDRV_VIDEO_START(rallyx)
|
||||
@ -870,11 +870,11 @@ static MACHINE_DRIVER_START( rallyx )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( tactcian )
|
||||
static MACHINE_DRIVER_START( jungler )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD(Z80, 18432000/6) /* 3.072 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(locomotn_map,0)
|
||||
MDRV_CPU_PROGRAM_MAP(jungler_map,0)
|
||||
MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
|
||||
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -886,25 +886,49 @@ static MACHINE_DRIVER_START( tactcian )
|
||||
MDRV_SCREEN_SIZE(36*8, 32*8)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 2*8, 30*8-1)
|
||||
MDRV_GFXDECODE(jungler)
|
||||
MDRV_PALETTE_LENGTH(32+64)
|
||||
MDRV_COLORTABLE_LENGTH(64*4+4)
|
||||
MDRV_PALETTE_LENGTH(64*4+4+64)
|
||||
|
||||
MDRV_PALETTE_INIT(rallyx)
|
||||
MDRV_VIDEO_START(rallyx)
|
||||
MDRV_VIDEO_UPDATE(rallyx)
|
||||
MDRV_PALETTE_INIT(jungler)
|
||||
MDRV_VIDEO_START(jungler)
|
||||
MDRV_VIDEO_UPDATE(jungler)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_IMPORT_FROM(locomotn_sound)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( tactcian )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_IMPORT_FROM(jungler)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_START(locomotn)
|
||||
MDRV_VIDEO_UPDATE(locomotn)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( locomotn )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_IMPORT_FROM(tactcian)
|
||||
MDRV_IMPORT_FROM(jungler)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
|
||||
MDRV_VIDEO_START(locomotn)
|
||||
MDRV_VIDEO_UPDATE(locomotn)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( commsega )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_IMPORT_FROM(jungler)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
|
||||
MDRV_VIDEO_START(commsega)
|
||||
MDRV_VIDEO_UPDATE(locomotn)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
@ -1193,15 +1217,14 @@ ROM_END
|
||||
|
||||
|
||||
|
||||
GAME( 1980, rallyx, 0, rallyx, rallyx, rallyx, ROT0, "Namco", "Rally X", 0 )
|
||||
GAME( 1980, rallyxm, rallyx, rallyx, rallyx, rallyx, ROT0, "[Namco] (Midway license)", "Rally X (Midway)", 0 )
|
||||
GAME( 1981, nrallyx, 0, rallyx, nrallyx, rallyx, ROT0, "Namco", "New Rally X", 0 )
|
||||
|
||||
GAME( 1981, jungler, 0, tactcian, jungler, jungler, ROT90, "Konami", "Jungler", 0 )
|
||||
GAME( 1981, junglers, jungler, tactcian, jungler, jungler, ROT90, "[Konami] (Stern license)", "Jungler (Stern)", 0 )
|
||||
GAME( 1982, tactcian, 0, tactcian, tactcian, tactcian, ROT90, "[Konami] (Sega license)", "Tactician (set 1)", 0 )
|
||||
GAME( 1981, tactcan2, tactcian, tactcian, tactcian, tactcian, ROT90, "[Konami] (Sega license)", "Tactician (set 2)", 0 )
|
||||
GAME( 1982, locomotn, 0, locomotn, locomotn, locomotn, ROT90, "Konami (Centuri license)", "Loco-Motion", 0 )
|
||||
GAME( 1982, gutangtn, locomotn, locomotn, locomotn, locomotn, ROT90, "Konami (Sega license)", "Guttang Gottong", 0 )
|
||||
GAME( 1982, cottong, locomotn, locomotn, locomotn, locomotn, ROT90, "bootleg", "Cotocoto Cottong", 0 )
|
||||
GAME( 1983, commsega, 0, locomotn, commsega, commsega, ROT90, "Sega", "Commando (Sega)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, rallyx, 0, rallyx, rallyx, 0, ROT0, "Namco", "Rally X", 0 )
|
||||
GAME( 1980, rallyxm, rallyx, rallyx, rallyx, 0, ROT0, "[Namco] (Midway license)", "Rally X (Midway)", 0 )
|
||||
GAME( 1981, nrallyx, 0, rallyx, nrallyx, 0, ROT0, "Namco", "New Rally X", 0 )
|
||||
GAME( 1981, jungler, 0, jungler, jungler, 0, ROT90, "Konami", "Jungler", 0 )
|
||||
GAME( 1981, junglers, jungler, jungler, jungler, 0, ROT90, "[Konami] (Stern license)", "Jungler (Stern)", 0 )
|
||||
GAME( 1982, tactcian, 0, tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 1)", 0 )
|
||||
GAME( 1981, tactcan2, tactcian, tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 2)", 0 )
|
||||
GAME( 1982, locomotn, 0, locomotn, locomotn, 0, ROT90, "Konami (Centuri license)", "Loco-Motion", 0 )
|
||||
GAME( 1982, gutangtn, locomotn, locomotn, locomotn, 0, ROT90, "Konami (Sega license)", "Guttang Gottong", 0 )
|
||||
GAME( 1982, cottong, locomotn, locomotn, locomotn, 0, ROT90, "bootleg", "Cotocoto Cottong", 0 )
|
||||
GAME( 1983, commsega, 0, commsega, commsega, 0, ROT90, "Sega", "Commando (Sega)", GAME_IMPERFECT_SOUND )
|
||||
|
@ -28,18 +28,19 @@ needs more color combination to render its graphics.
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "video/resnet.h"
|
||||
|
||||
|
||||
|
||||
UINT8 *rallyx_videoram,*rallyx_radarattr;
|
||||
|
||||
static UINT8 *rallyx_radarx,*rallyx_radary;
|
||||
static int video_type, spriteram_base;
|
||||
static int spriteram_base;
|
||||
|
||||
static tilemap *bg_tilemap,*fg_tilemap;
|
||||
|
||||
#define MAX_STARS 1000
|
||||
#define STARS_COLOR_BASE 32
|
||||
#define STARS_COLOR_BASE (0x104)
|
||||
|
||||
static int stars_enable;
|
||||
|
||||
@ -51,43 +52,6 @@ static struct star stars[MAX_STARS];
|
||||
static int total_stars;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
TYPE_RALLYX,
|
||||
TYPE_JUNGLER,
|
||||
TYPE_TACTCIAN,
|
||||
TYPE_LOCOMOTN,
|
||||
TYPE_COMMSEGA
|
||||
};
|
||||
|
||||
|
||||
DRIVER_INIT( rallyx )
|
||||
{
|
||||
video_type = TYPE_RALLYX;
|
||||
}
|
||||
|
||||
DRIVER_INIT( jungler )
|
||||
{
|
||||
video_type = TYPE_JUNGLER;
|
||||
}
|
||||
|
||||
DRIVER_INIT( tactcian )
|
||||
{
|
||||
video_type = TYPE_TACTCIAN;
|
||||
}
|
||||
|
||||
DRIVER_INIT( locomotn )
|
||||
{
|
||||
video_type = TYPE_LOCOMOTN;
|
||||
}
|
||||
|
||||
DRIVER_INIT( commsega )
|
||||
{
|
||||
video_type = TYPE_COMMSEGA;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Convert the color PROMs.
|
||||
@ -110,77 +74,152 @@ DRIVER_INIT( commsega )
|
||||
***************************************************************************/
|
||||
PALETTE_INIT( rallyx )
|
||||
{
|
||||
static const int resistances_rg[3] = { 1000, 470, 220 };
|
||||
static const int resistances_b [2] = { 470, 220 };
|
||||
double rweights[3], gweights[3], bweights[2];
|
||||
int i;
|
||||
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
|
||||
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
|
||||
|
||||
/* compute the color output resistor weights */
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
3, &resistances_rg[0], rweights, 0, 0,
|
||||
3, &resistances_rg[0], gweights, 0, 0,
|
||||
2, &resistances_b[0], bweights, 1000, 0);
|
||||
|
||||
for (i = 0;i < 32;i++)
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x20);
|
||||
|
||||
/* create a lookup table for the palette */
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
int bit0,bit1,bit2,r,g,b;
|
||||
|
||||
int bit0, bit1, bit2;
|
||||
int r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = (*color_prom >> 0) & 0x01;
|
||||
bit1 = (*color_prom >> 1) & 0x01;
|
||||
bit2 = (*color_prom >> 2) & 0x01;
|
||||
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
bit0 = (color_prom[i] >> 0) & 0x01;
|
||||
bit1 = (color_prom[i] >> 1) & 0x01;
|
||||
bit2 = (color_prom[i] >> 2) & 0x01;
|
||||
r = combine_3_weights(rweights, bit0, bit1, bit2);
|
||||
|
||||
/* green component */
|
||||
bit0 = (*color_prom >> 3) & 0x01;
|
||||
bit1 = (*color_prom >> 4) & 0x01;
|
||||
bit2 = (*color_prom >> 5) & 0x01;
|
||||
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
bit0 = (color_prom[i] >> 3) & 0x01;
|
||||
bit1 = (color_prom[i] >> 4) & 0x01;
|
||||
bit2 = (color_prom[i] >> 5) & 0x01;
|
||||
g = combine_3_weights(gweights, bit0, bit1, bit2);
|
||||
|
||||
/* blue component */
|
||||
if (video_type == TYPE_RALLYX)
|
||||
{
|
||||
bit0 = 0;
|
||||
bit1 = (*color_prom >> 6) & 0x01;
|
||||
bit2 = (*color_prom >> 7) & 0x01;
|
||||
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
}
|
||||
else
|
||||
{
|
||||
bit0 = (*color_prom >> 6) & 0x01;
|
||||
bit1 = (*color_prom >> 7) & 0x01;
|
||||
b = 0x50 * bit0 + 0xab * bit1;
|
||||
}
|
||||
bit0 = (color_prom[i] >> 6) & 0x01;
|
||||
bit1 = (color_prom[i] >> 7) & 0x01;
|
||||
b = combine_2_weights(bweights, bit0, bit1);
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
|
||||
color_prom++;
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
/* color_prom now points to the beginning of the lookup table */
|
||||
color_prom += 0x20;
|
||||
|
||||
/* character lookup table */
|
||||
/* sprites use the same color lookup table as characters */
|
||||
for (i = 0;i < TOTAL_COLORS(0);i++)
|
||||
COLOR(0,i) = *(color_prom++) & 0x0f;
|
||||
|
||||
/* radar dots lookup table */
|
||||
/* they use colors 16-19 */
|
||||
for (i = 0;i < 4;i++)
|
||||
COLOR(2,i) = 16 + i;
|
||||
|
||||
/* Rally X doesn't have the optional starfield generator */
|
||||
if (video_type != TYPE_RALLYX)
|
||||
/* character/sprites lookup table */
|
||||
for (i = 0x000; i < 0x100; i++)
|
||||
{
|
||||
/* now the stars */
|
||||
for (i = 0;i < 64;i++)
|
||||
{
|
||||
int bits,r,g,b;
|
||||
static const int map[4] = { 0x00, 0x47, 0x97, 0xde };
|
||||
|
||||
bits = (i >> 0) & 0x03;
|
||||
r = map[bits];
|
||||
bits = (i >> 2) & 0x03;
|
||||
g = map[bits];
|
||||
bits = (i >> 4) & 0x03;
|
||||
b = map[bits];
|
||||
|
||||
palette_set_color(machine,i + 32,MAKE_RGB(r,g,b));
|
||||
}
|
||||
UINT8 ctabentry = color_prom[i] & 0x0f;
|
||||
colortable_entry_set_value(machine->colortable, i, ctabentry);
|
||||
}
|
||||
|
||||
/* bullets use colors 0x10-0x13 */
|
||||
for (i = 0x100; i < 0x104; i++)
|
||||
colortable_entry_set_value(machine->colortable, i, (i - 0x100) | 0x10);
|
||||
}
|
||||
|
||||
|
||||
PALETTE_INIT( jungler )
|
||||
{
|
||||
static const int resistances_rg[3] = { 1000, 470, 220 };
|
||||
static const int resistances_b [2] = { 470, 220 };
|
||||
static const int resistances_star[3] = { 150, 100 };
|
||||
double rweights[3], gweights[3], bweights[2];
|
||||
double rweights_star[2], gweights_star[2], bweights_star[2];
|
||||
int i;
|
||||
|
||||
/* compute the color output resistor weights */
|
||||
double scale = compute_resistor_weights(0, 255, -1.0,
|
||||
2, resistances_star, rweights_star, 0, 0,
|
||||
2, resistances_star, gweights_star, 0, 0,
|
||||
2, resistances_star, bweights_star, 0, 0);
|
||||
|
||||
compute_resistor_weights(0, 255, scale,
|
||||
3, resistances_rg, rweights, 1000, 0,
|
||||
3, resistances_rg, gweights, 1000, 0,
|
||||
2, resistances_b, bweights, 1000, 0);
|
||||
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x60);
|
||||
|
||||
/* create a lookup table for the palette */
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
int bit0, bit1, bit2;
|
||||
int r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = (color_prom[i] >> 0) & 0x01;
|
||||
bit1 = (color_prom[i] >> 1) & 0x01;
|
||||
bit2 = (color_prom[i] >> 2) & 0x01;
|
||||
r = combine_3_weights(rweights, bit0, bit1, bit2);
|
||||
|
||||
/* green component */
|
||||
bit0 = (color_prom[i] >> 3) & 0x01;
|
||||
bit1 = (color_prom[i] >> 4) & 0x01;
|
||||
bit2 = (color_prom[i] >> 5) & 0x01;
|
||||
g = combine_3_weights(gweights, bit0, bit1, bit2);
|
||||
|
||||
/* blue component */
|
||||
bit0 = (color_prom[i] >> 6) & 0x01;
|
||||
bit1 = (color_prom[i] >> 7) & 0x01;
|
||||
b = combine_2_weights(bweights, bit0, bit1);
|
||||
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
/* star pens */
|
||||
for (i = 0x20; i < 0x60; i++)
|
||||
{
|
||||
int bit0, bit1;
|
||||
int r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = ((i - 0x20) >> 0) & 0x01;
|
||||
bit1 = ((i - 0x20) >> 1) & 0x01;
|
||||
r = combine_2_weights(rweights_star, bit0, bit1);
|
||||
|
||||
/* green component */
|
||||
bit0 = ((i - 0x20) >> 2) & 0x01;
|
||||
bit1 = ((i - 0x20) >> 3) & 0x01;
|
||||
g = combine_2_weights(gweights_star, bit0, bit1);
|
||||
|
||||
/* blue component */
|
||||
bit0 = ((i - 0x20) >> 4) & 0x01;
|
||||
bit1 = ((i - 0x20) >> 5) & 0x01;
|
||||
b = combine_2_weights(bweights_star, bit0, bit1);
|
||||
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
/* color_prom now points to the beginning of the lookup table */
|
||||
color_prom += 0x20;
|
||||
|
||||
/* character/sprites lookup table */
|
||||
for (i = 0x000; i < 0x100; i++)
|
||||
{
|
||||
UINT8 ctabentry = color_prom[i] & 0x0f;
|
||||
colortable_entry_set_value(machine->colortable, i, ctabentry);
|
||||
}
|
||||
|
||||
/* bullets use colors 0x10-0x13 */
|
||||
for (i = 0x100; i < 0x104; i++)
|
||||
colortable_entry_set_value(machine->colortable, i, (i - 0x100) | 0x10);
|
||||
|
||||
/* stars */
|
||||
for (i = 0x104; i < 0x144; i++)
|
||||
colortable_entry_set_value(machine->colortable, i, (i - 0x104) + 0x20);
|
||||
}
|
||||
|
||||
|
||||
@ -251,30 +290,60 @@ static TILE_GET_INFO( locomotn_fg_get_tile_info )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void calculate_star_field(void)
|
||||
{
|
||||
int generator;
|
||||
int x,y;
|
||||
|
||||
/* precalculate the star background */
|
||||
total_stars = 0;
|
||||
generator = 0;
|
||||
|
||||
for (y = 0;y < 256;y++)
|
||||
{
|
||||
for (x = 0;x < 288;x++)
|
||||
{
|
||||
int bit1,bit2;
|
||||
|
||||
generator <<= 1;
|
||||
bit1 = (~generator >> 17) & 1;
|
||||
bit2 = (generator >> 5) & 1;
|
||||
|
||||
if (bit1 ^ bit2) generator |= 1;
|
||||
|
||||
if (((~generator >> 16) & 1) &&
|
||||
(generator & 0xfe) == 0xfe)
|
||||
{
|
||||
int color;
|
||||
|
||||
color = (~(generator >> 8)) & 0x3f;
|
||||
|
||||
if (color && total_stars < MAX_STARS)
|
||||
{
|
||||
stars[total_stars].x = x;
|
||||
stars[total_stars].y = y;
|
||||
stars[total_stars].color = color;
|
||||
|
||||
total_stars++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( rallyx )
|
||||
{
|
||||
int i;
|
||||
|
||||
if (video_type == TYPE_RALLYX || video_type == TYPE_JUNGLER)
|
||||
{
|
||||
bg_tilemap = tilemap_create(rallyx_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(rallyx_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_tilemap = tilemap_create(locomotn_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(locomotn_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
}
|
||||
bg_tilemap = tilemap_create(rallyx_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(rallyx_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
|
||||
/* the scrolling tilemap is slightly misplaced in Rally X */
|
||||
if (video_type == TYPE_RALLYX)
|
||||
tilemap_set_scrolldx(bg_tilemap,3,3);
|
||||
tilemap_set_scrolldx(bg_tilemap,3,3);
|
||||
|
||||
spriteram_base = 0x14;
|
||||
|
||||
/* commsega has more sprites and bullets than the other games */
|
||||
if (video_type == TYPE_COMMSEGA)
|
||||
spriteram_base = 0x00;
|
||||
else
|
||||
spriteram_base = 0x14;
|
||||
spriteram = rallyx_videoram + 0x00;
|
||||
spriteram_2 = spriteram + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
@ -282,58 +351,104 @@ VIDEO_START( rallyx )
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
gfx_drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
gfx_drawmode_table[3] = DRAWMODE_NONE;
|
||||
|
||||
|
||||
/* Rally X doesn't have the optional starfield generator */
|
||||
if (video_type != TYPE_RALLYX)
|
||||
{
|
||||
int generator;
|
||||
int x,y;
|
||||
|
||||
/* precalculate the star background */
|
||||
/* this comes from the Galaxian hardware, Bosconian is probably different */
|
||||
total_stars = 0;
|
||||
generator = 0;
|
||||
|
||||
for (y = 0;y < 256;y++)
|
||||
{
|
||||
for (x = 0;x < 288;x++)
|
||||
{
|
||||
int bit1,bit2;
|
||||
|
||||
|
||||
generator <<= 1;
|
||||
bit1 = (~generator >> 17) & 1;
|
||||
bit2 = (generator >> 5) & 1;
|
||||
|
||||
if (bit1 ^ bit2) generator |= 1;
|
||||
|
||||
if (((~generator >> 16) & 1) &&
|
||||
(generator & 0xfe) == 0xfe)
|
||||
{
|
||||
int color;
|
||||
|
||||
color = (~(generator >> 8)) & 0x3f;
|
||||
if (color && total_stars < MAX_STARS)
|
||||
{
|
||||
stars[total_stars].x = x;
|
||||
stars[total_stars].y = y;
|
||||
stars[total_stars].color = machine->pens[color + STARS_COLOR_BASE];
|
||||
|
||||
total_stars++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( jungler )
|
||||
{
|
||||
int i;
|
||||
|
||||
bg_tilemap = tilemap_create(rallyx_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(rallyx_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
|
||||
spriteram_base = 0x14;
|
||||
|
||||
spriteram = rallyx_videoram + 0x00;
|
||||
spriteram_2 = spriteram + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
rallyx_radary = rallyx_radarx + 0x800;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
gfx_drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
gfx_drawmode_table[3] = DRAWMODE_NONE;
|
||||
|
||||
calculate_star_field();
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( locomotn )
|
||||
{
|
||||
int i;
|
||||
|
||||
bg_tilemap = tilemap_create(locomotn_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(locomotn_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
|
||||
spriteram_base = 0x14;
|
||||
|
||||
spriteram = rallyx_videoram + 0x00;
|
||||
spriteram_2 = spriteram + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
rallyx_radary = rallyx_radarx + 0x800;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
gfx_drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
gfx_drawmode_table[3] = DRAWMODE_NONE;
|
||||
|
||||
calculate_star_field();
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( commsega )
|
||||
{
|
||||
int i;
|
||||
|
||||
bg_tilemap = tilemap_create(locomotn_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(locomotn_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
|
||||
/* commsega has more sprites and bullets than the other games */
|
||||
spriteram_base = 0x00;
|
||||
|
||||
spriteram = rallyx_videoram + 0x00;
|
||||
spriteram_2 = spriteram + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
rallyx_radary = rallyx_radarx + 0x800;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
gfx_drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
gfx_drawmode_table[3] = DRAWMODE_NONE;
|
||||
|
||||
calculate_star_field();
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -369,8 +484,6 @@ WRITE8_HANDLER( tactcian_starson_w )
|
||||
|
||||
static void plot_star(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int x, int y, int color)
|
||||
{
|
||||
int bpen = machine->pens[0];
|
||||
|
||||
if (y < cliprect->min_y ||
|
||||
y > cliprect->max_y ||
|
||||
x < cliprect->min_x ||
|
||||
@ -378,15 +491,12 @@ static void plot_star(running_machine *machine, mame_bitmap *bitmap, const recta
|
||||
return;
|
||||
|
||||
if (flip_screen_x)
|
||||
{
|
||||
x = 255 - x;
|
||||
}
|
||||
if (flip_screen_y)
|
||||
{
|
||||
y = 255 - y;
|
||||
}
|
||||
|
||||
if (*BITMAP_ADDR16(bitmap, y, x) == bpen)
|
||||
if (flip_screen_y)
|
||||
y = 255 - y;
|
||||
|
||||
if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(bitmap, y, x) % 0x144) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[STARS_COLOR_BASE + color];
|
||||
}
|
||||
|
||||
@ -396,16 +506,11 @@ static void draw_stars(running_machine *machine, mame_bitmap *bitmap, const rect
|
||||
|
||||
for (offs = 0;offs < total_stars;offs++)
|
||||
{
|
||||
int x,y;
|
||||
|
||||
|
||||
x = stars[offs].x;
|
||||
y = stars[offs].y;
|
||||
int x = stars[offs].x;
|
||||
int y = stars[offs].y;
|
||||
|
||||
if ((y & 0x01) ^ ((x >> 3) & 0x01))
|
||||
{
|
||||
plot_star(machine, bitmap, cliprect, x, y, stars[offs].color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,16 +523,19 @@ static void rallyx_draw_sprites(running_machine *machine, mame_bitmap *bitmap, c
|
||||
{
|
||||
int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1) - displacement;
|
||||
int sy = 241 - spriteram_2[offs] - displacement;
|
||||
int color = spriteram_2[offs + 1] & 0x3f;
|
||||
int flipx = spriteram[offs] & 1;
|
||||
int flipy = spriteram[offs] & 2;
|
||||
if (flip_screen) sx -= 2*displacement;
|
||||
|
||||
pdrawgfx(bitmap,machine->gfx[1],
|
||||
(spriteram[offs] & 0xfc) >> 2,
|
||||
spriteram_2[offs + 1] & 0x3f,
|
||||
color,
|
||||
flipx,flipy,
|
||||
sx,sy,
|
||||
cliprect,TRANSPARENCY_COLOR,0,0x02);
|
||||
cliprect,TRANSPARENCY_PENS,
|
||||
colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0),
|
||||
0x02);
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,6 +547,7 @@ static void locomotn_draw_sprites(running_machine *machine, mame_bitmap *bitmap,
|
||||
{
|
||||
int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1);
|
||||
int sy = 241 - spriteram_2[offs] - displacement;
|
||||
int color = spriteram_2[offs + 1] & 0x3f;
|
||||
int flip = spriteram[offs] & 2;
|
||||
|
||||
/* handle reduced visible area in some games */
|
||||
@ -446,10 +555,12 @@ static void locomotn_draw_sprites(running_machine *machine, mame_bitmap *bitmap,
|
||||
|
||||
pdrawgfx(bitmap,machine->gfx[1],
|
||||
((spriteram[offs] & 0x7c) >> 2) + 0x20*(spriteram[offs] & 0x01) + ((spriteram[offs] & 0x80) >> 1),
|
||||
spriteram_2[offs + 1] & 0x3f,
|
||||
color,
|
||||
flip,flip,
|
||||
sx,sy,
|
||||
cliprect,TRANSPARENCY_COLOR,0,0x02);
|
||||
cliprect,TRANSPARENCY_PENS,
|
||||
colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0),
|
||||
0x02);
|
||||
}
|
||||
}
|
||||
|
||||
@ -547,35 +658,84 @@ VIDEO_UPDATE( rallyx )
|
||||
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,0,0);
|
||||
/* tile priority doesn't seem to be supported in Jungler */
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,video_type == TYPE_JUNGLER ? 0 : 1);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,video_type == TYPE_JUNGLER ? 0 : 1);
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,1);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,1);
|
||||
|
||||
switch (video_type)
|
||||
{
|
||||
case TYPE_RALLYX:
|
||||
rallyx_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN);
|
||||
rallyx_draw_sprites(machine, bitmap,cliprect,1);
|
||||
rallyx_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE);
|
||||
break;
|
||||
rallyx_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN);
|
||||
rallyx_draw_sprites(machine, bitmap,cliprect,1);
|
||||
rallyx_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE);
|
||||
|
||||
case TYPE_JUNGLER:
|
||||
jungler_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN);
|
||||
rallyx_draw_sprites(machine, bitmap,cliprect,0);
|
||||
jungler_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE);
|
||||
break;
|
||||
|
||||
case TYPE_TACTCIAN:
|
||||
case TYPE_LOCOMOTN:
|
||||
case TYPE_COMMSEGA:
|
||||
locomotn_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN);
|
||||
locomotn_draw_sprites(machine, bitmap,cliprect,0);
|
||||
locomotn_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Rally X doesn't have the optional starfield generator */
|
||||
if (video_type != TYPE_RALLYX)
|
||||
if (stars_enable) draw_stars(machine, bitmap,cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( jungler )
|
||||
{
|
||||
/* the radar tilemap is just 8x32. We rely on the tilemap code to repeat it across
|
||||
the screen, and clip it to only the position where it is supposed to be shown */
|
||||
rectangle fg_clip = *cliprect;
|
||||
rectangle bg_clip = *cliprect;
|
||||
if (flip_screen)
|
||||
{
|
||||
bg_clip.min_x = 8*8;
|
||||
fg_clip.max_x = 8*8-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_clip.max_x = 28*8-1;
|
||||
fg_clip.min_x = 28*8;
|
||||
}
|
||||
|
||||
fillbitmap(priority_bitmap,0,cliprect);
|
||||
|
||||
/* tile priority doesn't seem to be supported in Jungler */
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,0);
|
||||
|
||||
jungler_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN);
|
||||
rallyx_draw_sprites(machine, bitmap,cliprect,0);
|
||||
jungler_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE);
|
||||
|
||||
if (stars_enable)
|
||||
draw_stars(machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( locomotn )
|
||||
{
|
||||
/* the radar tilemap is just 8x32. We rely on the tilemap code to repeat it across
|
||||
the screen, and clip it to only the position where it is supposed to be shown */
|
||||
rectangle fg_clip = *cliprect;
|
||||
rectangle bg_clip = *cliprect;
|
||||
if (flip_screen)
|
||||
{
|
||||
bg_clip.min_x = 8*8;
|
||||
fg_clip.max_x = 8*8-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_clip.max_x = 28*8-1;
|
||||
fg_clip.min_x = 28*8;
|
||||
}
|
||||
|
||||
fillbitmap(priority_bitmap,0,cliprect);
|
||||
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,1);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,1);
|
||||
|
||||
locomotn_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN);
|
||||
locomotn_draw_sprites(machine, bitmap,cliprect,0);
|
||||
locomotn_draw_bullets(machine, bitmap,cliprect,TRANSPARENCY_PEN_TABLE);
|
||||
|
||||
if (stars_enable)
|
||||
draw_stars(machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user