Skip to content

Commit

Permalink
remove deco_zoomspr device, refactor deco32 - drgngun, lockload to us…
Browse files Browse the repository at this point in the history
…e the namco_c355spr device instead (#8725)
  • Loading branch information
David Haywood committed Oct 23, 2021
1 parent 7576d91 commit eca8831
Show file tree
Hide file tree
Showing 12 changed files with 728 additions and 823 deletions.
2 changes: 0 additions & 2 deletions scripts/target/mame/arcade.lua
Expand Up @@ -1754,8 +1754,6 @@ files {
MAME_DIR .. "src/mame/video/dvi.cpp",
MAME_DIR .. "src/mame/video/deco_ace.cpp",
MAME_DIR .. "src/mame/video/deco_ace.h",
MAME_DIR .. "src/mame/video/deco_zoomspr.cpp",
MAME_DIR .. "src/mame/video/deco_zoomspr.h",
MAME_DIR .. "src/mame/drivers/decocass.cpp",
MAME_DIR .. "src/mame/includes/decocass.h",
MAME_DIR .. "src/mame/machine/decocass.cpp",
Expand Down
199 changes: 120 additions & 79 deletions src/mame/drivers/deco32.cpp

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/mame/drivers/gal3.cpp
Expand Up @@ -208,7 +208,8 @@ uint32_t gal3_state::screen_update_left(screen_device &screen, bitmap_ind16 &bit
{
bitmap.fill(0xff, cliprect); // TODO : actually laserdisc layer
screen.priority().fill(0, cliprect);
m_c355spr[0]->get_sprites(cliprect); // TODO : buffered?

m_c355spr[0]->build_sprite_list_and_render_sprites(cliprect); // TODO : buffered?

int i;
char mst[18], slv[18];
Expand Down Expand Up @@ -262,7 +263,7 @@ uint32_t gal3_state::screen_update_right(screen_device &screen, bitmap_ind16 &bi
{
bitmap.fill(0xff, cliprect); // TODO : actually laserdisc layer
screen.priority().fill(0, cliprect);
m_c355spr[1]->get_sprites(cliprect); // TODO : buffered?
m_c355spr[1]->build_sprite_list_and_render_sprites(cliprect); // TODO : buffered?

static int pivot = 15;
int pri;
Expand Down
1 change: 1 addition & 0 deletions src/mame/drivers/namconb1.cpp
Expand Up @@ -995,6 +995,7 @@ void namconb1_state::namconb1(machine_config &config)
m_c355spr->set_palxor(0x0);
m_c355spr->set_buffer(2); // triple buffered
m_c355spr->set_color_base(0);
m_c355spr->set_draw_2_lists(false); // prevents bad tile on top left of vshoot during certain scenes

NAMCO_C123TMAP(config, m_c123tmap);
m_c123tmap->set_palette(m_c116);
Expand Down
2 changes: 1 addition & 1 deletion src/mame/drivers/namcos21_c67.cpp
Expand Up @@ -372,7 +372,7 @@ uint32_t namcos21_c67_state::screen_update(screen_device &screen, bitmap_ind16 &
int pri;
bitmap.fill(0xff, cliprect );
screen.priority().fill(0, cliprect);
m_c355spr->get_sprites(cliprect); // TODO : buffered?
m_c355spr->build_sprite_list_and_render_sprites(cliprect); // TODO : buffered?

m_c355spr->draw(screen, bitmap, cliprect, 2 );

Expand Down
2 changes: 1 addition & 1 deletion src/mame/drivers/namcos21_de.cpp
Expand Up @@ -221,7 +221,7 @@ uint32_t namco_de_pcbstack_device::screen_update(screen_device &screen, bitmap_i
int pri;
bitmap.fill(0xff, cliprect );
screen.priority().fill(0, cliprect);
m_c355spr->get_sprites(cliprect); // TODO : buffered?
m_c355spr->build_sprite_list_and_render_sprites(cliprect); // TODO : buffered?

m_c355spr->draw(screen, bitmap, cliprect, 2 );
m_c355spr->draw(screen, bitmap, cliprect, 14 ); //driver's eyes
Expand Down
32 changes: 25 additions & 7 deletions src/mame/includes/deco32.h
Expand Up @@ -14,7 +14,7 @@
#include "sound/ymopm.h"
#include "machine/deco146.h"
#include "machine/deco104.h"
#include "video/deco_zoomspr.h"
#include "video/namco_c355spr.h"
#include "emupal.h"
#include "screen.h"

Expand Down Expand Up @@ -218,10 +218,12 @@ class dragngun_state : public deco32_state
public:
dragngun_state(const machine_config &mconfig, device_type type, const char *tag)
: deco32_state(mconfig, type, tag)
, m_sprgenzoom(*this, "spritegen_zoom")
, m_sprgenzoom(*this, "c355spr")
, m_spriteram(*this, "spriteram")
, m_sprite_layout_ram(*this, "lay%u", 0)
, m_sprite_lookup_ram(*this, "look%u", 0)
, m_sprite_spriteformat(*this, "lay%u", 0)
, m_sprite_spritetile(*this, "look%u", 0)
, m_sprite_cliptable(*this, "spclip")
, m_sprite_indextable(*this, "spindex")
, m_vol_main(*this, "vol_main")
, m_vol_gun(*this, "vol_gun")
, m_io_inputs(*this, "INPUTS")
Expand All @@ -241,11 +243,14 @@ class dragngun_state : public deco32_state
DECLARE_INPUT_CHANGED_MEMBER(lockload_gun_trigger);

private:
required_device<deco_zoomspr_device> m_sprgenzoom;
required_device<namco_c355spr_device> m_sprgenzoom;
required_device<buffered_spriteram32_device> m_spriteram;

required_shared_ptr_array<u32, 2> m_sprite_layout_ram;
required_shared_ptr_array<u32, 2> m_sprite_lookup_ram;
required_shared_ptr_array<u32, 2> m_sprite_spriteformat;
required_shared_ptr_array<u32, 2> m_sprite_spritetile;
required_shared_ptr<u32> m_sprite_cliptable;
required_shared_ptr<u32> m_sprite_indextable;

required_device<lc7535_device> m_vol_main;
optional_device<lc7535_device> m_vol_gun;

Expand Down Expand Up @@ -276,13 +281,26 @@ class dragngun_state : public deco32_state
void lockload_okibank_hi_w(u8 data); // lockload

virtual void video_start() override;

int sprite_bank_callback(int sprite);
u16 read_spritetile(int lookupram_offset);
u16 read_spriteformat(int spriteformatram_offset, u8 attr);
u16 read_spritetable(int offs, u8 attr, int whichlist);
u16 read_spritelist(int offs, int whichlist);
u16 read_cliptable(int offs, u8 attr);
int sprite_priority_callback(int priority);

void expand_sprite_data();
void dragngun_init_common();

u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);

DECO16IC_BANK_CB_MEMBER(bank_1_callback);
DECO16IC_BANK_CB_MEMBER(bank_2_callback);

void namco_sprites(machine_config &config);

void namcosprite_map(address_map &map);
void dragngun_map(address_map &map);
void lockload_map(address_map &map);
void lockloadu_map(address_map &map);
Expand Down
60 changes: 58 additions & 2 deletions src/mame/video/deco32.cpp
Expand Up @@ -176,6 +176,63 @@ u32 captaven_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
return 0;
}

u16 dragngun_state::read_spritetile(int lookupram_offset)
{
if (lookupram_offset & 0x2000)
return m_sprite_spritetile[1][lookupram_offset&0x1fff];
else
return m_sprite_spritetile[0][lookupram_offset&0x1fff];
}

u16 dragngun_state::read_spriteformat(int spriteformatram_offset, u8 attr)
{
if (spriteformatram_offset & 0x400)
return m_sprite_spriteformat[1][((spriteformatram_offset & 0x1ff)<<2) + attr];
else
return m_sprite_spriteformat[0][((spriteformatram_offset & 0x1ff)<<2) + attr];
}

u16 dragngun_state::read_spritetable(int offs, u8 attr, int whichlist)
{
return m_spriteram->buffer()[(offs << 3) + attr];
}

u16 dragngun_state::read_spritelist(int offs, int whichlist)
{
return m_sprite_indextable[offs];
}

u16 dragngun_state::read_cliptable(int offs, u8 attr)
{
return m_sprite_cliptable[(offs << 2) + attr];
}

int dragngun_state::sprite_priority_callback(int priority)
{
/* For some reason, this bit when used in Dragon Gun causes the sprites
to flicker every other frame (fake transparency)
This would usually be a priority bit, but the flicker can't be a
post-process mixing effect filtering out those priorities, because then
it would still cut holes in sprites where it was drawn, and it doesn't.
Instead sprites with this priority must simple be disabled every other
frame. maybe there's a register in the sprite chip to control this on
a per-priority level?
*/

if ((priority & 0x80) && (m_screen->frame_number() & 1)) // flicker
return -1;

priority = (priority & 0x60) >> 5;
if (priority == 0) priority = 7;
else if (priority == 1) priority = 7; // set to 1 to have the 'masking effect' with the dragon on the dragngun attract mode, but that breaks the player select where it needs to be 3, probably missing some bits..
else if (priority == 2) priority = 7;
else if (priority == 3) priority = 7;
return priority;
}


u32 dragngun_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0, cliprect);
Expand All @@ -200,8 +257,7 @@ u32 dragngun_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
{
rectangle clip(cliprect.left(), cliprect.right(), 8, 247);

m_sprgenzoom->dragngun_draw_sprites(screen,bitmap,clip,m_spriteram->buffer(), m_sprite_layout_ram[0], m_sprite_layout_ram[1], m_sprite_lookup_ram[0], m_sprite_lookup_ram[1], m_sprite_ctrl, screen.priority(), m_temp_render_bitmap);

m_sprgenzoom->draw_dg(screen, bitmap, clip, screen.priority(), m_temp_render_bitmap);
}

return 0;
Expand Down

0 comments on commit eca8831

Please sign in to comment.