diff --git a/src/mame/drivers/zaccaria.c b/src/mame/drivers/zaccaria.c index 7fb9598698a..d154863727e 100644 --- a/src/mame/drivers/zaccaria.c +++ b/src/mame/drivers/zaccaria.c @@ -318,8 +318,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x6400, 0x6407) AM_READ(zaccaria_prot1_r) AM_RANGE(0x6000, 0x67ff) AM_WRITE(zaccaria_videoram_w) AM_BASE(&zaccaria_videoram) /* 6400-67ff is 4 bits wide */ AM_RANGE(0x6800, 0x683f) AM_WRITE(zaccaria_attributes_w) AM_BASE(&zaccaria_attributesram) - AM_RANGE(0x6840, 0x685f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x6881, 0x68bc) AM_RAM AM_BASE_SIZE_GENERIC(spriteram2) + AM_RANGE(0x6840, 0x685f) AM_RAM AM_BASE_GENERIC(spriteram) + AM_RANGE(0x6881, 0x68c0) AM_RAM AM_BASE_GENERIC(spriteram2) AM_RANGE(0x6c00, 0x6c00) AM_WRITE(zaccaria_flip_screen_x_w) AM_RANGE(0x6c01, 0x6c01) AM_WRITE(zaccaria_flip_screen_y_w) AM_RANGE(0x6c02, 0x6c02) AM_WRITENOP /* sound reset */ @@ -358,60 +358,60 @@ static CUSTOM_INPUT( acs_r ) static INPUT_PORTS_START( monymony ) PORT_START("IN0") - PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) + PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW 5I:1,2") PORT_DIPSETTING( 0x00, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x03, "5" ) - PORT_DIPNAME( 0x04, 0x00, "Infinite Lives (Cheat)") + PORT_DIPNAME( 0x04, 0x00, "Infinite Lives (Cheat)") PORT_DIPLOCATION("SW 5I:3") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Difficulty ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW 5I:4") PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW 5I:5") PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x10, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x20, 0x00, "Freeze" ) + PORT_DIPNAME( 0x20, 0x00, "Freeze" ) PORT_DIPLOCATION("SW 5I:6") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, "Cross Hatch Pattern" ) + PORT_DIPNAME( 0x40, 0x00, "Cross Hatch Pattern" ) PORT_DIPLOCATION("SW 5I:7") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) /* random high scores? */ + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 5I:8") /* random high scores? */ PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW0") - PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) ) + PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW 4I:1,2") PORT_DIPSETTING( 0x01, "200000" ) PORT_DIPSETTING( 0x02, "300000" ) PORT_DIPSETTING( 0x03, "400000" ) PORT_DIPSETTING( 0x00, DEF_STR( None ) ) - PORT_DIPNAME( 0x04, 0x00, "Table Title" ) + PORT_DIPNAME( 0x04, 0x00, "Table Title" ) PORT_DIPLOCATION("SW 4I:3") PORT_DIPSETTING( 0x00, "Todays High Scores" ) PORT_DIPSETTING( 0x04, "High Scores" ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unused ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW 4I:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unused ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW 4I:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW 4I:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW 4I:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) + PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) PORT_DIPLOCATION("SW 4I:8") PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coin_A ) ) + PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW 3I:1,2") PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x8c, 0x84, DEF_STR( Coin_B ) ) + PORT_DIPNAME( 0x8c, 0x84, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW 3I:3,4,5") PORT_DIPSETTING( 0x8c, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x88, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x84, DEF_STR( 1C_1C ) ) @@ -420,7 +420,7 @@ static INPUT_PORTS_START( monymony ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_4C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_6C ) ) - PORT_DIPNAME( 0x70, 0x50, "Coin C" ) + PORT_DIPNAME( 0x70, 0x50, "Coin C" ) PORT_DIPLOCATION("SW 3I:6,7,8") PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x50, DEF_STR( 1C_1C ) ) @@ -469,33 +469,32 @@ static INPUT_PORTS_START( jackrabt ) PORT_INCLUDE( monymony ) PORT_MODIFY("IN0") - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 5I:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_MODIFY("DSW0") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 4I:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 4I:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "Table Title" ) + PORT_DIPNAME( 0x04, 0x00, "Table Title" ) PORT_DIPLOCATION("SW 4I:3") PORT_DIPSETTING( 0x00, "Todays High Scores" ) PORT_DIPSETTING( 0x04, "High Scores" ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 4I:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 4I:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 4I:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW 4I:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) INPUT_PORTS_END diff --git a/src/mame/video/zaccaria.c b/src/mame/video/zaccaria.c index 00423663c91..366a0d2e025 100644 --- a/src/mame/video/zaccaria.c +++ b/src/mame/video/zaccaria.c @@ -204,11 +204,24 @@ WRITE8_HANDLER( zaccaria_flip_screen_y_w ) ***************************************************************************/ -static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) +/* sprite format: + + 76543210 +0 xxxxxxxx x +1 x....... flipy + .x...... flipx + ..xxxxxx code low +2 xx...... code high + ..xxx... ? + .....xxx color +3 xxxxxxxx y + +offsets 1 and 2 are swapped with spriteram2 + +*/ +static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT8 *spriteram,int color,int section) { - UINT8 *spriteram = machine->generic.spriteram.u8; - UINT8 *spriteram_2 = machine->generic.spriteram2.u8; - int offs; + int offs,o1 = 1,o2 = 2; rectangle clip = *cliprect; if (flip_screen_x_get(machine)) @@ -216,51 +229,18 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan else sect_rect(&clip, &spritevisiblearea); - /* - TODO: sprites have 32 color codes, but we are using only 8. In Jack - Rabbit the extra codes are all duplicates, but there is a quadruple - of codes in Money Money which contains two different combinations. That - color code seems to be used only by crocodiles, so the one we are picking - seems the correct one (otherwise they would be red). - */ - - /* - TODO: sprite placement is not perfect, I made the Jack Rabbit mouth - animation correct but this moves one pixel to the left the sprite - which masks the holes when you fall in them. The hardware is probably - similar to Amidar, but the code in the Amidar driver is not good either. - */ - for (offs = 0;offs < machine->generic.spriteram2_size;offs += 4) + if (section) { - int sx = spriteram_2[offs + 3] + 1; - int sy = 242 - spriteram_2[offs]; - int flipx = spriteram_2[offs + 2] & 0x40; - int flipy = spriteram_2[offs + 2] & 0x80; - - if (flip_screen_x_get(machine)) - { - sx = 240 - sx; - flipx = !flipx; - } - if (flip_screen_y_get(machine)) - { - sy = 240 - sy; - flipy = !flipy; - } - - drawgfx_transpen(bitmap,&clip,machine->gfx[1], - (spriteram_2[offs + 2] & 0x3f) + (spriteram_2[offs + 1] & 0xc0), - 4 * (spriteram_2[offs + 1] & 0x07), - flipx,flipy, - sx,sy,0); + o1 = 2; + o2 = 1; } - for (offs = 0;offs < machine->generic.spriteram_size;offs += 4) + for (offs = 0;offs < 0x20;offs += 4) { int sx = spriteram[offs + 3] + 1; int sy = 242 - spriteram[offs]; - int flipx = spriteram[offs + 1] & 0x40; - int flipy = spriteram[offs + 1] & 0x80; + int flipx = spriteram[offs + o1] & 0x40; + int flipy = spriteram[offs + o1] & 0x80; if (flip_screen_x_get(machine)) { @@ -274,17 +254,20 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan } drawgfx_transpen(bitmap,&clip,machine->gfx[1], - (spriteram[offs + 1] & 0x3f) + (spriteram[offs + 2] & 0xc0), - 4 * (spriteram[offs + 2] & 0x07), - flipx,flipy, - sx,sy,0); + (spriteram[offs + o1] & 0x3f) + (spriteram[offs + o2] & 0xc0), + ((spriteram[offs + o2] & 0x07) << 2) | color, + flipx,flipy,sx,sy,0); } } - VIDEO_UPDATE( zaccaria ) { tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); - draw_sprites(screen->machine, bitmap,cliprect); + + // 3 layers of sprites, each with their own palette and priorities + draw_sprites(screen->machine,bitmap,cliprect,screen->machine->generic.spriteram2.u8,2,1); + draw_sprites(screen->machine,bitmap,cliprect,screen->machine->generic.spriteram.u8,1,0); + draw_sprites(screen->machine,bitmap,cliprect,screen->machine->generic.spriteram2.u8+0x20,0,1); + return 0; }