From ed961330b6e015401c3cf281d30e351790d0bfca Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Fri, 28 Mar 2008 09:28:36 +0000 Subject: [PATCH] Added override to allow individual games to change sprite clipping behavior. Fixed sprite clipping offset to be 0-15 as I originally derived.... --- src/mame/drivers/galaxian.c | 20 ++++++++++++++++++-- src/mame/drivers/galdrvr.c | 2 +- src/mame/includes/galaxian.h | 2 ++ src/mame/video/galaxian.c | 12 +++++++----- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index f26adba418b..1ab3c086383 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -2049,6 +2049,8 @@ static void common_init( irq_line = INPUT_LINE_NMI; galaxian_frogger_adjust = FALSE; galaxian_sfx_tilemap = FALSE; + galaxian_sprite_clip_start = 16; + galaxian_sprite_clip_end = 255; galaxian_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : galaxian_draw_bullet; galaxian_draw_background_ptr = (draw_background != NULL) ? draw_background : galaxian_draw_background; galaxian_extend_tile_info_ptr = extend_tile_info; @@ -2095,7 +2097,7 @@ static DRIVER_INIT( galaxian ) static DRIVER_INIT( nolock ) { /* same as galaxian... */ - driver_init_galaxian(machine); + DRIVER_INIT_CALL(galaxian); /* ...but coin lockout disabled/disconnected */ memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP); @@ -2205,6 +2207,20 @@ static DRIVER_INIT( moonqsr ) } +static DRIVER_INIT( pacmanbl ) +{ + /* same as galaxian... */ + DRIVER_INIT_CALL(galaxian); + + /* ...but coin lockout disabled/disconnected */ + memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP); + + /* also shift the sprite clip offset */ + galaxian_sprite_clip_start = 7; + galaxian_sprite_clip_end = 246; +} + + static DRIVER_INIT( devilfsg ) { /* video extensions */ @@ -2444,7 +2460,7 @@ static DRIVER_INIT( sfx ) /* basic configuration */ common_init(machine, scramble_draw_bullet, scramble_draw_background, upper_extend_tile_info, NULL); galaxian_sfx_tilemap = TRUE; - + /* sfx uses 3 x 8255, so we need a non-standard interface */ ppi8255_init(&sfx_ppi8255_intf); diff --git a/src/mame/drivers/galdrvr.c b/src/mame/drivers/galdrvr.c index 06279b2039e..fd89dd2cc67 100644 --- a/src/mame/drivers/galdrvr.c +++ b/src/mame/drivers/galdrvr.c @@ -4639,7 +4639,7 @@ GAME( 1981, batman2, phoenix, galaxian, batman2, batman2, ROT270, "bootleg", /* separate tile/sprite ROMs */ GAME( 1981, streakng, 0, pacmanbl, streakng, galaxian, ROT90, "Shoei", "Streaking", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE ) -GAME( 1981, pacmanbl, puckman, pacmanbl, pacmanbl, nolock, ROT270, "bootleg", "Pac-Man (Galaxian hardware)", GAME_SUPPORTS_SAVE ) +GAME( 1981, pacmanbl, puckman, pacmanbl, pacmanbl, pacmanbl, ROT270, "bootleg", "Pac-Man (Galaxian hardware)", GAME_SUPPORTS_SAVE ) /* separate tile/sprite ROMs, plus INT instead of NMI */ GAME( 1984, devilfsg, devilfsh, pacmanbl, devilfsg, devilfsg, ROT270, "Vision / Artic", "Devil Fish (Galaxian hardware, bootleg?)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index f077b84b9af..c25a6fc0921 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -30,6 +30,8 @@ extern UINT8 galaxian_frogger_adjust; extern UINT8 galaxian_sfx_tilemap; +extern UINT8 galaxian_sprite_clip_start; +extern UINT8 galaxian_sprite_clip_end; PALETTE_INIT( galaxian ); diff --git a/src/mame/video/galaxian.c b/src/mame/video/galaxian.c index 1e2fd68d214..aaeaf1d1a4b 100644 --- a/src/mame/video/galaxian.c +++ b/src/mame/video/galaxian.c @@ -245,6 +245,8 @@ galaxian_extend_sprite_info_func galaxian_extend_sprite_info_ptr; /* global tweaks */ UINT8 galaxian_frogger_adjust; UINT8 galaxian_sfx_tilemap; +UINT8 galaxian_sprite_clip_start; +UINT8 galaxian_sprite_clip_end; @@ -587,11 +589,11 @@ static void sprites_draw(running_machine *machine, bitmap_t *bitmap, const recta rectangle clip = *cliprect; int sprnum; - /* sprites are hard-clipped at H=16 and H=256, regardless of flipping */ - /* because we normalize the H counter to 0, this effectively clips between */ - /* 8 and 248 */ - clip.min_x = MAX(clip.min_x, (16-8)*GALAXIAN_XSCALE); - clip.max_x = MIN(clip.max_x, (256-8)*GALAXIAN_XSCALE - 1); + /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */ + /* according to the schematics, it should be the first 16 pixels; however, */ + /* some bootlegs demonstrate that this can be shifted to other positions. */ + clip.min_x = MAX(clip.min_x, galaxian_sprite_clip_start * GALAXIAN_XSCALE); + clip.max_x = MIN(clip.max_x, (galaxian_sprite_clip_end + 1) * GALAXIAN_XSCALE - 1); /* The line buffer is only written if it contains a '0' currently; */ /* it is cleared during the visible area, and populated during HBLANK */