From c000fcf52f299465873fa11d7b1bc3b47c0021d7 Mon Sep 17 00:00:00 2001 From: Nicola Salmoria Date: Tue, 22 Apr 2008 08:50:38 +0000 Subject: [PATCH] 01670: kungfum, kungfud, spartanx, kungfub, kungfub2: Main character sprite not hidden at end of level. 01686: ldrun3, ldrun3jp: visible area problem --- src/mame/drivers/m62.c | 4 +- src/mame/includes/m62.h | 3 + src/mame/video/m62.c | 186 ++++++++++++++++++++++++---------------- 3 files changed, 117 insertions(+), 76 deletions(-) diff --git a/src/mame/drivers/m62.c b/src/mame/drivers/m62.c index 6897176d294..e1ce755b366 100644 --- a/src/mame/drivers/m62.c +++ b/src/mame/drivers/m62.c @@ -281,7 +281,7 @@ static ADDRESS_MAP_START( ldrun3_writeport, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0x00, 0x00) AM_WRITE(irem_sound_cmd_w) AM_RANGE(0x01, 0x01) AM_WRITE(m62_flipscreen_w) /* + coin counters */ AM_RANGE(0x80, 0x80) AM_WRITE(m62_vscroll_low_w) - /* 0x81 used too, don't know what for */ + AM_RANGE(0x81, 0x81) AM_WRITE(ldrun3_topbottom_mask_w) ADDRESS_MAP_END @@ -1391,7 +1391,7 @@ static MACHINE_DRIVER_START( ldrun3 ) /* video hardware */ MDRV_GFXDECODE(ldrun3) MDRV_VIDEO_START(ldrun2) - MDRV_VIDEO_UPDATE(ldrun) + MDRV_VIDEO_UPDATE(ldrun3) MACHINE_DRIVER_END diff --git a/src/mame/includes/m62.h b/src/mame/includes/m62.h index 963f4230a95..b14c583ad5f 100644 --- a/src/mame/includes/m62.h +++ b/src/mame/includes/m62.h @@ -18,6 +18,7 @@ WRITE8_HANDLER( m62_hscroll_low_w ); WRITE8_HANDLER( m62_hscroll_high_w ); WRITE8_HANDLER( m62_vscroll_low_w ); WRITE8_HANDLER( m62_vscroll_high_w ); +WRITE8_HANDLER( ldrun3_topbottom_mask_w ); extern UINT8 *m62_tileram; extern UINT8 *m62_textram; @@ -30,6 +31,8 @@ VIDEO_UPDATE( ldrun ); VIDEO_START( ldrun2 ); +VIDEO_UPDATE( ldrun3 ); + VIDEO_START( battroad ); VIDEO_UPDATE( battroad ); diff --git a/src/mame/video/m62.c b/src/mame/video/m62.c index d3175e8a097..84eb58880d3 100644 --- a/src/mame/video/m62.c +++ b/src/mame/video/m62.c @@ -28,6 +28,8 @@ static const UINT8 *sprite_height_prom; static INT32 m62_background_hscroll; static INT32 m62_background_vscroll; +static int ldrun3_topbottom_mask; + static UINT8 *irem_textram; static size_t irem_textram_size; @@ -406,9 +408,6 @@ static void m62_start( tile_get_info_func tile_get_info, int rows, int cols, int m62_background_hscroll = 0; m62_background_vscroll = 0; - tilemap_set_transmask(m62_background,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ - tilemap_set_transmask(m62_background,1,0x0001,0xfffe); /* split type 1 has pen 0 transparent in front half */ - register_savestate(); if( rows != 0 ) @@ -458,14 +457,19 @@ static TILE_GET_INFO( get_kungfum_bg_tile_info ) /* is the following right? */ if( ( tile_index / 64 ) < 6 || ( ( color & 0x1f ) >> 1 ) > 0x0c ) { - tileinfo->group = 1; + tileinfo->category = 1; } else { - tileinfo->group = 0; + tileinfo->category = 0; } } +VIDEO_START( kungfum ) +{ + m62_start( get_kungfum_bg_tile_info, 32, 0, 8, 8, 64, 32 ); +} + VIDEO_UPDATE( kungfum ) { int i; @@ -477,16 +481,12 @@ VIDEO_UPDATE( kungfum ) { tilemap_set_scrollx( m62_background, i, m62_background_hscroll ); } - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_LAYER1, 0 ); + tilemap_draw( bitmap, cliprect, m62_background, 0, 0 ); draw_sprites( screen->machine, bitmap, cliprect, 0x1f, 0x00, 0x00 ); - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_LAYER0, 0 ); + tilemap_draw( bitmap, cliprect, m62_background, 1, 0 ); return 0; } -VIDEO_START( kungfum ) -{ - m62_start( get_kungfum_bg_tile_info, 32, 0, 8, 8, 64, 32 ); -} static TILE_GET_INFO( get_ldrun_bg_tile_info ) @@ -512,6 +512,13 @@ static TILE_GET_INFO( get_ldrun_bg_tile_info ) } } +VIDEO_START( ldrun ) +{ + m62_start( get_ldrun_bg_tile_info, 1, 1, 8, 8, 64, 32 ); + tilemap_set_transmask(m62_background,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ + tilemap_set_transmask(m62_background,1,0x0001,0xfffe); /* split type 1 has pen 0 transparent in front half */ +} + VIDEO_UPDATE( ldrun ) { tilemap_set_scrollx( m62_background, 0, m62_background_hscroll ); @@ -524,11 +531,6 @@ VIDEO_UPDATE( ldrun ) return 0; } -VIDEO_START( ldrun ) -{ - m62_start( get_ldrun_bg_tile_info, 1, 1, 8, 8, 64, 32 ); -} - static TILE_GET_INFO( get_ldrun2_bg_tile_info ) { int code; @@ -555,8 +557,38 @@ static TILE_GET_INFO( get_ldrun2_bg_tile_info ) VIDEO_START( ldrun2 ) { m62_start( get_ldrun2_bg_tile_info, 1, 1, 8, 8, 64, 32 ); + tilemap_set_transmask(m62_background,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ + tilemap_set_transmask(m62_background,1,0x0001,0xfffe); /* split type 1 has pen 0 transparent in front half */ } + + +WRITE8_HANDLER( ldrun3_topbottom_mask_w ) +{ + ldrun3_topbottom_mask = data & 1; +} + +VIDEO_UPDATE( ldrun3 ) +{ + VIDEO_UPDATE_CALL(ldrun); + + if (ldrun3_topbottom_mask) + { + rectangle my_cliprect = *cliprect; + + my_cliprect.min_y = 0*8; + my_cliprect.max_y = 1*8-1; + fillbitmap(bitmap,get_black_pen(screen->machine),&my_cliprect); + + my_cliprect.min_y = 31*8; + my_cliprect.max_y = 32*8-1; + fillbitmap(bitmap,get_black_pen(screen->machine),&my_cliprect); + } + + return 0; +} + + static TILE_GET_INFO( get_battroad_bg_tile_info ) { int code; @@ -589,6 +621,14 @@ static TILE_GET_INFO( get_battroad_fg_tile_info ) SET_TILE_INFO( 2, code | ( ( color & 0x40 ) << 3 ) | ( ( color & 0x10 ) << 4 ), color & 0x0f, 0 ); } +VIDEO_START( battroad ) +{ + m62_start( get_battroad_bg_tile_info, 1, 1, 8, 8, 64, 32 ); + m62_textlayer( get_battroad_fg_tile_info, 1, 1, 8, 8, 32, 32 ); + tilemap_set_transmask(m62_background,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ + tilemap_set_transmask(m62_background,1,0x0001,0xfffe); /* split type 1 has pen 0 transparent in front half */ +} + VIDEO_UPDATE( battroad ) { tilemap_set_scrollx( m62_background, 0, m62_background_hscroll ); @@ -605,12 +645,6 @@ VIDEO_UPDATE( battroad ) return 0; } -VIDEO_START( battroad ) -{ - m62_start( get_battroad_bg_tile_info, 1, 1, 8, 8, 64, 32 ); - m62_textlayer( get_battroad_fg_tile_info, 1, 1, 8, 8, 32, 32 ); -} - /* almost identical but scrolling background, more characters, */ /* no char x flip, and more sprites */ @@ -623,20 +657,20 @@ static TILE_GET_INFO( get_ldrun4_bg_tile_info ) SET_TILE_INFO( 0, code | ( ( color & 0xc0 ) << 2 ) | ( ( color & 0x20 ) << 5 ), color & 0x1f, 0 ); } +VIDEO_START( ldrun4 ) +{ + m62_start( get_ldrun4_bg_tile_info, 1, 0, 8, 8, 64, 32 ); +} + VIDEO_UPDATE( ldrun4 ) { tilemap_set_scrollx( m62_background, 0, m62_background_hscroll ); - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_OPAQUE, 0 ); + tilemap_draw( bitmap, cliprect, m62_background, 0, 0 ); draw_sprites( screen->machine, bitmap, cliprect, 0x1f, 0x00, 0x00 ); return 0; } -VIDEO_START( ldrun4 ) -{ - m62_start( get_ldrun4_bg_tile_info, 1, 0, 8, 8, 64, 32 ); -} - static TILE_GET_INFO( get_lotlot_bg_tile_info ) { @@ -662,6 +696,12 @@ static TILE_GET_INFO( get_lotlot_fg_tile_info ) SET_TILE_INFO( 2, code | ( ( color & 0xc0 ) << 2 ), color & 0x1f, 0 ); } +VIDEO_START( lotlot ) +{ + m62_start( get_lotlot_bg_tile_info, 1, 1, 12, 10, 32, 64 ); + m62_textlayer( get_lotlot_fg_tile_info, 1, 1, 12, 10, 32, 64 ); +} + VIDEO_UPDATE( lotlot ) { tilemap_set_scrollx( m62_background, 0, m62_background_hscroll - 64 ); @@ -670,18 +710,12 @@ VIDEO_UPDATE( lotlot ) tilemap_set_scrolly( m62_foreground, 0, 32 ); tilemap_set_transparent_pen( m62_foreground, 0 ); - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_OPAQUE, 0 ); + tilemap_draw( bitmap, cliprect, m62_background, 0, 0 ); tilemap_draw( bitmap, cliprect, m62_foreground, 0, 0 ); draw_sprites( screen->machine, bitmap, cliprect, 0x1f, 0x00, 0x00 ); return 0; } -VIDEO_START( lotlot ) -{ - m62_start( get_lotlot_bg_tile_info, 1, 1, 12, 10, 32, 64 ); - m62_textlayer( get_lotlot_fg_tile_info, 1, 1, 12, 10, 32, 64 ); -} - WRITE8_HANDLER( kidniki_text_vscroll_low_w ) { @@ -721,20 +755,6 @@ static TILE_GET_INFO( get_kidniki_fg_tile_info ) SET_TILE_INFO( 2, code | ( ( color & 0xc0 ) << 2 ), color & 0x1f, 0 ); } -VIDEO_UPDATE( kidniki ) -{ - tilemap_set_scrollx( m62_background, 0, m62_background_hscroll ); - tilemap_set_scrollx( m62_foreground, 0, -64 ); - tilemap_set_scrolly( m62_foreground, 0, kidniki_text_vscroll + 128 ); - tilemap_set_transparent_pen( m62_foreground, 0 ); - - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_LAYER1, 0 ); - draw_sprites( screen->machine, bitmap, cliprect, 0x1f, 0x00, 0x00 ); - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_LAYER0, 0 ); - tilemap_draw( bitmap, cliprect, m62_foreground, 0, 0 ); - return 0; -} - VIDEO_START( kidniki ) { m62_background = tilemap_create( get_kidniki_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32 ); @@ -750,6 +770,20 @@ VIDEO_START( kidniki ) m62_textlayer( get_kidniki_fg_tile_info, 1, 1, 12, 8, 32, 64 ); } +VIDEO_UPDATE( kidniki ) +{ + tilemap_set_scrollx( m62_background, 0, m62_background_hscroll ); + tilemap_set_scrollx( m62_foreground, 0, -64 ); + tilemap_set_scrolly( m62_foreground, 0, kidniki_text_vscroll + 128 ); + tilemap_set_transparent_pen( m62_foreground, 0 ); + + tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_LAYER1, 0 ); + draw_sprites( screen->machine, bitmap, cliprect, 0x1f, 0x00, 0x00 ); + tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_LAYER0, 0 ); + tilemap_draw( bitmap, cliprect, m62_foreground, 0, 0 ); + return 0; +} + WRITE8_HANDLER( spelunkr_palbank_w ) { @@ -780,6 +814,12 @@ if (color&0xe0) popmessage("fg tilemap %x %x",tile_index,color&0xe0); SET_TILE_INFO( 2, code | ( ( color & 0x10 ) << 4 ), ( color & 0x0f ) | ( spelunkr_palbank << 4 ), 0 ); } +VIDEO_START( spelunkr ) +{ + m62_start( get_spelunkr_bg_tile_info, 1, 1, 8, 8, 64, 64 ); + m62_textlayer( get_spelunkr_fg_tile_info, 1, 1, 12, 8, 32, 32 ); +} + VIDEO_UPDATE( spelunkr ) { tilemap_set_scrollx( m62_background, 0, m62_background_hscroll ); @@ -788,18 +828,12 @@ VIDEO_UPDATE( spelunkr ) tilemap_set_scrolly( m62_foreground, 0, 0 ); tilemap_set_transparent_pen( m62_foreground, 0 ); - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_OPAQUE, 0 ); + tilemap_draw( bitmap, cliprect, m62_background, 0, 0 ); draw_sprites( screen->machine, bitmap, cliprect, 0x1f, 0x00, 0x00 ); tilemap_draw( bitmap, cliprect, m62_foreground, 0, 0 ); return 0; } -VIDEO_START( spelunkr ) -{ - m62_start( get_spelunkr_bg_tile_info, 1, 1, 8, 8, 64, 64 ); - m62_textlayer( get_spelunkr_fg_tile_info, 1, 1, 12, 8, 32, 32 ); -} - WRITE8_HANDLER( spelunk2_gfxport_w ) { @@ -822,6 +856,12 @@ static TILE_GET_INFO( get_spelunk2_bg_tile_info ) SET_TILE_INFO( 0, code | ( ( color & 0xf0 ) << 4 ), ( color & 0x0f ) | ( spelunkr_palbank << 4 ), 0 ); } +VIDEO_START( spelunk2 ) +{ + m62_start( get_spelunk2_bg_tile_info, 1, 1, 8, 8, 64, 64 ); + m62_textlayer( get_spelunkr_fg_tile_info, 1, 1, 12, 8, 32, 32 ); +} + VIDEO_UPDATE( spelunk2 ) { tilemap_set_scrollx( m62_background, 0, m62_background_hscroll - 1); @@ -830,18 +870,12 @@ VIDEO_UPDATE( spelunk2 ) tilemap_set_scrolly( m62_foreground, 0, 0 ); tilemap_set_transparent_pen( m62_foreground, 0 ); - tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_OPAQUE, 0 ); + tilemap_draw( bitmap, cliprect, m62_background, 0, 0 ); draw_sprites( screen->machine, bitmap, cliprect, 0x1f, 0x00, 0x00 ); tilemap_draw( bitmap, cliprect, m62_foreground, 0, 0 ); return 0; } -VIDEO_START( spelunk2 ) -{ - m62_start( get_spelunk2_bg_tile_info, 1, 1, 8, 8, 64, 64 ); - m62_textlayer( get_spelunkr_fg_tile_info, 1, 1, 12, 8, 32, 32 ); -} - static TILE_GET_INFO( get_youjyudn_bg_tile_info ) { @@ -869,6 +903,14 @@ static TILE_GET_INFO( get_youjyudn_fg_tile_info ) SET_TILE_INFO( 2, code | ( ( color & 0xc0 ) << 2 ), ( color & 0x0f ), 0 ); } +VIDEO_START( youjyudn ) +{ + m62_start( get_youjyudn_bg_tile_info, 1, 0, 8, 16, 64, 16 ); + m62_textlayer( get_youjyudn_fg_tile_info, 1, 1, 12, 8, 32, 32 ); + tilemap_set_transmask(m62_background,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ + tilemap_set_transmask(m62_background,1,0x0001,0xfffe); /* split type 1 has pen 0 transparent in front half */ +} + VIDEO_UPDATE( youjyudn ) { tilemap_set_scrollx( m62_background, 0, m62_background_hscroll ); @@ -883,12 +925,6 @@ VIDEO_UPDATE( youjyudn ) return 0; } -VIDEO_START( youjyudn ) -{ - m62_start( get_youjyudn_bg_tile_info, 1, 0, 8, 16, 64, 16 ); - m62_textlayer( get_youjyudn_fg_tile_info, 1, 1, 12, 8, 32, 32 ); -} - WRITE8_HANDLER( horizon_scrollram_w ) { @@ -912,6 +948,13 @@ static TILE_GET_INFO( get_horizon_bg_tile_info ) } } +VIDEO_START( horizon ) +{ + m62_start( get_horizon_bg_tile_info, 32, 0, 8, 8, 64, 32 ); + tilemap_set_transmask(m62_background,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ + tilemap_set_transmask(m62_background,1,0x0001,0xfffe); /* split type 1 has pen 0 transparent in front half */ +} + VIDEO_UPDATE( horizon ) { int i; @@ -924,8 +967,3 @@ VIDEO_UPDATE( horizon ) tilemap_draw( bitmap, cliprect, m62_background, TILEMAP_DRAW_LAYER0, 0 ); return 0; } - -VIDEO_START( horizon ) -{ - m62_start( get_horizon_bg_tile_info, 32, 0, 8, 8, 64, 32 ); -}