From c7baadaa7cf82e09ce6c02d2d212bf8e16e34f39 Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Sat, 17 May 2014 01:24:24 +0000 Subject: [PATCH] neogeo: simplify sprite_on_scanline calculation (nw) --- src/mame/video/neogeo_spr.c | 19 +++---------------- src/mame/video/neogeo_spr.h | 3 +-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/mame/video/neogeo_spr.c b/src/mame/video/neogeo_spr.c index cefa583a403..2cb844b47da 100644 --- a/src/mame/video/neogeo_spr.c +++ b/src/mame/video/neogeo_spr.c @@ -298,23 +298,10 @@ static const int zoom_x_tables[][16] = }; -inline int neosprite_base_device::rows_to_height(int rows) + +inline bool neosprite_base_device::sprite_on_scanline(int scanline, int y, int rows) { - if ((rows == 0) || (rows > 0x20)) - rows = 0x20; - - return rows * 0x10; -} - - -inline int neosprite_base_device::sprite_on_scanline(int scanline, int y, int rows) -{ - /* check if the current scanline falls inside this sprite, - two possible scenerios, wrap around or not */ - int max_y = (y + rows_to_height(rows) - 1) & 0x1ff; - - return (((max_y >= y) && (scanline >= y) && (scanline <= max_y)) || - ((max_y < y) && ((scanline >= y) || (scanline <= max_y)))); + return (rows == 0) || (rows >= 0x20) || ((scanline - y) & 0x1ff) < (rows * 0x10); } diff --git a/src/mame/video/neogeo_spr.h b/src/mame/video/neogeo_spr.h index 48dbead11bf..d269246c84c 100644 --- a/src/mame/video/neogeo_spr.h +++ b/src/mame/video/neogeo_spr.h @@ -36,8 +36,7 @@ public: void create_auto_animation_timer( ); void start_auto_animation_timer( ); void neogeo_set_fixed_layer_source( UINT8 data ); - inline int rows_to_height(int rows); - inline int sprite_on_scanline(int scanline, int y, int rows); + inline bool sprite_on_scanline(int scanline, int y, int rows); virtual void draw_pixel(int romaddr, UINT32* dst, pen_t *line_pens) = 0; void draw_sprites( bitmap_rgb32 &bitmap, int scanline ); void parse_sprites( int scanline );