summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/mame/includes/shadfrce.h2
-rw-r--r--src/mame/video/shadfrce.c59
2 files changed, 39 insertions, 22 deletions
diff --git a/src/mame/includes/shadfrce.h b/src/mame/includes/shadfrce.h
index 33dcff4409f..652979dd13d 100644
--- a/src/mame/includes/shadfrce.h
+++ b/src/mame/includes/shadfrce.h
@@ -83,5 +83,5 @@ public:
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof(screen_device &screen, bool state);
- void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
+ void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offset );
};
diff --git a/src/mame/video/shadfrce.c b/src/mame/video/shadfrce.c
index 8b68a623b61..5a01b4d7b58 100644
--- a/src/mame/video/shadfrce.c
+++ b/src/mame/video/shadfrce.c
@@ -101,8 +101,10 @@ WRITE16_MEMBER(shadfrce_state::bg1scrolly_w)
-void shadfrce_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
+void shadfrce_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offset )
{
+
+
/* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt |
| ---- ---- -pCc cccX | ---- ---- xxxx xxxx | ---- ---- ---- ---- | ---- ---- ---- ---- | */
@@ -121,29 +123,43 @@ void shadfrce_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
UINT16 *finish = m_spvideoram_old;
UINT16 *source = finish + 0x2000/2 - 8;
int hcount;
- while( source>=finish )
+ while (source >= finish)
{
- int ypos = 0x100 - (((source[0] & 0x0003) << 8) | (source[1] & 0x00ff));
- int xpos = (((source[4] & 0x0001) << 8) | (source[5] & 0x00ff)) + 1;
- int tile = ((source[2] & 0x00ff) << 8) | (source[3] & 0x00ff);
- int height = (source[0] & 0x00e0) >> 5;
+
int enable = ((source[0] & 0x0004));
- int flipx = ((source[0] & 0x0010) >> 4);
- int flipy = ((source[0] & 0x0008) >> 3);
- int pal = ((source[4] & 0x003e));
- int pri_mask = (source[4] & 0x0040) ? 0x02 : 0x00;
-
- if (pal & 0x20) pal ^= 0x60; /* skip hole */
-
- height++;
- if (enable) {
- for (hcount=0;hcount<height;hcount++) {
- gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16,screen.priority(),pri_mask,0);
- gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16,screen.priority(),pri_mask,0);
- gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16+0x200,screen.priority(),pri_mask,0);
- gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16+0x200,screen.priority(),pri_mask,0);
+
+ if (enable)
+ {
+ int ypos = 0x100 - (((source[0] & 0x0003) << 8) | (source[1] & 0x00ff));
+ int height = ((source[0] & 0x00e0) >> 5) ;
+ height += 1;
+
+ int bottom = ypos + y_offset;
+ int top = bottom - height * 16;
+
+ if (top > cliprect.max_y || bottom <= cliprect.min_y)
+ {
+ source -= 8;
+ continue;
+ }
+
+ int xpos = (((source[4] & 0x0001) << 8) | (source[5] & 0x00ff)) + 1;
+ int tile = ((source[2] & 0x00ff) << 8) | (source[3] & 0x00ff);
+ int flipx = ((source[0] & 0x0010) >> 4);
+ int flipy = ((source[0] & 0x0008) >> 3);
+ int pal = ((source[4] & 0x003e));
+ int pri_mask = (source[4] & 0x0040) ? 0x02 : 0x00;
+
+ if (pal & 0x20) pal ^= 0x60; /* skip hole */
+
+
+ for (hcount = 0; hcount < height; hcount++) {
+ gfx->prio_transpen(bitmap, cliprect, tile + hcount, pal, flipx, flipy, xpos, bottom-16, screen.priority(), pri_mask, 0);
+ gfx->prio_transpen(bitmap, cliprect, tile + hcount, pal, flipx, flipy, xpos - 0x200, bottom-16, screen.priority(), pri_mask, 0); // x wraparound
+ bottom -= 16;
}
}
+
source-=8;
}
}
@@ -156,7 +172,8 @@ UINT32 shadfrce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
{
m_bg1tilemap->draw(screen, bitmap, cliprect, 0,0);
m_bg0tilemap->draw(screen, bitmap, cliprect, 0,1);
- draw_sprites(screen,bitmap,cliprect);
+ draw_sprites(screen,bitmap,cliprect, 0);
+ draw_sprites(screen,bitmap,cliprect, 0x200); // y-wrap
m_fgtilemap->draw(screen, bitmap, cliprect, 0,0);
}
else