mirror of
https://github.com/holub/mame
synced 2025-04-28 03:02:52 +03:00
suprnova video changes. priorities should be correct from start to end in cyvern now.. still not perfect tho.
This commit is contained in:
parent
42fe8ba627
commit
02b0e17939
@ -956,13 +956,13 @@ static MACHINE_DRIVER_START(skns)
|
||||
MDRV_MACHINE_RESET(skns)
|
||||
MDRV_NVRAM_HANDLER(generic_1fill)
|
||||
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
|
||||
|
||||
MDRV_SCREEN_ADD("main", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
MDRV_SCREEN_REFRESH_RATE(59.5971) // measured by Guru
|
||||
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
|
||||
MDRV_SCREEN_SIZE(64*16,64*16)
|
||||
MDRV_SCREEN_SIZE(320,240)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0,319,0,239)
|
||||
|
||||
MDRV_PALETTE_LENGTH(32768)
|
||||
|
@ -19,11 +19,11 @@ Tilemap flip flags were reversed
|
||||
|
||||
static bitmap_t *sprite_bitmap;
|
||||
|
||||
static bitmap_t *tilemap_bitmap_a;
|
||||
static bitmap_t *tilemap_bitmapflags_a;
|
||||
static bitmap_t *tilemap_bitmap_lower;
|
||||
static bitmap_t *tilemap_bitmapflags_lower;
|
||||
|
||||
static bitmap_t *tilemap_bitmap_b;
|
||||
static bitmap_t *tilemap_bitmapflags_b;
|
||||
static bitmap_t *tilemap_bitmap_higher;
|
||||
static bitmap_t *tilemap_bitmapflags_higher;
|
||||
|
||||
|
||||
/* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */
|
||||
@ -527,6 +527,9 @@ void skns_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectang
|
||||
|
||||
/* sprite ram start / end is not really fixed registers change it */
|
||||
|
||||
//printf ("addr %08x\n", (skns_spc_regs[0x14/4]));
|
||||
|
||||
|
||||
UINT32 *source = spriteram32;
|
||||
UINT32 *finish = source + spriteram_size/4;
|
||||
|
||||
@ -684,11 +687,21 @@ void skns_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectang
|
||||
|
||||
endromoffs = skns_rle_decode ( romoffset, size );
|
||||
|
||||
// in Cyvern
|
||||
|
||||
// train in tunnel pri = 0x00
|
||||
// nothing? = 0x01
|
||||
// players etc. pri = 0x02
|
||||
// pickups etc. pri = 0x03
|
||||
|
||||
// PriTest
|
||||
// if(!( (keyboard_pressed(KEYCODE_Q)&&(pri==0)) || (keyboard_pressed(KEYCODE_W)&&(pri==1)) || (keyboard_pressed(KEYCODE_E)&&(pri==2)) || (keyboard_pressed(KEYCODE_D)&&(pri==3)) ))
|
||||
// if( !(keyboard_pressed(KEYCODE_Q) && ((source[0] & 0x00800000)>>24)) )
|
||||
|
||||
|
||||
|
||||
{
|
||||
int NewColour = colour*256;
|
||||
int NewColour = (colour<<8) | (pri << 14);
|
||||
|
||||
if(zoomx || zoomy)
|
||||
{
|
||||
@ -806,7 +819,7 @@ static TILE_GET_INFO( get_tilemap_A_tile_info )
|
||||
flags);
|
||||
tileinfo->category = pri;
|
||||
|
||||
//if (pri) popmessage("pri!!\n");
|
||||
//if (pri) popmessage("pri A!! %02x\n", pri);
|
||||
}
|
||||
|
||||
WRITE32_HANDLER ( skns_tilemapA_w )
|
||||
@ -833,7 +846,7 @@ static TILE_GET_INFO( get_tilemap_B_tile_info )
|
||||
flags);
|
||||
tileinfo->category = pri;
|
||||
|
||||
//if (pri) popmessage("pri!!\n");
|
||||
//if (pri) popmessage("pri B!! %02x\n", pri); // 02 on cyvern
|
||||
}
|
||||
|
||||
WRITE32_HANDLER ( skns_tilemapB_w )
|
||||
@ -872,53 +885,17 @@ VIDEO_START(skns)
|
||||
|
||||
sprite_bitmap = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16);
|
||||
|
||||
tilemap_bitmap_a = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16);
|
||||
tilemap_bitmapflags_a = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED8);
|
||||
tilemap_bitmap_lower = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16);
|
||||
tilemap_bitmapflags_lower = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED8);
|
||||
|
||||
tilemap_bitmap_b = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED16);
|
||||
tilemap_bitmapflags_b = auto_bitmap_alloc(1024,1024,BITMAP_FORMAT_INDEXED8);
|
||||
tilemap_bitmap_higher = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED16);
|
||||
tilemap_bitmapflags_higher = auto_bitmap_alloc(320,240,BITMAP_FORMAT_INDEXED8);
|
||||
|
||||
machine->gfx[2]->color_granularity=256;
|
||||
machine->gfx[3]->color_granularity=256;
|
||||
}
|
||||
|
||||
void tilemap_copy_bitmap(bitmap_t *bitmap, bitmap_t* tilemap_bitmap, bitmap_t* tilemap_bitmapflags)
|
||||
{
|
||||
int x,y;
|
||||
UINT8* srcflags;
|
||||
UINT16* src;
|
||||
UINT32* dst;
|
||||
int pri;
|
||||
const pen_t *clut = &Machine->pens[0];
|
||||
|
||||
|
||||
for (y=0;y<240;y++)
|
||||
{
|
||||
src = BITMAP_ADDR16(tilemap_bitmap, y, 0);
|
||||
srcflags = BITMAP_ADDR8(tilemap_bitmapflags, y, 0);
|
||||
dst = BITMAP_ADDR32(bitmap, y, 0);
|
||||
|
||||
|
||||
for (x=0;x<320;x++)
|
||||
{
|
||||
UINT16 pendata = src[x]&0x7fff;
|
||||
//UINT16 paldata = skns_palette_ram[pendata];
|
||||
|
||||
pri = (srcflags[x] & 0x0f);
|
||||
//if (pri!=0)
|
||||
{
|
||||
if (pendata & 0xff)
|
||||
{
|
||||
UINT32 coldat = clut[pendata];
|
||||
dst[x] = coldat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void supernova_draw_a( bitmap_t *bitmap, const rectangle *cliprect, int tran )
|
||||
static void supernova_draw_a( bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran )
|
||||
{
|
||||
int enable_a = (skns_v3_regs[0x10/4] >> 0) & 0x0001;
|
||||
UINT32 startx,starty;
|
||||
@ -935,14 +912,13 @@ static void supernova_draw_a( bitmap_t *bitmap, const rectangle *cliprect, int t
|
||||
incxx = skns_v3_regs[0x24/4]; // was yy, changed for sarukani
|
||||
|
||||
columnscroll = (skns_v3_regs[0x0c/4] >> 1) & 0x0001;
|
||||
fillbitmap(tilemap_bitmap_a, 0, NULL);
|
||||
fillbitmap(tilemap_bitmapflags_a, 0, NULL);
|
||||
suprnova_draw_roz(tilemap_bitmap_a,tilemap_bitmapflags_a,cliprect, skns_tilemap_A, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, 1, columnscroll, &skns_v3slc_ram[0]);
|
||||
tilemap_copy_bitmap(bitmap, tilemap_bitmap_a, tilemap_bitmapflags_a);
|
||||
|
||||
suprnova_draw_roz(bitmap,bitmap_flags,cliprect, skns_tilemap_A, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, 1, columnscroll, &skns_v3slc_ram[0]);
|
||||
//tilemap_copy_bitmap(bitmap, tilemap_bitmap_lower, tilemap_bitmapflags_lower);
|
||||
}
|
||||
}
|
||||
|
||||
static void supernova_draw_b( bitmap_t *bitmap, const rectangle *cliprect, int tran )
|
||||
static void supernova_draw_b( bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran )
|
||||
{
|
||||
int enable_b = (skns_v3_regs[0x34/4] >> 0) & 0x0001;
|
||||
UINT32 startx,starty;
|
||||
@ -958,10 +934,7 @@ static void supernova_draw_b( bitmap_t *bitmap, const rectangle *cliprect, int t
|
||||
incxy = skns_v3_regs[0x4c/4];
|
||||
incxx = skns_v3_regs[0x48/4];
|
||||
columnscroll = (skns_v3_regs[0x0c/4] >> 9) & 0x0001; // selects column scroll or rowscroll
|
||||
fillbitmap(tilemap_bitmap_b, 0, NULL);
|
||||
fillbitmap(tilemap_bitmapflags_b, 0, NULL);
|
||||
suprnova_draw_roz(tilemap_bitmap_b,tilemap_bitmapflags_b, cliprect, skns_tilemap_B, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, 1, columnscroll, &skns_v3slc_ram[0x1000/4]);
|
||||
tilemap_copy_bitmap(bitmap, tilemap_bitmap_b, tilemap_bitmapflags_b);
|
||||
suprnova_draw_roz(bitmap,bitmap_flags, cliprect, skns_tilemap_B, startx << 8,starty << 8, incxx << 8,incxy << 8,incyx << 8,incyy << 8, 1, columnscroll, &skns_v3slc_ram[0x1000/4]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1029,100 +1002,178 @@ VIDEO_UPDATE(skns)
|
||||
}
|
||||
|
||||
fillbitmap(bitmap, get_black_pen(screen->machine), cliprect);
|
||||
fillbitmap(tilemap_bitmap_lower, 0, NULL);
|
||||
fillbitmap(tilemap_bitmapflags_lower, 0, NULL);
|
||||
fillbitmap(tilemap_bitmap_higher, 0, NULL);
|
||||
fillbitmap(tilemap_bitmapflags_higher, 0, NULL);
|
||||
|
||||
{
|
||||
int supernova_pri_a;
|
||||
int supernova_pri_b;
|
||||
int tran = 0;
|
||||
|
||||
supernova_pri_a = skns_v3_regs[0x10/4] & 0x0002;
|
||||
supernova_pri_b = skns_v3_regs[0x34/4] & 0x0002;
|
||||
supernova_pri_a = (skns_v3_regs[0x10/4] & 0x0002)>>1;
|
||||
supernova_pri_b = (skns_v3_regs[0x34/4] & 0x0002)>>1;
|
||||
|
||||
//popmessage("pri %d %d\n", supernova_pri_a, supernova_pri_b);
|
||||
|
||||
/*if (!supernova_pri_b) { */
|
||||
supernova_draw_b(tilemap_bitmap_lower, tilemap_bitmapflags_lower, cliprect,tran);// tran = 1;
|
||||
supernova_draw_a(tilemap_bitmap_higher,tilemap_bitmapflags_higher,cliprect,tran);// tran = 1;
|
||||
|
||||
/* needed until we have the per tile priorities sorted out */
|
||||
if (!strcmp(screen->machine->gamedrv->name,"vblokbrk") ||
|
||||
!strcmp(screen->machine->gamedrv->name,"sarukani") ||
|
||||
!strcmp(screen->machine->gamedrv->name,"sengekis") ||
|
||||
!strcmp(screen->machine->gamedrv->name,"sengekij"))
|
||||
{
|
||||
supernova_pri_b = 0;
|
||||
supernova_pri_a = 1;
|
||||
}
|
||||
|
||||
|
||||
if (!supernova_pri_a) { supernova_draw_a(bitmap,cliprect,tran); tran = 1;}
|
||||
if (!supernova_pri_b) { supernova_draw_b(bitmap,cliprect,tran); tran = 1;}
|
||||
if (supernova_pri_a) { supernova_draw_a(bitmap,cliprect,tran); tran = 1;}
|
||||
if (supernova_pri_b) { supernova_draw_b(bitmap,cliprect,tran); tran = 1;}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
int x,y;
|
||||
const pen_t *paldata = screen->machine->pens;
|
||||
|
||||
|
||||
|
||||
for (y=0;y<240;y++)
|
||||
{
|
||||
UINT16* src;
|
||||
int x,y;
|
||||
UINT8* srcflags, *src2flags;
|
||||
UINT16* src, *src2, *src3;
|
||||
UINT32* dst;
|
||||
UINT16 pri, pri2, pri3;
|
||||
UINT16 bgpri;
|
||||
const pen_t *clut = &Machine->pens[0];
|
||||
// int drawpri;
|
||||
|
||||
src = BITMAP_ADDR16(sprite_bitmap,y,0);
|
||||
dst = BITMAP_ADDR32(bitmap,y,0);
|
||||
|
||||
for (x=0;x<320;x++)
|
||||
for (y=0;y<240;y++)
|
||||
{
|
||||
UINT16 pen = src[x]&0x7fff;
|
||||
UINT16 palvalue = skns_palette_ram[pen];
|
||||
src = BITMAP_ADDR16(tilemap_bitmap_lower, y, 0);
|
||||
srcflags = BITMAP_ADDR8(tilemap_bitmapflags_lower, y, 0);
|
||||
|
||||
if (palvalue&0x8000)
|
||||
src2 = BITMAP_ADDR16(tilemap_bitmap_higher, y, 0);
|
||||
src2flags = BITMAP_ADDR8(tilemap_bitmapflags_higher, y, 0);
|
||||
|
||||
src3 = BITMAP_ADDR16(sprite_bitmap, y, 0);
|
||||
|
||||
dst = BITMAP_ADDR32(bitmap, y, 0);
|
||||
|
||||
|
||||
for (x=0;x<320;x++)
|
||||
{
|
||||
UINT32 srccolour = dst[x];
|
||||
UINT32 dstcolour = paldata[pen];
|
||||
UINT16 pendata = src[x]&0x7fff;
|
||||
UINT16 pendata2 = src2[x]&0x7fff;
|
||||
UINT16 bgpendata;
|
||||
UINT16 pendata3 = src3[x]&0x3fff;
|
||||
|
||||
int r,g,b;
|
||||
int r2,g2,b2;
|
||||
UINT32 coldat;
|
||||
|
||||
r = (srccolour & 0x000000ff)>> 0;
|
||||
g = (srccolour & 0x0000ff00)>> 8;
|
||||
b = (srccolour & 0x00ff0000)>> 16;
|
||||
pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b);
|
||||
pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a);
|
||||
pri3 = ((src3[x]&0xc000)>>12)+3;
|
||||
|
||||
r2 = (dstcolour & 0x000000ff)>> 0;
|
||||
g2 = (dstcolour & 0x0000ff00)>> 8;
|
||||
b2 = (dstcolour & 0x00ff0000)>> 16;
|
||||
// work out which layers bg pixel has the higher priority
|
||||
// note, can the bg layers be blended?? sarukani uses an alpha pen for
|
||||
// some of them.. and registers indicate it might be possible..
|
||||
|
||||
r2 = (r2 * bright_spc_r_trans) >> 8;
|
||||
g2 = (g2 * bright_spc_g_trans) >> 8;
|
||||
b2 = (b2 * bright_spc_b_trans) >> 8;
|
||||
// this priority mixing is almost certainly still incorrect
|
||||
// bg colour / prioirty handling is now wrong
|
||||
|
||||
r = (r+r2);
|
||||
if (r>255) r = 255;
|
||||
if (pri<=pri2) // <= is good for last level of cyvern.. < seem better for galpanis kaneko logo
|
||||
{
|
||||
if (pendata2&0xff)
|
||||
{
|
||||
bgpendata = pendata2&0x7fff;
|
||||
bgpri = pri2;
|
||||
}
|
||||
else if (pendata&0xff)
|
||||
{
|
||||
bgpendata = pendata&0x7fff;
|
||||
bgpri = pri;
|
||||
}
|
||||
else
|
||||
{
|
||||
bgpendata = 0;
|
||||
bgpri = 0;;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pendata&0xff)
|
||||
{
|
||||
bgpendata = pendata&0x7fff;
|
||||
bgpri = pri;
|
||||
}
|
||||
else if (pendata2&0xff)
|
||||
{
|
||||
bgpendata = pendata2&0x7fff;
|
||||
bgpri = pri2;
|
||||
}
|
||||
else
|
||||
{
|
||||
bgpendata = 0;
|
||||
bgpri = 0;;
|
||||
}
|
||||
}
|
||||
|
||||
g = (g+g2);
|
||||
if (g>255) g = 255;
|
||||
// if the sprites are higher than the bg pixel
|
||||
if (pri3 > bgpri)
|
||||
{
|
||||
|
||||
b = (b+b2);
|
||||
if (b>255) b = 255;
|
||||
if (pendata3&0xff)
|
||||
{
|
||||
|
||||
if (pen) dst[x] = (r << 0) | (g << 8) | (b << 16);
|
||||
UINT16 palvalue = skns_palette_ram[pendata3];
|
||||
|
||||
coldat = clut[pendata3];
|
||||
|
||||
if (palvalue&0x8000)
|
||||
{
|
||||
UINT32 srccolour = clut[bgpendata&0x7fff];
|
||||
UINT32 dstcolour = clut[pendata3&0x3fff];
|
||||
|
||||
int r,g,b;
|
||||
int r2,g2,b2;
|
||||
|
||||
r = (srccolour & 0x000000ff)>> 0;
|
||||
g = (srccolour & 0x0000ff00)>> 8;
|
||||
b = (srccolour & 0x00ff0000)>> 16;
|
||||
|
||||
r2 = (dstcolour & 0x000000ff)>> 0;
|
||||
g2 = (dstcolour & 0x0000ff00)>> 8;
|
||||
b2 = (dstcolour & 0x00ff0000)>> 16;
|
||||
|
||||
r2 = (r2 * bright_spc_r_trans) >> 8;
|
||||
g2 = (g2 * bright_spc_g_trans) >> 8;
|
||||
b2 = (b2 * bright_spc_b_trans) >> 8;
|
||||
|
||||
r = (r+r2);
|
||||
if (r>255) r = 255;
|
||||
|
||||
g = (g+g2);
|
||||
if (g>255) g = 255;
|
||||
|
||||
b = (b+b2);
|
||||
if (b>255) b = 255;
|
||||
|
||||
dst[x] = (r << 0) | (g << 8) | (b << 16);
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
coldat = clut[pendata3];
|
||||
dst[x] = coldat;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
coldat = clut[bgpendata];
|
||||
dst[x] = coldat;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
coldat = clut[bgpendata];
|
||||
dst[x] = coldat;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pen) dst[x] = paldata[pen];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fillbitmap(sprite_bitmap, 0x0000, cliprect);
|
||||
skns_draw_sprites(screen->machine, sprite_bitmap, cliprect);
|
||||
|
||||
}
|
||||
|
||||
fillbitmap(sprite_bitmap, 0x0000, cliprect);
|
||||
skns_draw_sprites(screen->machine, sprite_bitmap, cliprect);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user