From 1e887cf7197e31a6d279d7baebb126905b6d142f Mon Sep 17 00:00:00 2001 From: Pierpaolo Prazzoli Date: Fri, 15 May 2009 09:43:37 +0000 Subject: [PATCH] Fixed 03176: cheekyms: Graphic Regression [Pierpaolo Prazzoli] --- src/mame/drivers/cheekyms.c | 4 +- src/mame/video/cheekyms.c | 83 ++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/src/mame/drivers/cheekyms.c b/src/mame/drivers/cheekyms.c index 1c30aa5141b..1bb521f0e5f 100644 --- a/src/mame/drivers/cheekyms.c +++ b/src/mame/drivers/cheekyms.c @@ -41,7 +41,7 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READ_PORT("DSW") AM_RANGE(0x01, 0x01) AM_READ_PORT("INPUTS") - AM_RANGE(0x20, 0x3f) AM_WRITE(SMH_RAM) AM_BASE(&cheekyms_spriteram) + AM_RANGE(0x20, 0x3f) AM_WRITEONLY AM_BASE(&cheekyms_spriteram) AM_RANGE(0x40, 0x40) AM_WRITE(cheekyms_port_40_w) AM_RANGE(0x80, 0x80) AM_WRITE(cheekyms_port_80_w) AM_BASE(&cheekyms_port_80) ADDRESS_MAP_END @@ -180,4 +180,4 @@ ROM_END -GAME( 1980, cheekyms, 0, cheekyms, cheekyms, 0, ROT270, "Universal", "Cheeky Mouse", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1980, cheekyms, 0, cheekyms, cheekyms, 0, ROT270, "Universal", "Cheeky Mouse", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/video/cheekyms.c b/src/mame/video/cheekyms.c index b9e3aeb237d..4c7d2367e0a 100644 --- a/src/mame/video/cheekyms.c +++ b/src/mame/video/cheekyms.c @@ -17,7 +17,7 @@ UINT8 *cheekyms_spriteram; UINT8 *cheekyms_port_80; static tilemap *cheekyms_tilemap; - +static bitmap_t *bitmap_buffer; /* bit 3 and 7 of the char color PROMs are used for something -- not currently emulated - thus GAME_IMPERFECT_GRAPHICS */ @@ -97,9 +97,14 @@ static TILE_GET_INFO( cheekyms_get_tile_info ) SET_TILE_INFO(0, code, color, 0); } - VIDEO_START( cheekyms ) { + int width, height; + + width = video_screen_get_width(machine->primary_screen); + height = video_screen_get_height(machine->primary_screen); + bitmap_buffer = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + cheekyms_tilemap = tilemap_create(machine, cheekyms_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32); tilemap_set_transparent_pen(cheekyms_tilemap, 0); } @@ -146,57 +151,51 @@ static void draw_sprites(gfx_element **gfx, bitmap_t *bitmap, const rectangle *c VIDEO_UPDATE( cheekyms ) { - #define SCROLL_X_MIN 8 - #define SCROLL_X_MAX 12 - #define SCROLL_Y_MIN 6 - #define SCROLL_Y_MAX 25 - - const rectangle clip_no_scroll_top = { 0*8, 32*8-1, 0*8, SCROLL_Y_MIN*8-1 }; - const rectangle clip_no_scroll_bottom = { 0*8, 32*8-1, (SCROLL_Y_MAX+1)*8, 32*8-1 }; - const rectangle clip_no_scroll_left_nf = { 0*8, SCROLL_X_MIN*8-1, SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 }; - const rectangle clip_no_scroll_right_nf = { (SCROLL_X_MAX+1)*8, 32*8-1, SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 }; - const rectangle clip_no_scroll_left_f = { (32-SCROLL_X_MIN)*8, 32*8-1, SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 }; - const rectangle clip_no_scroll_right_f = { 0*8, (32-SCROLL_X_MAX-1)*8-1, SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 }; - const rectangle clip_scroll_nf = { SCROLL_X_MIN*8, 13*8-1, SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 }; - const rectangle clip_scroll_f = { (32-SCROLL_X_MAX-1)*8, (32-SCROLL_X_MIN)*8-1, SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 }; - + int y,x; + int scrolly = ((*cheekyms_port_80 >> 3) & 0x07); int flip = *cheekyms_port_80 & 0x80; tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); tilemap_set_flip(ALL_TILEMAPS, flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); bitmap_fill(bitmap, cliprect, 0); + bitmap_fill(bitmap_buffer, cliprect, 0); /* sprites go under the playfield */ draw_sprites(screen->machine->gfx, bitmap, cliprect, flip); - /* draw the non-scrolling parts of the playfield first */ - tilemap_set_scrolly(cheekyms_tilemap, 0, 0); - tilemap_draw(bitmap, &clip_no_scroll_top, cheekyms_tilemap, 0, 0); - tilemap_draw(bitmap, &clip_no_scroll_bottom, cheekyms_tilemap, 0, 0); - - if (flip) + /* draw the tilemap to a temp bitmap */ + tilemap_draw(bitmap_buffer, cliprect, cheekyms_tilemap, 0, 0); + + /* draw the tilemap to the final bitmap applying the scroll to the man character */ + for(y = cliprect->min_y; y <= cliprect->max_y; y++) { - tilemap_draw(bitmap, &clip_no_scroll_left_f, cheekyms_tilemap, 0, 0); - tilemap_draw(bitmap, &clip_no_scroll_right_f, cheekyms_tilemap, 0, 0); + for(x = cliprect->min_x; x <= cliprect->max_x; x++) + { + int in_man_area; + + if(flip) + { + in_man_area = (x >= (32-12-1)*8 && x < (32-8)*8 && y > 5*8 && y < 27*8); + } + else + { + in_man_area = (x >= 8*8 && x < 12*8 && y > 5*8 && y < 27*8); + } + + if(in_man_area) + { + if ((y + scrolly) < 27*8 && *BITMAP_ADDR16(bitmap_buffer, y + scrolly, x) != 0) + *BITMAP_ADDR16(bitmap, y, x) = *BITMAP_ADDR16(bitmap_buffer, y + scrolly, x); + } + else + { + if(*BITMAP_ADDR16(bitmap_buffer, y, x) != 0) + *BITMAP_ADDR16(bitmap, y, x) = *BITMAP_ADDR16(bitmap_buffer, y, x); + } + } } - else - { - tilemap_draw(bitmap, &clip_no_scroll_left_nf, cheekyms_tilemap, 0, 0); - tilemap_draw(bitmap, &clip_no_scroll_right_nf, cheekyms_tilemap, 0, 0); - } - - /* now the scrolling part */ - if (flip) - { - tilemap_set_scrolly(cheekyms_tilemap, 0, -((*cheekyms_port_80 >> 3) & 0x07)); - tilemap_draw(bitmap, &clip_scroll_f, cheekyms_tilemap, 0, 0); - } - else - { - tilemap_set_scrolly(cheekyms_tilemap, 0, (*cheekyms_port_80 >> 3) & 0x07); - tilemap_draw(bitmap, &clip_scroll_nf, cheekyms_tilemap, 0, 0); - } - + + return 0; }