batman.cpp - offset layers to align with real PCB videos (#8275)

This commit is contained in:
David Haywood 2021-07-10 18:32:01 +01:00 committed by GitHub
parent 31e35811b6
commit 94064e4474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 6 deletions

View File

@ -199,10 +199,14 @@ void batman_state::batman(machine_config &config)
ATARI_VAD(config, m_vad, 0, m_screen);
m_vad->scanline_int_cb().set_inputline(m_maincpu, M68K_IRQ_4);
m_vad->set_xoffsets(2, 6);
TILEMAP(config, "vad:playfield", "gfxdecode", 2, 8, 8, TILEMAP_SCAN_COLS, 64, 64).set_info_callback(FUNC(batman_state::get_playfield_tile_info));
TILEMAP(config, "vad:playfield2", "gfxdecode", 2, 8, 8, TILEMAP_SCAN_COLS, 64, 64, 0).set_info_callback(FUNC(batman_state::get_playfield2_tile_info));
TILEMAP(config, "vad:alpha", "gfxdecode", 2, 8, 8, TILEMAP_SCAN_ROWS, 64, 32, 0).set_info_callback(FUNC(batman_state::get_alpha_tile_info));
ATARI_MOTION_OBJECTS(config, "vad:mob", 0, m_screen, batman_state::s_mob_config).set_gfxdecode("gfxdecode");
ATARI_MOTION_OBJECTS(config, m_mob, 0, m_screen, batman_state::s_mob_config).set_gfxdecode("gfxdecode");
m_mob->set_xoffset(-1);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);

View File

@ -25,7 +25,8 @@ public:
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
m_jsa(*this, "jsa"),
m_vad(*this, "vad")
m_vad(*this, "vad"),
m_mob(*this, "vad:mob")
{ }
void init_batman();
@ -46,6 +47,7 @@ private:
required_device<screen_device> m_screen;
required_device<atari_jsa_iii_device> m_jsa;
required_device<atari_vad_device> m_vad;
required_device<atari_motion_objects_device> m_mob;
uint16_t m_latch_data;
uint8_t m_alpha_tile_bank;

View File

@ -150,6 +150,7 @@ atari_motion_objects_device::atari_motion_objects_device(const machine_config &m
, m_activelast(nullptr)
, m_last_xpos(0)
, m_next_xpos(0)
, m_xoffset(0)
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
{
}
@ -438,7 +439,7 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect
// extract data from the various words
int code = m_codelookup[rawcode];
int color = m_colorlookup[m_colormask.extract(entry)];
int xpos = m_xposmask.extract(entry);
int xpos = m_xposmask.extract(entry) + m_xoffset;
int ypos = -m_yposmask.extract(entry);
int hflip = m_hflipmask.extract(entry);
int vflip = m_vflipmask.extract(entry);

View File

@ -83,6 +83,7 @@ public:
// configuration
template <typename T> void set_gfxdecode(T &&tag) { m_gfxdecode.set_tag(std::forward<T>(tag)); }
void set_config(const atari_motion_objects_config &config) { static_cast<atari_motion_objects_config &>(*this) = config; }
void set_xoffset(int xoffset) { m_xoffset = xoffset; }
// getters
int bank() const { return m_bank; }
@ -217,6 +218,9 @@ private:
uint32_t m_last_xpos; // (during processing) the previous X position
uint32_t m_next_xpos; // (during processing) the next X position
int m_xoffset; // global xoffset for sprites
required_device<gfxdecode_device> m_gfxdecode;
};

View File

@ -44,6 +44,8 @@ atari_vad_device::atari_vad_device(const machine_config &mconfig, const char *ta
, m_pf1_yscroll(0)
, m_mo_xscroll(0)
, m_mo_yscroll(0)
, m_pf_xoffset(0)
, m_pf2_xoffset(4)
{
}
@ -362,12 +364,11 @@ void atari_vad_device::internal_control_write(offs_t offset, uint16_t newword)
inline void atari_vad_device::update_pf_xscrolls()
{
m_playfield_tilemap->set_scrollx(0, m_pf0_xscroll_raw + ((m_pf1_xscroll_raw) & 7));
m_playfield_tilemap->set_scrollx(0, m_pf0_xscroll_raw + ((m_pf1_xscroll_raw) & 7) + m_pf_xoffset);
if (m_playfield2_tilemap != nullptr)
m_playfield2_tilemap->set_scrollx(0, m_pf1_xscroll_raw + 4);
m_playfield2_tilemap->set_scrollx(0, m_pf1_xscroll_raw + m_pf2_xoffset);
}
//-------------------------------------------------
// update_parameter: Update parameters, shared
// between end-of-frame, tilerow updates, and

View File

@ -38,6 +38,7 @@ public:
// configuration helpers
auto scanline_int_cb() { return m_scanline_int_cb.bind(); }
void set_xoffsets(int xoffset, int xoffset2) { m_pf_xoffset = xoffset; m_pf2_xoffset = xoffset2; }
// getters
tilemap_device &alpha() const { return *m_alpha_tilemap; }
@ -102,6 +103,9 @@ private:
uint32_t m_mo_yscroll; // sprite xscroll
uint16_t m_control[0x40/2]; // control data
int m_pf_xoffset;
int m_pf2_xoffset;
};