ironhors,bestleag: calculate spriteram bounds end

This commit is contained in:
hap 2022-11-05 14:15:05 +01:00
parent 85408be039
commit e495d9ab38
2 changed files with 15 additions and 15 deletions

View File

@ -142,7 +142,8 @@ Note: sprite chip is different than the other Big Striker sets and they
*/
void bestleag_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint16_t *src = m_spriteram + 0x16/2;
int start = 0x16/2;
int end = m_spriteram.length() - (start & 3);
/*
@ -150,16 +151,16 @@ void bestleag_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
*/
for (int offs = 0; offs < 0x7f4; offs += 4)
for (int offs = start; offs < end; offs += 4)
{
int code = src[offs+3] & 0xfff;
int color = (src[offs+2] & 0xf000) >> 12;
int sx = (src[offs+2] & 0x1ff) - 20;
int sy = (0xff - (src[offs+0] & 0xff)) - 15;
int flipx = (src[offs+0] & 0x4000) >> 14;
int code = m_spriteram[offs+3] & 0xfff;
int color = (m_spriteram[offs+2] & 0xf000) >> 12;
int sx = (m_spriteram[offs+2] & 0x1ff) - 20;
int sy = (0xff - (m_spriteram[offs+0] & 0xff)) - 15;
int flipx = (m_spriteram[offs+0] & 0x4000) >> 14;
/* Sprite list end code */
if(src[offs+0] & 0x2000)
if(m_spriteram[offs+0] & 0x2000)
return;
/* it can change sprites color mask like the original set */

View File

@ -286,15 +286,14 @@ void ironhors_state::video_start()
void ironhors_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t *sr;
if (m_spriterambank != 0)
sr = m_spriteram[0];
else
sr = m_spriteram[1];
int bank = m_spriterambank ? 0 : 1;
uint8_t *sr = m_spriteram[bank];
// note that it has 5 bytes per sprite
for (int offs = 0; offs <= 250; offs += 5)
int end = m_spriteram[bank].bytes();
end -= end % 5;
for (int offs = 0; offs < end; offs += 5)
{
int sx = sr[offs + 3];
int sy = sr[offs + 2];