summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/megazone.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/megazone.cpp')
-rw-r--r--src/mame/video/megazone.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/mame/video/megazone.cpp b/src/mame/video/megazone.cpp
index 7080e948617..fb3356010fa 100644
--- a/src/mame/video/megazone.cpp
+++ b/src/mame/video/megazone.cpp
@@ -38,60 +38,58 @@ Changes by Martin M. (pfloyd@gmx.net) 14.10.2001:
***************************************************************************/
-PALETTE_INIT_MEMBER(megazone_state, megazone)
+void megazone_state::megazone_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 1000, 0,
3, &resistances_rg[0], gweights, 1000, 0,
2, &resistances_b[0], bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
+ // green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
+ // blue component
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
- b = combine_2_weights(bweights, bit0, bit1);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* sprites */
- for (i = 0; i < 0x100; i++)
+ // sprites
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* characters */
- for (i = 0x100; i < 0x200; i++)
+ // characters
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}