make screen flipping actually work in the system16 driver (it hasn't since the driver was rewritten)

this makes SDI playable again (level 2 onwards had no sprites and completely broken backgrounds)
it also makes Super League and Excite League look correct, both are cocktail only games and have never really worked.
This commit is contained in:
David Haywood 2015-10-02 22:03:58 +01:00
parent cfc2a04ea1
commit 1e61bf70fb
3 changed files with 93 additions and 39 deletions

View File

@ -97,7 +97,7 @@ WRITE16_MEMBER( sega_16bit_sprite_device::draw_write )
sega_hangon_sprite_device::sega_hangon_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_HANGON_SPRITES, "Sega Custom Sprites (Hang On)", tag, owner, "sega_hangon_sprite", __FILE__)
{
set_origin(189, -1);
set_local_origin(189, -1);
}
@ -273,7 +273,7 @@ void sega_hangon_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
sega_sharrier_sprite_device::sega_sharrier_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_SHARRIER_SPRITES, "Sega Custom Sprites (Space Harrier)", tag, owner, "sega_sharrier_sprite", __FILE__)
{
set_origin(189, -1);
set_local_origin(189, -1);
}
@ -460,7 +460,7 @@ void sega_sharrier_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cl
sega_sys16a_sprite_device::sega_sys16a_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_SYS16A_SPRITES, "Sega System 16A Sprites", tag, owner, "sega_sys16a_sprite", __FILE__)
{
set_origin(189, -1);
set_local_origin(189, -1, -189, -1);
}
@ -542,6 +542,11 @@ void sega_sys16a_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
bottom = 224 - temp;
xpos = 320 - xpos;
xdelta = -1;
set_origin(m_xoffs_flipped, m_yoffs_flipped);
}
else
{
set_origin(m_xoffs, m_yoffs);
}
// loop from top to bottom
@ -642,7 +647,7 @@ bootleg_sys16a_sprite_device::bootleg_sys16a_sprite_device(const machine_config
m_addrmap[5] = 5;
m_addrmap[6] = 6;
m_addrmap[7] = 7;
set_origin(189, -1);
set_local_origin(189, -1);
}
@ -724,6 +729,11 @@ void bootleg_sys16a_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &c
bottom = 224 - temp;
xpos = 320 - xpos;
xdelta = -1;
set_origin(m_xoffs_flipped, m_yoffs_flipped);
}
else
{
set_origin(m_xoffs, m_yoffs);
}
// loop from top to bottom
@ -817,7 +827,7 @@ void bootleg_sys16a_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &c
sega_sys16b_sprite_device::sega_sys16b_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_SYS16B_SPRITES, "Sega System 16B Sprites", tag, owner, "sega_16bit_sprite", __FILE__)
{
set_origin(184, 0x00);
set_local_origin(184, 0x00, -184, 0);
}
@ -907,6 +917,11 @@ void sega_sys16b_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
bottom = 224 - temp;
xpos = 320 - xpos;
xdelta = -1;
set_origin(m_xoffs_flipped, m_yoffs_flipped);
}
else
{
set_origin(m_xoffs, m_yoffs);
}
// loop from top to bottom
@ -1008,14 +1023,14 @@ sega_outrun_sprite_device::sega_outrun_sprite_device(const machine_config &mconf
: sega_16bit_sprite_device(mconfig, SEGA_OUTRUN_SPRITES, "Sega Custom Sprites (Out Run)", tag, owner, "sega_outrun_sprite", __FILE__),
m_is_xboard(false)
{
set_origin(189, 0x00);
set_local_origin(189, 0x00);
}
sega_outrun_sprite_device::sega_outrun_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, bool xboard_variant, const char *shortname, const char *source)
: sega_16bit_sprite_device(mconfig, SEGA_XBOARD_SPRITES, "Sega X-Board Sprites", tag, owner, shortname, source),
m_is_xboard(true)
{
set_origin(190, 0x00);
set_local_origin(190, 0x00);
}
@ -1026,6 +1041,7 @@ sega_outrun_sprite_device::sega_outrun_sprite_device(const machine_config &mconf
sega_xboard_sprite_device::sega_xboard_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_outrun_sprite_device(mconfig, tag, owner, clock, true, "sega_xboard_sprite", __FILE__)
{
}
@ -1070,6 +1086,8 @@ void sega_outrun_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
// ----cccc cccc---- Sprite color palette
// -------- ----llll 4-bit pixel data
//
set_origin(m_xoffs, m_yoffs);
// render the sprites in order
const UINT32 *spritebase = reinterpret_cast<const UINT32 *>(region()->base());
@ -1218,7 +1236,7 @@ void sega_outrun_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
sega_yboard_sprite_device::sega_yboard_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_YBOARD_SPRITES, "Sega Y-Board Sprites", tag, owner, "sega_yboard_sprite", __FILE__)
{
set_origin(0x600, 0x600);
set_local_origin(0x600, 0x600);
}
@ -1261,6 +1279,8 @@ void sega_yboard_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
// sprites without rotation RAM.
//
set_origin(m_xoffs, m_yoffs);
// clear out any scanlines we might be using
const UINT16 *rotatebase = m_segaic16_rotate[0].buffer ? m_segaic16_rotate[0].buffer : m_segaic16_rotate[0].rotateram;
rotatebase -= yorigin();

View File

@ -70,6 +70,22 @@ public:
// live configuration
void set_bank(int banknum, int offset) { m_bank[banknum] = offset; }
void set_flip(bool flip) { m_flip = flip; }
void set_local_origin(int x, int y)
{
m_xoffs_flipped = m_xoffs = x;
m_yoffs_flipped = m_yoffs = y;
set_origin(x, y);
}
void set_local_origin(int x, int y, int xf, int yf)
{
m_xoffs = x;
m_yoffs = y;
m_xoffs_flipped = xf;
m_yoffs_flipped = yf;
set_origin(x, y);
}
// write trigger memory handler
DECLARE_WRITE16_MEMBER( draw_write );
@ -81,6 +97,9 @@ protected:
// internal state
bool m_flip; // screen flip?
UINT8 m_bank[16]; // banking redirection
int m_xoffs, m_yoffs;
int m_xoffs_flipped, m_yoffs_flipped;
};

View File

@ -442,8 +442,20 @@ void draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitm
rectangle pageclip;
int page;
int width = screen.width();
int height = screen.height();
if (info->flip)
{
pages = BITSWAP16(pages,
3, 2, 1, 0,
7, 6, 5, 4,
11, 10, 9, 8,
15, 14, 13, 12
);
}
int width = screen.visible_area().max_x+1;
int height = screen.visible_area().max_y+1;
/* which half/halves of the virtual tilemap do we intersect in the X direction? */
if (xscroll < 64*8 - width)
@ -501,33 +513,36 @@ void draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitm
topmax = height - 1;
}
/* if the tilemap is flipped, we need to flip our sense within each quadrant */
// adjust split positions to compensate for flipping
if (info->flip)
{
if (leftmin != -1)
{
int temp = leftmin;
leftmin = width - 1 - leftmax;
leftmax = width - 1 - temp;
}
if (rightmin != -1)
{
int temp = rightmin;
rightmin = width - 1 - rightmax;
rightmax = width - 1 - temp;
}
if (topmin != -1)
{
int temp = topmin;
topmin = height - 1 - topmax;
topmax = height - 1 - temp;
}
if (bottommin != -1)
{
int temp = bottommin;
bottommin = height - 1 - bottommax;
bottommax = height - 1 - temp;
}
int temp;
if (bottommin != -1) bottommin = height - 1 - bottommin;
if (bottommax != -1) bottommax = height - 1 - bottommax;
if (topmin != -1) topmin = height - 1 - topmin;
if (topmax != -1) topmax = height - 1 - topmax;
temp = bottommin;
bottommin = topmax;
topmax = temp;
temp = bottommax;
bottommax = topmin;
topmin = temp;
if (leftmin != -1) leftmin = width - 1 - leftmin;
if (leftmax != -1) leftmax = width - 1 - leftmax;
if (rightmin != -1) rightmin = width - 1 - rightmin;
if (rightmax != -1) rightmax = width - 1 - rightmax;
temp = leftmin;
leftmin = rightmax;
rightmax = temp;
temp = leftmax;
leftmax = rightmin;
rightmin = temp;
}
/* draw the upper-left chunk */
@ -1112,8 +1127,8 @@ void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int
info->textmap->set_user_data(&info->textmap_info);
info->textmap->set_palette_offset(colorbase);
info->textmap->set_transparent_pen(0);
info->textmap->set_scrolldx(-192 + xoffs, -170 + xoffs);
info->textmap->set_scrolldy(0, 38);
info->textmap->set_scrolldx(-192 + xoffs, -192 + xoffs);
info->textmap->set_scrolldy(0, 0);
/* create the tilemaps for the tile pages */
for (pagenum = 0; pagenum < info->numpages; pagenum++)
@ -1128,8 +1143,8 @@ void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int
info->tilemaps[pagenum]->set_user_data(&info->tmap_info[pagenum]);
info->tilemaps[pagenum]->set_palette_offset(colorbase);
info->tilemaps[pagenum]->set_transparent_pen(0);
info->tilemaps[pagenum]->set_scrolldx(0, 22);
info->tilemaps[pagenum]->set_scrolldy(0, 38);
info->tilemaps[pagenum]->set_scrolldx(0, 0);
info->tilemaps[pagenum]->set_scrolldy(0, 0);
}
save_item(NAME(info->flip), which);