mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
zac1b1120: fix zoomed sprite mask
This commit is contained in:
parent
aad4559ed4
commit
000bacd6af
@ -106,8 +106,10 @@ void zac1b1120_state::videoram_w(offs_t offset, uint8_t data)
|
||||
|
||||
uint8_t zac1b1120_state::s2636_r(offs_t offset)
|
||||
{
|
||||
if (offset != 0xcb) return m_s2636_0_ram[offset];
|
||||
else return m_collision_sprite;
|
||||
if (offset != 0xcb)
|
||||
return m_s2636_0_ram[offset];
|
||||
else
|
||||
return m_collision_sprite;
|
||||
}
|
||||
|
||||
void zac1b1120_state::s2636_w(offs_t offset, uint8_t data)
|
||||
@ -115,6 +117,7 @@ void zac1b1120_state::s2636_w(offs_t offset, uint8_t data)
|
||||
m_s2636_0_ram[offset] = data;
|
||||
m_gfxdecode->gfx(1)->mark_dirty(offset / 8);
|
||||
m_gfxdecode->gfx(2)->mark_dirty(offset / 8);
|
||||
|
||||
if (offset == 0xc7)
|
||||
{
|
||||
m_s2636->write_data(offset, data);
|
||||
@ -126,15 +129,12 @@ uint8_t zac1b1120_state::port_0_r()
|
||||
return m_1e80->read() - m_collision_background;
|
||||
}
|
||||
|
||||
/*****************************************/
|
||||
/* Check for collision between 2 sprites */
|
||||
/*****************************************/
|
||||
|
||||
int zac1b1120_state::sprite_collision(int first, int second)
|
||||
{
|
||||
int checksum = 0;
|
||||
const rectangle &visarea = m_screen->visible_area();
|
||||
|
||||
// Check for collision between 2 sprites
|
||||
if ((m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (m_s2636_0_ram[second * 0x10 + 10] < 0xf0))
|
||||
{
|
||||
int const fx = (m_s2636_0_ram[first * 0x10 + 10] * 4 )- 22;
|
||||
@ -142,7 +142,6 @@ int zac1b1120_state::sprite_collision(int first, int second)
|
||||
int const expand = (first == 1) ? 2 : 1;
|
||||
|
||||
// Draw first sprite
|
||||
|
||||
m_gfxdecode->gfx(expand)->opaque(m_spritebitmap, m_spritebitmap.cliprect(),
|
||||
first * 2,
|
||||
0,
|
||||
@ -150,7 +149,6 @@ int zac1b1120_state::sprite_collision(int first, int second)
|
||||
fx, fy);
|
||||
|
||||
// Get fingerprint
|
||||
|
||||
for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++)
|
||||
{
|
||||
for (int y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++)
|
||||
@ -161,7 +159,6 @@ int zac1b1120_state::sprite_collision(int first, int second)
|
||||
}
|
||||
|
||||
// Blackout second sprite
|
||||
|
||||
m_gfxdecode->gfx(1)->transpen(m_spritebitmap, m_spritebitmap.cliprect(),
|
||||
second * 2,
|
||||
1,
|
||||
@ -169,7 +166,6 @@ int zac1b1120_state::sprite_collision(int first, int second)
|
||||
(m_s2636_0_ram[second * 0x10 + 10] * 4) - 22, m_s2636_0_ram[second * 0x10 + 12] + 1, 0);
|
||||
|
||||
// Remove fingerprint
|
||||
|
||||
for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++)
|
||||
{
|
||||
for (int y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++)
|
||||
@ -180,7 +176,6 @@ int zac1b1120_state::sprite_collision(int first, int second)
|
||||
}
|
||||
|
||||
// Zero bitmap
|
||||
|
||||
m_gfxdecode->gfx(expand)->opaque(m_spritebitmap, m_spritebitmap.cliprect(),
|
||||
first * 2,
|
||||
1,
|
||||
@ -193,9 +188,7 @@ int zac1b1120_state::sprite_collision(int first, int second)
|
||||
|
||||
TILE_GET_INFO_MEMBER(zac1b1120_state::get_bg_tile_info)
|
||||
{
|
||||
int const code = m_videoram[tile_index];
|
||||
|
||||
tileinfo.set(0, code, 0, 0);
|
||||
tileinfo.set(0, m_videoram[tile_index], 0, 0);
|
||||
}
|
||||
|
||||
void zac1b1120_state::video_start()
|
||||
@ -229,17 +222,19 @@ void zac1b1120_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clipre
|
||||
/* does not seem to be a fault of the emulation! */
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
m_collision_background = 0; // Read from 0x1e80 bit 7
|
||||
m_collision_background = 0; // Read from 0x1e80 bit 7
|
||||
|
||||
// for collision detection checking
|
||||
copybitmap(m_bitmap, bitmap, 0, 0, 0, 0, visarea);
|
||||
|
||||
for (int offs = 0; offs < 0x50; offs += 0x10)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if ((m_s2636_0_ram[offs + 10] < 0xf0) && (offs != 0x30))
|
||||
int const spriteno = (i == 0) ? 0 : (1 << i); // 0, 2, 4, 8
|
||||
int const offs = spriteno << 3; // 0, 0x10, 0x20, 0x40
|
||||
|
||||
if (m_s2636_0_ram[offs + 10] < 0xf0)
|
||||
{
|
||||
int const spriteno = (offs / 8);
|
||||
int const expand = ((m_s2636_0_ram[0xc0] & (spriteno * 2)) != 0) ? 2 : 1;
|
||||
int const expand = (m_s2636_0_ram[0xc0] & (1 << (i * 2))) ? 2 : 1;
|
||||
int const bx = (m_s2636_0_ram[offs + 10] * 4) - 22;
|
||||
int const by = m_s2636_0_ram[offs + 12] + 1;
|
||||
|
||||
@ -273,12 +268,12 @@ void zac1b1120_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clipre
|
||||
|
||||
// Sprite->Sprite collision detection
|
||||
m_collision_sprite = 0;
|
||||
// if(sprite_collision(0, 1)) m_collision_sprite |= 0x20; // Not used
|
||||
// if(sprite_collision(0, 1)) m_collision_sprite |= 0x20; // Not used
|
||||
if(sprite_collision(0, 2)) m_collision_sprite |= 0x10;
|
||||
if(sprite_collision(0, 4)) m_collision_sprite |= 0x08;
|
||||
if(sprite_collision(1, 2)) m_collision_sprite |= 0x04;
|
||||
if(sprite_collision(1, 4)) m_collision_sprite |= 0x02;
|
||||
// if(sprite_collision(2, 4)) m_collision_sprite |= 0x01; // Not used
|
||||
// if(sprite_collision(2, 4)) m_collision_sprite |= 0x01; // Not used
|
||||
}
|
||||
|
||||
uint32_t zac1b1120_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
@ -496,6 +491,7 @@ void zac1b1120_state::tinvader(machine_config &config)
|
||||
|
||||
// video hardware (timings generated by an (overclocked) Signetics 2621 PAL Universal Sync Generator; screen refresh measured at 55Hz)
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); // for collision detection
|
||||
m_screen->set_raw(15.625_MHz_XTAL, 227 * 4, 0, 180 * 4, 312, 0, 256);
|
||||
m_screen->set_screen_update(FUNC(zac1b1120_state::screen_update));
|
||||
m_screen->set_palette(m_palette);
|
||||
@ -505,7 +501,6 @@ void zac1b1120_state::tinvader(machine_config &config)
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
|
||||
S2636(config, m_s2636, 0).add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
}
|
||||
|
||||
@ -523,7 +518,6 @@ void zac1b1120_state::dodgem(machine_config &config)
|
||||
void zac1b1120_state::sound_w(uint8_t data)
|
||||
{
|
||||
// sounds are NOT the same as space invaders
|
||||
|
||||
logerror("Register %x = Data %d\n", data & 0xfe, data & 0x01);
|
||||
|
||||
// 08 = hit invader
|
||||
|
Loading…
Reference in New Issue
Block a user