diff options
Diffstat (limited to 'src/mame/video/tceptor.cpp')
-rw-r--r-- | src/mame/video/tceptor.cpp | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/src/mame/video/tceptor.cpp b/src/mame/video/tceptor.cpp index 1b4f67d31d6..7b14db0b7b7 100644 --- a/src/mame/video/tceptor.cpp +++ b/src/mame/video/tceptor.cpp @@ -8,6 +8,8 @@ #include "emu.h" #include "includes/tceptor.h" +#include <algorithm> + #define TX_TILE_OFFSET_CENTER (32 * 2) #define TX_TILE_OFFSET_RIGHT (32 * 0 + 2) @@ -19,67 +21,67 @@ /*******************************************************************/ -PALETTE_INIT_MEMBER(tceptor_state, tceptor) +void tceptor_state::tceptor_palette(palette_device &palette) { const uint8_t *color_prom = memregion("proms")->base(); - int i; - /* create a lookup table for the palette */ - for (i = 0; i < 0x400; i++) + // create a lookup table for the palette + for (int i = 0; i < 0x400; i++) { - int r = pal4bit(color_prom[i + 0x000]); - int g = pal4bit(color_prom[i + 0x400]); - int b = pal4bit(color_prom[i + 0x800]); + int const r = pal4bit(color_prom[i + 0x000]); + int const g = pal4bit(color_prom[i + 0x400]); + int const b = pal4bit(color_prom[i + 0x800]); 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 += 0xc00; - /* - color lookup table: - 0- +1024 ( 4 * 256) colors: text (use 0- 256 colors) - 1024- +1024 (16 * 64) colors: sprite (use 768- 256 colors) - 2048- +512 ( 8 * 64) colors: bg (use 0- 512 colors) - 3840- +256 ( 4 * 64) colors: road (use 512- 256 colors) - */ - - /* tiles lookup table (1024 colors) */ - for (i = 0; i < 0x0400; i++) + color lookup table: + 0- +1024 ( 4 * 256) colors: text (use 0- 256 colors) + 1024- +1024 (16 * 64) colors: sprite (use 768- 256 colors) + 2048- +512 ( 8 * 64) colors: bg (use 0- 512 colors) + 3840- +256 ( 4 * 64) colors: road (use 512- 256 colors) + */ + + // tiles lookup table (1024 colors) + for (int i = 0; i < 0x0400; i++) { - int ctabentry = color_prom[i]; + int const ctabentry = color_prom[i]; palette.set_pen_indirect(i, ctabentry); } - /* sprites lookup table (1024 colors) */ - for (i = 0x0400; i < 0x0800; i++) + // sprites lookup table (1024 colors) + for (int i = 0x0400; i < 0x0800; i++) { - int ctabentry = color_prom[i] | 0x300; + int const ctabentry = color_prom[i] | 0x300; palette.set_pen_indirect(i, ctabentry); } - /* background: no lookup PROM, use directly (512 colors) */ - for (i = 0x0a00; i < 0x0c00; i++) + // background: no lookup PROM, use directly (512 colors) + for (int i = 0x0a00; i < 0x0c00; i++) { - int ctabentry = i & 0x1ff; + int const ctabentry = i & 0x1ff; palette.set_pen_indirect(i, ctabentry); } - /* road lookup table (256 colors) */ - for (i = 0x0f00; i < 0x1000; i++) + // road lookup table (256 colors) + for (int i = 0x0f00; i < 0x1000; i++) { - int ctabentry = color_prom[i - 0x700] | 0x200; + int const ctabentry = color_prom[i - 0x700] | 0x200; palette.set_pen_indirect(i, ctabentry); } - /* setup sprite mask color map */ - /* tceptor2: only 0x23 */ - memset(m_is_mask_spr, 0, sizeof m_is_mask_spr); - for (i = 0; i < 0x400; i++) + // setup sprite mask color map + // tceptor2: only 0x23 + std::fill(std::begin(m_is_mask_spr), std::end(m_is_mask_spr), 0); + for (int i = 0; i < 0x400; i++) + { if (palette.pen_indirect(i | 0x400) == SPR_MASK_COLOR) m_is_mask_spr[i >> 4] = 1; + } } |