Fixed 00865: blandia: In Jurane stage, the whole bottom of the screen is filled with solid gray [Pierpaolo Prazzoli]

This commit is contained in:
Pierpaolo Prazzoli 2011-01-15 17:47:10 +00:00
parent 7a261e4514
commit d2ff1f0c52
3 changed files with 135 additions and 16 deletions

View File

@ -80,7 +80,7 @@ PO-122-A (SZR-001) 95 Zombie Raid American Sammy
doesn't behave *exactly* the same as the original seta hw
(6) To enter test mode press 9 (open door), then F2 (turn function key), then E (bet 3-4).
(7) Bad tilemaps colors in demo mode are real game bug. Fade-in and fade-out "bad" colors are also right.
Bad sprites priorities are real game bugs.
Bad sprites priorities are real game bugs. The bad-looking colors in Jurane stage are right.
Notes:
- The NEC D4701 used by Caliber 50 is a mouse interface IC (uPD4701c).
@ -1812,7 +1812,7 @@ static ADDRESS_MAP_START( blandia_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r) // DSW
AM_RANGE(0x700000, 0x7003ff) AM_RAM // (rezon,jjsquawk)
AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, paletteram, paletteram_size) // Palette
AM_RANGE(0x703c00, 0x7047ff) AM_RAM // 2nd palette (?), written in the stage with the tilemap blending (?) effect, or just mirror
AM_RANGE(0x703c00, 0x7047ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, paletteram2, paletteram2_size) // 2nd Palette for the palette offset effect
/**/AM_RANGE(0x800000, 0x800607) AM_RAM AM_BASE_MEMBER(seta_state, spriteram) // Sprites Y
AM_RANGE(0x880000, 0x880001) AM_RAM // ? 0xc000
AM_RANGE(0x900000, 0x903fff) AM_RAM AM_BASE_MEMBER(seta_state, spriteram2) // Sprites Code + X + Attr
@ -1846,7 +1846,7 @@ static ADDRESS_MAP_START( blandiap_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r) // DSW
AM_RANGE(0x700000, 0x7003ff) AM_RAM // (rezon,jjsquawk)
AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, paletteram, paletteram_size) // Palette
AM_RANGE(0x703c00, 0x7047ff) AM_RAM // 2nd palette (?), written in the stage with the tilemap blending (?) effect, or just mirror
AM_RANGE(0x703c00, 0x7047ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, paletteram2, paletteram2_size) // 2nd Palette for the palette offset effect
AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE_MEMBER(seta_state, vram_0) // VRAM 0&1
AM_RANGE(0x804000, 0x80ffff) AM_RAM // (jjsquawk)
AM_RANGE(0x880000, 0x883fff) AM_RAM_WRITE(seta_vram_2_w) AM_BASE_MEMBER(seta_state, vram_2) // VRAM 2&3
@ -7193,7 +7193,7 @@ static MACHINE_CONFIG_START( blandia, seta_state )
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1)
MCFG_GFXDECODE(blandia)
MCFG_PALETTE_LENGTH(16*32+64*32*4) /* sprites, layer1, layer2 */
MCFG_PALETTE_LENGTH((16*32+64*32*4)*2) /* sprites, layer1, layer2, palette effect */
MCFG_PALETTE_INIT(blandia) /* layers 1&2 are 6 planes deep */
MCFG_VIDEO_START(seta_2_layers)
@ -7225,7 +7225,7 @@ static MACHINE_CONFIG_START( blandiap, seta_state )
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1)
MCFG_GFXDECODE(blandia)
MCFG_PALETTE_LENGTH(16*32+64*32*4) /* sprites, layer1, layer2 */
MCFG_PALETTE_LENGTH((16*32+64*32*4)*2) /* sprites, layer1, layer2, palette effect */
MCFG_PALETTE_INIT(blandia) /* layers 1&2 are 6 planes deep */
MCFG_VIDEO_START(seta_2_layers)

View File

@ -41,6 +41,8 @@ public:
UINT16 *spriteram2;
UINT16 *paletteram;
size_t paletteram_size;
UINT16 *paletteram2;
size_t paletteram2_size;
int tiles_offset;
tilemap_t *tilemap_0;

View File

@ -565,9 +565,10 @@ PALETTE_INIT( blandia )
int color, pen;
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x600);
machine->colortable = colortable_alloc(machine, 0x600*2);
for (color = 0; color < 0x20; color++)
{
for (pen = 0; pen < 0x40; pen++)
{
// layer 2-3
@ -578,6 +579,14 @@ PALETTE_INIT( blandia )
colortable_entry_set_value(machine->colortable, 0x0a00 + ((color << 6) | pen), 0x400 + ((color << 4) | (pen & 0x0f)));
colortable_entry_set_value(machine->colortable, 0x1a00 + ((color << 6) | pen), 0x400 + pen);
}
}
// setup the colortable for the effect palette.
// what are used for palette from 0x800 to 0xBFF?
for(int i = 0; i < 0x2200; i++)
{
colortable_entry_set_value(machine->colortable, 0x2200 + i, 0x600 + (i & 0x1ff));
}
}
@ -705,6 +714,21 @@ static void set_pens(running_machine *machine)
else
palette_set_color(machine, i, color);
}
if(state->paletteram2 != NULL)
{
for (i = 0; i < state->paletteram2_size / 2; i++)
{
UINT16 data = state->paletteram2[i];
rgb_t color = MAKE_RGB(pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0));
if (machine->colortable != NULL)
colortable_palette_set_color(machine->colortable, i + state->paletteram_size / 2, color);
else
palette_set_color(machine, i + state->paletteram_size / 2, color);
}
}
}
@ -737,7 +761,7 @@ static void usclssic_set_pens(running_machine *machine)
***************************************************************************/
static void draw_sprites_map(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
static void draw_sprites_map(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
seta_state *state = machine->driver_data<seta_state>();
UINT16 *spriteram16 = state->spriteram;
@ -842,7 +866,7 @@ twineagl: 000 027 00 0f (test mode)
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
seta_state *state = machine->driver_data<seta_state>();
UINT16 *spriteram16 = state->spriteram;
@ -901,7 +925,51 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
}
static void draw_tilemap_palette_effect(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap_t *tilemap, int scrollx, int scrolly, int gfxnum, int flipscreen)
{
int y;
const gfx_element *gfx_tilemap = machine->gfx[gfxnum];
const bitmap_t *src_bitmap = tilemap_get_pixmap(tilemap);
int width_mask, height_mask;
int opaque_mask = gfx_tilemap->color_granularity - 1;
int pixel_effect_mask = gfx_tilemap->color_base + (gfx_tilemap->total_colors - 1) * gfx_tilemap->color_granularity;
int p;
width_mask = src_bitmap->width - 1;
height_mask = src_bitmap->height - 1;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
{
UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
int x;
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
{
if(!flipscreen)
{
p = *BITMAP_ADDR16(src_bitmap, (y + scrolly) & height_mask, (x + scrollx) & width_mask);
}
else
{
p = *BITMAP_ADDR16(src_bitmap, (y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask);
}
// draw not transparent pixels
if(p & opaque_mask)
{
// pixels with the last color are not drawn and the 2nd palette is added to the current bitmap color
if((p & pixel_effect_mask) == pixel_effect_mask)
{
dest[x] = machine->total_colors() / 2 + dest[x];
}
else
{
dest[x] = machine->pens[p];
}
}
}
}
}
@ -928,7 +996,7 @@ static VIDEO_UPDATE( seta_layers )
{
seta_state *state = screen->machine->driver_data<seta_state>();
int layers_ctrl = -1;
int enab_0, enab_1, x_0, x_1, y_0, y_1;
int enab_0, enab_1, x_0, x_1=0, y_0, y_1=0;
int order = 0;
int flip = (state->spriteram[ 0x600/2 ] & 0x40) >> 6;
@ -936,7 +1004,6 @@ static VIDEO_UPDATE( seta_layers )
const rectangle &visarea = screen->visible_area();
int vis_dimy = visarea.max_y - visarea.min_y + 1;
// check tilemaps color modes
if(state->current_tilemap_mode[0] != (state->vctrl_0[ 4/2 ] & 0x10))
@ -1043,13 +1110,25 @@ if (input_code_pressed(screen->machine, KEYCODE_Z))
if (order & 2) // layer-sprite priority?
{
if (layers_ctrl & 8) draw_sprites(screen->machine,bitmap,cliprect);
if(order & 4)
{
popmessage("Missing palette effect. Contact MAMETesters.");
}
if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->tilemap_0, 0, 0);
if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->tilemap_1, 0, 0);
}
else
{
if(order & 4)
{
popmessage("Missing palette effect. Contact MAMETesters.");
}
if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->tilemap_0, 0, 0);
if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->tilemap_1, 0, 0);
if (layers_ctrl & 8) draw_sprites(screen->machine, bitmap,cliprect);
}
}
@ -1062,18 +1141,56 @@ if (input_code_pressed(screen->machine, KEYCODE_Z))
{
if (layers_ctrl & 8) draw_sprites(screen->machine, bitmap,cliprect);
if (state->tilemap_2)
if((order & 4) && state->paletteram2 != NULL)
{
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_2, 0, 0);
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_3, 0, 0);
if(tilemap_get_enable(state->tilemap_2))
{
draw_tilemap_palette_effect(screen->machine, bitmap, cliprect, state->tilemap_2, x_1, y_1, 2 + ((state->vctrl_2[ 4/2 ] & 0x10) >> state->color_mode_shift), flip);
}
else
{
draw_tilemap_palette_effect(screen->machine, bitmap, cliprect, state->tilemap_3, x_1, y_1, 2 + ((state->vctrl_2[ 4/2 ] & 0x10) >> state->color_mode_shift), flip);
}
}
else
{
if(order & 4)
{
popmessage("Missing palette effect. Contact MAMETesters.");
}
if (state->tilemap_2)
{
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_2, 0, 0);
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_3, 0, 0);
}
}
}
else
{
if (state->tilemap_2)
if((order & 4) && state->paletteram2 != NULL)
{
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_2, 0, 0);
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_3, 0, 0);
if(tilemap_get_enable(state->tilemap_2))
{
draw_tilemap_palette_effect(screen->machine, bitmap, cliprect, state->tilemap_2, x_1, y_1, 2 + ((state->vctrl_2[ 4/2 ] & 0x10) >> state->color_mode_shift), flip);
}
else
{
draw_tilemap_palette_effect(screen->machine, bitmap, cliprect, state->tilemap_3, x_1, y_1, 2 + ((state->vctrl_2[ 4/2 ] & 0x10) >> state->color_mode_shift), flip);
}
}
else
{
if(order & 4)
{
popmessage("Missing palette effect. Contact MAMETesters.");
}
if (state->tilemap_2)
{
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_2, 0, 0);
if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->tilemap_3, 0, 0);
}
}
if (layers_ctrl & 8) draw_sprites(screen->machine, bitmap,cliprect);