galivan.cpp : Add hide text layer support, and fix text color attlibute (#5957)

* galivan.cpp : Add hide text layer support, and fix text color attlibute

- 06946: dangar, dangara, dangarb, dangarbt, dangarj: missing black screen between areas (black hole warp)
- 07493: dangar, dangara, dangarb, dangarj, galivan, galivan2, galivan3: Some text displays red, but actial is white
- Fixed corrupt title logo of dangar.

* Fix source format

* Fix source format
This commit is contained in:
sasuke-arcade 2019-11-25 00:35:52 +09:00 committed by ajrhacker
parent 723969154f
commit 9eb74a7b41
3 changed files with 78 additions and 24 deletions

View File

@ -375,9 +375,15 @@ static const gfx_layout spritelayout =
};
static GFXDECODE_START( gfx_galivan )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 8 )
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 8*16, 16 )
GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 8*16+16*16, 256 )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 )
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 16*16, 16 )
GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 16*16+16*16, 256 )
GFXDECODE_END
static GFXDECODE_START( gfx_ninjemak )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 8 )
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 8*16, 16 )
GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 8*16+16*16, 256 )
GFXDECODE_END
@ -392,7 +398,6 @@ MACHINE_START_MEMBER(galivan_state,galivan)
/* register for saving */
save_item(NAME(m_scrollx));
save_item(NAME(m_scrolly));
save_item(NAME(m_write_layers));
save_item(NAME(m_layers));
}
@ -413,9 +418,7 @@ MACHINE_RESET_MEMBER(galivan_state,galivan)
{
m_maincpu->reset();
// m_layers = 0x60;
m_layers = 0;
m_write_layers = 0;
m_galivan_scrollx[0] = m_galivan_scrollx[1] = 0;
m_galivan_scrolly[0] = m_galivan_scrolly[1] = 0;
}
@ -458,7 +461,7 @@ void galivan_state::galivan(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_galivan);
PALETTE(config, m_palette, FUNC(galivan_state::galivan_palette), 8*16+16*16+256*16, 256);
PALETTE(config, m_palette, FUNC(galivan_state::galivan_palette), 16*16+16*16+256*16, 256);
MCFG_VIDEO_START_OVERRIDE(galivan_state,galivan)
@ -514,8 +517,8 @@ void galivan_state::ninjemak(machine_config &config)
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_galivan);
PALETTE(config, m_palette, FUNC(galivan_state::galivan_palette), 8*16+16*16+256*16, 256);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ninjemak);
PALETTE(config, m_palette, FUNC(galivan_state::ninjemak_palette), 8*16+16*16+256*16, 256);
MCFG_VIDEO_START_OVERRIDE(galivan_state,ninjemak)

View File

@ -53,7 +53,6 @@ private:
uint16_t m_scrollx;
uint16_t m_scrolly;
uint8_t m_galivan_scrollx[2],m_galivan_scrolly[2];
uint8_t m_write_layers;
uint8_t m_layers;
uint8_t m_ninjemak_dispdisable;
@ -78,6 +77,7 @@ private:
TILE_GET_INFO_MEMBER(ninjemak_get_bg_tile_info);
TILE_GET_INFO_MEMBER(ninjemak_get_tx_tile_info);
void galivan_palette(palette_device &palette) const;
void ninjemak_palette(palette_device &palette) const;
DECLARE_MACHINE_START(galivan);
DECLARE_MACHINE_RESET(galivan);
DECLARE_VIDEO_START(galivan);

View File

@ -34,7 +34,8 @@ background: 0x4000 bytes of ROM: 76543210 tile code low bits
#include "emu.h"
#include "includes/galivan.h"
/* Layers has only bits 5-6 active.
/* Layers has only bits 5-7 active.
7 selects text off/on
6 selects background off/on
5 controls sprite priority (active only on title screen,
not for scores or push start nor game)
@ -42,7 +43,7 @@ background: 0x4000 bytes of ROM: 76543210 tile code low bits
/* Notes:
write_layers and layers are used in galivan/dangar but not ninjemak
layers are used in galivan/dangar but not ninjemak
ninjemak_dispdisable is used in ninjemak but not galivan/dangar
*/
@ -71,6 +72,56 @@ void galivan_state::galivan_palette(palette_device &palette) const
// color_prom now points to the beginning of the lookup table
color_prom += 0x300;
// characters use colors 0-0x3f
// the bottom two bits of the color code select the palette bank for pens 0-7;
// the top two bits for pens 8-15.
for (int i = 0; i < 0x100; i++)
{
uint8_t const ctabentry = (i & 0x0f) | ((i >> ((i & 0x08) ? 2 : 0)) & 0x30);
palette.set_pen_indirect(i, ctabentry);
}
// I think that background tiles use colors 0xc0-0xff in four banks
// the bottom two bits of the color code select the palette bank for pens 0-7;
// the top two bits for pens 8-15.
for (int i = 0; i < 0x100; i++)
{
uint8_t const ctabentry = 0xc0 | (i & 0x0f) | ((i >> ((i & 0x08) ? 2 : 0)) & 0x30);
palette.set_pen_indirect(0x100 + i, ctabentry);
}
// sprites use colors 0x80-0xbf in four banks
// The lookup table tells which colors to pick from the selected bank
// the bank is selected by another PROM and depends on the top 7 bits of the sprite code.
// The PROM selects the bank *separately* for pens 0-7 and 8-15 (like for tiles).
for (int i = 0; i < 0x1000; i++)
{
uint8_t const ctabentry = 0x80 | ((i << ((i & 0x80) ? 2 : 4)) & 0x30) | (color_prom[i >> 4] & 0x0f);
int const i_swapped = ((i & 0x0f) << 8) | ((i & 0xff0) >> 4);
palette.set_pen_indirect(0x200 + i_swapped, ctabentry);
}
}
void galivan_state::ninjemak_palette(palette_device& palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
// create a lookup table for the palette
for (int i = 0; i < 0x100; i++)
{
int const r = pal4bit(color_prom[i + 0x000]);
int const g = pal4bit(color_prom[i + 0x100]);
int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
// color_prom now points to the beginning of the lookup table
color_prom += 0x300;
// characters use colors 0-0x7f
for (int i = 0; i < 0x80; i++)
palette.set_pen_indirect(i, i);
@ -123,7 +174,7 @@ TILE_GET_INFO_MEMBER(galivan_state::get_tx_tile_info)
int code = m_videoram[tile_index] | ((attr & 0x01) << 8);
SET_TILE_INFO_MEMBER(0,
code,
(attr & 0xe0) >> 5, /* not sure */
(attr & 0x78) >> 3, /* seems correct */
0);
tileinfo.category = attr & 8 ? 0 : 1; /* seems correct */
}
@ -247,13 +298,7 @@ WRITE8_MEMBER(galivan_state::galivan_scrollx_w)
{
if (offset == 1)
{
if (data & 0x80)
m_write_layers = 1;
else if (m_write_layers)
{
m_layers = data & 0x60;
m_write_layers = 0;
}
m_layers = data & 0xe0;
}
m_galivan_scrollx[offset] = data;
}
@ -324,15 +369,21 @@ uint32_t galivan_state::screen_update_galivan(screen_device &screen, bitmap_ind1
if (m_layers & 0x20)
{
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0);
if ((m_layers & 0x80) == 0)
{
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0);
}
draw_sprites(bitmap, cliprect);
}
else
{
draw_sprites(bitmap, cliprect);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0);
if ((m_layers & 0x80) == 0)
{
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0);
}
}
return 0;