summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/shougi.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
committer Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
commitf1f0591f43f381123e8d9ec20c52eb7c0c332c79 (patch)
tree97c8dd30a6ea292c3189f372b8103a2e303c0b2d /src/mame/drivers/shougi.cpp
parent65bfb2654f0c73235f114e9145c766245bed9790 (diff)
Start cleaning up palette configuration:
* Basically, initialisers go in the constructor arguments, and things for setting format go in set_format. * Initialisation patterns can be specified with an enum discriminator or with a FUNC and optionally a tag. * Formats can be specified with an enum discriminator or a size and function pointer. * You must always supply the number of entries when setting the format. * When initislising with a paletter initialisation member, you can specify the entries and indirecte entries together. * The palette_device now has a standard constructor, so use .set_entries if you are specifying entry count with no format/initialisation. * Also killed an overload on delegates that wasn't being useful.
Diffstat (limited to 'src/mame/drivers/shougi.cpp')
-rw-r--r--src/mame/drivers/shougi.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mame/drivers/shougi.cpp b/src/mame/drivers/shougi.cpp
index dd38e1395d4..d6717f9ec28 100644
--- a/src/mame/drivers/shougi.cpp
+++ b/src/mame/drivers/shougi.cpp
@@ -106,7 +106,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
DECLARE_READ8_MEMBER(semaphore_r);
- DECLARE_PALETTE_INIT(shougi);
+ void shougi_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_nmi);
@@ -162,7 +162,7 @@ void shougi_state::machine_start()
***************************************************************************/
-PALETTE_INIT_MEMBER(shougi_state, shougi)
+void shougi_state::shougi_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
static const int resistances_b[2] = { 470, 220 };
@@ -176,24 +176,24 @@ PALETTE_INIT_MEMBER(shougi_state, shougi)
for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
+ int bit0,bit1,bit2;
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
/* green component */
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
/* blue component */
bit0 = (color_prom[i] >> 6) & 0x01;
bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i,rgb_t(r,g,b));
}
@@ -404,8 +404,7 @@ MACHINE_CONFIG_START(shougi_state::shougi)
MCFG_SCREEN_UPDATE_DRIVER(shougi_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(shougi_state, shougi)
+ PALETTE(config, "palette", FUNC(shougi_state::shougi_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();