Flip screen API cleanup (nw)

- Make the global flipping functions of driver_device protected so as not to be accessible from within subdevices
- Eliminate the flip_screen_set_no_update kludge
This commit is contained in:
AJR 2018-02-03 20:56:53 -05:00
parent fb260c4259
commit 3f135a40b7
4 changed files with 17 additions and 32 deletions

View File

@ -334,23 +334,6 @@ void driver_device::flip_screen_set(u32 on)
}
//-------------------------------------------------
// flip_screen_set_no_update - set global flip
// do not call updateflip.
//-------------------------------------------------
void driver_device::flip_screen_set_no_update(u32 on)
{
// flip_screen_y is not updated on purpose
// this function is for drivers which
// were writing to flip_screen_x to
// bypass updateflip
if (on)
on = ~0;
m_flip_screen_x = on;
}
//-------------------------------------------------
// flip_screen_x_set - set global horizontal flip
//-------------------------------------------------

View File

@ -158,15 +158,6 @@ public:
INTERRUPT_GEN_MEMBER( irq7_line_assert );
// generic video
void flip_screen_set(u32 on);
void flip_screen_set_no_update(u32 on);
void flip_screen_x_set(u32 on);
void flip_screen_y_set(u32 on);
u32 flip_screen() const { return m_flip_screen_x; }
u32 flip_screen_x() const { return m_flip_screen_x; }
u32 flip_screen_y() const { return m_flip_screen_y; }
// generic input port helpers
DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read );
@ -190,6 +181,14 @@ protected:
virtual void device_start() override;
virtual void device_reset_after_children() override;
// generic video
void flip_screen_set(u32 on);
void flip_screen_x_set(u32 on);
void flip_screen_y_set(u32 on);
u32 flip_screen() const { return m_flip_screen_x; }
u32 flip_screen_x() const { return m_flip_screen_x; }
u32 flip_screen_y() const { return m_flip_screen_y; }
private:
// helpers
void updateflip();

View File

@ -49,6 +49,7 @@ public:
uint8_t m_bg_color;
uint16_t m_bg_position;
uint8_t m_fg_color;
bool m_flip_screen;
uint8_t m_congo_fg_bank;
uint8_t m_congo_color_bank;

View File

@ -123,6 +123,7 @@ void zaxxon_state::video_start_common(tilemap_get_info_delegate fg_tile_info)
m_bg_color = 0;
m_bg_position = 0;
m_fg_color = 0;
m_flip_screen = false;
m_congo_fg_bank = 0;
m_congo_color_bank = 0;
memset(m_congo_custom, 0, sizeof(m_congo_custom));
@ -139,6 +140,7 @@ void zaxxon_state::video_start_common(tilemap_get_info_delegate fg_tile_info)
save_item(NAME(m_bg_color));
save_item(NAME(m_bg_position));
save_item(NAME(m_fg_color));
save_item(NAME(m_flip_screen));
}
@ -178,8 +180,8 @@ VIDEO_START_MEMBER(zaxxon_state,congo)
WRITE_LINE_MEMBER(zaxxon_state::flipscreen_w)
{
/* low bit controls flip; background and sprite flip are handled at render time */
flip_screen_set_no_update(!state);
m_fg_tilemap->set_flip(flip_screen() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
m_flip_screen = !state;
m_fg_tilemap->set_flip(m_flip_screen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
}
@ -304,13 +306,13 @@ void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre
int colorbase = m_bg_color + (m_congo_color_bank << 8);
int xmask = pixmap.width() - 1;
int ymask = pixmap.height() - 1;
int flipmask = flip_screen() ? 0xff : 0x00;
int flipoffs = flip_screen() ? 0x38 : 0x40;
int flipmask = m_flip_screen ? 0xff : 0x00;
int flipoffs = m_flip_screen ? 0x38 : 0x40;
int x, y;
/* the starting X value is offset by 1 pixel (normal) or 7 pixels */
/* (flipped) due to a delay in the loading */
if (!flip_screen())
if (!m_flip_screen)
flipoffs -= 1;
else
flipoffs += 7;
@ -415,7 +417,7 @@ void zaxxon_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect,
{
uint8_t *spriteram = m_spriteram;
gfx_element *gfx = m_gfxdecode->gfx(2);
int flip = flip_screen();
int flip = m_flip_screen;
int flipmask = flip ? 0xff : 0x00;
int offs;