mirror of
https://github.com/holub/mame
synced 2025-06-26 06:14:12 +03:00
fcombat: fix bg colors, add fg tilemap instead of drawing manually
This commit is contained in:
parent
7339d3f904
commit
98cda496b3
@ -12,14 +12,8 @@ TS 2004.10.22.
|
|||||||
(press buttons 1+2 at the same time, to release 'army' ;)
|
(press buttons 1+2 at the same time, to release 'army' ;)
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- fix colours (sprites, bg), not many PCB references online
|
- verify sprite colors, not many PCB references online, but comparing with
|
||||||
sprites: maybe they are correct? player ufo is ok, soldiers are ok,
|
the small amount of photos that are there, they match
|
||||||
explosions probably ok, helicopters ok, kidnapper ufo ok
|
|
||||||
bg: 16 levels, each has a different color, from photos:
|
|
||||||
- 1st level: green,black?,?,?
|
|
||||||
- 8th level(visible at bottom of 1st level): black,darkred,grey,white
|
|
||||||
More levels on the flyer, but might not be the final version of the game.
|
|
||||||
- cocktail mode doesn't work right
|
|
||||||
|
|
||||||
|
|
||||||
PCB Notes:
|
PCB Notes:
|
||||||
@ -87,6 +81,7 @@ private:
|
|||||||
|
|
||||||
// video-related
|
// video-related
|
||||||
tilemap_t *m_bgmap = nullptr;
|
tilemap_t *m_bgmap = nullptr;
|
||||||
|
tilemap_t *m_fgmap = nullptr;
|
||||||
u8 m_cocktail_flip = 0;
|
u8 m_cocktail_flip = 0;
|
||||||
u8 m_char_palette = 0;
|
u8 m_char_palette = 0;
|
||||||
u8 m_char_bank = 0;
|
u8 m_char_bank = 0;
|
||||||
@ -113,7 +108,9 @@ private:
|
|||||||
u8 e300_r();
|
u8 e300_r();
|
||||||
void ee00_w(u8 data);
|
void ee00_w(u8 data);
|
||||||
void videoreg_w(u8 data);
|
void videoreg_w(u8 data);
|
||||||
|
void videoram_w(offs_t offset, u8 data);
|
||||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||||
|
TILE_GET_INFO_MEMBER(get_fg_tile_info);
|
||||||
void fcombat_palette(palette_device &palette) const;
|
void fcombat_palette(palette_device &palette) const;
|
||||||
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
void audio_map(address_map &map);
|
void audio_map(address_map &map);
|
||||||
@ -131,16 +128,11 @@ static constexpr XTAL PIXEL_CLOCK = MASTER_CLOCK / 3;
|
|||||||
static constexpr int HCOUNT_START = 0x58;
|
static constexpr int HCOUNT_START = 0x58;
|
||||||
static constexpr int HTOTAL = 512 - HCOUNT_START;
|
static constexpr int HTOTAL = 512 - HCOUNT_START;
|
||||||
static constexpr int HBEND = 12 * 8; // ??
|
static constexpr int HBEND = 12 * 8; // ??
|
||||||
static constexpr int HBSTART = 52 * 8; //
|
static constexpr int HBSTART = 52 * 8; // ??
|
||||||
static constexpr int VTOTAL = 256;
|
static constexpr int VTOTAL = 256;
|
||||||
static constexpr int VBEND = 16;
|
static constexpr int VBEND = 16;
|
||||||
static constexpr int VBSTART = 240;
|
static constexpr int VBSTART = 240;
|
||||||
|
|
||||||
static constexpr int VISIBLE_X_MIN = 12 * 8;
|
|
||||||
static constexpr int VISIBLE_X_MAX = 52 * 8;
|
|
||||||
static constexpr int VISIBLE_Y_MIN = 2 * 8;
|
|
||||||
static constexpr int VISIBLE_Y_MAX = 30 * 8;
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
@ -224,16 +216,34 @@ void fcombat_state::fcombat_palette(palette_device &palette) const
|
|||||||
|
|
||||||
void fcombat_state::video_start()
|
void fcombat_state::video_start()
|
||||||
{
|
{
|
||||||
|
m_fgmap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(fcombat_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
|
||||||
|
m_fgmap->set_transparent_pen(0);
|
||||||
|
|
||||||
m_bgmap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(fcombat_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32 * 8 * 2, 32);
|
m_bgmap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(fcombat_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32 * 8 * 2, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
TILE_GET_INFO_MEMBER(fcombat_state::get_bg_tile_info)
|
TILE_GET_INFO_MEMBER(fcombat_state::get_bg_tile_info)
|
||||||
{
|
{
|
||||||
const int tileno = m_bgdata_rom[tile_index];
|
const int tileno = m_bgdata_rom[tile_index];
|
||||||
const int palno = (tile_index >> 5 & 0xf) ^ 7;
|
const int palno = (tileno >> 2 & 3) | (tileno >> 4 & 0xc);
|
||||||
|
|
||||||
tileinfo.set(2, tileno, palno, 0);
|
tileinfo.set(2, tileno, palno, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER(fcombat_state::get_fg_tile_info)
|
||||||
|
{
|
||||||
|
const int tileno = m_videoram[tile_index] | (m_char_bank << 8);
|
||||||
|
const int palno = (tileno >> 4 & 0xf) | (m_char_palette << 4);
|
||||||
|
|
||||||
|
tileinfo.set(0, tileno, palno, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fcombat_state::videoram_w(offs_t offset, u8 data)
|
||||||
|
{
|
||||||
|
m_videoram[offset] = data;
|
||||||
|
m_fgmap->mark_tile_dirty(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
@ -245,12 +255,18 @@ void fcombat_state::videoreg_w(u8 data)
|
|||||||
{
|
{
|
||||||
// bit 0: flip screen and joystick input multiplexer
|
// bit 0: flip screen and joystick input multiplexer
|
||||||
m_cocktail_flip = data & 1;
|
m_cocktail_flip = data & 1;
|
||||||
|
flip_screen_set(m_cocktail_flip);
|
||||||
|
|
||||||
// bits 1-2: char lookup table bank
|
// bits 1-2: char lookup table bank
|
||||||
m_char_palette = (data & 0x06) >> 1;
|
|
||||||
|
|
||||||
// bit 3: char bank
|
// bit 3: char bank
|
||||||
m_char_bank = (data & 0x08) >> 3;
|
u8 char_pal = (data & 0x06) >> 1;
|
||||||
|
u8 char_bank = (data & 0x08) >> 3;
|
||||||
|
if (m_char_palette != char_pal || m_char_bank != char_bank)
|
||||||
|
{
|
||||||
|
m_char_palette = char_pal;
|
||||||
|
m_char_bank = char_bank;
|
||||||
|
m_fgmap->mark_all_dirty();
|
||||||
|
}
|
||||||
|
|
||||||
// bits 4-5: unused
|
// bits 4-5: unused
|
||||||
|
|
||||||
@ -263,9 +279,11 @@ u32 fcombat_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co
|
|||||||
{
|
{
|
||||||
// draw background
|
// draw background
|
||||||
m_bgmap->set_scrolly(0, m_fcombat_sh);
|
m_bgmap->set_scrolly(0, m_fcombat_sh);
|
||||||
m_bgmap->set_scrollx(0, m_fcombat_sv - 8);
|
if (m_cocktail_flip)
|
||||||
|
m_bgmap->set_scrollx(0, m_fcombat_sv + 8 - 2);
|
||||||
|
else
|
||||||
|
m_bgmap->set_scrollx(0, m_fcombat_sv - 8);
|
||||||
|
|
||||||
m_bgmap->mark_all_dirty();
|
|
||||||
m_bgmap->draw(screen, bitmap, cliprect, 0, 0);
|
m_bgmap->draw(screen, bitmap, cliprect, 0, 0);
|
||||||
|
|
||||||
// draw sprites
|
// draw sprites
|
||||||
@ -293,8 +311,8 @@ u32 fcombat_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co
|
|||||||
|
|
||||||
if (m_cocktail_flip)
|
if (m_cocktail_flip)
|
||||||
{
|
{
|
||||||
x = 64 * 8 - gfx->width() - x;
|
x = 64 * 8 - gfx->width() - x + 2;
|
||||||
y = 32 * 8 - gfx->height() - y;
|
y = 32 * 8 - gfx->height() - y + 2;
|
||||||
if (wide) y -= gfx->height();
|
if (wide) y -= gfx->height();
|
||||||
xflip = !xflip;
|
xflip = !xflip;
|
||||||
yflip = !yflip;
|
yflip = !yflip;
|
||||||
@ -321,19 +339,9 @@ u32 fcombat_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co
|
|||||||
gfx->transpen(bitmap, cliprect, code, color, xflip, yflip, x, y, 0);
|
gfx->transpen(bitmap, cliprect, code, color, xflip, yflip, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the visible text layer
|
// draw text layer
|
||||||
for (int sy = VISIBLE_Y_MIN / 8; sy < VISIBLE_Y_MAX / 8; sy++)
|
m_fgmap->draw(screen, bitmap, cliprect, 0, 0);
|
||||||
for (int sx = VISIBLE_X_MIN / 8; sx < VISIBLE_X_MAX / 8; sx++)
|
|
||||||
{
|
|
||||||
const int x = m_cocktail_flip ? (63 * 8 - 8 * sx) : 8 * sx;
|
|
||||||
const int y = m_cocktail_flip ? (31 * 8 - 8 * sy) : 8 * sy;
|
|
||||||
|
|
||||||
const int offs = sx + sy * 64;
|
|
||||||
m_gfxdecode->gfx(0)->transpen(bitmap, cliprect,
|
|
||||||
m_videoram[offs] + 256 * m_char_bank,
|
|
||||||
((m_videoram[offs] & 0xf0) >> 4) + m_char_palette * 16,
|
|
||||||
m_cocktail_flip, m_cocktail_flip, x, y, 0);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,7 +425,7 @@ void fcombat_state::main_map(address_map &map)
|
|||||||
{
|
{
|
||||||
map(0x0000, 0x7fff).rom();
|
map(0x0000, 0x7fff).rom();
|
||||||
map(0xc000, 0xc7ff).ram();
|
map(0xc000, 0xc7ff).ram();
|
||||||
map(0xd000, 0xd7ff).ram().share(m_videoram);
|
map(0xd000, 0xd7ff).ram().share(m_videoram).w(FUNC(fcombat_state::videoram_w));
|
||||||
map(0xd800, 0xd8ff).ram().share(m_spriteram);
|
map(0xd800, 0xd8ff).ram().share(m_spriteram);
|
||||||
map(0xe000, 0xe000).r(FUNC(fcombat_state::port01_r));
|
map(0xe000, 0xe000).r(FUNC(fcombat_state::port01_r));
|
||||||
map(0xe100, 0xe100).portr("DSW0");
|
map(0xe100, 0xe100).portr("DSW0");
|
||||||
@ -730,4 +738,4 @@ ROM_END
|
|||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
GAME( 1985, fcombat, 0, fcombat, fcombat, fcombat_state, init_fcombat, ROT90, "Jaleco", "Field Combat", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
|
GAME( 1985, fcombat, 0, fcombat, fcombat, fcombat_state, init_fcombat, ROT90, "Jaleco", "Field Combat", MACHINE_SUPPORTS_SAVE )
|
||||||
|
Loading…
Reference in New Issue
Block a user