make a few more atari things use rect getters/setters (nw)

This commit is contained in:
Vas Crabb 2018-07-28 04:06:48 +10:00
parent 142e1842c3
commit af6434355d
13 changed files with 53 additions and 81 deletions

View File

@ -184,7 +184,7 @@ uint32_t atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_in
bitmap_ind16 &mo_bitmap = m_rle->vram(0);
int left = cliprect.left();
int top = cliprect.top();
int right = cliprect.left() + 1;
int right = cliprect.right() + 1;
int bottom = cliprect.bottom() + 1;
int x, y;

View File

@ -185,7 +185,7 @@ void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cl
bandclip.min_y -= m_bitmapheight;
// maximum Y is based on the minimum
bandclip.max_y = bandclip.min_y + (1 << m_slipshift) - 1;
bandclip.set_height(1 << m_slipshift);
// keep within the cliprect
bandclip &= cliprect;

View File

@ -97,11 +97,10 @@ WRITE8_MEMBER(atari_rle_objects_device::control_write)
if ((oldbits & ATARIRLE_CONTROL_ERASE) != 0)
{
// compute the top and bottom of the rect
rectangle cliprect = m_cliprect;
if (m_partial_scanline + 1 > cliprect.min_y)
cliprect.min_y = m_partial_scanline + 1;
if (scanline < cliprect.max_y)
cliprect.max_y = scanline;
rectangle cliprect(m_cliprect);
cliprect.sety(
(std::max)(cliprect.top(), m_partial_scanline + 1),
(std::min)(cliprect.bottom(), scanline));
//logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (oldbits & ATARIRLE_CONTROL_FRAME) >> 2);
@ -152,8 +151,7 @@ void atari_rle_objects_device::vblank_callback(screen_device &screen, bool state
{
// compute top only; bottom is equal to visible_area
rectangle cliprect = m_cliprect;
if (m_partial_scanline + 1 > cliprect.min_y)
cliprect.min_y = m_partial_scanline + 1;
cliprect.sety((std::max)(cliprect.top(), m_partial_scanline + 1), cliprect.bottom());
//logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2);

View File

@ -208,7 +208,7 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind
float s_ratio = 256.0f / 196.0f;
float sx = x * s_ratio;
if ((int)(sx + 0.5f) > cliprect.right())
if (int(sx + 0.5f) > cliprect.right())
break;
// copy the S2636 bitmap into the main bitmap and check collision
@ -217,11 +217,11 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind
if (S2636_IS_PIXEL_DRAWN(pixel))
{
// S2636 vs. background collision detection
if ((m_temp_bitmap.pix16(y, (int)(sx)) | m_temp_bitmap.pix16(y, (int)(sx + 0.5f))) & 1)
if ((m_temp_bitmap.pix16(y, int(sx)) | m_temp_bitmap.pix16(y, int(sx + 0.5f))) & 1)
m_collision_register |= 0x01;
bitmap.pix16(y, (int)(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
bitmap.pix16(y, (int)(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
bitmap.pix16(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
bitmap.pix16(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
}
}
}

View File

@ -170,12 +170,12 @@ WRITE_LINE_MEMBER(sprint8_state::screen_vblank)
draw_sprites(m_helper1, visarea);
for (int y = visarea.min_y; y <= visarea.max_y; y++)
for (int y = visarea.top(); y <= visarea.bottom(); y++)
{
const uint16_t* p1 = &m_helper1.pix16(y);
const uint16_t* p2 = &m_helper2.pix16(y);
for (int x = visarea.min_x; x <= visarea.max_x; x++)
for (int x = visarea.left(); x <= visarea.right(); x++)
if (p1[x] != 0x20 && p2[x] == 0x23)
m_collision_timer->adjust(m_screen->time_until_pos(y + 24, x), m_palette->pen_indirect(p1[x]));
}

View File

@ -305,14 +305,11 @@ void starshp1_state::draw_circle(bitmap_ind16 &bitmap)
int starshp1_state::spaceship_collision(bitmap_ind16 &bitmap, const rectangle &rect)
{
int x;
int y;
for (y = rect.min_y; y <= rect.max_y; y++)
for (int y = rect.top(); y <= rect.bottom(); y++)
{
const uint16_t* pLine = &m_helper.pix16(y);
for (x = rect.min_x; x <= rect.max_x; x++)
for (int x = rect.left(); x <= rect.right(); x++)
if (pLine[x] != 0)
return 1;
}
@ -337,10 +334,10 @@ int starshp1_state::circle_collision(const rectangle &rect)
int r = get_radius();
return point_in_circle(rect.min_x, rect.min_y, center_x, center_y, r) ||
point_in_circle(rect.min_x, rect.max_y, center_x, center_y, r) ||
point_in_circle(rect.max_x, rect.min_y, center_x, center_y, r) ||
point_in_circle(rect.max_x, rect.max_y, center_x, center_y, r);
return point_in_circle(rect.left(), rect.top(), center_x, center_y, r) ||
point_in_circle(rect.left(), rect.bottom(), center_x, center_y, r) ||
point_in_circle(rect.right(), rect.top(), center_x, center_y, r) ||
point_in_circle(rect.right(), rect.bottom(), center_x, center_y, r);
}
@ -378,13 +375,10 @@ WRITE_LINE_MEMBER(starshp1_state::screen_vblank_starshp1)
// rising edge
if (state)
{
rectangle rect;
const rectangle &visarea = m_screen->visible_area();
rect.min_x = get_sprite_hpos(13);
rect.min_y = get_sprite_vpos(13);
rect.max_x = rect.min_x + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = rect.min_y + m_gfxdecode->gfx(1)->height() - 1;
rectangle rect(get_sprite_hpos(13), 0, get_sprite_vpos(13), 0);
rect.set_size(m_gfxdecode->gfx(1)->width(), m_gfxdecode->gfx(1)->height());
rect &= m_helper.cliprect();

View File

@ -224,13 +224,13 @@ uint32_t toobin_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
/* draw and merge the MO */
bitmap_ind16 &mobitmap = m_mob->bitmap();
const pen_t *palette = m_palette->pens();
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint32_t *dest = &bitmap.pix32(y);
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &m_pfbitmap.pix16(y);
uint8_t *pri = &priority_bitmap.pix8(y);
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
uint16_t pix = pf[x];
if (mo[x] != 0xffff)

View File

@ -83,7 +83,7 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
m_gfxdecode->gfx(m_sprite_zoom)->opaque(m_helper,cliprect,
2 * code + m_sprite_bank, 0, code & 8, 0,
rect.min_x, rect.min_y);
rect.left(), rect.top());
rect &= cliprect;
@ -93,9 +93,9 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
int x;
int y;
for (x = rect.min_x; x <= rect.max_x; x++)
for (x = rect.left(); x <= rect.right(); x++)
{
for (y = rect.min_y; y <= rect.max_y; y++)
for (y = rect.top(); y <= rect.bottom(); y++)
{
pen_t a = m_helper.pix16(y, x);
pen_t b = bitmap.pix16(y, x);

View File

@ -291,7 +291,7 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect)
for( y=0; y<256; y++ )
{
if (0xff-y >= cliprect.min_y && 0xff-y <= cliprect.max_y)
if (0xff-y >= cliprect.top() && 0xff-y <= cliprect.bottom())
for( x=0; x<256; x++ )
{
color = 0;
@ -308,7 +308,7 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect)
z = x0; /* give priority to rightmost spans */
}
}
if (x >= cliprect.min_x && x <= cliprect.max_x)
if (x >= cliprect.left() && x <= cliprect.right())
bitmap.pix16(0xff-y, x) = color;
}
}

View File

@ -95,19 +95,17 @@ WRITE_LINE_MEMBER(ultratnk_state::screen_vblank)
for (int i = 0; i < 4; i++)
{
rectangle rect;
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
rect.min_x = horz - 15;
rect.min_y = vert - 15;
rect.max_x = horz - 15 + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = vert - 15 + m_gfxdecode->gfx(1)->height() - 1;
rectangle rect(
horz - 15,
horz - 15 + m_gfxdecode->gfx(1)->width() - 1,
vert - 15,
vert - 15 + m_gfxdecode->gfx(1)->height() - 1);
rect &= m_screen->visible_area();
m_playfield->draw(*m_screen, m_helper, rect, 0, 0);
@ -122,8 +120,8 @@ WRITE_LINE_MEMBER(ultratnk_state::screen_vblank)
horz - 15,
vert - 15, 1);
for (int y = rect.min_y; y <= rect.max_y; y++)
for (int x = rect.min_x; x <= rect.max_x; x++)
for (int y = rect.top(); y <= rect.bottom(); y++)
for (int x = rect.left(); x <= rect.right(); x++)
if (m_palette->pen_indirect(m_helper.pix16(y, x)) != BG)
m_collision[i] = 1;
}

View File

@ -179,8 +179,8 @@ void vindictr_state::scanline_update(screen_device &screen, int scanline)
/* a new vscroll latches the offset into a counter; we must adjust for this */
int offset = scanline;
const rectangle &visible_area = screen.visible_area();
if (offset > visible_area.max_y)
offset -= visible_area.max_y + 1;
if (offset > visible_area.bottom())
offset -= visible_area.bottom() + 1;
if (m_playfield_yscroll != ((data - offset) & 0x1ff))
{
@ -213,11 +213,11 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
for (int y = rect->min_y; y <= rect->max_y; y++)
for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
for (int x = rect->min_x; x <= rect->max_x; x++)
for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* partially verified via schematics (there are a lot of PALs involved!):
@ -253,11 +253,11 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in
/* now go back and process the upper bit of MO priority */
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
for (int y = rect->min_y; y <= rect->max_y; y++)
for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
for (int x = rect->min_x; x <= rect->max_x; x++)
for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;

View File

@ -195,14 +195,10 @@ void wolfpack_state::draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprec
void wolfpack_state::draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
rectangle rect = cliprect;
if (!(m_pt_pic & 0x20))
rect.min_x = 256;
if (!(m_pt_pic & 0x10))
rect.max_x = 255;
rectangle rect(cliprect);
rect.setx(
(m_pt_pic & 0x20) ? rect.left() : 256,
(m_pt_pic & 0x10) ? rect.right() : 255);
m_gfxdecode->gfx(2)->transpen(bitmap,rect,
m_pt_pic,
@ -223,19 +219,11 @@ void wolfpack_state::draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect)
void wolfpack_state::draw_water(palette_device &palette, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
rectangle rect = cliprect;
int x;
int y;
if (rect.max_y > 127)
rect.max_y = 127;
for (y = rect.min_y; y <= rect.max_y; y++)
for (int y = cliprect.top(); y <= (std::min)(cliprect.bottom(), 127); y++)
{
uint16_t* p = &bitmap.pix16(y);
for (x = rect.min_x; x <= rect.max_x; x++)
for (int x = cliprect.left(); x <= cliprect.right(); x++)
p[x] = palette.pen_indirect(p[x]) | 0x08;
}
}
@ -243,9 +231,6 @@ void wolfpack_state::draw_water(palette_device &palette, bitmap_ind16 &bitmap, c
uint32_t wolfpack_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i;
int j;
uint8_t color = 0x48;
if (m_ship_size & 0x10) color += 0x13;
if (m_ship_size & 0x20) color += 0x22;
@ -259,8 +244,8 @@ uint32_t wolfpack_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
bitmap.fill(m_video_invert, cliprect);
for (i = 0; i < 8; i++)
for (j = 0; j < 32; j++)
for (int i = 0; i < 8; i++)
for (int j = 0; j < 32; j++)
{
int code = m_alpha_num_ram[32 * i + j];
@ -286,19 +271,16 @@ WRITE_LINE_MEMBER(wolfpack_state::screen_vblank)
// rising edge
if (state)
{
int x;
int y;
m_helper.fill(0);
draw_ship(m_helper, m_helper.cliprect());
for (y = 128; y < 224 - m_torpedo_v; y++)
for (int y = 128; y < 224 - m_torpedo_v; y++)
{
int x1 = 248 - m_torpedo_h - 1;
int x2 = 248 - m_torpedo_h + 1;
for (x = 2 * x1; x < 2 * x2; x++)
for (int x = 2 * x1; x < 2 * x2; x++)
{
if (x < 0 || x >= m_helper.width())
continue;

View File

@ -98,11 +98,11 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
for (int y = rect->min_y; y <= rect->max_y; y++)
for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
for (int x = rect->min_x; x <= rect->max_x; x++)
for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified via schematics: