summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/atarifb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/atarifb.cpp')
-rw-r--r--src/mame/video/atarifb.cpp130
1 files changed, 69 insertions, 61 deletions
diff --git a/src/mame/video/atarifb.cpp b/src/mame/video/atarifb.cpp
index b773aa60c2d..3cd865fb978 100644
--- a/src/mame/video/atarifb.cpp
+++ b/src/mame/video/atarifb.cpp
@@ -12,6 +12,39 @@
/*************************************
*
+ * Palette generation
+ *
+ *************************************/
+
+void atarifb_state::atarifb_palette(palette_device &palette) const
+{
+ // chars
+ palette.set_pen_color(0, rgb_t(0xff,0xff,0xff));
+ palette.set_pen_color(1, rgb_t(0x00,0x00,0x00));
+
+ // field
+ palette.set_pen_color(2, rgb_t(0x40,0x40,0x40));
+ palette.set_pen_color(3, rgb_t(0xc0,0xc0,0xc0));
+
+ // sprites
+ palette.set_pen_color(4, rgb_t(0x40,0x40,0x40));
+ palette.set_pen_color(5, rgb_t(0xff,0xff,0xff));
+ palette.set_pen_color(6, rgb_t(0x40,0x40,0x40));
+ palette.set_pen_color(7, rgb_t(0x00,0x00,0x00));
+
+ // sprite masks
+ palette.set_pen_color(8, rgb_t(0x40,0x40,0x40));
+ palette.set_pen_color(9, rgb_t(0x80,0x80,0x80));
+ palette.set_pen_color(10, rgb_t(0x40,0x40,0x40));
+ palette.set_pen_color(11, rgb_t(0x00,0x00,0x00));
+ palette.set_pen_color(12, rgb_t(0x40,0x40,0x40));
+ palette.set_pen_color(13, rgb_t(0xff,0xff,0xff));
+}
+
+
+
+/*************************************
+ *
* Tilemap callbacks
*
*************************************/
@@ -51,7 +84,6 @@ TILE_GET_INFO_MEMBER(atarifb_state::field_get_tile_info)
-
/*************************************
*
* Video RAM writes
@@ -94,10 +126,11 @@ void atarifb_state::video_start()
}
-
void atarifb_state::draw_playfield_and_alpha( bitmap_ind16 &bitmap, const rectangle &cliprect, int playfield_x_offset, int playfield_y_offset )
{
- const rectangle bigfield_area(4 * 8, 34 * 8 - 1, 0 * 8, 32 * 8 - 1);
+ bitmap.fill(1, cliprect);
+ rectangle clip(4 * 8, 34 * 8 - 1, 0 * 8, 32 * 8 - 1);
+ clip &= cliprect;
int scroll_x[1];
int scroll_y[1];
@@ -107,64 +140,47 @@ void atarifb_state::draw_playfield_and_alpha( bitmap_ind16 &bitmap, const rectan
copybitmap(bitmap, m_alpha1_tilemap->pixmap(), 0, 0, 35*8, 1*8, cliprect);
copybitmap(bitmap, m_alpha2_tilemap->pixmap(), 0, 0, 0*8, 1*8, cliprect);
- copyscrollbitmap(bitmap, m_field_tilemap->pixmap(), 1, scroll_x, 1, scroll_y, bigfield_area);
+ copyscrollbitmap(bitmap, m_field_tilemap->pixmap(), 1, scroll_x, 1, scroll_y, clip);
}
-void atarifb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfx, int is_soccer )
+void atarifb_state::draw_sprites_atarifb( bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- const rectangle bigfield_area(4 * 8, 34 * 8 - 1, 0 * 8, 32 * 8 - 1);
-
- int obj;
+ rectangle clip(4 * 8, 34 * 8 - 1, 0 * 8, 32 * 8 - 1);
+ clip &= cliprect;
- for (obj = 0; obj < 16; obj++)
+ for (int obj = 0; obj < 16; obj++)
{
- int charcode;
- int flipx, flipy;
- int sx, sy;
- int shade = 0;
+ int charcode = m_spriteram[obj * 2] & 0x3f;
+ int flipx = (m_spriteram[obj * 2] & 0x40);
+ int flipy = (m_spriteram[obj * 2] & 0x80);
+ int sx = m_spriteram[obj * 2 + 0x20] + 8 * 3;
+ int sy = 256 - m_spriteram[obj * 2 + 1];
+
+ m_gfxdecode->gfx(1)->transpen(bitmap, clip, charcode, 1, flipx, flipy, sx, sy, 0);
+ }
+}
- sy = 255 - m_spriteram[obj * 2 + 1];
- if (sy == 255)
- continue;
+void atarifb_state::draw_sprites_soccer( bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ rectangle clip(4 * 8, 34 * 8 - 1, 0 * 8, 32 * 8 - 1);
+ clip &= cliprect;
- charcode = m_spriteram[obj * 2] & 0x3f;
- flipx = (m_spriteram[obj * 2] & 0x40);
- flipy = (m_spriteram[obj * 2] & 0x80);
- sx = m_spriteram[obj * 2 + 0x20] + 8 * 3;
+ for (int obj = 0; obj < 16; obj++)
+ {
+ int charcode = m_spriteram[obj * 2] & 0x3f;
+ int flipx = (m_spriteram[obj * 2] & 0x40);
+ int flipy = (m_spriteram[obj * 2] & 0x80);
+ int sx = m_spriteram[obj * 2 + 0x20] + 8 * 3;
+ int sy = 256 - m_spriteram[obj * 2 + 1] - 8;
- /* Note on Atari Soccer: */
/* There are 3 sets of 2 bits each, where the 2 bits represent */
/* black, dk grey, grey and white. I think the 3 sets determine the */
/* color of each bit in the sprite, but I haven't implemented it that way. */
- if (is_soccer)
- {
- shade = ((m_spriteram[obj * 2 + 1 + 0x20]) & 0x07);
-
- m_gfxdecode->gfx(gfx + 1)->transpen(bitmap,bigfield_area,
- charcode, shade,
- flipx, flipy, sx, sy, 0);
-
- shade = ((m_spriteram[obj * 2 + 1 + 0x20]) & 0x08) >> 3;
- }
-
- m_gfxdecode->gfx(gfx)->transpen(bitmap,bigfield_area,
- charcode, shade,
- flipx, flipy, sx, sy, 0);
-
- /* If this isn't soccer, handle the multiplexed sprites */
- if (!is_soccer)
- {
- /* The down markers are multiplexed by altering the y location during */
- /* mid-screen. We'll fake it by essentially doing the same thing here. */
- if ((charcode == 0x11) && (sy == 0x07))
- {
- sy = 0xf1; /* When multiplexed, it's 0x10...why? */
- m_gfxdecode->gfx(gfx)->transpen(bitmap,bigfield_area,
- charcode, 0,
- flipx, flipy, sx, sy, 0);
- }
- }
+ int shade = m_spriteram[obj * 2 + 1 + 0x20];
+
+ m_gfxdecode->gfx(3)->transpen(bitmap, clip, charcode, shade & 7, flipx, flipy, sx, sy, 0);
+ m_gfxdecode->gfx(2)->transpen(bitmap, clip, charcode, shade >> 3 & 1, flipx, flipy, sx, sy, 0);
}
}
@@ -172,28 +188,20 @@ void atarifb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprec
uint32_t atarifb_state::screen_update_atarifb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
draw_playfield_and_alpha(bitmap, cliprect, 0, 0);
-
- draw_sprites(bitmap, cliprect, 1, 0);
-
+ draw_sprites_atarifb(bitmap, cliprect);
return 0;
}
-
uint32_t atarifb_state::screen_update_abaseb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
draw_playfield_and_alpha(bitmap, cliprect, -8, 0);
-
- draw_sprites(bitmap, cliprect, 1, 0);
-
+ draw_sprites_atarifb(bitmap, cliprect);
return 0;
}
-
uint32_t atarifb_state::screen_update_soccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- draw_playfield_and_alpha(bitmap, cliprect, 0, 8);
-
- draw_sprites(bitmap, cliprect, 2, 1);
-
+ draw_playfield_and_alpha(bitmap, cliprect, 0, 0);
+ draw_sprites_soccer(bitmap, cliprect);
return 0;
}