mirror of
https://github.com/holub/mame
synced 2025-05-17 11:15:06 +03:00
Putted Deco 56 video sprite chip inside its own file [David Haywood]
This commit is contained in:
parent
235b0d2e01
commit
4c1663441a
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -3829,6 +3829,8 @@ src/mame/video/deco16ic.h svneol=native#text/plain
|
||||
src/mame/video/deco32.c svneol=native#text/plain
|
||||
src/mame/video/deco_mlc.c svneol=native#text/plain
|
||||
src/mame/video/decocass.c svneol=native#text/plain
|
||||
src/mame/video/decospr.c svneol=native#text/plain
|
||||
src/mame/video/decospr.h svneol=native#text/plain
|
||||
src/mame/video/deniam.c svneol=native#text/plain
|
||||
src/mame/video/dietgo.c svneol=native#text/plain
|
||||
src/mame/video/digdug.c svneol=native#text/plain
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "cpu/arm/arm.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "rendlay.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
class backfire_state : public driver_device
|
||||
{
|
||||
@ -27,8 +28,8 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
/* memory pointers */
|
||||
UINT32 * spriteram_1;
|
||||
UINT32 * spriteram_2;
|
||||
UINT16 * spriteram_1;
|
||||
UINT16 * spriteram_2;
|
||||
UINT32 * mainram;
|
||||
UINT32 * left_priority;
|
||||
UINT32 * right_priority;
|
||||
@ -58,6 +59,9 @@ static VIDEO_START( backfire )
|
||||
{
|
||||
backfire_state *state = machine->driver_data<backfire_state>();
|
||||
|
||||
state->spriteram_1 = auto_alloc_array(machine, UINT16, 0x2000/2);
|
||||
state->spriteram_2 = auto_alloc_array(machine, UINT16, 0x2000/2);
|
||||
|
||||
/* and register the allocated ram so that save states still work */
|
||||
state->save_item(NAME(state->pf1_rowscroll));
|
||||
state->save_item(NAME(state->pf2_rowscroll));
|
||||
@ -66,97 +70,23 @@ static VIDEO_START( backfire )
|
||||
|
||||
state->left = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16);
|
||||
state->right = auto_bitmap_alloc(machine, 80*8, 32*8, BITMAP_FORMAT_INDEXED16);
|
||||
|
||||
state->save_pointer(NAME(state->spriteram_1), 0x2000/2);
|
||||
state->save_pointer(NAME(state->spriteram_2), 0x2000/2);
|
||||
|
||||
state->save_item(NAME(*state->left));
|
||||
state->save_item(NAME(*state->right));
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 *spriteram, int region )
|
||||
{
|
||||
int offs;
|
||||
|
||||
flip_screen_set_no_update(machine, 1);
|
||||
|
||||
for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) // 0x1400 for charlien
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri;
|
||||
|
||||
sprite = spriteram[offs + 1] & 0xffff;
|
||||
|
||||
y = spriteram[offs] & 0xffff;
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2] & 0xffff;
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
pri = (x & 0xc000); // 2 bits or 1?
|
||||
|
||||
switch (pri & 0xc000)
|
||||
{
|
||||
case 0x0000: pri = 0; break; // numbers, people, cars when in the air, status display..
|
||||
case 0x4000: pri = 0xf0;break; // cars most of the time
|
||||
case 0x8000: pri = 0; break; // car wheels during jump?
|
||||
case 0xc000: pri = 0xf0;break; /* car wheels in race? */
|
||||
}
|
||||
|
||||
// pri 0 = ontop of everything//
|
||||
|
||||
// pri = 0;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320) continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_x_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[region],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static SCREEN_UPDATE( backfire )
|
||||
{
|
||||
backfire_state *state = screen->machine->driver_data<backfire_state>();
|
||||
|
||||
//FIXME: flip_screen_x should not be written!
|
||||
flip_screen_set_no_update(screen->machine, 1);
|
||||
|
||||
/* screen 1 uses pf1 as the forground and pf3 as the background */
|
||||
/* screen 2 uses pf2 as the foreground and pf4 as the background */
|
||||
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
|
||||
@ -172,13 +102,13 @@ static SCREEN_UPDATE( backfire )
|
||||
{
|
||||
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 1);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_1, 3);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_1, 0x800);
|
||||
}
|
||||
else if (state->left_priority[0] == 2)
|
||||
{
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 4);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_1, 3);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_1, 0x800);
|
||||
}
|
||||
else
|
||||
popmessage( "unknown left priority %08x", state->left_priority[0]);
|
||||
@ -192,13 +122,13 @@ static SCREEN_UPDATE( backfire )
|
||||
{
|
||||
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, 0, 1);
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_2, 4);
|
||||
screen->machine->device<decospr_device>("spritegen2")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_2, 0x800);
|
||||
}
|
||||
else if (state->right_priority[0] == 2)
|
||||
{
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, 0, 4);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_2, 4);
|
||||
screen->machine->device<decospr_device>("spritegen2")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_2, 0x800);
|
||||
}
|
||||
else
|
||||
popmessage( "unknown right priority %08x", state->right_priority[0]);
|
||||
@ -284,6 +214,38 @@ READ32_HANDLER( backfire_wheel2_r )
|
||||
#endif
|
||||
|
||||
|
||||
static READ32_HANDLER( backfire_spriteram1_r )
|
||||
{
|
||||
backfire_state *state = space->machine->driver_data<backfire_state>();
|
||||
return state->spriteram_1[offset] ^ 0xffff0000;
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( backfire_spriteram1_w )
|
||||
{
|
||||
backfire_state *state = space->machine->driver_data<backfire_state>();
|
||||
data &= 0x0000ffff;
|
||||
mem_mask &= 0x0000ffff;
|
||||
|
||||
COMBINE_DATA(&state->spriteram_1[offset]);
|
||||
}
|
||||
|
||||
static READ32_HANDLER( backfire_spriteram2_r )
|
||||
{
|
||||
backfire_state *state = space->machine->driver_data<backfire_state>();
|
||||
return state->spriteram_2[offset] ^ 0xffff0000;
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( backfire_spriteram2_w )
|
||||
{
|
||||
backfire_state *state = space->machine->driver_data<backfire_state>();
|
||||
data &= 0x0000ffff;
|
||||
mem_mask &= 0x0000ffff;
|
||||
|
||||
COMBINE_DATA(&state->spriteram_2[offset]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( backfire_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x10001f) AM_DEVREADWRITE("deco_custom", deco16ic_pf12_control_dword_r, deco16ic_pf12_control_dword_w)
|
||||
@ -302,8 +264,8 @@ static ADDRESS_MAP_START( backfire_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
// AM_RANGE(0x180010, 0x180013) AM_RAM AM_BASE(&backfire_180010) // always 180010 ?
|
||||
// AM_RANGE(0x188010, 0x188013) AM_RAM AM_BASE(&backfire_188010) // always 188010 ?
|
||||
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM AM_BASE_MEMBER(backfire_state, spriteram_1)
|
||||
AM_RANGE(0x18c000, 0x18dfff) AM_RAM AM_BASE_MEMBER(backfire_state, spriteram_2)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_READWRITE(backfire_spriteram1_r, backfire_spriteram1_w)
|
||||
AM_RANGE(0x18c000, 0x18dfff) AM_READWRITE(backfire_spriteram2_r, backfire_spriteram2_w)
|
||||
AM_RANGE(0x190000, 0x190003) AM_DEVREAD("eeprom", backfire_eeprom_r)
|
||||
AM_RANGE(0x194000, 0x194003) AM_READ(backfire_control2_r)
|
||||
AM_RANGE(0x1a4000, 0x1a4003) AM_DEVWRITE("eeprom", backfire_eeprom_w)
|
||||
@ -473,6 +435,18 @@ static MACHINE_START( backfire )
|
||||
state->eeprom = machine->device("eeprom");
|
||||
}
|
||||
|
||||
UINT16 backfire_pri_callback(UINT16 x)
|
||||
{
|
||||
switch (x & 0xc000)
|
||||
{
|
||||
case 0x0000: return 0; break; // numbers, people, cars when in the air, status display..
|
||||
case 0x4000: return 0xf0;break; // cars most of the time
|
||||
case 0x8000: return 0; break; // car wheels during jump?
|
||||
case 0xc000: return 0xf0;break; /* car wheels in race? */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( backfire, backfire_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -508,6 +482,14 @@ static MACHINE_CONFIG_START( backfire, backfire_state )
|
||||
MCFG_VIDEO_START(backfire)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", backfire_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 3);
|
||||
decospr_device_config::set_pri_callback(device, backfire_pri_callback);
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen2", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 4);
|
||||
decospr_device_config::set_pri_callback(device, backfire_pri_callback);
|
||||
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -51,7 +51,7 @@ Note about version levels using Mutant Fighter as the example:
|
||||
#include "sound/2151intf.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "video/deco16ic.h"
|
||||
|
||||
#include "video/decospr.h"
|
||||
|
||||
static WRITE16_HANDLER( cninja_sound_w )
|
||||
{
|
||||
@ -842,6 +842,21 @@ static MACHINE_RESET( cninja )
|
||||
state->irq_mask = 0;
|
||||
}
|
||||
|
||||
UINT16 cninja_pri_callback(UINT16 x)
|
||||
{
|
||||
/* Sprite/playfield priority */
|
||||
switch (x & 0xc000)
|
||||
{
|
||||
case 0x0000: return 0;
|
||||
case 0x4000: return 0xf0;
|
||||
case 0x8000: return 0xf0 | 0xcc;
|
||||
case 0xc000: return 0xf0 | 0xcc; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( cninja, cninja_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -871,6 +886,9 @@ static MACHINE_CONFIG_START( cninja, cninja_state )
|
||||
MCFG_PALETTE_LENGTH(2048)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", cninja_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 3);
|
||||
decospr_device_config::set_pri_callback(device, cninja_pri_callback);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
@ -921,6 +939,9 @@ static MACHINE_CONFIG_START( stoneage, cninja_state )
|
||||
MCFG_VIDEO_START(stoneage)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", cninja_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 3);
|
||||
decospr_device_config::set_pri_callback(device, cninja_pri_callback);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
@ -1010,6 +1031,9 @@ static MACHINE_CONFIG_START( edrandy, cninja_state )
|
||||
MCFG_PALETTE_LENGTH(2048)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", edrandy_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 3);
|
||||
decospr_device_config::set_pri_callback(device, cninja_pri_callback);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
@ -24,6 +24,7 @@ Protection TODO:
|
||||
#include "sound/2151intf.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
class dblewing_state : public driver_device
|
||||
{
|
||||
@ -70,126 +71,22 @@ public:
|
||||
device_t *deco16ic;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
offs +0
|
||||
-------- --------
|
||||
fFbSssy yyyyyyyy
|
||||
|
||||
s = size (multipart)
|
||||
S = size (x?) (does any other game use this?)
|
||||
f = flipy
|
||||
b = flash
|
||||
F = flipx
|
||||
y = ypos
|
||||
|
||||
offs +1
|
||||
-------- --------
|
||||
tttttttt tttttttt
|
||||
|
||||
t = sprite tile
|
||||
|
||||
offs +2
|
||||
-------- --------
|
||||
ppcccccx xxxxxxxx
|
||||
|
||||
c = colour palette
|
||||
p = priority
|
||||
x = xpos
|
||||
|
||||
*/
|
||||
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
UINT16 dblwings_pri_callback(UINT16 x)
|
||||
{
|
||||
dblewing_state *state = machine->driver_data<dblewing_state>();
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x400 - 4; offs >= 0; offs -= 4)
|
||||
UINT16 pri = (x & 0xc000); // 2 bits or 1?
|
||||
switch (pri & 0xc000)
|
||||
{
|
||||
int x, y, sprite, colour, multi, mult2, fx, fy, inc, flash, mult, xsize, pri;
|
||||
|
||||
sprite = spriteram[offs + 1];
|
||||
|
||||
y = spriteram[offs];
|
||||
flash = y & 0x1000;
|
||||
xsize = y & 0x0800;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2];
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
pri = (x & 0xc000); // 2 bits or 1?
|
||||
|
||||
switch (pri & 0xc000)
|
||||
{
|
||||
case 0x0000: pri = 0; break;
|
||||
case 0x4000: pri = 0xf0; break;
|
||||
case 0x8000: pri = 0xf0 | 0xcc; break;
|
||||
case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */
|
||||
}
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320)
|
||||
continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else
|
||||
mult = -16;
|
||||
|
||||
mult2 = multi + 1;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
|
||||
if (xsize)
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
(sprite - multi * inc)-mult2,
|
||||
colour,
|
||||
fx,fy,
|
||||
x-16,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
|
||||
return pri;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static SCREEN_UPDATE(dblewing)
|
||||
{
|
||||
dblewing_state *state = screen->machine->driver_data<dblewing_state>();
|
||||
@ -203,7 +100,7 @@ static SCREEN_UPDATE(dblewing)
|
||||
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 4);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, 0x400);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -759,6 +656,9 @@ static MACHINE_CONFIG_START( dblewing, dblewing_state )
|
||||
MCFG_GFXDECODE(dblewing)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", dblewing_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
decospr_device_config::set_pri_callback(device, dblwings_pri_callback);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "sound/okim6295.h"
|
||||
#include "sound/ymz280b.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
class deco156_state : public driver_device
|
||||
{
|
||||
@ -39,102 +40,27 @@ public:
|
||||
/* memory */
|
||||
UINT16 pf1_rowscroll[0x800/2];
|
||||
UINT16 pf2_rowscroll[0x800/2];
|
||||
UINT16* spriteram;
|
||||
};
|
||||
|
||||
|
||||
static VIDEO_START( wcvol95 )
|
||||
{
|
||||
deco156_state *state = machine->driver_data<deco156_state>();
|
||||
state->spriteram = auto_alloc_array(machine, UINT16, 0x2000/2);
|
||||
|
||||
/* and register the allocated ram so that save states still work */
|
||||
state->save_item(NAME(state->pf1_rowscroll));
|
||||
state->save_item(NAME(state->pf2_rowscroll));
|
||||
state->save_pointer(NAME(state->spriteram), 0x2000/2);
|
||||
}
|
||||
|
||||
/* spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps
|
||||
its the same sprite chip Data East used on many, many 16-bit era titles */
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
{
|
||||
UINT32 *spriteram = machine->generic.spriteram.u32;
|
||||
int offs;
|
||||
|
||||
flip_screen_set_no_update(machine, 1);
|
||||
|
||||
for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) // 0x1400 for charlien
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri;
|
||||
|
||||
sprite = spriteram[offs + 1] & 0xffff;
|
||||
|
||||
y = spriteram[offs] & 0xffff;
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2] & 0xffff;
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
pri = (x & 0xc000); // 2 bits or 1?
|
||||
|
||||
switch (pri & 0xc000)
|
||||
{
|
||||
case 0x0000: pri = 0; break;
|
||||
case 0x4000: pri = 0xf0; break;
|
||||
case 0x8000: pri = 0xf0 | 0xcc; break;
|
||||
case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */
|
||||
}
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320)
|
||||
continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_x_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static SCREEN_UPDATE( wcvol95 )
|
||||
{
|
||||
//FIXME: flip_screen_x should not be written!
|
||||
flip_screen_set_no_update(screen->machine, 1);
|
||||
|
||||
deco156_state *state = screen->machine->driver_data<deco156_state>();
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
|
||||
@ -143,7 +69,7 @@ static SCREEN_UPDATE( wcvol95 )
|
||||
deco16ic_pf12_update(state->deco16ic, state->pf1_rowscroll, state->pf2_rowscroll);
|
||||
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, 0x800);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -188,8 +114,10 @@ static WRITE32_HANDLER( deco156_nonbuffered_palette_w )
|
||||
|
||||
static READ32_HANDLER( wcvol95_pf1_rowscroll_r ) { deco156_state *state = space->machine->driver_data<deco156_state>(); return state->pf1_rowscroll[offset] ^ 0xffff0000; }
|
||||
static READ32_HANDLER( wcvol95_pf2_rowscroll_r ) { deco156_state *state = space->machine->driver_data<deco156_state>(); return state->pf2_rowscroll[offset] ^ 0xffff0000; }
|
||||
static READ32_HANDLER( wcvol95_spriteram_r ) { deco156_state *state = space->machine->driver_data<deco156_state>(); return state->spriteram[offset] ^ 0xffff0000; }
|
||||
static WRITE32_HANDLER( wcvol95_pf1_rowscroll_w ) { deco156_state *state = space->machine->driver_data<deco156_state>(); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf1_rowscroll[offset]); }
|
||||
static WRITE32_HANDLER( wcvol95_pf2_rowscroll_w ) { deco156_state *state = space->machine->driver_data<deco156_state>(); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->pf2_rowscroll[offset]); }
|
||||
static WRITE32_HANDLER( wcvol95_spriteram_w ) { deco156_state *state = space->machine->driver_data<deco156_state>(); data &= 0x0000ffff; mem_mask &= 0x0000ffff; COMBINE_DATA(&state->spriteram[offset]); }
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( hvysmsh_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
@ -209,7 +137,7 @@ static ADDRESS_MAP_START( hvysmsh_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x1a4000, 0x1a4fff) AM_READWRITE(wcvol95_pf2_rowscroll_r, wcvol95_pf2_rowscroll_w)
|
||||
AM_RANGE(0x1c0000, 0x1c0fff) AM_RAM_WRITE(deco156_nonbuffered_palette_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x1d0010, 0x1d002f) AM_READNOP // Check for DMA complete?
|
||||
AM_RANGE(0x1e0000, 0x1e1fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x1e0000, 0x1e1fff) AM_READWRITE(wcvol95_spriteram_r, wcvol95_spriteram_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( wcvol95_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
@ -222,7 +150,7 @@ static ADDRESS_MAP_START( wcvol95_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x130000, 0x137fff) AM_RAM
|
||||
AM_RANGE(0x140000, 0x140003) AM_READ_PORT("INPUTS")
|
||||
AM_RANGE(0x150000, 0x150003) AM_WRITE_PORT("EEPROMOUT")
|
||||
AM_RANGE(0x160000, 0x161fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x160000, 0x161fff) AM_READWRITE(wcvol95_spriteram_r, wcvol95_spriteram_w)
|
||||
AM_RANGE(0x170000, 0x170003) AM_NOP // Irq ack?
|
||||
AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(wcvol95_nonbuffered_palette_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x1a0000, 0x1a0007) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0x000000ff)
|
||||
@ -397,6 +325,20 @@ static const deco16ic_interface deco156_deco16ic_intf =
|
||||
NULL
|
||||
};
|
||||
|
||||
UINT16 deco156_pri_callback(UINT16 x)
|
||||
{
|
||||
switch (x & 0xc000)
|
||||
{
|
||||
case 0x0000: return 0;
|
||||
case 0x4000: return 0xf0;
|
||||
case 0x8000: return 0xf0 | 0xcc;
|
||||
case 0xc000: return 0xf0 | 0xcc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( hvysmsh, deco156_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -406,9 +348,6 @@ static MACHINE_CONFIG_START( hvysmsh, deco156_state )
|
||||
|
||||
MCFG_EEPROM_93C46_ADD("eeprom")
|
||||
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529))
|
||||
@ -423,6 +362,9 @@ static MACHINE_CONFIG_START( hvysmsh, deco156_state )
|
||||
MCFG_VIDEO_START(wcvol95)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", deco156_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
decospr_device_config::set_pri_callback(device, deco156_pri_callback);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
@ -445,9 +387,6 @@ static MACHINE_CONFIG_START( wcvol95, deco156_state )
|
||||
|
||||
MCFG_EEPROM_93C46_ADD("eeprom")
|
||||
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529))
|
||||
@ -462,6 +401,9 @@ static MACHINE_CONFIG_START( wcvol95, deco156_state )
|
||||
MCFG_VIDEO_START(wcvol95)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", deco156_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
decospr_device_config::set_pri_callback(device, deco156_pri_callback);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "includes/decoprot.h"
|
||||
#include "includes/dietgo.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( dietgo_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
@ -224,7 +225,9 @@ static MACHINE_CONFIG_START( dietgo, dietgo_state )
|
||||
MCFG_GFXDECODE(dietgo)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", dietgo_deco16ic_intf)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
|
@ -59,7 +59,7 @@ bootleg todo:
|
||||
#include "video/deco16ic.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "includes/pktgaldx.h"
|
||||
|
||||
#include "video/decospr.h"
|
||||
|
||||
/**********************************************************************************/
|
||||
|
||||
@ -340,6 +340,8 @@ static MACHINE_CONFIG_START( pktgaldx, pktgaldx_state )
|
||||
MCFG_GFXDECODE(pktgaldx)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", pktgaldx_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -95,7 +95,7 @@ Are the OKI M6295 clocks from Heavy Smash are correct at least for the Mitchell
|
||||
#include "machine/eeprom.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "video/deco16ic.h"
|
||||
|
||||
#include "video/decospr.h"
|
||||
|
||||
static INPUT_PORTS_START( simpl156 )
|
||||
PORT_START("IN0")
|
||||
@ -251,7 +251,7 @@ static WRITE32_HANDLER( simpl156_pf2_rowscroll_w )
|
||||
static ADDRESS_MAP_START( joemacr_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x107fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram
|
||||
AM_RANGE(0x110000, 0x111fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_MEMBER(simpl156_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x110000, 0x111fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w)
|
||||
AM_RANGE(0x120000, 0x120fff) AM_READWRITE(simpl156_palette_r, simpl156_palette_w)
|
||||
AM_RANGE(0x130000, 0x130003) AM_READWRITE(simpl156_system_r, simpl156_eeprom_w)
|
||||
AM_RANGE(0x140000, 0x14001f) AM_DEVREADWRITE("deco_custom", deco16ic_pf12_control_dword_r, deco16ic_pf12_control_dword_w)
|
||||
@ -275,7 +275,7 @@ static ADDRESS_MAP_START( chainrec_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
|
||||
AM_RANGE(0x3c0000, 0x3c0003) AM_DEVREADWRITE8_MODERN("okimusic", okim6295_device, read, write, 0x000000ff)
|
||||
AM_RANGE(0x400000, 0x407fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram?
|
||||
AM_RANGE(0x410000, 0x411fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_MEMBER(simpl156_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x410000, 0x411fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w)
|
||||
AM_RANGE(0x420000, 0x420fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
|
||||
AM_RANGE(0x430000, 0x430003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
|
||||
AM_RANGE(0x440000, 0x44001f) AM_DEVREADWRITE("deco_custom", deco16ic_pf12_control_dword_r, deco16ic_pf12_control_dword_w)
|
||||
@ -296,7 +296,7 @@ static ADDRESS_MAP_START( magdrop_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
|
||||
AM_RANGE(0x340000, 0x340003) AM_DEVREADWRITE8_MODERN("okimusic", okim6295_device, read, write, 0x000000ff)
|
||||
AM_RANGE(0x380000, 0x387fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram?
|
||||
AM_RANGE(0x390000, 0x391fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_MEMBER(simpl156_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x390000, 0x391fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w)
|
||||
AM_RANGE(0x3a0000, 0x3a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
|
||||
AM_RANGE(0x3b0000, 0x3b0003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
|
||||
AM_RANGE(0x3c0000, 0x3c001f) AM_DEVREADWRITE("deco_custom", deco16ic_pf12_control_dword_r, deco16ic_pf12_control_dword_w)
|
||||
@ -317,7 +317,7 @@ static ADDRESS_MAP_START( magdropp_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE_MEMBER(simpl156_state, systemram) // work ram (32-bit)
|
||||
AM_RANGE(0x4c0000, 0x4c0003) AM_DEVREADWRITE8_MODERN("okimusic", okim6295_device, read, write, 0x000000ff)
|
||||
AM_RANGE(0x680000, 0x687fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram?
|
||||
AM_RANGE(0x690000, 0x691fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_MEMBER(simpl156_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x690000, 0x691fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w)
|
||||
AM_RANGE(0x6a0000, 0x6a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
|
||||
AM_RANGE(0x6b0000, 0x6b0003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
|
||||
AM_RANGE(0x6c0000, 0x6c001f) AM_DEVREADWRITE("deco_custom", deco16ic_pf12_control_dword_r, deco16ic_pf12_control_dword_w)
|
||||
@ -337,7 +337,7 @@ static ADDRESS_MAP_START( mitchell156_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x100000, 0x100003) AM_DEVREADWRITE8_MODERN("okisfx", okim6295_device, read, write, 0x000000ff)
|
||||
AM_RANGE(0x140000, 0x140003) AM_DEVREADWRITE8_MODERN("okimusic", okim6295_device, read, write, 0x000000ff)
|
||||
AM_RANGE(0x180000, 0x187fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE_MEMBER(simpl156_state, mainram) // main ram
|
||||
AM_RANGE(0x190000, 0x191fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE_SIZE_MEMBER(simpl156_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w)
|
||||
AM_RANGE(0x1a0000, 0x1a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
|
||||
AM_RANGE(0x1b0000, 0x1b0003) AM_READWRITE(simpl156_system_r,simpl156_eeprom_w)
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_DEVREADWRITE("deco_custom", deco16ic_pf12_control_dword_r, deco16ic_pf12_control_dword_w)
|
||||
@ -417,6 +417,20 @@ static const deco16ic_interface simpl156_deco16ic_intf =
|
||||
NULL
|
||||
};
|
||||
|
||||
UINT16 simpl156_pri_callback(UINT16 x)
|
||||
{
|
||||
switch (x & 0xc000)
|
||||
{
|
||||
case 0x0000: return 0;
|
||||
case 0x4000: return 0xf0;
|
||||
case 0x8000: return 0xf0 | 0xcc;
|
||||
case 0xc000: return 0xf0 | 0xcc;; /* or 0xf0|0xcc|0xaa ? */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( chainrec, simpl156_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -440,6 +454,9 @@ static MACHINE_CONFIG_START( chainrec, simpl156_state )
|
||||
MCFG_VIDEO_START(simpl156)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", simpl156_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
decospr_device_config::set_pri_callback(device, simpl156_pri_callback);
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
|
@ -27,7 +27,7 @@ down hardware (it doesn't write any good sound data btw, mostly zeros).
|
||||
#include "sound/okim6295.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "includes/supbtime.h"
|
||||
|
||||
#include "video/decospr.h"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@ -366,6 +366,8 @@ static MACHINE_CONFIG_START( supbtime, supbtime_state )
|
||||
MCFG_PALETTE_LENGTH(1024)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", supbtime_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
@ -48,6 +48,7 @@ Stephh's notes (based on the games M68000 code and some tests) :
|
||||
#include "sound/okim6295.h"
|
||||
#include "includes/tumblep.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
#define TUMBLEP_HACK 0
|
||||
|
||||
@ -328,6 +329,8 @@ static MACHINE_CONFIG_START( tumblep, tumblep_state )
|
||||
MCFG_PALETTE_LENGTH(1024)
|
||||
|
||||
MCFG_DECO16IC_ADD("deco_custom", tumblep_deco16ic_intf)
|
||||
MCFG_DEVICE_ADD("spritegen", decospr_, 0)
|
||||
decospr_device_config::set_gfx_region(device, 2);
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
UINT16 * pf2_rowscroll;
|
||||
UINT32 * mainram;
|
||||
UINT32 * systemram;
|
||||
UINT32 *spriteram;
|
||||
UINT16 *spriteram;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* devices */
|
||||
|
@ -608,6 +608,7 @@ $(MAMEOBJ)/dataeast.a: \
|
||||
$(MACHINE)/decocrpt.o \
|
||||
$(MACHINE)/decoprot.o \
|
||||
$(VIDEO)/deco16ic.o \
|
||||
$(VIDEO)/decospr.o \
|
||||
|
||||
$(MAMEOBJ)/dooyong.a: \
|
||||
$(DRIVERS)/dooyong.o $(VIDEO)/dooyong.o \
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "emu.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "includes/cninja.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@ -22,81 +23,6 @@ VIDEO_START( stoneage )
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void cninja_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT16 *buffered_spriteram = machine->generic.buffered_spriteram.u16;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x400 - 4; offs >=0 ; offs -= 4)
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0;
|
||||
|
||||
sprite = buffered_spriteram[offs + 1];
|
||||
if (!sprite)
|
||||
continue;
|
||||
|
||||
x = buffered_spriteram[offs + 2];
|
||||
|
||||
/* Sprite/playfield priority */
|
||||
switch (x & 0xc000)
|
||||
{
|
||||
case 0x0000: pri = 0; break;
|
||||
case 0x4000: pri = 0xf0; break;
|
||||
case 0x8000: pri = 0xf0 | 0xcc; break;
|
||||
case 0xc000: pri = 0xf0 | 0xcc; break; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
|
||||
}
|
||||
|
||||
y = buffered_spriteram[offs];
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 256) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
x = 240 - x;
|
||||
y = 240 - y;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else
|
||||
mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[3],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The bootleg sprites are in a different format! */
|
||||
static void cninjabl_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
@ -405,7 +331,7 @@ SCREEN_UPDATE( cninja )
|
||||
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 2);
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 4);
|
||||
cninja_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 0x400);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -445,7 +371,7 @@ SCREEN_UPDATE( edrandy )
|
||||
deco16ic_tilemap_4_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
|
||||
deco16ic_tilemap_3_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 4);
|
||||
cninja_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.buffered_spriteram.u16, 0x400);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
271
src/mame/video/decospr.c
Normal file
271
src/mame/video/decospr.c
Normal file
@ -0,0 +1,271 @@
|
||||
/* Data East Sprite Chip
|
||||
DECO 52
|
||||
|
||||
note, we have pri callbacks and checks to drop back to plain drawgfx because not all drivers are using pdrawgfx yet, they probably should be...
|
||||
some games have different visible areas, but are confirmed as the same sprite chip.
|
||||
|
||||
games with alpha aren't supported here yet, in most cases they need better mixing anyway.
|
||||
|
||||
used by:
|
||||
|
||||
dblewing.c
|
||||
tumblep.c
|
||||
dietgo.c
|
||||
supbtime.c
|
||||
simpl156.c
|
||||
deco156.c
|
||||
pktgaldx.c
|
||||
backfire.c
|
||||
|
||||
partially converted:
|
||||
cninja.c (mutantf uses alpha etc.)
|
||||
|
||||
difficult to convert:
|
||||
rohga.c - alpha effects, extra rom banking on the sprites etc. causes problems
|
||||
|
||||
todo:
|
||||
cbuster.c - needs updating to use proper priority, not multipass
|
||||
|
||||
many more
|
||||
*/
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "decospr.h"
|
||||
|
||||
|
||||
decospr_device_config::decospr_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "decospr_device", tag, owner, clock)
|
||||
{
|
||||
m_gfxregion = 0;
|
||||
m_pricallback = NULL;
|
||||
}
|
||||
|
||||
device_config *decospr_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
{
|
||||
return global_alloc(decospr_device_config(mconfig, tag, owner, clock));
|
||||
}
|
||||
|
||||
device_t *decospr_device_config::alloc_device(running_machine &machine) const
|
||||
{
|
||||
return auto_alloc(&machine, decospr_device(machine, *this));
|
||||
}
|
||||
|
||||
void decospr_device_config::set_gfx_region(device_config *device, int gfxregion)
|
||||
{
|
||||
decospr_device_config *dev = downcast<decospr_device_config *>(device);
|
||||
dev->m_gfxregion = gfxregion;
|
||||
// printf("decospr_device_config::set_gfx_region()\n");
|
||||
}
|
||||
|
||||
void decospr_device_config::set_pri_callback(device_config *device, decospr_priority_callback_func callback)
|
||||
{
|
||||
decospr_device_config *dev = downcast<decospr_device_config *>(device);
|
||||
dev->m_pricallback = callback;
|
||||
// printf("decospr_device_config::set_pri_callback()\n");
|
||||
}
|
||||
|
||||
decospr_device::decospr_device(running_machine &_machine, const decospr_device_config &config)
|
||||
: device_t(_machine, config),
|
||||
m_config(config),
|
||||
m_gfxregion(m_config.m_gfxregion),
|
||||
m_pricallback(m_config.m_pricallback)
|
||||
{
|
||||
}
|
||||
|
||||
void decospr_device::device_start()
|
||||
{
|
||||
// sprite_kludge_x = sprite_kludge_y = 0;
|
||||
printf("decospr_device::device_start()\n");
|
||||
}
|
||||
|
||||
void decospr_device::device_reset()
|
||||
{
|
||||
//printf("decospr_device::device_reset()\n");
|
||||
}
|
||||
|
||||
/*
|
||||
void decospr_device::decospr_sprite_kludge(int x, int y)
|
||||
{
|
||||
sprite_kludge_x = x;
|
||||
sprite_kludge_y = y;
|
||||
}
|
||||
*/
|
||||
|
||||
void decospr_device::set_pri_callback(decospr_priority_callback_func callback)
|
||||
{
|
||||
m_pricallback = callback;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
offs +0
|
||||
-------- --------
|
||||
fFbSssy yyyyyyyy
|
||||
|
||||
s = size (multipart)
|
||||
S = size (x?) (does any other game use this?)
|
||||
f = flipy
|
||||
b = flash
|
||||
F = flipx
|
||||
y = ypos
|
||||
|
||||
offs +1
|
||||
-------- --------
|
||||
tttttttt tttttttt
|
||||
|
||||
t = sprite tile
|
||||
|
||||
offs +2
|
||||
-------- --------
|
||||
ppcccccx xxxxxxxx
|
||||
|
||||
c = colour palette
|
||||
p = priority
|
||||
x = xpos
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void decospr_device::draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram, int sizewords, bool invert_flip )
|
||||
{
|
||||
int offs, end, incr;
|
||||
|
||||
int flipscreen = flip_screen_get(machine);
|
||||
|
||||
if (invert_flip)
|
||||
flipscreen = !flipscreen;
|
||||
|
||||
|
||||
if (m_pricallback)
|
||||
{
|
||||
offs = sizewords-4;
|
||||
end = -4;
|
||||
incr = -4;
|
||||
}
|
||||
else
|
||||
{
|
||||
offs = 0;
|
||||
end = sizewords;
|
||||
incr = 4;
|
||||
}
|
||||
|
||||
while (offs!=end)
|
||||
{
|
||||
int x, y, sprite, colour, multi, mult2, fx, fy, inc, flash, mult, xsize, pri;
|
||||
|
||||
sprite = spriteram[offs + 1];
|
||||
|
||||
y = spriteram[offs];
|
||||
flash = y & 0x1000;
|
||||
xsize = y & 0x0800;
|
||||
if (!(flash && (machine->primary_screen->frame_number() & 1)))
|
||||
{
|
||||
|
||||
x = spriteram[offs + 2];
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
if (m_pricallback)
|
||||
pri = m_pricallback(x);
|
||||
else
|
||||
pri = 0;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
if (cliprect->max_x>256)
|
||||
{
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 256) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
}
|
||||
|
||||
//if (x <= 320)
|
||||
{
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flipscreen)
|
||||
{
|
||||
y = 240 - y;
|
||||
|
||||
if (cliprect->max_x>256)
|
||||
x = 304 - x;
|
||||
else
|
||||
x = 240 - x;
|
||||
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else
|
||||
mult = -16;
|
||||
|
||||
mult2 = multi + 1;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
if (m_pricallback)
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
else
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
0);
|
||||
|
||||
// double wing uses this flag
|
||||
if (xsize)
|
||||
{
|
||||
if (m_pricallback)
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
(sprite - multi * inc)-mult2,
|
||||
colour,
|
||||
fx,fy,
|
||||
x-16,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
else
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[m_gfxregion],
|
||||
(sprite - multi * inc)-mult2,
|
||||
colour,
|
||||
fx,fy,
|
||||
x-16,y + mult * multi,
|
||||
0);
|
||||
}
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
offs+=incr;
|
||||
}
|
||||
}
|
45
src/mame/video/decospr.h
Normal file
45
src/mame/video/decospr.h
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
typedef UINT16 (*decospr_priority_callback_func)(UINT16 pri);
|
||||
|
||||
class decospr_device_config : public device_config
|
||||
{
|
||||
friend class decospr_device;
|
||||
decospr_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
public:
|
||||
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
virtual device_t *alloc_device(running_machine &machine) const;
|
||||
static void set_gfx_region(device_config *device, int gfxregion);
|
||||
static void set_pri_callback(device_config *device, decospr_priority_callback_func callback);
|
||||
|
||||
protected:
|
||||
UINT8 m_gfxregion;
|
||||
decospr_priority_callback_func m_pricallback;
|
||||
};
|
||||
|
||||
class decospr_device : public device_t
|
||||
{
|
||||
friend class decospr_device_config;
|
||||
decospr_device(running_machine &_machine, const decospr_device_config &config);
|
||||
public:
|
||||
//void decospr_sprite_kludge(int x, int y);
|
||||
void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram, int sizewords, bool invert_flip = false );
|
||||
void set_pri_callback(decospr_priority_callback_func callback);
|
||||
void set_gfxregion(int region) { m_gfxregion = region; };
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
const decospr_device_config &m_config;
|
||||
UINT8 m_gfxregion;
|
||||
decospr_priority_callback_func m_pricallback;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
const device_type decospr_ = decospr_device_config::static_alloc_device_config;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,76 +1,7 @@
|
||||
#include "emu.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "includes/dietgo.h"
|
||||
|
||||
|
||||
static void draw_sprites( running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
dietgo_state *state = machine->driver_data<dietgo_state>();
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < 0x400; offs += 4)
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
|
||||
|
||||
sprite = spriteram[offs + 1];
|
||||
if (!sprite)
|
||||
continue;
|
||||
|
||||
y = spriteram[offs];
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2];
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320)
|
||||
continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "video/decospr.h"
|
||||
|
||||
SCREEN_UPDATE( dietgo )
|
||||
{
|
||||
@ -85,6 +16,6 @@ SCREEN_UPDATE( dietgo )
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, 0x400);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,75 +1,7 @@
|
||||
#include "emu.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "includes/pktgaldx.h"
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect )
|
||||
{
|
||||
pktgaldx_state *state = machine->driver_data<pktgaldx_state>();
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
int flipscreen = !flip_screen_get(machine);
|
||||
|
||||
for (offs = 0; offs < 0x400; offs += 4)
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
|
||||
|
||||
sprite = spriteram[offs+1];
|
||||
if (!sprite)
|
||||
continue;
|
||||
|
||||
y = spriteram[offs];
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2];
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320)
|
||||
continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flipscreen)
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "video/decospr.h"
|
||||
|
||||
/* Video on the orginal */
|
||||
|
||||
@ -85,7 +17,7 @@ SCREEN_UPDATE( pktgaldx )
|
||||
bitmap_fill(screen->machine->priority_bitmap, NULL, 0);
|
||||
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, 0x400, true);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,117 +5,7 @@
|
||||
#include "emu.h"
|
||||
#include "includes/simpl156.h"
|
||||
#include "video/deco16ic.h"
|
||||
|
||||
/*
|
||||
|
||||
offs +0
|
||||
-------- --------
|
||||
fFb ssy yyyyyyyy
|
||||
|
||||
s = size (multipart)
|
||||
f = flipy
|
||||
b = flash
|
||||
F = flipx
|
||||
y = ypos
|
||||
|
||||
offs +1
|
||||
-------- --------
|
||||
tttttttt tttttttt
|
||||
|
||||
t = sprite tile
|
||||
|
||||
offs +2
|
||||
-------- --------
|
||||
ppcccccx xxxxxxxx
|
||||
|
||||
c = colour palette
|
||||
p = priority
|
||||
x = xpos
|
||||
|
||||
*/
|
||||
|
||||
/* spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps
|
||||
its the same sprite chip Data East used on many, many 16-bit era titles */
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect )
|
||||
{
|
||||
simpl156_state *state = machine->driver_data<simpl156_state>();
|
||||
UINT32 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
//FIXME: flip_screen_x should not be written!
|
||||
flip_screen_set_no_update(machine, 1);
|
||||
|
||||
for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) // 0x1400 for charlien
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri;
|
||||
|
||||
sprite = spriteram[offs + 1] & 0xffff;
|
||||
|
||||
y = spriteram[offs] & 0xffff;
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2] & 0xffff;
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
pri = (x & 0xc000); // 2 bits or 1?
|
||||
|
||||
switch (pri & 0xc000)
|
||||
{
|
||||
case 0x0000: pri = 0; break;
|
||||
case 0x4000: pri = 0xf0; break;
|
||||
case 0x8000: pri = 0xf0 | 0xcc; break;
|
||||
case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */
|
||||
}
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320)
|
||||
continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else
|
||||
mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,
|
||||
machine->priority_bitmap,pri,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "video/decospr.h"
|
||||
|
||||
|
||||
VIDEO_START( simpl156 )
|
||||
@ -125,11 +15,13 @@ VIDEO_START( simpl156 )
|
||||
/* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
|
||||
state->pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
|
||||
state->pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
|
||||
state->spriteram = auto_alloc_array(machine, UINT16, 0x2000/2);
|
||||
machine->generic.paletteram.u16 = auto_alloc_array(machine, UINT16, 0x1000/2);
|
||||
|
||||
/* and register the allocated ram so that save states still work */
|
||||
state->save_pointer(NAME(state->pf1_rowscroll), 0x800/2);
|
||||
state->save_pointer(NAME(state->pf2_rowscroll), 0x800/2);
|
||||
state->save_pointer(NAME(state->spriteram), 0x2000/2);
|
||||
state_save_register_global_pointer(machine, machine->generic.paletteram.u16, 0x1000/2);
|
||||
}
|
||||
|
||||
@ -146,6 +38,9 @@ SCREEN_UPDATE( simpl156 )
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 2);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 4);
|
||||
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
//FIXME: flip_screen_x should not be written!
|
||||
flip_screen_set_no_update(screen->machine, 1);
|
||||
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, 0x800); // 0x800 needed to charlien title
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,77 +15,10 @@ End sequence uses rowscroll '98 c0' on pf1 (jmp to 1d61a on supbtimj)
|
||||
#include "emu.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "includes/supbtime.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
supbtime_state *state = machine->driver_data<supbtime_state>();
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < 0x400; offs += 4)
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
|
||||
|
||||
sprite = spriteram[offs + 1] & 0x3fff;
|
||||
if (!sprite)
|
||||
continue;
|
||||
|
||||
y = spriteram[offs];
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2];
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320)
|
||||
continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
SCREEN_UPDATE(supbtime)
|
||||
@ -99,7 +32,7 @@ SCREEN_UPDATE(supbtime)
|
||||
bitmap_fill(bitmap, cliprect, 768);
|
||||
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, 0x400);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,73 +16,8 @@ to switch between 8*8 tiles and 16*16 tiles.
|
||||
#include "emu.h"
|
||||
#include "video/deco16ic.h"
|
||||
#include "includes/tumblep.h"
|
||||
#include "video/decospr.h"
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
tumblep_state *state = machine->driver_data<tumblep_state>();
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < 0x400; offs += 4)
|
||||
{
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
|
||||
|
||||
sprite = spriteram[offs + 1];
|
||||
if (!sprite)
|
||||
continue;
|
||||
|
||||
y = spriteram[offs];
|
||||
flash = y & 0x1000;
|
||||
if (flash && (machine->primary_screen->frame_number() & 1))
|
||||
continue;
|
||||
|
||||
x = spriteram[offs + 2];
|
||||
colour = (x >> 9) & 0x1f;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
if (x >= 320) x -= 512;
|
||||
if (y >= 256) y -= 512;
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
|
||||
if (x > 320) continue;
|
||||
|
||||
sprite &= ~multi;
|
||||
if (fy)
|
||||
inc = -1;
|
||||
else
|
||||
{
|
||||
sprite += multi;
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 304 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite - multi * inc,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y + mult * multi,0);
|
||||
|
||||
multi--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCREEN_UPDATE( tumblep )
|
||||
{
|
||||
@ -97,6 +32,6 @@ SCREEN_UPDATE( tumblep )
|
||||
deco16ic_tilemap_2_draw(state->deco16ic, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
|
||||
deco16ic_tilemap_1_draw(state->deco16ic, bitmap, cliprect, 0, 0);
|
||||
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
screen->machine->device<decospr_device>("spritegen")->draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, 0x400);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user