mirror of
https://github.com/holub/mame
synced 2025-06-07 05:13:46 +03:00
cvs_base: simplify star generator a bit (no difference here yet)
This commit is contained in:
parent
c6fc479ddb
commit
cffaa099a9
@ -47,7 +47,7 @@ void cvs_base_state::scroll_start(int state)
|
|||||||
|
|
||||||
void cvs_base_state::init_stars()
|
void cvs_base_state::init_stars()
|
||||||
{
|
{
|
||||||
int generator = 0;
|
uint32_t generator = 0;
|
||||||
m_total_stars = 0;
|
m_total_stars = 0;
|
||||||
|
|
||||||
// precalculate the star background
|
// precalculate the star background
|
||||||
@ -56,28 +56,20 @@ void cvs_base_state::init_stars()
|
|||||||
for (int x = 511; x >= 0; x--)
|
for (int x = 511; x >= 0; x--)
|
||||||
{
|
{
|
||||||
generator <<= 1;
|
generator <<= 1;
|
||||||
int const bit1 = BIT(~generator, 17);
|
generator |= BIT(~generator, 17) ^ BIT(generator, 5);
|
||||||
int const bit2 = BIT(generator, 5);
|
|
||||||
|
|
||||||
if (bit1 ^ bit2)
|
if ((generator & 0x130fe) == 0xfe)
|
||||||
generator |= 1;
|
|
||||||
|
|
||||||
if (BIT(~generator, 16) && (generator & 0xfe) == 0xfe)
|
|
||||||
{
|
{
|
||||||
if (BIT(~generator, 12) && BIT(~generator, 13))
|
m_stars[m_total_stars].x = x;
|
||||||
{
|
m_stars[m_total_stars].y = y;
|
||||||
if (m_total_stars < CVS_MAX_STARS)
|
m_stars[m_total_stars].code = 1;
|
||||||
{
|
|
||||||
m_stars[m_total_stars].x = x;
|
|
||||||
m_stars[m_total_stars].y = y;
|
|
||||||
m_stars[m_total_stars].code = 1;
|
|
||||||
|
|
||||||
m_total_stars++;
|
m_total_stars++;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(m_total_stars == 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cvs_base_state::update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always)
|
void cvs_base_state::update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always)
|
||||||
@ -95,8 +87,7 @@ void cvs_base_state::update_stars(bitmap_ind16 &bitmap, const rectangle &cliprec
|
|||||||
if (flip_screen_y())
|
if (flip_screen_y())
|
||||||
y = ~y;
|
y = ~y;
|
||||||
|
|
||||||
if ((y >= cliprect.top()) && (y <= cliprect.bottom()) &&
|
if (cliprect.contains(x, y) && (update_always || (m_palette->pen_indirect(bitmap.pix(y, x)) == 0)))
|
||||||
(update_always || (m_palette->pen_indirect(bitmap.pix(y, x)) == 0)))
|
|
||||||
bitmap.pix(y, x) = star_pen;
|
bitmap.pix(y, x) = star_pen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ protected:
|
|||||||
, m_ram_view(*this, "video_color_ram_view")
|
, m_ram_view(*this, "video_color_ram_view")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
static inline constexpr uint8_t CVS_MAX_STARS = 250;
|
static inline constexpr uint8_t CVS_MAX_STARS = 128;
|
||||||
static inline constexpr int8_t CVS_S2636_Y_OFFSET = -5;
|
static inline constexpr int8_t CVS_S2636_Y_OFFSET = -5;
|
||||||
static inline constexpr int8_t CVS_S2636_X_OFFSET = -26;
|
static inline constexpr int8_t CVS_S2636_X_OFFSET = -26;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user