mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Color table removal
This commit is contained in:
parent
87265897e1
commit
9ee40057d9
@ -411,8 +411,8 @@ static TILE_GET_INFO( get_7mezzo_tile_info )
|
||||
|
||||
static VIDEO_START( 7mezzo )
|
||||
{
|
||||
bg_tilemap = tilemap_create(get_7mezzo_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 29);
|
||||
mc6845 = mc6845_config(NULL);
|
||||
bg_tilemap = tilemap_create(get_7mezzo_tile_info, tilemap_scan_rows, 8, 8, 32, 29);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( magicfly )
|
||||
@ -423,19 +423,24 @@ static VIDEO_UPDATE( magicfly )
|
||||
|
||||
static PALETTE_INIT( magicfly )
|
||||
{
|
||||
/* 1st gfx bank */
|
||||
palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, 2, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, 4, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, 6, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, 10, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, 11, MAKE_RGB(0x00, 0xff, 0x00));
|
||||
palette_set_color(machine, 12, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, 14, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
int i;
|
||||
|
||||
/* 2nd gfx bank */
|
||||
palette_set_color(machine, 22, MAKE_RGB(0xe0, 0xe0, 0xe0));
|
||||
palette_set_color(machine, 23, MAKE_RGB(0xff, 0xff, 0xff));
|
||||
for (i = 0; i < 0x100; i += 0x20)
|
||||
{
|
||||
/* 1st gfx bank */
|
||||
palette_set_color(machine, i + 0, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, i + 2, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, i + 4, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, i + 6, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, i + 10, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, i + 11, MAKE_RGB(0x00, 0xff, 0x00));
|
||||
palette_set_color(machine, i + 12, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
palette_set_color(machine, i + 14, MAKE_RGB(0x00, 0x00, 0x00));
|
||||
|
||||
/* 2nd gfx bank */
|
||||
palette_set_color(machine, i + 22, MAKE_RGB(0xe0, 0xe0, 0xe0));
|
||||
palette_set_color(machine, i + 23, MAKE_RGB(0xff, 0xff, 0xff));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -669,9 +674,8 @@ static MACHINE_DRIVER_START( magicfly )
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 29*8-1) /* Taken from MC6845 init, registers 01 & 06. */
|
||||
|
||||
MDRV_GFXDECODE(magicfly)
|
||||
MDRV_PALETTE_LENGTH(32)
|
||||
MDRV_PALETTE_LENGTH(256)
|
||||
MDRV_PALETTE_INIT(magicfly)
|
||||
MDRV_COLORTABLE_LENGTH(256)
|
||||
|
||||
MDRV_VIDEO_START(magicfly)
|
||||
MDRV_VIDEO_UPDATE(magicfly)
|
||||
|
@ -90,20 +90,20 @@ extern UINT8* mermaid_videoram2;
|
||||
extern UINT8* mermaid_bg_scrollram;
|
||||
extern UINT8* mermaid_fg_scrollram;
|
||||
|
||||
extern WRITE8_HANDLER( mermaid_videoram2_w );
|
||||
extern WRITE8_HANDLER( mermaid_videoram_w );
|
||||
extern WRITE8_HANDLER( mermaid_colorram_w );
|
||||
extern WRITE8_HANDLER( mermaid_flip_screen_x_w );
|
||||
extern WRITE8_HANDLER( mermaid_flip_screen_y_w );
|
||||
extern WRITE8_HANDLER( mermaid_bg_scroll_w );
|
||||
extern WRITE8_HANDLER( mermaid_fg_scroll_w );
|
||||
extern WRITE8_HANDLER( rougien_gfxbankswitch1_w );
|
||||
extern WRITE8_HANDLER( rougien_gfxbankswitch2_w );
|
||||
extern READ8_HANDLER( mermaid_collision_r );
|
||||
WRITE8_HANDLER( mermaid_videoram2_w );
|
||||
WRITE8_HANDLER( mermaid_videoram_w );
|
||||
WRITE8_HANDLER( mermaid_colorram_w );
|
||||
WRITE8_HANDLER( mermaid_flip_screen_x_w );
|
||||
WRITE8_HANDLER( mermaid_flip_screen_y_w );
|
||||
WRITE8_HANDLER( mermaid_bg_scroll_w );
|
||||
WRITE8_HANDLER( mermaid_fg_scroll_w );
|
||||
WRITE8_HANDLER( rougien_gfxbankswitch1_w );
|
||||
WRITE8_HANDLER( rougien_gfxbankswitch2_w );
|
||||
READ8_HANDLER( mermaid_collision_r );
|
||||
|
||||
extern PALETTE_INIT( mermaid );
|
||||
extern VIDEO_START( mermaid );
|
||||
extern VIDEO_UPDATE( mermaid );
|
||||
PALETTE_INIT( mermaid );
|
||||
VIDEO_START( mermaid );
|
||||
VIDEO_UPDATE( mermaid );
|
||||
|
||||
/* Read/Write Handlers */
|
||||
|
||||
@ -266,8 +266,7 @@ static MACHINE_DRIVER_START( mermaid )
|
||||
MDRV_SCREEN_SIZE(32*8, 32*8)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
|
||||
MDRV_GFXDECODE(mermaid)
|
||||
MDRV_PALETTE_LENGTH(4*16+1)
|
||||
MDRV_COLORTABLE_LENGTH(4*16+2*2)
|
||||
MDRV_PALETTE_LENGTH(4*16+2*2)
|
||||
|
||||
MDRV_PALETTE_INIT(mermaid)
|
||||
MDRV_VIDEO_START(mermaid)
|
||||
@ -388,6 +387,6 @@ ROM_END
|
||||
|
||||
/* Game Drivers */
|
||||
|
||||
GAME( 1982, mermaid, 0, mermaid, mermaid, 0, ROT0, "[Sanritsu] Rock-Ola", "Mermaid", GAME_NOT_WORKING )
|
||||
GAME( 1982, mermaid, 0, mermaid, mermaid, 0, ROT0, "[Sanritsu] Rock-Ola", "Mermaid", GAME_NOT_WORKING )
|
||||
GAME( 1982, yachtmn, mermaid, mermaid, mermaid, 0, ROT0, "[Sanritsu] Esco", "Yachtsman", GAME_NOT_WORKING )
|
||||
GAME( 1982, rougien, 0, mermaid, mermaid, 0, ROT0, "Sanritsu", "Rougien", 0 )
|
||||
GAME( 1982, rougien, 0, mermaid, mermaid, 0, ROT0, "Sanritsu", "Rougien", 0 )
|
||||
|
@ -262,8 +262,7 @@ static MACHINE_DRIVER_START( mikie )
|
||||
MDRV_SCREEN_SIZE(32*8, 32*8)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
|
||||
MDRV_GFXDECODE(mikie)
|
||||
MDRV_PALETTE_LENGTH(256)
|
||||
MDRV_COLORTABLE_LENGTH(16*8*16+16*8*16)
|
||||
MDRV_PALETTE_LENGTH(16*8*16+16*8*16)
|
||||
|
||||
MDRV_PALETTE_INIT(mikie)
|
||||
MDRV_VIDEO_START(mikie)
|
||||
|
@ -287,7 +287,6 @@ static MACHINE_DRIVER_START( miniboy7 )
|
||||
MDRV_GFXDECODE(miniboy7)
|
||||
|
||||
MDRV_PALETTE_LENGTH(256)
|
||||
MDRV_COLORTABLE_LENGTH(1024)
|
||||
|
||||
MDRV_VIDEO_START(miniboy7)
|
||||
MDRV_VIDEO_UPDATE(miniboy7)
|
||||
|
@ -45,13 +45,13 @@
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
|
||||
extern WRITE8_HANDLER(mole_videoram_w);
|
||||
extern WRITE8_HANDLER(mole_tilebank_w);
|
||||
extern WRITE8_HANDLER(mole_flipscreen_w);
|
||||
WRITE8_HANDLER(mole_videoram_w);
|
||||
WRITE8_HANDLER(mole_tilebank_w);
|
||||
WRITE8_HANDLER(mole_flipscreen_w);
|
||||
|
||||
extern PALETTE_INIT(mole);
|
||||
extern VIDEO_START(mole);
|
||||
extern VIDEO_UPDATE(mole);
|
||||
PALETTE_INIT(mole);
|
||||
VIDEO_START(mole);
|
||||
VIDEO_UPDATE(mole);
|
||||
|
||||
|
||||
static READ8_HANDLER( mole_protection_r )
|
||||
@ -209,7 +209,6 @@ static MACHINE_DRIVER_START( mole )
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 25*8-1)
|
||||
MDRV_GFXDECODE(mole)
|
||||
MDRV_PALETTE_LENGTH(8)
|
||||
MDRV_COLORTABLE_LENGTH(8)
|
||||
|
||||
MDRV_PALETTE_INIT(mole)
|
||||
MDRV_VIDEO_START(mole)
|
||||
|
@ -1669,7 +1669,6 @@ static MACHINE_DRIVER_START( dealem )
|
||||
MDRV_VIDEO_UPDATE(dealem)
|
||||
|
||||
MDRV_PALETTE_LENGTH(32)
|
||||
MDRV_COLORTABLE_LENGTH(32)
|
||||
MDRV_PALETTE_INIT(dealem)
|
||||
|
||||
MACHINE_DRIVER_END
|
||||
|
@ -189,8 +189,7 @@ static MACHINE_DRIVER_START( mrdo )
|
||||
MDRV_SCREEN_SIZE(32*8, 32*8)
|
||||
MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 4*8, 28*8-1)
|
||||
MDRV_GFXDECODE(mrdo)
|
||||
MDRV_PALETTE_LENGTH(256)
|
||||
MDRV_COLORTABLE_LENGTH(64*4+16*4)
|
||||
MDRV_PALETTE_LENGTH(64*4+16*4)
|
||||
|
||||
MDRV_PALETTE_INIT(mrdo)
|
||||
MDRV_VIDEO_START(mrdo)
|
||||
|
@ -193,8 +193,7 @@ static MACHINE_DRIVER_START( mrjong )
|
||||
MDRV_SCREEN_SIZE(32*8, 32*8)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 30*8-1, 2*8, 30*8-1)
|
||||
MDRV_GFXDECODE(mrjong)
|
||||
MDRV_PALETTE_LENGTH(16)
|
||||
MDRV_COLORTABLE_LENGTH(4*32)
|
||||
MDRV_PALETTE_LENGTH(4*32)
|
||||
|
||||
MDRV_PALETTE_INIT(mrjong)
|
||||
MDRV_VIDEO_START(mrjong)
|
||||
|
@ -22,32 +22,32 @@ static const rectangle flip_spritevisiblearea =
|
||||
|
||||
PALETTE_INIT( mermaid )
|
||||
{
|
||||
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
|
||||
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
|
||||
|
||||
// first, the char actor/sprite palette
|
||||
int i;
|
||||
|
||||
for (i = 0; i < TOTAL_COLORS(0); i++)
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x41);
|
||||
|
||||
for (i = 0; i < 0x40; i++)
|
||||
{
|
||||
int r = 0x21 * BIT(*color_prom, 0) + 0x47 * BIT(*color_prom, 1) + 0x97 * BIT(*color_prom, 2);
|
||||
int g = 0x21 * BIT(*color_prom, 3) + 0x47 * BIT(*color_prom, 4) + 0x97 * BIT(*color_prom, 5);
|
||||
int b = 0x47 * BIT(*color_prom, 6) + 0x97 * BIT(*color_prom, 7);
|
||||
int r = 0x21 * BIT(color_prom[i], 0) + 0x47 * BIT(color_prom[i], 1) + 0x97 * BIT(color_prom[i], 2);
|
||||
int g = 0x21 * BIT(color_prom[i], 3) + 0x47 * BIT(color_prom[i], 4) + 0x97 * BIT(color_prom[i], 5);
|
||||
int b = 0x47 * BIT(color_prom[i], 6) + 0x97 * BIT(color_prom[i], 7);
|
||||
|
||||
palette_set_color(machine, i, MAKE_RGB(r, g, b));
|
||||
|
||||
color_prom++;
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
// blue background
|
||||
palette_set_color(machine, TOTAL_COLORS(0), MAKE_RGB(0, 0, 0xff));
|
||||
/* blue background */
|
||||
colortable_palette_set_color(machine->colortable, 0x40, MAKE_RGB(0, 0, 0xff));
|
||||
|
||||
// set up background palette
|
||||
COLOR(2,0) = 32;
|
||||
COLOR(2,1) = 33;
|
||||
/* char/sprite palette */
|
||||
for (i = 0; i < 0x40; i++)
|
||||
colortable_entry_set_value(machine->colortable, i, i);
|
||||
|
||||
COLOR(2,2) = 64;
|
||||
COLOR(2,3) = 33;
|
||||
/* background palette */
|
||||
colortable_entry_set_value(machine->colortable, 0x40, 0x20);
|
||||
colortable_entry_set_value(machine->colortable, 0x41, 0x21);
|
||||
colortable_entry_set_value(machine->colortable, 0x42, 0x40);
|
||||
colortable_entry_set_value(machine->colortable, 0x43, 0x21);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( mermaid_videoram2_w )
|
||||
@ -141,13 +141,10 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
VIDEO_START( mermaid )
|
||||
{
|
||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 32);
|
||||
|
||||
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 32);
|
||||
|
||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
tilemap_set_scroll_cols(bg_tilemap, 32);
|
||||
|
||||
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
tilemap_set_scroll_cols(fg_tilemap, 32);
|
||||
tilemap_set_transparent_pen(fg_tilemap, 0);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "video/resnet.h"
|
||||
|
||||
static int palettebank;
|
||||
|
||||
@ -29,63 +30,63 @@ static tilemap *bg_tilemap;
|
||||
***************************************************************************/
|
||||
PALETTE_INIT( mikie )
|
||||
{
|
||||
static const int resistances[4] = { 2200, 1000, 470, 220 };
|
||||
double rweights[4], gweights[4], bweights[4];
|
||||
int i;
|
||||
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
|
||||
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
|
||||
|
||||
/* compute the color output resistor weights */
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
4, resistances, rweights, 470, 0,
|
||||
4, resistances, gweights, 470, 0,
|
||||
4, resistances, bweights, 470, 0);
|
||||
|
||||
for (i = 0;i < machine->drv->total_colors;i++)
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x100);
|
||||
|
||||
/* create a lookup table for the palette */
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
int bit0,bit1,bit2,bit3,r,g,b;
|
||||
int bit0, bit1, bit2, bit3;
|
||||
int r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
|
||||
bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
|
||||
bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
|
||||
bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
|
||||
r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
|
||||
|
||||
bit0 = (color_prom[0] >> 0) & 0x01;
|
||||
bit1 = (color_prom[0] >> 1) & 0x01;
|
||||
bit2 = (color_prom[0] >> 2) & 0x01;
|
||||
bit3 = (color_prom[0] >> 3) & 0x01;
|
||||
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
|
||||
bit0 = (color_prom[machine->drv->total_colors] >> 0) & 0x01;
|
||||
bit1 = (color_prom[machine->drv->total_colors] >> 1) & 0x01;
|
||||
bit2 = (color_prom[machine->drv->total_colors] >> 2) & 0x01;
|
||||
bit3 = (color_prom[machine->drv->total_colors] >> 3) & 0x01;
|
||||
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
|
||||
bit0 = (color_prom[2*machine->drv->total_colors] >> 0) & 0x01;
|
||||
bit1 = (color_prom[2*machine->drv->total_colors] >> 1) & 0x01;
|
||||
bit2 = (color_prom[2*machine->drv->total_colors] >> 2) & 0x01;
|
||||
bit3 = (color_prom[2*machine->drv->total_colors] >> 3) & 0x01;
|
||||
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
|
||||
/* green component */
|
||||
bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
|
||||
bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
|
||||
bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
|
||||
bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
|
||||
g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
/* blue component */
|
||||
bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
|
||||
bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
|
||||
bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
|
||||
bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
|
||||
b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
|
||||
|
||||
color_prom++;
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
color_prom += 2*machine->drv->total_colors;
|
||||
/* color_prom now points to the beginning of the character lookup table */
|
||||
/* color_prom now points to the beginning of the lookup table,*/
|
||||
color_prom += 0x300;
|
||||
|
||||
|
||||
/* there are eight 32 colors palette banks; sprites use colors 0-15 and */
|
||||
/* characters 16-31 of each bank. */
|
||||
for (i = 0;i < TOTAL_COLORS(0)/8;i++)
|
||||
/* characters use colors 0x10-0x1f of each 0x20 color bank,
|
||||
while sprites use colors 0-0x0f */
|
||||
for (i = 0; i < 0x200; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
|
||||
for (j = 0;j < 8;j++)
|
||||
COLOR(0,i + j * TOTAL_COLORS(0)/8) = (*color_prom & 0x0f) + 32 * j + 16;
|
||||
|
||||
color_prom++;
|
||||
}
|
||||
|
||||
for (i = 0;i < TOTAL_COLORS(1)/8;i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
|
||||
for (j = 0;j < 8;j++)
|
||||
COLOR(1,i + j * TOTAL_COLORS(1)/8) = (*color_prom & 0x0f) + 32 * j;
|
||||
|
||||
color_prom++;
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
UINT8 ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
|
||||
colortable_entry_set_value(machine->colortable, ((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,7 @@ VIDEO_START( mole )
|
||||
{
|
||||
tileram = (UINT16 *)auto_malloc(0x400 * sizeof(UINT16));
|
||||
|
||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 40, 25);
|
||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( mole_videoram_w )
|
||||
|
@ -61,7 +61,7 @@ PALETTE_INIT( mrdo )
|
||||
int weight[16];
|
||||
const float potadjust = 0.2f; /* diode voltage drop */
|
||||
|
||||
for (i = 15;i >= 0;i--)
|
||||
for (i = 0x0f; i >= 0; i--)
|
||||
{
|
||||
float par = 0;
|
||||
|
||||
@ -76,42 +76,57 @@ PALETTE_INIT( mrdo )
|
||||
}
|
||||
else pot[i] = 0;
|
||||
|
||||
weight[i] = 255 * pot[i] / pot[15];
|
||||
weight[i] = 0xff * pot[i] / pot[0x0f];
|
||||
}
|
||||
|
||||
for (i = 0;i < 256;i++)
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x100);
|
||||
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
int a1,a2;
|
||||
int bits0,bits2,r,g,b;
|
||||
int bits0, bits2;
|
||||
int r, g, b;
|
||||
|
||||
a1 = ((i >> 3) & 0x1c) + (i & 0x03) + 32;
|
||||
a2 = ((i >> 0) & 0x1c) + (i & 0x03);
|
||||
|
||||
/* red component */
|
||||
bits0 = (color_prom[a1] >> 0) & 0x03;
|
||||
bits2 = (color_prom[a2] >> 0) & 0x03;
|
||||
r = weight[bits0 + (bits2 << 2)];
|
||||
|
||||
/* green component */
|
||||
bits0 = (color_prom[a1] >> 2) & 0x03;
|
||||
bits2 = (color_prom[a2] >> 2) & 0x03;
|
||||
g = weight[bits0 + (bits2 << 2)];
|
||||
|
||||
/* blue component */
|
||||
bits0 = (color_prom[a1] >> 4) & 0x03;
|
||||
bits2 = (color_prom[a2] >> 4) & 0x03;
|
||||
b = weight[bits0 + (bits2 << 2)];
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
color_prom += 64;
|
||||
/* color_prom now points to the beginning of the lookup table */
|
||||
color_prom += 0x40;
|
||||
|
||||
/* characters */
|
||||
for (i = 0; i < 0x100; i++)
|
||||
colortable_entry_set_value(machine->colortable, i, i);
|
||||
|
||||
/* sprites */
|
||||
for (i = 0;i < TOTAL_COLORS(2);i++)
|
||||
for (i = 0x100; i < 0x140; i++)
|
||||
{
|
||||
int bits;
|
||||
UINT8 ctabentry = color_prom[(i - 0x100) & 0x1f];
|
||||
|
||||
if (i < 32)
|
||||
bits = color_prom[i] & 0x0f; /* low 4 bits are for sprite color n */
|
||||
if ((i - 0x100) & 0x20)
|
||||
ctabentry = ctabentry >> 4; /* high 4 bits are for sprite color n + 8 */
|
||||
else
|
||||
bits = color_prom[i & 0x1f] >> 4; /* high 4 bits are for sprite color n + 8 */
|
||||
ctabentry = ctabentry & 0x0f; /* low 4 bits are for sprite color n */
|
||||
|
||||
COLOR(2,i) = bits + ((bits & 0x0c) << 3);
|
||||
colortable_entry_set_value(machine->colortable, i, ctabentry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,40 +18,46 @@ static tilemap *bg_tilemap;
|
||||
PALETTE_INIT( mrjong )
|
||||
{
|
||||
int i;
|
||||
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
|
||||
#define COLOR(gfxn, offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + (offs)])
|
||||
|
||||
for (i = 0; i < machine->drv->total_colors; i++)
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x10);
|
||||
|
||||
/* create a lookup table for the palette */
|
||||
for (i = 0; i < 0x10; i++)
|
||||
{
|
||||
int bit0, bit1, bit2, r, g, b;
|
||||
int bit0, bit1, bit2;
|
||||
int r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = (*color_prom >> 0) & 0x01;
|
||||
bit1 = (*color_prom >> 1) & 0x01;
|
||||
bit2 = (*color_prom >> 2) & 0x01;
|
||||
bit0 = (color_prom[i] >> 0) & 0x01;
|
||||
bit1 = (color_prom[i] >> 1) & 0x01;
|
||||
bit2 = (color_prom[i] >> 2) & 0x01;
|
||||
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
/* green component */
|
||||
bit0 = (*color_prom >> 3) & 0x01;
|
||||
bit1 = (*color_prom >> 4) & 0x01;
|
||||
bit2 = (*color_prom >> 5) & 0x01;
|
||||
bit0 = (color_prom[i] >> 3) & 0x01;
|
||||
bit1 = (color_prom[i] >> 4) & 0x01;
|
||||
bit2 = (color_prom[i] >> 5) & 0x01;
|
||||
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
/* blue component */
|
||||
bit0 = 0;
|
||||
bit1 = (*color_prom >> 6) & 0x01;
|
||||
bit2 = (*color_prom >> 7) & 0x01;
|
||||
bit1 = (color_prom[i] >> 6) & 0x01;
|
||||
bit2 = (color_prom[i] >> 7) & 0x01;
|
||||
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
color_prom++;
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
color_prom += 0x10;
|
||||
/* color_prom now points to the beginning of the lookup table */
|
||||
color_prom += 0x20;
|
||||
|
||||
/* character lookup table */
|
||||
/* sprites use the same color lookup table as characters */
|
||||
for (i = 0; i < TOTAL_COLORS(0); i++)
|
||||
COLOR(0, i) = *(color_prom++) & 0x0f;
|
||||
/* characters/sprites */
|
||||
for (i = 0; i < 0x80; i++)
|
||||
{
|
||||
UINT8 ctabentry = color_prom[i] & 0x0f;
|
||||
colortable_entry_set_value(machine->colortable, i, ctabentry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -92,8 +98,7 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( mrjong )
|
||||
{
|
||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows_flip_xy,
|
||||
8, 8, 32, 32);
|
||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows_flip_xy, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
|
||||
|
Loading…
Reference in New Issue
Block a user