summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/supduck.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/supduck.c')
-rw-r--r--src/mame/drivers/supduck.c75
1 files changed, 9 insertions, 66 deletions
diff --git a/src/mame/drivers/supduck.c b/src/mame/drivers/supduck.c
index 68e9a6fe6cb..420d7a154de 100644
--- a/src/mame/drivers/supduck.c
+++ b/src/mame/drivers/supduck.c
@@ -24,6 +24,7 @@ All clock timing comes from crystal 1
#include "cpu/m68000/m68000.h"
#include "sound/okim6295.h"
#include "video/bufsprite.h"
+#include "video/tigeroad_spr.h"
class supduck_state : public driver_device
{
@@ -36,9 +37,9 @@ public:
m_text_videoram(*this, "textvideoram"),
m_fore_videoram(*this, "forevideoram"),
m_back_videoram(*this, "backvideoram"),
- m_paletteram(*this, "paletteram"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette")
+ m_palette(*this, "palette"),
+ m_spritegen(*this, "spritegen")
{ }
// devices
@@ -50,10 +51,10 @@ public:
required_shared_ptr<UINT16> m_text_videoram;
required_shared_ptr<UINT16> m_fore_videoram;
required_shared_ptr<UINT16> m_back_videoram;
- required_shared_ptr<UINT16> m_paletteram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
+ required_device<tigeroad_spr_device> m_spritegen;
tilemap_t *m_text_tilemap;
tilemap_t *m_fore_tilemap;
@@ -68,7 +69,6 @@ public:
DECLARE_WRITE16_MEMBER(supduck_4000_w);
DECLARE_WRITE16_MEMBER(supduck_4002_w);
- DECLARE_WRITE16_MEMBER(supduck_paletteram_w);
TILEMAP_MAPPER_MEMBER(supduk_tilemap_scan);
@@ -82,7 +82,6 @@ protected:
virtual void video_start();
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
TILE_GET_INFO_MEMBER(get_text_tile_info);
TILE_GET_INFO_MEMBER(get_fore_tile_info);
TILE_GET_INFO_MEMBER(get_back_tile_info);
@@ -127,9 +126,7 @@ UINT32 supduck_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
m_back_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_fore_tilemap->draw(screen, bitmap, cliprect, 0, 0);
-
- draw_sprites(bitmap, cliprect, 0);
- draw_sprites(bitmap, cliprect, 1); //draw priority sprites?
+ m_spritegen->draw_sprites(bitmap, cliprect, m_gfxdecode, 3, m_spriteram->buffer(), m_spriteram->bytes(), flip_screen(), 1 );
m_text_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
@@ -200,67 +197,11 @@ TILE_GET_INFO_MEMBER(supduck_state::get_back_tile_info)
}
-void supduck_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
-{
- UINT16 *source = &m_spriteram->buffer()[m_spriteram->bytes()/2] - 4;
- UINT16 *finish = m_spriteram->buffer();
-
- while (source >= finish)
- {
- int tile_number = source[0];
-
- if (tile_number != 0xfff) {
- int attr = source[1];
- int sy = source[2] & 0x1ff;
- int sx = source[3] & 0x1ff;
-
- int flipx = attr & 0x02;
- int flipy = attr & 0x01;
- int color = (attr >> 2) & 0x0f;
-
- if (sx > 0x100) sx -= 0x200;
- if (sy > 0x100) sy -= 0x200;
-
- if (flip_screen())
- {
- sx = 240 - sx;
- sy = 240 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
-
- m_gfxdecode->gfx(3)->transpen(bitmap,cliprect,
- tile_number,
- color,
- flipx, flipy,
- sx, 240 - sy, 15);
- }
-
- source -= 4;
- }
-}
WRITE16_MEMBER(supduck_state::supduck_4000_w)
{
}
-WRITE16_MEMBER(supduck_state::supduck_paletteram_w)
-{
- int r, g, b;
- data = COMBINE_DATA(&m_paletteram[offset]);
-
- r = ((data >> 8) & 0x0f);
- if (data & 0x4000) r |= 0x10;
-
- g = ((data >> 4 ) & 0x0f);
- if (data & 0x2000) g |= 0x10;
-
- b = ((data >> 0 ) & 0x0f);
- if (data & 0x1000) b |= 0x10;
-
- m_palette->set_pen_color (offset, rgb_t(r<<3, g<<3, b<<3));
-}
WRITE16_MEMBER(supduck_state::supduck_4002_w)
{
@@ -308,7 +249,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, supduck_state )
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(text_videoram_w) AM_SHARE("textvideoram")
AM_RANGE(0xff0000, 0xff3fff) AM_RAM_WRITE(back_videoram_w) AM_SHARE("backvideoram")
AM_RANGE(0xff4000, 0xff7fff) AM_RAM_WRITE(fore_videoram_w) AM_SHARE("forevideoram")
- AM_RANGE(0xff8000, 0xff87ff) AM_RAM_WRITE(supduck_paletteram_w) AM_SHARE("paletteram") // AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
+ AM_RANGE(0xff8000, 0xff87ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xffc000, 0xffffff) AM_RAM /* working RAM */
ADDRESS_MAP_END
@@ -509,8 +450,10 @@ static MACHINE_CONFIG_START( supduck, supduck_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", supduck)
+ MCFG_DEVICE_ADD("spritegen", TIGEROAD_SPRITE, 0)
+
MCFG_PALETTE_ADD("palette", 0x800/2)
-// MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB) // can't use this, the RGB bits are the lowest bits with this format, for this game they're the highest bits
+ MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit4)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")