gstriker.c: added save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-07-09 17:55:05 +02:00
parent 1651c33b4e
commit 6043fc936a
9 changed files with 126 additions and 123 deletions

View File

@ -178,6 +178,13 @@ Frequencies: 68k is XTAL_32MHZ/2
******************************************************************************/
void gstriker_state::machine_start()
{
membank("soundbank")->configure_entries(0, 8, memregion("audiocpu")->base(), 0x8000);
save_item(NAME(m_dmmy_8f_ret));
save_item(NAME(m_pending_command));
}
/*** MISC READ / WRITE HANDLERS **********************************************/
@ -207,18 +214,14 @@ READ16_MEMBER(gstriker_state::pending_command_r)
}
#endif
WRITE8_MEMBER(gstriker_state::gs_sh_pending_command_clear_w)
WRITE8_MEMBER(gstriker_state::sh_pending_command_clear_w)
{
m_pending_command = 0;
}
WRITE8_MEMBER(gstriker_state::gs_sh_bankswitch_w)
WRITE8_MEMBER(gstriker_state::sh_bankswitch_w)
{
UINT8 *RAM = memregion("audiocpu")->base();
int bankaddress;
bankaddress = (data & 0x07) * 0x8000;
membank("bank1")->set_base(&RAM[bankaddress]);
membank("soundbank")->set_entry(data & 0x07);
}
/*** GFX DECODE **************************************************************/
@ -258,15 +261,6 @@ static GFXDECODE_START( gstriker )
GFXDECODE_END
/*** MORE SOUND RELATED ******************************************************/
WRITE_LINE_MEMBER(gstriker_state::gs_ym2610_irq)
{
if (state)
m_audiocpu->set_input_line(0, ASSERT_LINE);
else
m_audiocpu->set_input_line(0, CLEAR_LINE);
}
/*** MEMORY LAYOUTS **********************************************************/
@ -297,14 +291,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, gstriker_state )
AM_RANGE(0x0000, 0x77ff) AM_ROM
AM_RANGE(0x7800, 0x7fff) AM_RAM
AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")
AM_RANGE(0x8000, 0xffff) AM_ROMBANK("soundbank")
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, gstriker_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write)
AM_RANGE(0x04, 0x04) AM_WRITE(gs_sh_bankswitch_w)
AM_RANGE(0x08, 0x08) AM_WRITE(gs_sh_pending_command_clear_w)
AM_RANGE(0x04, 0x04) AM_WRITE(sh_bankswitch_w)
AM_RANGE(0x08, 0x08) AM_WRITE(sh_pending_command_clear_w)
AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_byte_r)
ADDRESS_MAP_END
@ -530,7 +524,7 @@ static MACHINE_CONFIG_START( gstriker, gstriker_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(5000) /* hand-tuned, it needs a bit */)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gstriker_state, screen_update_gstriker)
MCFG_SCREEN_UPDATE_DRIVER(gstriker_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", gstriker)
@ -540,9 +534,11 @@ static MACHINE_CONFIG_START( gstriker, gstriker_state )
MCFG_DEVICE_ADD("zoomtilemap", MB60553, 0)
MCFG_MB60553_GFXDECODE("gfxdecode")
MCFG_MB60553_GFX_REGION(1)
MCFG_DEVICE_ADD("texttilemap", VS920A, 0)
MCFG_VS920A_GFXDECODE("gfxdecode")
MCFG_VS920A_GFX_REGION(0)
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
@ -552,12 +548,10 @@ static MACHINE_CONFIG_START( gstriker, gstriker_state )
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(gstriker_state,gstriker)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD("ymsnd", YM2610, 8000000)
MCFG_YM2610_IRQ_HANDLER(WRITELINE(gstriker_state, gs_ym2610_irq))
MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.25)
MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
MCFG_SOUND_ROUTE(1, "lspeaker", 1.0)
@ -576,11 +570,8 @@ static MACHINE_CONFIG_DERIVED( vgoal, gstriker )
MCFG_CPU_PROGRAM_MAP(gstriker_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", gstriker_state, irq1_line_hold)
MCFG_DEVICE_REPLACE("vsystem_spr", VSYSTEM_SPR, 0)
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
MCFG_DEVICE_MODIFY("vsystem_spr")
MCFG_VSYSTEM_SPR_SET_TRANSPEN(0xf) // different vs. the other games, find register
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR_PALETTE("palette")
MACHINE_CONFIG_END
@ -1010,7 +1001,7 @@ WRITE16_MEMBER(gstriker_state::vbl_toggle_w)
}
}
void gstriker_state::mcu_init( )
void gstriker_state::mcu_init()
{
m_dmmy_8f_ret = 0xFFFF;
m_pending_command = 0;
@ -1021,6 +1012,9 @@ void gstriker_state::mcu_init( )
m_maincpu->space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),this));
m_maincpu->space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),this));
save_item(NAME(m_mcu_data));
save_item(NAME(m_prot_reg));
}
DRIVER_INIT_MEMBER(gstriker_state,twrldc94)
@ -1046,13 +1040,13 @@ DRIVER_INIT_MEMBER(gstriker_state,vgoalsoc)
/*** GAME DRIVERS ************************************************************/
GAME( 1993, gstriker, 0, gstriker, gstriker, driver_device, 0, ROT0, "Human", "Grand Striker", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
GAME( 1993, gstrikera, gstriker, gstriker, gstriker, driver_device, 0, ROT0, "Human", "Grand Striker (Americas)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
GAME( 1993, gstrikerj, gstriker, gstriker, gstriker, driver_device, 0, ROT0, "Human", "Grand Striker (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
GAME( 1993, gstriker, 0, gstriker, gstriker, driver_device, 0, ROT0, "Human", "Grand Striker", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
GAME( 1993, gstrikera, gstriker, gstriker, gstriker, driver_device, 0, ROT0, "Human", "Grand Striker (Americas)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
GAME( 1993, gstrikerj, gstriker, gstriker, gstriker, driver_device, 0, ROT0, "Human", "Grand Striker (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
/* Similar, but not identical hardware, appear to be protected by an MCU :-( */
GAME( 1994, vgoalsoc, 0, vgoal, vgoalsoc, gstriker_state, vgoalsoc, ROT0, "Tecmo", "V Goal Soccer (Europe)", GAME_NOT_WORKING ) // has ger/hol/arg/bra/ita/eng/spa/fra
GAME( 1994, vgoalsca, vgoalsoc, vgoal, vgoalsoc, gstriker_state, vgoalsoc, ROT0, "Tecmo", "V Goal Soccer (US/Japan/Korea)", GAME_NOT_WORKING ) // has ger/hol/arg/bra/ita/kor/usa/jpn
GAME( 1994, twrldc94, 0, twc94, twrldc94, gstriker_state, twrldc94, ROT0, "Tecmo", "Tecmo World Cup '94 (set 1)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS )
GAME( 1994, twrldc94a,twrldc94, twc94, twrldc94, gstriker_state, twrldc94a, ROT0, "Tecmo", "Tecmo World Cup '94 (set 2)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS )
GAME( 1994, vgoalsoc, 0, vgoal, vgoalsoc, gstriker_state, vgoalsoc, ROT0, "Tecmo", "V Goal Soccer (Europe)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // has ger/hol/arg/bra/ita/eng/spa/fra
GAME( 1994, vgoalsca, vgoalsoc, vgoal, vgoalsoc, gstriker_state, vgoalsoc, ROT0, "Tecmo", "V Goal Soccer (US/Japan/Korea)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // has ger/hol/arg/bra/ita/kor/usa/jpn
GAME( 1994, twrldc94, 0, twc94, twrldc94, gstriker_state, twrldc94, ROT0, "Tecmo", "Tecmo World Cup '94 (set 1)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
GAME( 1994, twrldc94a,twrldc94, twc94, twrldc94, gstriker_state, twrldc94a, ROT0, "Tecmo", "Tecmo World Cup '94 (set 2)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )

View File

@ -14,69 +14,66 @@ class gstriker_state : public driver_device
public:
gstriker_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_CG10103_m_vram(*this, "cg10103_m_vram"),
m_work_ram(*this, "work_ram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_spr(*this, "vsystem_spr"),
m_bg(*this, "zoomtilemap"),
m_tx(*this, "texttilemap"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_CG10103_m_vram(*this, "cg10103_m_vram"),
m_work_ram(*this, "work_ram"),
m_mixerregs1(*this, "mixerregs1"),
m_mixerregs2(*this, "mixerregs2")
{ }
virtual void machine_start()
{
}
required_shared_ptr<UINT16> m_CG10103_m_vram;
required_shared_ptr<UINT16> m_work_ram;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<vsystem_spr_device> m_spr;
required_device<mb60553_zooming_tilemap_device> m_bg;
required_device<vs920a_text_tilemap_device> m_tx;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<UINT16> m_CG10103_m_vram;
required_shared_ptr<UINT16> m_work_ram;
required_shared_ptr<UINT16> m_mixerregs1;
required_shared_ptr<UINT16> m_mixerregs2;
UINT16 m_dmmy_8f_ret;
int m_pending_command;
int m_gametype;
UINT16 m_mcu_data;
UINT16 m_prot_reg[2];
// common
DECLARE_READ16_MEMBER(dmmy_8f);
DECLARE_WRITE16_MEMBER(sound_command_w);
DECLARE_READ16_MEMBER(pending_command_r);
DECLARE_WRITE8_MEMBER(gs_sh_pending_command_clear_w);
DECLARE_WRITE8_MEMBER(gs_sh_bankswitch_w);
DECLARE_WRITE8_MEMBER(sh_pending_command_clear_w);
DECLARE_WRITE8_MEMBER(sh_bankswitch_w);
// vgoalsoc and twrldc
DECLARE_WRITE16_MEMBER(twrldc94_mcu_w);
DECLARE_READ16_MEMBER(twrldc94_mcu_r);
DECLARE_WRITE16_MEMBER(twrldc94_prot_reg_w);
DECLARE_READ16_MEMBER(twrldc94_prot_reg_r);
// vgoalsoc only
DECLARE_READ16_MEMBER(vbl_toggle_r);
DECLARE_WRITE16_MEMBER(vbl_toggle_w);
virtual void machine_start();
virtual void video_start();
DECLARE_DRIVER_INIT(twrldc94a);
DECLARE_DRIVER_INIT(vgoalsoc);
DECLARE_DRIVER_INIT(twrldc94);
DECLARE_VIDEO_START(gstriker);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void mcu_init( );
DECLARE_WRITE_LINE_MEMBER(gs_ym2610_irq);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<UINT16> m_mixerregs1;
required_shared_ptr<UINT16> m_mixerregs2;
void mcu_init();
};
#endif

View File

@ -9,7 +9,7 @@
UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 gstriker_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_mixerregs1[8]&0x07ff, cliprect); // complete guess, causes green behind test grid in twc94 and blue behind title screen on gstriker
@ -34,13 +34,11 @@ UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind1
return 0;
}
VIDEO_START_MEMBER(gstriker_state, gstriker)
void gstriker_state::video_start()
{
// Initalize the chip for the score plane
m_tx->set_gfx_region(0);
m_tx->get_tilemap()->set_transparent_pen(0xf);
// Initalize the chip for the screen plane
m_bg->set_gfx_region(1);
m_bg->get_tilemap()->set_transparent_pen(0xf);
}

View File

@ -16,9 +16,17 @@ const device_type MB60553 = &device_creator<mb60553_zooming_tilemap_device>;
mb60553_zooming_tilemap_device::mb60553_zooming_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MB60553, "MB60553 Zooming Tilemap", tag, owner, clock, "mb60553", __FILE__),
m_m_gfx_region(0),
m_vram(NULL),
m_pal_base(0),
m_lineram(NULL),
m_gfx_region(0),
m_gfxdecode(*this)
{
for (int i = 0; i < 8; i++)
{
m_regs[i] = 0;
m_bank[i] = 0;
}
}
@ -32,7 +40,9 @@ void mb60553_zooming_tilemap_device::device_start()
save_pointer(NAME(m_lineram), 0x1000/2);
save_pointer(NAME(m_vram), 0x4000/2);
save_item(NAME(m_pal_base));
save_item(NAME(m_bank));
save_item(NAME(m_regs));
m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(mb60553_zooming_tilemap_device::get_tile_info),this),tilemap_mapper_delegate(FUNC(mb60553_zooming_tilemap_device::twc94_scan),this), 16,16,128,64);
m_tmap->set_transparent_pen(0);
@ -46,7 +56,7 @@ void mb60553_zooming_tilemap_device::device_reset()
void mb60553_zooming_tilemap_device::set_gfx_region(device_t &device, int gfxregion)
{
mb60553_zooming_tilemap_device &dev = downcast<mb60553_zooming_tilemap_device &>(device);
dev.m_m_gfx_region = gfxregion;
dev.m_gfx_region = gfxregion;
}
void mb60553_zooming_tilemap_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
@ -115,7 +125,7 @@ TILE_GET_INFO_MEMBER(mb60553_zooming_tilemap_device::get_tile_info)
pal = (data >> 12) & 0xF;
bankno = (data >> 9) & 0x7;
SET_TILE_INFO_MEMBER(m_m_gfx_region, tileno + m_bank[bankno] * 0x200, pal + m_pal_base, 0);
SET_TILE_INFO_MEMBER(m_gfx_region, tileno + m_bank[bankno] * 0x200, pal + m_pal_base, 0);
}
void mb60553_zooming_tilemap_device::reg_written( int num_reg)
@ -176,14 +186,6 @@ void mb60553_zooming_tilemap_device::set_pal_base( int pal_base)
m_pal_base = pal_base;
}
void mb60553_zooming_tilemap_device::set_gfx_region( int gfx_region)
{
m_m_gfx_region = gfx_region;
}
void mb60553_zooming_tilemap_device::draw_roz_core(screen_device &screen, bitmap_ind16 &destbitmap, const rectangle &cliprect,
UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound)

View File

@ -19,7 +19,6 @@ public:
void reg_written( int num_reg);
TILE_GET_INFO_MEMBER(get_tile_info);
void set_pal_base( int m_pal_base);
void set_gfx_region( int m_gfx_region);
void draw( screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority);
tilemap_t* get_tilemap();
@ -44,7 +43,7 @@ protected:
private:
UINT8 m_m_gfx_region;
UINT8 m_gfx_region;
required_device<gfxdecode_device> m_gfxdecode;

View File

@ -34,6 +34,8 @@ const device_type VS920A = &device_creator<vs920a_text_tilemap_device>;
vs920a_text_tilemap_device::vs920a_text_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VS920A, "VS920A Text Tilemap", tag, owner, clock, "vs920a", __FILE__),
m_vram(NULL),
m_pal_base(0),
m_gfx_region(0),
m_gfxdecode(*this)
@ -48,6 +50,7 @@ void vs920a_text_tilemap_device::device_start()
m_vram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2);
save_pointer(NAME(m_vram), 0x1000/2);
save_item(NAME(m_pal_base));
m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(vs920a_text_tilemap_device::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
@ -108,11 +111,6 @@ void vs920a_text_tilemap_device::set_pal_base(int pal_base)
m_pal_base = pal_base;
}
void vs920a_text_tilemap_device::set_gfx_region(int gfx_region)
{
m_gfx_region = gfx_region;
}
void vs920a_text_tilemap_device::draw(screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority)
{
m_tmap->draw(screen, bitmap, cliprect, 0, priority);

View File

@ -16,7 +16,6 @@ public:
TILE_GET_INFO_MEMBER(get_tile_info);
tilemap_t* get_tilemap();
void set_pal_base(int m_pal_base);
void set_gfx_region(int m_gfx_region);
void draw(screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority);
DECLARE_WRITE16_MEMBER(vram_w);

View File

@ -85,6 +85,8 @@ vsystem_spr_device::vsystem_spr_device(const machine_config &mconfig, const char
m_pal_mask = 0x3f;
m_newtilecb = vsystem_tile_indirection_delegate(FUNC(vsystem_spr_device::tile_callback_noindirect), this);
memset(&m_curr_sprite, 0, sizeof(m_curr_sprite));
}
//-------------------------------------------------
@ -175,6 +177,20 @@ void vsystem_spr_device::device_start()
{
// bind our handler
m_newtilecb.bind_relative_to(*owner());
save_item(NAME(m_pal_base));
save_item(NAME(m_curr_sprite.ox));
save_item(NAME(m_curr_sprite.xsize));
save_item(NAME(m_curr_sprite.zoomx));
save_item(NAME(m_curr_sprite.oy));
save_item(NAME(m_curr_sprite.ysize));
save_item(NAME(m_curr_sprite.zoomy));
save_item(NAME(m_curr_sprite.flipx));
save_item(NAME(m_curr_sprite.flipy));
save_item(NAME(m_curr_sprite.color));
save_item(NAME(m_curr_sprite.pri));
save_item(NAME(m_curr_sprite.map));
}
void vsystem_spr_device::device_reset()
@ -205,21 +221,21 @@ void vsystem_spr_device::get_sprite_attributes(UINT16* ram)
xxxx xxxx xxxx xxxx map start (lsb)
*/
curr_sprite.oy = (ram[0] & 0x01ff);
curr_sprite.ysize = (ram[0] & 0x0e00) >> 9;
curr_sprite.zoomy = (ram[0] & 0xf000) >> 12;
m_curr_sprite.oy = (ram[0] & 0x01ff);
m_curr_sprite.ysize = (ram[0] & 0x0e00) >> 9;
m_curr_sprite.zoomy = (ram[0] & 0xf000) >> 12;
curr_sprite.ox = (ram[1] & 0x01ff);
curr_sprite.xsize = (ram[1] & 0x0e00) >> 9;
curr_sprite.zoomx = (ram[1] & 0xf000) >> 12;
m_curr_sprite.ox = (ram[1] & 0x01ff);
m_curr_sprite.xsize = (ram[1] & 0x0e00) >> 9;
m_curr_sprite.zoomx = (ram[1] & 0xf000) >> 12;
curr_sprite.flipx = (ram[2] & 0x4000);
curr_sprite.flipy = (ram[2] & 0x8000);
curr_sprite.color = (ram[2] & 0x3f00) >> 8;
curr_sprite.pri = (ram[2] & 0x3000) >> 12;
curr_sprite.map = (ram[2] & 0x0001) << 16;
m_curr_sprite.flipx = (ram[2] & 0x4000);
m_curr_sprite.flipy = (ram[2] & 0x8000);
m_curr_sprite.color = (ram[2] & 0x3f00) >> 8;
m_curr_sprite.pri = (ram[2] & 0x3000) >> 12;
m_curr_sprite.map = (ram[2] & 0x0001) << 16;
curr_sprite.map |= (ram[3] & 0xffff);
m_curr_sprite.map |= (ram[3] & 0xffff);
}
@ -228,12 +244,12 @@ void vsystem_spr_device::common_sprite_drawgfx(bitmap_ind16 &bitmap, const recta
gfx_element *gfx = m_gfxdecode->gfx(m_gfx_region);
int priority_mask = 0x00;
curr_sprite.oy += m_yoffs;
curr_sprite.ox += m_xoffs;
m_curr_sprite.oy += m_yoffs;
m_curr_sprite.ox += m_xoffs;
if (m_pdraw)
{
switch (curr_sprite.pri)
switch (m_curr_sprite.pri)
{
default:
case 0: priority_mask = 0x00; break;
@ -243,39 +259,39 @@ void vsystem_spr_device::common_sprite_drawgfx(bitmap_ind16 &bitmap, const recta
}
}
curr_sprite.zoomx = 32 - curr_sprite.zoomx;
curr_sprite.zoomy = 32 - curr_sprite.zoomy;
m_curr_sprite.zoomx = 32 - m_curr_sprite.zoomx;
m_curr_sprite.zoomy = 32 - m_curr_sprite.zoomy;
int ystart, yend, yinc;
if (!curr_sprite.flipy) { ystart = 0; yend = curr_sprite.ysize+1; yinc = 1; }
else { ystart = curr_sprite.ysize; yend = -1; yinc = -1; }
if (!m_curr_sprite.flipy) { ystart = 0; yend = m_curr_sprite.ysize+1; yinc = 1; }
else { ystart = m_curr_sprite.ysize; yend = -1; yinc = -1; }
int ycnt = ystart;
while (ycnt != yend)
{
int xstart, xend, xinc;
if (!curr_sprite.flipx) { xstart = 0; xend = curr_sprite.xsize+1; xinc = 1; }
else { xstart = curr_sprite.xsize; xend = -1; xinc = -1; }
if (!m_curr_sprite.flipx) { xstart = 0; xend = m_curr_sprite.xsize+1; xinc = 1; }
else { xstart = m_curr_sprite.xsize; xend = -1; xinc = -1; }
int xcnt = xstart;
while (xcnt != xend)
{
int startno = m_newtilecb(curr_sprite.map++);
int startno = m_newtilecb(m_curr_sprite.map++);
if (m_pdraw)
{
gfx->prio_zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
gfx->prio_zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
gfx->prio_zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2, -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
gfx->prio_zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
gfx->prio_zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, priority_bitmap, priority_mask, m_transpen);
}
else
{
gfx->zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_transpen);
gfx->zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_transpen);
gfx->zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2, -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_transpen);
gfx->zoom_transpen(bitmap,cliprect, startno, curr_sprite.color + m_pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_transpen);
gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen);
gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen);
gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen);
gfx->zoom_transpen(bitmap,cliprect, startno, m_curr_sprite.color + m_pal_base, m_curr_sprite.flipx, m_curr_sprite.flipy, -0x200+m_curr_sprite.ox + xcnt * m_curr_sprite.zoomx/2, -0x200+m_curr_sprite.oy + ycnt * m_curr_sprite.zoomy/2, m_curr_sprite.zoomx << 11, m_curr_sprite.zoomy << 11, m_transpen);
}
xcnt+=xinc;
}
@ -325,12 +341,12 @@ void vsystem_spr_device::draw_sprites( UINT16* spriteram, int spriteram_bytes, s
get_sprite_attributes(&spriteram[attr_start]);
curr_sprite.color &= m_pal_mask;
m_curr_sprite.color &= m_pal_mask;
// hack for aero fighters and other which still call us multiple times with different priorities instead of using the pdrawgfx version
if (prihack_mask != -1)
{
if ((curr_sprite.pri & prihack_mask) == prihack_val)
if ((m_curr_sprite.pri & prihack_mask) == prihack_val)
common_sprite_drawgfx(bitmap, cliprect, screen.priority());
}
else

View File

@ -41,15 +41,15 @@ public:
UINT32 tile_callback_noindirect(UINT32 tile);
vsystem_tile_indirection_delegate m_newtilecb;
// inline config
int m_xoffs, m_yoffs;
bool m_pdraw;
UINT16* m_vram;
UINT16 m_pal_base;
UINT16 m_pal_mask;
UINT8 m_gfx_region;
UINT8 m_transpen;
UINT16 m_pal_base;
struct vsystem_sprite_attributes
{
int ox;
@ -63,7 +63,7 @@ public:
int color;
int pri;
UINT32 map;
} curr_sprite;
} m_curr_sprite;
void get_sprite_attributes(UINT16* ram);
void common_sprite_drawgfx(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap);