mirror of
https://github.com/holub/mame
synced 2025-04-18 22:49:58 +03:00
Merged afega.c and nmk16.c drivers
Removed many hacks from both. A couple of games changed status from GAME_NOT_WORKING to fully playable: stagger1, redhawk, redhawkb, grdnstrm, spec2k, firehawk (all - former afega.c) and tharrier/tharrierj(nmk16.c)
This commit is contained in:
parent
9334535a4d
commit
f80cc32b04
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1152,7 +1152,6 @@ src/mame/drivers/actfancr.c svneol=native#text/plain
|
||||
src/mame/drivers/adp.c svneol=native#text/plain
|
||||
src/mame/drivers/aeroboto.c svneol=native#text/plain
|
||||
src/mame/drivers/aerofgt.c svneol=native#text/plain
|
||||
src/mame/drivers/afega.c svneol=native#text/plain
|
||||
src/mame/drivers/airbustr.c svneol=native#text/plain
|
||||
src/mame/drivers/ajax.c svneol=native#text/plain
|
||||
src/mame/drivers/aladbl.c svneol=native#text/plain
|
||||
@ -2552,7 +2551,6 @@ src/mame/video/88games.c svneol=native#text/plain
|
||||
src/mame/video/actfancr.c svneol=native#text/plain
|
||||
src/mame/video/aeroboto.c svneol=native#text/plain
|
||||
src/mame/video/aerofgt.c svneol=native#text/plain
|
||||
src/mame/video/afega.c svneol=native#text/plain
|
||||
src/mame/video/airbustr.c svneol=native#text/plain
|
||||
src/mame/video/ajax.c svneol=native#text/plain
|
||||
src/mame/video/aliens.c svneol=native#text/plain
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1488,7 +1488,6 @@ $(MAMEOBJ)/misc.a: \
|
||||
$(DRIVERS)/4enraya.o $(VIDEO)/4enraya.o \
|
||||
$(DRIVERS)/acefruit.o \
|
||||
$(DRIVERS)/adp.o \
|
||||
$(DRIVERS)/afega.o $(VIDEO)/afega.o \
|
||||
$(DRIVERS)/ambush.o $(VIDEO)/ambush.o \
|
||||
$(DRIVERS)/ampoker.o $(VIDEO)/ampoker.o \
|
||||
$(DRIVERS)/amspdwy.o $(VIDEO)/amspdwy.o \
|
||||
|
@ -1,381 +0,0 @@
|
||||
/***************************************************************************
|
||||
|
||||
-= Afega Games =-
|
||||
|
||||
driver by Luca Elia (l.elia@tin.it)
|
||||
|
||||
|
||||
Note: if MAME_DEBUG is defined, pressing Z with:
|
||||
|
||||
Q / W Shows Layer 0 / 1
|
||||
A Shows Sprites
|
||||
|
||||
Keys can be used together!
|
||||
|
||||
[ 2 Layers ]
|
||||
[ Layer 0 ] [ Layer 1 ]
|
||||
|
||||
Tile Size: 16 x 16 x 4/8 8 x 8 x 4
|
||||
Layer Size (pixels): 1024 x 1024 256 x 256
|
||||
Layer Size (tiles): 64 x 64 32 x 32
|
||||
Scrolling: Yes No
|
||||
|
||||
The layout is a bit weird. 16 consecutive tile codes define a
|
||||
vertical column. 16 columns form a page (256 x 256).
|
||||
Layer 0 is made of 4 x 4 pages. Layer 1 of just 1 page.
|
||||
|
||||
[ 256 Sprites ]
|
||||
|
||||
Sprites are made of 16 x 16 x 4 tiles. Size can vary from 1 to 16
|
||||
tiles both horizontally and vertically.
|
||||
Is there zooming ?
|
||||
|
||||
[ Priorities ]
|
||||
|
||||
The game only uses this scheme:
|
||||
|
||||
Back -> Front: Layer 0, Sprites, Layer 1
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#ifdef MAME_DEBUG
|
||||
#include "ui.h"
|
||||
#endif
|
||||
|
||||
/* Variables needed by drivers: */
|
||||
|
||||
UINT16 *afega_vram_0, *afega_scroll_0;
|
||||
UINT16 *afega_vram_1, *afega_scroll_1;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
Palette - RRRRGGGGBBBB????
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
WRITE16_HANDLER( afega_palette_w )
|
||||
{
|
||||
int r,g,b;
|
||||
data = COMBINE_DATA(&paletteram16[offset]);
|
||||
b = ((data & 0x00F0) >> 3 ) + ((data & 0x0002) >> 1);
|
||||
g = ((data & 0x0F00) >> 7 ) + ((data & 0x0004) >> 2);
|
||||
r = ((data & 0xF000) >> 11) + ((data & 0x0008) >> 3);
|
||||
palette_set_color_rgb( Machine, offset, pal5bit(r) , pal5bit(g) , pal5bit(b) );
|
||||
}
|
||||
|
||||
/* This game uses 8 bit tiles, so it ignores the color codes and just
|
||||
uses the same 256 colors for every tile */
|
||||
PALETTE_INIT( grdnstrm )
|
||||
{
|
||||
int color, pen;
|
||||
for( color = 0; color < 16; color++ )
|
||||
for( pen = 0; pen < 256; pen++ )
|
||||
colortable[color * 256 + pen + 256*3] = 256*0 + pen;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Tilemaps
|
||||
|
||||
Offset: Bits: Value:
|
||||
|
||||
2.w fedc ---- ---- ---- Color
|
||||
---- ba98 7654 3210 Code
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#define TILES_PER_PAGE_X (0x10)
|
||||
#define TILES_PER_PAGE_Y (0x10)
|
||||
#define PAGES_PER_TMAP_X (0x4)
|
||||
#define PAGES_PER_TMAP_Y (0x4)
|
||||
#define FIREHAWK_PAGES_PER_TMAP_X (0x1)
|
||||
#define FIREHAWK_PAGES_PER_TMAP_Y (0x1)
|
||||
#define TWINACTN_TILES_PER_PAGE_X (0x100)
|
||||
#define TWINACTN_TILES_PER_PAGE_Y (0x10)
|
||||
#define TWINACTN_PAGES_PER_TMAP_X (0x1)
|
||||
#define TWINACTN_PAGES_PER_TMAP_Y (0x1)
|
||||
|
||||
|
||||
static TILEMAP_MAPPER( afega_tilemap_scan_pages )
|
||||
{
|
||||
return (row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * PAGES_PER_TMAP_X +
|
||||
(row % TILES_PER_PAGE_Y) +
|
||||
|
||||
(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
|
||||
(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( twinactn_tilemap_scan_pages )
|
||||
{
|
||||
return (row / TWINACTN_TILES_PER_PAGE_Y) * TWINACTN_TILES_PER_PAGE_X * TWINACTN_TILES_PER_PAGE_Y * TWINACTN_PAGES_PER_TMAP_X +
|
||||
(row % TWINACTN_TILES_PER_PAGE_Y) +
|
||||
|
||||
(col / TWINACTN_TILES_PER_PAGE_X) * TWINACTN_TILES_PER_PAGE_X * TWINACTN_TILES_PER_PAGE_Y +
|
||||
(col % TWINACTN_TILES_PER_PAGE_X) * TWINACTN_TILES_PER_PAGE_Y;
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( firehawk_tilemap_scan_pages )
|
||||
{
|
||||
return (row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * FIREHAWK_PAGES_PER_TMAP_X +
|
||||
(row % TILES_PER_PAGE_Y) +
|
||||
|
||||
(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
|
||||
(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
|
||||
}
|
||||
|
||||
static tilemap *tilemap_0, *tilemap_1;
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_0 )
|
||||
{
|
||||
UINT16 code = afega_vram_0[tile_index];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
code,
|
||||
(code & 0xf000) >> 12,
|
||||
0);
|
||||
}
|
||||
static TILE_GET_INFO( get_tile_info_1 )
|
||||
{
|
||||
UINT16 code = afega_vram_1[tile_index];
|
||||
SET_TILE_INFO(
|
||||
2,
|
||||
code,
|
||||
(code & 0xf000) >> 12,
|
||||
0);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( afega_vram_0_w )
|
||||
{
|
||||
COMBINE_DATA(&afega_vram_0[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_0,offset);
|
||||
}
|
||||
WRITE16_HANDLER( afega_vram_1_w )
|
||||
{
|
||||
COMBINE_DATA(&afega_vram_1[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_1,offset);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
Video Hardware Init
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
VIDEO_START( afega )
|
||||
{
|
||||
tilemap_0 = tilemap_create( get_tile_info_0, afega_tilemap_scan_pages,
|
||||
TILEMAP_TYPE_PEN,
|
||||
16,16,
|
||||
TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
|
||||
|
||||
tilemap_1 = tilemap_create( get_tile_info_1, tilemap_scan_cols,
|
||||
TILEMAP_TYPE_PEN,
|
||||
8,8,
|
||||
32,32);
|
||||
|
||||
tilemap_set_transparent_pen(tilemap_1,0xf);
|
||||
}
|
||||
|
||||
VIDEO_START( twinactn )
|
||||
{
|
||||
tilemap_0 = tilemap_create( get_tile_info_0, twinactn_tilemap_scan_pages,
|
||||
TILEMAP_TYPE_PEN,
|
||||
16,16,
|
||||
TWINACTN_TILES_PER_PAGE_X*TWINACTN_PAGES_PER_TMAP_X,TWINACTN_TILES_PER_PAGE_Y*TWINACTN_PAGES_PER_TMAP_Y);
|
||||
|
||||
tilemap_1 = tilemap_create( get_tile_info_1, tilemap_scan_cols,
|
||||
TILEMAP_TYPE_PEN,
|
||||
8,8,
|
||||
32,32);
|
||||
|
||||
tilemap_set_transparent_pen(tilemap_1,0xf);
|
||||
}
|
||||
|
||||
VIDEO_START( firehawk )
|
||||
{
|
||||
tilemap_0 = tilemap_create( get_tile_info_0, firehawk_tilemap_scan_pages,
|
||||
TILEMAP_TYPE_PEN,
|
||||
16,16,
|
||||
TILES_PER_PAGE_X*FIREHAWK_PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*FIREHAWK_PAGES_PER_TMAP_Y);
|
||||
|
||||
tilemap_1 = tilemap_create( get_tile_info_1, tilemap_scan_cols,
|
||||
TILEMAP_TYPE_PEN,
|
||||
8,8,
|
||||
32,32);
|
||||
|
||||
tilemap_set_transparent_pen(tilemap_1,0xf);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Sprites Drawing
|
||||
|
||||
Offset: Bits: Value:
|
||||
|
||||
0.w fedc ba-- ---- ----
|
||||
---- --9- ---- ---- Flip Y?
|
||||
---- ---8 7654 3---
|
||||
---- --------- -21- Priority?
|
||||
---- ---- ---- ---0 1 = Draw This Sprite
|
||||
|
||||
2.w fedc ba98 ---- ----
|
||||
---- ---- 7654 ---- Number Of Tiles Along Y - 1
|
||||
---- ---- ---- 3210 Number Of Tiles Along X - 1
|
||||
|
||||
4.w
|
||||
|
||||
6.w Code
|
||||
|
||||
8.w fedc ba98 ---- ----
|
||||
---- ---- 7654 3210 X (Signed)
|
||||
|
||||
A.w
|
||||
|
||||
C.w fedc ba98 ---- ----
|
||||
---- ---- 7654 3210 Y (Signed)
|
||||
|
||||
E.w fedc ba98 7654 ----
|
||||
---- ---- ---- 3210 Color
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect, UINT16 attr_mask)
|
||||
{
|
||||
int offs;
|
||||
|
||||
int max_x = machine->screen[0].width;
|
||||
int max_y = machine->screen[0].height;
|
||||
|
||||
for ( offs = 0; offs < spriteram_size/2; offs += 16/2 )
|
||||
{
|
||||
int attr, dim, code, sx, sy, color, flipx, flipy;
|
||||
|
||||
int x, xnum, xstart, xend, xinc;
|
||||
int y, ynum, ystart, yend, yinc;
|
||||
|
||||
attr = spriteram16[offs + 0x0/2];
|
||||
if (!(attr & attr_mask)) continue;
|
||||
dim = spriteram16[offs + 0x2/2];
|
||||
code = spriteram16[offs + 0x6/2];
|
||||
sx = spriteram16[offs + 0x8/2];
|
||||
sy = spriteram16[offs + 0xc/2];
|
||||
color = spriteram16[offs + 0xe/2];
|
||||
|
||||
flipx = attr & 0x000; // ?
|
||||
flipy = attr & 0x000; // ?
|
||||
|
||||
xnum = ((dim >> 0) & 0xf) + 1;
|
||||
ynum = ((dim >> 4) & 0xf) + 1;
|
||||
|
||||
sx = (sx & 0xff) - (sx & 0x100);
|
||||
sy = (sy & 0xff) - (sy & 0x100);
|
||||
|
||||
if (flip_screen_x) { flipx = !flipx; sx = max_x - sx - xnum * 16; }
|
||||
if (flip_screen_y) { flipy = !flipy; sy = max_y - sy - ynum * 16; }
|
||||
|
||||
if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; }
|
||||
else { xstart = 0; xend = xnum; xinc = +1; }
|
||||
|
||||
if (flipy) { ystart = ynum-1; yend = -1; yinc = -1; }
|
||||
else { ystart = 0; yend = ynum; yinc = +1; }
|
||||
|
||||
for (y = ystart; y != yend; y += yinc)
|
||||
{
|
||||
for (x = xstart; x != xend; x += xinc)
|
||||
{
|
||||
drawgfx( bitmap,machine->gfx[0],
|
||||
code++,
|
||||
color,
|
||||
flipx, flipy,
|
||||
sx + x * 16, sy + y * 16,
|
||||
cliprect,TRANSPARENCY_PEN,15 );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
#if 1
|
||||
if (input_code_pressed(KEYCODE_X))
|
||||
{ /* Display some info on each sprite */
|
||||
char buf[10];
|
||||
sprintf(buf, "%X",(spriteram16[offs + 0x0/2]&6)/2);
|
||||
ui_draw_text(buf, sy, sx);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
Screen Drawing
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void video_update(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
|
||||
int dsw_flipscreen, // 1 = Horizontal and vertical screen flip are hardwired to 2 dip switches
|
||||
int xoffset, int yoffset, // tilemap_0 offsets
|
||||
int attr_mask // "sprite active" mask
|
||||
)
|
||||
{
|
||||
int layers_ctrl = -1;
|
||||
|
||||
if (dsw_flipscreen)
|
||||
{
|
||||
|
||||
flip_screen_x_set(~readinputport(2) & 0x0100);
|
||||
flip_screen_y_set(~readinputport(2) & 0x0200);
|
||||
}
|
||||
|
||||
tilemap_set_scrollx(tilemap_0, 0, afega_scroll_0[1] + xoffset);
|
||||
tilemap_set_scrolly(tilemap_0, 0, afega_scroll_0[0] + yoffset);
|
||||
|
||||
tilemap_set_scrollx(tilemap_1, 0, afega_scroll_1[1]);
|
||||
tilemap_set_scrolly(tilemap_1, 0, afega_scroll_1[0]);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
if ( input_code_pressed(KEYCODE_Z) )
|
||||
{ int msk = 0;
|
||||
if (input_code_pressed(KEYCODE_Q)) msk |= 1;
|
||||
if (input_code_pressed(KEYCODE_W)) msk |= 2;
|
||||
if (input_code_pressed(KEYCODE_A)) msk |= 4;
|
||||
if (msk != 0) layers_ctrl &= msk; }
|
||||
#endif
|
||||
|
||||
if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
|
||||
else fillbitmap(bitmap,get_black_pen(machine),cliprect);
|
||||
|
||||
if (layers_ctrl & 4) draw_sprites(machine,bitmap,cliprect, attr_mask);
|
||||
|
||||
if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( afega ) { video_update(machine,bitmap,cliprect, 1, -0x100,+0x000, 0x0001); return 0; }
|
||||
VIDEO_UPDATE( bubl2000 ) { video_update(machine,bitmap,cliprect, 0, -0x100,+0x000, 0x0001); return 0; } // no flipscreen support, I really would confirmation from the schematics
|
||||
VIDEO_UPDATE( redhawkb ) { video_update(machine,bitmap,cliprect, 0, +0x000,+0x100, 0x0001); return 0; }
|
||||
VIDEO_UPDATE( twinactn ) { video_update(machine,bitmap,cliprect, 0, +0x000,+0x000, 0x0100); return 0; }
|
||||
|
||||
VIDEO_UPDATE( firehawk )
|
||||
{
|
||||
tilemap_set_scrolly(tilemap_0, 0, afega_scroll_1[1] + 0x100);
|
||||
tilemap_set_scrollx(tilemap_0, 0, afega_scroll_1[0]);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
|
||||
draw_sprites(machine,bitmap,cliprect,1);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
|
||||
return 0;
|
||||
}
|
@ -1,3 +1,12 @@
|
||||
/* notes...
|
||||
|
||||
drawing sprites in a single pass with pdrawgfx breaks Thunder Dragon 2,
|
||||
which seems to expect the sprite priority values to affect sprite-sprite
|
||||
priority. Thunder Dragon 2 also breaks if you support sprite flipping,
|
||||
the collectable point score / power up names appear flipped..
|
||||
|
||||
*/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
UINT16 *nmk_bgvideoram,*nmk_fgvideoram,*nmk_txvideoram;
|
||||
@ -15,6 +24,7 @@ static UINT8 bioship_scroll[4];
|
||||
|
||||
static tilemap *bg_tilemap,*fg_tilemap,*tx_tilemap;
|
||||
static mame_bitmap *background_bitmap;
|
||||
extern UINT16* nmk16_mainram;
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -92,8 +102,8 @@ VIDEO_START( bioship )
|
||||
{
|
||||
bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
|
||||
tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,32,32);
|
||||
spriteram_old = auto_malloc(spriteram_size);
|
||||
spriteram_old2 = auto_malloc(spriteram_size);
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
background_bitmap = auto_bitmap_alloc(8192,512,machine->screen[0].format);
|
||||
|
||||
tilemap_set_transparent_pen(bg_tilemap,15);
|
||||
@ -101,8 +111,8 @@ VIDEO_START( bioship )
|
||||
bioship_background_bank=0;
|
||||
redraw_bitmap = 1;
|
||||
|
||||
memset(spriteram_old,0,spriteram_size);
|
||||
memset(spriteram_old2,0,spriteram_size);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
videoshift = 0; /* 256x224 screen, no shift */
|
||||
}
|
||||
@ -112,14 +122,14 @@ VIDEO_START( strahl )
|
||||
bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
|
||||
fg_tilemap = tilemap_create(strahl_get_fg_tile_info, bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
|
||||
tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,32,32);
|
||||
spriteram_old = auto_malloc(spriteram_size);
|
||||
spriteram_old2 = auto_malloc(spriteram_size);
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,15);
|
||||
tilemap_set_transparent_pen(tx_tilemap,15);
|
||||
|
||||
memset(spriteram_old,0,spriteram_size);
|
||||
memset(spriteram_old2,0,spriteram_size);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
videoshift = 0; /* 256x224 screen, no shift */
|
||||
background_bitmap = NULL;
|
||||
@ -129,13 +139,13 @@ VIDEO_START( macross )
|
||||
{
|
||||
bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
|
||||
tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,32,32);
|
||||
spriteram_old = auto_malloc(spriteram_size);
|
||||
spriteram_old2 = auto_malloc(spriteram_size);
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
|
||||
tilemap_set_transparent_pen(tx_tilemap,15);
|
||||
|
||||
memset(spriteram_old,0,spriteram_size);
|
||||
memset(spriteram_old2,0,spriteram_size);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
videoshift = 0; /* 256x224 screen, no shift */
|
||||
background_bitmap = NULL;
|
||||
@ -145,14 +155,14 @@ VIDEO_START( gunnail )
|
||||
{
|
||||
bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
|
||||
tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
|
||||
spriteram_old = auto_malloc(spriteram_size);
|
||||
spriteram_old2 = auto_malloc(spriteram_size);
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
|
||||
tilemap_set_transparent_pen(tx_tilemap,15);
|
||||
tilemap_set_scroll_rows(bg_tilemap,512);
|
||||
|
||||
memset(spriteram_old,0,spriteram_size);
|
||||
memset(spriteram_old2,0,spriteram_size);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */
|
||||
/* from the other side of the tilemap (!) */
|
||||
@ -163,13 +173,13 @@ VIDEO_START( macross2 )
|
||||
{
|
||||
bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,1024,128);
|
||||
tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
|
||||
spriteram_old = auto_malloc(spriteram_size);
|
||||
spriteram_old2 = auto_malloc(spriteram_size);
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
|
||||
tilemap_set_transparent_pen(tx_tilemap,15);
|
||||
|
||||
memset(spriteram_old,0,spriteram_size);
|
||||
memset(spriteram_old2,0,spriteram_size);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */
|
||||
/* from the other side of the tilemap (!) */
|
||||
@ -180,13 +190,13 @@ VIDEO_START( tdragon2 )
|
||||
{
|
||||
bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan_td2,TILEMAP_TYPE_PEN,16,16,1024,32);
|
||||
tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
|
||||
spriteram_old = auto_malloc(spriteram_size);
|
||||
spriteram_old2 = auto_malloc(spriteram_size);
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
|
||||
tilemap_set_transparent_pen(tx_tilemap,15);
|
||||
|
||||
memset(spriteram_old,0,spriteram_size);
|
||||
memset(spriteram_old2,0,spriteram_size);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */
|
||||
/* from the other side of the tilemap (!) */
|
||||
@ -196,11 +206,11 @@ VIDEO_START( tdragon2 )
|
||||
VIDEO_START( bjtwin )
|
||||
{
|
||||
bg_tilemap = tilemap_create(bjtwin_get_bg_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
|
||||
spriteram_old = auto_malloc(spriteram_size);
|
||||
spriteram_old2 = auto_malloc(spriteram_size);
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
|
||||
memset(spriteram_old,0,spriteram_size);
|
||||
memset(spriteram_old2,0,spriteram_size);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
videoshift = 64; /* 384x224 screen, leftmost 64 pixels have to be retrieved */
|
||||
/* from the other side of the tilemap (!) */
|
||||
@ -410,7 +420,7 @@ WRITE16_HANDLER( gunnail_scrolly_w )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
extern int is_blkheart;
|
||||
|
||||
|
||||
// manybloc uses extra flip bits on the sprites, but these break other games
|
||||
|
||||
@ -418,9 +428,9 @@ static void nmk16_draw_sprites(running_machine *machine, mame_bitmap *bitmap, co
|
||||
{
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < spriteram_size/2;offs += 8)
|
||||
for (offs = 0;offs < 0x1000/2;offs += 8)
|
||||
{
|
||||
if ((spriteram_old2[offs] & 0x0001) || (spriteram_old2[offs] && is_blkheart))
|
||||
if ((spriteram_old2[offs] & 0x0001))
|
||||
{
|
||||
int sx = (spriteram_old2[offs+4] & 0x1ff) + videoshift;
|
||||
int sy = (spriteram_old2[offs+6] & 0x1ff);
|
||||
@ -465,83 +475,23 @@ static void nmk16_draw_sprites(running_machine *machine, mame_bitmap *bitmap, co
|
||||
}
|
||||
}
|
||||
|
||||
/* sprites have flipping and are not delayed 2 frames */
|
||||
static void manybloc_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
|
||||
static void nmk16_draw_sprites_flipsupported(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
|
||||
{
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < spriteram_size/2;offs += 8)
|
||||
for (offs = 0;offs < 0x1000/2;offs += 8)
|
||||
{
|
||||
if ((spriteram16[offs] & 0x0001) || (spriteram16[offs] && is_blkheart))
|
||||
if (spriteram_old2[offs] & 0x0001)
|
||||
{
|
||||
int sx = (spriteram16[offs+4] & 0x1ff) + videoshift;
|
||||
int sy = (spriteram16[offs+6] & 0x1ff);
|
||||
int code = spriteram16[offs+3];
|
||||
int color = spriteram16[offs+7];
|
||||
int w = (spriteram16[offs+1] & 0x0f);
|
||||
int h = ((spriteram16[offs+1] & 0xf0) >> 4);
|
||||
int pri = (spriteram16[offs] & 0xc0) >> 6;
|
||||
/* these would break some of the nmk games ... */
|
||||
int flipy= ((spriteram16[offs+1] & 0x0200) >> 9);
|
||||
int flipx = ((spriteram16[offs+1] & 0x0100) >> 8);
|
||||
|
||||
int xx,yy,x;
|
||||
int delta = 16;
|
||||
|
||||
if(pri != priority)
|
||||
continue;
|
||||
|
||||
flipx ^= flip_screen;
|
||||
flipy ^= flip_screen;
|
||||
|
||||
if (flip_screen)
|
||||
{
|
||||
sx = 368 - sx;
|
||||
sy = 240 - sy;
|
||||
delta = -16;
|
||||
}
|
||||
|
||||
yy = h;
|
||||
do
|
||||
{
|
||||
x = sx;
|
||||
xx = w;
|
||||
do
|
||||
{
|
||||
drawgfx(bitmap,machine->gfx[2],
|
||||
code,
|
||||
color,
|
||||
flipx, flipy,
|
||||
((x + 16) & 0x1ff) - 16,sy & 0x1ff,
|
||||
cliprect,TRANSPARENCY_PEN,15);
|
||||
|
||||
code++;
|
||||
x += delta;
|
||||
} while (--xx >= 0);
|
||||
|
||||
sy += delta;
|
||||
} while (--yy >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void tharrier_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
|
||||
{
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < spriteram_size/2;offs += 8)
|
||||
{
|
||||
if ((spriteram16[offs] & 0x0001) || (spriteram16[offs] && is_blkheart))
|
||||
{
|
||||
int sx = (spriteram16[offs+4] & 0x1ff) + videoshift;
|
||||
int sy = (spriteram16[offs+6] & 0x1ff);
|
||||
int code = spriteram16[offs+3];
|
||||
int color = spriteram16[offs+7];
|
||||
int w = (spriteram16[offs+1] & 0x0f);
|
||||
int h = ((spriteram16[offs+1] & 0xf0) >> 4);
|
||||
int pri = (spriteram16[offs] & 0xc0) >> 6;
|
||||
int flipy= ((spriteram16[offs+1] & 0x0200) >> 9);
|
||||
int flipx = ((spriteram16[offs+1] & 0x0100) >> 8);
|
||||
int sx = (spriteram_old2[offs+4] & 0x1ff) + videoshift;
|
||||
int sy = (spriteram_old2[offs+6] & 0x1ff);
|
||||
int code = spriteram_old2[offs+3];
|
||||
int color = spriteram_old2[offs+7];
|
||||
int w = (spriteram_old2[offs+1] & 0x0f);
|
||||
int h = ((spriteram_old2[offs+1] & 0xf0) >> 4);
|
||||
int pri = (spriteram_old2[offs] & 0xc0) >> 6;
|
||||
int flipy= ((spriteram_old2[offs+1] & 0x0200) >> 9);
|
||||
int flipx = ((spriteram_old2[offs+1] & 0x0100) >> 8);
|
||||
|
||||
int xx,yy,x;
|
||||
int delta = 16;
|
||||
@ -588,22 +538,22 @@ static void tharrier_draw_sprites(running_machine *machine, mame_bitmap *bitmap,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( macross )
|
||||
{
|
||||
tilemap_set_scrollx(tx_tilemap,0,-videoshift);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern UINT16 *nmk16_mcu_shared_ram;
|
||||
extern UINT16 *nmk16_mcu_work_ram;
|
||||
|
||||
/*coin setting MCU simulation*/
|
||||
static void mcu_run(UINT8 dsw_setting)
|
||||
{
|
||||
@ -627,7 +577,7 @@ static void mcu_run(UINT8 dsw_setting)
|
||||
old_value = readinputport(0);
|
||||
|
||||
if(dsw_a == 0 || dsw_b == 0)
|
||||
nmk16_mcu_work_ram[0x000/2]|=0x4000; //free_play
|
||||
nmk16_mainram[0x9000/2]|=0x4000; //free_play
|
||||
|
||||
if(read_coin != old_value)
|
||||
{
|
||||
@ -635,15 +585,15 @@ static void mcu_run(UINT8 dsw_setting)
|
||||
{
|
||||
switch(dsw_a & 7)
|
||||
{
|
||||
case 1: nmk16_mcu_shared_ram[0xf00/2]+=4; break;
|
||||
case 2: nmk16_mcu_shared_ram[0xf00/2]+=3; break;
|
||||
case 3: nmk16_mcu_shared_ram[0xf00/2]+=2; break;
|
||||
case 1: nmk16_mainram[0xef00/2]+=4; break;
|
||||
case 2: nmk16_mainram[0xef00/2]+=3; break;
|
||||
case 3: nmk16_mainram[0xef00/2]+=2; break;
|
||||
case 4:
|
||||
coina++;
|
||||
if(coina >= 4)
|
||||
{
|
||||
coina = 0;
|
||||
nmk16_mcu_shared_ram[0xf00/2]++;
|
||||
nmk16_mainram[0xef00/2]++;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
@ -651,7 +601,7 @@ static void mcu_run(UINT8 dsw_setting)
|
||||
if(coina >= 3)
|
||||
{
|
||||
coina = 0;
|
||||
nmk16_mcu_shared_ram[0xf00/2]++;
|
||||
nmk16_mainram[0xef00/2]++;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@ -659,10 +609,10 @@ static void mcu_run(UINT8 dsw_setting)
|
||||
if(coina >= 2)
|
||||
{
|
||||
coina = 0;
|
||||
nmk16_mcu_shared_ram[0xf00/2]++;
|
||||
nmk16_mainram[0xef00/2]++;
|
||||
}
|
||||
break;
|
||||
case 7: nmk16_mcu_shared_ram[0xf00/2]++; break;
|
||||
case 7: nmk16_mainram[0xef00/2]++; break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,15 +620,15 @@ static void mcu_run(UINT8 dsw_setting)
|
||||
{
|
||||
switch(dsw_b & 7)
|
||||
{
|
||||
case 1: nmk16_mcu_shared_ram[0xf00/2]+=4; break;
|
||||
case 2: nmk16_mcu_shared_ram[0xf00/2]+=3; break;
|
||||
case 3: nmk16_mcu_shared_ram[0xf00/2]+=2; break;
|
||||
case 1: nmk16_mainram[0xef00/2]+=4; break;
|
||||
case 2: nmk16_mainram[0xef00/2]+=3; break;
|
||||
case 3: nmk16_mainram[0xef00/2]+=2; break;
|
||||
case 4:
|
||||
coinb++;
|
||||
if(coinb >= 4)
|
||||
{
|
||||
coinb = 0;
|
||||
nmk16_mcu_shared_ram[0xf00/2]++;
|
||||
nmk16_mainram[0xef00/2]++;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
@ -686,7 +636,7 @@ static void mcu_run(UINT8 dsw_setting)
|
||||
if(coinb >= 3)
|
||||
{
|
||||
coinb = 0;
|
||||
nmk16_mcu_shared_ram[0xf00/2]++;
|
||||
nmk16_mainram[0xef00/2]++;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@ -694,37 +644,37 @@ static void mcu_run(UINT8 dsw_setting)
|
||||
if(coinb >= 2)
|
||||
{
|
||||
coinb = 0;
|
||||
nmk16_mcu_shared_ram[0xf00/2]++;
|
||||
nmk16_mainram[0xef00/2]++;
|
||||
}
|
||||
break;
|
||||
case 7: nmk16_mcu_shared_ram[0xf00/2]++; break;
|
||||
case 7: nmk16_mainram[0xef00/2]++; break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!(readinputport(0) & 0x04))//SERVICE_COIN
|
||||
nmk16_mcu_shared_ram[0xf00/2]++;
|
||||
nmk16_mainram[0xef00/2]++;
|
||||
|
||||
if(nmk16_mcu_shared_ram[0xf00/2] >= 1 && (nmk16_mcu_work_ram[0x000/2] & 0x8000))/*enable start button*/
|
||||
if(nmk16_mainram[0xef00/2] >= 1 && (nmk16_mainram[0x9000/2] & 0x8000))/*enable start button*/
|
||||
{
|
||||
/*Start a 1-player game,but don't decrement if the player 1 is already playing*/
|
||||
if((!(readinputport(0) & 0x08)) /*START1*/
|
||||
&& (!(nmk16_mcu_work_ram[0x000/2] & 0x0200)) /*PLAYER-1 playing*/
|
||||
&& (!(nmk16_mainram[0x9000/2] & 0x0200)) /*PLAYER-1 playing*/
|
||||
)
|
||||
nmk16_mcu_shared_ram[0xf00/2]--;
|
||||
nmk16_mainram[0xef00/2]--;
|
||||
|
||||
/*Start a 2-players game,but don't decrement if the player 2 is already playing*/
|
||||
if((!(readinputport(0) & 0x10))
|
||||
&& (!(nmk16_mcu_work_ram[0x000/2] & 0x0100))
|
||||
&& (!(nmk16_mainram[0x9000/2] & 0x0100))
|
||||
)
|
||||
{
|
||||
if(!(nmk16_mcu_work_ram[0x000/2] & 0x0200) && nmk16_mcu_shared_ram[0xf00/2] >= 2)
|
||||
nmk16_mcu_shared_ram[0xf00/2]-=2;
|
||||
if(!(nmk16_mainram[0x9000/2] & 0x0200) && nmk16_mainram[0xef00/2] >= 2)
|
||||
nmk16_mainram[0xef00/2]-=2;
|
||||
else
|
||||
nmk16_mcu_shared_ram[0xf00/2]--;
|
||||
nmk16_mainram[0xef00/2]--;
|
||||
}
|
||||
}
|
||||
|
||||
if(nmk16_mcu_shared_ram[0xf00/2] > 99) nmk16_mcu_shared_ram[0xf00/2] = 99;
|
||||
if(nmk16_mainram[0xef00/2] > 99) nmk16_mainram[0xef00/2] = 99;
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,10 +685,12 @@ VIDEO_UPDATE( tdragon )
|
||||
tilemap_set_scrollx(tx_tilemap,0,-videoshift);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
@ -750,10 +702,12 @@ VIDEO_UPDATE( hachamf )
|
||||
tilemap_set_scrollx(tx_tilemap,0,-videoshift);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
@ -763,23 +717,30 @@ VIDEO_UPDATE( manybloc )
|
||||
tilemap_set_scrollx(tx_tilemap,0,-videoshift);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
manybloc_draw_sprites(machine, bitmap,cliprect,3);
|
||||
manybloc_draw_sprites(machine, bitmap,cliprect,2);
|
||||
manybloc_draw_sprites(machine, bitmap,cliprect,1);
|
||||
manybloc_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( tharrier )
|
||||
{
|
||||
/* I think the protection device probably copies this to the regs... */
|
||||
UINT16 tharrier_scroll = nmk16_mainram[0x9f00/2];
|
||||
|
||||
tilemap_set_scrollx(tx_tilemap,0,-videoshift);
|
||||
tilemap_set_scrollx(bg_tilemap,0,tharrier_scroll);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
tharrier_draw_sprites(machine, bitmap,cliprect,3);
|
||||
tharrier_draw_sprites(machine, bitmap,cliprect,2);
|
||||
tharrier_draw_sprites(machine, bitmap,cliprect,1);
|
||||
tharrier_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
@ -842,10 +803,12 @@ VIDEO_UPDATE( bioship )
|
||||
|
||||
copyscrollbitmap(bitmap,background_bitmap,1,&scrollx,1,&scrolly,cliprect,TRANSPARENCY_NONE,0);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
@ -856,10 +819,12 @@ VIDEO_UPDATE( strahl )
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
|
||||
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
@ -869,16 +834,251 @@ VIDEO_UPDATE( bjtwin )
|
||||
tilemap_set_scrollx(bg_tilemap,0,-videoshift);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites(machine, bitmap,cliprect,0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIDEO_EOF( nmk )
|
||||
{
|
||||
/* looks like sprites are *two* frames ahead */
|
||||
memcpy(spriteram_old2,spriteram_old,spriteram_size);
|
||||
memcpy(spriteram_old,spriteram16,spriteram_size);
|
||||
/* sprites are DMA'd from Main RAM to a private buffer automatically
|
||||
(or at least this is how I interpret the datasheet) */
|
||||
|
||||
/* -- I actually see little evidence to support this, sprite lag
|
||||
in some games should be checked on real boards */
|
||||
|
||||
// memcpy(spriteram_old2,spriteram_old,0x1000);
|
||||
memcpy(spriteram_old2,nmk16_mainram+0x8000/2,0x1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Variables needed by drivers: */
|
||||
|
||||
UINT16 *afega_vram_0, *afega_scroll_0;
|
||||
UINT16 *afega_vram_1, *afega_scroll_1;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
Palette - RRRRGGGGBBBB????
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
WRITE16_HANDLER( afega_palette_w )
|
||||
{
|
||||
int r,g,b;
|
||||
data = COMBINE_DATA(&paletteram16[offset]);
|
||||
b = ((data & 0x00F0) >> 3 ) + ((data & 0x0002) >> 1);
|
||||
g = ((data & 0x0F00) >> 7 ) + ((data & 0x0004) >> 2);
|
||||
r = ((data & 0xF000) >> 11) + ((data & 0x0008) >> 3);
|
||||
palette_set_color_rgb( Machine, offset, pal5bit(r) , pal5bit(g) , pal5bit(b) );
|
||||
}
|
||||
|
||||
/* This game uses 8 bit tiles, so it ignores the color codes and just
|
||||
uses the same 256 colors for every tile */
|
||||
PALETTE_INIT( grdnstrm )
|
||||
{
|
||||
int color, pen;
|
||||
for( color = 0; color < 16; color++ )
|
||||
for( pen = 0; pen < 256; pen++ )
|
||||
colortable[color * 256 + pen + 256*3] = 256*0 + pen;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Tilemaps
|
||||
|
||||
Offset: Bits: Value:
|
||||
|
||||
2.w fedc ---- ---- ---- Color
|
||||
---- ba98 7654 3210 Code
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#define TILES_PER_PAGE_X (0x10)
|
||||
#define TILES_PER_PAGE_Y (0x10)
|
||||
#define PAGES_PER_TMAP_X (0x4)
|
||||
#define PAGES_PER_TMAP_Y (0x4)
|
||||
#define FIREHAWK_PAGES_PER_TMAP_X (0x1)
|
||||
#define FIREHAWK_PAGES_PER_TMAP_Y (0x1)
|
||||
#define TWINACTN_TILES_PER_PAGE_X (0x100)
|
||||
#define TWINACTN_TILES_PER_PAGE_Y (0x10)
|
||||
#define TWINACTN_PAGES_PER_TMAP_X (0x1)
|
||||
#define TWINACTN_PAGES_PER_TMAP_Y (0x1)
|
||||
|
||||
|
||||
static TILEMAP_MAPPER( afega_tilemap_scan_pages )
|
||||
{
|
||||
return (row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * PAGES_PER_TMAP_X +
|
||||
(row % TILES_PER_PAGE_Y) +
|
||||
|
||||
(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
|
||||
(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( firehawk_tilemap_scan_pages )
|
||||
{
|
||||
return (row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * FIREHAWK_PAGES_PER_TMAP_X +
|
||||
(row % TILES_PER_PAGE_Y) +
|
||||
|
||||
(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
|
||||
(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
|
||||
}
|
||||
|
||||
static tilemap *tilemap_0, *tilemap_1;
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_0 )
|
||||
{
|
||||
UINT16 code = afega_vram_0[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
code,
|
||||
(code & 0xf000) >> 12,
|
||||
0);
|
||||
}
|
||||
static TILE_GET_INFO( get_tile_info_1 )
|
||||
{
|
||||
UINT16 code = afega_vram_1[tile_index];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
code,
|
||||
(code & 0xf000) >> 12,
|
||||
0);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( afega_vram_0_w )
|
||||
{
|
||||
COMBINE_DATA(&afega_vram_0[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_0,offset);
|
||||
}
|
||||
WRITE16_HANDLER( afega_vram_1_w )
|
||||
{
|
||||
COMBINE_DATA(&afega_vram_1[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_1,offset);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
Video Hardware Init
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
VIDEO_START( afega )
|
||||
{
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
|
||||
tilemap_0 = tilemap_create( get_tile_info_0, afega_tilemap_scan_pages,
|
||||
TILEMAP_TYPE_PEN,
|
||||
16,16,
|
||||
TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
|
||||
|
||||
tilemap_1 = tilemap_create( get_tile_info_1, tilemap_scan_cols,
|
||||
TILEMAP_TYPE_PEN,
|
||||
8,8,
|
||||
32,32);
|
||||
|
||||
tilemap_set_transparent_pen(tilemap_1,0xf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
VIDEO_START( firehawk )
|
||||
{
|
||||
spriteram_old = auto_malloc(0x1000);
|
||||
spriteram_old2 = auto_malloc(0x1000);
|
||||
memset(spriteram_old,0,0x1000);
|
||||
memset(spriteram_old2,0,0x1000);
|
||||
|
||||
|
||||
tilemap_0 = tilemap_create( get_tile_info_0, firehawk_tilemap_scan_pages,
|
||||
TILEMAP_TYPE_PEN,
|
||||
16,16,
|
||||
TILES_PER_PAGE_X*FIREHAWK_PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*FIREHAWK_PAGES_PER_TMAP_Y);
|
||||
|
||||
tilemap_1 = tilemap_create( get_tile_info_1, tilemap_scan_cols,
|
||||
TILEMAP_TYPE_PEN,
|
||||
8,8,
|
||||
32,32);
|
||||
|
||||
tilemap_set_transparent_pen(tilemap_1,0xf);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
Screen Drawing
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void video_update(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
|
||||
int dsw_flipscreen, // 1 = Horizontal and vertical screen flip are hardwired to 2 dip switches
|
||||
int xoffset, int yoffset, // tilemap_0 offsets
|
||||
int attr_mask // "sprite active" mask
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (dsw_flipscreen)
|
||||
{
|
||||
|
||||
flip_screen_x_set(~readinputport(2) & 0x0100);
|
||||
flip_screen_y_set(~readinputport(2) & 0x0200);
|
||||
}
|
||||
|
||||
tilemap_set_scrollx(tilemap_0, 0, afega_scroll_0[1] + xoffset);
|
||||
tilemap_set_scrolly(tilemap_0, 0, afega_scroll_0[0] + yoffset);
|
||||
|
||||
tilemap_set_scrollx(tilemap_1, 0, afega_scroll_1[1]);
|
||||
tilemap_set_scrolly(tilemap_1, 0, afega_scroll_1[0]);
|
||||
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
|
||||
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( afega ) { video_update(machine,bitmap,cliprect, 1, -0x100,+0x000, 0x0001); return 0; }
|
||||
VIDEO_UPDATE( bubl2000 ) { video_update(machine,bitmap,cliprect, 0, -0x100,+0x000, 0x0001); return 0; } // no flipscreen support, I really would confirmation from the schematics
|
||||
VIDEO_UPDATE( redhawkb ) { video_update(machine,bitmap,cliprect, 0, +0x000,+0x100, 0x0001); return 0; }
|
||||
|
||||
VIDEO_UPDATE( firehawk )
|
||||
{
|
||||
|
||||
|
||||
tilemap_set_scrolly(tilemap_0, 0, afega_scroll_1[1] + 0x100);
|
||||
tilemap_set_scrollx(tilemap_0, 0, afega_scroll_1[0]);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
|
||||
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
|
||||
nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user