From d901fed61a94d153720748a9d4b432f083c987ef Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Tue, 11 Sep 2012 23:32:50 +0000 Subject: [PATCH] Wrap-around fix from Haze for ZT, nw --- src/mame/drivers/raiden2.c | 39 ++++++++++++++++++++++++++++++++++---- src/mame/machine/seicop.c | 2 +- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/raiden2.c b/src/mame/drivers/raiden2.c index 02db5f74649..57099efd664 100644 --- a/src/mame/drivers/raiden2.c +++ b/src/mame/drivers/raiden2.c @@ -680,9 +680,6 @@ void raiden2_state::draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int xflip, yflip; int xstep, ystep; - if (sx & 0x8000) sx -= 0x10000; - if (sy & 0x8000) sy -= 0x10000; - ytlim = (source[0] >> 12) & 0x7; xtlim = (source[0] >> 8) & 0x7; @@ -714,6 +711,12 @@ void raiden2_state::draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, { for (ytiles = 0; ytiles < ytlim; ytiles++) { + /* note this wraparound handling could be wrong if some of the COP maths is wrong */ + +#define ZEROTEAM_MASK_X (0x1ff) // causes a blank square in the corner of zero team, but otherwise the thrusters of the ship in the r2 intro are clipped, using 0x8000 as a sign bit instead of this logic works for r2, but not zero team +#define ZEROTEAM_MASK_Y (0x1ff) + + drawgfx_transpen( bitmap, cliprect, @@ -721,7 +724,35 @@ void raiden2_state::draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, tile_number, colr, yflip,xflip, - sx+xstep*xtiles,sy+ystep*ytiles,15); + (sx+xstep*xtiles)&ZEROTEAM_MASK_X,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y,15); + + drawgfx_transpen( + bitmap, + cliprect, + gfx, + tile_number, + colr, + yflip,xflip, + ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y,15); + + drawgfx_transpen( + bitmap, + cliprect, + gfx, + tile_number, + colr, + yflip,xflip, + (sx+xstep*xtiles)&ZEROTEAM_MASK_X,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200,15); + + drawgfx_transpen( + bitmap, + cliprect, + gfx, + tile_number, + colr, + yflip,xflip, + ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200,15); + tile_number++; } diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c index 988c5fdcd08..f30caeae71d 100644 --- a/src/mame/machine/seicop.c +++ b/src/mame/machine/seicop.c @@ -2502,7 +2502,7 @@ static WRITE16_HANDLER( generic_cop_w ) //if(dma_trigger != 0x87) //printf("SRC: %08x %08x DST:%08x SIZE:%08x TRIGGER: %08x %02x %02x\n",cop_dma_src[cop_dma_trigger] << 6,cop_dma_fade_table * 0x400,cop_dma_dst[cop_dma_trigger] << 6,cop_dma_size[cop_dma_trigger] << 5,cop_dma_trigger,pal_brightness_val,pal_brightness_mode); - src = (cop_dma_src[cop_dma_trigger] << 6) ; + src = (cop_dma_src[cop_dma_trigger] << 6); dst = (cop_dma_dst[cop_dma_trigger] << 6); size = ((cop_dma_size[cop_dma_trigger] << 5) - (cop_dma_dst[cop_dma_trigger] << 6) + 0x20)/2;