mirror of
https://github.com/holub/mame
synced 2025-05-21 13:18:56 +03:00
Modernization of drivers part 15 (no whatsnew)
This commit is contained in:
parent
4f40d7f2cd
commit
9cada7c97e
@ -5768,12 +5768,11 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void maketrax_rom_decode(running_machine &machine)
|
||||
void pacman_state::maketrax_rom_decode()
|
||||
{
|
||||
pacman_state *state = machine.driver_data<pacman_state>();
|
||||
address_space &space = state->m_maincpu->space(AS_PROGRAM);
|
||||
UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x4000);
|
||||
UINT8 *rom = machine().root_device().memregion("maincpu")->base();
|
||||
|
||||
/* patch protection using a copy of the opcodes so ROM checksum */
|
||||
/* tests will not fail */
|
||||
@ -5798,15 +5797,14 @@ DRIVER_INIT_MEMBER(pacman_state,maketrax)
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x5080, 0x50bf, read8_delegate(FUNC(pacman_state::maketrax_special_port2_r),this));
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x50c0, 0x50ff, read8_delegate(FUNC(pacman_state::maketrax_special_port3_r),this));
|
||||
|
||||
maketrax_rom_decode(machine());
|
||||
maketrax_rom_decode();
|
||||
}
|
||||
|
||||
static void korosuke_rom_decode(running_machine &machine)
|
||||
void pacman_state::korosuke_rom_decode()
|
||||
{
|
||||
pacman_state *state = machine.driver_data<pacman_state>();
|
||||
address_space &space = state->m_maincpu->space(AS_PROGRAM);
|
||||
UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x4000);
|
||||
UINT8 *rom = machine().root_device().memregion("maincpu")->base();
|
||||
|
||||
/* patch protection using a copy of the opcodes so ROM checksum */
|
||||
/* tests will not fail */
|
||||
@ -5831,7 +5829,7 @@ DRIVER_INIT_MEMBER(pacman_state,korosuke)
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x5080, 0x5080, read8_delegate(FUNC(pacman_state::korosuke_special_port2_r),this));
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x50c0, 0x50ff, read8_delegate(FUNC(pacman_state::korosuke_special_port3_r),this));
|
||||
|
||||
korosuke_rom_decode(machine());
|
||||
korosuke_rom_decode();
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(pacman_state,ponpoko)
|
||||
@ -5870,7 +5868,7 @@ DRIVER_INIT_MEMBER(pacman_state,ponpoko)
|
||||
}
|
||||
}
|
||||
|
||||
static void eyes_decode(UINT8 *data)
|
||||
void pacman_state::eyes_decode(UINT8 *data)
|
||||
{
|
||||
int j;
|
||||
UINT8 swapbuffer[8];
|
||||
@ -5917,7 +5915,7 @@ DRIVER_INIT_MEMBER(pacman_state,eyes)
|
||||
#define BITSWAP11(val,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0) \
|
||||
BITSWAP16(val,15,14,13,12,11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0)
|
||||
|
||||
static void mspacman_install_patches(UINT8 *ROM)
|
||||
void pacman_state::mspacman_install_patches(UINT8 *ROM)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -106,10 +106,9 @@ WRITE8_MEMBER(parodius_state::parodius_sh_irqtrigger_w)
|
||||
|
||||
#if 0
|
||||
|
||||
static void sound_nmi_callback( running_machine &machine, int param )
|
||||
void parodius_state::sound_nmi_callback( int param )
|
||||
{
|
||||
parodius_state *state = machine.driver_data<parodius_state>();
|
||||
state->m_audiocpu->set_input_line(INPUT_LINE_NMI, ( state->m_nmi_enabled ) ? CLEAR_LINE : ASSERT_LINE );
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, ( m_nmi_enabled ) ? CLEAR_LINE : ASSERT_LINE );
|
||||
|
||||
nmi_enabled = 0;
|
||||
}
|
||||
|
@ -335,17 +335,17 @@ ROM_END
|
||||
|
||||
/* Init */
|
||||
|
||||
static void pirates_decrypt_68k(running_machine &machine)
|
||||
void pirates_state::pirates_decrypt_68k()
|
||||
{
|
||||
int rom_size;
|
||||
UINT16 *buf, *rom;
|
||||
int i;
|
||||
|
||||
rom_size = machine.root_device().memregion("maincpu")->bytes();
|
||||
rom_size = machine().root_device().memregion("maincpu")->bytes();
|
||||
|
||||
buf = auto_alloc_array(machine, UINT16, rom_size/2);
|
||||
buf = auto_alloc_array(machine(), UINT16, rom_size/2);
|
||||
|
||||
rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
|
||||
rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
|
||||
memcpy (buf, rom, rom_size);
|
||||
|
||||
for (i=0; i<rom_size/2; i++)
|
||||
@ -361,20 +361,20 @@ static void pirates_decrypt_68k(running_machine &machine)
|
||||
|
||||
rom[i] = (vr<<8) | vl;
|
||||
}
|
||||
auto_free (machine, buf);
|
||||
auto_free (machine(), buf);
|
||||
}
|
||||
|
||||
static void pirates_decrypt_p(running_machine &machine)
|
||||
void pirates_state::pirates_decrypt_p()
|
||||
{
|
||||
int rom_size;
|
||||
UINT8 *buf, *rom;
|
||||
int i;
|
||||
|
||||
rom_size = machine.root_device().memregion("gfx1")->bytes();
|
||||
rom_size = machine().root_device().memregion("gfx1")->bytes();
|
||||
|
||||
buf = auto_alloc_array(machine, UINT8, rom_size);
|
||||
buf = auto_alloc_array(machine(), UINT8, rom_size);
|
||||
|
||||
rom = machine.root_device().memregion("gfx1")->base();
|
||||
rom = machine().root_device().memregion("gfx1")->base();
|
||||
memcpy (buf, rom, rom_size);
|
||||
|
||||
for (i=0; i<rom_size/4; i++)
|
||||
@ -385,20 +385,20 @@ static void pirates_decrypt_p(running_machine &machine)
|
||||
rom[adr+2*(rom_size/4)] = BITSWAP8(buf[i+2*(rom_size/4)], 1,4,7,0,3,5,6,2);
|
||||
rom[adr+3*(rom_size/4)] = BITSWAP8(buf[i+3*(rom_size/4)], 2,3,4,0,7,5,1,6);
|
||||
}
|
||||
auto_free (machine, buf);
|
||||
auto_free (machine(), buf);
|
||||
}
|
||||
|
||||
static void pirates_decrypt_s(running_machine &machine)
|
||||
void pirates_state::pirates_decrypt_s()
|
||||
{
|
||||
int rom_size;
|
||||
UINT8 *buf, *rom;
|
||||
int i;
|
||||
|
||||
rom_size = machine.root_device().memregion("gfx2")->bytes();
|
||||
rom_size = machine().root_device().memregion("gfx2")->bytes();
|
||||
|
||||
buf = auto_alloc_array(machine, UINT8, rom_size);
|
||||
buf = auto_alloc_array(machine(), UINT8, rom_size);
|
||||
|
||||
rom = machine.root_device().memregion("gfx2")->base();
|
||||
rom = machine().root_device().memregion("gfx2")->base();
|
||||
memcpy (buf, rom, rom_size);
|
||||
|
||||
for (i=0; i<rom_size/4; i++)
|
||||
@ -409,21 +409,21 @@ static void pirates_decrypt_s(running_machine &machine)
|
||||
rom[adr+2*(rom_size/4)] = BITSWAP8(buf[i+2*(rom_size/4)], 2,3,4,0,7,5,1,6);
|
||||
rom[adr+3*(rom_size/4)] = BITSWAP8(buf[i+3*(rom_size/4)], 4,2,7,1,6,5,0,3);
|
||||
}
|
||||
auto_free (machine, buf);
|
||||
auto_free (machine(), buf);
|
||||
}
|
||||
|
||||
|
||||
static void pirates_decrypt_oki(running_machine &machine)
|
||||
void pirates_state::pirates_decrypt_oki()
|
||||
{
|
||||
int rom_size;
|
||||
UINT8 *buf, *rom;
|
||||
int i;
|
||||
|
||||
rom_size = machine.root_device().memregion("oki")->bytes();
|
||||
rom_size = machine().root_device().memregion("oki")->bytes();
|
||||
|
||||
buf = auto_alloc_array(machine, UINT8, rom_size);
|
||||
buf = auto_alloc_array(machine(), UINT8, rom_size);
|
||||
|
||||
rom = machine.root_device().memregion("oki")->base();
|
||||
rom = machine().root_device().memregion("oki")->base();
|
||||
memcpy (buf, rom, rom_size);
|
||||
|
||||
for (i=0; i<rom_size; i++)
|
||||
@ -431,7 +431,7 @@ static void pirates_decrypt_oki(running_machine &machine)
|
||||
int adr = BITSWAP24(i,23,22,21,20,19,10,16,13,8,4,7,11,14,17,12,6,2,0,5,18,15,3,1,9);
|
||||
rom[adr] = BITSWAP8(buf[i], 2,3,4,0,7,5,1,6);
|
||||
}
|
||||
auto_free (machine, buf);
|
||||
auto_free (machine(), buf);
|
||||
}
|
||||
|
||||
|
||||
@ -439,10 +439,10 @@ DRIVER_INIT_MEMBER(pirates_state,pirates)
|
||||
{
|
||||
UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
|
||||
|
||||
pirates_decrypt_68k(machine());
|
||||
pirates_decrypt_p(machine());
|
||||
pirates_decrypt_s(machine());
|
||||
pirates_decrypt_oki(machine());
|
||||
pirates_decrypt_68k();
|
||||
pirates_decrypt_p();
|
||||
pirates_decrypt_s();
|
||||
pirates_decrypt_oki();
|
||||
|
||||
/* patch out protection check */
|
||||
rom[0x62c0/2] = 0x6006; // beq -> bra
|
||||
@ -452,10 +452,10 @@ READ16_MEMBER(pirates_state::genix_prot_r){ if(!offset) return 0x0004; else retu
|
||||
|
||||
DRIVER_INIT_MEMBER(pirates_state,genix)
|
||||
{
|
||||
pirates_decrypt_68k(machine());
|
||||
pirates_decrypt_p(machine());
|
||||
pirates_decrypt_s(machine());
|
||||
pirates_decrypt_oki(machine());
|
||||
pirates_decrypt_68k();
|
||||
pirates_decrypt_p();
|
||||
pirates_decrypt_s();
|
||||
pirates_decrypt_oki();
|
||||
|
||||
/* If this value is increased then something has gone wrong and the protection failed */
|
||||
/* Write-protect it for now */
|
||||
|
@ -1693,7 +1693,7 @@ ROM_START( hrdtimesa )
|
||||
ROM_END
|
||||
|
||||
|
||||
static UINT8 playmark_asciitohex(UINT8 data)
|
||||
UINT8 playmark_state::playmark_asciitohex(UINT8 data)
|
||||
{
|
||||
/* Convert ASCII data to HEX */
|
||||
|
||||
|
@ -542,16 +542,15 @@ ADDRESS_MAP_END
|
||||
|
||||
/**********************************************************************************/
|
||||
|
||||
static void reset_sound_region(running_machine &machine)
|
||||
void polygonet_state::reset_sound_region()
|
||||
{
|
||||
polygonet_state *state = machine.driver_data<polygonet_state>();
|
||||
state->membank("bank2")->set_base(state->memregion("soundcpu")->base() + 0x10000 + state->m_cur_sound_region*0x4000);
|
||||
membank("bank2")->set_base(memregion("soundcpu")->base() + 0x10000 + m_cur_sound_region*0x4000);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(polygonet_state::sound_bankswitch_w)
|
||||
{
|
||||
m_cur_sound_region = (data & 0x1f);
|
||||
reset_sound_region(machine());
|
||||
reset_sound_region();
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(polygonet_state::audio_interrupt)
|
||||
@ -726,7 +725,7 @@ DRIVER_INIT_MEMBER(polygonet_state,polygonet)
|
||||
{
|
||||
/* Set default bankswitch */
|
||||
m_cur_sound_region = 2;
|
||||
reset_sound_region(machine());
|
||||
reset_sound_region();
|
||||
|
||||
/* Allocate space for the dsp56k banking */
|
||||
memset(m_dsp56k_bank00_ram, 0, sizeof(m_dsp56k_bank00_ram));
|
||||
|
@ -387,14 +387,13 @@ TILE_GET_INFO_MEMBER(playmark_state::powerbal_get_bg_tile_info)
|
||||
SET_TILE_INFO_MEMBER(1, code, colr >> 12, 0);
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void playmark_state::draw_sprites_powerbal(bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
playmark_state *state = machine.driver_data<playmark_state>();
|
||||
UINT16 *spriteram = state->m_spriteram;
|
||||
UINT16 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
int height = machine.gfx[0]->height();
|
||||
int height = machine().gfx[0]->height();
|
||||
|
||||
for (offs = 4; offs < state->m_spriteram.bytes() / 2; offs += 4)
|
||||
for (offs = 4; offs < m_spriteram.bytes() / 2; offs += 4)
|
||||
{
|
||||
int sx, sy, code, color, flipx;
|
||||
|
||||
@ -408,11 +407,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
code = spriteram[offs + 2];
|
||||
color = (spriteram[offs + 1] & 0xf000) >> 12;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code,
|
||||
color,
|
||||
flipx,0,
|
||||
sx + state->m_xoffset,sy + state->m_yoffset,0);
|
||||
sx + m_xoffset,sy + m_yoffset,0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,7 +427,7 @@ VIDEO_START_MEMBER(playmark_state,powerbal)
|
||||
UINT32 playmark_state::screen_update_powerbal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites_powerbal(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -208,8 +208,8 @@ WRITE32_MEMBER(psikyo_state::s1945_mcu_w)
|
||||
m_s1945_mcu_direction = data;
|
||||
break;
|
||||
case 0x07:
|
||||
psikyo_switch_banks(machine(), 1, (data >> 6) & 3);
|
||||
psikyo_switch_banks(machine(), 0, (data >> 4) & 3);
|
||||
psikyo_switch_banks(1, (data >> 6) & 3);
|
||||
psikyo_switch_banks(0, (data >> 4) & 3);
|
||||
m_s1945_mcu_bctrl = data;
|
||||
break;
|
||||
case 0x0b:
|
||||
@ -1831,28 +1831,27 @@ DRIVER_INIT_MEMBER(psikyo_state,sngkace)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void s1945_mcu_init( running_machine &machine )
|
||||
void psikyo_state::s1945_mcu_init( )
|
||||
{
|
||||
psikyo_state *state = machine.driver_data<psikyo_state>();
|
||||
state->m_s1945_mcu_direction = 0x00;
|
||||
state->m_s1945_mcu_inlatch = 0xff;
|
||||
state->m_s1945_mcu_latch1 = 0xff;
|
||||
state->m_s1945_mcu_latch2 = 0xff;
|
||||
state->m_s1945_mcu_latching = 0x5;
|
||||
state->m_s1945_mcu_control = 0xff;
|
||||
state->m_s1945_mcu_index = 0;
|
||||
state->m_s1945_mcu_mode = 0;
|
||||
state->m_s1945_mcu_bctrl = 0x00;
|
||||
m_s1945_mcu_direction = 0x00;
|
||||
m_s1945_mcu_inlatch = 0xff;
|
||||
m_s1945_mcu_latch1 = 0xff;
|
||||
m_s1945_mcu_latch2 = 0xff;
|
||||
m_s1945_mcu_latching = 0x5;
|
||||
m_s1945_mcu_control = 0xff;
|
||||
m_s1945_mcu_index = 0;
|
||||
m_s1945_mcu_mode = 0;
|
||||
m_s1945_mcu_bctrl = 0x00;
|
||||
|
||||
state->save_item(NAME(state->m_s1945_mcu_direction));
|
||||
state->save_item(NAME(state->m_s1945_mcu_inlatch));
|
||||
state->save_item(NAME(state->m_s1945_mcu_latch1));
|
||||
state->save_item(NAME(state->m_s1945_mcu_latch2));
|
||||
state->save_item(NAME(state->m_s1945_mcu_latching));
|
||||
state->save_item(NAME(state->m_s1945_mcu_control));
|
||||
state->save_item(NAME(state->m_s1945_mcu_index));
|
||||
state->save_item(NAME(state->m_s1945_mcu_mode));
|
||||
state->save_item(NAME(state->m_s1945_mcu_bctrl));
|
||||
save_item(NAME(m_s1945_mcu_direction));
|
||||
save_item(NAME(m_s1945_mcu_inlatch));
|
||||
save_item(NAME(m_s1945_mcu_latch1));
|
||||
save_item(NAME(m_s1945_mcu_latch2));
|
||||
save_item(NAME(m_s1945_mcu_latching));
|
||||
save_item(NAME(m_s1945_mcu_control));
|
||||
save_item(NAME(m_s1945_mcu_index));
|
||||
save_item(NAME(m_s1945_mcu_mode));
|
||||
save_item(NAME(m_s1945_mcu_bctrl));
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(psikyo_state,tengai)
|
||||
@ -1866,7 +1865,7 @@ DRIVER_INIT_MEMBER(psikyo_state,tengai)
|
||||
/* protection */
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
|
||||
|
||||
s1945_mcu_init(machine());
|
||||
s1945_mcu_init();
|
||||
m_s1945_mcu_table = 0;
|
||||
|
||||
m_ka302c_banking = 0; // Banking is controlled by mcu
|
||||
@ -1903,7 +1902,7 @@ DRIVER_INIT_MEMBER(psikyo_state,s1945)
|
||||
/* protection and tile bank switching */
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
|
||||
|
||||
s1945_mcu_init(machine());
|
||||
s1945_mcu_init();
|
||||
m_s1945_mcu_table = s1945_table;
|
||||
|
||||
m_ka302c_banking = 0; // Banking is controlled by mcu
|
||||
@ -1924,7 +1923,7 @@ DRIVER_INIT_MEMBER(psikyo_state,s1945a)
|
||||
/* protection and tile bank switching */
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
|
||||
|
||||
s1945_mcu_init(machine());
|
||||
s1945_mcu_init();
|
||||
m_s1945_mcu_table = s1945a_table;
|
||||
|
||||
m_ka302c_banking = 0; // Banking is controlled by mcu
|
||||
@ -1945,7 +1944,7 @@ DRIVER_INIT_MEMBER(psikyo_state,s1945j)
|
||||
/* protection and tile bank switching */
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
|
||||
|
||||
s1945_mcu_init(machine());
|
||||
s1945_mcu_init();
|
||||
m_s1945_mcu_table = s1945j_table;
|
||||
|
||||
m_ka302c_banking = 0; // Banking is controlled by mcu
|
||||
|
@ -322,13 +322,12 @@ WRITE32_MEMBER(psikyo4_state::ps4_vidregs_w)
|
||||
}
|
||||
}
|
||||
|
||||
#define PCM_BANK_NO_LEGACY(n) ((state->m_io_select[0] >> (n * 4 + 24)) & 0x07)
|
||||
#define PCM_BANK_NO_LEGACY(n) ((m_io_select[0] >> (n * 4 + 24)) & 0x07)
|
||||
|
||||
static void set_hotgmck_pcm_bank( running_machine &machine, int n )
|
||||
void psikyo4_state::set_hotgmck_pcm_bank( int n )
|
||||
{
|
||||
psikyo4_state *state = machine.driver_data<psikyo4_state>();
|
||||
UINT8 *ymf_pcmbank = state->memregion("ymf")->base() + 0x200000;
|
||||
UINT8 *pcm_rom = state->memregion("ymfsource")->base();
|
||||
UINT8 *ymf_pcmbank = memregion("ymf")->base() + 0x200000;
|
||||
UINT8 *pcm_rom = memregion("ymfsource")->base();
|
||||
|
||||
memcpy(ymf_pcmbank + n * 0x100000, pcm_rom + PCM_BANK_NO_LEGACY(n) * 0x100000, 0x100000);
|
||||
}
|
||||
@ -345,10 +344,10 @@ WRITE32_MEMBER(psikyo4_state::hotgmck_pcm_bank_w)
|
||||
new_bank1 = PCM_BANK_NO(1);
|
||||
|
||||
if (old_bank0 != new_bank0)
|
||||
set_hotgmck_pcm_bank(machine(), 0);
|
||||
set_hotgmck_pcm_bank(0);
|
||||
|
||||
if (old_bank1 != new_bank1)
|
||||
set_hotgmck_pcm_bank(machine(), 1);
|
||||
set_hotgmck_pcm_bank(1);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( ps4_map, AS_PROGRAM, 32, psikyo4_state )
|
||||
@ -940,31 +939,30 @@ ROM_END
|
||||
|
||||
void psikyo4_state::hotgmck_pcm_bank_postload()
|
||||
{
|
||||
set_hotgmck_pcm_bank(machine(), 0);
|
||||
set_hotgmck_pcm_bank(machine(), 1);
|
||||
set_hotgmck_pcm_bank(0);
|
||||
set_hotgmck_pcm_bank(1);
|
||||
}
|
||||
|
||||
static void install_hotgmck_pcm_bank(running_machine &machine)
|
||||
void psikyo4_state::install_hotgmck_pcm_bank()
|
||||
{
|
||||
psikyo4_state *state = machine.driver_data<psikyo4_state>();
|
||||
UINT8 *ymf_pcm = state->memregion("ymf")->base();
|
||||
UINT8 *pcm_rom = state->memregion("ymfsource")->base();
|
||||
UINT8 *ymf_pcm = memregion("ymf")->base();
|
||||
UINT8 *pcm_rom = memregion("ymfsource")->base();
|
||||
|
||||
memcpy(ymf_pcm, pcm_rom, 0x200000);
|
||||
|
||||
state->m_io_select[0] = (state->m_io_select[0] & 0x00ffffff) | 0x32000000;
|
||||
set_hotgmck_pcm_bank(machine, 0);
|
||||
set_hotgmck_pcm_bank(machine, 1);
|
||||
m_io_select[0] = (m_io_select[0] & 0x00ffffff) | 0x32000000;
|
||||
set_hotgmck_pcm_bank(0);
|
||||
set_hotgmck_pcm_bank(1);
|
||||
|
||||
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x5800008, 0x580000b, write32_delegate(FUNC(psikyo4_state::hotgmck_pcm_bank_w),state));
|
||||
machine.save().register_postload(save_prepost_delegate(FUNC(psikyo4_state::hotgmck_pcm_bank_postload), state));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x5800008, 0x580000b, write32_delegate(FUNC(psikyo4_state::hotgmck_pcm_bank_w),this));
|
||||
machine().save().register_postload(save_prepost_delegate(FUNC(psikyo4_state::hotgmck_pcm_bank_postload), this));
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(psikyo4_state,hotgmck)
|
||||
{
|
||||
UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
|
||||
machine().root_device().membank("bank1")->set_base(&RAM[0x100000]);
|
||||
install_hotgmck_pcm_bank(machine()); // Banked PCM ROM
|
||||
install_hotgmck_pcm_bank(); // Banked PCM ROM
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,4 +40,7 @@ public:
|
||||
UINT32 screen_update_pacland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(mcu_vblank_irq);
|
||||
void switch_palette();
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int whichmask);
|
||||
void draw_fg(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
|
||||
};
|
||||
|
@ -139,6 +139,12 @@ public:
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(vblank_nmi);
|
||||
INTERRUPT_GEN_MEMBER(s2650_interrupt);
|
||||
void init_save_state();
|
||||
void jrpacman_mark_tile_dirty( int offset );
|
||||
void maketrax_rom_decode();
|
||||
void korosuke_rom_decode();
|
||||
void eyes_decode(UINT8 *data);
|
||||
void mspacman_install_patches(UINT8 *ROM);
|
||||
};
|
||||
|
||||
/*----------- defined in machine/pacplus.c -----------*/
|
||||
|
@ -53,4 +53,5 @@ public:
|
||||
UINT32 screen_update_pandoras(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(pandoras_master_interrupt);
|
||||
INTERRUPT_GEN_MEMBER(pandoras_slave_interrupt);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* sr );
|
||||
};
|
||||
|
@ -55,4 +55,6 @@ public:
|
||||
UINT32 screen_update_torus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_madball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(paradise_irq);
|
||||
void update_pix_palbank();
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -36,6 +36,9 @@ public:
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(blitter_timer_callback);
|
||||
int pastelg_blitter_src_addr_r(address_space &space);
|
||||
void pastelg_vramflip();
|
||||
void pastelg_gfxdraw();
|
||||
};
|
||||
|
||||
/*----------- defined in video/pastelg.c -----------*/
|
||||
|
@ -54,4 +54,5 @@ public:
|
||||
UINT32 screen_update_pbaction(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(pbaction_interrupt);
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -18,4 +18,5 @@ public:
|
||||
virtual void machine_start();
|
||||
UINT32 screen_update_pcktgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_pcktgalb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
@ -29,4 +29,5 @@ public:
|
||||
UINT32 screen_update_pingpong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(pingpong_interrupt);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(merlinmm_interrupt);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -30,4 +30,9 @@ public:
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
virtual void video_start();
|
||||
UINT32 screen_update_pirates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void pirates_decrypt_68k();
|
||||
void pirates_decrypt_p();
|
||||
void pirates_decrypt_s();
|
||||
void pirates_decrypt_oki();
|
||||
};
|
||||
|
@ -57,4 +57,6 @@ public:
|
||||
TIMER_CALLBACK_MEMBER(pitnrun_mcu_real_data_w);
|
||||
TIMER_CALLBACK_MEMBER(pitnrun_mcu_data_real_r);
|
||||
TIMER_CALLBACK_MEMBER(pitnrun_mcu_status_real_w);
|
||||
void pitnrun_spotlights();
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -118,6 +118,8 @@ public:
|
||||
UINT32 screen_update_playch10_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_playch10_single(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(playch10_interrupt);
|
||||
void pc10_set_videorom_bank( int first, int count, int bank, int size );
|
||||
void set_videoram_bank( int first, int count, int bank, int size );
|
||||
};
|
||||
|
||||
/*----------- defined in video/playch10.c -----------*/
|
||||
|
@ -107,4 +107,9 @@ public:
|
||||
UINT32 screen_update_excelsr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_hrdtimes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_powerbal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift );
|
||||
void bigtwinb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift );
|
||||
void draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
UINT8 playmark_asciitohex(UINT8 data);
|
||||
void draw_sprites_powerbal( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -75,4 +75,5 @@ public:
|
||||
UINT32 screen_update_polygonet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(polygonet_interrupt);
|
||||
INTERRUPT_GEN_MEMBER(audio_interrupt);
|
||||
void reset_sound_region();
|
||||
};
|
||||
|
@ -18,4 +18,5 @@ public:
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
virtual void video_start();
|
||||
UINT32 screen_update_pokechmp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
@ -84,6 +84,9 @@ public:
|
||||
DECLARE_PALETTE_INIT(polepos);
|
||||
UINT32 screen_update_polepos(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(polepos_scanline);
|
||||
void draw_road(bitmap_ind16 &bitmap);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void zoom_sprite(bitmap_ind16 &bitmap,int big,UINT32 code,UINT32 color,int flipx,int sx,int sy,int sizex,int sizey);
|
||||
};
|
||||
|
||||
|
||||
|
@ -49,4 +49,5 @@ public:
|
||||
UINT32 screen_update_policetr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(irq4_gen);
|
||||
TIMER_CALLBACK_MEMBER(irq5_gen);
|
||||
void render_display_list(offs_t offset);
|
||||
};
|
||||
|
@ -34,4 +34,5 @@ public:
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_pooyan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(pooyan_interrupt);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -42,4 +42,8 @@ public:
|
||||
DECLARE_PALETTE_INIT(popeyebl);
|
||||
UINT32 screen_update_popeye(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(popeye_interrupt);
|
||||
void convert_color_prom(const UINT8 *color_prom);
|
||||
void set_background_palette(int bank);
|
||||
void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
@ -56,4 +56,5 @@ public:
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_popper(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
|
||||
};
|
||||
|
@ -27,4 +27,6 @@ public:
|
||||
virtual void video_start();
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_portrait(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
inline void get_tile_info( tile_data &tileinfo, int tile_index, const UINT8 *source );
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
@ -31,4 +31,5 @@ public:
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
UINT32 screen_update_powerins(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
|
||||
};
|
||||
|
@ -28,4 +28,5 @@ public:
|
||||
TILE_GET_INFO_MEMBER(get_fg_tile_info);
|
||||
virtual void video_start();
|
||||
UINT32 screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int foreground );
|
||||
};
|
||||
|
@ -93,6 +93,11 @@ public:
|
||||
UINT32 screen_update_psikyo_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void screen_eof_psikyo(screen_device &screen, bool state);
|
||||
TIMER_CALLBACK_MEMBER(psikyo_soundlatch_callback);
|
||||
void psikyo_switch_banks( int tmap, int bank );
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int trans_pen );
|
||||
void draw_sprites_bootleg( bitmap_ind16 &bitmap, const rectangle &cliprect, int trans_pen );
|
||||
int tilemap_width( int size );
|
||||
void s1945_mcu_init( );
|
||||
};
|
||||
|
||||
/*----------- defined in video/psikyo.c -----------*/
|
||||
|
@ -54,4 +54,7 @@ public:
|
||||
UINT32 screen_update_psikyo4_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(psikyosh_interrupt);
|
||||
void hotgmck_pcm_bank_postload();
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 scr );
|
||||
void set_hotgmck_pcm_bank( int n );
|
||||
void install_hotgmck_pcm_bank();
|
||||
};
|
||||
|
@ -3,18 +3,18 @@
|
||||
#define MASTER_CLOCK 57272700 // main oscillator frequency
|
||||
|
||||
/* Psikyo PS6406B */
|
||||
#define FLIPSCREEN (((state->m_vidregs[3] & 0x0000c000) == 0x0000c000) ? 1:0)
|
||||
#define DISPLAY_DISABLE (((state->m_vidregs[2] & 0x0000000f) == 0x00000006) ? 1:0)
|
||||
#define BG_LARGE(n) (((state->m_vidregs[7] << (4*n)) & 0x00001000 ) ? 1:0)
|
||||
#define BG_DEPTH_8BPP(n) (((state->m_vidregs[7] << (4*n)) & 0x00004000 ) ? 1:0)
|
||||
#define BG_LAYER_ENABLE(n) (((state->m_vidregs[7] << (4*n)) & 0x00008000 ) ? 1:0)
|
||||
#define FLIPSCREEN (((m_vidregs[3] & 0x0000c000) == 0x0000c000) ? 1:0)
|
||||
#define DISPLAY_DISABLE (((m_vidregs[2] & 0x0000000f) == 0x00000006) ? 1:0)
|
||||
#define BG_LARGE(n) (((m_vidregs[7] << (4*n)) & 0x00001000 ) ? 1:0)
|
||||
#define BG_DEPTH_8BPP(n) (((m_vidregs[7] << (4*n)) & 0x00004000 ) ? 1:0)
|
||||
#define BG_LAYER_ENABLE(n) (((m_vidregs[7] << (4*n)) & 0x00008000 ) ? 1:0)
|
||||
|
||||
#define BG_TYPE(n) (((state->m_vidregs[6] << (8*n)) & 0x7f000000 ) >> 24)
|
||||
#define BG_LINE(n) (((state->m_vidregs[6] << (8*n)) & 0x80000000 ) ? 1:0)
|
||||
#define BG_TYPE(n) (((m_vidregs[6] << (8*n)) & 0x7f000000 ) >> 24)
|
||||
#define BG_LINE(n) (((m_vidregs[6] << (8*n)) & 0x80000000 ) ? 1:0)
|
||||
|
||||
#define BG_TRANSPEN MAKE_ARGB(0x00,0xff,0x00,0xff) // used for representing transparency in temporary bitmaps
|
||||
|
||||
#define SPRITE_PRI(n) (((state->m_vidregs[2] << (4*n)) & 0xf0000000 ) >> 28)
|
||||
#define SPRITE_PRI(n) (((m_vidregs[2] << (4*n)) & 0xf0000000 ) >> 28)
|
||||
|
||||
|
||||
class psikyosh_state : public driver_device
|
||||
@ -67,4 +67,17 @@ public:
|
||||
virtual void video_start();
|
||||
UINT32 screen_update_psikyosh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(psikyosh_interrupt);
|
||||
void draw_scanline32_alpha(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, int alpha);
|
||||
void draw_scanline32_argb(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr);
|
||||
void draw_scanline32_transpen(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr);
|
||||
void draw_bglayer( int layer, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri );
|
||||
void cache_bitmap(int scanline, gfx_element *gfx, int size, int tilebank, int alpha, int *last_bank);
|
||||
void draw_bglayerscroll( int layer, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri );
|
||||
void draw_background( bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri );
|
||||
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri);
|
||||
void psikyosh_prelineblend( bitmap_rgb32 &bitmap, const rectangle &cliprect );
|
||||
void psikyosh_postlineblend( bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri );
|
||||
void psikyosh_drawgfxzoom( bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||
int alpha, int zoomx, int zoomy, int wide, int high, UINT32 z);
|
||||
};
|
||||
|
@ -48,4 +48,9 @@ public:
|
||||
UINT32 screen_update_psychic5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_bombsa(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(psychic5_scanline);
|
||||
void psychic5_change_palette(int color, int offset);
|
||||
void psychic5_change_bg_palette(int color, int lo_offs, int hi_offs);
|
||||
void set_background_palette_intensity();
|
||||
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
@ -68,4 +68,9 @@ public:
|
||||
UINT32 screen_update_armwrest_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_armwrest_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(vblank_irq);
|
||||
void draw_big_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, int palette);
|
||||
void armwrest_draw_big_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, int palette);
|
||||
void drawbs2(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void punchout_copy_top_palette(int bank);
|
||||
void punchout_copy_bot_palette(int bank);
|
||||
};
|
||||
|
@ -49,4 +49,5 @@ public:
|
||||
DECLARE_MACHINE_RESET(pushman);
|
||||
DECLARE_MACHINE_RESET(bballs);
|
||||
UINT32 screen_update_pushman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -4,11 +4,6 @@
|
||||
#include "machine/nvram.h"
|
||||
#include "includes/playch10.h"
|
||||
|
||||
/* prototypes */
|
||||
static void pc10_set_videorom_bank( running_machine &machine, int first, int count, int bank, int size );
|
||||
static void set_videoram_bank( running_machine &machine, int first, int count, int bank, int size );
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Init machine
|
||||
@ -55,8 +50,8 @@ void playch10_state::machine_start()
|
||||
machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(playch10_state::pc10_nt_r),this),write8_delegate(FUNC(playch10_state::pc10_nt_w),this));
|
||||
|
||||
if (NULL != m_vram)
|
||||
set_videoram_bank(machine(), 0, 8, 0, 8);
|
||||
else pc10_set_videorom_bank(machine(), 0, 8, 0, 8);
|
||||
set_videoram_bank(0, 8, 0, 8);
|
||||
else pc10_set_videorom_bank(0, 8, 0, 8);
|
||||
|
||||
nvram_device *nvram = machine().device<nvram_device>("nvram");
|
||||
if (nvram != NULL)
|
||||
@ -355,9 +350,8 @@ void playch10_state::pc10_set_mirroring(int mirroring )
|
||||
* 64 1 *
|
||||
\*****************/
|
||||
|
||||
static void pc10_set_videorom_bank( running_machine &machine, int first, int count, int bank, int size )
|
||||
void playch10_state::pc10_set_videorom_bank( int first, int count, int bank, int size )
|
||||
{
|
||||
playch10_state *state = machine.driver_data<playch10_state>();
|
||||
int i, len;
|
||||
/* first = first bank to map */
|
||||
/* count = number of 1K banks to map */
|
||||
@ -368,7 +362,7 @@ static void pc10_set_videorom_bank( running_machine &machine, int first, int cou
|
||||
/* yeah, this is probably a horrible assumption to make.*/
|
||||
/* but the driver is 100% consistant */
|
||||
|
||||
len = state->memregion("gfx2")->bytes();
|
||||
len = memregion("gfx2")->bytes();
|
||||
len /= 0x400; // convert to KB
|
||||
len /= size; // convert to bank resolution
|
||||
len--; // convert to mask
|
||||
@ -376,14 +370,13 @@ static void pc10_set_videorom_bank( running_machine &machine, int first, int cou
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
state->m_chr_page[i + first].writable = 0;
|
||||
state->m_chr_page[i + first].chr=state->m_vrom + (i * 0x400) + (bank * size * 0x400);
|
||||
m_chr_page[i + first].writable = 0;
|
||||
m_chr_page[i + first].chr=m_vrom + (i * 0x400) + (bank * size * 0x400);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_videoram_bank( running_machine &machine, int first, int count, int bank, int size )
|
||||
void playch10_state::set_videoram_bank( int first, int count, int bank, int size )
|
||||
{
|
||||
playch10_state *state = machine.driver_data<playch10_state>();
|
||||
int i;
|
||||
/* first = first bank to map */
|
||||
/* count = number of 1K banks to map */
|
||||
@ -397,8 +390,8 @@ static void set_videoram_bank( running_machine &machine, int first, int count, i
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
state->m_chr_page[i + first].writable = 1;
|
||||
state->m_chr_page[i + first].chr = state->m_vram + (((i * 0x400) + (bank * size * 0x400)) & 0x1fff);
|
||||
m_chr_page[i + first].writable = 1;
|
||||
m_chr_page[i + first].chr = m_vram + (((i * 0x400) + (bank * size * 0x400)) & 0x1fff);
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,18 +518,18 @@ WRITE8_MEMBER(playch10_state::mmc1_rom_switch_w)
|
||||
|
||||
case 1: /* video rom banking - bank 0 - 4k or 8k */
|
||||
if (m_vram)
|
||||
set_videoram_bank(machine(), 0, (vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
set_videoram_bank(0, (vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
else
|
||||
pc10_set_videorom_bank(machine(), 0, (vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
pc10_set_videorom_bank(0, (vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
break;
|
||||
|
||||
case 2: /* video rom banking - bank 1 - 4k only */
|
||||
if (vrom4k)
|
||||
{
|
||||
if (m_vram)
|
||||
set_videoram_bank(machine(), 0, (vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
set_videoram_bank(0, (vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
else
|
||||
pc10_set_videorom_bank(machine(), 4, 4, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
pc10_set_videorom_bank(4, 4, (m_mmc1_shiftreg & 0x1f), 4);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -575,7 +568,7 @@ WRITE8_MEMBER(playch10_state::mmc1_rom_switch_w)
|
||||
|
||||
WRITE8_MEMBER(playch10_state::aboard_vrom_switch_w)
|
||||
{
|
||||
pc10_set_videorom_bank(machine(), 0, 8, (data & 3), 8);
|
||||
pc10_set_videorom_bank(0, 8, (data & 3), 8);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(playch10_state,pcaboard)
|
||||
@ -624,7 +617,7 @@ DRIVER_INIT_MEMBER(playch10_state,pcbboard)
|
||||
/* set the mirroring here */
|
||||
m_mirroring = PPU_MIRROR_VERT;
|
||||
/* special init */
|
||||
set_videoram_bank(machine(), 0, 8, 0, 8);
|
||||
set_videoram_bank(0, 8, 0, 8);
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
@ -632,7 +625,7 @@ DRIVER_INIT_MEMBER(playch10_state,pcbboard)
|
||||
|
||||
WRITE8_MEMBER(playch10_state::cboard_vrom_switch_w)
|
||||
{
|
||||
pc10_set_videorom_bank(machine(), 0, 8, ((data >> 1) & 1), 8);
|
||||
pc10_set_videorom_bank(0, 8, ((data >> 1) & 1), 8);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(playch10_state,pccboard)
|
||||
@ -669,7 +662,7 @@ DRIVER_INIT_MEMBER(playch10_state,pcdboard)
|
||||
/* allocate vram */
|
||||
m_vram = auto_alloc_array(machine(), UINT8, 0x2000);
|
||||
/* special init */
|
||||
set_videoram_bank(machine(), 0, 8, 0, 8);
|
||||
set_videoram_bank(0, 8, 0, 8);
|
||||
}
|
||||
|
||||
/* D Board games with extra ram (Metroid) */
|
||||
@ -685,7 +678,7 @@ DRIVER_INIT_MEMBER(playch10_state,pcdboard_2)
|
||||
/* allocate vram */
|
||||
m_vram = auto_alloc_array(machine(), UINT8, 0x2000);
|
||||
/* special init */
|
||||
set_videoram_bank(machine(), 0, 8, 0, 8);
|
||||
set_videoram_bank(0, 8, 0, 8);
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
@ -699,22 +692,22 @@ static void mapper9_latch( device_t *ppu, offs_t offset )
|
||||
if((offset & 0x1ff0) == 0x0fd0 && state->m_MMC2_bank_latch[0] != 0xfd)
|
||||
{
|
||||
state->m_MMC2_bank_latch[0] = 0xfd;
|
||||
pc10_set_videorom_bank(ppu->machine(), 0, 4, state->m_MMC2_bank[0], 4);
|
||||
state->pc10_set_videorom_bank(0, 4, state->m_MMC2_bank[0], 4);
|
||||
}
|
||||
else if((offset & 0x1ff0) == 0x0fe0 && state->m_MMC2_bank_latch[0] != 0xfe)
|
||||
{
|
||||
state->m_MMC2_bank_latch[0] = 0xfe;
|
||||
pc10_set_videorom_bank(ppu->machine(), 0, 4, state->m_MMC2_bank[1], 4);
|
||||
state->pc10_set_videorom_bank(0, 4, state->m_MMC2_bank[1], 4);
|
||||
}
|
||||
else if((offset & 0x1ff0) == 0x1fd0 && state->m_MMC2_bank_latch[1] != 0xfd)
|
||||
{
|
||||
state->m_MMC2_bank_latch[1] = 0xfd;
|
||||
pc10_set_videorom_bank(ppu->machine(), 4, 4, state->m_MMC2_bank[2], 4);
|
||||
state->pc10_set_videorom_bank(4, 4, state->m_MMC2_bank[2], 4);
|
||||
}
|
||||
else if((offset & 0x1ff0) == 0x1fe0 && state->m_MMC2_bank_latch[1] != 0xfe)
|
||||
{
|
||||
state->m_MMC2_bank_latch[1] = 0xfe;
|
||||
pc10_set_videorom_bank(ppu->machine(), 4, 4, state->m_MMC2_bank[3], 4);
|
||||
state->pc10_set_videorom_bank(4, 4, state->m_MMC2_bank[3], 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -734,25 +727,25 @@ WRITE8_MEMBER(playch10_state::eboard_rom_switch_w)
|
||||
case 0x3000: /* gfx bank 0 - 4k */
|
||||
m_MMC2_bank[0] = data;
|
||||
if (m_MMC2_bank_latch[0] == 0xfd)
|
||||
pc10_set_videorom_bank(machine(), 0, 4, data, 4);
|
||||
pc10_set_videorom_bank(0, 4, data, 4);
|
||||
break;
|
||||
|
||||
case 0x4000: /* gfx bank 0 - 4k */
|
||||
m_MMC2_bank[1] = data;
|
||||
if (m_MMC2_bank_latch[0] == 0xfe)
|
||||
pc10_set_videorom_bank(machine(), 0, 4, data, 4);
|
||||
pc10_set_videorom_bank(0, 4, data, 4);
|
||||
break;
|
||||
|
||||
case 0x5000: /* gfx bank 1 - 4k */
|
||||
m_MMC2_bank[2] = data;
|
||||
if (m_MMC2_bank_latch[1] == 0xfd)
|
||||
pc10_set_videorom_bank(machine(), 4, 4, data, 4);
|
||||
pc10_set_videorom_bank(4, 4, data, 4);
|
||||
break;
|
||||
|
||||
case 0x6000: /* gfx bank 1 - 4k */
|
||||
m_MMC2_bank[3] = data;
|
||||
if (m_MMC2_bank_latch[1] == 0xfe)
|
||||
pc10_set_videorom_bank(machine(), 4, 4, data, 4);
|
||||
pc10_set_videorom_bank(4, 4, data, 4);
|
||||
break;
|
||||
|
||||
case 0x7000: /* mirroring */
|
||||
@ -898,7 +891,7 @@ WRITE8_MEMBER(playch10_state::gboard_rom_switch_w)
|
||||
case 1: /* char banking */
|
||||
data &= 0xfe;
|
||||
page ^= (cmd << 1);
|
||||
pc10_set_videorom_bank(machine(), page, 2, data, 1);
|
||||
pc10_set_videorom_bank(page, 2, data, 1);
|
||||
break;
|
||||
|
||||
case 2: /* char banking */
|
||||
@ -906,7 +899,7 @@ WRITE8_MEMBER(playch10_state::gboard_rom_switch_w)
|
||||
case 4: /* char banking */
|
||||
case 5: /* char banking */
|
||||
page ^= cmd + 2;
|
||||
pc10_set_videorom_bank(machine(), page, 1, data, 1);
|
||||
pc10_set_videorom_bank(page, 1, data, 1);
|
||||
break;
|
||||
|
||||
case 6: /* program banking */
|
||||
@ -1053,7 +1046,7 @@ DRIVER_INIT_MEMBER(playch10_state,pciboard)
|
||||
/* allocate vram */
|
||||
m_vram = auto_alloc_array(machine(), UINT8, 0x2000);
|
||||
/* special init */
|
||||
set_videoram_bank(machine(), 0, 8, 0, 8);
|
||||
set_videoram_bank(0, 8, 0, 8);
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
@ -1076,11 +1069,11 @@ WRITE8_MEMBER(playch10_state::hboard_rom_switch_w)
|
||||
page ^= (cmd << 1);
|
||||
if (data & 0x40)
|
||||
{
|
||||
set_videoram_bank(machine(), page, 2, data, 1);
|
||||
set_videoram_bank(page, 2, data, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pc10_set_videorom_bank(machine(), page, 2, data, 1);
|
||||
pc10_set_videorom_bank(page, 2, data, 1);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1091,11 +1084,11 @@ WRITE8_MEMBER(playch10_state::hboard_rom_switch_w)
|
||||
page ^= cmd + 2;
|
||||
if (data & 0x40)
|
||||
{
|
||||
set_videoram_bank(machine(), page, 1, data, 1);
|
||||
set_videoram_bank(page, 1, data, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pc10_set_videorom_bank(machine(), page, 1, data, 1);
|
||||
pc10_set_videorom_bank(page, 1, data, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1153,5 +1146,5 @@ DRIVER_INIT_MEMBER(playch10_state,pckboard)
|
||||
/* allocate vram */
|
||||
m_vram = auto_alloc_array(machine(), UINT8, 0x2000);
|
||||
/* special init */
|
||||
set_videoram_bank(machine(), 0, 8, 0, 8);
|
||||
set_videoram_bank(0, 8, 0, 8);
|
||||
}
|
||||
|
@ -55,11 +55,10 @@ sprite color 0x7f will erase the tilemap and force it to be transparent.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void switch_palette(running_machine &machine)
|
||||
void pacland_state::switch_palette()
|
||||
{
|
||||
pacland_state *state = machine.driver_data<pacland_state>();
|
||||
int i;
|
||||
const UINT8 *color_prom = state->m_color_prom + 256 * state->m_palette_bank;
|
||||
const UINT8 *color_prom = m_color_prom + 256 * m_palette_bank;
|
||||
|
||||
for (i = 0;i < 256;i++)
|
||||
{
|
||||
@ -84,7 +83,7 @@ static void switch_palette(running_machine &machine)
|
||||
|
||||
color_prom++;
|
||||
|
||||
colortable_palette_set_color(machine.colortable,i,MAKE_RGB(r,g,b));
|
||||
colortable_palette_set_color(machine().colortable,i,MAKE_RGB(r,g,b));
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +112,7 @@ void pacland_state::palette_init()
|
||||
colortable_entry_set_value(machine().colortable, machine().gfx[2]->colorbase() + i, *color_prom++);
|
||||
|
||||
m_palette_bank = 0;
|
||||
switch_palette(machine());
|
||||
switch_palette();
|
||||
|
||||
/* precalculate transparency masks for sprites */
|
||||
m_transmask[0] = auto_alloc_array(machine(), UINT32, 64);
|
||||
@ -259,7 +258,7 @@ WRITE8_MEMBER(pacland_state::pacland_bankswitch_w)
|
||||
if (m_palette_bank != ((data & 0x18) >> 3))
|
||||
{
|
||||
m_palette_bank = (data & 0x18) >> 3;
|
||||
switch_palette(machine());
|
||||
switch_palette();
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,10 +271,9 @@ WRITE8_MEMBER(pacland_state::pacland_bankswitch_w)
|
||||
***************************************************************************/
|
||||
|
||||
/* the sprite generator IC is the same as Mappy */
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int whichmask)
|
||||
void pacland_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int whichmask)
|
||||
{
|
||||
pacland_state *state = machine.driver_data<pacland_state>();
|
||||
UINT8 *spriteram = state->m_spriteram + 0x780;
|
||||
UINT8 *spriteram = m_spriteram + 0x780;
|
||||
UINT8 *spriteram_2 = spriteram + 0x800;
|
||||
UINT8 *spriteram_3 = spriteram_2 + 0x800;
|
||||
int offs;
|
||||
@ -300,7 +298,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
sprite &= ~sizex;
|
||||
sprite &= ~(sizey << 1);
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
flipx ^= 1;
|
||||
flipy ^= 1;
|
||||
@ -314,39 +312,38 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
for (x = 0;x <= sizex;x++)
|
||||
{
|
||||
if (whichmask != 0)
|
||||
drawgfx_transmask(bitmap,cliprect,machine.gfx[2],
|
||||
drawgfx_transmask(bitmap,cliprect,machine().gfx[2],
|
||||
sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
|
||||
color,
|
||||
flipx,flipy,
|
||||
sx + 16*x,sy + 16*y,state->m_transmask[whichmask][color]);
|
||||
sx + 16*x,sy + 16*y,m_transmask[whichmask][color]);
|
||||
else
|
||||
pdrawgfx_transmask(bitmap,cliprect,machine.gfx[2],
|
||||
pdrawgfx_transmask(bitmap,cliprect,machine().gfx[2],
|
||||
sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
|
||||
color,
|
||||
flipx,flipy,
|
||||
sx + 16*x,sy + 16*y,
|
||||
machine.priority_bitmap,0,state->m_transmask[whichmask][color]);
|
||||
machine().priority_bitmap,0,m_transmask[whichmask][color]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void draw_fg(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
|
||||
void pacland_state::draw_fg(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
|
||||
{
|
||||
pacland_state *state = machine.driver_data<pacland_state>();
|
||||
int y, x;
|
||||
|
||||
/* draw tilemap transparently over it; this will leave invalid pens (0xffff)
|
||||
anywhere where the fg_tilemap should be transparent; note that we assume
|
||||
the fg_bitmap has been pre-erased to 0xffff */
|
||||
state->m_fg_tilemap->draw(state->m_fg_bitmap, cliprect, priority, 0);
|
||||
m_fg_tilemap->draw(m_fg_bitmap, cliprect, priority, 0);
|
||||
|
||||
/* now copy the fg_bitmap to the destination wherever the sprite pixel allows */
|
||||
for (y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||
{
|
||||
const UINT8 *pri = &machine.priority_bitmap.pix8(y);
|
||||
UINT16 *src = &state->m_fg_bitmap.pix16(y);
|
||||
const UINT8 *pri = &machine().priority_bitmap.pix8(y);
|
||||
UINT16 *src = &m_fg_bitmap.pix16(y);
|
||||
UINT16 *dst = &bitmap.pix16(y);
|
||||
|
||||
/* only copy if the priority bitmap is 0 (no high priority sprite) and the
|
||||
@ -377,21 +374,21 @@ UINT32 pacland_state::screen_update_pacland(screen_device &screen, bitmap_ind16
|
||||
wherever there is a high-priority pixel; note that we draw to the bitmap
|
||||
which is safe because the bg_tilemap draw will overwrite everything */
|
||||
machine().priority_bitmap.fill(0x00, cliprect);
|
||||
draw_sprites(machine(), bitmap, cliprect, 0);
|
||||
draw_sprites(bitmap, cliprect, 0);
|
||||
|
||||
/* draw background */
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
/* draw low priority fg tiles */
|
||||
draw_fg(machine(), bitmap, cliprect, 0);
|
||||
draw_fg(bitmap, cliprect, 0);
|
||||
|
||||
/* draw sprites with regular transparency */
|
||||
draw_sprites(machine(), bitmap, cliprect, 1);
|
||||
draw_sprites(bitmap, cliprect, 1);
|
||||
|
||||
/* draw high priority fg tiles */
|
||||
draw_fg(machine(), bitmap, cliprect, 1);
|
||||
draw_fg(bitmap, cliprect, 1);
|
||||
|
||||
/* draw sprite pixels with colortable values >= 0xf0, which have priority over everything */
|
||||
draw_sprites(machine(), bitmap, cliprect, 2);
|
||||
draw_sprites(bitmap, cliprect, 2);
|
||||
return 0;
|
||||
}
|
||||
|
@ -147,21 +147,20 @@ TILE_GET_INFO_MEMBER(pacman_state::pacman_get_tile_info)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void init_save_state(running_machine &machine)
|
||||
void pacman_state::init_save_state()
|
||||
{
|
||||
pacman_state *state = machine.driver_data<pacman_state>();
|
||||
state_save_register_global(machine, state->m_charbank);
|
||||
state_save_register_global(machine, state->m_spritebank);
|
||||
state_save_register_global(machine, state->m_palettebank);
|
||||
state_save_register_global(machine, state->m_colortablebank);
|
||||
state_save_register_global(machine, state->m_flipscreen);
|
||||
state_save_register_global(machine, state->m_bgpriority);
|
||||
state_save_register_global(machine(), m_charbank);
|
||||
state_save_register_global(machine(), m_spritebank);
|
||||
state_save_register_global(machine(), m_palettebank);
|
||||
state_save_register_global(machine(), m_colortablebank);
|
||||
state_save_register_global(machine(), m_flipscreen);
|
||||
state_save_register_global(machine(), m_bgpriority);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START_MEMBER(pacman_state,pacman)
|
||||
{
|
||||
init_save_state(machine());
|
||||
init_save_state();
|
||||
|
||||
m_charbank = 0;
|
||||
m_spritebank = 0;
|
||||
@ -316,7 +315,7 @@ UINT32 pacman_state::screen_update_pacman(screen_device &screen, bitmap_ind16 &b
|
||||
|
||||
VIDEO_START_MEMBER(pacman_state,pengo)
|
||||
{
|
||||
init_save_state(machine());
|
||||
init_save_state();
|
||||
|
||||
m_charbank = 0;
|
||||
m_spritebank = 0;
|
||||
@ -382,7 +381,7 @@ TILE_GET_INFO_MEMBER(pacman_state::s2650_get_tile_info)
|
||||
|
||||
VIDEO_START_MEMBER(pacman_state,s2650games)
|
||||
{
|
||||
init_save_state(machine());
|
||||
init_save_state();
|
||||
|
||||
m_charbank = 0;
|
||||
m_spritebank = 0;
|
||||
@ -525,33 +524,32 @@ TILE_GET_INFO_MEMBER(pacman_state::jrpacman_get_tile_info)
|
||||
SET_TILE_INFO_MEMBER(0,code,attr,0);
|
||||
}
|
||||
|
||||
static void jrpacman_mark_tile_dirty( running_machine &machine, int offset )
|
||||
void pacman_state::jrpacman_mark_tile_dirty( int offset )
|
||||
{
|
||||
pacman_state *state = machine.driver_data<pacman_state>();
|
||||
if( offset < 0x20 )
|
||||
{
|
||||
/* line color - mark whole line as dirty */
|
||||
int i;
|
||||
for( i = 2 * 0x20; i < 56 * 0x20; i += 0x20 )
|
||||
{
|
||||
state->m_bg_tilemap->mark_tile_dirty(offset + i );
|
||||
m_bg_tilemap->mark_tile_dirty(offset + i );
|
||||
}
|
||||
}
|
||||
else if (offset < 1792)
|
||||
{
|
||||
/* tiles for playfield */
|
||||
state->m_bg_tilemap->mark_tile_dirty(offset );
|
||||
m_bg_tilemap->mark_tile_dirty(offset );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* tiles & colors for top and bottom two rows */
|
||||
state->m_bg_tilemap->mark_tile_dirty(offset & ~0x80 );
|
||||
m_bg_tilemap->mark_tile_dirty(offset & ~0x80 );
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(pacman_state,jrpacman)
|
||||
{
|
||||
init_save_state(machine());
|
||||
init_save_state();
|
||||
|
||||
m_charbank = 0;
|
||||
m_spritebank = 0;
|
||||
@ -571,7 +569,7 @@ VIDEO_START_MEMBER(pacman_state,jrpacman)
|
||||
WRITE8_MEMBER(pacman_state::jrpacman_videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
jrpacman_mark_tile_dirty(machine(), offset);
|
||||
jrpacman_mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacman_state::jrpacman_charbank_w)
|
||||
|
@ -147,7 +147,7 @@ WRITE8_MEMBER(pandoras_state::pandoras_flipscreen_w)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* sr )
|
||||
void pandoras_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* sr )
|
||||
{
|
||||
int offs;
|
||||
|
||||
@ -159,19 +159,19 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
int nflipx = sr[offs + 3] & 0x40;
|
||||
int nflipy = sr[offs + 3] & 0x80;
|
||||
|
||||
drawgfx_transmask(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transmask(bitmap,cliprect,machine().gfx[0],
|
||||
sr[offs + 2],
|
||||
color,
|
||||
!nflipx,!nflipy,
|
||||
sx,sy,
|
||||
colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
|
||||
colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 pandoras_state::screen_update_pandoras(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_layer0->draw(bitmap, cliprect, 1 ,0);
|
||||
draw_sprites(machine(), bitmap, cliprect, &m_spriteram[0x800] );
|
||||
draw_sprites(bitmap, cliprect, &m_spriteram[0x800] );
|
||||
m_layer0->draw(bitmap, cliprect, 0 ,0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -39,14 +39,13 @@ WRITE8_MEMBER(paradise_state::tgtball_flipscreen_w)
|
||||
}
|
||||
|
||||
/* Note: Penky updates pixel palette bank register BEFORE actually writing to the paletteram. */
|
||||
static void update_pix_palbank(running_machine &machine)
|
||||
void paradise_state::update_pix_palbank()
|
||||
{
|
||||
paradise_state *state = machine.driver_data<paradise_state>();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 15; i++)
|
||||
palette_set_color_rgb(machine, 0x800 + i, state->m_paletteram[0x200 + state->m_pixbank + i + 0x800 * 0], state->m_paletteram[0x200 + state->m_pixbank + i + 0x800 * 1],
|
||||
state->m_paletteram[0x200 + state->m_pixbank + i + 0x800 * 2]);
|
||||
palette_set_color_rgb(machine(), 0x800 + i, m_paletteram[0x200 + m_pixbank + i + 0x800 * 0], m_paletteram[0x200 + m_pixbank + i + 0x800 * 1],
|
||||
m_paletteram[0x200 + m_pixbank + i + 0x800 * 2]);
|
||||
}
|
||||
|
||||
/* 800 bytes for red, followed by 800 bytes for green & 800 bytes for blue */
|
||||
@ -57,7 +56,7 @@ WRITE8_MEMBER(paradise_state::paradise_palette_w)
|
||||
palette_set_color_rgb(machine(), offset, m_paletteram[offset + 0x800 * 0], m_paletteram[offset + 0x800 * 1],
|
||||
m_paletteram[offset + 0x800 * 2]);
|
||||
|
||||
update_pix_palbank(machine());
|
||||
update_pix_palbank();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -86,7 +85,7 @@ WRITE8_MEMBER(paradise_state::paradise_palbank_w)
|
||||
|
||||
m_pixbank = bank2;
|
||||
|
||||
update_pix_palbank(machine());
|
||||
update_pix_palbank();
|
||||
|
||||
if (m_palbank != bank1)
|
||||
{
|
||||
@ -180,12 +179,11 @@ WRITE8_MEMBER(paradise_state::paradise_priority_w)
|
||||
m_priority = data;
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void paradise_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
paradise_state *state = machine.driver_data<paradise_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int i;
|
||||
for (i = 0; i < state->m_spriteram.bytes() ; i += state->m_sprite_inc)
|
||||
for (i = 0; i < m_spriteram.bytes() ; i += m_sprite_inc)
|
||||
{
|
||||
int code = spriteram[i + 0];
|
||||
int x = spriteram[i + 1];
|
||||
@ -195,26 +193,26 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
int flipx = 0; // ?
|
||||
int flipy = 0;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
x = 0xf0 - x; flipx = !flipx;
|
||||
y = 0xf0 - y; flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code + (attr << 8),
|
||||
0,
|
||||
flipx, flipy,
|
||||
x,y, 0xff );
|
||||
|
||||
/* wrap around x */
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code + (attr << 8),
|
||||
0,
|
||||
flipx, flipy,
|
||||
x - 256,y, 0xff );
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code + (attr << 8),
|
||||
0,
|
||||
flipx, flipy,
|
||||
@ -253,7 +251,7 @@ if (machine().input().code_pressed(KEYCODE_Z))
|
||||
|
||||
if (m_priority & 1)
|
||||
if (layers_ctrl & 16)
|
||||
draw_sprites(screen.machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
|
||||
if (layers_ctrl & 1) m_tilemap_0->draw(bitmap, cliprect, 0, 0);
|
||||
if (layers_ctrl & 2) m_tilemap_1->draw(bitmap, cliprect, 0, 0);
|
||||
@ -263,7 +261,7 @@ if (machine().input().code_pressed(KEYCODE_Z))
|
||||
{
|
||||
if (!(m_priority & 1))
|
||||
if (layers_ctrl & 16)
|
||||
draw_sprites(screen.machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
if (layers_ctrl & 8)
|
||||
m_tilemap_2->draw(bitmap, cliprect, 0, 0);
|
||||
}
|
||||
@ -273,7 +271,7 @@ if (machine().input().code_pressed(KEYCODE_Z))
|
||||
m_tilemap_2->draw(bitmap, cliprect, 0, 0);
|
||||
if (!(m_priority & 1))
|
||||
if (layers_ctrl & 16)
|
||||
draw_sprites(screen.machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -287,14 +285,14 @@ UINT32 paradise_state::screen_update_torus(screen_device &screen, bitmap_ind16 &
|
||||
return 0;
|
||||
|
||||
if (m_priority & 1)
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
|
||||
m_tilemap_1->draw(bitmap, cliprect, 0,0);
|
||||
|
||||
if (m_priority & 4)
|
||||
{
|
||||
if (!(m_priority & 1))
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
|
||||
m_tilemap_2->draw(bitmap, cliprect, 0, 0);
|
||||
}
|
||||
@ -303,7 +301,7 @@ UINT32 paradise_state::screen_update_torus(screen_device &screen, bitmap_ind16 &
|
||||
m_tilemap_2->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
if (!(m_priority & 1))
|
||||
draw_sprites(machine(), bitmap,cliprect);
|
||||
draw_sprites(bitmap,cliprect);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -315,6 +313,6 @@ UINT32 paradise_state::screen_update_madball(screen_device &screen, bitmap_ind16
|
||||
m_tilemap_0->draw(bitmap, cliprect, 0, 0);
|
||||
m_tilemap_1->draw(bitmap, cliprect, 0, 0);
|
||||
m_tilemap_2->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -10,11 +10,6 @@
|
||||
#include "includes/nb1413m3.h"
|
||||
#include "includes/pastelg.h"
|
||||
|
||||
|
||||
static void pastelg_vramflip(running_machine &machine);
|
||||
static void pastelg_gfxdraw(running_machine &machine);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
|
||||
@ -57,10 +52,9 @@ WRITE8_MEMBER(pastelg_state::pastelg_clut_w)
|
||||
|
||||
|
||||
******************************************************************************/
|
||||
int pastelg_blitter_src_addr_r(address_space &space)
|
||||
int pastelg_state::pastelg_blitter_src_addr_r(address_space &space)
|
||||
{
|
||||
pastelg_state *state = space.machine().driver_data<pastelg_state>();
|
||||
return state->m_blitter_src_addr;
|
||||
return m_blitter_src_addr;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pastelg_state::pastelg_blitter_w)
|
||||
@ -74,13 +68,13 @@ WRITE8_MEMBER(pastelg_state::pastelg_blitter_w)
|
||||
case 4: m_blitter_sizex = data; break;
|
||||
case 5: m_blitter_sizey = data;
|
||||
/* writing here also starts the blit */
|
||||
pastelg_gfxdraw(machine());
|
||||
pastelg_gfxdraw();
|
||||
break;
|
||||
case 6: m_blitter_direction_x = (data & 0x01) ? 1 : 0;
|
||||
m_blitter_direction_y = (data & 0x02) ? 1 : 0;
|
||||
m_flipscreen = (data & 0x04) ? 0 : 1;
|
||||
m_dispflag = (data & 0x08) ? 0 : 1;
|
||||
pastelg_vramflip(machine());
|
||||
pastelg_vramflip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -126,28 +120,27 @@ WRITE8_MEMBER(pastelg_state::pastelg_romsel_w)
|
||||
|
||||
|
||||
******************************************************************************/
|
||||
static void pastelg_vramflip(running_machine &machine)
|
||||
void pastelg_state::pastelg_vramflip()
|
||||
{
|
||||
pastelg_state *state = machine.driver_data<pastelg_state>();
|
||||
int x, y;
|
||||
UINT8 color1, color2;
|
||||
int width = machine.primary_screen->width();
|
||||
int height = machine.primary_screen->height();
|
||||
int width = machine().primary_screen->width();
|
||||
int height = machine().primary_screen->height();
|
||||
|
||||
if (state->m_flipscreen == state->m_flipscreen_old) return;
|
||||
if (m_flipscreen == m_flipscreen_old) return;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
color1 = state->m_videoram[(y * width) + x];
|
||||
color2 = state->m_videoram[((y ^ 0xff) * width) + (x ^ 0xff)];
|
||||
state->m_videoram[(y * width) + x] = color2;
|
||||
state->m_videoram[((y ^ 0xff) * width) + (x ^ 0xff)] = color1;
|
||||
color1 = m_videoram[(y * width) + x];
|
||||
color2 = m_videoram[((y ^ 0xff) * width) + (x ^ 0xff)];
|
||||
m_videoram[(y * width) + x] = color2;
|
||||
m_videoram[((y ^ 0xff) * width) + (x ^ 0xff)] = color1;
|
||||
}
|
||||
}
|
||||
|
||||
state->m_flipscreen_old = state->m_flipscreen;
|
||||
m_flipscreen_old = m_flipscreen;
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(pastelg_state::blitter_timer_callback)
|
||||
@ -155,11 +148,10 @@ TIMER_CALLBACK_MEMBER(pastelg_state::blitter_timer_callback)
|
||||
nb1413m3_busyflag = 1;
|
||||
}
|
||||
|
||||
static void pastelg_gfxdraw(running_machine &machine)
|
||||
void pastelg_state::pastelg_gfxdraw()
|
||||
{
|
||||
pastelg_state *state = machine.driver_data<pastelg_state>();
|
||||
UINT8 *GFX = state->memregion("gfx1")->base();
|
||||
int width = machine.primary_screen->width();
|
||||
UINT8 *GFX = memregion("gfx1")->base();
|
||||
int width = machine().primary_screen->width();
|
||||
|
||||
int x, y;
|
||||
int dx, dy;
|
||||
@ -174,36 +166,36 @@ static void pastelg_gfxdraw(running_machine &machine)
|
||||
|
||||
nb1413m3_busyctr = 0;
|
||||
|
||||
startx = state->m_blitter_destx + state->m_blitter_sizex;
|
||||
starty = state->m_blitter_desty + state->m_blitter_sizey;
|
||||
startx = m_blitter_destx + m_blitter_sizex;
|
||||
starty = m_blitter_desty + m_blitter_sizey;
|
||||
|
||||
|
||||
if (state->m_blitter_direction_x)
|
||||
if (m_blitter_direction_x)
|
||||
{
|
||||
if (state->m_blitter_sizex&0x80) sizex = 0xff-state->m_blitter_sizex;
|
||||
else sizex=state->m_blitter_sizex;
|
||||
if (m_blitter_sizex&0x80) sizex = 0xff-m_blitter_sizex;
|
||||
else sizex=m_blitter_sizex;
|
||||
incx = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sizex = state->m_blitter_sizex;
|
||||
sizex = m_blitter_sizex;
|
||||
incx = -1;
|
||||
}
|
||||
|
||||
if (state->m_blitter_direction_y)
|
||||
if (m_blitter_direction_y)
|
||||
{
|
||||
if (state->m_blitter_sizey&0x80) sizey = 0xff-state->m_blitter_sizey;
|
||||
else sizey=state->m_blitter_sizey;
|
||||
if (m_blitter_sizey&0x80) sizey = 0xff-m_blitter_sizey;
|
||||
else sizey=m_blitter_sizey;
|
||||
incy = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sizey = state->m_blitter_sizey;
|
||||
sizey = m_blitter_sizey;
|
||||
incy = -1;
|
||||
}
|
||||
|
||||
gfxlen = machine.root_device().memregion("gfx1")->bytes();
|
||||
gfxaddr = (state->m_gfxrom << 16) + state->m_blitter_src_addr;
|
||||
gfxlen = machine().root_device().memregion("gfx1")->bytes();
|
||||
gfxaddr = (m_gfxrom << 16) + m_blitter_src_addr;
|
||||
|
||||
readflag = 0;
|
||||
|
||||
@ -216,7 +208,7 @@ static void pastelg_gfxdraw(running_machine &machine)
|
||||
|
||||
for (ctrx = sizex; ctrx >= 0; ctrx--)
|
||||
{
|
||||
gfxaddr = (state->m_gfxrom << 16) + ((state->m_blitter_src_addr + count));
|
||||
gfxaddr = (m_gfxrom << 16) + ((m_blitter_src_addr + count));
|
||||
|
||||
if ((gfxaddr > (gfxlen - 1)))
|
||||
{
|
||||
@ -231,7 +223,7 @@ static void pastelg_gfxdraw(running_machine &machine)
|
||||
dx = x & 0xff;
|
||||
dy = y & 0xff;
|
||||
|
||||
if (state->m_flipscreen)
|
||||
if (m_flipscreen)
|
||||
{
|
||||
dx ^= 0xff;
|
||||
dy ^= 0xff;
|
||||
@ -251,20 +243,20 @@ static void pastelg_gfxdraw(running_machine &machine)
|
||||
|
||||
readflag ^= 1;
|
||||
|
||||
if (state->m_clut[color] & 0xf0)
|
||||
if (m_clut[color] & 0xf0)
|
||||
{
|
||||
if (color)
|
||||
{
|
||||
color = ((state->m_palbank * 0x10) + color);
|
||||
state->m_videoram[(dy * width) + dx] = color;
|
||||
color = ((m_palbank * 0x10) + color);
|
||||
m_videoram[(dy * width) + dx] = color;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(state->m_clut[color] != 0)
|
||||
if(m_clut[color] != 0)
|
||||
{
|
||||
color = ((state->m_palbank * 0x10) + state->m_clut[color]);
|
||||
state->m_videoram[(dy * width) + dx] = color;
|
||||
color = ((m_palbank * 0x10) + m_clut[color]);
|
||||
m_videoram[(dy * width) + dx] = color;
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +268,7 @@ static void pastelg_gfxdraw(running_machine &machine)
|
||||
}
|
||||
|
||||
nb1413m3_busyflag = 0;
|
||||
machine.scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(pastelg_state::blitter_timer_callback),state));
|
||||
machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(pastelg_state::blitter_timer_callback),this));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -76,13 +76,12 @@ void pbaction_state::video_start()
|
||||
m_fg_tilemap->set_transparent_pen(0);
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void pbaction_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
pbaction_state *state = machine.driver_data<pbaction_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
|
||||
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int sx, sy, flipx, flipy;
|
||||
|
||||
@ -100,7 +99,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
flipx = spriteram[offs + 1] & 0x40;
|
||||
flipy = spriteram[offs + 1] & 0x80;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
if (spriteram[offs] & 0x80)
|
||||
{
|
||||
@ -116,18 +115,18 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[(spriteram[offs] & 0x80) ? 3 : 2], /* normal or double size */
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[(spriteram[offs] & 0x80) ? 3 : 2], /* normal or double size */
|
||||
spriteram[offs],
|
||||
spriteram[offs + 1] & 0x0f,
|
||||
flipx,flipy,
|
||||
sx + (state->flip_screen() ? state->m_scroll : -state->m_scroll), sy,0);
|
||||
sx + (flip_screen() ? m_scroll : -m_scroll), sy,0);
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 pbaction_state::screen_update_pbaction(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,13 +31,12 @@ void pcktgal_state::palette_init()
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void pcktgal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
pcktgal_state *state = machine.driver_data<pcktgal_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < state->m_spriteram.bytes();offs += 4)
|
||||
for (offs = 0;offs < m_spriteram.bytes();offs += 4)
|
||||
{
|
||||
if (spriteram[offs] != 0xf8)
|
||||
{
|
||||
@ -49,14 +48,14 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
|
||||
flipx = spriteram[offs+1] & 0x04;
|
||||
flipy = spriteram[offs+1] & 0x02;
|
||||
if (state->flip_screen()) {
|
||||
if (flip_screen()) {
|
||||
sx=240-sx;
|
||||
sy=240-sy;
|
||||
if (flipx) flipx=0; else flipx=1;
|
||||
if (flipy) flipy=0; else flipy=1;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
|
||||
spriteram[offs+3] + ((spriteram[offs+1] & 1) << 8),
|
||||
(spriteram[offs+1] & 0x70) >> 4,
|
||||
flipx,flipy,
|
||||
@ -69,7 +68,7 @@ UINT32 pcktgal_state::screen_update_pcktgal(screen_device &screen, bitmap_ind16
|
||||
{
|
||||
// flip_screen_set(machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
|
||||
machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -77,5 +76,6 @@ UINT32 pcktgal_state::screen_update_pcktgalb(screen_device &screen, bitmap_ind16
|
||||
{
|
||||
// the bootleg doesn't properly set the tilemap registers, because it's on non-original hardware, which probably doesn't have the flexible tilemaps.
|
||||
machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw_bootleg(machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0, 2);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
return 0;}
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -110,18 +110,17 @@ void pingpong_state::video_start()
|
||||
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pingpong_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void pingpong_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
/* This is strange; it's unlikely that the sprites actually have a hardware */
|
||||
/* clipping region, but I haven't found another way to have them masked by */
|
||||
/* the characters at the top and bottom of the screen. */
|
||||
const rectangle spritevisiblearea(0*8, 32*8-1, 4*8, 29*8-1);
|
||||
|
||||
pingpong_state *state = machine.driver_data<pingpong_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = state->m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
|
||||
for (offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
|
||||
{
|
||||
int sx,sy,flipx,flipy,color,schar;
|
||||
|
||||
@ -134,18 +133,18 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
color = spriteram[offs] & 0x1f;
|
||||
schar = spriteram[offs + 2] & 0x7f;
|
||||
|
||||
drawgfx_transmask(bitmap,spritevisiblearea,machine.gfx[1],
|
||||
drawgfx_transmask(bitmap,spritevisiblearea,machine().gfx[1],
|
||||
schar,
|
||||
color,
|
||||
flipx,flipy,
|
||||
sx,sy,
|
||||
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
|
||||
colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 pingpong_state::screen_update_pingpong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -67,11 +67,10 @@ WRITE16_MEMBER(pirates_state::pirates_bg_tileram_w)
|
||||
|
||||
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void pirates_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
pirates_state *state = machine.driver_data<pirates_state>();
|
||||
gfx_element *gfx = machine.gfx[1];
|
||||
UINT16 *source = state->m_spriteram + 4;
|
||||
gfx_element *gfx = machine().gfx[1];
|
||||
UINT16 *source = m_spriteram + 4;
|
||||
UINT16 *finish = source + 0x800/2-4;
|
||||
|
||||
while( source<finish )
|
||||
@ -106,7 +105,7 @@ UINT32 pirates_state::screen_update_pirates(screen_device &screen, bitmap_ind16
|
||||
m_fg_tilemap->set_scrollx(0,m_scroll[0]);
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0,0);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0,0);
|
||||
draw_sprites(machine(),bitmap,cliprect);
|
||||
draw_sprites(bitmap,cliprect);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0,0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -94,11 +94,10 @@ WRITE8_MEMBER(pitnrun_state::pitnrun_color_select_w)
|
||||
machine().tilemap().mark_all_dirty();
|
||||
}
|
||||
|
||||
static void pitnrun_spotlights(running_machine &machine)
|
||||
void pitnrun_state::pitnrun_spotlights()
|
||||
{
|
||||
pitnrun_state *state = machine.driver_data<pitnrun_state>();
|
||||
int x,y,i,b,datapix;
|
||||
UINT8 *ROM = state->memregion("user1")->base();
|
||||
UINT8 *ROM = memregion("user1")->base();
|
||||
for(i=0;i<4;i++)
|
||||
for(y=0;y<128;y++)
|
||||
for(x=0;x<16;x++)
|
||||
@ -106,7 +105,7 @@ static void pitnrun_spotlights(running_machine &machine)
|
||||
datapix=ROM[128*16*i+x+y*16];
|
||||
for(b=0;b<8;b++)
|
||||
{
|
||||
state->m_tmp_bitmap[i]->pix16(y, x*8+(7-b)) = (datapix&1);
|
||||
m_tmp_bitmap[i]->pix16(y, x*8+(7-b)) = (datapix&1);
|
||||
datapix>>=1;
|
||||
}
|
||||
}
|
||||
@ -169,13 +168,12 @@ void pitnrun_state::video_start()
|
||||
m_tmp_bitmap[1] = auto_bitmap_ind16_alloc(machine(),128,128);
|
||||
m_tmp_bitmap[2] = auto_bitmap_ind16_alloc(machine(),128,128);
|
||||
m_tmp_bitmap[3] = auto_bitmap_ind16_alloc(machine(),128,128);
|
||||
pitnrun_spotlights(machine());
|
||||
pitnrun_spotlights();
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void pitnrun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
pitnrun_state *state = machine.driver_data<pitnrun_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int sx, sy, flipx, flipy, offs,pal;
|
||||
|
||||
for (offs = 0 ; offs < 0x100; offs+=4)
|
||||
@ -187,18 +185,18 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
flipy = (spriteram[offs+1]&0x80)>>7;
|
||||
flipx = (spriteram[offs+1]&0x40)>>6;
|
||||
|
||||
if (state->flip_screen_x())
|
||||
if (flip_screen_x())
|
||||
{
|
||||
sx = 256 - sx;
|
||||
flipx = !flipx;
|
||||
}
|
||||
if (state->flip_screen_y())
|
||||
if (flip_screen_y())
|
||||
{
|
||||
sy = 240 - sy;
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
|
||||
(spriteram[offs+1]&0x3f)+((spriteram[offs+2]&0x80)>>1)+((spriteram[offs+2]&0x40)<<1),
|
||||
pal,
|
||||
flipx,flipy,
|
||||
@ -253,7 +251,7 @@ UINT32 pitnrun_state::screen_update_pitnrun(screen_device &screen, bitmap_ind16
|
||||
m_bg->draw(bitmap, myclip, 0,0);
|
||||
}
|
||||
|
||||
draw_sprites(machine(),bitmap,myclip);
|
||||
draw_sprites(bitmap,myclip);
|
||||
|
||||
if(m_ha&4)
|
||||
copybitmap_trans(bitmap,*m_tmp_bitmap[m_ha&3],flip_screen_x(),flip_screen_y(),dx,dy,myclip, 1);
|
||||
|
@ -385,16 +385,15 @@ WRITE16_MEMBER(playmark_state::hrdtimes_scroll_w)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift )
|
||||
void playmark_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift )
|
||||
{
|
||||
playmark_state *state = machine.driver_data<playmark_state>();
|
||||
int offs, start_offset = state->m_spriteram.bytes() / 2 - 4;
|
||||
int height = machine.gfx[0]->height();
|
||||
int colordiv = machine.gfx[0]->granularity() / 16;
|
||||
UINT16 *spriteram = state->m_spriteram;
|
||||
int offs, start_offset = m_spriteram.bytes() / 2 - 4;
|
||||
int height = machine().gfx[0]->height();
|
||||
int colordiv = machine().gfx[0]->granularity() / 16;
|
||||
UINT16 *spriteram = m_spriteram;
|
||||
|
||||
// find the "end of list" to draw the sprites in reverse order
|
||||
for (offs = 4; offs < state->m_spriteram.bytes() / 2; offs += 4)
|
||||
for (offs = 4; offs < m_spriteram.bytes() / 2; offs += 4)
|
||||
{
|
||||
if (spriteram[offs + 3 - 4] == 0x2000) /* end of list marker */
|
||||
{
|
||||
@ -419,25 +418,24 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
if(!pri && (color & 0x0c) == 0x0c)
|
||||
pri = 2;
|
||||
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code,
|
||||
color,
|
||||
flipx,0,
|
||||
sx + state->m_xoffset,sy + state->m_yoffset,
|
||||
machine.priority_bitmap,state->m_pri_masks[pri],0);
|
||||
sx + m_xoffset,sy + m_yoffset,
|
||||
machine().priority_bitmap,m_pri_masks[pri],0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void bigtwinb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift )
|
||||
void playmark_state::bigtwinb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift )
|
||||
{
|
||||
playmark_state *state = machine.driver_data<playmark_state>();
|
||||
int offs, start_offset = state->m_spriteram.bytes() / 2 - 4;
|
||||
int height = machine.gfx[0]->height();
|
||||
UINT16 *spriteram = state->m_spriteram;
|
||||
int offs, start_offset = m_spriteram.bytes() / 2 - 4;
|
||||
int height = machine().gfx[0]->height();
|
||||
UINT16 *spriteram = m_spriteram;
|
||||
|
||||
// find the "end of list" to draw the sprites in reverse order
|
||||
for (offs = 4; offs < state->m_spriteram.bytes() / 2; offs += 4)
|
||||
for (offs = 4; offs < m_spriteram.bytes() / 2; offs += 4)
|
||||
{
|
||||
if (spriteram[offs + 3 - 4] == 0x2000) /* end of list marker */
|
||||
{
|
||||
@ -458,17 +456,16 @@ static void bigtwinb_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
|
||||
code = spriteram[offs + 2] >> codeshift;
|
||||
color = ((spriteram[offs + 1] & 0xf000) >> 12);
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
code,
|
||||
color,
|
||||
flipx,0,
|
||||
sx + state->m_xoffset,sy + state->m_yoffset, 0);
|
||||
sx + m_xoffset,sy + m_yoffset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_bitmap( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void playmark_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
playmark_state *state = machine.driver_data<playmark_state>();
|
||||
int x, y, count;
|
||||
int color;
|
||||
UINT8 *pri;
|
||||
@ -478,26 +475,26 @@ static void draw_bitmap( running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
{
|
||||
for (x = 0; x < 512; x++)
|
||||
{
|
||||
color = state->m_bgvideoram[count] & 0xff;
|
||||
color = m_bgvideoram[count] & 0xff;
|
||||
|
||||
if (color)
|
||||
{
|
||||
if (state->m_bg_full_size)
|
||||
if (m_bg_full_size)
|
||||
{
|
||||
bitmap.pix16((y + state->m_bgscrolly) & 0x1ff, (x + state->m_bgscrollx) & 0x1ff) = 0x100 + color;
|
||||
bitmap.pix16((y + m_bgscrolly) & 0x1ff, (x + m_bgscrollx) & 0x1ff) = 0x100 + color;
|
||||
|
||||
pri = &machine.priority_bitmap.pix8((y + state->m_bgscrolly) & 0x1ff);
|
||||
pri[(x + state->m_bgscrollx) & 0x1ff] |= 2;
|
||||
pri = &machine().priority_bitmap.pix8((y + m_bgscrolly) & 0x1ff);
|
||||
pri[(x + m_bgscrollx) & 0x1ff] |= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 50% size */
|
||||
if(!(x % 2) && !(y % 2))
|
||||
{
|
||||
bitmap.pix16((y / 2 + state->m_bgscrolly) & 0x1ff, (x / 2 + state->m_bgscrollx) & 0x1ff) = 0x100 + color;
|
||||
bitmap.pix16((y / 2 + m_bgscrolly) & 0x1ff, (x / 2 + m_bgscrollx) & 0x1ff) = 0x100 + color;
|
||||
|
||||
pri = &machine.priority_bitmap.pix8((y / 2 + state->m_bgscrolly) & 0x1ff);
|
||||
pri[(x / 2 + state->m_bgscrollx) & 0x1ff] |= 2;
|
||||
pri = &machine().priority_bitmap.pix8((y / 2 + m_bgscrolly) & 0x1ff);
|
||||
pri[(x / 2 + m_bgscrollx) & 0x1ff] |= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -513,8 +510,8 @@ UINT32 playmark_state::screen_update_bigtwin(screen_device &screen, bitmap_ind16
|
||||
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
if (m_bg_enable)
|
||||
draw_bitmap(machine(), bitmap, cliprect);
|
||||
draw_sprites(machine(), bitmap, cliprect, 4);
|
||||
draw_bitmap(bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect, 4);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -527,7 +524,7 @@ UINT32 playmark_state::screen_update_bigtwinb(screen_device &screen, bitmap_ind1
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
bigtwinb_draw_sprites(machine(), bitmap, cliprect, 4);
|
||||
bigtwinb_draw_sprites(bitmap, cliprect, 4);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
}
|
||||
else
|
||||
@ -541,9 +538,9 @@ UINT32 playmark_state::screen_update_excelsr(screen_device &screen, bitmap_ind16
|
||||
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 1);
|
||||
if (m_bg_enable)
|
||||
draw_bitmap(machine(), bitmap, cliprect);
|
||||
draw_bitmap(bitmap, cliprect);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
|
||||
draw_sprites(machine(), bitmap, cliprect, 2);
|
||||
draw_sprites(bitmap, cliprect, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -567,7 +564,7 @@ UINT32 playmark_state::screen_update_wbeachvl(screen_device &screen, bitmap_ind1
|
||||
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 1);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 2);
|
||||
draw_sprites(machine(), bitmap, cliprect, 0);
|
||||
draw_sprites(bitmap, cliprect, 0);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -581,7 +578,7 @@ UINT32 playmark_state::screen_update_hrdtimes(screen_device &screen, bitmap_ind1
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 1);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 2);
|
||||
draw_sprites(machine(), bitmap, cliprect, 2);
|
||||
draw_sprites(bitmap, cliprect, 2);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
}
|
||||
else
|
||||
|
@ -35,13 +35,12 @@ void pokechmp_state::video_start()
|
||||
8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void pokechmp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
pokechmp_state *state = machine.driver_data<pokechmp_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < state->m_spriteram.bytes();offs += 4)
|
||||
for (offs = 0;offs < m_spriteram.bytes();offs += 4)
|
||||
{
|
||||
if (spriteram[offs] != 0xf8)
|
||||
{
|
||||
@ -53,7 +52,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
|
||||
flipx = spriteram[offs+1] & 0x04;
|
||||
flipy = spriteram[offs+1] & 0x02;
|
||||
if (state->flip_screen()) {
|
||||
if (flip_screen()) {
|
||||
sx=240-sx;
|
||||
sy=240-sy;
|
||||
if (flipx) flipx=0; else flipx=1;
|
||||
@ -63,7 +62,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
if (spriteram[offs+1] & 0x01) tileno += 0x100;
|
||||
if (spriteram[offs+1] & 0x08) tileno += 0x200;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
|
||||
tileno,
|
||||
(spriteram[offs+1] & 0xf0) >> 4,
|
||||
flipx,flipy,
|
||||
@ -75,6 +74,6 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
UINT32 pokechmp_state::screen_update_pokechmp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -340,10 +340,9 @@ WRITE8_MEMBER(polepos_state::polepos_alpha_w)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_road(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
void polepos_state::draw_road(bitmap_ind16 &bitmap)
|
||||
{
|
||||
polepos_state *state = machine.driver_data<polepos_state>();
|
||||
const UINT8 *road_control = state->memregion("gfx5")->base();
|
||||
const UINT8 *road_control = memregion("gfx5")->base();
|
||||
const UINT8 *road_bits1 = road_control + 0x2000;
|
||||
const UINT8 *road_bits2 = road_control + 0x4000;
|
||||
int x, y, i;
|
||||
@ -357,16 +356,16 @@ static void draw_road(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
pen_t pen_base;
|
||||
|
||||
/* first add the vertical position modifier and the vertical scroll */
|
||||
yoffs = ((state->m_vertical_position_modifier[y] + state->m_road16_vscroll) >> 3) & 0x1ff;
|
||||
yoffs = ((m_vertical_position_modifier[y] + m_road16_vscroll) >> 3) & 0x1ff;
|
||||
|
||||
/* then use that as a lookup into the road memory */
|
||||
roadpal = state->m_road16_memory[yoffs] & 15;
|
||||
roadpal = m_road16_memory[yoffs] & 15;
|
||||
|
||||
/* this becomes the palette base for the scanline */
|
||||
pen_base = 0x0b00 + (roadpal << 6);
|
||||
|
||||
/* now fetch the horizontal scroll offset for this scanline */
|
||||
xoffs = state->m_road16_memory[0x380 + (y & 0x7f)] & 0x3ff;
|
||||
xoffs = m_road16_memory[0x380 + (y & 0x7f)] & 0x3ff;
|
||||
|
||||
/* the road is drawn in 8-pixel chunks, so round downward and adjust the base */
|
||||
/* note that we assume there is at least 8 pixels of slop on the left/right */
|
||||
@ -416,14 +415,14 @@ static void draw_road(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
}
|
||||
}
|
||||
|
||||
static void zoom_sprite(running_machine &machine, bitmap_ind16 &bitmap,int big,
|
||||
void polepos_state::zoom_sprite(bitmap_ind16 &bitmap,int big,
|
||||
UINT32 code,UINT32 color,int flipx,int sx,int sy,
|
||||
int sizex,int sizey)
|
||||
{
|
||||
gfx_element *gfx = machine.gfx[big ? 3 : 2];
|
||||
gfx_element *gfx = machine().gfx[big ? 3 : 2];
|
||||
const UINT8 *gfxdata = gfx->get_data(code % gfx->elements());
|
||||
UINT8 *scaling_rom = machine.root_device().memregion("gfx6")->base();
|
||||
UINT32 transmask = colortable_get_transpen_mask(machine.colortable, gfx, color, 0x1f);
|
||||
UINT8 *scaling_rom = machine().root_device().memregion("gfx6")->base();
|
||||
UINT32 transmask = colortable_get_transpen_mask(machine().colortable, gfx, color, 0x1f);
|
||||
int coloroffs = gfx->colorbase() + color * gfx->granularity();
|
||||
int x,y;
|
||||
|
||||
@ -467,11 +466,10 @@ static void zoom_sprite(running_machine &machine, bitmap_ind16 &bitmap,int big,
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void polepos_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
polepos_state *state = machine.driver_data<polepos_state>();
|
||||
UINT16 *posmem = &state->m_sprite16_memory[0x380];
|
||||
UINT16 *sizmem = &state->m_sprite16_memory[0x780];
|
||||
UINT16 *posmem = &m_sprite16_memory[0x380];
|
||||
UINT16 *sizmem = &m_sprite16_memory[0x780];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 64; i++, posmem += 2, sizmem += 2)
|
||||
@ -487,7 +485,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
/* 128V input to the palette PROM */
|
||||
if (sy >= 128) color |= 0x40;
|
||||
|
||||
zoom_sprite(machine, bitmap, (sizmem[0] & 0x8000) ? 1 : 0,
|
||||
zoom_sprite(bitmap, (sizmem[0] & 0x8000) ? 1 : 0,
|
||||
code,
|
||||
color,
|
||||
flipx,
|
||||
@ -502,8 +500,8 @@ UINT32 polepos_state::screen_update_polepos(screen_device &screen, bitmap_ind16
|
||||
rectangle clip = cliprect;
|
||||
clip.max_y = 127;
|
||||
m_bg_tilemap->draw(bitmap, clip, 0,0);
|
||||
draw_road(machine(), bitmap);
|
||||
draw_sprites(machine(), bitmap,cliprect);
|
||||
draw_road(bitmap);
|
||||
draw_sprites(bitmap,cliprect);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0,0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -42,18 +42,17 @@ void policetr_state::video_start()
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void render_display_list(running_machine &machine, offs_t offset)
|
||||
void policetr_state::render_display_list(offs_t offset)
|
||||
{
|
||||
policetr_state *state = machine.driver_data<policetr_state>();
|
||||
/* mask against the R3000 address space */
|
||||
offset &= 0x1fffffff;
|
||||
|
||||
/* loop over all items */
|
||||
while (offset != 0x1fffffff)
|
||||
{
|
||||
UINT32 *entry = &state->m_rambase[offset / 4];
|
||||
UINT32 *entry = &m_rambase[offset / 4];
|
||||
UINT32 srcx = entry[0] & 0xfffffff;
|
||||
UINT32 srcy = entry[1] & ((state->m_srcbitmap_height_mask << 16) | 0xffff);
|
||||
UINT32 srcy = entry[1] & ((m_srcbitmap_height_mask << 16) | 0xffff);
|
||||
UINT32 srcxstep = entry[2];
|
||||
UINT32 srcystep = entry[3];
|
||||
int dstw = (entry[4] & 0x1ff) + 1;
|
||||
@ -65,43 +64,43 @@ static void render_display_list(running_machine &machine, offs_t offset)
|
||||
UINT32 curx, cury;
|
||||
int x, y;
|
||||
|
||||
if (dstx > state->m_render_clip.max_x)
|
||||
if (dstx > m_render_clip.max_x)
|
||||
{
|
||||
dstw -= (512 - dstx);
|
||||
dstx = 0;
|
||||
}
|
||||
/* apply X clipping */
|
||||
if (dstx < state->m_render_clip.min_x)
|
||||
if (dstx < m_render_clip.min_x)
|
||||
{
|
||||
srcx += srcxstep * (state->m_render_clip.min_x - dstx);
|
||||
dstw -= state->m_render_clip.min_x - dstx;
|
||||
dstx = state->m_render_clip.min_x;
|
||||
srcx += srcxstep * (m_render_clip.min_x - dstx);
|
||||
dstw -= m_render_clip.min_x - dstx;
|
||||
dstx = m_render_clip.min_x;
|
||||
}
|
||||
if (dstx + dstw > state->m_render_clip.max_x)
|
||||
dstw = state->m_render_clip.max_x - dstx + 1;
|
||||
if (dstx + dstw > m_render_clip.max_x)
|
||||
dstw = m_render_clip.max_x - dstx + 1;
|
||||
|
||||
/* apply Y clipping */
|
||||
if (dsty < state->m_render_clip.min_y)
|
||||
if (dsty < m_render_clip.min_y)
|
||||
{
|
||||
srcy += srcystep * (state->m_render_clip.min_y - dsty);
|
||||
dsth -= state->m_render_clip.min_y - dsty;
|
||||
dsty = state->m_render_clip.min_y;
|
||||
srcy += srcystep * (m_render_clip.min_y - dsty);
|
||||
dsth -= m_render_clip.min_y - dsty;
|
||||
dsty = m_render_clip.min_y;
|
||||
}
|
||||
if (dsty + dsth > state->m_render_clip.max_y)
|
||||
dsth = state->m_render_clip.max_y - dsty + 1;
|
||||
if (dsty + dsth > m_render_clip.max_y)
|
||||
dsth = m_render_clip.max_y - dsty + 1;
|
||||
|
||||
/* special case for fills */
|
||||
if (srcxstep == 0 && srcystep == 0)
|
||||
{
|
||||
/* prefetch the pixel */
|
||||
UINT8 pixel = state->m_srcbitmap[((srcy >> 16) * state->m_srcbitmap_height_mask) * SRCBITMAP_WIDTH + (srcx >> 16) % SRCBITMAP_WIDTH];
|
||||
UINT8 pixel = m_srcbitmap[((srcy >> 16) * m_srcbitmap_height_mask) * SRCBITMAP_WIDTH + (srcx >> 16) % SRCBITMAP_WIDTH];
|
||||
pixel = color | (pixel & mask);
|
||||
|
||||
/* loop over rows and columns */
|
||||
if (dstw > 0)
|
||||
for (y = 0; y < dsth; y++)
|
||||
{
|
||||
UINT8 *dst = &state->m_dstbitmap[(dsty + y) * DSTBITMAP_WIDTH + dstx];
|
||||
UINT8 *dst = &m_dstbitmap[(dsty + y) * DSTBITMAP_WIDTH + dstx];
|
||||
memset(dst, pixel, dstw);
|
||||
}
|
||||
}
|
||||
@ -112,8 +111,8 @@ static void render_display_list(running_machine &machine, offs_t offset)
|
||||
/* loop over rows */
|
||||
for (y = 0, cury = srcy; y < dsth; y++, cury += srcystep)
|
||||
{
|
||||
UINT8 *src = &state->m_srcbitmap[((cury >> 16) & state->m_srcbitmap_height_mask) * SRCBITMAP_WIDTH];
|
||||
UINT8 *dst = &state->m_dstbitmap[(dsty + y) * DSTBITMAP_WIDTH + dstx];
|
||||
UINT8 *src = &m_srcbitmap[((cury >> 16) & m_srcbitmap_height_mask) * SRCBITMAP_WIDTH];
|
||||
UINT8 *dst = &m_dstbitmap[(dsty + y) * DSTBITMAP_WIDTH + dstx];
|
||||
|
||||
/* loop over columns */
|
||||
for (x = 0, curx = srcx; x < dstw; x++, curx += srcxstep)
|
||||
@ -149,7 +148,7 @@ WRITE32_MEMBER(policetr_state::policetr_video_w)
|
||||
{
|
||||
/* offset 0 specifies the start address of a display list */
|
||||
case 0:
|
||||
render_display_list(machine(), data);
|
||||
render_display_list(data);
|
||||
break;
|
||||
|
||||
/* offset 1 specifies a latch value in the upper 8 bits */
|
||||
|
@ -154,11 +154,10 @@ WRITE8_MEMBER(pooyan_state::pooyan_flipscreen_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void pooyan_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
pooyan_state *state = machine.driver_data<pooyan_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram_2 = state->m_spriteram2;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
UINT8 *spriteram_2 = m_spriteram2;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x10; offs < 0x40; offs += 2)
|
||||
@ -172,12 +171,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
int flipy = spriteram_2[offs] & 0x80;
|
||||
|
||||
drawgfx_transmask(bitmap,cliprect,
|
||||
machine.gfx[1],
|
||||
machine().gfx[1],
|
||||
code,
|
||||
color,
|
||||
flipx, flipy,
|
||||
sx, sy,
|
||||
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
|
||||
colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,6 +191,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
UINT32 pooyan_state::screen_update_pooyan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,9 +49,8 @@ enum { TYPE_SKYSKIPR, TYPE_POPEYE };
|
||||
The bootleg is the same, but the outputs are not inverted.
|
||||
|
||||
***************************************************************************/
|
||||
static void convert_color_prom(running_machine &machine,const UINT8 *color_prom)
|
||||
void popeye_state::convert_color_prom(const UINT8 *color_prom)
|
||||
{
|
||||
popeye_state *state = machine.driver_data<popeye_state>();
|
||||
int i;
|
||||
|
||||
|
||||
@ -65,22 +64,22 @@ static void convert_color_prom(running_machine &machine,const UINT8 *color_prom)
|
||||
int bit0,bit1,bit2,r,g,b;
|
||||
|
||||
/* red component */
|
||||
bit0 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 0) & 0x01;
|
||||
bit1 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 1) & 0x01;
|
||||
bit2 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 2) & 0x01;
|
||||
bit0 = ((color_prom[prom_offs] ^ m_invertmask) >> 0) & 0x01;
|
||||
bit1 = ((color_prom[prom_offs] ^ m_invertmask) >> 1) & 0x01;
|
||||
bit2 = ((color_prom[prom_offs] ^ m_invertmask) >> 2) & 0x01;
|
||||
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
/* green component */
|
||||
bit0 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 3) & 0x01;
|
||||
bit1 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 4) & 0x01;
|
||||
bit2 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 5) & 0x01;
|
||||
bit0 = ((color_prom[prom_offs] ^ m_invertmask) >> 3) & 0x01;
|
||||
bit1 = ((color_prom[prom_offs] ^ m_invertmask) >> 4) & 0x01;
|
||||
bit2 = ((color_prom[prom_offs] ^ m_invertmask) >> 5) & 0x01;
|
||||
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
/* blue component */
|
||||
bit0 = 0;
|
||||
bit1 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 6) & 0x01;
|
||||
bit2 = ((color_prom[prom_offs] ^ state->m_invertmask) >> 7) & 0x01;
|
||||
bit1 = ((color_prom[prom_offs] ^ m_invertmask) >> 6) & 0x01;
|
||||
bit2 = ((color_prom[prom_offs] ^ m_invertmask) >> 7) & 0x01;
|
||||
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
palette_set_color(machine,16 + (2 * i) + 1,MAKE_RGB(r,g,b));
|
||||
palette_set_color(machine(),16 + (2 * i) + 1,MAKE_RGB(r,g,b));
|
||||
}
|
||||
|
||||
color_prom += 32;
|
||||
@ -92,22 +91,22 @@ static void convert_color_prom(running_machine &machine,const UINT8 *color_prom)
|
||||
|
||||
|
||||
/* red component */
|
||||
bit0 = ((color_prom[0] ^ state->m_invertmask) >> 0) & 0x01;
|
||||
bit1 = ((color_prom[0] ^ state->m_invertmask) >> 1) & 0x01;
|
||||
bit2 = ((color_prom[0] ^ state->m_invertmask) >> 2) & 0x01;
|
||||
bit0 = ((color_prom[0] ^ m_invertmask) >> 0) & 0x01;
|
||||
bit1 = ((color_prom[0] ^ m_invertmask) >> 1) & 0x01;
|
||||
bit2 = ((color_prom[0] ^ m_invertmask) >> 2) & 0x01;
|
||||
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
/* green component */
|
||||
bit0 = ((color_prom[0] ^ state->m_invertmask) >> 3) & 0x01;
|
||||
bit1 = ((color_prom[256] ^ state->m_invertmask) >> 0) & 0x01;
|
||||
bit2 = ((color_prom[256] ^ state->m_invertmask) >> 1) & 0x01;
|
||||
bit0 = ((color_prom[0] ^ m_invertmask) >> 3) & 0x01;
|
||||
bit1 = ((color_prom[256] ^ m_invertmask) >> 0) & 0x01;
|
||||
bit2 = ((color_prom[256] ^ m_invertmask) >> 1) & 0x01;
|
||||
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
/* blue component */
|
||||
bit0 = 0;
|
||||
bit1 = ((color_prom[256] ^ state->m_invertmask) >> 2) & 0x01;
|
||||
bit2 = ((color_prom[256] ^ state->m_invertmask) >> 3) & 0x01;
|
||||
bit1 = ((color_prom[256] ^ m_invertmask) >> 2) & 0x01;
|
||||
bit2 = ((color_prom[256] ^ m_invertmask) >> 3) & 0x01;
|
||||
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
palette_set_color(machine,48+i,MAKE_RGB(r,g,b));
|
||||
palette_set_color(machine(),48+i,MAKE_RGB(r,g,b));
|
||||
|
||||
color_prom++;
|
||||
}
|
||||
@ -118,7 +117,7 @@ void popeye_state::palette_init()
|
||||
const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
|
||||
m_invertmask = 0xff;
|
||||
|
||||
convert_color_prom(machine(),color_prom);
|
||||
convert_color_prom(color_prom);
|
||||
}
|
||||
|
||||
PALETTE_INIT_MEMBER(popeye_state,popeyebl)
|
||||
@ -126,14 +125,13 @@ PALETTE_INIT_MEMBER(popeye_state,popeyebl)
|
||||
const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
|
||||
m_invertmask = 0x00;
|
||||
|
||||
convert_color_prom(machine(),color_prom);
|
||||
convert_color_prom(color_prom);
|
||||
}
|
||||
|
||||
static void set_background_palette(running_machine &machine,int bank)
|
||||
void popeye_state::set_background_palette(int bank)
|
||||
{
|
||||
popeye_state *state = machine.driver_data<popeye_state>();
|
||||
int i;
|
||||
UINT8 *color_prom = state->memregion("proms")->base() + 16 * bank;
|
||||
UINT8 *color_prom = memregion("proms")->base() + 16 * bank;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
{
|
||||
@ -141,20 +139,20 @@ static void set_background_palette(running_machine &machine,int bank)
|
||||
int r,g,b;
|
||||
|
||||
/* red component */
|
||||
bit0 = ((*color_prom ^ state->m_invertmask) >> 0) & 0x01;
|
||||
bit1 = ((*color_prom ^ state->m_invertmask) >> 1) & 0x01;
|
||||
bit2 = ((*color_prom ^ state->m_invertmask) >> 2) & 0x01;
|
||||
bit0 = ((*color_prom ^ m_invertmask) >> 0) & 0x01;
|
||||
bit1 = ((*color_prom ^ m_invertmask) >> 1) & 0x01;
|
||||
bit2 = ((*color_prom ^ m_invertmask) >> 2) & 0x01;
|
||||
r = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
|
||||
/* green component */
|
||||
bit0 = ((*color_prom ^ state->m_invertmask) >> 3) & 0x01;
|
||||
bit1 = ((*color_prom ^ state->m_invertmask) >> 4) & 0x01;
|
||||
bit2 = ((*color_prom ^ state->m_invertmask) >> 5) & 0x01;
|
||||
bit0 = ((*color_prom ^ m_invertmask) >> 3) & 0x01;
|
||||
bit1 = ((*color_prom ^ m_invertmask) >> 4) & 0x01;
|
||||
bit2 = ((*color_prom ^ m_invertmask) >> 5) & 0x01;
|
||||
g = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
|
||||
/* blue component */
|
||||
bit0 = 0;
|
||||
bit1 = ((*color_prom ^ state->m_invertmask) >> 6) & 0x01;
|
||||
bit2 = ((*color_prom ^ state->m_invertmask) >> 7) & 0x01;
|
||||
if (state->m_bitmap_type == TYPE_SKYSKIPR)
|
||||
bit1 = ((*color_prom ^ m_invertmask) >> 6) & 0x01;
|
||||
bit2 = ((*color_prom ^ m_invertmask) >> 7) & 0x01;
|
||||
if (m_bitmap_type == TYPE_SKYSKIPR)
|
||||
{
|
||||
/* Sky Skipper has different weights */
|
||||
bit0 = bit1;
|
||||
@ -162,7 +160,7 @@ static void set_background_palette(running_machine &machine,int bank)
|
||||
}
|
||||
b = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
palette_set_color(machine(),i,MAKE_RGB(r,g,b));
|
||||
|
||||
color_prom++;
|
||||
}
|
||||
@ -273,51 +271,49 @@ VIDEO_START_MEMBER(popeye_state,popeye)
|
||||
state_save_register_global_pointer(machine(), m_bitmapram, popeye_bitmapram_size);
|
||||
}
|
||||
|
||||
static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void popeye_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
popeye_state *state = machine.driver_data<popeye_state>();
|
||||
int offs;
|
||||
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
|
||||
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
|
||||
if (state->m_lastflip != state->flip_screen())
|
||||
if (m_lastflip != flip_screen())
|
||||
{
|
||||
for (offs = 0;offs < popeye_bitmapram_size;offs++)
|
||||
state->popeye_bitmap_w(space,offs,state->m_bitmapram[offs]);
|
||||
popeye_bitmap_w(space,offs,m_bitmapram[offs]);
|
||||
|
||||
state->m_lastflip = state->flip_screen();
|
||||
m_lastflip = flip_screen();
|
||||
}
|
||||
|
||||
set_background_palette(machine, (*state->m_palettebank & 0x08) >> 3);
|
||||
set_background_palette((*m_palettebank & 0x08) >> 3);
|
||||
|
||||
if (state->m_background_pos[1] == 0) /* no background */
|
||||
if (m_background_pos[1] == 0) /* no background */
|
||||
bitmap.fill(0, cliprect);
|
||||
else
|
||||
{
|
||||
/* copy the background graphics */
|
||||
int scrollx = 200 - state->m_background_pos[0] - 256*(state->m_background_pos[2]&1); /* ??? */
|
||||
int scrolly = 2 * (256 - state->m_background_pos[1]);
|
||||
int scrollx = 200 - m_background_pos[0] - 256*(m_background_pos[2]&1); /* ??? */
|
||||
int scrolly = 2 * (256 - m_background_pos[1]);
|
||||
|
||||
if (state->m_bitmap_type == TYPE_SKYSKIPR)
|
||||
if (m_bitmap_type == TYPE_SKYSKIPR)
|
||||
scrollx = 2*scrollx - 512;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
if (state->m_bitmap_type == TYPE_POPEYE)
|
||||
if (m_bitmap_type == TYPE_POPEYE)
|
||||
scrollx = -scrollx;
|
||||
scrolly = -scrolly;
|
||||
}
|
||||
|
||||
copyscrollbitmap(bitmap,*state->m_tmpbitmap2,1,&scrollx,1,&scrolly,cliprect);
|
||||
copyscrollbitmap(bitmap,*m_tmpbitmap2,1,&scrollx,1,&scrolly,cliprect);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void popeye_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
popeye_state *state = machine.driver_data<popeye_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < state->m_spriteram.bytes();offs += 4)
|
||||
for (offs = 0;offs < m_spriteram.bytes();offs += 4)
|
||||
{
|
||||
int code,color,flipx,flipy,sx,sy;
|
||||
|
||||
@ -335,8 +331,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
|
||||
code = (spriteram[offs + 2] & 0x7f) + ((spriteram[offs + 3] & 0x10) << 3)
|
||||
+ ((spriteram[offs + 3] & 0x04) << 6);
|
||||
color = (spriteram[offs + 3] & 0x07) + 8*(*state->m_palettebank & 0x07);
|
||||
if (state->m_bitmap_type == TYPE_SKYSKIPR)
|
||||
color = (spriteram[offs + 3] & 0x07) + 8*(*m_palettebank & 0x07);
|
||||
if (m_bitmap_type == TYPE_SKYSKIPR)
|
||||
{
|
||||
/* Two of the PROM address pins are tied together and one is not connected... */
|
||||
color = (color & 0x0f) | ((color & 0x08) << 1);
|
||||
@ -348,7 +344,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
sx = 2*(spriteram[offs])-8;
|
||||
sy = 2*(256-spriteram[offs + 1]);
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
@ -357,7 +353,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
}
|
||||
|
||||
if (spriteram[offs] != 0)
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
|
||||
code ^ 0x1ff,
|
||||
color,
|
||||
flipx,flipy,
|
||||
@ -367,8 +363,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
|
||||
UINT32 popeye_state::screen_update_popeye(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
draw_background(machine(), bitmap, cliprect);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_background(bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -187,15 +187,14 @@ void popper_state::video_start()
|
||||
m_tilemap_clip = machine().primary_screen->visible_area();
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
|
||||
void popper_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
|
||||
{
|
||||
popper_state *state = machine.driver_data<popper_state>();
|
||||
int offs, sx, sy, flipx, flipy;
|
||||
|
||||
for (offs = 0; offs < state->m_spriteram.bytes() - 4; offs += 4)
|
||||
for (offs = 0; offs < m_spriteram.bytes() - 4; offs += 4)
|
||||
{
|
||||
//if y position is in the current strip
|
||||
if (state->m_spriteram[offs + 1] && (((state->m_spriteram[offs] + (state->m_flipscreen ? 2 : 0)) & 0xf0) == (0x0f - offs / 0x80) << 4))
|
||||
if (m_spriteram[offs + 1] && (((m_spriteram[offs] + (m_flipscreen ? 2 : 0)) & 0xf0) == (0x0f - offs / 0x80) << 4))
|
||||
{
|
||||
//offs y pos
|
||||
//offs+1 sprite number
|
||||
@ -207,12 +206,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const r
|
||||
//----xxxx colour
|
||||
//offs+3 x pos
|
||||
|
||||
sx = state->m_spriteram[offs + 3];
|
||||
sy = 240 - state->m_spriteram[offs];
|
||||
flipx = (state->m_spriteram[offs + 2] & 0x40) >> 6;
|
||||
flipy = (state->m_spriteram[offs + 2] & 0x80) >> 7;
|
||||
sx = m_spriteram[offs + 3];
|
||||
sy = 240 - m_spriteram[offs];
|
||||
flipx = (m_spriteram[offs + 2] & 0x40) >> 6;
|
||||
flipy = (m_spriteram[offs + 2] & 0x80) >> 7;
|
||||
|
||||
if (state->m_flipscreen)
|
||||
if (m_flipscreen)
|
||||
{
|
||||
sx = 248 - sx;
|
||||
sy = 242 - sy;
|
||||
@ -220,9 +219,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const r
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
|
||||
state->m_spriteram[offs + 1],
|
||||
(state->m_spriteram[offs + 2] & 0x0f),
|
||||
drawgfx_transpen(bitmap, cliprect, machine().gfx[1],
|
||||
m_spriteram[offs + 1],
|
||||
(m_spriteram[offs + 2] & 0x0f),
|
||||
flipx,flipy,
|
||||
sx,sy,0);
|
||||
}
|
||||
@ -245,7 +244,7 @@ UINT32 popper_state::screen_update_popper(screen_device &screen, bitmap_ind16 &b
|
||||
m_ol_p123_tilemap->draw(bitmap, finalclip, TILEMAP_DRAW_LAYER1, 0);
|
||||
m_ol_p0_tilemap->draw(bitmap, finalclip, TILEMAP_DRAW_LAYER1, 0);
|
||||
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
|
||||
m_p123_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
|
||||
m_p0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
|
||||
|
@ -21,7 +21,7 @@ WRITE8_MEMBER(portrait_state::portrait_fgvideo_write)
|
||||
m_fgvideoram[offset] = data;
|
||||
}
|
||||
|
||||
INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, const UINT8 *source )
|
||||
inline void portrait_state::get_tile_info( tile_data &tileinfo, int tile_index, const UINT8 *source )
|
||||
{
|
||||
int attr = source[tile_index*2+0];
|
||||
int tilenum = source[tile_index*2+1];
|
||||
@ -49,17 +49,17 @@ INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int ti
|
||||
else
|
||||
color = ((tilenum&0xff)>>1)+0x80;
|
||||
|
||||
SET_TILE_INFO( 0, tilenum, color, flags );
|
||||
SET_TILE_INFO_MEMBER( 0, tilenum, color, flags );
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(portrait_state::get_bg_tile_info)
|
||||
{
|
||||
get_tile_info( machine(), tileinfo, tile_index, m_bgvideoram );
|
||||
get_tile_info(tileinfo, tile_index, m_bgvideoram );
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(portrait_state::get_fg_tile_info)
|
||||
{
|
||||
get_tile_info( machine(), tileinfo, tile_index, m_fgvideoram );
|
||||
get_tile_info(tileinfo, tile_index, m_fgvideoram );
|
||||
}
|
||||
|
||||
void portrait_state::video_start()
|
||||
@ -125,10 +125,9 @@ void portrait_state::palette_init()
|
||||
}
|
||||
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void portrait_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
portrait_state *state = machine.driver_data<portrait_state>();
|
||||
UINT8 *source = state->m_spriteram;
|
||||
UINT8 *source = m_spriteram;
|
||||
UINT8 *finish = source + 0x200;
|
||||
|
||||
while( source < finish )
|
||||
@ -151,7 +150,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
|
||||
if(attr & 0x08) sy |= 0x100;
|
||||
|
||||
sx += (source - state->m_spriteram) - 8;
|
||||
sx += (source - m_spriteram) - 8;
|
||||
sx &= 0x1ff;
|
||||
|
||||
sy = (512 - 64) - sy;
|
||||
@ -163,11 +162,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
break;
|
||||
|
||||
case 0x40:
|
||||
sy -= state->m_scroll;
|
||||
sy -= m_scroll;
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
sy -= state->m_scroll;
|
||||
sy -= m_scroll;
|
||||
break;
|
||||
|
||||
case 0xc0:
|
||||
@ -175,7 +174,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
tilenum,color,
|
||||
0,fy,
|
||||
sx,sy,7);
|
||||
@ -203,6 +202,6 @@ UINT32 portrait_state::screen_update_portrait(screen_device &screen, bitmap_ind1
|
||||
m_background->draw(bitmap, cliprect_scroll, 0, 0);
|
||||
m_foreground->draw(bitmap, cliprect_scroll, 0, 0);
|
||||
|
||||
draw_sprites(machine(), bitmap,cliprect);
|
||||
draw_sprites(bitmap,cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -248,14 +248,13 @@ Offset: Format: Value:
|
||||
#define SIGN_EXTEND_POS(_var_) {_var_ &= 0x3ff; if (_var_ > 0x1ff) _var_ -= 0x400;}
|
||||
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
|
||||
void powerins_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
|
||||
{
|
||||
powerins_state *state = machine.driver_data<powerins_state>();
|
||||
UINT16 *source = state->m_spriteram + 0x8000/2;
|
||||
UINT16 *finish = state->m_spriteram + 0x9000/2;
|
||||
UINT16 *source = m_spriteram + 0x8000/2;
|
||||
UINT16 *finish = m_spriteram + 0x9000/2;
|
||||
|
||||
int screen_w = machine.primary_screen->width();
|
||||
int screen_h = machine.primary_screen->height();
|
||||
int screen_w = machine().primary_screen->width();
|
||||
int screen_h = machine().primary_screen->height();
|
||||
|
||||
for ( ; source < finish; source += 16/2 )
|
||||
{
|
||||
@ -281,7 +280,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
|
||||
|
||||
/* Handle flip_screen. Apply a global offset of 32 pixels along x too */
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx = screen_w - sx - dimx*16 - 32; flipx = !flipx;
|
||||
sy = screen_h - sy - dimy*16; flipy = !flipy;
|
||||
@ -298,7 +297,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
|
||||
{
|
||||
for (y = 0 ; y < dimy ; y++)
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
|
||||
code,
|
||||
color,
|
||||
flipx, flipy,
|
||||
@ -353,7 +352,7 @@ if (machine().input().code_pressed(KEYCODE_Z))
|
||||
|
||||
if (layers_ctrl&1) m_tilemap_0->draw(bitmap, cliprect, 0, 0);
|
||||
else bitmap.fill(0, cliprect);
|
||||
if (layers_ctrl&8) draw_sprites(machine(),bitmap,cliprect);
|
||||
if (layers_ctrl&8) draw_sprites(bitmap,cliprect);
|
||||
if (layers_ctrl&2) m_tilemap_1->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -117,10 +117,9 @@ o fedcba9876543210
|
||||
|
||||
3 xxxx............ color+priority, other bits unknown
|
||||
*/
|
||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int foreground )
|
||||
void prehisle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int foreground )
|
||||
{
|
||||
prehisle_state *state = machine.driver_data<prehisle_state>();
|
||||
UINT16 *spriteram16 = state->m_spriteram;
|
||||
UINT16 *spriteram16 = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < 1024; offs += 4)
|
||||
@ -138,7 +137,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
if (sx&0x100) sx=-0x100+(sx&0xff);
|
||||
if (sy&0x100) sy=-0x100+(sy&0xff);
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
@ -148,7 +147,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
|
||||
if ((foreground && priority) || (!foreground && !priority))
|
||||
{
|
||||
drawgfx_transpen(bitmap, cliprect, machine.gfx[3], code, color, flipx, flipy, sx, sy, 15);
|
||||
drawgfx_transpen(bitmap, cliprect, machine().gfx[3], code, color, flipx, flipy, sx, sy, 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,9 +155,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
|
||||
UINT32 prehisle_state::screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect, 0);
|
||||
draw_sprites(bitmap, cliprect, 0);
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect, 1);
|
||||
draw_sprites(bitmap, cliprect, 1);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -132,25 +132,24 @@ WRITE32_MEMBER(psikyo_state::psikyo_vram_1_w)
|
||||
}
|
||||
}
|
||||
|
||||
void psikyo_switch_banks( running_machine &machine, int tmap, int bank )
|
||||
void psikyo_state::psikyo_switch_banks( int tmap, int bank )
|
||||
{
|
||||
psikyo_state *state = machine.driver_data<psikyo_state>();
|
||||
|
||||
if ((tmap == 0) && (bank != state->m_tilemap_0_bank))
|
||||
if ((tmap == 0) && (bank != m_tilemap_0_bank))
|
||||
{
|
||||
state->m_tilemap_0_bank = bank;
|
||||
state->m_tilemap_0_size0->mark_all_dirty();
|
||||
state->m_tilemap_0_size1->mark_all_dirty();
|
||||
state->m_tilemap_0_size2->mark_all_dirty();
|
||||
state->m_tilemap_0_size3->mark_all_dirty();
|
||||
m_tilemap_0_bank = bank;
|
||||
m_tilemap_0_size0->mark_all_dirty();
|
||||
m_tilemap_0_size1->mark_all_dirty();
|
||||
m_tilemap_0_size2->mark_all_dirty();
|
||||
m_tilemap_0_size3->mark_all_dirty();
|
||||
}
|
||||
else if ((tmap == 1) && (bank != state->m_tilemap_1_bank))
|
||||
else if ((tmap == 1) && (bank != m_tilemap_1_bank))
|
||||
{
|
||||
state->m_tilemap_1_bank = bank;
|
||||
state->m_tilemap_1_size0->mark_all_dirty();
|
||||
state->m_tilemap_1_size1->mark_all_dirty();
|
||||
state->m_tilemap_1_size2->mark_all_dirty();
|
||||
state->m_tilemap_1_size3->mark_all_dirty();
|
||||
m_tilemap_1_bank = bank;
|
||||
m_tilemap_1_size0->mark_all_dirty();
|
||||
m_tilemap_1_size1->mark_all_dirty();
|
||||
m_tilemap_1_size2->mark_all_dirty();
|
||||
m_tilemap_1_size3->mark_all_dirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,8 +204,8 @@ VIDEO_START_MEMBER(psikyo_state,sngkace)
|
||||
{
|
||||
VIDEO_START_CALL_MEMBER( psikyo );
|
||||
|
||||
psikyo_switch_banks(machine(), 0, 0); // sngkace / samuraia don't use banking
|
||||
psikyo_switch_banks(machine(), 1, 1); // They share "gfx2" to save memory on other boards
|
||||
psikyo_switch_banks(0, 0); // sngkace / samuraia don't use banking
|
||||
psikyo_switch_banks(1, 1); // They share "gfx2" to save memory on other boards
|
||||
}
|
||||
|
||||
|
||||
@ -255,19 +254,18 @@ Note: Not all sprites are displayed: in the top part of spriteram
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int trans_pen )
|
||||
void psikyo_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int trans_pen )
|
||||
{
|
||||
psikyo_state *state = machine.driver_data<psikyo_state>();
|
||||
|
||||
/* tile layers 0 & 1 have priorities 1 & 2 */
|
||||
static const int pri[] = { 0, 0xfc, 0xff, 0xff };
|
||||
int offs;
|
||||
UINT16 *spritelist = (UINT16 *)(state->m_spritebuf2 + 0x1800 / 4);
|
||||
UINT8 *TILES = machine.root_device().memregion("spritelut")->base(); // Sprites LUT
|
||||
int TILES_LEN = machine.root_device().memregion("spritelut")->bytes();
|
||||
UINT16 *spritelist = (UINT16 *)(m_spritebuf2 + 0x1800 / 4);
|
||||
UINT8 *TILES = machine().root_device().memregion("spritelut")->base(); // Sprites LUT
|
||||
int TILES_LEN = machine().root_device().memregion("spritelut")->bytes();
|
||||
|
||||
int width = machine.primary_screen->width();
|
||||
int height = machine.primary_screen->height();
|
||||
int width = machine().primary_screen->width();
|
||||
int height = machine().primary_screen->height();
|
||||
|
||||
/* Exit if sprites are disabled */
|
||||
if (spritelist[BYTE_XOR_BE((0x800 - 2) / 2)] & 1) return;
|
||||
@ -295,7 +293,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
sprite = spritelist[BYTE_XOR_BE(offs)];
|
||||
|
||||
sprite %= 0x300;
|
||||
source = &state->m_spritebuf2[sprite * 8 / 4];
|
||||
source = &m_spritebuf2[sprite * 8 / 4];
|
||||
|
||||
/* Draw this sprite */
|
||||
|
||||
@ -326,7 +324,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
zoomx = 32 - zoomx;
|
||||
zoomy = 32 - zoomy;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
x = width - x - (nx * zoomx) / 2;
|
||||
y = height - y - (ny * zoomy) / 2;
|
||||
@ -347,21 +345,21 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
int addr = (code * 2) & (TILES_LEN - 1);
|
||||
|
||||
if (zoomx == 32 && zoomy == 32)
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
TILES[addr+1] * 256 + TILES[addr],
|
||||
attr >> 8,
|
||||
flipx, flipy,
|
||||
x + dx * 16, y + dy * 16,
|
||||
machine.priority_bitmap,
|
||||
machine().priority_bitmap,
|
||||
pri[(attr & 0xc0) >> 6],trans_pen);
|
||||
else
|
||||
pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
TILES[addr+1] * 256 + TILES[addr],
|
||||
attr >> 8,
|
||||
flipx, flipy,
|
||||
x + (dx * zoomx) / 2, y + (dy * zoomy) / 2,
|
||||
zoomx << 11,zoomy << 11,
|
||||
machine.priority_bitmap,pri[(attr & 0xc0) >> 6],trans_pen);
|
||||
machine().priority_bitmap,pri[(attr & 0xc0) >> 6],trans_pen);
|
||||
|
||||
code++;
|
||||
}
|
||||
@ -374,19 +372,18 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
// until I work out why it makes a partial copy of the sprite list, and how best to apply it
|
||||
// sprite placement of the explosion graphic seems incorrect compared to the original sets? (no / different zoom support?)
|
||||
// it might be a problem with the actual bootleg
|
||||
static void draw_sprites_bootleg( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int trans_pen )
|
||||
void psikyo_state::draw_sprites_bootleg( bitmap_ind16 &bitmap, const rectangle &cliprect, int trans_pen )
|
||||
{
|
||||
psikyo_state *state = machine.driver_data<psikyo_state>();
|
||||
|
||||
/* tile layers 0 & 1 have priorities 1 & 2 */
|
||||
static const int pri[] = { 0, 0xfc, 0xff, 0xff };
|
||||
int offs;
|
||||
UINT16 *spritelist = (UINT16 *)(state->m_spritebuf2 + 0x1800 / 4);
|
||||
UINT8 *TILES = machine.root_device().memregion("spritelut")->base(); // Sprites LUT
|
||||
int TILES_LEN = machine.root_device().memregion("spritelut")->bytes();
|
||||
UINT16 *spritelist = (UINT16 *)(m_spritebuf2 + 0x1800 / 4);
|
||||
UINT8 *TILES = machine().root_device().memregion("spritelut")->base(); // Sprites LUT
|
||||
int TILES_LEN = machine().root_device().memregion("spritelut")->bytes();
|
||||
|
||||
int width = machine.primary_screen->width();
|
||||
int height = machine.primary_screen->height();
|
||||
int width = machine().primary_screen->width();
|
||||
int height = machine().primary_screen->height();
|
||||
|
||||
/* Exit if sprites are disabled */
|
||||
if (spritelist[BYTE_XOR_BE((0x800 - 2) / 2)] & 1)
|
||||
@ -415,7 +412,7 @@ static void draw_sprites_bootleg( running_machine &machine, bitmap_ind16 &bitmap
|
||||
sprite = spritelist[BYTE_XOR_BE(offs)];
|
||||
|
||||
sprite %= 0x300;
|
||||
source = &state->m_spritebuf2[sprite * 8 / 4];
|
||||
source = &m_spritebuf2[sprite * 8 / 4];
|
||||
|
||||
/* Draw this sprite */
|
||||
|
||||
@ -447,7 +444,7 @@ static void draw_sprites_bootleg( running_machine &machine, bitmap_ind16 &bitmap
|
||||
zoomy = 32 - zoomy;
|
||||
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
x = width - x - (nx * zoomx) / 2;
|
||||
y = height - y - (ny * zoomy) / 2;
|
||||
@ -468,21 +465,21 @@ static void draw_sprites_bootleg( running_machine &machine, bitmap_ind16 &bitmap
|
||||
int addr = (code * 2) & (TILES_LEN-1);
|
||||
|
||||
if (zoomx == 32 && zoomy == 32)
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
TILES[addr+1] * 256 + TILES[addr],
|
||||
attr >> 8,
|
||||
flipx, flipy,
|
||||
x + dx * 16, y + dy * 16,
|
||||
machine.priority_bitmap,
|
||||
machine().priority_bitmap,
|
||||
pri[(attr & 0xc0) >> 6],trans_pen);
|
||||
else
|
||||
pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0],
|
||||
pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0],
|
||||
TILES[addr+1] * 256 + TILES[addr],
|
||||
attr >> 8,
|
||||
flipx, flipy,
|
||||
x + (dx * zoomx) / 2, y + (dy * zoomy) / 2,
|
||||
zoomx << 11,zoomy << 11,
|
||||
machine.priority_bitmap,pri[(attr & 0xc0) >> 6],trans_pen);
|
||||
machine().priority_bitmap,pri[(attr & 0xc0) >> 6],trans_pen);
|
||||
|
||||
code++;
|
||||
}
|
||||
@ -500,7 +497,7 @@ static void draw_sprites_bootleg( running_machine &machine, bitmap_ind16 &bitmap
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static int tilemap_width( int size )
|
||||
int psikyo_state::tilemap_width( int size )
|
||||
{
|
||||
if (size == 0)
|
||||
return 0x80 * 16;
|
||||
@ -561,8 +558,8 @@ UINT32 psikyo_state::screen_update_psikyo(screen_device &screen, bitmap_ind16 &b
|
||||
/* For gfx banking for s1945jn/gunbird/btlkroad */
|
||||
if (m_ka302c_banking)
|
||||
{
|
||||
psikyo_switch_banks(machine(), 0, (layer0_ctrl & 0x400) >> 10);
|
||||
psikyo_switch_banks(machine(), 1, (layer1_ctrl & 0x400) >> 10);
|
||||
psikyo_switch_banks(0, (layer0_ctrl & 0x400) >> 10);
|
||||
psikyo_switch_banks(1, (layer1_ctrl & 0x400) >> 10);
|
||||
}
|
||||
|
||||
switch ((layer0_ctrl & 0x00c0) >> 6)
|
||||
@ -672,7 +669,7 @@ UINT32 psikyo_state::screen_update_psikyo(screen_device &screen, bitmap_ind16 &b
|
||||
tmptilemap1->draw(bitmap, cliprect, layer1_ctrl & 2 ? TILEMAP_DRAW_OPAQUE : 0, 2);
|
||||
|
||||
if (layers_ctrl & 4)
|
||||
draw_sprites(machine(), bitmap, cliprect, (spr_ctrl & 4 ? 0 : 15));
|
||||
draw_sprites(bitmap, cliprect, (spr_ctrl & 4 ? 0 : 15));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -734,8 +731,8 @@ UINT32 psikyo_state::screen_update_psikyo_bootleg(screen_device &screen, bitmap_
|
||||
/* For gfx banking for s1945jn/gunbird/btlkroad */
|
||||
if (m_ka302c_banking)
|
||||
{
|
||||
psikyo_switch_banks(machine(), 0, (layer0_ctrl & 0x400) >> 10);
|
||||
psikyo_switch_banks(machine(), 1, (layer1_ctrl & 0x400) >> 10);
|
||||
psikyo_switch_banks(0, (layer0_ctrl & 0x400) >> 10);
|
||||
psikyo_switch_banks(1, (layer1_ctrl & 0x400) >> 10);
|
||||
}
|
||||
|
||||
switch ((layer0_ctrl & 0x00c0) >> 6)
|
||||
@ -845,7 +842,7 @@ UINT32 psikyo_state::screen_update_psikyo_bootleg(screen_device &screen, bitmap_
|
||||
tmptilemap1->draw(bitmap, cliprect, layer1_ctrl & 2 ? TILEMAP_DRAW_OPAQUE : 0, 2);
|
||||
|
||||
if (layers_ctrl & 4)
|
||||
draw_sprites_bootleg(machine(), bitmap, cliprect, (spr_ctrl & 4 ? 0 : 15));
|
||||
draw_sprites_bootleg(bitmap, cliprect, (spr_ctrl & 4 ? 0 : 15));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ HgKairak: 86010000 1f201918 a0000000 Large Screen
|
||||
|
||||
|
||||
/* --- SPRITES --- */
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 scr )
|
||||
void psikyo4_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 scr )
|
||||
{
|
||||
/*- Sprite Format 0x0000 - 0x2bff -**
|
||||
|
||||
@ -52,15 +52,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
|
||||
**- End Sprite Format -*/
|
||||
|
||||
psikyo4_state *state = machine.driver_data<psikyo4_state>();
|
||||
gfx_element *gfx = machine.gfx[0];
|
||||
UINT32 *source = state->m_spriteram;
|
||||
UINT16 *list = (UINT16 *)state->m_spriteram.target() + 0x2c00/2 + 0x04/2; /* 0x2c00/0x2c02 what are these for, pointers? one for each screen */
|
||||
gfx_element *gfx = machine().gfx[0];
|
||||
UINT32 *source = m_spriteram;
|
||||
UINT16 *list = (UINT16 *)m_spriteram.target() + 0x2c00/2 + 0x04/2; /* 0x2c00/0x2c02 what are these for, pointers? one for each screen */
|
||||
UINT16 listlen = (0xc00/2 - 0x04/2), listcntr = 0;
|
||||
int flipscreen1, flipscreen2;
|
||||
|
||||
flipscreen1 = (((state->m_vidregs[1] >> 30) & 2) == 2) ? 1 : 0;
|
||||
flipscreen2 = (((state->m_vidregs[1] >> 22) & 2) == 2) ? 1 : 0;
|
||||
flipscreen1 = (((m_vidregs[1] >> 30) & 2) == 2) ? 1 : 0;
|
||||
flipscreen2 = (((m_vidregs[1] >> 22) & 2) == 2) ? 1 : 0;
|
||||
|
||||
while (listcntr < listlen)
|
||||
{
|
||||
@ -99,7 +98,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
|
||||
if ((!scr && flipscreen1) || (scr && flipscreen2))
|
||||
{
|
||||
ypos = machine.primary_screen->visible_area().max_y + 1 - ypos - high * 16; /* Screen Height depends on game */
|
||||
ypos = machine().primary_screen->visible_area().max_y + 1 - ypos - high * 16; /* Screen Height depends on game */
|
||||
xpos = 40 * 8 - xpos - wide * 16;
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
@ -130,14 +129,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
UINT32 psikyo4_state::screen_update_psikyo4_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(0x1000, cliprect);
|
||||
draw_sprites(machine(), bitmap, cliprect, 0x0000);
|
||||
draw_sprites(bitmap, cliprect, 0x0000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 psikyo4_state::screen_update_psikyo4_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(0x1001, cliprect);
|
||||
draw_sprites(machine(), bitmap, cliprect, 0x2000);
|
||||
draw_sprites(bitmap, cliprect, 0x2000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ while (0)
|
||||
draw_scanline32_alpha - take an RGB-encoded UINT32
|
||||
scanline and alpha-blend it into the destination bitmap
|
||||
-------------------------------------------------*/
|
||||
static void draw_scanline32_alpha(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, int alpha)
|
||||
void psikyosh_state::draw_scanline32_alpha(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, int alpha)
|
||||
{
|
||||
DECLARE_NO_PRIORITY;
|
||||
UINT32 transpen = BG_TRANSPEN;
|
||||
@ -152,7 +152,7 @@ static void draw_scanline32_alpha(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty
|
||||
draw_scanline32_argb - take an ARGB-encoded UINT32
|
||||
scanline and alpha-blend it into the destination bitmap
|
||||
-------------------------------------------------*/
|
||||
static void draw_scanline32_argb(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
|
||||
void psikyosh_state::draw_scanline32_argb(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
|
||||
{
|
||||
DECLARE_NO_PRIORITY;
|
||||
UINT32 transpen = BG_TRANSPEN;
|
||||
@ -164,7 +164,7 @@ static void draw_scanline32_argb(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty,
|
||||
draw_scanline32_tranpens - take an RGB-encoded UINT32
|
||||
scanline and copy it into the destination bitmap, testing for the special ARGB transpen
|
||||
-------------------------------------------------*/
|
||||
static void draw_scanline32_transpen(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
|
||||
void psikyosh_state::draw_scanline32_transpen(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
|
||||
{
|
||||
DECLARE_NO_PRIORITY;
|
||||
UINT32 transpen = BG_TRANSPEN;
|
||||
@ -261,29 +261,28 @@ static void drawgfx_alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, gf
|
||||
|
||||
/* 'Normal' layers, no line/columnscroll. No per-line effects.
|
||||
Zooming isn't supported just because it's not used and it would be slow */
|
||||
static void draw_bglayer( running_machine &machine, int layer, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
void psikyosh_state::draw_bglayer( int layer, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
{
|
||||
psikyosh_state *state = machine.driver_data<psikyosh_state>();
|
||||
gfx_element *gfx;
|
||||
int offs = 0, sx, sy;
|
||||
int scrollx, scrolly, regbank, tilebank, alpha, alphamap, zoom, pri, size, width;
|
||||
|
||||
assert(!BG_LINE(layer));
|
||||
|
||||
gfx = BG_DEPTH_8BPP(layer) ? machine.gfx[1] : machine.gfx[0];
|
||||
gfx = BG_DEPTH_8BPP(layer) ? machine().gfx[1] : machine().gfx[0];
|
||||
size = BG_LARGE(layer) ? 32 : 16;
|
||||
width = 16 * size;
|
||||
|
||||
regbank = BG_TYPE(layer);
|
||||
|
||||
scrollx = (state->m_bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000001ff) >> 0;
|
||||
scrolly = (state->m_bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x03ff0000) >> 16;
|
||||
scrollx = (m_bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000001ff) >> 0;
|
||||
scrolly = (m_bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x03ff0000) >> 16;
|
||||
|
||||
tilebank = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000000ff) >> 0;
|
||||
alpha = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00003f00) >> 8;
|
||||
alphamap = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00008000) >> 15;
|
||||
zoom = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00ff0000) >> 16;
|
||||
pri = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0xff000000) >> 24;
|
||||
tilebank = (m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000000ff) >> 0;
|
||||
alpha = (m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00003f00) >> 8;
|
||||
alphamap = (m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00008000) >> 15;
|
||||
zoom = (m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00ff0000) >> 16;
|
||||
pri = (m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0xff000000) >> 24;
|
||||
|
||||
if(pri != req_pri) return;
|
||||
|
||||
@ -304,8 +303,8 @@ static void draw_bglayer( running_machine &machine, int layer, bitmap_rgb32 &bit
|
||||
{
|
||||
int tileno, colour;
|
||||
|
||||
tileno = (state->m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */
|
||||
colour = (state->m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
|
||||
tileno = (m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */
|
||||
colour = (m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
|
||||
|
||||
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, (16 * sx + scrollx) & 0x1ff, ((16 * sy + scrolly) & (width - 1)), alpha); /* normal */
|
||||
|
||||
@ -324,7 +323,7 @@ static void draw_bglayer( running_machine &machine, int layer, bitmap_rgb32 &bit
|
||||
|
||||
|
||||
/* populate bg_bitmap for the given bank if it's not already */
|
||||
static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx, int size, int tilebank, int alpha, int *last_bank)
|
||||
void psikyosh_state::cache_bitmap(int scanline, gfx_element *gfx, int size, int tilebank, int alpha, int *last_bank)
|
||||
{
|
||||
// test if the tile row is the cached one or not
|
||||
int sy = scanline / 16;
|
||||
@ -335,9 +334,9 @@ static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx,
|
||||
{
|
||||
rectangle cliprect;
|
||||
|
||||
cliprect.set(0, state->m_bg_bitmap.width() - 1, sy * 16, cliprect.min_y + 16 - 1);
|
||||
cliprect.set(0, m_bg_bitmap.width() - 1, sy * 16, cliprect.min_y + 16 - 1);
|
||||
|
||||
state->m_bg_bitmap.fill(BG_TRANSPEN, cliprect);
|
||||
m_bg_bitmap.fill(BG_TRANSPEN, cliprect);
|
||||
int width = size * 16;
|
||||
|
||||
int offs = size * sy;
|
||||
@ -347,12 +346,12 @@ static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx,
|
||||
{
|
||||
int tileno, colour;
|
||||
|
||||
tileno = (state->m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */
|
||||
colour = (state->m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
|
||||
tileno = (m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */
|
||||
colour = (m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
|
||||
int need_alpha = alpha < 0 ? -1 : 0xff; // store per-pen alpha in bitmap, otherwise don't since we'll need it per-line
|
||||
|
||||
if(tileno) { // valid tile, but blank in all games?
|
||||
drawgfx_alphastore(state->m_bg_bitmap, state->m_bg_bitmap.cliprect(), gfx, tileno, colour, 0, 0, (16 * sx) & 0x1ff, ((16 * sy) & (width - 1)), need_alpha);
|
||||
drawgfx_alphastore(m_bg_bitmap, m_bg_bitmap.cliprect(), gfx, tileno, colour, 0, 0, (16 * sx) & 0x1ff, ((16 * sy) & (width - 1)), need_alpha);
|
||||
}
|
||||
|
||||
offs++;
|
||||
@ -366,25 +365,24 @@ static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx,
|
||||
Bitmap is first rendered to an ARGB image, taking into account the per-pen alpha (if used).
|
||||
From there we extract data as we compose the image, one scanline at a time, blending the ARGB pixels
|
||||
into the RGB32 bitmap (with either the alpha information from the ARGB, or per-line alpha */
|
||||
static void draw_bglayerscroll( running_machine &machine, int layer, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
void psikyosh_state::draw_bglayerscroll( int layer, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
{
|
||||
psikyosh_state *state = machine.driver_data<psikyosh_state>();
|
||||
assert(BG_LINE(layer));
|
||||
|
||||
gfx_element *gfx = BG_DEPTH_8BPP(layer) ? machine.gfx[1] : machine.gfx[0];
|
||||
gfx_element *gfx = BG_DEPTH_8BPP(layer) ? machine().gfx[1] : machine().gfx[0];
|
||||
int size = BG_LARGE(layer) ? 32 : 16;
|
||||
int width = size * 16;
|
||||
|
||||
int linebank = BG_TYPE(layer);
|
||||
|
||||
/* cache rendered bitmap */
|
||||
int last_bank[32]; // corresponds to bank of bitmap in state->m_bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each
|
||||
int last_bank[32]; // corresponds to bank of bitmap in m_bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each
|
||||
for(int ii = 0; ii < 32; ii++) last_bank[ii] = -1;
|
||||
|
||||
int scr_width = cliprect.width();
|
||||
int scr_height = cliprect.height();
|
||||
UINT32 *scroll_reg = &state->m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4];
|
||||
UINT32 *pzab_reg = &state->m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4]; // pri, zoom, alpha, bank
|
||||
UINT32 *scroll_reg = &m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4];
|
||||
UINT32 *pzab_reg = &m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4]; // pri, zoom, alpha, bank
|
||||
|
||||
// now, for each scanline, check priority,
|
||||
// extract the relevant scanline from the bitmap, after applying per-scanline vscroll,
|
||||
@ -414,19 +412,19 @@ static void draw_bglayerscroll( running_machine &machine, int layer, bitmap_rgb3
|
||||
int tilemap_scanline = (scanline - scrolly + 0x400) % 0x200;
|
||||
|
||||
// render reelvant tiles to temp bitmap, assume bank changes infrequently/never. render alpha as per-pen
|
||||
cache_bitmap(tilemap_scanline, state, gfx, size, tilebank, alpha, last_bank);
|
||||
cache_bitmap(tilemap_scanline, gfx, size, tilebank, alpha, last_bank);
|
||||
|
||||
/* zoomy and 'wibbly' effects - extract an entire row from tilemap */
|
||||
g_profiler.start(PROFILER_USER2);
|
||||
UINT32 tilemap_line[32 * 16];
|
||||
UINT32 scr_line[64 * 8];
|
||||
extract_scanline32(state->m_bg_bitmap, 0, tilemap_scanline, width, tilemap_line);
|
||||
extract_scanline32(m_bg_bitmap, 0, tilemap_scanline, width, tilemap_line);
|
||||
g_profiler.stop();
|
||||
|
||||
/* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */
|
||||
g_profiler.start(PROFILER_USER3);
|
||||
if(zoom) {
|
||||
int step = state->m_bg_zoom[zoom];
|
||||
int step = m_bg_zoom[zoom];
|
||||
int jj = 0x400 << 10; // ensure +ve for mod
|
||||
for(int ii = 0; ii < scr_width; ii++) {
|
||||
scr_line[ii] = tilemap_line[((jj>>10) - scrollx) % width];
|
||||
@ -461,9 +459,8 @@ static void draw_bglayerscroll( running_machine &machine, int layer, bitmap_rgb3
|
||||
}
|
||||
|
||||
/* 3 BG layers, with priority */
|
||||
static void draw_background( running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
void psikyosh_state::draw_background( bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
{
|
||||
psikyosh_state *state = machine.driver_data<psikyosh_state>();
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG_KEYS
|
||||
@ -471,7 +468,7 @@ static void draw_background( running_machine &machine, bitmap_rgb32 &bitmap, con
|
||||
bool lay_debug = false;
|
||||
for (i = 0; i <= 3; i++)
|
||||
{
|
||||
if(machine.input().code_pressed(lay_keys[i])) {
|
||||
if(machine().input().code_pressed(lay_keys[i])) {
|
||||
lay_debug = true;
|
||||
}
|
||||
}
|
||||
@ -481,7 +478,7 @@ static void draw_background( running_machine &machine, bitmap_rgb32 &bitmap, con
|
||||
for (i = 0; i <= 3; i++)
|
||||
{
|
||||
#ifdef DEBUG_KEYS
|
||||
if(lay_debug && !machine.input().code_pressed(lay_keys[i]))
|
||||
if(lay_debug && !machine().input().code_pressed(lay_keys[i]))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
@ -490,11 +487,11 @@ static void draw_background( running_machine &machine, bitmap_rgb32 &bitmap, con
|
||||
|
||||
if(BG_LINE(i)) {
|
||||
/* per-line alpha, scroll, zoom etc. check the priority for the first scanline */
|
||||
draw_bglayerscroll(machine, i, bitmap, cliprect, req_pri);
|
||||
draw_bglayerscroll(i, bitmap, cliprect, req_pri);
|
||||
}
|
||||
else {
|
||||
/* not per-line alpha, scroll, zoom etc. */
|
||||
draw_bglayer(machine, i, bitmap, cliprect, req_pri);
|
||||
draw_bglayer(i, bitmap, cliprect, req_pri);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -508,13 +505,11 @@ static void draw_background( running_machine &machine, bitmap_rgb32 &bitmap, con
|
||||
/* sx and sy is top-left of entire sprite regardless of flip */
|
||||
/* Note that Level 5-4 of sbomberb boss is perfect! (Alpha blended zoomed) as well as S1945II logo */
|
||||
/* pixel is only plotted if z is >= priority_buffer[y][x] */
|
||||
static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||
void psikyosh_state:: psikyosh_drawgfxzoom( bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
|
||||
UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
|
||||
int alpha, int zoomx, int zoomy, int wide, int high, UINT32 z)
|
||||
{
|
||||
psikyosh_state *state = machine.driver_data<psikyosh_state>();
|
||||
UINT8 *alphatable = state->m_alphatable;
|
||||
UINT8 *alphatable = m_alphatable;
|
||||
rectangle myclip; /* Clip to screen boundaries */
|
||||
int code_offset = 0;
|
||||
int xtile, ytile, xpixel, ypixel;
|
||||
@ -602,7 +597,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
const UINT8 *source = code_base + (y_index) * gfx->rowbytes() + x_index_base;
|
||||
UINT32 *dest = &dest_bmp.pix32(sy, sx);
|
||||
UINT16 *pri = &state->m_z_bitmap.pix16(sy, sx);
|
||||
UINT16 *pri = &m_z_bitmap.pix16(sy, sx);
|
||||
int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
|
||||
int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
|
||||
|
||||
@ -661,7 +656,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
const UINT8 *source = code_base + y_index * gfx->rowbytes() + x_index_base;
|
||||
UINT32 *dest = &dest_bmp.pix32(sy, sx);
|
||||
UINT16 *pri = &state->m_z_bitmap.pix16(sy, sx);
|
||||
UINT16 *pri = &m_z_bitmap.pix16(sy, sx);
|
||||
int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
|
||||
int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
|
||||
|
||||
@ -721,7 +716,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
const UINT8 *source = code_base + y_index * gfx->rowbytes() + x_index_base;
|
||||
UINT32 *dest = &dest_bmp.pix32(sy, sx);
|
||||
UINT16 *pri = &state->m_z_bitmap.pix16(sy, sx);
|
||||
UINT16 *pri = &m_z_bitmap.pix16(sy, sx);
|
||||
int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
|
||||
int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
|
||||
|
||||
@ -798,7 +793,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
for (ypixel = 0; ypixel < gfx->height(); ypixel++)
|
||||
{
|
||||
const UINT8 *source = code_base + ypixel * gfx->rowbytes();
|
||||
UINT8 *dest = &state->m_zoom_bitmap.pix8(ypixel + ytile*gfx->height());
|
||||
UINT8 *dest = &m_zoom_bitmap.pix8(ypixel + ytile*gfx->height());
|
||||
|
||||
for (xpixel = 0; xpixel < gfx->width(); xpixel++)
|
||||
{
|
||||
@ -873,9 +868,9 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
for (y = sy; y < ey; y++)
|
||||
{
|
||||
UINT8 *source = &state->m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT8 *source = &m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
UINT16 *pri = &state->m_z_bitmap.pix16(y);
|
||||
UINT16 *pri = &m_z_bitmap.pix16(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
@ -899,7 +894,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
for (y = sy; y < ey; y++)
|
||||
{
|
||||
UINT8 *source = &state->m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT8 *source = &m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
@ -923,9 +918,9 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
for (y = sy; y < ey; y++)
|
||||
{
|
||||
UINT8 *source = &state->m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT8 *source = &m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
UINT16 *pri = &state->m_z_bitmap.pix16(y);
|
||||
UINT16 *pri = &m_z_bitmap.pix16(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
@ -949,7 +944,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
for (y = sy; y < ey; y++)
|
||||
{
|
||||
UINT8 *source = &state->m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT8 *source = &m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
@ -972,9 +967,9 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
for (y = sy; y < ey; y++)
|
||||
{
|
||||
UINT8 *source = &state->m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT8 *source = &m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
UINT16 *pri = &state->m_z_bitmap.pix16(y);
|
||||
UINT16 *pri = &m_z_bitmap.pix16(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
@ -1002,7 +997,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
{
|
||||
for (y = sy; y < ey; y++)
|
||||
{
|
||||
UINT8 *source = &state->m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT8 *source = &m_zoom_bitmap.pix8(y_index >> 10);
|
||||
UINT32 *dest = &dest_bmp.pix32(y);
|
||||
|
||||
int x, x_index = x_index_base;
|
||||
@ -1031,7 +1026,7 @@ static void psikyosh_drawgfxzoom( running_machine &machine,
|
||||
}
|
||||
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri)
|
||||
void psikyosh_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri)
|
||||
{
|
||||
/*- Sprite Format 0x0000 - 0x37ff -**
|
||||
|
||||
@ -1070,20 +1065,19 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
|
||||
#ifdef DEBUG_KEYS
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
if(machine.input().code_pressed(spr_keys[i])) {
|
||||
if(machine().input().code_pressed(spr_keys[i])) {
|
||||
spr_debug = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
psikyosh_state *state = machine.driver_data<psikyosh_state>();
|
||||
gfx_element *gfx;
|
||||
UINT32 *src = state->m_spriteram->buffer(); /* Use buffered spriteram */
|
||||
UINT32 *src = m_spriteram->buffer(); /* Use buffered spriteram */
|
||||
UINT16 *list = (UINT16 *)src + 0x3800 / 2;
|
||||
UINT16 listlen = 0x800/2;
|
||||
UINT16 *zoom_table = (UINT16 *)state->m_zoomram.target();
|
||||
UINT8 *alpha_table = (UINT8 *)&(state->m_vidregs[0]);
|
||||
UINT16 *zoom_table = (UINT16 *)m_zoomram.target();
|
||||
UINT8 *alpha_table = (UINT8 *)&(m_vidregs[0]);
|
||||
|
||||
UINT16 listcntr = 0;
|
||||
while (listcntr < listlen)
|
||||
@ -1126,19 +1120,19 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
|
||||
alphamap = (alpha_table[BYTE4_XOR_BE(alpha)] & 0x80)? 1:0;
|
||||
alpha = alpha_table[BYTE4_XOR_BE(alpha)] & 0x3f;
|
||||
|
||||
gfx = dpth ? machine.gfx[1] : machine.gfx[0];
|
||||
gfx = dpth ? machine().gfx[1] : machine().gfx[0];
|
||||
|
||||
if (alphamap) /* alpha values are per-pen */
|
||||
alpha = -1;
|
||||
else
|
||||
alpha = pal6bit(0x3f - alpha); /* 0x3f-0x00 maps to 0x00-0xff */
|
||||
|
||||
if(!spr_debug || machine.input().code_pressed(spr_keys[spr_pri]))
|
||||
if(!spr_debug || machine().input().code_pressed(spr_keys[spr_pri]))
|
||||
{
|
||||
/* start drawing */
|
||||
if (zoom_table[BYTE_XOR_BE(zoomy)] && zoom_table[BYTE_XOR_BE(zoomx)]) /* Avoid division-by-zero when table contains 0 (Uninitialised/Bug) */
|
||||
{
|
||||
psikyosh_drawgfxzoom(machine, bitmap, cliprect, gfx, tnum, colr, flpx, flpy, xpos, ypos, alpha,
|
||||
psikyosh_drawgfxzoom(bitmap, cliprect, gfx, tnum, colr, flpx, flpy, xpos, ypos, alpha,
|
||||
(UINT32)zoom_table[BYTE_XOR_BE(zoomx)], (UINT32)zoom_table[BYTE_XOR_BE(zoomy)], wide, high, listcntr);
|
||||
}
|
||||
/* end drawing */
|
||||
@ -1151,16 +1145,15 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
|
||||
}
|
||||
|
||||
|
||||
static void psikyosh_prelineblend( running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect )
|
||||
void psikyosh_state::psikyosh_prelineblend( bitmap_rgb32 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
/* There are 224 values for pre-lineblending. Using one for every row currently */
|
||||
/* I suspect that it should be blended against black by the amount specified as
|
||||
gnbarich sets the 0x000000ff to 0x7f in test mode whilst the others use 0x80.
|
||||
tgm2 sets it to 0x00 on warning screen. Likely has no effect. */
|
||||
psikyosh_state *state = machine.driver_data<psikyosh_state>();
|
||||
UINT32 *dstline;
|
||||
int bank = (state->m_vidregs[7] & 0xff000000) >> 24; /* bank is always 8 (0x4000) except for daraku/soldivid */
|
||||
UINT32 *linefill = &state->m_bgram[(bank * 0x800) / 4 - 0x4000 / 4]; /* Per row */
|
||||
int bank = (m_vidregs[7] & 0xff000000) >> 24; /* bank is always 8 (0x4000) except for daraku/soldivid */
|
||||
UINT32 *linefill = &m_bgram[(bank * 0x800) / 4 - 0x4000 / 4]; /* Per row */
|
||||
int x, y;
|
||||
|
||||
assert(bitmap.bpp() == 32);
|
||||
@ -1177,18 +1170,17 @@ static void psikyosh_prelineblend( running_machine &machine, bitmap_rgb32 &bitma
|
||||
}
|
||||
|
||||
|
||||
static void psikyosh_postlineblend( running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
void psikyosh_state::psikyosh_postlineblend( bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 req_pri )
|
||||
{
|
||||
/* There are 224 values for post-lineblending. Using one for every row currently */
|
||||
psikyosh_state *state = machine.driver_data<psikyosh_state>();
|
||||
UINT32 *dstline;
|
||||
int bank = (state->m_vidregs[7] & 0xff000000) >> 24; /* bank is always 8 (i.e. 0x4000) except for daraku/soldivid */
|
||||
UINT32 *lineblend = &state->m_bgram[(bank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4]; /* Per row */
|
||||
int bank = (m_vidregs[7] & 0xff000000) >> 24; /* bank is always 8 (i.e. 0x4000) except for daraku/soldivid */
|
||||
UINT32 *lineblend = &m_bgram[(bank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4]; /* Per row */
|
||||
int x, y;
|
||||
|
||||
assert(bitmap.bpp() == 32);
|
||||
|
||||
if ((state->m_vidregs[2] & 0xf) != req_pri) {
|
||||
if ((m_vidregs[2] & 0xf) != req_pri) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1280,18 +1272,18 @@ popmessage ("%08x %08x %08x %08x\n%08x %08x %08x %08x",
|
||||
|
||||
m_z_bitmap.fill(0, cliprect); /* z-buffer */
|
||||
|
||||
psikyosh_prelineblend(machine(), bitmap, cliprect); // fills screen
|
||||
psikyosh_prelineblend(bitmap, cliprect); // fills screen
|
||||
for (i = 0; i <= 7; i++)
|
||||
{
|
||||
if(!pri_debug || machine().input().code_pressed(pri_keys[i]))
|
||||
{
|
||||
if(sprites) {
|
||||
draw_sprites(machine(), bitmap, cliprect, i); // When same priority bg's have higher pri
|
||||
draw_sprites(bitmap, cliprect, i); // When same priority bg's have higher pri
|
||||
}
|
||||
if(backgrounds) {
|
||||
draw_background(machine(), bitmap, cliprect, i);
|
||||
draw_background(bitmap, cliprect, i);
|
||||
}
|
||||
psikyosh_postlineblend(machine(), bitmap, cliprect, i); // assume this has highest priority at same priority level
|
||||
psikyosh_postlineblend(bitmap, cliprect, i); // assume this has highest priority at same priority level
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -23,31 +23,29 @@
|
||||
Palette color
|
||||
***************************************************************************/
|
||||
|
||||
static void psychic5_change_palette(running_machine &machine, int color, int offset)
|
||||
void psychic5_state::psychic5_change_palette(int color, int offset)
|
||||
{
|
||||
psychic5_state *state = machine.driver_data<psychic5_state>();
|
||||
UINT8 lo = state->m_ps5_palette_ram[offset & ~1];
|
||||
UINT8 hi = state->m_ps5_palette_ram[offset | 1];
|
||||
UINT8 lo = m_ps5_palette_ram[offset & ~1];
|
||||
UINT8 hi = m_ps5_palette_ram[offset | 1];
|
||||
jal_blend_set(color, hi & 0x0f);
|
||||
palette_set_color_rgb(machine, color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
|
||||
palette_set_color_rgb(machine(), color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
|
||||
}
|
||||
|
||||
static void psychic5_change_bg_palette(running_machine &machine, int color, int lo_offs, int hi_offs)
|
||||
void psychic5_state::psychic5_change_bg_palette(int color, int lo_offs, int hi_offs)
|
||||
{
|
||||
psychic5_state *state = machine.driver_data<psychic5_state>();
|
||||
UINT8 r,g,b,lo,hi,ir,ig,ib,ix;
|
||||
rgb_t irgb;
|
||||
|
||||
/* red,green,blue intensities */
|
||||
ir = pal4bit(state->m_palette_intensity >> 12);
|
||||
ig = pal4bit(state->m_palette_intensity >> 8);
|
||||
ib = pal4bit(state->m_palette_intensity >> 4);
|
||||
ix = state->m_palette_intensity & 0x0f;
|
||||
ir = pal4bit(m_palette_intensity >> 12);
|
||||
ig = pal4bit(m_palette_intensity >> 8);
|
||||
ib = pal4bit(m_palette_intensity >> 4);
|
||||
ix = m_palette_intensity & 0x0f;
|
||||
|
||||
irgb = MAKE_RGB(ir,ig,ib);
|
||||
|
||||
lo = state->m_ps5_palette_ram[lo_offs];
|
||||
hi = state->m_ps5_palette_ram[hi_offs];
|
||||
lo = m_ps5_palette_ram[lo_offs];
|
||||
hi = m_ps5_palette_ram[hi_offs];
|
||||
|
||||
/* red,green,blue component */
|
||||
r = pal4bit(lo >> 4);
|
||||
@ -55,33 +53,32 @@ static void psychic5_change_bg_palette(running_machine &machine, int color, int
|
||||
b = pal4bit(hi >> 4);
|
||||
|
||||
/* Grey background enable */
|
||||
if (state->m_bg_status & 2)
|
||||
if (m_bg_status & 2)
|
||||
{
|
||||
UINT8 val = (r + g + b) / 3; /* Grey */
|
||||
/* Just leave plain grey */
|
||||
palette_set_color(machine,color,jal_blend_func(MAKE_RGB(val,val,val),irgb,ix));
|
||||
palette_set_color(machine(),color,jal_blend_func(MAKE_RGB(val,val,val),irgb,ix));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Seems fishy, but the title screen would be black otherwise... */
|
||||
if (!(state->m_title_screen & 1))
|
||||
if (!(m_title_screen & 1))
|
||||
{
|
||||
/* Leave the world as-is */
|
||||
palette_set_color(machine,color,jal_blend_func(MAKE_RGB(r,g,b),irgb,ix));
|
||||
palette_set_color(machine(),color,jal_blend_func(MAKE_RGB(r,g,b),irgb,ix));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void set_background_palette_intensity(running_machine &machine)
|
||||
void psychic5_state::set_background_palette_intensity()
|
||||
{
|
||||
psychic5_state *state = machine.driver_data<psychic5_state>();
|
||||
int i;
|
||||
state->m_palette_intensity = state->m_ps5_palette_ram[BG_PAL_INTENSITY_BU] |
|
||||
(state->m_ps5_palette_ram[BG_PAL_INTENSITY_RG]<<8);
|
||||
m_palette_intensity = m_ps5_palette_ram[BG_PAL_INTENSITY_BU] |
|
||||
(m_ps5_palette_ram[BG_PAL_INTENSITY_RG]<<8);
|
||||
|
||||
/* for all of the background palette */
|
||||
for (i = 0; i < 0x100; i++)
|
||||
psychic5_change_bg_palette(machine,state->m_bg_palette_base+i,state->m_bg_palette_ram_base+i*2,state->m_bg_palette_ram_base+i*2+1);
|
||||
psychic5_change_bg_palette(m_bg_palette_base+i,m_bg_palette_ram_base+i*2,m_bg_palette_ram_base+i*2+1);
|
||||
}
|
||||
|
||||
|
||||
@ -147,11 +144,11 @@ WRITE8_MEMBER(psychic5_state::psychic5_paged_ram_w)
|
||||
m_bg_status = m_ps5_io_ram[BG_SCREEN_MODE];
|
||||
}
|
||||
else if (offset >= 0x400 && offset <= 0x5ff) /* Sprite color */
|
||||
psychic5_change_palette(machine(),((offset >> 1) & 0xff)+0x000,offset-0x400);
|
||||
psychic5_change_palette(((offset >> 1) & 0xff)+0x000,offset-0x400);
|
||||
else if (offset >= 0x800 && offset <= 0x9ff) /* BG color */
|
||||
psychic5_change_palette(machine(),((offset >> 1) & 0xff)+0x100,offset-0x400);
|
||||
psychic5_change_palette(((offset >> 1) & 0xff)+0x100,offset-0x400);
|
||||
else if (offset >= 0xa00 && offset <= 0xbff) /* Text color */
|
||||
psychic5_change_palette(machine(),((offset >> 1) & 0xff)+0x200,offset-0x400);
|
||||
psychic5_change_palette(((offset >> 1) & 0xff)+0x200,offset-0x400);
|
||||
else if (offset >= 0x1000)
|
||||
m_fg_tilemap->mark_tile_dirty((offset-0x1000) >> 1);
|
||||
}
|
||||
@ -184,7 +181,7 @@ WRITE8_MEMBER(psychic5_state::bombsa_paged_ram_w)
|
||||
else if (offset >= 0x0800 && offset <= 0x0fff)
|
||||
m_fg_tilemap->mark_tile_dirty((offset & 0x7ff) >> 1);
|
||||
else if (offset >= 0x1000 && offset <= 0x15ff)
|
||||
psychic5_change_palette(machine(), (offset >> 1) & 0x3ff, offset-0x1000);
|
||||
psychic5_change_palette((offset >> 1) & 0x3ff, offset-0x1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,16 +293,15 @@ VIDEO_RESET_MEMBER(psychic5_state,bombsa)
|
||||
Screen refresh
|
||||
***************************************************************************/
|
||||
|
||||
#define DRAW_SPRITE(code, sx, sy) jal_blend_drawgfx(bitmap, cliprect, machine.gfx[0], code, color, flipx, flipy, sx, sy, 15);
|
||||
#define DRAW_SPRITE(code, sx, sy) jal_blend_drawgfx(bitmap, cliprect, machine().gfx[0], code, color, flipx, flipy, sx, sy, 15);
|
||||
|
||||
static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
void psychic5_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
psychic5_state *state = machine.driver_data<psychic5_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
/* Draw the sprites */
|
||||
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 16)
|
||||
for (offs = 0; offs < m_spriteram.bytes(); offs += 16)
|
||||
{
|
||||
int attr = spriteram[offs + 13];
|
||||
int code = spriteram[offs + 14] | ((attr & 0xc0) << 2);
|
||||
@ -319,7 +315,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
|
||||
if (attr & 0x01) sx -= 256;
|
||||
if (attr & 0x04) sy -= 256;
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
sx = 224 - sx;
|
||||
sy = 224 - sy;
|
||||
@ -344,7 +340,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
DRAW_SPRITE(code, sx + 16, sy + 16)
|
||||
else
|
||||
DRAW_SPRITE(code, sx, sy)
|
||||
@ -352,70 +348,69 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
void psychic5_state::draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
psychic5_state *state = machine.driver_data<psychic5_state>();
|
||||
UINT8 *spriteram = state->m_spriteram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
|
||||
rectangle clip = cliprect;
|
||||
|
||||
set_background_palette_intensity(machine);
|
||||
set_background_palette_intensity();
|
||||
|
||||
if (!(state->m_title_screen & 1))
|
||||
if (!(m_title_screen & 1))
|
||||
{
|
||||
state->m_bg_clip_mode = 0;
|
||||
state->m_sx1 = state->m_sy1 = state->m_sy2 = 0;
|
||||
m_bg_clip_mode = 0;
|
||||
m_sx1 = m_sy1 = m_sy2 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int sy1_old = state->m_sy1;
|
||||
int sx1_old = state->m_sx1;
|
||||
int sy2_old = state->m_sy2;
|
||||
int sy1_old = m_sy1;
|
||||
int sx1_old = m_sx1;
|
||||
int sy2_old = m_sy2;
|
||||
|
||||
state->m_sy1 = spriteram[11]; /* sprite 0 */
|
||||
state->m_sx1 = spriteram[12];
|
||||
state->m_sy2 = spriteram[11+128]; /* sprite 8 */
|
||||
m_sy1 = spriteram[11]; /* sprite 0 */
|
||||
m_sx1 = spriteram[12];
|
||||
m_sy2 = spriteram[11+128]; /* sprite 8 */
|
||||
|
||||
switch (state->m_bg_clip_mode)
|
||||
switch (m_bg_clip_mode)
|
||||
{
|
||||
case 0: case 4: if (sy1_old != state->m_sy1) state->m_bg_clip_mode++; break;
|
||||
case 2: case 6: if (sy2_old != state->m_sy2) state->m_bg_clip_mode++; break;
|
||||
case 0: case 4: if (sy1_old != m_sy1) m_bg_clip_mode++; break;
|
||||
case 2: case 6: if (sy2_old != m_sy2) m_bg_clip_mode++; break;
|
||||
case 8: case 10:
|
||||
case 12: case 14: if (sx1_old != state->m_sx1) state->m_bg_clip_mode++; break;
|
||||
case 1: case 5: if (state->m_sy1 == 0xf0) state->m_bg_clip_mode++; break;
|
||||
case 3: case 7: if (state->m_sy2 == 0xf0) state->m_bg_clip_mode++; break;
|
||||
case 9: case 11: if (state->m_sx1 == 0xf0) state->m_bg_clip_mode++; break;
|
||||
case 13: case 15: if (sx1_old == 0xf0) state->m_bg_clip_mode++;
|
||||
case 16: if (state->m_sy1 != 0x00) state->m_bg_clip_mode = 0; break;
|
||||
case 12: case 14: if (sx1_old != m_sx1) m_bg_clip_mode++; break;
|
||||
case 1: case 5: if (m_sy1 == 0xf0) m_bg_clip_mode++; break;
|
||||
case 3: case 7: if (m_sy2 == 0xf0) m_bg_clip_mode++; break;
|
||||
case 9: case 11: if (m_sx1 == 0xf0) m_bg_clip_mode++; break;
|
||||
case 13: case 15: if (sx1_old == 0xf0) m_bg_clip_mode++;
|
||||
case 16: if (m_sy1 != 0x00) m_bg_clip_mode = 0; break;
|
||||
}
|
||||
|
||||
switch (state->m_bg_clip_mode)
|
||||
switch (m_bg_clip_mode)
|
||||
{
|
||||
case 0: case 4: case 8: case 12: case 16:
|
||||
clip.set(0, 0, 0, 0);
|
||||
break;
|
||||
case 1: clip.min_y = state->m_sy1; break;
|
||||
case 3: clip.max_y = state->m_sy2; break;
|
||||
case 5: clip.max_y = state->m_sy1; break;
|
||||
case 7: clip.min_y = state->m_sy2; break;
|
||||
case 9: case 15: clip.min_x = state->m_sx1; break;
|
||||
case 11: case 13: clip.max_x = state->m_sx1; break;
|
||||
case 1: clip.min_y = m_sy1; break;
|
||||
case 3: clip.max_y = m_sy2; break;
|
||||
case 5: clip.max_y = m_sy1; break;
|
||||
case 7: clip.min_y = m_sy2; break;
|
||||
case 9: case 15: clip.min_x = m_sx1; break;
|
||||
case 11: case 13: clip.max_x = m_sx1; break;
|
||||
}
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
clip.set(255 - clip.max_x, 255 - clip.min_x, 255 - clip.max_y, 255 - clip.min_y);
|
||||
}
|
||||
|
||||
state->m_bg_tilemap->draw(bitmap, clip, 0, 0);
|
||||
m_bg_tilemap->draw(bitmap, clip, 0, 0);
|
||||
}
|
||||
|
||||
UINT32 psychic5_state::screen_update_psychic5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(get_black_pen(machine()), cliprect);
|
||||
if (m_bg_status & 1) /* Backgound enable */
|
||||
draw_background(machine(), bitmap, cliprect);
|
||||
draw_background(bitmap, cliprect);
|
||||
if (!(m_title_screen & 1))
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -426,7 +421,7 @@ UINT32 psychic5_state::screen_update_bombsa(screen_device &screen, bitmap_rgb32
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
else
|
||||
bitmap.fill(machine().pens[0x0ff], cliprect);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -187,22 +187,21 @@ WRITE8_MEMBER(punchout_state::punchout_spr2_videoram_w)
|
||||
|
||||
|
||||
|
||||
static void draw_big_sprite(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int palette)
|
||||
void punchout_state::draw_big_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, int palette)
|
||||
{
|
||||
punchout_state *state = machine.driver_data<punchout_state>();
|
||||
int zoom;
|
||||
|
||||
zoom = state->m_spr1_ctrlram[0] + 256 * (state->m_spr1_ctrlram[1] & 0x0f);
|
||||
zoom = m_spr1_ctrlram[0] + 256 * (m_spr1_ctrlram[1] & 0x0f);
|
||||
if (zoom)
|
||||
{
|
||||
int sx,sy;
|
||||
UINT32 startx,starty;
|
||||
int incxx,incyy;
|
||||
|
||||
sx = 4096 - (state->m_spr1_ctrlram[2] + 256 * (state->m_spr1_ctrlram[3] & 0x0f));
|
||||
sx = 4096 - (m_spr1_ctrlram[2] + 256 * (m_spr1_ctrlram[3] & 0x0f));
|
||||
if (sx > 4096-4*127) sx -= 4096;
|
||||
|
||||
sy = -(state->m_spr1_ctrlram[4] + 256 * (state->m_spr1_ctrlram[5] & 1));
|
||||
sy = -(m_spr1_ctrlram[4] + 256 * (m_spr1_ctrlram[5] & 1));
|
||||
if (sy <= -256 + zoom/0x40) sy += 512;
|
||||
sy += 12;
|
||||
|
||||
@ -214,15 +213,15 @@ static void draw_big_sprite(running_machine &machine, bitmap_ind16 &bitmap, cons
|
||||
startx += 3740 * zoom; /* adjustment to match the screen shots */
|
||||
starty -= 178 * zoom; /* and make the hall of fame picture nice */
|
||||
|
||||
if (state->m_spr1_ctrlram[6] & 1) /* flip x */
|
||||
if (m_spr1_ctrlram[6] & 1) /* flip x */
|
||||
{
|
||||
startx = ((16 * 8) << 16) - startx - 1;
|
||||
incxx = -incxx;
|
||||
}
|
||||
|
||||
state->m_spr1_tilemap->set_palette_offset(0x100 * palette);
|
||||
m_spr1_tilemap->set_palette_offset(0x100 * palette);
|
||||
|
||||
state->m_spr1_tilemap->draw_roz(bitmap, cliprect,
|
||||
m_spr1_tilemap->draw_roz(bitmap, cliprect,
|
||||
startx,starty + 0x200*(2) * zoom,
|
||||
incxx,0,0,incyy, /* zoom, no rotation */
|
||||
0, /* no wraparound */
|
||||
@ -231,12 +230,11 @@ static void draw_big_sprite(running_machine &machine, bitmap_ind16 &bitmap, cons
|
||||
}
|
||||
|
||||
|
||||
static void armwrest_draw_big_sprite(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int palette)
|
||||
void punchout_state::armwrest_draw_big_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, int palette)
|
||||
{
|
||||
punchout_state *state = machine.driver_data<punchout_state>();
|
||||
int zoom;
|
||||
|
||||
zoom = state->m_spr1_ctrlram[0] + 256 * (state->m_spr1_ctrlram[1] & 0x0f);
|
||||
zoom = m_spr1_ctrlram[0] + 256 * (m_spr1_ctrlram[1] & 0x0f);
|
||||
if (zoom)
|
||||
{
|
||||
int sx,sy;
|
||||
@ -244,10 +242,10 @@ static void armwrest_draw_big_sprite(running_machine &machine, bitmap_ind16 &bit
|
||||
int incxx,incyy;
|
||||
tilemap_t *_tilemap;
|
||||
|
||||
sx = 4096 - (state->m_spr1_ctrlram[2] + 256 * (state->m_spr1_ctrlram[3] & 0x0f));
|
||||
sx = 4096 - (m_spr1_ctrlram[2] + 256 * (m_spr1_ctrlram[3] & 0x0f));
|
||||
if (sx > 2048) sx -= 4096;
|
||||
|
||||
sy = -(state->m_spr1_ctrlram[4] + 256 * (state->m_spr1_ctrlram[5] & 1));
|
||||
sy = -(m_spr1_ctrlram[4] + 256 * (m_spr1_ctrlram[5] & 1));
|
||||
if (sy <= -256 + zoom/0x40) sy += 512;
|
||||
sy += 12;
|
||||
|
||||
@ -259,14 +257,14 @@ static void armwrest_draw_big_sprite(running_machine &machine, bitmap_ind16 &bit
|
||||
startx += 3740 * zoom; /* adjustment to match the screen shots */
|
||||
starty -= 178 * zoom; /* and make the hall of fame picture nice */
|
||||
|
||||
if (state->m_spr1_ctrlram[6] & 1) /* flip x */
|
||||
if (m_spr1_ctrlram[6] & 1) /* flip x */
|
||||
{
|
||||
_tilemap = state->m_spr1_tilemap_flipx;
|
||||
_tilemap = m_spr1_tilemap_flipx;
|
||||
startx = ((32 * 8) << 16) - startx - 1;
|
||||
incxx = -incxx;
|
||||
}
|
||||
else
|
||||
_tilemap = state->m_spr1_tilemap;
|
||||
_tilemap = m_spr1_tilemap;
|
||||
|
||||
_tilemap->set_palette_offset(0x100 * palette);
|
||||
|
||||
@ -278,23 +276,22 @@ static void armwrest_draw_big_sprite(running_machine &machine, bitmap_ind16 &bit
|
||||
}
|
||||
}
|
||||
|
||||
static void drawbs2(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void punchout_state::drawbs2(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
punchout_state *state = machine.driver_data<punchout_state>();
|
||||
int sx,sy;
|
||||
int incxx;
|
||||
|
||||
sx = 512 - (state->m_spr2_ctrlram[0] + 256 * (state->m_spr2_ctrlram[1] & 1));
|
||||
sx = 512 - (m_spr2_ctrlram[0] + 256 * (m_spr2_ctrlram[1] & 1));
|
||||
if (sx > 512-127) sx -= 512;
|
||||
sx -= 55; /* adjustment to match the screen shots */
|
||||
|
||||
sy = -state->m_spr2_ctrlram[2] + 256 * (state->m_spr2_ctrlram[3] & 1);
|
||||
sy = -m_spr2_ctrlram[2] + 256 * (m_spr2_ctrlram[3] & 1);
|
||||
sy += 3; /* adjustment to match the screen shots */
|
||||
|
||||
sx = -sx << 16;
|
||||
sy = -sy << 16;
|
||||
|
||||
if (state->m_spr2_ctrlram[4] & 1) /* flip x */
|
||||
if (m_spr2_ctrlram[4] & 1) /* flip x */
|
||||
{
|
||||
sx = ((16 * 8) << 16) - sx - 1;
|
||||
incxx = -1;
|
||||
@ -303,18 +300,17 @@ static void drawbs2(running_machine &machine, bitmap_ind16 &bitmap, const rectan
|
||||
incxx = 1;
|
||||
|
||||
// this tilemap doesn't actually zoom, but draw_roz is the only way to draw it without wraparound
|
||||
state->m_spr2_tilemap->draw_roz(bitmap, cliprect,
|
||||
m_spr2_tilemap->draw_roz(bitmap, cliprect,
|
||||
sx, sy, incxx << 16, 0, 0, 1 << 16,
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void punchout_copy_top_palette(running_machine &machine, int bank)
|
||||
void punchout_state::punchout_copy_top_palette(int bank)
|
||||
{
|
||||
punchout_state *state = machine.driver_data<punchout_state>();
|
||||
int i;
|
||||
const UINT8 *color_prom = state->memregion("proms")->base();
|
||||
const UINT8 *color_prom = memregion("proms")->base();
|
||||
|
||||
// top monitor palette
|
||||
for (i = 0; i < 0x100; i++)
|
||||
@ -326,15 +322,14 @@ static void punchout_copy_top_palette(running_machine &machine, int bank)
|
||||
g = 255 - pal4bit(color_prom[i + 0x200 + base]);
|
||||
b = 255 - pal4bit(color_prom[i + 0x400 + base]);
|
||||
|
||||
palette_set_color(machine, i ^ state->m_palette_reverse_top, MAKE_RGB(r, g, b));
|
||||
palette_set_color(machine(), i ^ m_palette_reverse_top, MAKE_RGB(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
static void punchout_copy_bot_palette(running_machine &machine, int bank)
|
||||
void punchout_state::punchout_copy_bot_palette(int bank)
|
||||
{
|
||||
punchout_state *state = machine.driver_data<punchout_state>();
|
||||
int i;
|
||||
const UINT8 *color_prom = state->memregion("proms")->base() + 0x600;
|
||||
const UINT8 *color_prom = memregion("proms")->base() + 0x600;
|
||||
|
||||
// bottom monitor palette
|
||||
for (i = 0; i < 0x100; i++)
|
||||
@ -346,19 +341,19 @@ static void punchout_copy_bot_palette(running_machine &machine, int bank)
|
||||
g = 255 - pal4bit(color_prom[i + 0x200 + base]);
|
||||
b = 255 - pal4bit(color_prom[i + 0x400 + base]);
|
||||
|
||||
palette_set_color(machine, (i ^ state->m_palette_reverse_bot) + 0x100, MAKE_RGB(r, g, b));
|
||||
palette_set_color(machine(), (i ^ m_palette_reverse_bot) + 0x100, MAKE_RGB(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UINT32 punchout_state::screen_update_punchout_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
punchout_copy_top_palette(machine(), BIT(*m_palettebank,1));
|
||||
punchout_copy_top_palette(BIT(*m_palettebank,1));
|
||||
|
||||
m_bg_top_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
if (m_spr1_ctrlram[7] & 1) /* display in top monitor */
|
||||
draw_big_sprite(machine(), bitmap, cliprect, 0);
|
||||
draw_big_sprite(bitmap, cliprect, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -367,7 +362,7 @@ UINT32 punchout_state::screen_update_punchout_bottom(screen_device &screen, bitm
|
||||
{
|
||||
int offs;
|
||||
|
||||
punchout_copy_bot_palette(machine(), BIT(*m_palettebank,0));
|
||||
punchout_copy_bot_palette(BIT(*m_palettebank,0));
|
||||
|
||||
/* copy the character mapped graphics */
|
||||
for (offs = 0;offs < 32;offs++)
|
||||
@ -376,8 +371,8 @@ UINT32 punchout_state::screen_update_punchout_bottom(screen_device &screen, bitm
|
||||
m_bg_bot_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
if (m_spr1_ctrlram[7] & 2) /* display in bottom monitor */
|
||||
draw_big_sprite(machine(), bitmap, cliprect, 1);
|
||||
drawbs2(machine(), bitmap, cliprect);
|
||||
draw_big_sprite(bitmap, cliprect, 1);
|
||||
drawbs2(bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -385,25 +380,25 @@ UINT32 punchout_state::screen_update_punchout_bottom(screen_device &screen, bitm
|
||||
|
||||
UINT32 punchout_state::screen_update_armwrest_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
punchout_copy_top_palette(machine(), BIT(*m_palettebank,1));
|
||||
punchout_copy_top_palette(BIT(*m_palettebank,1));
|
||||
|
||||
m_bg_top_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
if (m_spr1_ctrlram[7] & 1) /* display in top monitor */
|
||||
armwrest_draw_big_sprite(machine(), bitmap, cliprect, 0);
|
||||
armwrest_draw_big_sprite(bitmap, cliprect, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 punchout_state::screen_update_armwrest_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
punchout_copy_bot_palette(machine(), BIT(*m_palettebank,0));
|
||||
punchout_copy_bot_palette(BIT(*m_palettebank,0));
|
||||
|
||||
m_bg_bot_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
if (m_spr1_ctrlram[7] & 2) /* display in bottom monitor */
|
||||
armwrest_draw_big_sprite(machine(), bitmap, cliprect, 1);
|
||||
drawbs2(machine(), bitmap, cliprect);
|
||||
armwrest_draw_big_sprite(bitmap, cliprect, 1);
|
||||
drawbs2(bitmap, cliprect);
|
||||
|
||||
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
|
||||
|
@ -79,10 +79,9 @@ WRITE16_MEMBER(pushman_state::pushman_videoram_w)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void pushman_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
pushman_state *state = machine.driver_data<pushman_state>();
|
||||
UINT16 *spriteram = state->m_spriteram;
|
||||
UINT16 *spriteram = m_spriteram;
|
||||
int offs, x, y, color, sprite, flipx, flipy;
|
||||
|
||||
for (offs = 0x0800 - 4; offs >=0; offs -= 4)
|
||||
@ -101,7 +100,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
flipx = spriteram[offs + 1] & 2;
|
||||
flipy = spriteram[offs + 1] & 1; /* flip y untested */
|
||||
|
||||
if (state->flip_screen())
|
||||
if (flip_screen())
|
||||
{
|
||||
x = 240 - x;
|
||||
y = 240 - y;
|
||||
@ -109,7 +108,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], sprite,
|
||||
drawgfx_transpen(bitmap,cliprect,machine().gfx[1], sprite,
|
||||
color, flipx, flipy, x, y, 15);
|
||||
}
|
||||
}
|
||||
@ -121,7 +120,7 @@ UINT32 pushman_state::screen_update_pushman(screen_device &screen, bitmap_ind16
|
||||
m_bg_tilemap->set_scrolly(0, 0xf00 - m_control[1]);
|
||||
|
||||
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
draw_sprites(machine(), bitmap, cliprect);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user