diff --git a/src/mame/drivers/alpha68k.c b/src/mame/drivers/alpha68k.c index caba26b361c..32229343fb9 100644 --- a/src/mame/drivers/alpha68k.c +++ b/src/mame/drivers/alpha68k.c @@ -218,7 +218,7 @@ WRITE16_MEMBER(alpha68k_state::tnextspc_unknown_w) { logerror("tnextspc_unknown_w : PC = %04x - offset = %04x - data = %04x\n", space.device().safe_pc(), offset, data); if (offset == 0) - alpha68k_flipscreen_w(machine(), data & 0x100); + alpha68k_flipscreen_w(data & 0x100); } WRITE16_MEMBER(alpha68k_state::alpha_microcontroller_w) @@ -226,7 +226,7 @@ WRITE16_MEMBER(alpha68k_state::alpha_microcontroller_w) logerror("%04x: Alpha write trigger at %04x (%04x)\n", space.device().safe_pc(), offset, data); /* 0x44 = coin clear signal to microcontroller? */ if (offset == 0x2d && ACCESSING_BITS_0_7) - alpha68k_flipscreen_w(machine(), data & 1); + alpha68k_flipscreen_w(data & 1); } /******************************************************************************/ @@ -307,7 +307,7 @@ WRITE16_MEMBER(alpha68k_state::alpha68k_V_sound_w) if(ACCESSING_BITS_0_7) soundlatch_byte_w(space, 0, data & 0xff); if(ACCESSING_BITS_8_15) - alpha68k_V_video_bank_w(machine(), (data >> 8) & 0xff); + alpha68k_V_video_bank_w((data >> 8) & 0xff); } //AT WRITE16_MEMBER(alpha68k_state::paddlema_soundlatch_w) diff --git a/src/mame/drivers/amspdwy.c b/src/mame/drivers/amspdwy.c index 6d1a4a95baf..521c40b6879 100644 --- a/src/mame/drivers/amspdwy.c +++ b/src/mame/drivers/amspdwy.c @@ -34,32 +34,31 @@ Sound: YM2151 Or last value when wheel delta = 0 */ -static UINT8 amspdwy_wheel_r( running_machine &machine, int index ) +UINT8 amspdwy_state::amspdwy_wheel_r( int index ) { - amspdwy_state *state = machine.driver_data(); static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" }; - UINT8 wheel = machine.root_device().ioport(portnames[2 + index])->read(); - if (wheel != state->m_wheel_old[index]) + UINT8 wheel = machine().root_device().ioport(portnames[2 + index])->read(); + if (wheel != m_wheel_old[index]) { wheel = (wheel & 0x7fff) - (wheel & 0x8000); - if (wheel > state->m_wheel_old[index]) - state->m_wheel_return[index] = ((+wheel) & 0xf) | 0x00; + if (wheel > m_wheel_old[index]) + m_wheel_return[index] = ((+wheel) & 0xf) | 0x00; else - state->m_wheel_return[index] = ((-wheel) & 0xf) | 0x10; + m_wheel_return[index] = ((-wheel) & 0xf) | 0x10; - state->m_wheel_old[index] = wheel; + m_wheel_old[index] = wheel; } - return state->m_wheel_return[index] | machine.root_device().ioport(portnames[index])->read(); + return m_wheel_return[index] | machine().root_device().ioport(portnames[index])->read(); } READ8_MEMBER(amspdwy_state::amspdwy_wheel_0_r) { - return amspdwy_wheel_r(machine(), 0); + return amspdwy_wheel_r(0); } READ8_MEMBER(amspdwy_state::amspdwy_wheel_1_r) { - return amspdwy_wheel_r(machine(), 1); + return amspdwy_wheel_r(1); } READ8_MEMBER(amspdwy_state::amspdwy_sound_r) diff --git a/src/mame/drivers/aquarium.c b/src/mame/drivers/aquarium.c index abd241aab70..0a6a2e3036c 100644 --- a/src/mame/drivers/aquarium.c +++ b/src/mame/drivers/aquarium.c @@ -70,7 +70,7 @@ WRITE8_MEMBER(aquarium_state::aquarium_z80_bank_w) membank("bank1")->set_entry(data & 0x07); } -static UINT8 aquarium_snd_bitswap( UINT8 scrambled_data ) +UINT8 aquarium_state::aquarium_snd_bitswap( UINT8 scrambled_data ) { UINT8 data = 0; diff --git a/src/mame/drivers/arkanoid.c b/src/mame/drivers/arkanoid.c index 434f4d66557..2eb04a2758b 100644 --- a/src/mame/drivers/arkanoid.c +++ b/src/mame/drivers/arkanoid.c @@ -1572,25 +1572,24 @@ ROM_END /* Driver Initialization */ -static void arkanoid_bootleg_init( running_machine &machine ) +void arkanoid_state::arkanoid_bootleg_init( ) { - arkanoid_state *state = machine.driver_data(); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf000, 0xf000, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f000_r),state) ); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf002, 0xf002, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f002_r),state) ); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd018, 0xd018, write8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d018_w),state) ); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd008, 0xd008, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d008_r),state) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf000, 0xf000, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f000_r),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf002, 0xf002, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f002_r),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd018, 0xd018, write8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d018_w),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd008, 0xd008, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d008_r),this) ); } DRIVER_INIT_MEMBER(arkanoid_state,arkangc) { m_bootleg_id = ARKANGC; - arkanoid_bootleg_init(machine()); + arkanoid_bootleg_init(); } DRIVER_INIT_MEMBER(arkanoid_state,arkangc2) { m_bootleg_id = ARKANGC2; - arkanoid_bootleg_init(machine()); + arkanoid_bootleg_init(); } DRIVER_INIT_MEMBER(arkanoid_state,block2) @@ -1625,31 +1624,31 @@ DRIVER_INIT_MEMBER(arkanoid_state,block2) auto_free(machine(), buffer); m_bootleg_id = BLOCK2; - arkanoid_bootleg_init(machine()); + arkanoid_bootleg_init(); } DRIVER_INIT_MEMBER(arkanoid_state,arkblock) { m_bootleg_id = ARKBLOCK; - arkanoid_bootleg_init(machine()); + arkanoid_bootleg_init(); } DRIVER_INIT_MEMBER(arkanoid_state,arkbloc2) { m_bootleg_id = ARKBLOC2; - arkanoid_bootleg_init(machine()); + arkanoid_bootleg_init(); } DRIVER_INIT_MEMBER(arkanoid_state,arkgcbl) { m_bootleg_id = ARKGCBL; - arkanoid_bootleg_init(machine()); + arkanoid_bootleg_init(); } DRIVER_INIT_MEMBER(arkanoid_state,paddle2) { m_bootleg_id = PADDLE2; - arkanoid_bootleg_init(machine()); + arkanoid_bootleg_init(); } diff --git a/src/mame/drivers/astrof.c b/src/mame/drivers/astrof.c index dbb8d3c79e7..e1fde77f81a 100644 --- a/src/mame/drivers/astrof.c +++ b/src/mame/drivers/astrof.c @@ -173,12 +173,10 @@ void astrof_state::video_start() } -static rgb_t make_pen( running_machine &machine, UINT8 data ) +rgb_t astrof_state::make_pen( UINT8 data ) { - astrof_state *state = machine.driver_data(); - - UINT8 r1_bit = state->m_red_on ? 0x01 : (data >> 0) & 0x01; - UINT8 r2_bit = state->m_red_on ? 0x01 : (data >> 1) & 0x01; + UINT8 r1_bit = m_red_on ? 0x01 : (data >> 0) & 0x01; + UINT8 r2_bit = m_red_on ? 0x01 : (data >> 1) & 0x01; UINT8 g1_bit = (data >> 2) & 0x01; UINT8 g2_bit = (data >> 3) & 0x01; UINT8 b1_bit = (data >> 4) & 0x01; @@ -194,13 +192,12 @@ static rgb_t make_pen( running_machine &machine, UINT8 data ) } -static void astrof_get_pens( running_machine &machine, pen_t *pens ) +void astrof_state::astrof_get_pens( pen_t *pens ) { - astrof_state *state = machine.driver_data(); offs_t i; - UINT8 bank = (state->m_astrof_palette_bank ? 0x10 : 0x00); - UINT8 config = state->ioport("FAKE")->read_safe(0x00); - UINT8 *prom = state->memregion("proms")->base(); + UINT8 bank = (m_astrof_palette_bank ? 0x10 : 0x00); + UINT8 config = ioport("FAKE")->read_safe(0x00); + UINT8 *prom = memregion("proms")->base(); /* a common wire hack to the pcb causes the prom halves to be inverted */ /* this results in e.g. astrof background being black */ @@ -226,16 +223,16 @@ static void astrof_get_pens( running_machine &machine, pen_t *pens ) for (i = 0; i < ASTROF_NUM_PENS; i++) { UINT8 data = prom[bank | i]; - pens[i] = make_pen(machine, data); + pens[i] = make_pen(data); } } -static void tomahawk_get_pens( running_machine &machine, pen_t *pens ) +void astrof_state::tomahawk_get_pens( pen_t *pens ) { offs_t i; - UINT8 *prom = machine.root_device().memregion("proms")->base(); - UINT8 config = machine.root_device().ioport("FAKE")->read_safe(0x00); + UINT8 *prom = machine().root_device().memregion("proms")->base(); + UINT8 config = machine().root_device().ioport("FAKE")->read_safe(0x00); for (i = 0; i < TOMAHAWK_NUM_PENS; i++) { @@ -266,7 +263,7 @@ static void tomahawk_get_pens( running_machine &machine, pen_t *pens ) data = prom[pen]; - pens[i] = make_pen(machine, data); + pens[i] = make_pen(data); } } @@ -299,79 +296,72 @@ WRITE8_MEMBER(astrof_state::video_control_1_w) } -static void astrof_set_video_control_2( running_machine &machine, UINT8 data ) +void astrof_state::astrof_set_video_control_2( UINT8 data ) { - astrof_state *state = machine.driver_data(); - /* D0 - OUT0 - goes to edge conn. pin A10 - was perhaps meant to be a start lamp */ /* D1 - OUT1 - goes to edge conn. pin A11 - was perhaps meant to be a start lamp */ /* D2 - selects one of the two palette banks */ - state->m_astrof_palette_bank = (data & 0x04) ? TRUE : FALSE; + m_astrof_palette_bank = (data & 0x04) ? TRUE : FALSE; /* D3 - turns on the red color gun regardless of the value in the color PROM */ - state->m_red_on = (data & 0x08) ? TRUE : FALSE; + m_red_on = (data & 0x08) ? TRUE : FALSE; /* D4-D7 - not connected */ } WRITE8_MEMBER(astrof_state::astrof_video_control_2_w) { - astrof_set_video_control_2(machine(), data); + astrof_set_video_control_2(data); machine().primary_screen->update_partial(machine().primary_screen->vpos()); } -static void spfghmk2_set_video_control_2( running_machine &machine, UINT8 data ) +void astrof_state::spfghmk2_set_video_control_2( UINT8 data ) { - astrof_state *state = machine.driver_data(); - /* D0 - OUT0 - goes to edge conn. pin A10 - was perhaps meant to be a start lamp */ /* D1 - OUT1 - goes to edge conn. pin A11 - was perhaps meant to be a start lamp */ /* D2 - selects one of the two palette banks */ - state->m_astrof_palette_bank = (data & 0x04) ? TRUE : FALSE; + m_astrof_palette_bank = (data & 0x04) ? TRUE : FALSE; /* D3-D7 - not connected */ } WRITE8_MEMBER(astrof_state::spfghmk2_video_control_2_w) { - spfghmk2_set_video_control_2(machine(), data); + spfghmk2_set_video_control_2(data); machine().primary_screen->update_partial(machine().primary_screen->vpos()); } -static void tomahawk_set_video_control_2( running_machine &machine, UINT8 data ) +void astrof_state::tomahawk_set_video_control_2( UINT8 data ) { - astrof_state *state = machine.driver_data(); - /* D0 - OUT0 - goes to edge conn. pin A10 - was perhaps meant to be a start lamp */ /* D1 - OUT1 - goes to edge conn. pin A11 - was perhaps meant to be a start lamp */ /* D2 - not connected */ /* D3 - turns on the red color gun regardless of the value in the color PROM */ - state->m_red_on = (data & 0x08) ? TRUE : FALSE; + m_red_on = (data & 0x08) ? TRUE : FALSE; } WRITE8_MEMBER(astrof_state::tomahawk_video_control_2_w) { - tomahawk_set_video_control_2(machine(), data); + tomahawk_set_video_control_2(data); machine().primary_screen->update_partial(machine().primary_screen->vpos()); } -static void video_update_common( running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens ) +void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens ) { - astrof_state *state = machine.driver_data(); offs_t offs; - for (offs = 0; offs < state->m_videoram.bytes(); offs++) + for (offs = 0; offs < m_videoram.bytes(); offs++) { UINT8 data; int i; - UINT8 color = state->m_colorram[offs >> 1]; + UINT8 color = m_colorram[offs >> 1]; pen_t back_pen = pens[color | 0x00]; pen_t fore_pen = pens[color | 0x01]; @@ -379,22 +369,22 @@ static void video_update_common( running_machine &machine, bitmap_rgb32 &bitmap, UINT8 y = offs; UINT8 x = offs >> 8 << 3; - if (!state->m_flipscreen) + if (!m_flipscreen) y = ~y; if ((y <= cliprect.min_y) || (y >= cliprect.max_y)) continue; - if (state->m_screen_off) + if (m_screen_off) data = 0; else - data = state->m_videoram[offs]; + data = m_videoram[offs]; for (i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? fore_pen : back_pen; - if (state->m_flipscreen) + if (m_flipscreen) bitmap.pix32(y, 255 - x) = pen; else bitmap.pix32(y, x) = pen; @@ -410,9 +400,9 @@ UINT32 astrof_state::screen_update_astrof(screen_device &screen, bitmap_rgb32 &b { pen_t pens[ASTROF_NUM_PENS]; - astrof_get_pens(machine(), pens); + astrof_get_pens(pens); - video_update_common(machine(), bitmap, cliprect, pens); + video_update_common(bitmap, cliprect, pens); return 0; } @@ -422,9 +412,9 @@ UINT32 astrof_state::screen_update_tomahawk(screen_device &screen, bitmap_rgb32 { pen_t pens[TOMAHAWK_NUM_PENS]; - tomahawk_get_pens(machine(), pens); + tomahawk_get_pens(pens); - video_update_common(machine(), bitmap, cliprect, pens); + video_update_common(bitmap, cliprect, pens); return 0; } @@ -475,7 +465,7 @@ READ8_MEMBER(astrof_state::tomahawk_protection_r) MACHINE_START_MEMBER(astrof_state,astrof) { /* the 74175 outputs all HI's if not otherwise set */ - astrof_set_video_control_2(machine(), 0xff); + astrof_set_video_control_2(0xff); m_maincpu = machine().device("maincpu"); m_samples = machine().device("samples"); @@ -505,7 +495,7 @@ MACHINE_START_MEMBER(astrof_state,abattle) MACHINE_START_MEMBER(astrof_state,spfghmk2) { /* the 74175 outputs all HI's if not otherwise set */ - spfghmk2_set_video_control_2(machine(), 0xff); + spfghmk2_set_video_control_2(0xff); m_maincpu = machine().device("maincpu"); @@ -522,7 +512,7 @@ MACHINE_START_MEMBER(astrof_state,spfghmk2) MACHINE_START_MEMBER(astrof_state,tomahawk) { /* the 74175 outputs all HI's if not otherwise set */ - tomahawk_set_video_control_2(machine(), 0xff); + tomahawk_set_video_control_2(0xff); m_maincpu = machine().device("maincpu"); m_sn = machine().device("snsnd"); diff --git a/src/mame/drivers/balsente.c b/src/mame/drivers/balsente.c index 429ebc9553a..22a7832bc25 100644 --- a/src/mame/drivers/balsente.c +++ b/src/mame/drivers/balsente.c @@ -2067,17 +2067,17 @@ ROM_END #define EXPAND_NONE 0x3f #define SWAP_HALVES 0x80 -static void expand_roms(running_machine &machine, UINT8 cd_rom_mask) +void balsente_state::expand_roms(UINT8 cd_rom_mask) { /* load AB bank data from 0x10000-0x20000 */ /* load CD bank data from 0x20000-0x2e000 */ /* load EF from 0x2e000-0x30000 */ /* ROM region must be 0x40000 total */ - UINT8 *temp = auto_alloc_array(machine, UINT8, 0x20000); + UINT8 *temp = auto_alloc_array(machine(), UINT8, 0x20000); { - UINT8 *rom = machine.root_device().memregion("maincpu")->base(); - UINT32 len = machine.root_device().memregion("maincpu")->bytes(); + UINT8 *rom = machine().root_device().memregion("maincpu")->base(); + UINT32 len = machine().root_device().memregion("maincpu")->bytes(); UINT32 base; for (base = 0x10000; base < len; base += 0x30000) @@ -2129,75 +2129,74 @@ static void expand_roms(running_machine &machine, UINT8 cd_rom_mask) memcpy(&rom[base + 0x00000], &ab_base[0x0000], 0x2000); } - auto_free(machine, temp); + auto_free(machine(), temp); } } -INLINE void config_shooter_adc(running_machine &machine, UINT8 shooter, UINT8 adc_shift) +inline void balsente_state::config_shooter_adc(UINT8 shooter, UINT8 adc_shift) { - balsente_state *state = machine.driver_data(); - state->m_shooter = shooter; - state->m_adc_shift = adc_shift; + m_shooter = shooter; + m_adc_shift = adc_shift; } -DRIVER_INIT_MEMBER(balsente_state,sentetst) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } -DRIVER_INIT_MEMBER(balsente_state,cshift) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } -DRIVER_INIT_MEMBER(balsente_state,gghost) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 1); } -DRIVER_INIT_MEMBER(balsente_state,hattrick) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } -DRIVER_INIT_MEMBER(balsente_state,otwalls) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0); } -DRIVER_INIT_MEMBER(balsente_state,snakepit) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 1); } -DRIVER_INIT_MEMBER(balsente_state,snakjack) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 1); } -DRIVER_INIT_MEMBER(balsente_state,stocker) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0); } -DRIVER_INIT_MEMBER(balsente_state,triviag1) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } +DRIVER_INIT_MEMBER(balsente_state,sentetst) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 0 /* noanalog */); } +DRIVER_INIT_MEMBER(balsente_state,cshift) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 0 /* noanalog */); } +DRIVER_INIT_MEMBER(balsente_state,gghost) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 1); } +DRIVER_INIT_MEMBER(balsente_state,hattrick) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 0 /* noanalog */); } +DRIVER_INIT_MEMBER(balsente_state,otwalls) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 0); } +DRIVER_INIT_MEMBER(balsente_state,snakepit) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 1); } +DRIVER_INIT_MEMBER(balsente_state,snakjack) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 1); } +DRIVER_INIT_MEMBER(balsente_state,stocker) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 0); } +DRIVER_INIT_MEMBER(balsente_state,triviag1) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 0 /* noanalog */); } DRIVER_INIT_MEMBER(balsente_state,triviag2) { UINT8 *rom = machine().root_device().memregion("maincpu")->base(); memcpy(&rom[0x20000], &rom[0x28000], 0x4000); memcpy(&rom[0x24000], &rom[0x28000], 0x4000); - expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); + expand_roms(EXPAND_NONE); config_shooter_adc(FALSE, 0 /* noanalog */); } -DRIVER_INIT_MEMBER(balsente_state,triviaes) { expand_roms(machine(), EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } -DRIVER_INIT_MEMBER(balsente_state,gimeabrk) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 1); } -DRIVER_INIT_MEMBER(balsente_state,minigolf) { expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 2); } -DRIVER_INIT_MEMBER(balsente_state,minigolf2) { expand_roms(machine(), 0x0c); config_shooter_adc(machine(), FALSE, 2); } -DRIVER_INIT_MEMBER(balsente_state,toggle) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } +DRIVER_INIT_MEMBER(balsente_state,triviaes) { expand_roms(EXPAND_NONE | SWAP_HALVES); config_shooter_adc(FALSE, 0 /* noanalog */); } +DRIVER_INIT_MEMBER(balsente_state,gimeabrk) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 1); } +DRIVER_INIT_MEMBER(balsente_state,minigolf) { expand_roms(EXPAND_NONE); config_shooter_adc(FALSE, 2); } +DRIVER_INIT_MEMBER(balsente_state,minigolf2) { expand_roms(0x0c); config_shooter_adc(FALSE, 2); } +DRIVER_INIT_MEMBER(balsente_state,toggle) { expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 0 /* noanalog */); } DRIVER_INIT_MEMBER(balsente_state,nametune) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); - expand_roms(machine(), EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); + expand_roms(EXPAND_NONE | SWAP_HALVES); config_shooter_adc(FALSE, 0 /* noanalog */); } DRIVER_INIT_MEMBER(balsente_state,nstocker) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); - expand_roms(machine(), EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine(), TRUE, 1); + expand_roms(EXPAND_NONE | SWAP_HALVES); config_shooter_adc(TRUE, 1); } DRIVER_INIT_MEMBER(balsente_state,sfootbal) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); - expand_roms(machine(), EXPAND_ALL | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 0); + expand_roms(EXPAND_ALL | SWAP_HALVES); config_shooter_adc(FALSE, 0); } DRIVER_INIT_MEMBER(balsente_state,spiker) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_readwrite_handler(0x9f80, 0x9f8f, read8_delegate(FUNC(balsente_state::spiker_expand_r),this), write8_delegate(FUNC(balsente_state::spiker_expand_w),this)); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); - expand_roms(machine(), EXPAND_ALL | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 1); + expand_roms(EXPAND_ALL | SWAP_HALVES); config_shooter_adc(FALSE, 1); } DRIVER_INIT_MEMBER(balsente_state,stompin) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); - expand_roms(machine(), 0x0c | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 32); + expand_roms(0x0c | SWAP_HALVES); config_shooter_adc(FALSE, 32); } -DRIVER_INIT_MEMBER(balsente_state,rescraid) { expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } +DRIVER_INIT_MEMBER(balsente_state,rescraid) { expand_roms(EXPAND_NONE); config_shooter_adc(FALSE, 0 /* noanalog */); } DRIVER_INIT_MEMBER(balsente_state,grudge) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_read_handler(0x9400, 0x9400, read8_delegate(FUNC(balsente_state::grudge_steering_r),this)); - expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 0); + expand_roms(EXPAND_NONE); config_shooter_adc(FALSE, 0); } DRIVER_INIT_MEMBER(balsente_state,shrike) { @@ -2206,7 +2205,7 @@ DRIVER_INIT_MEMBER(balsente_state,shrike) space.install_write_handler(0x9e01, 0x9e01, write8_delegate(FUNC(balsente_state::shrike_sprite_select_w),this)); machine().device("68k")->memory().space(AS_PROGRAM).install_readwrite_handler(0x10000, 0x1001f, read16_delegate(FUNC(balsente_state::shrike_io_68k_r),this), write16_delegate(FUNC(balsente_state::shrike_io_68k_w),this)); - expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 32); + expand_roms(EXPAND_ALL); config_shooter_adc(FALSE, 32); } diff --git a/src/mame/drivers/bublbobl.c b/src/mame/drivers/bublbobl.c index f5944aa3453..756238f9cfd 100644 --- a/src/mame/drivers/bublbobl.c +++ b/src/mame/drivers/bublbobl.c @@ -1531,15 +1531,15 @@ ROM_END * *************************************/ -static void configure_banks( running_machine& machine ) +void bublbobl_state::configure_banks( ) { - UINT8 *ROM = machine.root_device().memregion("maincpu")->base(); - machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000); + UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); + machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000); } DRIVER_INIT_MEMBER(bublbobl_state,bublbobl) { - configure_banks(machine()); + configure_banks(); /* we init this here, so that it does not conflict with tokio init, below */ m_video_enable = 0; @@ -1547,7 +1547,7 @@ DRIVER_INIT_MEMBER(bublbobl_state,bublbobl) DRIVER_INIT_MEMBER(bublbobl_state,tokio) { - configure_banks(machine()); + configure_banks(); /* preemptively enable video, the bit is not mapped for this game and */ /* I don't know if it even has it. */ diff --git a/src/mame/drivers/bwing.c b/src/mame/drivers/bwing.c index 31c13b8f5bd..aab008aac84 100644 --- a/src/mame/drivers/bwing.c +++ b/src/mame/drivers/bwing.c @@ -555,11 +555,10 @@ ROM_END //**************************************************************************** // Initializations -static void fix_bwp3( running_machine &machine ) +void bwing_state::fix_bwp3( ) { - bwing_state *state = machine.driver_data(); - UINT8 *rom = state->m_bwp3_rombase; - int i, j = state->m_bwp3_rombase.bytes(); + UINT8 *rom = m_bwp3_rombase; + int i, j = m_bwp3_rombase.bytes(); // swap nibbles for (i = 0; i < j; i++) @@ -577,7 +576,7 @@ DRIVER_INIT_MEMBER(bwing_state,bwing) m_bwp123_membase[1] = memregion("sub")->base(); m_bwp123_membase[2] = memregion("audiocpu")->base(); - fix_bwp3(machine()); + fix_bwp3(); } //**************************************************************************** diff --git a/src/mame/drivers/missb2.c b/src/mame/drivers/missb2.c index 93087122c8a..f75032300de 100644 --- a/src/mame/drivers/missb2.c +++ b/src/mame/drivers/missb2.c @@ -40,6 +40,7 @@ public: DECLARE_MACHINE_RESET(missb2); UINT32 screen_update_missb2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(missb2_interrupt); + void configure_banks(); }; @@ -571,21 +572,21 @@ ROM_START( bublpong ) ROM_END -static void configure_banks( running_machine& machine ) +void missb2_state::configure_banks() { - UINT8 *ROM = machine.root_device().memregion("maincpu")->base(); - UINT8 *SLAVE = machine.root_device().memregion("slave")->base(); + UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); + UINT8 *SLAVE = machine().root_device().memregion("slave")->base(); - machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000); + machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000); /* 2009-11 FP: isn't there a way to configure both at once? */ - machine.root_device().membank("bank2")->configure_entries(0, 7, &SLAVE[0x8000], 0x1000); - machine.root_device().membank("bank3")->configure_entries(0, 7, &SLAVE[0x9000], 0x1000); + machine().root_device().membank("bank2")->configure_entries(0, 7, &SLAVE[0x8000], 0x1000); + machine().root_device().membank("bank3")->configure_entries(0, 7, &SLAVE[0x9000], 0x1000); } DRIVER_INIT_MEMBER(missb2_state,missb2) { - configure_banks(machine()); + configure_banks(); m_video_enable = 0; } diff --git a/src/mame/includes/1942.h b/src/mame/includes/1942.h index c120d56b8d6..db1c010f453 100644 --- a/src/mame/includes/1942.h +++ b/src/mame/includes/1942.h @@ -41,4 +41,5 @@ public: virtual void palette_init(); UINT32 screen_update_1942(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(c1942_scanline); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/1943.h b/src/mame/includes/1943.h index d74e3a64139..cc7b61b0cc5 100644 --- a/src/mame/includes/1943.h +++ b/src/mame/includes/1943.h @@ -47,4 +47,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_1943(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); }; diff --git a/src/mame/includes/20pacgal.h b/src/mame/includes/20pacgal.h index ce4c96a4662..5e1f5143da0 100644 --- a/src/mame/includes/20pacgal.h +++ b/src/mame/includes/20pacgal.h @@ -57,6 +57,14 @@ public: UINT32 screen_update_20pacgal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); void set_bankptr(); + void get_pens(pen_t *pens); + void do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_rgb32 &bitmap); + void draw_chars(bitmap_rgb32 &bitmap); + void draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect ); + void draw_sprite(bitmap_rgb32 &bitmap, int y, int x, + UINT8 code, UINT8 color, int flip_y, int flip_x); + }; diff --git a/src/mame/includes/40love.h b/src/mame/includes/40love.h index 31232f326ce..11991ff9bab 100644 --- a/src/mame/includes/40love.h +++ b/src/mame/includes/40love.h @@ -98,4 +98,8 @@ public: UINT32 screen_update_fortyl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(nmi_callback); void redraw_pixels(); + void fortyl_set_scroll_x( int offset ); + void fortyl_plot_pix( int offset ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_pixram( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/8080bw.h b/src/mame/includes/8080bw.h index 90de22862a8..bf098f8fe4e 100644 --- a/src/mame/includes/8080bw.h +++ b/src/mame/includes/8080bw.h @@ -133,6 +133,12 @@ public: DECLARE_WRITE8_MEMBER(polaris_sh_port_3_w); void schaser_reinit_555_time_remain(); + void invadpt2_get_pens( pen_t *pens ); + void sflush_get_pens( pen_t *pens ); + void cosmo_get_pens( pen_t *pens ); + inline void set_pixel( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, pen_t *pens, UINT8 color ); + inline void set_8_pixels( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, pen_t *pens, UINT8 fore_color, UINT8 back_color ); + void clear_extra_columns( bitmap_rgb32 &bitmap, pen_t *pens, UINT8 color ); }; diff --git a/src/mame/includes/actfancr.h b/src/mame/includes/actfancr.h index 16db932a03e..1f94aa08e6f 100644 --- a/src/mame/includes/actfancr.h +++ b/src/mame/includes/actfancr.h @@ -34,6 +34,7 @@ public: DECLARE_MACHINE_START(triothep); DECLARE_MACHINE_RESET(triothep); UINT32 screen_update_actfancr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void register_savestate( ); }; diff --git a/src/mame/includes/aeroboto.h b/src/mame/includes/aeroboto.h index 57ed42a2a04..26cedfb9564 100644 --- a/src/mame/includes/aeroboto.h +++ b/src/mame/includes/aeroboto.h @@ -60,4 +60,5 @@ public: virtual void video_start(); UINT32 screen_update_aeroboto(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(aeroboto_interrupt); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/aerofgt.h b/src/mame/includes/aerofgt.h index 31cfc31ba6e..cdffec42b0f 100644 --- a/src/mame/includes/aerofgt.h +++ b/src/mame/includes/aerofgt.h @@ -111,4 +111,11 @@ public: UINT32 screen_update_aerfboot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_aerfboo2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void aerofgt_register_state_globals( ); + void setbank( tilemap_t *tmap, int num, int bank ); + void aerfboo2_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri ); + void pspikesb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void spikes91_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void aerfboot_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ); }; diff --git a/src/mame/includes/alpha68k.h b/src/mame/includes/alpha68k.h index 72c45b24822..44460b650cc 100644 --- a/src/mame/includes/alpha68k.h +++ b/src/mame/includes/alpha68k.h @@ -105,6 +105,15 @@ public: UINT32 screen_update_alpha68k_V(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_alpha68k_V_sb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(alpha68k_sound_nmi); + void alpha68k_flipscreen_w( int flip ); + void alpha68k_V_video_bank_w( int bank ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e ); + void draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask ); + void draw_sprites_I( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift ); + void kyros_video_banking(int *bank, int data); + void jongbou_video_banking(int *bank, int data); + void kyros_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d ); + void sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d ); }; /* game_id - used to deal with a few game specific situations */ @@ -116,6 +125,3 @@ enum }; -/*----------- defined in video/alpha68k.c -----------*/ -void alpha68k_V_video_bank_w(running_machine &machine, int bank); -void alpha68k_flipscreen_w(running_machine &machine, int flip); diff --git a/src/mame/includes/ambush.h b/src/mame/includes/ambush.h index 52eec510b00..a52af1153cd 100644 --- a/src/mame/includes/ambush.h +++ b/src/mame/includes/ambush.h @@ -26,4 +26,5 @@ public: DECLARE_WRITE8_MEMBER(flip_screen_w); virtual void palette_init(); UINT32 screen_update_ambush(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_chars( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); }; diff --git a/src/mame/includes/amspdwy.h b/src/mame/includes/amspdwy.h index 19ad6e2a821..66a18222d86 100644 --- a/src/mame/includes/amspdwy.h +++ b/src/mame/includes/amspdwy.h @@ -44,4 +44,6 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + UINT8 amspdwy_wheel_r( int index ); }; diff --git a/src/mame/includes/angelkds.h b/src/mame/includes/angelkds.h index c03d25762ac..d8663dbee28 100644 --- a/src/mame/includes/angelkds.h +++ b/src/mame/includes/angelkds.h @@ -60,4 +60,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_angelkds(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int enable_n); }; diff --git a/src/mame/includes/appoooh.h b/src/mame/includes/appoooh.h index 8bdb0a06587..ac2fca5e442 100644 --- a/src/mame/includes/appoooh.h +++ b/src/mame/includes/appoooh.h @@ -53,6 +53,8 @@ public: UINT32 screen_update_appoooh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_robowres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); + void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ); + void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ); }; #define CHR1_OFST 0x00 /* palette page of char set #1 */ diff --git a/src/mame/includes/aquarium.h b/src/mame/includes/aquarium.h index 041e7f899fd..d0b90f2c451 100644 --- a/src/mame/includes/aquarium.h +++ b/src/mame/includes/aquarium.h @@ -47,4 +47,6 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_aquarium(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ); + UINT8 aquarium_snd_bitswap( UINT8 scrambled_data ); }; diff --git a/src/mame/includes/arabian.h b/src/mame/includes/arabian.h index e5bf22cf106..d7269fbf51d 100644 --- a/src/mame/includes/arabian.h +++ b/src/mame/includes/arabian.h @@ -43,4 +43,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_arabian(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void blit_area( UINT8 plane, UINT16 src, UINT8 x, UINT8 y, UINT8 sx, UINT8 sy ); }; diff --git a/src/mame/includes/arcadecl.h b/src/mame/includes/arcadecl.h index 4bf0a6a74e0..bbcf4d2446d 100644 --- a/src/mame/includes/arcadecl.h +++ b/src/mame/includes/arcadecl.h @@ -24,4 +24,5 @@ public: DECLARE_MACHINE_RESET(arcadecl); DECLARE_VIDEO_START(arcadecl); UINT32 screen_update_arcadecl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void arcadecl_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/argus.h b/src/mame/includes/argus.h index bfcc4fccb3f..c35154894ec 100644 --- a/src/mame/includes/argus.h +++ b/src/mame/includes/argus.h @@ -85,4 +85,15 @@ public: UINT32 screen_update_butasan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(argus_scanline); TIMER_DEVICE_CALLBACK_MEMBER(butasan_scanline); + void reset_common(); + void argus_write_dummy_rams(int dramoffs, int vromoffs); + void argus_change_palette(int color, int lo_offs, int hi_offs); + void argus_change_bg_palette(int color, int lo_offs, int hi_offs); + void bg_setting(); + void argus_bg0_scroll_handle(); + void argus_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority); + void valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void butasan_log_vram(); }; diff --git a/src/mame/includes/arkanoid.h b/src/mame/includes/arkanoid.h index 69685c79690..7549498d049 100644 --- a/src/mame/includes/arkanoid.h +++ b/src/mame/includes/arkanoid.h @@ -85,4 +85,6 @@ public: UINT32 screen_update_arkanoid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_hexa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(test); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void arkanoid_bootleg_init( ); }; diff --git a/src/mame/includes/armedf.h b/src/mame/includes/armedf.h index 71111a30c68..066e0e17f18 100644 --- a/src/mame/includes/armedf.h +++ b/src/mame/includes/armedf.h @@ -80,6 +80,11 @@ public: DECLARE_VIDEO_START(terraf); DECLARE_VIDEO_START(armedf); UINT32 screen_update_armedf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); + void armedf_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, + UINT32 code,UINT32 color, UINT32 clut,int flipx,int flipy,int offsx,int offsy, + int transparent_color); + }; class bigfghtr_state : public armedf_state diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h index d71958cb246..9b40c95c4e3 100644 --- a/src/mame/includes/astrocde.h +++ b/src/mame/includes/astrocde.h @@ -125,6 +125,13 @@ public: TIMER_CALLBACK_MEMBER(interrupt_off); TIMER_CALLBACK_MEMBER(scanline_callback); void profbank_banksw_restore(); + inline int mame_vpos_to_astrocade_vpos(int scanline); + void init_savestate(); + void astrocade_trigger_lightpen(UINT8 vfeedback, UINT8 hfeedback); + inline void increment_source(UINT8 curwidth, UINT8 *u13ff); + inline void increment_dest(UINT8 curwidth); + void execute_blit(address_space &space); + void init_sparklestar(); }; /*----------- defined in audio/wow.c -----------*/ diff --git a/src/mame/includes/astrof.h b/src/mame/includes/astrof.h index 24218ffdeb6..68d42d046f3 100644 --- a/src/mame/includes/astrof.h +++ b/src/mame/includes/astrof.h @@ -71,6 +71,13 @@ public: UINT32 screen_update_astrof(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_tomahawk(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(irq_callback); + rgb_t make_pen( UINT8 data ); + void astrof_get_pens( pen_t *pens ); + void tomahawk_get_pens( pen_t *pens ); + void astrof_set_video_control_2( UINT8 data ); + void spfghmk2_set_video_control_2( UINT8 data ); + void tomahawk_set_video_control_2( UINT8 data ); + void video_update_common( bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens ); }; /*----------- defined in audio/astrof.c -----------*/ diff --git a/src/mame/includes/atarifb.h b/src/mame/includes/atarifb.h index 1219117a246..f08ee3aa895 100644 --- a/src/mame/includes/atarifb.h +++ b/src/mame/includes/atarifb.h @@ -82,6 +82,9 @@ public: UINT32 screen_update_atarifb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_abaseb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_soccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void get_tile_info_common( tile_data &tileinfo, tilemap_memory_index tile_index, UINT8 *alpha_videoram ); + void draw_playfield_and_alpha( bitmap_ind16 &bitmap, const rectangle &cliprect, int playfield_x_offset, int playfield_y_offset ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfx, int is_soccer ); }; /*----------- defined in audio/atarifb.c -----------*/ diff --git a/src/mame/includes/atarisy1.h b/src/mame/includes/atarisy1.h index 65ac1462b8c..e342c3141cf 100644 --- a/src/mame/includes/atarisy1.h +++ b/src/mame/includes/atarisy1.h @@ -70,6 +70,9 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(atarisy1_reset_yscroll_callback); TIMER_DEVICE_CALLBACK_MEMBER(atarisy1_int3off_callback); TIMER_DEVICE_CALLBACK_MEMBER(atarisy1_int3_callback); + void update_timers(int scanline); + void decode_gfx(UINT16 *pflookup, UINT16 *molookup); + int get_bank(UINT8 prom1, UINT8 prom2, int bpp); }; DECLARE_READ16_HANDLER( atarisy1_int3state_r ); diff --git a/src/mame/includes/aztarac.h b/src/mame/includes/aztarac.h index 4a01bc3c96d..64e498c0b6b 100644 --- a/src/mame/includes/aztarac.h +++ b/src/mame/includes/aztarac.h @@ -29,4 +29,5 @@ public: virtual void video_start(); INTERRUPT_GEN_MEMBER(aztarac_snd_timed_irq); IRQ_CALLBACK_MEMBER(aztarac_irq_callback); + inline void read_vectorram(UINT16 *vectorram, int addr, int *x, int *y, int *c); }; diff --git a/src/mame/includes/bagman.h b/src/mame/includes/bagman.h index 59699ccc535..792d34827d2 100644 --- a/src/mame/includes/bagman.h +++ b/src/mame/includes/bagman.h @@ -49,6 +49,7 @@ public: DECLARE_PALETTE_INIT(bagman); UINT32 screen_update_bagman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); }; /*----------- timings -----------*/ diff --git a/src/mame/includes/balsente.h b/src/mame/includes/balsente.h index 726727bff10..48aa2077b5e 100644 --- a/src/mame/includes/balsente.h +++ b/src/mame/includes/balsente.h @@ -201,6 +201,13 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(balsente_interrupt_timer); TIMER_DEVICE_CALLBACK_MEMBER(balsente_counter_callback); TIMER_DEVICE_CALLBACK_MEMBER(balsente_clock_counter_0_ff); + void draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sprite); + void poly17_init(); + void m6850_update_io(); + void set_counter_0_ff(timer_device &timer, int newstate); + void update_grudge_steering(); + void expand_roms(UINT8 cd_rom_mask); + inline void config_shooter_adc(UINT8 shooter, UINT8 adc_shift); }; diff --git a/src/mame/includes/baraduke.h b/src/mame/includes/baraduke.h index a2aba38f117..4a1f447e2af 100644 --- a/src/mame/includes/baraduke.h +++ b/src/mame/includes/baraduke.h @@ -40,4 +40,7 @@ public: virtual void palette_init(); UINT32 screen_update_baraduke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_baraduke(screen_device &screen, bool state); + void scroll_w(address_space &space, int layer, int offset, int data); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_priority); + void set_scroll(int layer); }; diff --git a/src/mame/includes/battlane.h b/src/mame/includes/battlane.h index ab57b4e6c82..7db769be25d 100644 --- a/src/mame/includes/battlane.h +++ b/src/mame/includes/battlane.h @@ -40,4 +40,6 @@ public: virtual void video_start(); UINT32 screen_update_battlane(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(battlane_cpu1_interrupt); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_fg_bitmap( bitmap_ind16 &bitmap ); }; diff --git a/src/mame/includes/battlera.h b/src/mame/includes/battlera.h index e996506bcb2..4742b85ced0 100644 --- a/src/mame/includes/battlera.h +++ b/src/mame/includes/battlera.h @@ -42,4 +42,5 @@ public: virtual void video_start(); UINT32 screen_update_battlera(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(battlera_irq); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &clip,int pri); }; diff --git a/src/mame/includes/battlex.h b/src/mame/includes/battlex.h index 4bff1294a34..db5d0632655 100644 --- a/src/mame/includes/battlex.h +++ b/src/mame/includes/battlex.h @@ -37,4 +37,5 @@ public: virtual void video_start(); UINT32 screen_update_battlex(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(battlex_interrupt); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/bbusters.h b/src/mame/includes/bbusters.h index 89375678686..19f07c49cad 100644 --- a/src/mame/includes/bbusters.h +++ b/src/mame/includes/bbusters.h @@ -57,4 +57,7 @@ public: UINT32 screen_update_bbuster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mechatt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_bbuster(screen_device &screen, bool state); + inline const UINT8 *get_source_ptr(gfx_element *gfx, UINT32 sprite, int dx, int dy, int block); + void bbusters_draw_block(bitmap_ind16 &dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block); + void draw_sprites(bitmap_ind16 &bitmap, const UINT16 *source, int bank, int colval, int colmask); }; diff --git a/src/mame/includes/bigevglf.h b/src/mame/includes/bigevglf.h index b241e1493d9..77a1255ea7b 100644 --- a/src/mame/includes/bigevglf.h +++ b/src/mame/includes/bigevglf.h @@ -93,4 +93,5 @@ public: TIMER_CALLBACK_MEMBER(from_sound_latch_callback); TIMER_CALLBACK_MEMBER(nmi_callback); TIMER_CALLBACK_MEMBER(deferred_ls74_w); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/bigstrkb.h b/src/mame/includes/bigstrkb.h index ee2a0908012..77d3571916c 100644 --- a/src/mame/includes/bigstrkb.h +++ b/src/mame/includes/bigstrkb.h @@ -31,4 +31,5 @@ public: TILE_GET_INFO_MEMBER(get_bsb_tile3_info); virtual void video_start(); UINT32 screen_update_bigstrkb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/bionicc.h b/src/mame/includes/bionicc.h index b5f085786f4..c1da8571c44 100644 --- a/src/mame/includes/bionicc.h +++ b/src/mame/includes/bionicc.h @@ -52,4 +52,5 @@ public: virtual void video_start(); UINT32 screen_update_bionicc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(bionicc_scanline); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/blktiger.h b/src/mame/includes/blktiger.h index 4bfb734d0e4..5f23c4a7a7e 100644 --- a/src/mame/includes/blktiger.h +++ b/src/mame/includes/blktiger.h @@ -63,4 +63,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_blktiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/blmbycar.h b/src/mame/includes/blmbycar.h index d6e1a19a8a4..145a7c9d0ad 100644 --- a/src/mame/includes/blmbycar.h +++ b/src/mame/includes/blmbycar.h @@ -50,4 +50,5 @@ public: DECLARE_MACHINE_START(watrball); DECLARE_MACHINE_RESET(watrball); UINT32 screen_update_blmbycar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/blockout.h b/src/mame/includes/blockout.h index 4eb9b80da82..fd42bc03caf 100644 --- a/src/mame/includes/blockout.h +++ b/src/mame/includes/blockout.h @@ -37,4 +37,6 @@ public: virtual void video_start(); UINT32 screen_update_blockout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(blockout_scanline); + void setcolor( int color, int rgb ); + void update_pixels( int x, int y ); }; diff --git a/src/mame/includes/bloodbro.h b/src/mame/includes/bloodbro.h index 2eb598b892c..7de7beda456 100644 --- a/src/mame/includes/bloodbro.h +++ b/src/mame/includes/bloodbro.h @@ -29,4 +29,6 @@ public: UINT32 screen_update_bloodbro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_weststry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_skysmash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void bloodbro_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void weststry_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/blueprnt.h b/src/mame/includes/blueprnt.h index a93a3c1dac3..e96f8c9e8b2 100644 --- a/src/mame/includes/blueprnt.h +++ b/src/mame/includes/blueprnt.h @@ -44,4 +44,5 @@ public: DECLARE_VIDEO_START(blueprnt); virtual void palette_init(); UINT32 screen_update_blueprnt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/bogeyman.h b/src/mame/includes/bogeyman.h index 998cf988b6c..1f2d3d89578 100644 --- a/src/mame/includes/bogeyman.h +++ b/src/mame/includes/bogeyman.h @@ -46,4 +46,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/bombjack.h b/src/mame/includes/bombjack.h index 992d6ee3bb3..4d7d0522a15 100644 --- a/src/mame/includes/bombjack.h +++ b/src/mame/includes/bombjack.h @@ -42,4 +42,5 @@ public: UINT32 screen_update_bombjack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); TIMER_CALLBACK_MEMBER(soundlatch_callback); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/boogwing.h b/src/mame/includes/boogwing.h index f91640f7ec1..7c4271860a6 100644 --- a/src/mame/includes/boogwing.h +++ b/src/mame/includes/boogwing.h @@ -54,4 +54,5 @@ public: DECLARE_DRIVER_INIT(boogwing); virtual void video_start(); UINT32 screen_update_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void mix_boogwing(bitmap_rgb32 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/brkthru.h b/src/mame/includes/brkthru.h index 5bc0f75c399..b3efb7e5ae5 100644 --- a/src/mame/includes/brkthru.h +++ b/src/mame/includes/brkthru.h @@ -47,4 +47,6 @@ public: virtual void palette_init(); UINT32 screen_update_brkthru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); + void show_register( bitmap_ind16 &bitmap, int x, int y, UINT32 data ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int prio ); }; diff --git a/src/mame/includes/bsktball.h b/src/mame/includes/bsktball.h index 7df39d849a1..df207e28d0a 100644 --- a/src/mame/includes/bsktball.h +++ b/src/mame/includes/bsktball.h @@ -62,6 +62,7 @@ public: DECLARE_WRITE8_MEMBER(bsktball_bounce_w); DECLARE_WRITE8_MEMBER(bsktball_note_w); DECLARE_WRITE8_MEMBER(bsktball_noise_reset_w); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; /*----------- defined in audio/bsktball.c -----------*/ diff --git a/src/mame/includes/btime.h b/src/mame/includes/btime.h index 596d324353e..e0659320301 100644 --- a/src/mame/includes/btime.h +++ b/src/mame/includes/btime.h @@ -116,4 +116,10 @@ public: UINT32 screen_update_zoar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_disco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(audio_nmi_gen); + void draw_chars( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 transparency, UINT8 color, int priority ); + void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* tmap, UINT8 color ); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 color, + UINT8 sprite_y_adjust, UINT8 sprite_y_adjust_flip_screen, + UINT8 *sprite_ram, offs_t interleave ); + }; diff --git a/src/mame/includes/bublbobl.h b/src/mame/includes/bublbobl.h index 4f6f151470b..0082e93a443 100644 --- a/src/mame/includes/bublbobl.h +++ b/src/mame/includes/bublbobl.h @@ -112,4 +112,5 @@ public: INTERRUPT_GEN_MEMBER(bublbobl_m68705_interrupt); TIMER_CALLBACK_MEMBER(nmi_callback); TIMER_CALLBACK_MEMBER(bublbobl_m68705_irq_ack); + void configure_banks( ); }; diff --git a/src/mame/includes/buggychl.h b/src/mame/includes/buggychl.h index 090289a92ae..f5f63ee5bad 100644 --- a/src/mame/includes/buggychl.h +++ b/src/mame/includes/buggychl.h @@ -57,4 +57,8 @@ public: virtual void palette_init(); UINT32 screen_update_buggychl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(nmi_callback); + void draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_bg( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/bwing.h b/src/mame/includes/bwing.h index 41b7cfe24ef..edbdbf3e060 100644 --- a/src/mame/includes/bwing.h +++ b/src/mame/includes/bwing.h @@ -76,6 +76,9 @@ public: virtual void video_start(); UINT32 screen_update_bwing(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(bwp3_interrupt); + void fill_srxlat( int *xlat ); + void draw_sprites( bitmap_ind16 &bmp, const rectangle &clip, UINT8 *ram, int pri ); + void fix_bwp3( ); }; /*----------- defined in video/bwing.c -----------*/ diff --git a/src/mame/machine/balsente.c b/src/mame/machine/balsente.c index 11a44736d8c..ded7a0732e6 100644 --- a/src/mame/machine/balsente.c +++ b/src/mame/machine/balsente.c @@ -14,14 +14,6 @@ #define LOG_CEM_WRITES 0 - -/* local prototypes */ -static void poly17_init(running_machine &machine); -static void update_grudge_steering(running_machine &machine); - - - - /************************************* * * Interrupt handling @@ -50,7 +42,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::balsente_interrupt_timer) /* if this is Grudge Match, update the steering */ if (m_grudge_steering_result & 0x80) - update_grudge_steering(machine()); + update_grudge_steering(); /* if we're a shooter, we do a little more work */ if (m_shooter) @@ -85,7 +77,7 @@ void balsente_state::machine_start() m_cem_device[5] = m_cem6; /* create the polynomial tables */ - poly17_init(machine()); + poly17_init(); /* register for saving */ for (i = 0; i < 3; i++) @@ -190,15 +182,14 @@ void balsente_state::machine_reset() * *************************************/ -static void poly17_init(running_machine &machine) +void balsente_state::poly17_init() { - balsente_state *state = machine.driver_data(); UINT32 i, x = 0; UINT8 *p, *r; /* allocate memory */ - p = state->m_poly17; - r = state->m_rand17; + p = m_poly17; + r = m_rand17; /* generate the polynomial */ for (i = 0; i < POLY17_SIZE; i++) @@ -337,88 +328,87 @@ WRITE8_MEMBER(balsente_state::balsente_misc_output_w) * *************************************/ -static void m6850_update_io(running_machine &machine) +void balsente_state::m6850_update_io() { - balsente_state *state = machine.driver_data(); UINT8 new_state; /* sound -> main CPU communications */ - if (!(state->m_m6850_sound_status & 0x02)) + if (!(m_m6850_sound_status & 0x02)) { /* set the overrun bit if the data in the destination hasn't been read yet */ - if (state->m_m6850_status & 0x01) - state->m_m6850_status |= 0x20; + if (m_m6850_status & 0x01) + m_m6850_status |= 0x20; /* copy the sound's output to our input */ - state->m_m6850_input = state->m_m6850_sound_output; + m_m6850_input = m_m6850_sound_output; /* set the receive register full bit */ - state->m_m6850_status |= 0x01; + m_m6850_status |= 0x01; /* set the sound's trasmitter register empty bit */ - state->m_m6850_sound_status |= 0x02; + m_m6850_sound_status |= 0x02; } /* main -> sound CPU communications */ - if (state->m_m6850_data_ready) + if (m_m6850_data_ready) { /* set the overrun bit if the data in the destination hasn't been read yet */ - if (state->m_m6850_sound_status & 0x01) - state->m_m6850_sound_status |= 0x20; + if (m_m6850_sound_status & 0x01) + m_m6850_sound_status |= 0x20; /* copy the main CPU's output to our input */ - state->m_m6850_sound_input = state->m_m6850_output; + m_m6850_sound_input = m_m6850_output; /* set the receive register full bit */ - state->m_m6850_sound_status |= 0x01; + m_m6850_sound_status |= 0x01; /* set the main CPU's trasmitter register empty bit */ - state->m_m6850_status |= 0x02; - state->m_m6850_data_ready = 0; + m_m6850_status |= 0x02; + m_m6850_data_ready = 0; } /* check for reset states */ - if ((state->m_m6850_control & 3) == 3) + if ((m_m6850_control & 3) == 3) { - state->m_m6850_status = 0x02; - state->m_m6850_data_ready = 0; + m_m6850_status = 0x02; + m_m6850_data_ready = 0; } - if ((state->m_m6850_sound_control & 3) == 3) - state->m_m6850_sound_status = 0x02; + if ((m_m6850_sound_control & 3) == 3) + m_m6850_sound_status = 0x02; /* check for transmit/receive IRQs on the main CPU */ new_state = 0; - if ((state->m_m6850_control & 0x80) && (state->m_m6850_status & 0x21)) new_state = 1; - if ((state->m_m6850_control & 0x60) == 0x20 && (state->m_m6850_status & 0x02)) new_state = 1; + if ((m_m6850_control & 0x80) && (m_m6850_status & 0x21)) new_state = 1; + if ((m_m6850_control & 0x60) == 0x20 && (m_m6850_status & 0x02)) new_state = 1; /* apply the change */ - if (new_state && !(state->m_m6850_status & 0x80)) + if (new_state && !(m_m6850_status & 0x80)) { - machine.device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); - state->m_m6850_status |= 0x80; + machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); + m_m6850_status |= 0x80; } - else if (!new_state && (state->m_m6850_status & 0x80)) + else if (!new_state && (m_m6850_status & 0x80)) { - machine.device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); - state->m_m6850_status &= ~0x80; + machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); + m_m6850_status &= ~0x80; } /* check for transmit/receive IRQs on the sound CPU */ new_state = 0; - if ((state->m_m6850_sound_control & 0x80) && (state->m_m6850_sound_status & 0x21)) new_state = 1; - if ((state->m_m6850_sound_control & 0x60) == 0x20 && (state->m_m6850_sound_status & 0x02)) new_state = 1; - if (!(state->m_counter_control & 0x20)) new_state = 0; + if ((m_m6850_sound_control & 0x80) && (m_m6850_sound_status & 0x21)) new_state = 1; + if ((m_m6850_sound_control & 0x60) == 0x20 && (m_m6850_sound_status & 0x02)) new_state = 1; + if (!(m_counter_control & 0x20)) new_state = 0; /* apply the change */ - if (new_state && !(state->m_m6850_sound_status & 0x80)) + if (new_state && !(m_m6850_sound_status & 0x80)) { - machine.device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - state->m_m6850_sound_status |= 0x80; + machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_m6850_sound_status |= 0x80; } - else if (!new_state && (state->m_m6850_sound_status & 0x80)) + else if (!new_state && (m_m6850_sound_status & 0x80)) { - machine.device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - state->m_m6850_sound_status &= ~0x80; + machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_m6850_sound_status &= ~0x80; } } @@ -447,7 +437,7 @@ READ8_MEMBER(balsente_state::balsente_m6850_r) /* clear the overrun and receive buffer full bits */ m_m6850_status &= ~0x21; - m6850_update_io(machine()); + m6850_update_io(); } return result; @@ -459,7 +449,7 @@ TIMER_CALLBACK_MEMBER(balsente_state::m6850_data_ready_callback) /* set the output data byte and indicate that we're ready to go */ m_m6850_output = param; m_m6850_data_ready = 1; - m6850_update_io(machine()); + m6850_update_io(); } @@ -467,7 +457,7 @@ TIMER_CALLBACK_MEMBER(balsente_state::m6850_w_callback) { /* indicate that the transmit buffer is no longer empty and update the I/O state */ m_m6850_status &= ~0x02; - m6850_update_io(machine()); + m6850_update_io(); /* set a timer for 500usec later to actually transmit the data */ /* (this is very important for several games, esp Snacks'n Jaxson) */ @@ -483,7 +473,7 @@ WRITE8_MEMBER(balsente_state::balsente_m6850_w) m_m6850_control = data; /* re-update since interrupt enables could have been modified */ - m6850_update_io(machine()); + m6850_update_io(); } /* output register is at offset 1; set a timer to synchronize the CPUs */ @@ -516,7 +506,7 @@ READ8_MEMBER(balsente_state::balsente_m6850_sound_r) /* clear the overrun and receive buffer full bits */ m_m6850_sound_status &= ~0x21; - m6850_update_io(machine()); + m6850_update_io(); } return result; @@ -537,7 +527,7 @@ WRITE8_MEMBER(balsente_state::balsente_m6850_sound_w) } /* re-update since interrupt enables could have been modified */ - m6850_update_io(machine()); + m6850_update_io(); } @@ -846,24 +836,22 @@ WRITE8_MEMBER(balsente_state::balsente_counter_8253_w) * *************************************/ -static void set_counter_0_ff(timer_device &timer, int newstate) +void balsente_state::set_counter_0_ff(timer_device &timer, int newstate) { - balsente_state *state = timer.machine().driver_data(); - /* the flip/flop output is inverted, so if we went high to low, that's a clock */ - if (state->m_counter_0_ff && !newstate) + if (m_counter_0_ff && !newstate) { /* only count if gated and non-zero */ - if (state->m_counter[0].count > 0 && state->m_counter[0].gate) + if (m_counter[0].count > 0 && m_counter[0].gate) { - state->m_counter[0].count--; - if (state->m_counter[0].count == 0) - state->balsente_counter_callback(timer, NULL, 0); + m_counter[0].count--; + if (m_counter[0].count == 0) + balsente_counter_callback(timer, NULL, 0); } } /* remember the new state */ - state->m_counter_0_ff = newstate; + m_counter_0_ff = newstate; } @@ -967,7 +955,7 @@ WRITE8_MEMBER(balsente_state::balsente_counter_control_w) if (!(data & 0x10)) set_counter_0_ff(*m_counter_0_timer, 0); /* bit 5 clears the NMI interrupt; recompute the I/O state now */ - m6850_update_io(machine()); + m6850_update_io(); } @@ -1113,43 +1101,42 @@ READ8_MEMBER(balsente_state::spiker_expand_r) } -static void update_grudge_steering(running_machine &machine) +void balsente_state::update_grudge_steering() { - balsente_state *state = machine.driver_data(); UINT8 wheel[3]; INT8 diff[3]; /* read the current steering values */ - wheel[0] = state->ioport("AN0")->read(); - wheel[1] = state->ioport("AN1")->read(); - wheel[2] = state->ioport("AN2")->read(); + wheel[0] = ioport("AN0")->read(); + wheel[1] = ioport("AN1")->read(); + wheel[2] = ioport("AN2")->read(); /* diff the values */ - diff[0] = wheel[0] - state->m_grudge_last_steering[0]; - diff[1] = wheel[1] - state->m_grudge_last_steering[1]; - diff[2] = wheel[2] - state->m_grudge_last_steering[2]; + diff[0] = wheel[0] - m_grudge_last_steering[0]; + diff[1] = wheel[1] - m_grudge_last_steering[1]; + diff[2] = wheel[2] - m_grudge_last_steering[2]; /* update the last values */ - state->m_grudge_last_steering[0] += diff[0]; - state->m_grudge_last_steering[1] += diff[1]; - state->m_grudge_last_steering[2] += diff[2]; + m_grudge_last_steering[0] += diff[0]; + m_grudge_last_steering[1] += diff[1]; + m_grudge_last_steering[2] += diff[2]; /* compute the result */ - state->m_grudge_steering_result = 0xff; + m_grudge_steering_result = 0xff; if (diff[0]) { - state->m_grudge_steering_result ^= 0x01; - if (diff[0] > 0) state->m_grudge_steering_result ^= 0x02; + m_grudge_steering_result ^= 0x01; + if (diff[0] > 0) m_grudge_steering_result ^= 0x02; } if (diff[1]) { - state->m_grudge_steering_result ^= 0x04; - if (diff[1] > 0) state->m_grudge_steering_result ^= 0x08; + m_grudge_steering_result ^= 0x04; + if (diff[1] > 0) m_grudge_steering_result ^= 0x08; } if (diff[2]) { - state->m_grudge_steering_result ^= 0x10; - if (diff[2] > 0) state->m_grudge_steering_result ^= 0x20; + m_grudge_steering_result ^= 0x10; + if (diff[2] > 0) m_grudge_steering_result ^= 0x20; } logerror("Recomputed steering\n"); } diff --git a/src/mame/video/1942.c b/src/mame/video/1942.c index 2aefa9bc9af..3b60e0289b1 100644 --- a/src/mame/video/1942.c +++ b/src/mame/video/1942.c @@ -187,23 +187,22 @@ WRITE8_MEMBER(_1942_state::c1942_c804_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void _1942_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - _1942_state *state = machine.driver_data<_1942_state>(); int offs; - for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) { int i, code, col, sx, sy, dir; - code = (state->m_spriteram[offs] & 0x7f) + 4 * (state->m_spriteram[offs + 1] & 0x20) - + 2 * (state->m_spriteram[offs] & 0x80); - col = state->m_spriteram[offs + 1] & 0x0f; - sx = state->m_spriteram[offs + 3] - 0x10 * (state->m_spriteram[offs + 1] & 0x10); - sy = state->m_spriteram[offs + 2]; + code = (m_spriteram[offs] & 0x7f) + 4 * (m_spriteram[offs + 1] & 0x20) + + 2 * (m_spriteram[offs] & 0x80); + col = m_spriteram[offs + 1] & 0x0f; + sx = m_spriteram[offs + 3] - 0x10 * (m_spriteram[offs + 1] & 0x10); + sy = m_spriteram[offs + 2]; dir = 1; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -211,15 +210,15 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } /* handle double / quadruple height */ - i = (state->m_spriteram[offs + 1] & 0xc0) >> 6; + i = (m_spriteram[offs + 1] & 0xc0) >> 6; if (i == 2) i = 3; do { - drawgfx_transpen(bitmap,cliprect,machine.gfx[2], + drawgfx_transpen(bitmap,cliprect,machine().gfx[2], code + i,col, - state->flip_screen(),state->flip_screen(), + flip_screen(),flip_screen(), sx,sy + 16 * i * dir,15); i--; @@ -232,7 +231,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 _1942_state::screen_update_1942(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; } diff --git a/src/mame/video/1943.c b/src/mame/video/1943.c index d13cf4e0c0d..fe4d9083851 100644 --- a/src/mame/video/1943.c +++ b/src/mame/video/1943.c @@ -212,20 +212,19 @@ void _1943_state::video_start() save_item(NAME(m_bg2_on)); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) +void _1943_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { - _1943_state *state = machine.driver_data<_1943_state>(); int offs; - for (offs = state->m_spriteram.bytes() - 32; offs >= 0; offs -= 32) + for (offs = m_spriteram.bytes() - 32; offs >= 0; offs -= 32) { - int attr = state->m_spriteram[offs + 1]; - int code = state->m_spriteram[offs] + ((attr & 0xe0) << 3); + int attr = m_spriteram[offs + 1]; + int code = m_spriteram[offs] + ((attr & 0xe0) << 3); int color = attr & 0x0f; - int sx = state->m_spriteram[offs + 3] - ((attr & 0x10) << 4); - int sy = state->m_spriteram[offs + 2]; + int sx = m_spriteram[offs + 3] - ((attr & 0x10) << 4); + int sy = m_spriteram[offs + 2]; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -235,12 +234,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (priority) { if (color != 0x0a && color != 0x0b) - drawgfx_transpen(bitmap, cliprect, machine.gfx[3], code, color, state->flip_screen(), state->flip_screen(), sx, sy, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[3], code, color, flip_screen(), flip_screen(), sx, sy, 0); } else { if (color == 0x0a || color == 0x0b) - drawgfx_transpen(bitmap, cliprect, machine.gfx[3], code, color, state->flip_screen(), state->flip_screen(), sx, sy, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[3], code, color, flip_screen(), flip_screen(), sx, sy, 0); } } } @@ -257,13 +256,13 @@ UINT32 _1943_state::screen_update_1943(screen_device &screen, bitmap_ind16 &bitm bitmap.fill(get_black_pen(machine()), cliprect); if (m_obj_on) - draw_sprites(machine(), bitmap, cliprect, 0); + draw_sprites(bitmap, cliprect, 0); if (m_bg1_on) m_bg_tilemap->draw(bitmap, cliprect, 0, 0); if (m_obj_on) - draw_sprites(machine(), bitmap, cliprect, 1); + draw_sprites(bitmap, cliprect, 1); if (m_char_on) m_fg_tilemap->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/20pacgal.c b/src/mame/video/20pacgal.c index e133a076f72..a0b90bb9fc6 100644 --- a/src/mame/video/20pacgal.c +++ b/src/mame/video/20pacgal.c @@ -22,10 +22,10 @@ * *************************************/ -static void get_pens(running_machine &machine, const _20pacgal_state *state, pen_t *pens) +void _20pacgal_state::get_pens(pen_t *pens) { offs_t offs; - UINT8 *color_prom = machine.root_device().memregion("proms")->base() + (NUM_PENS * state->m_game_selected); + UINT8 *color_prom = machine().root_device().memregion("proms")->base() + (NUM_PENS * m_game_selected); for (offs = 0; offs < NUM_PENS ;offs++) { @@ -73,12 +73,12 @@ static void get_pens(running_machine &machine, const _20pacgal_state *state, pen } -static void do_pen_lookup(running_machine &machine, const _20pacgal_state *state, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void _20pacgal_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int y, x; pen_t pens[NUM_PENS + NUM_STAR_PENS]; - get_pens(machine, state, pens); + get_pens(pens); for (y = cliprect.min_y; y <= cliprect.max_y; y++) for(x = cliprect.min_x; x <= cliprect.max_x; x++) @@ -93,13 +93,13 @@ static void do_pen_lookup(running_machine &machine, const _20pacgal_state *state * *************************************/ -static void draw_sprite(running_machine& machine, const _20pacgal_state *state, bitmap_rgb32 &bitmap, int y, int x, +void _20pacgal_state::draw_sprite(bitmap_rgb32 &bitmap, int y, int x, UINT8 code, UINT8 color, int flip_y, int flip_x) { int sy; offs_t pen_base = (color & 0x1f) << 2; - pen_base += state->m_sprite_pal_base; + pen_base += m_sprite_pal_base; if (flip_y) y = y + 0x0f; @@ -122,10 +122,10 @@ static void draw_sprite(running_machine& machine, const _20pacgal_state *state, /* address mangling */ gfx_offs = (gfx_offs & 0x1f83) | ((gfx_offs & 0x003c) << 1) | ((gfx_offs & 0x0040) >> 4); - data = (state->m_sprite_gfx_ram[gfx_offs + 0] << 24) | - (state->m_sprite_gfx_ram[gfx_offs + 1] << 16) | - (state->m_sprite_gfx_ram[gfx_offs + 2] << 8) | - (state->m_sprite_gfx_ram[gfx_offs + 3] << 0); + data = (m_sprite_gfx_ram[gfx_offs + 0] << 24) | + (m_sprite_gfx_ram[gfx_offs + 1] << 16) | + (m_sprite_gfx_ram[gfx_offs + 2] << 8) | + (m_sprite_gfx_ram[gfx_offs + 3] << 0); /* for each pixel in the row */ for (sx = 0; sx < 0x10; sx++) @@ -135,7 +135,7 @@ static void draw_sprite(running_machine& machine, const _20pacgal_state *state, offs_t pen = (data & 0xc0000000) >> 30; UINT8 col; - col = state->m_sprite_color_lookup[pen_base | pen] & 0x0f; + col = m_sprite_color_lookup[pen_base | pen] & 0x0f; /* pen bits A0-A3 */ if (col) @@ -163,7 +163,7 @@ static void draw_sprite(running_machine& machine, const _20pacgal_state *state, } -static void draw_sprites(running_machine& machine,const _20pacgal_state *state, bitmap_rgb32 &bitmap) +void _20pacgal_state::draw_sprites(bitmap_rgb32 &bitmap) { int offs; @@ -176,22 +176,22 @@ static void draw_sprites(running_machine& machine,const _20pacgal_state *state, }; int x, y; - UINT8 code = state->m_sprite_ram[offs + 0x000]; - UINT8 color = state->m_sprite_ram[offs + 0x001]; + UINT8 code = m_sprite_ram[offs + 0x000]; + UINT8 color = m_sprite_ram[offs + 0x001]; - int sx = state->m_sprite_ram[offs + 0x081] - 41 + 0x100*(state->m_sprite_ram[offs + 0x101] & 3); - int sy = 256 - state->m_sprite_ram[offs + 0x080] + 1; + int sx = m_sprite_ram[offs + 0x081] - 41 + 0x100*(m_sprite_ram[offs + 0x101] & 3); + int sy = 256 - m_sprite_ram[offs + 0x080] + 1; - int flip_x = (state->m_sprite_ram[offs + 0x100] & 0x01) >> 0; - int flip_y = (state->m_sprite_ram[offs + 0x100] & 0x02) >> 1; - int size_x = (state->m_sprite_ram[offs + 0x100] & 0x04) >> 2; - int size_y = (state->m_sprite_ram[offs + 0x100] & 0x08) >> 3; + int flip_x = (m_sprite_ram[offs + 0x100] & 0x01) >> 0; + int flip_y = (m_sprite_ram[offs + 0x100] & 0x02) >> 1; + int size_x = (m_sprite_ram[offs + 0x100] & 0x04) >> 2; + int size_y = (m_sprite_ram[offs + 0x100] & 0x08) >> 3; sy = sy - (16 * size_y); sy = (sy & 0xff) - 32; /* fix wraparound */ /* only Galaga appears to be effected by the global flip state */ - if (state->m_game_selected && (state->m_flip[0] & 0x01)) + if (m_game_selected && (m_flip[0] & 0x01)) { flip_x = !flip_x; flip_y = !flip_y; @@ -199,7 +199,7 @@ static void draw_sprites(running_machine& machine,const _20pacgal_state *state, for (y = 0; y <= size_y; y++) for (x = 0; x <= size_x; x++) - draw_sprite(machine,state, bitmap, + draw_sprite(bitmap, sy + (16 * y), sx + (16 * x), code + code_offs[y ^ (size_y * flip_y)][x ^ (size_x * flip_x)], color, @@ -215,11 +215,11 @@ static void draw_sprites(running_machine& machine,const _20pacgal_state *state, * *************************************/ -static void draw_chars(const _20pacgal_state *state, bitmap_rgb32 &bitmap) +void _20pacgal_state::draw_chars(bitmap_rgb32 &bitmap) { offs_t offs; - int flip = state->m_flip[0] & 0x01; + int flip = m_flip[0] & 0x01; /* for each byte in the video RAM */ for (offs = 0; offs < 0x400; offs++) @@ -227,8 +227,8 @@ static void draw_chars(const _20pacgal_state *state, bitmap_rgb32 &bitmap) int sy; int y, x; - UINT8 *gfx = &state->m_char_gfx_ram.target()[state->m_video_ram[0x0000 | offs] << 4]; - UINT32 color_base = (state->m_video_ram[0x0400 | offs] & 0x3f) << 2; + UINT8 *gfx = &m_char_gfx_ram.target()[m_video_ram[0x0000 | offs] << 4]; + UINT32 color_base = (m_video_ram[0x0400 | offs] & 0x3f) << 2; /* map the offset to (x, y) character coordinates */ if ((offs & 0x03c0) == 0) @@ -349,15 +349,15 @@ static void draw_chars(const _20pacgal_state *state, bitmap_rgb32 &bitmap) * */ -static void draw_stars(_20pacgal_state *state, bitmap_rgb32 &bitmap, const rectangle &cliprect ) +void _20pacgal_state::draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect ) { - if ( (state->m_stars_ctrl[0] >> 5) & 1 ) + if ( (m_stars_ctrl[0] >> 5) & 1 ) { int clock; - UINT16 lfsr = state->m_stars_seed[0] + state->m_stars_seed[1]*256; - UINT8 feedback = (state->m_stars_ctrl[0] >> 6) & 1; - UINT16 star_seta = (state->m_stars_ctrl[0] >> 3) & 0x01; - UINT16 star_setb = (state->m_stars_ctrl[0] >> 3) & 0x02; + UINT16 lfsr = m_stars_seed[0] + m_stars_seed[1]*256; + UINT8 feedback = (m_stars_ctrl[0] >> 6) & 1; + UINT16 star_seta = (m_stars_ctrl[0] >> 3) & 0x01; + UINT16 star_setb = (m_stars_ctrl[0] >> 3) & 0x02; int cnt = 0; /* This is a guess based on galaga star sets */ @@ -409,10 +409,10 @@ static void draw_stars(_20pacgal_state *state, bitmap_rgb32 &bitmap, const recta UINT32 _20pacgal_state::screen_update_20pacgal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { bitmap.fill(0, cliprect); - draw_stars(this, bitmap,cliprect); - draw_chars(this, bitmap); - draw_sprites(machine(),this, bitmap); - do_pen_lookup(machine(), this, bitmap, cliprect); + draw_stars(bitmap,cliprect); + draw_chars(bitmap); + draw_sprites(bitmap); + do_pen_lookup(bitmap, cliprect); return 0; } diff --git a/src/mame/video/40love.c b/src/mame/video/40love.c index 5a6c225fc34..6d59b3ce507 100644 --- a/src/mame/video/40love.c +++ b/src/mame/video/40love.c @@ -131,13 +131,12 @@ void fortyl_state::video_start() ***************************************************************************/ -static void fortyl_set_scroll_x( running_machine &machine, int offset ) +void fortyl_state::fortyl_set_scroll_x( int offset ) { - fortyl_state *state = machine.driver_data(); int i = offset & ~1; - int x = ((state->m_colorram[i] & 0x80) << 1) | state->m_colorram[i + 1]; /* 9 bits signed */ + int x = ((m_colorram[i] & 0x80) << 1) | m_colorram[i + 1]; /* 9 bits signed */ - if (state->m_flipscreen) + if (m_flipscreen) x += 0x51; else x -= 0x50; @@ -145,7 +144,7 @@ static void fortyl_set_scroll_x( running_machine &machine, int offset ) x &= 0x1ff; if (x & 0x100) x -= 0x200; /* sign extend */ - state->m_bg_tilemap->set_scrollx(offset / 2, x); + m_bg_tilemap->set_scrollx(offset / 2, x); } WRITE8_MEMBER(fortyl_state::fortyl_pixram_sel_w) @@ -162,7 +161,7 @@ WRITE8_MEMBER(fortyl_state::fortyl_pixram_sel_w) m_pix_redraw = 1; for (offs = 0; offs < 32; offs++) - fortyl_set_scroll_x(machine(), offs * 2); + fortyl_set_scroll_x(offs * 2); } } @@ -174,32 +173,31 @@ READ8_MEMBER(fortyl_state::fortyl_pixram_r) return m_pixram1[offset]; } -static void fortyl_plot_pix( running_machine &machine, int offset ) +void fortyl_state::fortyl_plot_pix( int offset ) { - fortyl_state *state = machine.driver_data(); int x, y, i, c, d1, d2; x = (offset & 0x1f) * 8; y = (offset >> 5) & 0xff; - if (state->m_pixram_sel) + if (m_pixram_sel) { - d1 = state->m_pixram2[offset]; - d2 = state->m_pixram2[offset + 0x2000]; + d1 = m_pixram2[offset]; + d2 = m_pixram2[offset + 0x2000]; } else { - d1 = state->m_pixram1[offset]; - d2 = state->m_pixram1[offset + 0x2000]; + d1 = m_pixram1[offset]; + d2 = m_pixram1[offset + 0x2000]; } for (i = 0; i < 8; i++) { c = ((d2 >> i) & 1) + ((d1 >> i) & 1) * 2; - if (state->m_pixram_sel) - state->m_tmp_bitmap2->pix16(y, x + i) = state->m_pix_color[c]; + if (m_pixram_sel) + m_tmp_bitmap2->pix16(y, x + i) = m_pix_color[c]; else - state->m_tmp_bitmap1->pix16(y, x + i) = state->m_pix_color[c]; + m_tmp_bitmap1->pix16(y, x + i) = m_pix_color[c]; } } @@ -210,7 +208,7 @@ WRITE8_MEMBER(fortyl_state::fortyl_pixram_w) else m_pixram1[offset] = data; - fortyl_plot_pix(machine(), offset & 0x1fff); + fortyl_plot_pix(offset & 0x1fff); } @@ -235,7 +233,7 @@ WRITE8_MEMBER(fortyl_state::fortyl_bg_colorram_w) for (i = (offset / 2) * 64; i < (offset / 2) * 64 + 64; i++) m_bg_tilemap->mark_tile_dirty(i); - fortyl_set_scroll_x(machine(), offset); + fortyl_set_scroll_x(offset); } } @@ -265,97 +263,95 @@ spriteram format (4 bytes per sprite): offset 3 xxxxxxxx x position */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void fortyl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - fortyl_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; - UINT8 *spriteram_2 = state->m_spriteram2; + UINT8 *spriteram = m_spriteram; + UINT8 *spriteram_2 = m_spriteram2; int offs; /* spriteram #1 */ - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { int code, color, sx, sy, flipx, flipy; sx = spriteram[offs + 3]; sy = spriteram[offs + 0] +1; - if (state->m_flipscreen) + if (m_flipscreen) sx = 240 - sx; else sy = 242 - sy; code = (spriteram[offs + 1] & 0x3f) + ((spriteram[offs + 2] & 0x18) << 3); - flipx = ((spriteram[offs + 1] & 0x40) >> 6) ^ state->m_flipscreen; - flipy = ((spriteram[offs + 1] & 0x80) >> 7) ^ state->m_flipscreen; + flipx = ((spriteram[offs + 1] & 0x40) >> 6) ^ m_flipscreen; + flipy = ((spriteram[offs + 1] & 0x80) >> 7) ^ m_flipscreen; color = (spriteram[offs + 2] & 0x07) + 0x08; if (spriteram[offs + 2] & 0xe0) - color = machine.rand() & 0xf; + color = machine().rand() & 0xf; - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], code, color, flipx,flipy, - sx+state->m_xoffset,sy,0); + sx+m_xoffset,sy,0); } /* spriteram #2 */ - for (offs = 0; offs < state->m_spriteram2.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram2.bytes(); offs += 4) { int code, color, sx, sy, flipx, flipy; sx = spriteram_2[offs + 3]; sy = spriteram_2[offs + 0] +1; - if (state->m_flipscreen) + if (m_flipscreen) sx = 240 - sx; else sy = 242 - sy; code = (spriteram_2[offs + 1] & 0x3f) + ((spriteram_2[offs + 2] & 0x18) << 3); - flipx = ((spriteram_2[offs + 1] & 0x40) >> 6) ^ state->m_flipscreen; - flipy = ((spriteram_2[offs + 1] & 0x80) >> 7) ^ state->m_flipscreen; + flipx = ((spriteram_2[offs + 1] & 0x40) >> 6) ^ m_flipscreen; + flipy = ((spriteram_2[offs + 1] & 0x80) >> 7) ^ m_flipscreen; color = (spriteram_2[offs + 2] & 0x07) + 0x08; if (spriteram_2[offs + 2] & 0xe0) - color = machine.rand() & 0xf; + color = machine().rand() & 0xf; - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], code, color, flipx,flipy, - sx+state->m_xoffset,sy,0); + sx+m_xoffset,sy,0); } } -static void draw_pixram( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void fortyl_state::draw_pixram( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - fortyl_state *state = machine.driver_data(); int offs; - int f = state->m_flipscreen ^ 1; + int f = m_flipscreen ^ 1; - if (state->m_pix_redraw) + if (m_pix_redraw) { - state->m_pix_redraw = 0; + m_pix_redraw = 0; for (offs = 0; offs < 0x2000; offs++) - fortyl_plot_pix(machine, offs); + fortyl_plot_pix(offs); } - if (state->m_pixram_sel) - copybitmap(bitmap, *state->m_tmp_bitmap1, f, f, state->m_xoffset, 0, cliprect); + if (m_pixram_sel) + copybitmap(bitmap, *m_tmp_bitmap1, f, f, m_xoffset, 0, cliprect); else - copybitmap(bitmap, *state->m_tmp_bitmap2, f, f, state->m_xoffset, 0, cliprect); + copybitmap(bitmap, *m_tmp_bitmap2, f, f, m_xoffset, 0, cliprect); } UINT32 fortyl_state::screen_update_fortyl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_pixram(machine(), bitmap, cliprect); + draw_pixram(bitmap, cliprect); m_bg_tilemap->set_scrolldy(- m_video_ctrl[1] + 1, - m_video_ctrl[1] - 1 ); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/8080bw.c b/src/mame/video/8080bw.c index 49ac80ea0ca..9b8e64d798b 100644 --- a/src/mame/video/8080bw.c +++ b/src/mame/video/8080bw.c @@ -26,7 +26,7 @@ MACHINE_START_MEMBER(_8080bw_state,extra_8080bw_vh) } -static void invadpt2_get_pens( pen_t *pens ) +void _8080bw_state::invadpt2_get_pens( pen_t *pens ) { offs_t i; @@ -37,7 +37,7 @@ static void invadpt2_get_pens( pen_t *pens ) } -static void sflush_get_pens( pen_t *pens ) +void _8080bw_state::sflush_get_pens( pen_t *pens ) { offs_t i; @@ -50,7 +50,7 @@ static void sflush_get_pens( pen_t *pens ) } -static void cosmo_get_pens( pen_t *pens ) +void _8080bw_state::cosmo_get_pens( pen_t *pens ) { offs_t i; @@ -61,13 +61,11 @@ static void cosmo_get_pens( pen_t *pens ) } -INLINE void set_pixel( running_machine &machine, bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, pen_t *pens, UINT8 color ) +inline void _8080bw_state::set_pixel( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, pen_t *pens, UINT8 color ) { - _8080bw_state *state = machine.driver_data<_8080bw_state>(); - if (y >= MW8080BW_VCOUNTER_START_NO_VBLANK) { - if (state->m_flip_screen) + if (m_flip_screen) bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pens[color]; else bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pens[color]; @@ -75,13 +73,13 @@ INLINE void set_pixel( running_machine &machine, bitmap_rgb32 &bitmap, UINT8 y, } -INLINE void set_8_pixels( running_machine &machine, bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, pen_t *pens, UINT8 fore_color, UINT8 back_color ) +inline void _8080bw_state::set_8_pixels( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, pen_t *pens, UINT8 fore_color, UINT8 back_color ) { int i; for (i = 0; i < 8; i++) { - set_pixel(machine, bitmap, y, x, pens, (data & 0x01) ? fore_color : back_color); + set_pixel(bitmap, y, x, pens, (data & 0x01) ? fore_color : back_color); x = x + 1; data = data >> 1; @@ -90,9 +88,8 @@ INLINE void set_8_pixels( running_machine &machine, bitmap_rgb32 &bitmap, UINT8 /* this is needed as this driver doesn't emulate the shift register like mw8080bw does */ -static void clear_extra_columns( running_machine &machine, bitmap_rgb32 &bitmap, pen_t *pens, UINT8 color ) +void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, pen_t *pens, UINT8 color ) { - _8080bw_state *state = machine.driver_data<_8080bw_state>(); UINT8 x; for (x = 0; x < 4; x++) @@ -101,7 +98,7 @@ static void clear_extra_columns( running_machine &machine, bitmap_rgb32 &bitmap, for (y = MW8080BW_VCOUNTER_START_NO_VBLANK; y != 0; y++) { - if (state->m_flip_screen) + if (m_flip_screen) bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = pens[color]; else bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = pens[color]; @@ -132,10 +129,10 @@ UINT32 _8080bw_state::screen_update_invadpt2(screen_device &screen, bitmap_rgb32 UINT8 data = m_main_ram[offs]; UINT8 fore_color = m_screen_red ? 1 : color_map_base[color_address] & 0x07; - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); } - clear_extra_columns(machine(), bitmap, pens, 0); + clear_extra_columns(bitmap, pens, 0); return 0; } @@ -164,10 +161,10 @@ UINT32 _8080bw_state::screen_update_ballbomb(screen_device &screen, bitmap_rgb32 UINT8 fore_color = m_screen_red ? 1 : color_map_base[color_address] & 0x07; /* blue background */ - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 2); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 2); } - clear_extra_columns(machine(), bitmap, pens, 2); + clear_extra_columns(bitmap, pens, 2); return 0; } @@ -204,10 +201,10 @@ UINT32 _8080bw_state::screen_update_schaser(screen_device &screen, bitmap_rgb32 back_color = (((back_data & 0x0c) == 0x0c) && m_schaser_background_select) ? 4 : 2; } - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, back_color); + set_8_pixels(bitmap, y, x, data, pens, fore_color, back_color); } - clear_extra_columns(machine(), bitmap, pens, m_schaser_background_disable ? 0 : 2); + clear_extra_columns(bitmap, pens, m_schaser_background_disable ? 0 : 2); return 0; } @@ -229,10 +226,10 @@ UINT32 _8080bw_state::screen_update_schasercv(screen_device &screen, bitmap_rgb3 UINT8 fore_color = m_colorram[offs & 0x1f9f] & 0x07; /* blue background */ - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 2); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 2); } - clear_extra_columns(machine(), bitmap, pens, 2); + clear_extra_columns(bitmap, pens, 2); return 0; } @@ -253,10 +250,10 @@ UINT32 _8080bw_state::screen_update_rollingc(screen_device &screen, bitmap_rgb32 UINT8 data = m_main_ram[offs]; UINT8 fore_color = m_colorram[offs & 0x1f1f] & 0x07; - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); } - clear_extra_columns(machine(), bitmap, pens, 0); + clear_extra_columns(bitmap, pens, 0); return 0; } @@ -296,7 +293,7 @@ UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 if ((color_map_base[color_address] & 0x08) || (cloud_y >= 64)) { - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, back_color); + set_8_pixels(bitmap, y, x, data, pens, fore_color, back_color); } else { @@ -319,7 +316,7 @@ UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 color = (cloud_gfx[cloud_gfx_offs] & bit) ? 7 : back_color; } - set_pixel(machine(), bitmap, y, x, pens, color); + set_pixel(bitmap, y, x, pens, color); x = x + 1; data = data >> 1; @@ -327,7 +324,7 @@ UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 } } - clear_extra_columns(machine(), bitmap, pens, 6); + clear_extra_columns(bitmap, pens, 6); return 0; } @@ -348,10 +345,10 @@ UINT32 _8080bw_state::screen_update_lupin3(screen_device &screen, bitmap_rgb32 & UINT8 data = m_main_ram[offs]; UINT8 fore_color = ~m_colorram[offs & 0x1f9f] & 0x07; - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); } - clear_extra_columns(machine(), bitmap, pens, 0); + clear_extra_columns(bitmap, pens, 0); return 0; } @@ -374,10 +371,10 @@ UINT32 _8080bw_state::screen_update_cosmo(screen_device &screen, bitmap_rgb32 &b UINT8 data = m_main_ram[offs]; UINT8 fore_color = m_colorram[color_address] & 0x07; - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); } - clear_extra_columns(machine(), bitmap, pens, 0); + clear_extra_columns(bitmap, pens, 0); return 0; } @@ -405,10 +402,10 @@ UINT32 _8080bw_state::screen_update_indianbt(screen_device &screen, bitmap_rgb32 UINT8 data = m_main_ram[offs]; UINT8 fore_color = color_map_base[color_address] & 0x07; - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); } - clear_extra_columns(machine(), bitmap, pens, 0); + clear_extra_columns(bitmap, pens, 0); return 0; } @@ -429,10 +426,10 @@ UINT32 _8080bw_state::screen_update_sflush(screen_device &screen, bitmap_rgb32 & UINT8 data = m_main_ram[offs]; UINT8 fore_color = m_colorram[offs & 0x1f9f] & 0x07; - set_8_pixels(machine(), bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); } - clear_extra_columns(machine(), bitmap, pens, 0); + clear_extra_columns(bitmap, pens, 0); return 0; } diff --git a/src/mame/video/actfancr.c b/src/mame/video/actfancr.c index acf1187f73f..77176f6d3c5 100644 --- a/src/mame/video/actfancr.c +++ b/src/mame/video/actfancr.c @@ -11,15 +11,14 @@ /******************************************************************************/ -static void register_savestate( running_machine &machine ) +void actfancr_state::register_savestate() { - actfancr_state *state = machine.driver_data(); - state->save_item(NAME(state->m_flipscreen)); + save_item(NAME(m_flipscreen)); } void actfancr_state::video_start() { - register_savestate(machine()); + register_savestate(); } /******************************************************************************/ diff --git a/src/mame/video/aeroboto.c b/src/mame/video/aeroboto.c index fb6dbab106f..ab8fa49e128 100644 --- a/src/mame/video/aeroboto.c +++ b/src/mame/video/aeroboto.c @@ -120,26 +120,25 @@ WRITE8_MEMBER(aeroboto_state::aeroboto_tilecolor_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void aeroboto_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - aeroboto_state *state = machine.driver_data(); int offs; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { - int x = state->m_spriteram[offs + 3]; - int y = 240 - state->m_spriteram[offs]; + int x = m_spriteram[offs + 3]; + int y = 240 - m_spriteram[offs]; - if (state->flip_screen()) + if (flip_screen()) { x = 248 - x; y = 240 - y; } - drawgfx_transpen(bitmap, cliprect, machine.gfx[1], - state->m_spriteram[offs + 1], - state->m_spriteram[offs + 2] & 0x07, - state->flip_screen(), state->flip_screen(), + drawgfx_transpen(bitmap, cliprect, machine().gfx[1], + m_spriteram[offs + 1], + m_spriteram[offs + 2] & 0x07, + flip_screen(), flip_screen(), ((x + 8) & 0xff) - 8, y, 0); } } @@ -209,7 +208,7 @@ UINT32 aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_ind1 m_bg_tilemap->set_scrolly(0, *m_vscroll); m_bg_tilemap->draw(bitmap, splitrect2, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); // the status display behaves more closely to a 40-line splitscreen than an overlay m_bg_tilemap->set_scrolly(0, 0); diff --git a/src/mame/video/aerofgt.c b/src/mame/video/aerofgt.c index 2fd8e025168..c03829d4478 100644 --- a/src/mame/video/aerofgt.c +++ b/src/mame/video/aerofgt.c @@ -80,17 +80,16 @@ TILE_GET_INFO_MEMBER(aerofgt_state::get_bg2_tile_info) -static void aerofgt_register_state_globals( running_machine &machine ) +void aerofgt_state::aerofgt_register_state_globals( ) { - aerofgt_state *state = machine.driver_data(); - state->save_item(NAME(state->m_gfxbank)); - state->save_item(NAME(state->m_bank)); - state->save_item(NAME(state->m_bg1scrollx)); - state->save_item(NAME(state->m_bg1scrolly)); - state->save_item(NAME(state->m_bg2scrollx)); - state->save_item(NAME(state->m_bg2scrolly)); - state->save_item(NAME(state->m_charpalettebank)); - state->save_item(NAME(state->m_spritepalettebank)); + save_item(NAME(m_gfxbank)); + save_item(NAME(m_bank)); + save_item(NAME(m_bg1scrollx)); + save_item(NAME(m_bg1scrolly)); + save_item(NAME(m_bg2scrollx)); + save_item(NAME(m_bg2scrolly)); + save_item(NAME(m_charpalettebank)); + save_item(NAME(m_spritepalettebank)); } VIDEO_START_MEMBER(aerofgt_state,pspikes) @@ -100,7 +99,7 @@ VIDEO_START_MEMBER(aerofgt_state,pspikes) m_sprite_gfx = 1; - aerofgt_register_state_globals(machine()); + aerofgt_register_state_globals(); save_item(NAME(m_spikes91_lookup)); } @@ -114,7 +113,7 @@ VIDEO_START_MEMBER(aerofgt_state,karatblz) m_spritepalettebank = 0; m_sprite_gfx = 2; - aerofgt_register_state_globals(machine()); + aerofgt_register_state_globals(); } VIDEO_START_MEMBER(aerofgt_state,spinlbrk) @@ -132,7 +131,7 @@ VIDEO_START_MEMBER(aerofgt_state,spinlbrk) /* enemy sprites use ROM instead of RAM */ m_spriteram2.set_target(reinterpret_cast(memregion("gfx5")->base()), 0x20000); - aerofgt_register_state_globals(machine()); + aerofgt_register_state_globals(); } VIDEO_START_MEMBER(aerofgt_state,turbofrc) @@ -145,7 +144,7 @@ VIDEO_START_MEMBER(aerofgt_state,turbofrc) m_spritepalettebank = 0; m_sprite_gfx = 2; - aerofgt_register_state_globals(machine()); + aerofgt_register_state_globals(); } @@ -190,12 +189,11 @@ WRITE16_MEMBER(aerofgt_state::aerofgt_bg2videoram_w) } -static void setbank( running_machine &machine, tilemap_t *tmap, int num, int bank ) +void aerofgt_state::setbank( tilemap_t *tmap, int num, int bank ) { - aerofgt_state *state = machine.driver_data(); - if (state->m_gfxbank[num] != bank) + if (m_gfxbank[num] != bank) { - state->m_gfxbank[num] = bank; + m_gfxbank[num] = bank; tmap->mark_all_dirty(); } } @@ -204,8 +202,8 @@ WRITE16_MEMBER(aerofgt_state::pspikes_gfxbank_w) { if (ACCESSING_BITS_0_7) { - setbank(machine(), m_bg1_tilemap, 0, (data & 0xf0) >> 4); - setbank(machine(), m_bg1_tilemap, 1, data & 0x0f); + setbank(m_bg1_tilemap, 0, (data & 0xf0) >> 4); + setbank(m_bg1_tilemap, 1, data & 0x0f); } } @@ -214,8 +212,8 @@ WRITE16_MEMBER(aerofgt_state::karatblz_gfxbank_w) { if (ACCESSING_BITS_8_15) { - setbank(machine(), m_bg1_tilemap, 0, (data & 0x0100) >> 8); - setbank(machine(), m_bg2_tilemap, 1, (data & 0x0800) >> 11); + setbank(m_bg1_tilemap, 0, (data & 0x0100) >> 8); + setbank(m_bg2_tilemap, 1, (data & 0x0800) >> 11); } } @@ -223,8 +221,8 @@ WRITE16_MEMBER(aerofgt_state::spinlbrk_gfxbank_w) { if (ACCESSING_BITS_0_7) { - setbank(machine(), m_bg1_tilemap, 0, (data & 0x07)); - setbank(machine(), m_bg2_tilemap, 1, (data & 0x38) >> 3); + setbank(m_bg1_tilemap, 0, (data & 0x07)); + setbank(m_bg2_tilemap, 1, (data & 0x38) >> 3); } } @@ -234,10 +232,10 @@ WRITE16_MEMBER(aerofgt_state::turbofrc_gfxbank_w) data = COMBINE_DATA(&m_bank[offset]); - setbank(machine(), tmap, 4 * offset + 0, (data >> 0) & 0x0f); - setbank(machine(), tmap, 4 * offset + 1, (data >> 4) & 0x0f); - setbank(machine(), tmap, 4 * offset + 2, (data >> 8) & 0x0f); - setbank(machine(), tmap, 4 * offset + 3, (data >> 12) & 0x0f); + setbank(tmap, 4 * offset + 0, (data >> 0) & 0x0f); + setbank(tmap, 4 * offset + 1, (data >> 4) & 0x0f); + setbank(tmap, 4 * offset + 2, (data >> 8) & 0x0f); + setbank(tmap, 4 * offset + 3, (data >> 12) & 0x0f); } WRITE16_MEMBER(aerofgt_state::aerofgt_gfxbank_w) @@ -246,8 +244,8 @@ WRITE16_MEMBER(aerofgt_state::aerofgt_gfxbank_w) data = COMBINE_DATA(&m_bank[offset]); - setbank(machine(), tmap, 2 * offset + 0, (data >> 8) & 0xff); - setbank(machine(), tmap, 2 * offset + 1, (data >> 0) & 0xff); + setbank(tmap, 2 * offset + 0, (data >> 8) & 0xff); + setbank(tmap, 2 * offset + 1, (data >> 0) & 0xff); } WRITE16_MEMBER(aerofgt_state::aerofgt_bg1scrollx_w) @@ -422,7 +420,7 @@ VIDEO_START_MEMBER(aerofgt_state,wbbc97) m_sprite_gfx = 1; - aerofgt_register_state_globals(machine()); + aerofgt_register_state_globals(); save_item(NAME(m_wbbc97_bitmap_enable)); } @@ -432,8 +430,8 @@ WRITE16_MEMBER(aerofgt_state::pspikesb_gfxbank_w) { COMBINE_DATA(&m_rasterram[0x200 / 2]); - setbank(machine(), m_bg1_tilemap, 0, (data & 0xf000) >> 12); - setbank(machine(), m_bg1_tilemap, 1, (data & 0x0f00) >> 8); + setbank(m_bg1_tilemap, 0, (data & 0xf000) >> 12); + setbank(m_bg1_tilemap, 1, (data & 0x0f00) >> 8); } // BOOTLEG @@ -449,13 +447,12 @@ WRITE16_MEMBER(aerofgt_state::wbbc97_bitmap_enable_w) } // BOOTLEG -static void aerfboo2_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri ) +void aerofgt_state::aerfboo2_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri ) { - aerofgt_state *state = machine.driver_data(); int attr_start, base, first; base = chip * 0x0200; -// first = 4 * state->m_spriteram3[0x1fe + base]; +// first = 4 * m_spriteram3[0x1fe + base]; first = 0; for (attr_start = base + 0x0200 - 4; attr_start >= first + base; attr_start -= 4) @@ -465,26 +462,26 @@ static void aerfboo2_draw_sprites( running_machine &machine, bitmap_ind16 &bitma // some other drivers still use this wrong table, they have to be upgraded // int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; - if (!(state->m_spriteram3[attr_start + 2] & 0x0080)) + if (!(m_spriteram3[attr_start + 2] & 0x0080)) continue; - pri = state->m_spriteram3[attr_start + 2] & 0x0010; + pri = m_spriteram3[attr_start + 2] & 0x0010; if ( chip_disabled_pri & !pri) continue; if ((!chip_disabled_pri) & (pri >> 4)) continue; - ox = state->m_spriteram3[attr_start + 1] & 0x01ff; - xsize = (state->m_spriteram3[attr_start + 2] & 0x0700) >> 8; - zoomx = (state->m_spriteram3[attr_start + 1] & 0xf000) >> 12; - oy = state->m_spriteram3[attr_start + 0] & 0x01ff; - ysize = (state->m_spriteram3[attr_start + 2] & 0x7000) >> 12; - zoomy = (state->m_spriteram3[attr_start + 0] & 0xf000) >> 12; - flipx = state->m_spriteram3[attr_start + 2] & 0x0800; - flipy = state->m_spriteram3[attr_start + 2] & 0x8000; - color = (state->m_spriteram3[attr_start + 2] & 0x000f) + 16 * state->m_spritepalettebank; + ox = m_spriteram3[attr_start + 1] & 0x01ff; + xsize = (m_spriteram3[attr_start + 2] & 0x0700) >> 8; + zoomx = (m_spriteram3[attr_start + 1] & 0xf000) >> 12; + oy = m_spriteram3[attr_start + 0] & 0x01ff; + ysize = (m_spriteram3[attr_start + 2] & 0x7000) >> 12; + zoomy = (m_spriteram3[attr_start + 0] & 0xf000) >> 12; + flipx = m_spriteram3[attr_start + 2] & 0x0800; + flipy = m_spriteram3[attr_start + 2] & 0x8000; + color = (m_spriteram3[attr_start + 2] & 0x000f) + 16 * m_spritepalettebank; - map_start = state->m_spriteram3[attr_start + 3]; + map_start = m_spriteram3[attr_start + 3]; // aerofgt has this adjustment, but doing it here would break turbo force title screen // ox += (xsize*zoomx+2)/4; @@ -512,17 +509,17 @@ static void aerfboo2_draw_sprites( running_machine &machine, bitmap_ind16 &bitma sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16; if (chip == 0) - code = state->m_spriteram1[map_start % (state->m_spriteram1.bytes()/2)]; + code = m_spriteram1[map_start % (m_spriteram1.bytes()/2)]; else - code = state->m_spriteram2[map_start % (state->m_spriteram2.bytes()/2)]; + code = m_spriteram2[map_start % (m_spriteram2.bytes()/2)]; - pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx + chip], + pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[m_sprite_gfx + chip], code, color, flipx,flipy, sx,sy, zoomx << 11, zoomy << 11, - machine.priority_bitmap,pri ? 0 : 2,15); + machine().priority_bitmap,pri ? 0 : 2,15); map_start++; } @@ -535,33 +532,32 @@ static void aerfboo2_draw_sprites( running_machine &machine, bitmap_ind16 &bitma } // BOOTLEG -static void pspikesb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void aerofgt_state::pspikesb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - aerofgt_state *state = machine.driver_data(); int i; - for (i = 4; i < state->m_spriteram3.bytes() / 2; i += 4) + for (i = 4; i < m_spriteram3.bytes() / 2; i += 4) { int xpos, ypos, color, flipx, flipy, code; - if (state->m_spriteram3[i + 3 - 4] & 0x8000) + if (m_spriteram3[i + 3 - 4] & 0x8000) break; - xpos = (state->m_spriteram3[i + 2] & 0x1ff) - 34; - ypos = 256 - (state->m_spriteram3[i + 3 - 4] & 0x1ff) - 33; - code = state->m_spriteram3[i + 0] & 0x1fff; + xpos = (m_spriteram3[i + 2] & 0x1ff) - 34; + ypos = 256 - (m_spriteram3[i + 3 - 4] & 0x1ff) - 33; + code = m_spriteram3[i + 0] & 0x1fff; flipy = 0; - flipx = state->m_spriteram3[i + 1] & 0x0800; - color = state->m_spriteram3[i + 1] & 0x000f; + flipx = m_spriteram3[i + 1] & 0x0800; + color = m_spriteram3[i + 1] & 0x000f; - drawgfx_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx], + drawgfx_transpen(bitmap,cliprect,machine().gfx[m_sprite_gfx], code, color, flipx,flipy, xpos,ypos,15); /* wrap around y */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx], + drawgfx_transpen(bitmap,cliprect,machine().gfx[m_sprite_gfx], code, color, flipx,flipy, @@ -571,41 +567,40 @@ static void pspikesb_draw_sprites( running_machine &machine, bitmap_ind16 &bitma } // BOOTLEG -static void spikes91_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void aerofgt_state::spikes91_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - aerofgt_state *state = machine.driver_data(); int i; UINT8 *lookup; - lookup = state->memregion("user1")->base(); - state->m_spritepalettebank = 1; + lookup = memregion("user1")->base(); + m_spritepalettebank = 1; - for (i = state->m_spriteram3.bytes() / 2 - 4; i >= 4; i -= 4) + for (i = m_spriteram3.bytes() / 2 - 4; i >= 4; i -= 4) { int xpos, ypos, color, flipx, flipy, code, realcode; - code = state->m_spriteram3[i + 0] & 0x1fff; + code = m_spriteram3[i + 0] & 0x1fff; if (!code) continue; - xpos = (state->m_spriteram3[i + 2] & 0x01ff) - 16; - ypos = 256 - (state->m_spriteram3[i + 1] & 0x00ff) - 26; + xpos = (m_spriteram3[i + 2] & 0x01ff) - 16; + ypos = 256 - (m_spriteram3[i + 1] & 0x00ff) - 26; flipy = 0; - flipx = state->m_spriteram3[i + 3] & 0x8000; - color = ((state->m_spriteram3[i + 3] & 0x00f0) >> 4); + flipx = m_spriteram3[i + 3] & 0x8000; + color = ((m_spriteram3[i + 3] & 0x00f0) >> 4); - code |= state->m_spikes91_lookup * 0x2000; + code |= m_spikes91_lookup * 0x2000; realcode = (lookup[code] << 8) + lookup[0x10000 + code]; - drawgfx_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx], + drawgfx_transpen(bitmap,cliprect,machine().gfx[m_sprite_gfx], realcode, color, flipx,flipy, xpos,ypos,15); /* wrap around y */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx], + drawgfx_transpen(bitmap,cliprect,machine().gfx[m_sprite_gfx], realcode, color, flipx,flipy, @@ -614,30 +609,29 @@ static void spikes91_draw_sprites( running_machine &machine, bitmap_ind16 &bitma } // BOOTLEG -static void aerfboot_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void aerofgt_state::aerfboot_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - aerofgt_state *state = machine.driver_data(); int attr_start, last; - last = ((state->m_rasterram[0x404 / 2] << 5) - 0x8000) / 2; + last = ((m_rasterram[0x404 / 2] << 5) - 0x8000) / 2; - for (attr_start = state->m_spriteram3.bytes() / 2 - 4; attr_start >= last; attr_start -= 4) + for (attr_start = m_spriteram3.bytes() / 2 - 4; attr_start >= last; attr_start -= 4) { int code; int ox, oy, sx, sy, zoomx, zoomy, flipx, flipy, color, pri; - ox = state->m_spriteram3[attr_start + 1] & 0x01ff; - oy = state->m_spriteram3[attr_start + 0] & 0x01ff; - flipx = state->m_spriteram3[attr_start + 2] & 0x0800; - flipy = state->m_spriteram3[attr_start + 2] & 0x8000; - color = state->m_spriteram3[attr_start + 2] & 0x000f; + ox = m_spriteram3[attr_start + 1] & 0x01ff; + oy = m_spriteram3[attr_start + 0] & 0x01ff; + flipx = m_spriteram3[attr_start + 2] & 0x0800; + flipy = m_spriteram3[attr_start + 2] & 0x8000; + color = m_spriteram3[attr_start + 2] & 0x000f; - zoomx = (state->m_spriteram3[attr_start + 1] & 0xf000) >> 12; - zoomy = (state->m_spriteram3[attr_start + 0] & 0xf000) >> 12; - pri = state->m_spriteram3[attr_start + 2] & 0x0010; - code = state->m_spriteram3[attr_start + 3] & 0x1fff; + zoomx = (m_spriteram3[attr_start + 1] & 0xf000) >> 12; + zoomy = (m_spriteram3[attr_start + 0] & 0xf000) >> 12; + pri = m_spriteram3[attr_start + 2] & 0x0010; + code = m_spriteram3[attr_start + 3] & 0x1fff; - if (!(state->m_spriteram3[attr_start + 2] & 0x0040)) + if (!(m_spriteram3[attr_start + 2] & 0x0040)) code |= 0x2000; zoomx = 32 + zoomx; @@ -647,35 +641,35 @@ static void aerfboot_draw_sprites( running_machine &machine, bitmap_ind16 &bitma sx = ((ox + 16 + 3) & 0x1ff) - 16; - pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx + (code >= 0x1000 ? 0 : 1)], + pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[m_sprite_gfx + (code >= 0x1000 ? 0 : 1)], code, color, flipx,flipy, sx,sy, zoomx << 11,zoomy << 11, - machine.priority_bitmap,pri ? 0 : 2,15); + machine().priority_bitmap,pri ? 0 : 2,15); } - last = ((state->m_rasterram[0x402 / 2] << 5) - 0x8000) / 2; + last = ((m_rasterram[0x402 / 2] << 5) - 0x8000) / 2; - for (attr_start = ((state->m_spriteram3.bytes() / 2) / 2) - 4; attr_start >= last; attr_start -= 4) + for (attr_start = ((m_spriteram3.bytes() / 2) / 2) - 4; attr_start >= last; attr_start -= 4) { int code; int ox, oy, sx, sy, zoomx, zoomy, flipx, flipy, color, pri; - ox = state->m_spriteram3[attr_start + 1] & 0x01ff; - oy = state->m_spriteram3[attr_start + 0] & 0x01ff; - flipx = state->m_spriteram3[attr_start + 2] & 0x0800; - flipy = state->m_spriteram3[attr_start + 2] & 0x8000; - color = state->m_spriteram3[attr_start + 2] & 0x000f; + ox = m_spriteram3[attr_start + 1] & 0x01ff; + oy = m_spriteram3[attr_start + 0] & 0x01ff; + flipx = m_spriteram3[attr_start + 2] & 0x0800; + flipy = m_spriteram3[attr_start + 2] & 0x8000; + color = m_spriteram3[attr_start + 2] & 0x000f; - zoomx = (state->m_spriteram3[attr_start + 1] & 0xf000) >> 12; - zoomy = (state->m_spriteram3[attr_start + 0] & 0xf000) >> 12; - pri = state->m_spriteram3[attr_start + 2] & 0x0010; - code = state->m_spriteram3[attr_start + 3] & 0x1fff; + zoomx = (m_spriteram3[attr_start + 1] & 0xf000) >> 12; + zoomy = (m_spriteram3[attr_start + 0] & 0xf000) >> 12; + pri = m_spriteram3[attr_start + 2] & 0x0010; + code = m_spriteram3[attr_start + 3] & 0x1fff; - if (!(state->m_spriteram3[attr_start + 2] & 0x0040)) + if (!(m_spriteram3[attr_start + 2] & 0x0040)) code |= 0x2000; zoomx = 32 + zoomx; @@ -685,32 +679,31 @@ static void aerfboot_draw_sprites( running_machine &machine, bitmap_ind16 &bitma sx = ((ox + 16 + 3) & 0x1ff) - 16; - pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[state->m_sprite_gfx + (code >= 0x1000 ? 0 : 1)], + pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[m_sprite_gfx + (code >= 0x1000 ? 0 : 1)], code, color, flipx,flipy, sx,sy, zoomx << 11,zoomy << 11, - machine.priority_bitmap,pri ? 0 : 2,15); + machine().priority_bitmap,pri ? 0 : 2,15); } } // BOOTLEG -static void wbbc97_draw_bitmap( running_machine &machine, bitmap_rgb32 &bitmap ) +void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) { - aerofgt_state *state = machine.driver_data(); int x, y, count; count = 16; // weird, the bitmap doesn't start at 0? for (y = 0; y < 256; y++) for (x = 0; x < 512; x++) { - int color = state->m_bitmapram[count] >> 1; + int color = m_bitmapram[count] >> 1; /* data is GRB; convert to RGB */ rgb_t pen = MAKE_RGB(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f)); - bitmap.pix32(y, (10 + x - state->m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; + bitmap.pix32(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; count++; count &= 0x1ffff; @@ -729,7 +722,7 @@ UINT32 aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind16 m_bg1_tilemap->set_scrolly(0, scrolly); m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); - pspikesb_draw_sprites(machine(), bitmap, cliprect); + pspikesb_draw_sprites(bitmap, cliprect); return 0; } @@ -749,7 +742,7 @@ UINT32 aerofgt_state::screen_update_spikes91(screen_device &screen, bitmap_ind16 m_bg1_tilemap->set_scrolly(0, scrolly); m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); - spikes91_draw_sprites(machine(), bitmap, cliprect); + spikes91_draw_sprites(bitmap, cliprect); /* we could use a tilemap, but it's easier to just do it here */ count = 0; @@ -793,7 +786,7 @@ UINT32 aerofgt_state::screen_update_aerfboot(screen_device &screen, bitmap_ind16 m_bg2_tilemap->draw(bitmap, cliprect, 0, 1); /* we use the priority buffer so sprites are drawn front to back */ - aerfboot_draw_sprites(machine(), bitmap, cliprect); + aerfboot_draw_sprites(bitmap, cliprect); return 0; } @@ -817,10 +810,10 @@ UINT32 aerofgt_state::screen_update_aerfboo2(screen_device &screen, bitmap_ind16 m_bg2_tilemap->draw(bitmap, cliprect, 0, 1); /* we use the priority buffer so sprites are drawn front to back */ - aerfboo2_draw_sprites(machine(), bitmap, cliprect, 1, -1); //ship - aerfboo2_draw_sprites(machine(), bitmap, cliprect, 1, 0); //intro - aerfboo2_draw_sprites(machine(), bitmap, cliprect, 0, -1); //enemy - aerfboo2_draw_sprites(machine(), bitmap, cliprect, 0, 0); //enemy + aerfboo2_draw_sprites(bitmap, cliprect, 1, -1); //ship + aerfboo2_draw_sprites(bitmap, cliprect, 1, 0); //intro + aerfboo2_draw_sprites(bitmap, cliprect, 0, -1); //enemy + aerfboo2_draw_sprites(bitmap, cliprect, 0, 0); //enemy return 0; } @@ -839,7 +832,7 @@ UINT32 aerofgt_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 & if (m_wbbc97_bitmap_enable) { - wbbc97_draw_bitmap(machine(), bitmap); + wbbc97_draw_bitmap(bitmap); m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); } else diff --git a/src/mame/video/alpha68k.c b/src/mame/video/alpha68k.c index d084fbb6bd0..f2396be6276 100644 --- a/src/mame/video/alpha68k.c +++ b/src/mame/video/alpha68k.c @@ -8,16 +8,14 @@ #include "includes/alpha68k.h" -void alpha68k_flipscreen_w( running_machine &machine, int flip ) +void alpha68k_state::alpha68k_flipscreen_w( int flip ) { - alpha68k_state *state = machine.driver_data(); - state->m_flipscreen = flip; + m_flipscreen = flip; } -void alpha68k_V_video_bank_w( running_machine &machine, int bank ) +void alpha68k_state::alpha68k_V_video_bank_w( int bank ) { - alpha68k_state *state = machine.driver_data(); - state->m_bank_base = bank & 0xf; + m_bank_base = bank & 0xf; } WRITE16_MEMBER(alpha68k_state::alpha68k_paletteram_w) @@ -70,10 +68,9 @@ VIDEO_START_MEMBER(alpha68k_state,alpha68k) /******************************************************************************/ //AT -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e ) +void alpha68k_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e ) { - alpha68k_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int offs, mx, my, color, tile, fx, fy, i; for (offs = s; offs < e; offs += 0x40) @@ -85,7 +82,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (j == 0 && s == 0x7c0) my++; //ZT - if (state->m_flipscreen) + if (m_flipscreen) { mx = 240 - mx; my = 240 - my; @@ -100,20 +97,20 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const fx = tile & 0x4000; tile &= 0x3fff; - if (state->m_flipscreen) + if (m_flipscreen) { if (fx) fx = 0; else fx = 1; if (fy) fy = 0; else fy = 1; } if (color) - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], tile, color, fx,fy, mx,my,0); - if (state->m_flipscreen) + if (m_flipscreen) my = (my - 16) & 0x1ff; else my = (my + 16) & 0x1ff; @@ -133,10 +130,10 @@ UINT32 alpha68k_state::screen_update_alpha68k_II(screen_device &screen, bitmap_i bitmap.fill(2047, cliprect); //AT - draw_sprites(machine(), bitmap, cliprect, 0, 0x07c0, 0x0800); - draw_sprites(machine(), bitmap, cliprect, 1, 0x0000, 0x0800); - draw_sprites(machine(), bitmap, cliprect, 2, 0x0000, 0x0800); - draw_sprites(machine(), bitmap, cliprect, 0, 0x0000, 0x07c0); + draw_sprites(bitmap, cliprect, 0, 0x07c0, 0x0800); + draw_sprites(bitmap, cliprect, 1, 0x0000, 0x0800); + draw_sprites(bitmap, cliprect, 2, 0x0000, 0x0800); + draw_sprites(bitmap, cliprect, 0, 0x0000, 0x07c0); //ZT m_fix_tilemap->draw(bitmap, cliprect, 0, 0); return 0; @@ -213,10 +210,9 @@ WRITE16_MEMBER(alpha68k_state::alpha68k_V_video_control_w) } } -static void draw_sprites_V( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask ) +void alpha68k_state::draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask ) { - alpha68k_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int offs, mx, my, color, tile, fx, fy, i; for (offs = s; offs < e; offs += 0x40) @@ -229,7 +225,7 @@ static void draw_sprites_V( running_machine &machine, bitmap_ind16 &bitmap, cons if (j == 0 && s == 0x7c0) my++; //ZT - if (state->m_flipscreen) + if (m_flipscreen) { mx = 240 - mx; my = 240 - my; @@ -246,20 +242,20 @@ static void draw_sprites_V( running_machine &machine, bitmap_ind16 &bitmap, cons if (tile > 0x4fff) continue; - if (state->m_flipscreen) + if (m_flipscreen) { if (fx) fx = 0; else fx = 1; if (fy) fy = 0; else fy = 1; } if (color) - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], tile, color, fx,fy, mx,my,0); - if (state->m_flipscreen) + if (m_flipscreen) my = (my - 16) & 0x1ff; else my = (my + 16) & 0x1ff; @@ -282,25 +278,25 @@ UINT32 alpha68k_state::screen_update_alpha68k_V(screen_device &screen, bitmap_in /* This appears to be correct priority */ if (m_microcontroller_id == 0x8814) /* Sky Adventure */ { - draw_sprites_V(machine(), bitmap, cliprect, 0, 0x07c0, 0x0800, 0, 0x8000, 0x7fff); - draw_sprites_V(machine(), bitmap, cliprect, 1, 0x0000, 0x0800, 0, 0x8000, 0x7fff); + draw_sprites_V(bitmap, cliprect, 0, 0x07c0, 0x0800, 0, 0x8000, 0x7fff); + draw_sprites_V(bitmap, cliprect, 1, 0x0000, 0x0800, 0, 0x8000, 0x7fff); //AT: *KLUDGE* fixes priest priority in level 1(could be a game bug) if (spriteram[0x1bde] == 0x24 && (spriteram[0x1bdf] >> 8) == 0x3b) { - draw_sprites_V(machine(), bitmap, cliprect, 2, 0x03c0, 0x0800, 0, 0x8000, 0x7fff); - draw_sprites_V(machine(), bitmap, cliprect, 2, 0x0000, 0x03c0, 0, 0x8000, 0x7fff); + draw_sprites_V(bitmap, cliprect, 2, 0x03c0, 0x0800, 0, 0x8000, 0x7fff); + draw_sprites_V(bitmap, cliprect, 2, 0x0000, 0x03c0, 0, 0x8000, 0x7fff); } else - draw_sprites_V(machine(), bitmap, cliprect, 2, 0x0000, 0x0800, 0, 0x8000, 0x7fff); + draw_sprites_V(bitmap, cliprect, 2, 0x0000, 0x0800, 0, 0x8000, 0x7fff); - draw_sprites_V(machine(), bitmap, cliprect, 0, 0x0000, 0x07c0, 0, 0x8000, 0x7fff); + draw_sprites_V(bitmap, cliprect, 0, 0x0000, 0x07c0, 0, 0x8000, 0x7fff); } else /* gangwars */ { - draw_sprites_V(machine(), bitmap, cliprect, 0, 0x07c0, 0x0800, 0x8000, 0, 0x7fff); - draw_sprites_V(machine(), bitmap, cliprect, 1, 0x0000, 0x0800, 0x8000, 0, 0x7fff); - draw_sprites_V(machine(), bitmap, cliprect, 2, 0x0000, 0x0800, 0x8000, 0, 0x7fff); - draw_sprites_V(machine(), bitmap, cliprect, 0, 0x0000, 0x07c0, 0x8000, 0, 0x7fff); + draw_sprites_V(bitmap, cliprect, 0, 0x07c0, 0x0800, 0x8000, 0, 0x7fff); + draw_sprites_V(bitmap, cliprect, 1, 0x0000, 0x0800, 0x8000, 0, 0x7fff); + draw_sprites_V(bitmap, cliprect, 2, 0x0000, 0x0800, 0x8000, 0, 0x7fff); + draw_sprites_V(bitmap, cliprect, 0, 0x0000, 0x07c0, 0x8000, 0, 0x7fff); } m_fix_tilemap->draw(bitmap, cliprect, 0, 0); @@ -318,10 +314,10 @@ UINT32 alpha68k_state::screen_update_alpha68k_V_sb(screen_device &screen, bitmap bitmap.fill(4095, cliprect); /* This appears to be correct priority */ - draw_sprites_V(machine(), bitmap, cliprect, 0, 0x07c0, 0x0800, 0x4000, 0x8000, 0x3fff); - draw_sprites_V(machine(), bitmap, cliprect, 1, 0x0000, 0x0800, 0x4000, 0x8000, 0x3fff); - draw_sprites_V(machine(), bitmap, cliprect, 2, 0x0000, 0x0800, 0x4000, 0x8000, 0x3fff); - draw_sprites_V(machine(), bitmap, cliprect, 0, 0x0000, 0x07c0, 0x4000, 0x8000, 0x3fff); + draw_sprites_V(bitmap, cliprect, 0, 0x07c0, 0x0800, 0x4000, 0x8000, 0x3fff); + draw_sprites_V(bitmap, cliprect, 1, 0x0000, 0x0800, 0x4000, 0x8000, 0x3fff); + draw_sprites_V(bitmap, cliprect, 2, 0x0000, 0x0800, 0x4000, 0x8000, 0x3fff); + draw_sprites_V(bitmap, cliprect, 0, 0x0000, 0x07c0, 0x4000, 0x8000, 0x3fff); m_fix_tilemap->draw(bitmap, cliprect, 0, 0); return 0; @@ -329,13 +325,12 @@ UINT32 alpha68k_state::screen_update_alpha68k_V_sb(screen_device &screen, bitmap /******************************************************************************/ //AT -static void draw_sprites_I( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift ) +void alpha68k_state::draw_sprites_I( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift ) { - alpha68k_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int data, offs, mx, my, tile, color, fy, i; - UINT8 *color_prom = state->memregion("user1")->base(); - gfx_element *gfx = machine.gfx[0]; + UINT8 *color_prom = memregion("user1")->base(); + gfx_element *gfx = machine().gfx[0]; for (offs = 0; offs < 0x400; offs += 0x20) { @@ -364,9 +359,9 @@ UINT32 alpha68k_state::screen_update_alpha68k_I(screen_device &screen, bitmap_in bitmap.fill(get_black_pen(machine()), cliprect); /* This appears to be correct priority */ - draw_sprites_I(machine(), bitmap, cliprect, 2, 0x0800, yshift); - draw_sprites_I(machine(), bitmap, cliprect, 3, 0x0c00, yshift); - draw_sprites_I(machine(), bitmap, cliprect, 1, 0x0400, yshift); + draw_sprites_I(bitmap, cliprect, 2, 0x0800, yshift); + draw_sprites_I(bitmap, cliprect, 3, 0x0c00, yshift); + draw_sprites_I(bitmap, cliprect, 1, 0x0400, yshift); return 0; } //ZT @@ -428,23 +423,22 @@ PALETTE_INIT_MEMBER(alpha68k_state,paddlem) } } -static void kyros_video_banking(int *bank, int data) +void alpha68k_state::kyros_video_banking(int *bank, int data) { *bank = (data >> 13 & 4) | (data >> 10 & 3); } -static void jongbou_video_banking(int *bank, int data) +void alpha68k_state::jongbou_video_banking(int *bank, int data) { *bank = (data >> 11 & 4) | (data >> 10 & 3); } -static void kyros_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d ) +void alpha68k_state::kyros_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d ) { - alpha68k_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int offs, mx, my, color, tile, i, bank, fy, fx; int data; - UINT8 *color_prom = state->memregion("user1")->base(); + UINT8 *color_prom = memregion("user1")->base(); //AT for (offs = 0; offs < 0x400; offs += 0x20) @@ -453,7 +447,7 @@ static void kyros_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, my = -(mx >> 8) & 0xff; mx &= 0xff; - if (state->m_flipscreen) + if (m_flipscreen) my = 249 - my; for (i = 0; i < 0x20; i++) @@ -467,23 +461,23 @@ static void kyros_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, fy = data & 0x1000; fx = 0; - if(state->m_flipscreen) + if(m_flipscreen) { if (fy) fy = 0; else fy = 1; fx = 1; } tile = (data >> 3 & 0x400) | (data & 0x3ff); - if (state->m_game_id == ALPHA68K_KYROS) + if (m_game_id == ALPHA68K_KYROS) kyros_video_banking(&bank, data); else jongbou_video_banking(&bank, data); - drawgfx_transpen(bitmap, cliprect, machine.gfx[bank], tile, color, fx, fy, mx, my, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[bank], tile, color, fx, fy, mx, my, 0); } } //ZT - if (state->m_flipscreen) + if (m_flipscreen) my = (my - 8) & 0xff; else my = (my + 8) & 0xff; @@ -496,19 +490,18 @@ UINT32 alpha68k_state::screen_update_kyros(screen_device &screen, bitmap_ind16 & colortable_entry_set_value(machine().colortable, 0x100, *m_videoram & 0xff); bitmap.fill(0x100, cliprect); //AT - kyros_draw_sprites(machine(), bitmap, cliprect, 2, 0x0800); - kyros_draw_sprites(machine(), bitmap, cliprect, 3, 0x0c00); - kyros_draw_sprites(machine(), bitmap, cliprect, 1, 0x0400); + kyros_draw_sprites(bitmap, cliprect, 2, 0x0800); + kyros_draw_sprites(bitmap, cliprect, 3, 0x0c00); + kyros_draw_sprites(bitmap, cliprect, 1, 0x0400); return 0; } /******************************************************************************/ -static void sstingry_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d ) +void alpha68k_state::sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d ) { //AT - alpha68k_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int data, offs, mx, my, color, tile, i, bank, fy, fx; for (offs = 0; offs < 0x400; offs += 0x20) @@ -519,7 +512,7 @@ static void sstingry_draw_sprites( running_machine &machine, bitmap_ind16 &bitma if (mx > 0xf8) mx -= 0x100; - if (state->m_flipscreen) + if (m_flipscreen) my = 249 - my; for (i = 0; i < 0x20; i++) @@ -530,7 +523,7 @@ static void sstingry_draw_sprites( running_machine &machine, bitmap_ind16 &bitma fy = data & 0x1000; fx = 0; - if(state->m_flipscreen) + if(m_flipscreen) { if (fy) fy = 0; else fy = 1; fx = 1; @@ -539,10 +532,10 @@ static void sstingry_draw_sprites( running_machine &machine, bitmap_ind16 &bitma color = (data >> 7 & 0x18) | (data >> 13 & 7); tile = data & 0x3ff; bank = data >> 10 & 3; - drawgfx_transpen(bitmap, cliprect, machine.gfx[bank], tile, color, fx, fy, mx, my, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[bank], tile, color, fx, fy, mx, my, 0); } //ZT - if(state->m_flipscreen) + if(m_flipscreen) my = (my - 8) & 0xff; else my = (my + 8) & 0xff; @@ -555,8 +548,8 @@ UINT32 alpha68k_state::screen_update_sstingry(screen_device &screen, bitmap_ind1 colortable_entry_set_value(machine().colortable, 0x100, *m_videoram & 0xff); bitmap.fill(0x100, cliprect); //AT - sstingry_draw_sprites(machine(), bitmap, cliprect, 2, 0x0800); - sstingry_draw_sprites(machine(), bitmap, cliprect, 3, 0x0c00); - sstingry_draw_sprites(machine(), bitmap, cliprect, 1, 0x0400); + sstingry_draw_sprites(bitmap, cliprect, 2, 0x0800); + sstingry_draw_sprites(bitmap, cliprect, 3, 0x0c00); + sstingry_draw_sprites(bitmap, cliprect, 1, 0x0400); return 0; } diff --git a/src/mame/video/ambush.c b/src/mame/video/ambush.c index 433ef6feaed..7c830717e67 100644 --- a/src/mame/video/ambush.c +++ b/src/mame/video/ambush.c @@ -48,14 +48,13 @@ void ambush_state::palette_init() } -static void draw_chars( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) +void ambush_state::draw_chars( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { - ambush_state *state = machine.driver_data(); int offs, transpen; transpen = (priority == 0) ? -1 : 0; - for (offs = 0; offs < state->m_videoram.bytes(); offs++) + for (offs = 0; offs < m_videoram.bytes(); offs++) { int code, sx, sy, col; UINT8 scroll; @@ -63,26 +62,26 @@ static void draw_chars( running_machine &machine, bitmap_ind16 &bitmap, const re sy = (offs / 32); sx = (offs % 32); - col = state->m_colorram[((sy & 0x1c) << 3) + sx]; + col = m_colorram[((sy & 0x1c) << 3) + sx]; if (priority & ~col) continue; - scroll = ~state->m_scrollram[sx]; + scroll = ~m_scrollram[sx]; - code = state->m_videoram[offs] | ((col & 0x60) << 3); + code = m_videoram[offs] | ((col & 0x60) << 3); - if (state->flip_screen()) + if (flip_screen()) { sx = 31 - sx; sy = 31 - sy; scroll = ~scroll - 1; } - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], code, - (col & 0x0f) | ((*state->m_colorbank & 0x03) << 4), - state->flip_screen(), state->flip_screen(), + (col & 0x0f) | ((*m_colorbank & 0x03) << 4), + flip_screen(), flip_screen(), 8 * sx, (8 * sy + scroll) & 0xff, transpen); } } @@ -95,7 +94,7 @@ UINT32 ambush_state::screen_update_ambush(screen_device &screen, bitmap_ind16 &b bitmap.fill(0, cliprect); /* Draw the characters */ - draw_chars(machine(), bitmap, cliprect, 0x00); + draw_chars(bitmap, cliprect, 0x00); /* Draw the sprites. */ for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) @@ -153,6 +152,6 @@ UINT32 ambush_state::screen_update_ambush(screen_device &screen, bitmap_ind16 &b } /* Draw the foreground priority characters over the sprites */ - draw_chars(machine(), bitmap, cliprect, 0x10); + draw_chars(bitmap, cliprect, 0x10); return 0; } diff --git a/src/mame/video/amspdwy.c b/src/mame/video/amspdwy.c index 7908ee09644..0c3ae5428ae 100644 --- a/src/mame/video/amspdwy.c +++ b/src/mame/video/amspdwy.c @@ -98,15 +98,14 @@ Offset: Format: Value: ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void amspdwy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - amspdwy_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int i; - int max_x = machine.primary_screen->width() - 1; - int max_y = machine.primary_screen->height() - 1; + int max_x = machine().primary_screen->width() - 1; + int max_y = machine().primary_screen->height() - 1; - for (i = 0; i < state->m_spriteram.bytes() ; i += 4) + for (i = 0; i < m_spriteram.bytes() ; i += 4) { int y = spriteram[i + 0]; int x = spriteram[i + 1]; @@ -115,7 +114,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int flipx = attr & 0x80; int flipy = attr & 0x40; - if (state->flip_screen()) + if (flip_screen()) { x = max_x - x - 8; y = max_y - y - 8; @@ -123,7 +122,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const flipy = !flipy; } - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], // code + ((attr & 0x18)<<5), code + ((attr & 0x08)<<5), attr, @@ -144,6 +143,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 amspdwy_state::screen_update_amspdwy(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; } diff --git a/src/mame/video/angelkds.c b/src/mame/video/angelkds.c index 80904b6cbdc..8cd1f0ab809 100644 --- a/src/mame/video/angelkds.c +++ b/src/mame/video/angelkds.c @@ -119,12 +119,11 @@ a split down the middle of the screen */ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int enable_n) +void angelkds_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int enable_n) { - angelkds_state *state = machine.driver_data(); - const UINT8 *source = state->m_spriteram + 0x100 - 4; - const UINT8 *finish = state->m_spriteram; - gfx_element *gfx = machine.gfx[3]; + const UINT8 *source = m_spriteram + 0x100 - 4; + const UINT8 *finish = m_spriteram; + gfx_element *gfx = machine().gfx[3]; while (source >= finish) { @@ -261,7 +260,7 @@ UINT32 angelkds_state::screen_update_angelkds(screen_device &screen, bitmap_ind1 if ((m_layer_ctrl & 0x80) == 0x00) m_bgtop_tilemap->draw(bitmap, clip, 0, 0); - draw_sprites(machine(), bitmap, clip, 0x80); + draw_sprites(bitmap, clip, 0x80); if ((m_layer_ctrl & 0x20) == 0x00) m_tx_tilemap->draw(bitmap, clip, 0, 0); @@ -272,7 +271,7 @@ UINT32 angelkds_state::screen_update_angelkds(screen_device &screen, bitmap_ind1 if ((m_layer_ctrl & 0x40) == 0x00) m_bgbot_tilemap->draw(bitmap, clip, 0, 0); - draw_sprites(machine(), bitmap, clip, 0x40); + draw_sprites(bitmap, clip, 0x40); if ((m_layer_ctrl & 0x20) == 0x00) m_tx_tilemap->draw(bitmap, clip, 0, 0); diff --git a/src/mame/video/appoooh.c b/src/mame/video/appoooh.c index 20a9e9ad9be..a8cd4e25109 100644 --- a/src/mame/video/appoooh.c +++ b/src/mame/video/appoooh.c @@ -199,11 +199,10 @@ WRITE8_MEMBER(appoooh_state::appoooh_out_w) /* bit 7 unknown (used) */ } -static void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ) +void appoooh_state::appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ) { - appoooh_state *state = gfx->machine().driver_data(); int offs; - int flipy = state->flip_screen(); + int flipy = flip_screen(); for (offs = 0x20 - 4; offs >= 0; offs -= 4) { @@ -231,11 +230,10 @@ static void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &clipr } } -static void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ) +void appoooh_state::robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite ) { - appoooh_state *state = gfx->machine().driver_data(); int offs; - int flipy = state->flip_screen(); + int flipy = flip_screen(); for (offs = 0x20 - 4; offs >= 0; offs -= 4) { diff --git a/src/mame/video/aquarium.c b/src/mame/video/aquarium.c index 458b5095d61..1aa432386d2 100644 --- a/src/mame/video/aquarium.c +++ b/src/mame/video/aquarium.c @@ -4,53 +4,52 @@ #include "includes/aquarium.h" /* gcpinbal.c modified */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) +void aquarium_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) { - aquarium_state *state = machine.driver_data(); int offs, chain_pos; int x, y, curx, cury; UINT8 col, flipx, flipy, chain; UINT16 code; - for (offs = 0; offs < state->m_spriteram.bytes() / 2; offs += 8) + for (offs = 0; offs < m_spriteram.bytes() / 2; offs += 8) { - code = ((state->m_spriteram[offs + 5]) & 0xff) + (((state->m_spriteram[offs + 6]) & 0xff) << 8); + code = ((m_spriteram[offs + 5]) & 0xff) + (((m_spriteram[offs + 6]) & 0xff) << 8); code &= 0x3fff; - if (!(state->m_spriteram[offs + 4] &0x80)) /* active sprite ? */ + if (!(m_spriteram[offs + 4] &0x80)) /* active sprite ? */ { - x = ((state->m_spriteram[offs + 0]) &0xff) + (((state->m_spriteram[offs + 1]) & 0xff) << 8); - y = ((state->m_spriteram[offs + 2]) &0xff) + (((state->m_spriteram[offs + 3]) & 0xff) << 8); + x = ((m_spriteram[offs + 0]) &0xff) + (((m_spriteram[offs + 1]) & 0xff) << 8); + y = ((m_spriteram[offs + 2]) &0xff) + (((m_spriteram[offs + 3]) & 0xff) << 8); /* Treat coords as signed */ if (x & 0x8000) x -= 0x10000; if (y & 0x8000) y -= 0x10000; - col = ((state->m_spriteram[offs + 7]) & 0x0f); - chain = (state->m_spriteram[offs + 4]) & 0x07; - flipy = (state->m_spriteram[offs + 4]) & 0x10; - flipx = (state->m_spriteram[offs + 4]) & 0x20; + col = ((m_spriteram[offs + 7]) & 0x0f); + chain = (m_spriteram[offs + 4]) & 0x07; + flipy = (m_spriteram[offs + 4]) & 0x10; + flipx = (m_spriteram[offs + 4]) & 0x20; curx = x; cury = y; - if (((state->m_spriteram[offs + 4]) & 0x08) && flipy) + if (((m_spriteram[offs + 4]) & 0x08) && flipy) cury += (chain * 16); - if (!(((state->m_spriteram[offs + 4]) & 0x08)) && flipx) + if (!(((m_spriteram[offs + 4]) & 0x08)) && flipx) curx += (chain * 16); for (chain_pos = chain; chain_pos >= 0; chain_pos--) { - drawgfx_transpen(bitmap, cliprect,machine.gfx[0], + drawgfx_transpen(bitmap, cliprect,machine().gfx[0], code, col, flipx, flipy, curx,cury,0); /* wrap around y */ - drawgfx_transpen(bitmap, cliprect,machine.gfx[0], + drawgfx_transpen(bitmap, cliprect,machine().gfx[0], code, col, flipx, flipy, @@ -58,7 +57,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const code++; - if ((state->m_spriteram[offs + 4]) &0x08) /* Y chain */ + if ((m_spriteram[offs + 4]) &0x08) /* Y chain */ { if (flipy) cury -= 16; @@ -163,7 +162,7 @@ UINT32 aquarium_state::screen_update_aquarium(screen_device &screen, bitmap_ind1 m_bak_tilemap->draw(bitmap, cliprect, 0, 0); m_mid_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect, 16); + draw_sprites(bitmap, cliprect, 16); m_bak_tilemap->draw(bitmap, cliprect, 1, 0); m_mid_tilemap->draw(bitmap, cliprect, 1, 0); diff --git a/src/mame/video/arabian.c b/src/mame/video/arabian.c index cf7d4b09251..4268fe936e1 100644 --- a/src/mame/video/arabian.c +++ b/src/mame/video/arabian.c @@ -219,10 +219,9 @@ void arabian_state::video_start() * *************************************/ -static void blit_area( running_machine &machine, UINT8 plane, UINT16 src, UINT8 x, UINT8 y, UINT8 sx, UINT8 sy ) +void arabian_state::blit_area( UINT8 plane, UINT16 src, UINT8 x, UINT8 y, UINT8 sx, UINT8 sy ) { - arabian_state *state = machine.driver_data(); - UINT8 *srcdata = &state->m_converted_gfx[src * 4]; + UINT8 *srcdata = &m_converted_gfx[src * 4]; int i,j; /* loop over X, then Y */ @@ -236,7 +235,7 @@ static void blit_area( running_machine &machine, UINT8 plane, UINT16 src, UINT8 UINT8 *base; /* get a pointer to the bitmap */ - base = &state->m_main_bitmap[((y + j) & 0xff) * BITMAP_WIDTH + (x & 0xff)]; + base = &m_main_bitmap[((y + j) & 0xff) * BITMAP_WIDTH + (x & 0xff)]; /* bit 0 means write to upper plane (upper 4 bits of our bitmap) */ if (plane & 0x01) @@ -283,7 +282,7 @@ WRITE8_MEMBER(arabian_state::arabian_blitter_w) int sy = m_blitter[5]; /* blit it */ - blit_area(machine(), plane, src, x, y, sx, sy); + blit_area(plane, src, x, y, sx, sy); } } diff --git a/src/mame/video/arcadecl.c b/src/mame/video/arcadecl.c index 44c9fea6961..d375020573f 100644 --- a/src/mame/video/arcadecl.c +++ b/src/mame/video/arcadecl.c @@ -12,9 +12,6 @@ #include "video/atarimo.h" #include "includes/arcadecl.h" - -static void arcadecl_bitmap_render(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); - /************************************* * * Video system start @@ -80,7 +77,7 @@ VIDEO_START_MEMBER(arcadecl_state,arcadecl) UINT32 arcadecl_state::screen_update_arcadecl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* draw the playfield */ - arcadecl_bitmap_render(machine(), bitmap, cliprect); + arcadecl_bitmap_render(bitmap, cliprect); /* draw and merge the MO */ if (m_has_mo) @@ -118,15 +115,14 @@ UINT32 arcadecl_state::screen_update_arcadecl(screen_device &screen, bitmap_ind1 * *************************************/ -static void arcadecl_bitmap_render(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void arcadecl_state::arcadecl_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect) { - arcadecl_state *state = machine.driver_data(); int x, y; /* update any dirty scanlines */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - const UINT16 *src = &state->m_bitmap[256 * y]; + const UINT16 *src = &m_bitmap[256 * y]; UINT16 *dst = &bitmap.pix16(y); /* regenerate the line */ diff --git a/src/mame/video/argus.c b/src/mame/video/argus.c index 9057992e8a4..e6927115996 100644 --- a/src/mame/video/argus.c +++ b/src/mame/video/argus.c @@ -259,12 +259,11 @@ TILE_GET_INFO_MEMBER(argus_state::butasan_get_bg1_tile_info) Initialize and destroy video hardware emulation ***************************************************************************/ -static void reset_common(running_machine &machine) +void argus_state::reset_common() { - argus_state *state = machine.driver_data(); - state->m_bg_status = 0x01; - state->m_flipscreen = 0; - state->m_palette_intensity = 0; + m_bg_status = 0x01; + m_flipscreen = 0; + m_palette_intensity = 0; } VIDEO_START_MEMBER(argus_state,argus) @@ -290,7 +289,7 @@ VIDEO_RESET_MEMBER(argus_state,argus) m_bg0_scrollx[0] = 0; m_bg0_scrollx[1] = 0; memset(m_dummy_bg0ram, 0, 0x800); - reset_common(machine()); + reset_common(); } VIDEO_START_MEMBER(argus_state,valtric) @@ -309,7 +308,7 @@ VIDEO_START_MEMBER(argus_state,valtric) VIDEO_RESET_MEMBER(argus_state,valtric) { m_valtric_mosaic = 0x0f; - reset_common(machine()); + reset_common(); } VIDEO_START_MEMBER(argus_state,butasan) @@ -339,7 +338,7 @@ VIDEO_RESET_MEMBER(argus_state,butasan) m_butasan_bg1_status = 0x01; memset(m_butasan_pagedram[0], 0, 0x1000); memset(m_butasan_pagedram[1], 0, 0x1000); - reset_common(machine()); + reset_common(); } @@ -348,15 +347,14 @@ VIDEO_RESET_MEMBER(argus_state,butasan) ***************************************************************************/ /* Write bg0 pattern data to dummy bg0 ram */ -static void argus_write_dummy_rams(running_machine &machine, int dramoffs, int vromoffs) +void argus_state::argus_write_dummy_rams(int dramoffs, int vromoffs) { - argus_state *state = machine.driver_data(); int i; int voffs; int offs; - UINT8 *VROM1 = state->memregion("user1")->base(); /* "ag_15.bin" */ - UINT8 *VROM2 = state->memregion("user2")->base(); /* "ag_16.bin" */ + UINT8 *VROM1 = memregion("user1")->base(); /* "ag_15.bin" */ + UINT8 *VROM2 = memregion("user2")->base(); /* "ag_16.bin" */ /* offset in pattern data */ offs = VROM1[vromoffs] | (VROM1[vromoffs + 1] << 8); @@ -365,39 +363,37 @@ static void argus_write_dummy_rams(running_machine &machine, int dramoffs, int v voffs = offs * 16; for (i = 0; i < 8; i++) { - state->m_dummy_bg0ram[dramoffs] = VROM2[voffs]; - state->m_dummy_bg0ram[dramoffs + 1] = VROM2[voffs + 1]; - state->m_bg0_tilemap->mark_tile_dirty(dramoffs >> 1); + m_dummy_bg0ram[dramoffs] = VROM2[voffs]; + m_dummy_bg0ram[dramoffs + 1] = VROM2[voffs + 1]; + m_bg0_tilemap->mark_tile_dirty(dramoffs >> 1); dramoffs += 2; voffs += 2; } } -static void argus_change_palette(running_machine &machine, int color, int lo_offs, int hi_offs) +void argus_state::argus_change_palette(int color, int lo_offs, int hi_offs) { - argus_state *state = machine.driver_data(); - UINT8 lo = state->m_paletteram[lo_offs]; - UINT8 hi = state->m_paletteram[hi_offs]; + UINT8 lo = m_paletteram[lo_offs]; + UINT8 hi = m_paletteram[hi_offs]; 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 argus_change_bg_palette(running_machine &machine, int color, int lo_offs, int hi_offs) +void argus_state::argus_change_bg_palette(int color, int lo_offs, int hi_offs) { - argus_state *state = machine.driver_data(); UINT8 r,g,b,lo,hi,ir,ig,ib,ix; rgb_t rgb,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_paletteram[lo_offs]; - hi = state->m_paletteram[hi_offs]; + lo = m_paletteram[lo_offs]; + hi = m_paletteram[hi_offs]; /* red,green,blue component */ r = pal4bit(lo >> 4); @@ -405,7 +401,7 @@ static void argus_change_bg_palette(running_machine &machine, int color, int lo_ b = pal4bit(hi >> 4); /* Grey background enable */ - if (state->m_bg_status & 2) + if (m_bg_status & 2) { UINT8 val = (r + g + b) / 3; rgb = MAKE_RGB(val,val,val); @@ -417,7 +413,7 @@ static void argus_change_bg_palette(running_machine &machine, int color, int lo_ rgb = jal_blend_func(rgb,irgb,ix); - palette_set_color(machine,color,rgb); + palette_set_color(machine(),color,rgb); } @@ -465,7 +461,7 @@ WRITE8_MEMBER(argus_state::argus_bg_status_w) for (offs = 0x400; offs < 0x500; offs++) { - argus_change_bg_palette(machine(), (offs - 0x400) + 0x080, offs, offs + 0x400); + argus_change_bg_palette((offs - 0x400) + 0x080, offs, offs + 0x400); } } } @@ -484,7 +480,7 @@ WRITE8_MEMBER(argus_state::valtric_bg_status_w) for (offs = 0x400; offs < 0x600; offs += 2) { - argus_change_bg_palette(machine(), ((offs - 0x400) >> 1) + 0x100, offs & ~1, offs | 1); + argus_change_bg_palette(((offs - 0x400) >> 1) + 0x100, offs & ~1, offs | 1); } } } @@ -526,14 +522,14 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) { offset &= 0x07f; - argus_change_palette(machine(), offset, offset, offset + 0x080); + argus_change_palette(offset, offset, offset + 0x080); if (offset == 0x07f || offset == 0x0ff) { m_palette_intensity = m_paletteram[0x0ff] | (m_paletteram[0x07f] << 8); for (offs = 0x400; offs < 0x500; offs++) - argus_change_bg_palette(machine(), (offs & 0xff) + 0x080, offs, offs + 0x400); + argus_change_bg_palette((offs & 0xff) + 0x080, offs, offs + 0x400); } } else if ((offset >= 0x400 && offset <= 0x4ff) || @@ -542,7 +538,7 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) offs = offset & 0xff; offset = offs | 0x400; - argus_change_bg_palette(machine(), offs + 0x080, offset, offset + 0x400); + argus_change_bg_palette(offs + 0x080, offset, offset + 0x400); } else if ((offset >= 0x500 && offset <= 0x5ff) || (offset >= 0x900 && offset <= 0x9ff)) /* BG1 color */ @@ -550,7 +546,7 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) offs = offset & 0xff; offset = offs | 0x500; - argus_change_palette(machine(), offs + 0x180, offset, offset + 0x400); + argus_change_palette(offs + 0x180, offset, offset + 0x400); } else if ((offset >= 0x700 && offset <= 0x7ff) || (offset >= 0xb00 && offset <= 0xbff)) /* text color */ @@ -558,7 +554,7 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) offs = offset & 0xff; offset = offs | 0x700; - argus_change_palette(machine(), offs + 0x280, offset, offset + 0x400); + argus_change_palette(offs + 0x280, offset, offset + 0x400); } } @@ -568,7 +564,7 @@ WRITE8_MEMBER(argus_state::valtric_paletteram_w) if (offset <= 0x1ff) /* Sprite color */ { - argus_change_palette(machine(), offset >> 1, offset & ~1, offset | 1); + argus_change_palette(offset >> 1, offset & ~1, offset | 1); if (offset == 0x1fe || offset == 0x1ff) { @@ -577,16 +573,16 @@ WRITE8_MEMBER(argus_state::valtric_paletteram_w) m_palette_intensity = m_paletteram[0x1ff] | (m_paletteram[0x1fe] << 8); for (offs = 0x400; offs < 0x600; offs += 2) - argus_change_bg_palette(machine(), ((offs & 0x1ff) >> 1) + 0x100, offs & ~1, offs | 1); + argus_change_bg_palette(((offs & 0x1ff) >> 1) + 0x100, offs & ~1, offs | 1); } } else if (offset >= 0x400 && offset <= 0x5ff) /* BG color */ { - argus_change_bg_palette(machine(), ((offset & 0x1ff) >> 1) + 0x100, offset & ~1, offset | 1); + argus_change_bg_palette(((offset & 0x1ff) >> 1) + 0x100, offset & ~1, offset | 1); } else if (offset >= 0x600 && offset <= 0x7ff) /* Text color */ { - argus_change_palette(machine(), ((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); + argus_change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); } } @@ -596,31 +592,31 @@ WRITE8_MEMBER(argus_state::butasan_paletteram_w) if (offset <= 0x1ff) /* BG0 color */ { - argus_change_palette(machine(), (offset >> 1) + 0x100, offset & ~1, offset | 1); + argus_change_palette((offset >> 1) + 0x100, offset & ~1, offset | 1); } else if (offset <= 0x23f) /* BG1 color */ { - argus_change_palette(machine(), ((offset & 0x3f) >> 1) + 0x0c0, offset & ~1, offset | 1); + argus_change_palette(((offset & 0x3f) >> 1) + 0x0c0, offset & ~1, offset | 1); } else if (offset >= 0x400 && offset <= 0x47f) /* Sprite color */ { /* 16 colors */ - argus_change_palette(machine(), (offset & 0x7f) >> 1, offset & ~1, offset | 1); + argus_change_palette((offset & 0x7f) >> 1, offset & ~1, offset | 1); } else if (offset >= 0x480 && offset <= 0x4ff) /* Sprite color */ { /* 8 colors */ int offs = (offset & 0x070) | ((offset & 0x00f) >> 1); - argus_change_palette(machine(), offs + 0x040, offset & ~1, offset | 1); - argus_change_palette(machine(), offs + 0x048, offset & ~1, offset | 1); + argus_change_palette(offs + 0x040, offset & ~1, offset | 1); + argus_change_palette(offs + 0x048, offset & ~1, offset | 1); } else if (offset >= 0x600 && offset <= 0x7ff) /* Text color */ { - argus_change_palette(machine(), ((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); + argus_change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); } else if (offset >= 0x240 && offset <= 0x25f) // dummy - argus_change_palette(machine(), ((offset & 0x1f) >> 1) + 0xe0, offset & ~1, offset | 1); + argus_change_palette(((offset & 0x1f) >> 1) + 0xe0, offset & ~1, offset | 1); else if (offset >= 0x500 && offset <= 0x51f) // dummy - argus_change_palette(machine(), ((offset & 0x1f) >> 1) + 0xf0, offset & ~1, offset | 1); + argus_change_palette(((offset & 0x1f) >> 1) + 0xf0, offset & ~1, offset | 1); } READ8_MEMBER(argus_state::butasan_bg1ram_r) @@ -689,60 +685,58 @@ WRITE8_MEMBER(argus_state::butasan_unknown_w) Screen refresh ***************************************************************************/ -#define bg0_scrollx (state->m_bg0_scrollx[0] | (state->m_bg0_scrollx[1] << 8)) -#define bg0_scrolly (state->m_bg0_scrolly[0] | (state->m_bg0_scrolly[1] << 8)) -#define bg1_scrollx (state->m_bg1_scrollx[0] | (state->m_bg1_scrollx[1] << 8)) -#define bg1_scrolly (state->m_bg1_scrolly[0] | (state->m_bg1_scrolly[1] << 8)) +#define bg0_scrollx (m_bg0_scrollx[0] | (m_bg0_scrollx[1] << 8)) +#define bg0_scrolly (m_bg0_scrolly[0] | (m_bg0_scrolly[1] << 8)) +#define bg1_scrollx (m_bg1_scrollx[0] | (m_bg1_scrollx[1] << 8)) +#define bg1_scrolly (m_bg1_scrolly[0] | (m_bg1_scrolly[1] << 8)) -static void bg_setting(running_machine &machine) +void argus_state::bg_setting() { - argus_state *state = machine.driver_data(); - machine.tilemap().set_flip_all(state->m_flipscreen ? TILEMAP_FLIPY|TILEMAP_FLIPX : 0); + machine().tilemap().set_flip_all(m_flipscreen ? TILEMAP_FLIPY|TILEMAP_FLIPX : 0); - if (!state->m_flipscreen) + if (!m_flipscreen) { - if (state->m_bg0_tilemap != NULL) + if (m_bg0_tilemap != NULL) { - state->m_bg0_tilemap->set_scrollx(0, bg0_scrollx & 0x1ff); - state->m_bg0_tilemap->set_scrolly(0, bg0_scrolly & 0x1ff); + m_bg0_tilemap->set_scrollx(0, bg0_scrollx & 0x1ff); + m_bg0_tilemap->set_scrolly(0, bg0_scrolly & 0x1ff); } - state->m_bg1_tilemap->set_scrollx(0, bg1_scrollx & 0x1ff); - state->m_bg1_tilemap->set_scrolly(0, bg1_scrolly & 0x1ff); + m_bg1_tilemap->set_scrollx(0, bg1_scrollx & 0x1ff); + m_bg1_tilemap->set_scrolly(0, bg1_scrolly & 0x1ff); } else { - if (state->m_bg0_tilemap != NULL) + if (m_bg0_tilemap != NULL) { - state->m_bg0_tilemap->set_scrollx(0, (bg0_scrollx + 256) & 0x1ff); - state->m_bg0_tilemap->set_scrolly(0, (bg0_scrolly + 256) & 0x1ff); + m_bg0_tilemap->set_scrollx(0, (bg0_scrollx + 256) & 0x1ff); + m_bg0_tilemap->set_scrolly(0, (bg0_scrolly + 256) & 0x1ff); } - state->m_bg1_tilemap->set_scrollx(0, (bg1_scrollx + 256) & 0x1ff); - state->m_bg1_tilemap->set_scrolly(0, (bg1_scrolly + 256) & 0x1ff); + m_bg1_tilemap->set_scrollx(0, (bg1_scrollx + 256) & 0x1ff); + m_bg1_tilemap->set_scrolly(0, (bg1_scrolly + 256) & 0x1ff); } } -static void argus_bg0_scroll_handle(running_machine &machine) +void argus_state::argus_bg0_scroll_handle() { - argus_state *state = machine.driver_data(); int delta; int dcolumn; /* Deficit between previous and current scroll value */ - delta = bg0_scrollx - state->m_prvscrollx; - state->m_prvscrollx = bg0_scrollx; + delta = bg0_scrollx - m_prvscrollx; + m_prvscrollx = bg0_scrollx; if (delta == 0) return; if (delta > 0) { - state->m_lowbitscroll += delta % 16; + m_lowbitscroll += delta % 16; dcolumn = delta / 16; - if (state->m_lowbitscroll >= 16) + if (m_lowbitscroll >= 16) { dcolumn++; - state->m_lowbitscroll -= 16; + m_lowbitscroll -= 16; } if (dcolumn != 0) @@ -761,7 +755,7 @@ static void argus_bg0_scroll_handle(running_machine &machine) { for (j = 0; j < 4; j++) { - argus_write_dummy_rams(machine, woffs, roffs); + argus_write_dummy_rams(woffs, roffs); woffs += 16; roffs += 2; } @@ -776,13 +770,13 @@ static void argus_bg0_scroll_handle(running_machine &machine) } else { - state->m_lowbitscroll += (delta % 16); + m_lowbitscroll += (delta % 16); dcolumn = -(delta / 16); - if (state->m_lowbitscroll <= 0) + if (m_lowbitscroll <= 0) { dcolumn++; - state->m_lowbitscroll += 16; + m_lowbitscroll += 16; } if (dcolumn != 0) @@ -803,7 +797,7 @@ static void argus_bg0_scroll_handle(running_machine &machine) { for (j = 0; j < 4; j++) { - argus_write_dummy_rams(machine, woffs, roffs); + argus_write_dummy_rams(woffs, roffs); woffs += 16; roffs += 2; } @@ -816,14 +810,13 @@ static void argus_bg0_scroll_handle(running_machine &machine) } } -static void argus_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority) +void argus_state::argus_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority) { - argus_state *state = machine.driver_data(); - 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) { if (!(spriteram[offs+15] == 0 && spriteram[offs+11] == 0xf0)) { @@ -838,7 +831,7 @@ static void argus_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, c color = spriteram[offs+15] & 0x07; pri = (spriteram[offs+15] & 0x08) >> 3; - if (state->m_flipscreen) + if (m_flipscreen) { sx = 240 - sx; sy = 240 - sy; @@ -848,7 +841,7 @@ static void argus_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, c if (priority != pri) jal_blend_drawgfx( - bitmap,cliprect,machine.gfx[0], + bitmap,cliprect,machine().gfx[0], tile, color, flipx, flipy, @@ -859,40 +852,38 @@ static void argus_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, c } #if 1 -static void valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void argus_state::valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - argus_state *state = screen.machine().driver_data(); - - if (state->m_valtric_mosaic!=0x80) + if (m_valtric_mosaic!=0x80) { - state->m_mosaic=0x0f-(state->m_valtric_mosaic&0x0f); - if (state->m_mosaic!=0) state->m_mosaic++; - if (state->m_valtric_mosaic&0x80) state->m_mosaic*=-1; + m_mosaic=0x0f-(m_valtric_mosaic&0x0f); + if (m_mosaic!=0) m_mosaic++; + if (m_valtric_mosaic&0x80) m_mosaic*=-1; } - if (state->m_mosaic==0) - state->m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); + if (m_mosaic==0) + m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); else { - state->m_bg1_tilemap->draw(state->m_mosaicbitmap, cliprect, 0, 0); + m_bg1_tilemap->draw(m_mosaicbitmap, cliprect, 0, 0); { - int step=state->m_mosaic; + int step=m_mosaic; UINT32 *dest; int x,y,xx,yy,c=0; int width = screen.width(); int height = screen.height(); - if (state->m_mosaic<0)step*=-1; + if (m_mosaic<0)step*=-1; for (y=0;ym_mosaicbitmap.pix32(y, x); + c=m_mosaicbitmap.pix32(y, x); - if (state->m_mosaic<0) + if (m_mosaic<0) if (y+step-1m_mosaicbitmap.pix32(y+step-1, x+step-1); + c = m_mosaicbitmap.pix32(y+step-1, x+step-1); for (yy=0;yy(); - int step = 0x10 - (state->m_valtric_mosaic & 0x0f); + int step = 0x10 - (m_valtric_mosaic & 0x0f); if (step == 1) - state->m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); + m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); else { - state->m_bg1_tilemap->draw(state->m_mosaicbitmap, cliprect, 0, 0); + m_bg1_tilemap->draw(m_mosaicbitmap, cliprect, 0, 0); { UINT32 *dest; int x,y,xx,yy,c=0; @@ -928,11 +919,11 @@ static void valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con for (x = 0; x < height+step; x += step) { if (y < height && x < width) - c = state->m_mosaicbitmap.pix32(y, x); + c = m_mosaicbitmap.pix32(y, x); - if (state->m_valtric_mosaic & 0x80) + if (m_valtric_mosaic & 0x80) if (y+step-1 < height && x+step-1 < width) - c = state->m_mosaicbitmap.pix32(y+step-1, x+step-1); + c = m_mosaicbitmap.pix32(y+step-1, x+step-1); for (yy = 0; yy < step; yy++) for (xx = 0; xx < step; xx++) @@ -949,14 +940,13 @@ static void valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con } #endif -static void valtric_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void argus_state::valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - argus_state *state = machine.driver_data(); - 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) { if (!(spriteram[offs+15] == 0 && spriteram[offs+11] == 0xf0)) { @@ -970,7 +960,7 @@ static void valtric_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, flipy = spriteram[offs+13] & 0x20; color = spriteram[offs+15] & 0x0f; - if (state->m_flipscreen) + if (m_flipscreen) { sx = 240 - sx; sy = 240 - sy; @@ -979,7 +969,7 @@ static void valtric_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, } jal_blend_drawgfx( - bitmap,cliprect,machine.gfx[0], + bitmap,cliprect,machine().gfx[0], tile, color, flipx, flipy, @@ -989,14 +979,13 @@ static void valtric_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, } } -static void butasan_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void argus_state::butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - argus_state *state = machine.driver_data(); - 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 sx, sy, tile, flipx, flipy, color; int fx, fy; @@ -1017,7 +1006,7 @@ static void butasan_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, fx = flipx; fy = flipy; - if (state->m_flipscreen) + if (m_flipscreen) { sx = 240 - sx; sy = 240 - sy; @@ -1031,7 +1020,7 @@ static void butasan_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, if ((offs >= 0x100 && offs <= 0x2ff) || (offs >= 0x400 && offs <= 0x57f)) { jal_blend_drawgfx( - bitmap,cliprect,machine.gfx[0], + bitmap,cliprect,machine().gfx[0], tile, color, flipx, flipy, @@ -1045,7 +1034,7 @@ static void butasan_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, td = (fx) ? (1 - i) : i; jal_blend_drawgfx( - bitmap,cliprect,machine.gfx[0], + bitmap,cliprect,machine().gfx[0], tile + td, color, flipx, flipy, @@ -1065,7 +1054,7 @@ static void butasan_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, td = (fx) ? (i * 2) + 1 - j : i * 2 + j; jal_blend_drawgfx( - bitmap,cliprect,machine.gfx[0], + bitmap,cliprect,machine().gfx[0], tile + td, color, flipx, flipy, @@ -1086,7 +1075,7 @@ static void butasan_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, td = (fx) ? (i * 4) + 3 - j : i * 4 + j; jal_blend_drawgfx( - bitmap,cliprect,machine.gfx[0], + bitmap,cliprect,machine().gfx[0], tile + td, color, flipx, flipy, @@ -1100,20 +1089,19 @@ static void butasan_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, } -static void butasan_log_vram(running_machine &machine) +void argus_state::butasan_log_vram() { #ifdef MAME_DEBUG - argus_state *state = machine.driver_data(); int offs; - if (machine.input().code_pressed(KEYCODE_M)) + if (machine().input().code_pressed(KEYCODE_M)) { - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int i; logerror("\nSprite RAM\n"); logerror("---------------------------------------\n"); logerror(" +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +a +b +c +d +e +f\n"); - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 16) + for (offs = 0; offs < m_spriteram.bytes(); offs += 16) { for (i = 0; i < 16; i++) { @@ -1140,14 +1128,14 @@ static void butasan_log_vram(running_machine &machine) if (i == 0) { logerror("%04x : ", offs + 0xc400); - logerror("%02x ", state->m_paletteram[offs]); + logerror("%02x ", m_paletteram[offs]); } else if (i == 7) - logerror("%02x ", state->m_paletteram[offs + 7]); + logerror("%02x ", m_paletteram[offs + 7]); else if (i == 15) - logerror("%02x\n", state->m_paletteram[offs + 15]); + logerror("%02x\n", m_paletteram[offs + 15]); else - logerror("%02x ", state->m_paletteram[offs + i]); + logerror("%02x ", m_paletteram[offs + i]); } } } @@ -1156,45 +1144,45 @@ static void butasan_log_vram(running_machine &machine) UINT32 argus_state::screen_update_argus(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - bg_setting(machine()); + bg_setting(); /* scroll BG0 and render tile at proper position */ - argus_bg0_scroll_handle(machine()); + argus_bg0_scroll_handle(); m_bg0_tilemap->draw(bitmap, cliprect, 0, 0); - argus_draw_sprites(machine(), bitmap, cliprect, 0); + argus_draw_sprites(bitmap, cliprect, 0); if (m_bg_status & 1) /* Backgound enable */ m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); - argus_draw_sprites(machine(), bitmap, cliprect, 1); + argus_draw_sprites(bitmap, cliprect, 1); m_tx_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } UINT32 argus_state::screen_update_valtric(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - bg_setting(machine()); + bg_setting(); if (m_bg_status & 1) /* Backgound enable */ valtric_draw_mosaic(screen, bitmap, cliprect); else bitmap.fill(get_black_pen(machine()), cliprect); - valtric_draw_sprites(machine(), bitmap, cliprect); + valtric_draw_sprites(bitmap, cliprect); m_tx_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } UINT32 argus_state::screen_update_butasan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - bg_setting(machine()); + bg_setting(); if (m_bg_status & 1) /* Backgound enable */ m_bg0_tilemap->draw(bitmap, cliprect, 0, 0); else bitmap.fill(get_black_pen(machine()), cliprect); if (m_butasan_bg1_status & 1) m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); - butasan_draw_sprites(machine(), bitmap, cliprect); + butasan_draw_sprites(bitmap, cliprect); m_tx_tilemap->draw(bitmap, cliprect, 0, 0); - butasan_log_vram(machine()); + butasan_log_vram(); return 0; } diff --git a/src/mame/video/arkanoid.c b/src/mame/video/arkanoid.c index 4b03837a05d..14eabc4403d 100644 --- a/src/mame/video/arkanoid.c +++ b/src/mame/video/arkanoid.c @@ -211,33 +211,32 @@ VIDEO_START_MEMBER(arkanoid_state,arkanoid) m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(arkanoid_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 arkanoid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - arkanoid_state *state = machine.driver_data(); int offs; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { int sx, sy, code; - sx = state->m_spriteram[offs]; - sy = 248 - state->m_spriteram[offs + 1]; - if (state->flip_screen_x()) + sx = m_spriteram[offs]; + sy = 248 - m_spriteram[offs + 1]; + if (flip_screen_x()) sx = 248 - sx; - if (state->flip_screen_y()) + if (flip_screen_y()) sy = 248 - sy; - code = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 2] & 0x03) << 8) + 1024 * state->m_gfxbank; + code = m_spriteram[offs + 3] + ((m_spriteram[offs + 2] & 0x03) << 8) + 1024 * m_gfxbank; - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], 2 * code, - ((state->m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->m_palettebank, - state->flip_screen_x(),state->flip_screen_y(), - sx,sy + (state->flip_screen_y() ? 8 : -8),0); - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + ((m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * m_palettebank, + flip_screen_x(),flip_screen_y(), + sx,sy + (flip_screen_y() ? 8 : -8),0); + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], 2 * code + 1, - ((state->m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->m_palettebank, - state->flip_screen_x(),state->flip_screen_y(), + ((m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * m_palettebank, + flip_screen_x(),flip_screen_y(), sx,sy,0); } } @@ -246,7 +245,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 arkanoid_state::screen_update_arkanoid(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; } diff --git a/src/mame/video/armedf.c b/src/mame/video/armedf.c index f4be195cefa..936407513ac 100644 --- a/src/mame/video/armedf.c +++ b/src/mame/video/armedf.c @@ -256,11 +256,10 @@ WRITE16_MEMBER(armedf_state::armedf_bg_scrolly_w) ***************************************************************************/ /* custom code to handle color cycling effect, handled by m_spr_pal_clut */ -void armedf_drawgfx(running_machine &machine, bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, +void armedf_state::armedf_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, UINT32 code,UINT32 color, UINT32 clut,int flipx,int flipy,int offsx,int offsy, int transparent_color) { - armedf_state *state = machine.driver_data(); const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; const UINT8 *source_base = gfx->get_data(code % gfx->elements()); int x_index_base, y_index, sx, sy, ex, ey; @@ -314,7 +313,7 @@ void armedf_drawgfx(running_machine &machine, bitmap_ind16 &dest_bmp,const recta int x_index = x_index_base; for (x = sx; x < ex; x++) { - int c = (source[x_index] & ~0xf) | ((state->m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); + int c = (source[x_index] & ~0xf) | ((m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); if (c != transparent_color) dest[x] = pal[c]; @@ -327,13 +326,12 @@ void armedf_drawgfx(running_machine &machine, bitmap_ind16 &dest_bmp,const recta } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) +void armedf_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { - armedf_state *state = machine.driver_data(); - UINT16 *buffered_spriteram = state->m_spriteram->buffer(); + UINT16 *buffered_spriteram = m_spriteram->buffer(); int offs; - for (offs = 0; offs < state->m_spriteram->bytes() / 2; offs += 4) + for (offs = 0; offs < m_spriteram->bytes() / 2; offs += 4) { int code = buffered_spriteram[offs + 1]; /* ??YX?TTTTTTTTTTT */ int flipx = code & 0x2000; @@ -341,9 +339,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int color = (buffered_spriteram[offs + 2] >> 8) & 0x1f; int clut = (buffered_spriteram[offs + 2]) & 0x7f; int sx = buffered_spriteram[offs + 3]; - int sy = state->m_sprite_offy + 240 - (buffered_spriteram[offs + 0] & 0x1ff); + int sy = m_sprite_offy + 240 - (buffered_spriteram[offs + 0] & 0x1ff); - if (state->flip_screen()) + if (flip_screen()) { sx = 320 - sx + 176; /* don't ask where 176 comes from, just tried it out */ sy = 240 - sy + 1; /* don't ask where 1 comes from, just tried it out */ @@ -353,7 +351,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (((buffered_spriteram[offs + 0] & 0x3000) >> 12) == priority) { - armedf_drawgfx(machine,bitmap,cliprect,machine.gfx[3], + armedf_drawgfx(bitmap,cliprect,machine().gfx[3], code & 0xfff, color,clut, flipx,flipy, @@ -393,15 +391,15 @@ UINT32 armedf_state::screen_update_armedf(screen_device &screen, bitmap_ind16 &b m_bg_tilemap->draw(bitmap, cliprect, 0, 0); if (sprite_enable) - draw_sprites(machine(), bitmap, cliprect, 2); + draw_sprites(bitmap, cliprect, 2); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); if (sprite_enable) - draw_sprites(machine(), bitmap, cliprect, 1); + draw_sprites(bitmap, cliprect, 1); if (sprite_enable) - draw_sprites(machine(), bitmap, cliprect, 0); + draw_sprites(bitmap, cliprect, 0); m_tx_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(0), 0); diff --git a/src/mame/video/astrocde.c b/src/mame/video/astrocde.c index d5a349326a0..d07d35bd8b0 100644 --- a/src/mame/video/astrocde.c +++ b/src/mame/video/astrocde.c @@ -22,28 +22,13 @@ #define VERT_OFFSET (22) /* pixels from top of screen to top of game area */ #define HORZ_OFFSET (16) /* pixels from left of screen to left of game area */ - - -/************************************* - * - * Function prototypes - * - *************************************/ - -static void init_savestate(running_machine &machine); - - -static void init_sparklestar(running_machine &machine); - - - /************************************* * * Scanline conversion * *************************************/ -INLINE int mame_vpos_to_astrocade_vpos(int scanline) +inline int astrocde_state::mame_vpos_to_astrocade_vpos(int scanline) { scanline -= VERT_OFFSET; if (scanline < 0) @@ -168,11 +153,11 @@ void astrocde_state::video_start() m_intoff_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(astrocde_state::interrupt_off),this)); /* register for save states */ - init_savestate(machine()); + init_savestate(); /* initialize the sparkle and stars */ if (m_video_config & AC_STARS) - init_sparklestar(machine()); + init_sparklestar(); } @@ -187,7 +172,7 @@ VIDEO_START_MEMBER(astrocde_state,profpac) m_profpac_videoram = auto_alloc_array(machine(), UINT16, 0x4000 * 4); /* register for save states */ - init_savestate(machine()); + init_savestate(); /* register our specific save state data */ state_save_register_global_pointer(machine(), m_profpac_videoram, 0x4000 * 4); @@ -204,37 +189,36 @@ VIDEO_START_MEMBER(astrocde_state,profpac) } -static void init_savestate(running_machine &machine) +void astrocde_state::init_savestate() { - astrocde_state *state = machine.driver_data(); - state_save_register_global_array(machine, state->m_sparkle); + state_save_register_global_array(machine(), m_sparkle); - state_save_register_global(machine, state->m_interrupt_enabl); - state_save_register_global(machine, state->m_interrupt_vector); - state_save_register_global(machine, state->m_interrupt_scanline); - state_save_register_global(machine, state->m_vertical_feedback); - state_save_register_global(machine, state->m_horizontal_feedback); + state_save_register_global(machine(), m_interrupt_enabl); + state_save_register_global(machine(), m_interrupt_vector); + state_save_register_global(machine(), m_interrupt_scanline); + state_save_register_global(machine(), m_vertical_feedback); + state_save_register_global(machine(), m_horizontal_feedback); - state_save_register_global_array(machine, state->m_colors); - state_save_register_global(machine, state->m_colorsplit); - state_save_register_global(machine, state->m_bgdata); - state_save_register_global(machine, state->m_vblank); - state_save_register_global(machine, state->m_video_mode); + state_save_register_global_array(machine(), m_colors); + state_save_register_global(machine(), m_colorsplit); + state_save_register_global(machine(), m_bgdata); + state_save_register_global(machine(), m_vblank); + state_save_register_global(machine(), m_video_mode); - state_save_register_global_array(machine, state->m_funcgen_expand_color); - state_save_register_global(machine, state->m_funcgen_control); - state_save_register_global(machine, state->m_funcgen_expand_count); - state_save_register_global(machine, state->m_funcgen_rotate_count); - state_save_register_global_array(machine, state->m_funcgen_rotate_data); - state_save_register_global(machine, state->m_funcgen_shift_prev_data); - state_save_register_global(machine, state->m_funcgen_intercept); + state_save_register_global_array(machine(), m_funcgen_expand_color); + state_save_register_global(machine(), m_funcgen_control); + state_save_register_global(machine(), m_funcgen_expand_count); + state_save_register_global(machine(), m_funcgen_rotate_count); + state_save_register_global_array(machine(), m_funcgen_rotate_data); + state_save_register_global(machine(), m_funcgen_shift_prev_data); + state_save_register_global(machine(), m_funcgen_intercept); - state_save_register_global(machine, state->m_pattern_source); - state_save_register_global(machine, state->m_pattern_mode); - state_save_register_global(machine, state->m_pattern_dest); - state_save_register_global(machine, state->m_pattern_skip); - state_save_register_global(machine, state->m_pattern_width); - state_save_register_global(machine, state->m_pattern_height); + state_save_register_global(machine(), m_pattern_source); + state_save_register_global(machine(), m_pattern_mode); + state_save_register_global(machine(), m_pattern_dest); + state_save_register_global(machine(), m_pattern_skip); + state_save_register_global(machine(), m_pattern_width); + state_save_register_global(machine(), m_pattern_height); } @@ -377,30 +361,29 @@ TIMER_CALLBACK_MEMBER(astrocde_state::interrupt_off) } -static void astrocade_trigger_lightpen(running_machine &machine, UINT8 vfeedback, UINT8 hfeedback) +void astrocde_state::astrocade_trigger_lightpen(UINT8 vfeedback, UINT8 hfeedback) { - astrocde_state *state = machine.driver_data(); /* both bits 1 and 4 enable lightpen interrupts; bit 4 enables them even in horizontal */ /* blanking regions; we treat them both the same here */ - if ((state->m_interrupt_enabl & 0x12) != 0) + if ((m_interrupt_enabl & 0x12) != 0) { /* bit 0 controls the interrupt mode: mode 0 means assert until acknowledged */ - if ((state->m_interrupt_enabl & 0x01) == 0) + if ((m_interrupt_enabl & 0x01) == 0) { - machine.device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, state->m_interrupt_vector & 0xf0); - state->m_intoff_timer->adjust(machine.primary_screen->time_until_pos(vfeedback)); + machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, m_interrupt_vector & 0xf0); + m_intoff_timer->adjust(machine().primary_screen->time_until_pos(vfeedback)); } /* mode 1 means assert for 1 instruction */ else { - machine.device("maincpu")->execute().set_input_line_and_vector(0, ASSERT_LINE, state->m_interrupt_vector & 0xf0); - state->m_intoff_timer->adjust(machine.device("maincpu")->cycles_to_attotime(1)); + machine().device("maincpu")->execute().set_input_line_and_vector(0, ASSERT_LINE, m_interrupt_vector & 0xf0); + m_intoff_timer->adjust(machine().device("maincpu")->cycles_to_attotime(1)); } /* latch the feedback registers */ - state->m_vertical_feedback = vfeedback; - state->m_horizontal_feedback = hfeedback; + m_vertical_feedback = vfeedback; + m_horizontal_feedback = hfeedback; } } @@ -441,7 +424,7 @@ TIMER_CALLBACK_MEMBER(astrocde_state::scanline_callback) /* on some games, the horizontal drive line is conected to the lightpen interrupt */ else if (m_video_config & AC_LIGHTPEN_INTS) - astrocade_trigger_lightpen(machine(), astrocade_scanline, 8); + astrocade_trigger_lightpen(astrocade_scanline, 8); /* advance to the next scanline */ scanline++; @@ -706,47 +689,46 @@ WRITE8_MEMBER(astrocde_state::astrocade_funcgen_w) * *************************************/ -INLINE void increment_source(astrocde_state *state, UINT8 curwidth, UINT8 *u13ff) +inline void astrocde_state::increment_source(UINT8 curwidth, UINT8 *u13ff) { /* if the flip-flop at U13 is high and mode.d2 is 1 we can increment */ /* however, if mode.d3 is set and we're on the last byte of a row, the increment is suppressed */ - if (*u13ff && (state->m_pattern_mode & 0x04) != 0 && (curwidth != 0 || (state->m_pattern_mode & 0x08) == 0)) - state->m_pattern_source++; + if (*u13ff && (m_pattern_mode & 0x04) != 0 && (curwidth != 0 || (m_pattern_mode & 0x08) == 0)) + m_pattern_source++; /* if mode.d1 is 1, toggle the flip-flop; otherwise leave it preset */ - if ((state->m_pattern_mode & 0x02) != 0) + if ((m_pattern_mode & 0x02) != 0) *u13ff ^= 1; } -INLINE void increment_dest(astrocde_state *state, UINT8 curwidth) +inline void astrocde_state::increment_dest(UINT8 curwidth) { /* increment is suppressed for the last byte in a row */ if (curwidth != 0) { /* if mode.d5 is 1, we increment */ - if ((state->m_pattern_mode & 0x20) != 0) - state->m_pattern_dest++; + if ((m_pattern_mode & 0x20) != 0) + m_pattern_dest++; /* otherwise, we decrement */ else - state->m_pattern_dest--; + m_pattern_dest--; } } -static void execute_blit(address_space &space) +void astrocde_state::execute_blit(address_space &space) { - astrocde_state *state = space.machine().driver_data(); /* - state->m_pattern_source = counter set U7/U16/U25/U34 - state->m_pattern_dest = counter set U9/U18/U30/U39 - state->m_pattern_mode = latch U21 - state->m_pattern_skip = latch set U30/U39 - state->m_pattern_width = latch set U32/U41 - state->m_pattern_height = counter set U31/U40 + m_pattern_source = counter set U7/U16/U25/U34 + m_pattern_dest = counter set U9/U18/U30/U39 + m_pattern_mode = latch U21 + m_pattern_skip = latch set U30/U39 + m_pattern_width = latch set U32/U41 + m_pattern_height = counter set U31/U40 - state->m_pattern_mode bits: + m_pattern_mode bits: d0 = direction (0 = read from src, write to dest, 1 = read from dest, write to src) d1 = expand (0 = increment src each pixel, 1 = increment src every other pixel) d2 = constant (0 = never increment src, 1 = normal src increment) @@ -760,13 +742,13 @@ static void execute_blit(address_space &space) int cycles = 0; /* logerror("Blit: src=%04X mode=%02X dest=%04X skip=%02X width=%02X height=%02X\n", - state->m_pattern_source, state->m_pattern_mode, state->m_pattern_dest, state->m_pattern_skip, state->m_pattern_width, state->m_pattern_height);*/ + m_pattern_source, m_pattern_mode, m_pattern_dest, m_pattern_skip, m_pattern_width, m_pattern_height);*/ /* flip-flop at U13 is cleared at the beginning */ u13ff = 0; /* it is also forced preset if mode.d1 == 0 */ - if ((state->m_pattern_mode & 0x02) == 0) + if ((m_pattern_mode & 0x02) == 0) u13ff = 1; /* loop over height */ @@ -775,7 +757,7 @@ static void execute_blit(address_space &space) UINT16 carry; /* loop over width */ - curwidth = state->m_pattern_width; + curwidth = m_pattern_width; do { UINT16 busaddr; @@ -784,31 +766,31 @@ static void execute_blit(address_space &space) /* ----- read phase ----- */ /* address is selected between source/dest based on mode.d0 */ - busaddr = ((state->m_pattern_mode & 0x01) == 0) ? state->m_pattern_source : state->m_pattern_dest; + busaddr = ((m_pattern_mode & 0x01) == 0) ? m_pattern_source : m_pattern_dest; /* if mode.d3 is set, then the last byte fetched per row is forced to 0 */ - if (curwidth == 0 && (state->m_pattern_mode & 0x08) != 0) + if (curwidth == 0 && (m_pattern_mode & 0x08) != 0) busdata = 0; else busdata = space.read_byte(busaddr); /* increment the appropriate address */ - if ((state->m_pattern_mode & 0x01) == 0) - increment_source(state, curwidth, &u13ff); + if ((m_pattern_mode & 0x01) == 0) + increment_source(curwidth, &u13ff); else - increment_dest(state, curwidth); + increment_dest(curwidth); /* ----- write phase ----- */ /* address is selected between source/dest based on mode.d0 */ - busaddr = ((state->m_pattern_mode & 0x01) != 0) ? state->m_pattern_source : state->m_pattern_dest; + busaddr = ((m_pattern_mode & 0x01) != 0) ? m_pattern_source : m_pattern_dest; space.write_byte(busaddr, busdata); /* increment the appropriate address */ - if ((state->m_pattern_mode & 0x01) == 0) - increment_dest(state, curwidth); + if ((m_pattern_mode & 0x01) == 0) + increment_dest(curwidth); else - increment_source(state, curwidth, &u13ff); + increment_source(curwidth, &u13ff); /* count 4 cycles (two read, two write) */ cycles += 4; @@ -816,16 +798,16 @@ static void execute_blit(address_space &space) } while (curwidth-- != 0); /* at the end of each row, the skip value is added to the dest value */ - carry = ((state->m_pattern_dest & 0xff) + state->m_pattern_skip) & 0x100; - state->m_pattern_dest = (state->m_pattern_dest & 0xff00) | ((state->m_pattern_dest + state->m_pattern_skip) & 0xff); + carry = ((m_pattern_dest & 0xff) + m_pattern_skip) & 0x100; + m_pattern_dest = (m_pattern_dest & 0xff00) | ((m_pattern_dest + m_pattern_skip) & 0xff); /* carry behavior into the top byte is controlled by mode.d4 */ - if ((state->m_pattern_mode & 0x10) == 0) - state->m_pattern_dest += carry; + if ((m_pattern_mode & 0x10) == 0) + m_pattern_dest += carry; else - state->m_pattern_dest -= carry ^ 0x100; + m_pattern_dest -= carry ^ 0x100; - } while (state->m_pattern_height-- != 0); + } while (m_pattern_height-- != 0); /* count cycles we ran the bus */ space.device().execute().adjust_icount(-cycles); @@ -905,17 +887,16 @@ WRITE8_MEMBER(astrocde_state::astrocade_pattern_board_w) relative to the beginning of time and use that, mod RNG_PERIOD. */ -static void init_sparklestar(running_machine &machine) +void astrocde_state::init_sparklestar() { - astrocde_state *state = machine.driver_data(); UINT32 shiftreg; int i; /* reset global sparkle state */ - state->m_sparkle[0] = state->m_sparkle[1] = state->m_sparkle[2] = state->m_sparkle[3] = 0; + m_sparkle[0] = m_sparkle[1] = m_sparkle[2] = m_sparkle[3] = 0; /* allocate memory for the sparkle/star array */ - state->m_sparklestar = auto_alloc_array(machine, UINT8, RNG_PERIOD); + m_sparklestar = auto_alloc_array(machine(), UINT8, RNG_PERIOD); /* generate the data for the sparkle/star array */ for (shiftreg = i = 0; i < RNG_PERIOD; i++) @@ -928,7 +909,7 @@ static void init_sparklestar(running_machine &machine) /* extract the sparkle/star intensity here */ /* this is controlled by the shift register at U17/U19/U18 */ - state->m_sparklestar[i] = (((shiftreg >> 4) & 1) << 3) | + m_sparklestar[i] = (((shiftreg >> 4) & 1) << 3) | (((shiftreg >> 12) & 1) << 2) | (((shiftreg >> 16) & 1) << 1) | (((shiftreg >> 8) & 1) << 0); @@ -936,7 +917,7 @@ static void init_sparklestar(running_machine &machine) /* determine the star enable here */ /* this is controlled by the shift register at U17/U12/U11 */ if ((shiftreg & 0xff) == 0xfe) - state->m_sparklestar[i] |= 0x10; + m_sparklestar[i] |= 0x10; } } diff --git a/src/mame/video/atarifb.c b/src/mame/video/atarifb.c index b1d761f7f6f..1975ca60cd7 100644 --- a/src/mame/video/atarifb.c +++ b/src/mame/video/atarifb.c @@ -14,7 +14,7 @@ * *************************************/ -static void get_tile_info_common( running_machine &machine, tile_data &tileinfo, tilemap_memory_index tile_index, UINT8 *alpha_videoram ) +void atarifb_state::get_tile_info_common( tile_data &tileinfo, tilemap_memory_index tile_index, UINT8 *alpha_videoram ) { int code = alpha_videoram[tile_index] & 0x3f; int flip = alpha_videoram[tile_index] & 0x40; @@ -23,19 +23,19 @@ static void get_tile_info_common( running_machine &machine, tile_data &tileinfo, if (disable) code = 0; /* I *know* this is a space */ - SET_TILE_INFO(0, code, 0, (flip ? TILE_FLIPX | TILE_FLIPY : 0)); + SET_TILE_INFO_MEMBER(0, code, 0, (flip ? TILE_FLIPX | TILE_FLIPY : 0)); } TILE_GET_INFO_MEMBER(atarifb_state::alpha1_get_tile_info) { - get_tile_info_common(machine(), tileinfo, tile_index, m_alphap1_videoram); + get_tile_info_common(tileinfo, tile_index, m_alphap1_videoram); } TILE_GET_INFO_MEMBER(atarifb_state::alpha2_get_tile_info) { - get_tile_info_common(machine(), tileinfo, tile_index, m_alphap2_videoram); + get_tile_info_common(tileinfo, tile_index, m_alphap2_videoram); } @@ -93,26 +93,24 @@ void atarifb_state::video_start() -static void draw_playfield_and_alpha( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int playfield_x_offset, int playfield_y_offset ) +void atarifb_state::draw_playfield_and_alpha( bitmap_ind16 &bitmap, const rectangle &cliprect, int playfield_x_offset, int playfield_y_offset ) { - atarifb_state *state = machine.driver_data(); const rectangle bigfield_area(4 * 8, 34 * 8 - 1, 0 * 8, 32 * 8 - 1); int scroll_x[1]; int scroll_y[1]; - scroll_x[0] = - *state->m_scroll_register + 32 + playfield_x_offset; + scroll_x[0] = - *m_scroll_register + 32 + playfield_x_offset; scroll_y[0] = 8 + playfield_y_offset; - copybitmap(bitmap, state->m_alpha1_tilemap->pixmap(), 0, 0, 35*8, 1*8, cliprect); - copybitmap(bitmap, state->m_alpha2_tilemap->pixmap(), 0, 0, 0*8, 1*8, cliprect); - copyscrollbitmap(bitmap, state->m_field_tilemap->pixmap(), 1, scroll_x, 1, scroll_y, bigfield_area); + copybitmap(bitmap, m_alpha1_tilemap->pixmap(), 0, 0, 35*8, 1*8, cliprect); + copybitmap(bitmap, m_alpha2_tilemap->pixmap(), 0, 0, 0*8, 1*8, cliprect); + copyscrollbitmap(bitmap, m_field_tilemap->pixmap(), 1, scroll_x, 1, scroll_y, bigfield_area); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int gfx, int is_soccer ) +void atarifb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfx, int is_soccer ) { - atarifb_state *state = machine.driver_data(); const rectangle bigfield_area(4 * 8, 34 * 8 - 1, 0 * 8, 32 * 8 - 1); int obj; @@ -124,14 +122,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int sx, sy; int shade = 0; - sy = 255 - state->m_spriteram[obj * 2 + 1]; + sy = 255 - m_spriteram[obj * 2 + 1]; if (sy == 255) continue; - charcode = state->m_spriteram[obj * 2] & 0x3f; - flipx = (state->m_spriteram[obj * 2] & 0x40); - flipy = (state->m_spriteram[obj * 2] & 0x80); - sx = state->m_spriteram[obj * 2 + 0x20] + 8 * 3; + charcode = m_spriteram[obj * 2] & 0x3f; + flipx = (m_spriteram[obj * 2] & 0x40); + flipy = (m_spriteram[obj * 2] & 0x80); + sx = m_spriteram[obj * 2 + 0x20] + 8 * 3; /* Note on Atari Soccer: */ /* There are 3 sets of 2 bits each, where the 2 bits represent */ @@ -139,16 +137,16 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const /* color of each bit in the sprite, but I haven't implemented it that way. */ if (is_soccer) { - shade = ((state->m_spriteram[obj * 2 + 1 + 0x20]) & 0x07); + shade = ((m_spriteram[obj * 2 + 1 + 0x20]) & 0x07); - drawgfx_transpen(bitmap, bigfield_area, machine.gfx[gfx + 1], + drawgfx_transpen(bitmap, bigfield_area, machine().gfx[gfx + 1], charcode, shade, flipx, flipy, sx, sy, 0); - shade = ((state->m_spriteram[obj * 2 + 1 + 0x20]) & 0x08) >> 3; + shade = ((m_spriteram[obj * 2 + 1 + 0x20]) & 0x08) >> 3; } - drawgfx_transpen(bitmap, bigfield_area, machine.gfx[gfx], + drawgfx_transpen(bitmap, bigfield_area, machine().gfx[gfx], charcode, shade, flipx, flipy, sx, sy, 0); @@ -160,7 +158,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if ((charcode == 0x11) && (sy == 0x07)) { sy = 0xf1; /* When multiplexed, it's 0x10...why? */ - drawgfx_transpen(bitmap, bigfield_area, machine.gfx[gfx], + drawgfx_transpen(bitmap, bigfield_area, machine().gfx[gfx], charcode, 0, flipx, flipy, sx, sy, 0); } @@ -171,9 +169,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 atarifb_state::screen_update_atarifb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_playfield_and_alpha(machine(), bitmap, cliprect, 0, 0); + draw_playfield_and_alpha(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect, 1, 0); + draw_sprites(bitmap, cliprect, 1, 0); return 0; } @@ -181,9 +179,9 @@ UINT32 atarifb_state::screen_update_atarifb(screen_device &screen, bitmap_ind16 UINT32 atarifb_state::screen_update_abaseb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_playfield_and_alpha(machine(), bitmap, cliprect, -8, 0); + draw_playfield_and_alpha(bitmap, cliprect, -8, 0); - draw_sprites(machine(), bitmap, cliprect, 1, 0); + draw_sprites(bitmap, cliprect, 1, 0); return 0; } @@ -191,9 +189,9 @@ UINT32 atarifb_state::screen_update_abaseb(screen_device &screen, bitmap_ind16 & UINT32 atarifb_state::screen_update_soccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_playfield_and_alpha(machine(), bitmap, cliprect, 0, 8); + draw_playfield_and_alpha(bitmap, cliprect, 0, 8); - draw_sprites(machine(), bitmap, cliprect, 2, 1); + draw_sprites(bitmap, cliprect, 2, 1); return 0; } diff --git a/src/mame/video/atarisy1.c b/src/mame/video/atarisy1.c index 6b4c375df46..98b870c2cef 100644 --- a/src/mame/video/atarisy1.c +++ b/src/mame/video/atarisy1.c @@ -72,20 +72,6 @@ static const gfx_layout objlayout_6bpp = 8*8 /* every sprite takes 8 consecutive bytes */ }; - - -/************************************* - * - * Prototypes - * - *************************************/ - -static void update_timers(running_machine &machine, int scanline); -static void decode_gfx(running_machine &machine, UINT16 *pflookup, UINT16 *molookup); -static int get_bank(running_machine &machine, UINT8 prom1, UINT8 prom2, int bpp); - - - /************************************* * * Tilemap callbacks @@ -165,7 +151,7 @@ VIDEO_START_MEMBER(atarisy1_state,atarisy1) int i, size; /* first decode the graphics */ - decode_gfx(machine(), m_playfield_lookup, motable); + decode_gfx(m_playfield_lookup, motable); /* initialize the playfield */ m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(atarisy1_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,64); @@ -233,7 +219,7 @@ WRITE16_HANDLER( atarisy1_bankselect_w ) /* motion object bank select */ atarimo_set_bank(0, (newselect >> 3) & 7); - update_timers(space.machine(), scanline); + state->update_timers(scanline); /* playfield bank select */ if (diff & 0x0004) @@ -344,6 +330,7 @@ WRITE16_HANDLER( atarisy1_yscroll_w ) WRITE16_HANDLER( atarisy1_spriteram_w ) { + atarisy1_state *state = space.machine().driver_data(); int active_bank = atarimo_get_bank(0); int oldword = atarimo_0_spriteram_r(space, offset, mem_mask); int newword = oldword; @@ -358,7 +345,7 @@ WRITE16_HANDLER( atarisy1_spriteram_w ) { /* if the timer is in the active bank, update the display list */ atarimo_0_spriteram_w(space, offset, data, 0xffff); - update_timers(space.machine(), space.machine().primary_screen->vpos()); + state->update_timers(space.machine().primary_screen->vpos()); } /* if we're about to modify data in the active sprite bank, make sure the video is up-to-date */ @@ -402,7 +389,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(atarisy1_state::atarisy1_int3_callback) /* determine the time of the next one */ m_next_timer_scanline = -1; - update_timers(machine(), scanline); + update_timers(scanline); } @@ -427,10 +414,9 @@ READ16_HANDLER( atarisy1_int3state_r ) * *************************************/ -static void update_timers(running_machine &machine, int scanline) +void atarisy1_state::update_timers(int scanline) { - atarisy1_state *state = machine.driver_data(); - address_space &space = state->generic_space(); + address_space &space = generic_space(); UINT16 mem_mask = 0xffff; int offset = atarimo_get_bank(0) * 64 * 4; int link = 0, best = scanline, found = 0; @@ -475,15 +461,15 @@ static void update_timers(running_machine &machine, int scanline) best = -1; /* update the timer */ - if (best != state->m_next_timer_scanline) + if (best != m_next_timer_scanline) { - state->m_next_timer_scanline = best; + m_next_timer_scanline = best; /* set a new one */ if (best != -1) - state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(best), best); + m_scanline_timer->adjust(machine().primary_screen->time_until_pos(best), best); else - state->m_scanline_timer->reset(); + m_scanline_timer->reset(); } } @@ -548,15 +534,14 @@ UINT32 atarisy1_state::screen_update_atarisy1(screen_device &screen, bitmap_ind1 * *************************************/ -static void decode_gfx(running_machine &machine, UINT16 *pflookup, UINT16 *molookup) +void atarisy1_state::decode_gfx(UINT16 *pflookup, UINT16 *molookup) { - atarisy1_state *state = machine.driver_data(); - UINT8 *prom1 = &state->memregion("proms")->u8(0x000); - UINT8 *prom2 = &state->memregion("proms")->u8(0x200); + UINT8 *prom1 = &memregion("proms")->u8(0x000); + UINT8 *prom2 = &memregion("proms")->u8(0x200); int obj, i; /* reset the globals */ - memset(&state->m_bank_gfx[0][0], 0, sizeof(state->m_bank_gfx)); + memset(&m_bank_gfx[0][0], 0, sizeof(m_bank_gfx)); /* loop for two sets of objects */ for (obj = 0; obj < 2; obj++) @@ -579,7 +564,7 @@ static void decode_gfx(running_machine &machine, UINT16 *pflookup, UINT16 *moloo offset = *prom1 & PROM1_OFFSET_MASK; /* determine the bank */ - bank = get_bank(machine, *prom1, *prom2, bpp); + bank = get_bank(*prom1, *prom2, bpp); /* set the value */ if (obj == 0) @@ -611,9 +596,8 @@ static void decode_gfx(running_machine &machine, UINT16 *pflookup, UINT16 *moloo * *************************************/ -static int get_bank(running_machine &machine, UINT8 prom1, UINT8 prom2, int bpp) +int atarisy1_state::get_bank(UINT8 prom1, UINT8 prom2, int bpp) { - atarisy1_state *state = machine.driver_data(); const UINT8 *srcdata; int bank_index, gfx_index; @@ -639,17 +623,17 @@ static int get_bank(running_machine &machine, UINT8 prom1, UINT8 prom2, int bpp) return 0; /* find the bank */ - if (state->m_bank_gfx[bpp - 4][bank_index]) - return state->m_bank_gfx[bpp - 4][bank_index]; + if (m_bank_gfx[bpp - 4][bank_index]) + return m_bank_gfx[bpp - 4][bank_index]; /* if the bank is out of range, call it 0 */ - memory_region *tiles = machine.root_device().memregion("tiles"); + memory_region *tiles = machine().root_device().memregion("tiles"); if (0x80000 * (bank_index - 1) >= tiles->bytes()) return 0; /* don't have one? let's make it ... first find any empty slot */ for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) - if (machine.gfx[gfx_index] == NULL) + if (machine().gfx[gfx_index] == NULL) break; assert(gfx_index != MAX_GFX_ELEMENTS); @@ -658,15 +642,15 @@ static int get_bank(running_machine &machine, UINT8 prom1, UINT8 prom2, int bpp) switch (bpp) { case 4: - machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, objlayout_4bpp, srcdata, 0x40, 256)); + machine().gfx[gfx_index] = auto_alloc(machine(), gfx_element(machine(), objlayout_4bpp, srcdata, 0x40, 256)); break; case 5: - machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, objlayout_5bpp, srcdata, 0x40, 256)); + machine().gfx[gfx_index] = auto_alloc(machine(), gfx_element(machine(), objlayout_5bpp, srcdata, 0x40, 256)); break; case 6: - machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, objlayout_6bpp, srcdata, 0x40, 256)); + machine().gfx[gfx_index] = auto_alloc(machine(), gfx_element(machine(), objlayout_6bpp, srcdata, 0x40, 256)); break; default: @@ -674,9 +658,9 @@ static int get_bank(running_machine &machine, UINT8 prom1, UINT8 prom2, int bpp) } /* set the color information */ - machine.gfx[gfx_index]->set_granularity(8); - state->m_bank_color_shift[gfx_index] = bpp - 3; + machine().gfx[gfx_index]->set_granularity(8); + m_bank_color_shift[gfx_index] = bpp - 3; /* set the entry and return it */ - return state->m_bank_gfx[bpp - 4][bank_index] = gfx_index; + return m_bank_gfx[bpp - 4][bank_index] = gfx_index; } diff --git a/src/mame/video/aztarac.c b/src/mame/video/aztarac.c index 0fb68e832cd..c8477b572e9 100644 --- a/src/mame/video/aztarac.c +++ b/src/mame/video/aztarac.c @@ -13,7 +13,7 @@ vector_add_point (m, m_xcenter + ((x) << 16), m_ycenter - ((y) << 16), color, in -INLINE void read_vectorram(UINT16 *vectorram, int addr, int *x, int *y, int *c) +inline void aztarac_state::read_vectorram(UINT16 *vectorram, int addr, int *x, int *y, int *c) { *c = vectorram[addr] & 0xffff; *x = vectorram[addr + 0x800] & 0x03ff; diff --git a/src/mame/video/bagman.c b/src/mame/video/bagman.c index a2da7069cfd..d79184a8d73 100644 --- a/src/mame/video/bagman.c +++ b/src/mame/video/bagman.c @@ -107,13 +107,12 @@ VIDEO_START_MEMBER(bagman_state,bagman) } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void bagman_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - bagman_state *state = machine.driver_data(); - 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; @@ -121,12 +120,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r sy = 255 - spriteram[offs + 2] - 16; flipx = spriteram[offs] & 0x40; flipy = spriteram[offs] & 0x80; - if (state->flip_screen_x()) + if (flip_screen_x()) { sx = bitmap.width() - sx - 15; flipx = !flipx; } - if (state->flip_screen_y()) + if (flip_screen_y()) { sy = bitmap.height() - sy - 15; flipy = !flipy; @@ -134,7 +133,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r if (spriteram[offs + 2] && spriteram[offs + 3]) drawgfx_transpen(bitmap, - cliprect,machine.gfx[1], + cliprect,machine().gfx[1], (spriteram[offs] & 0x3f) + 2 * (spriteram[offs + 1] & 0x20), spriteram[offs + 1] & 0x1f, flipx,flipy, @@ -149,6 +148,6 @@ UINT32 bagman_state::screen_update_bagman(screen_device &screen, bitmap_ind16 &b return 0; m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/balsente.c b/src/mame/video/balsente.c index 30a8d0d535d..f4900ebf599 100644 --- a/src/mame/video/balsente.c +++ b/src/mame/video/balsente.c @@ -119,9 +119,8 @@ WRITE8_MEMBER(balsente_state::shrike_sprite_select_w) * *************************************/ -static void draw_one_sprite(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sprite) +void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sprite) { - balsente_state *state = machine.driver_data(); int flags = sprite[0]; int image = sprite[1] | ((flags & 7) << 8); int ypos = sprite[2] + 17 + BALSENTE_VBEND; @@ -130,7 +129,7 @@ static void draw_one_sprite(running_machine &machine, bitmap_ind16 &bitmap, cons int x, y; /* get a pointer to the source image */ - src = &state->m_sprite_data[(64 * image) & state->m_sprite_mask]; + src = &m_sprite_data[(64 * image) & m_sprite_mask]; if (flags & 0x80) src += 4 * 15; /* loop over y */ @@ -138,8 +137,8 @@ static void draw_one_sprite(running_machine &machine, bitmap_ind16 &bitmap, cons { if (ypos >= (16 + BALSENTE_VBEND) && ypos >= cliprect.min_y && ypos <= cliprect.max_y) { - const pen_t *pens = &machine.pens[state->m_palettebank_vis * 256]; - UINT8 *old = &state->m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; + const pen_t *pens = &machine().pens[m_palettebank_vis * 256]; + UINT8 *old = &m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; int currx = xpos; /* standard case */ @@ -214,7 +213,7 @@ UINT32 balsente_state::screen_update_balsente(screen_device &screen, bitmap_ind1 /* draw the sprite images */ for (i = 0; i < 40; i++) - draw_one_sprite(machine(), bitmap, cliprect, &m_spriteram[(0xe0 + i * 4) & 0xff]); + draw_one_sprite(bitmap, cliprect, &m_spriteram[(0xe0 + i * 4) & 0xff]); return 0; } diff --git a/src/mame/video/baraduke.c b/src/mame/video/baraduke.c index 739af9e1652..c296ff4209c 100644 --- a/src/mame/video/baraduke.c +++ b/src/mame/video/baraduke.c @@ -158,19 +158,18 @@ WRITE8_MEMBER(baraduke_state::baraduke_textram_w) } -static void scroll_w(address_space &space, int layer, int offset, int data) +void baraduke_state::scroll_w(address_space &space, int layer, int offset, int data) { - baraduke_state *state = space.machine().driver_data(); switch (offset) { case 0: /* high scroll x */ - state->m_xscroll[layer] = (state->m_xscroll[layer] & 0xff) | (data << 8); + m_xscroll[layer] = (m_xscroll[layer] & 0xff) | (data << 8); break; case 1: /* low scroll x */ - state->m_xscroll[layer] = (state->m_xscroll[layer] & 0xff00) | data; + m_xscroll[layer] = (m_xscroll[layer] & 0xff00) | data; break; case 2: /* scroll y */ - state->m_yscroll[layer] = data; + m_yscroll[layer] = data; break; } } @@ -208,10 +207,9 @@ WRITE8_MEMBER(baraduke_state::baraduke_spriteram_w) ***************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_priority) +void baraduke_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_priority) { - baraduke_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram + 0x1800; + UINT8 *spriteram = m_spriteram + 0x1800; const UINT8 *source = &spriteram[0x0000]; const UINT8 *finish = &spriteram[0x0800-16]; /* the last is NOT a sprite */ @@ -257,7 +255,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r sy -= 16 * sizey; - if (state->flip_screen()) + if (flip_screen()) { sx = 496+3 - 16 * sizex - sx; sy = 240 - 16 * sizey - sy; @@ -269,7 +267,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r { for (x = 0;x <= sizex;x++) { - drawgfx_transpen( bitmap, cliprect,machine.gfx[3], + drawgfx_transpen( bitmap, cliprect,machine().gfx[3], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, @@ -284,22 +282,21 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r } -static void set_scroll(running_machine &machine, int layer) +void baraduke_state::set_scroll(int layer) { - baraduke_state *state = machine.driver_data(); static const int xdisp[2] = { 26, 24 }; int scrollx, scrolly; - scrollx = state->m_xscroll[layer] + xdisp[layer]; - scrolly = state->m_yscroll[layer] + 9; - if (state->flip_screen()) + scrollx = m_xscroll[layer] + xdisp[layer]; + scrolly = m_yscroll[layer] + 9; + if (flip_screen()) { scrollx = -scrollx + 3; scrolly = -scrolly; } - state->m_bg_tilemap[layer]->set_scrollx(0, scrollx); - state->m_bg_tilemap[layer]->set_scrolly(0, scrolly); + m_bg_tilemap[layer]->set_scrollx(0, scrollx); + m_bg_tilemap[layer]->set_scrolly(0, scrolly); } @@ -312,8 +309,8 @@ UINT32 baraduke_state::screen_update_baraduke(screen_device &screen, bitmap_ind1 /* can't use flip_screen_set() because the visible area is asymmetrical */ flip_screen_set_no_update(spriteram[0x07f6] & 0x01); machine().tilemap().set_flip_all(flip_screen() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); - set_scroll(machine(), 0); - set_scroll(machine(), 1); + set_scroll(0); + set_scroll(1); if (((m_xscroll[0] & 0x0e00) >> 9) == 6) back = 1; @@ -321,9 +318,9 @@ UINT32 baraduke_state::screen_update_baraduke(screen_device &screen, bitmap_ind1 back = 0; m_bg_tilemap[back]->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - draw_sprites(machine(), bitmap,cliprect,0); + draw_sprites(bitmap,cliprect,0); m_bg_tilemap[back ^ 1]->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect,1); + draw_sprites(bitmap,cliprect,1); m_tx_tilemap->draw(bitmap, cliprect, 0,0); return 0; diff --git a/src/mame/video/battlane.c b/src/mame/video/battlane.c index 472565f9ea8..3d5159f0f4d 100644 --- a/src/mame/video/battlane.c +++ b/src/mame/video/battlane.c @@ -139,9 +139,8 @@ void battlane_state::video_start() m_screen_bitmap.allocate(32 * 8, 32 * 8); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void battlane_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - battlane_state *state = machine.driver_data(); int offs, attr, code, color, sx, sy, flipx, flipy, dy; for (offs = 0; offs < 0x100; offs += 4) @@ -157,8 +156,8 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const 0x01 = Sprite Enable */ - attr = state->m_spriteram[offs + 1]; - code = state->m_spriteram[offs + 3]; + attr = m_spriteram[offs + 1]; + code = m_spriteram[offs + 3]; code += 256 * ((attr >> 6) & 0x02); code += 256 * ((attr >> 5) & 0x01); @@ -167,13 +166,13 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const { color = (attr >> 3) & 0x01; - sx = state->m_spriteram[offs + 2]; - sy = state->m_spriteram[offs]; + sx = m_spriteram[offs + 2]; + sy = m_spriteram[offs]; flipx = attr & 0x04; flipy = attr & 0x02; - if (!state->flip_screen()) + if (!flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -182,7 +181,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } drawgfx_transpen(bitmap,cliprect, - machine.gfx[0], + machine().gfx[0], code, color, flipx, flipy, @@ -193,7 +192,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const dy = flipy ? 16 : -16; drawgfx_transpen(bitmap,cliprect, - machine.gfx[0], + machine().gfx[0], code + 1, color, flipx, flipy, @@ -203,20 +202,19 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } } -static void draw_fg_bitmap( running_machine &machine, bitmap_ind16 &bitmap ) +void battlane_state::draw_fg_bitmap( bitmap_ind16 &bitmap ) { - battlane_state *state = machine.driver_data(); int x, y, data; for (y = 0; y < 32 * 8; y++) { for (x = 0; x < 32 * 8; x++) { - data = state->m_screen_bitmap.pix8(y, x); + data = m_screen_bitmap.pix8(y, x); if (data) { - if (state->flip_screen()) + if (flip_screen()) bitmap.pix16(255 - y, 255 - x) = data; else bitmap.pix16(y, x) = data; @@ -230,7 +228,7 @@ UINT32 battlane_state::screen_update_battlane(screen_device &screen, bitmap_ind1 m_bg_tilemap->mark_all_dirty(); // HACK m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); - draw_fg_bitmap(machine(), bitmap); + draw_sprites(bitmap, cliprect); + draw_fg_bitmap(bitmap); return 0; } diff --git a/src/mame/video/battlera.c b/src/mame/video/battlera.c index ab17ff51bcc..f0d9140921e 100644 --- a/src/mame/video/battlera.c +++ b/src/mame/video/battlera.c @@ -232,32 +232,31 @@ WRITE8_MEMBER(battlera_state::HuC6270_data_w) /******************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &clip,int pri) +void battlera_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &clip,int pri) { - battlera_state *state = machine.driver_data(); int offs,my,mx,code,code2,fx,fy,cgy=0,cgx,colour,i,yinc; /* Draw sprites, starting at SATB, draw in _reverse_ order */ - for (offs=(state->m_HuC6270_registers[19]<<1)+0x200-8; offs>=(state->m_HuC6270_registers[19]<<1); offs-=8) + for (offs=(m_HuC6270_registers[19]<<1)+0x200-8; offs>=(m_HuC6270_registers[19]<<1); offs-=8) { - if ((state->m_HuC6270_vram[offs+7]&0x80) && !pri) continue; - if (!(state->m_HuC6270_vram[offs+7]&0x80) && pri) continue; + if ((m_HuC6270_vram[offs+7]&0x80) && !pri) continue; + if (!(m_HuC6270_vram[offs+7]&0x80) && pri) continue; - code=state->m_HuC6270_vram[offs+5] + (state->m_HuC6270_vram[offs+4]<<8); + code=m_HuC6270_vram[offs+5] + (m_HuC6270_vram[offs+4]<<8); code=code>>1; - my=state->m_HuC6270_vram[offs+1] + (state->m_HuC6270_vram[offs+0]<<8); - mx=state->m_HuC6270_vram[offs+3] + (state->m_HuC6270_vram[offs+2]<<8); + my=m_HuC6270_vram[offs+1] + (m_HuC6270_vram[offs+0]<<8); + mx=m_HuC6270_vram[offs+3] + (m_HuC6270_vram[offs+2]<<8); mx-=32; my-=57; - fx=state->m_HuC6270_vram[offs+6]&0x8; - fy=state->m_HuC6270_vram[offs+6]&0x80; - cgx=state->m_HuC6270_vram[offs+6]&1; - colour=state->m_HuC6270_vram[offs+7]&0xf; + fx=m_HuC6270_vram[offs+6]&0x8; + fy=m_HuC6270_vram[offs+6]&0x80; + cgx=m_HuC6270_vram[offs+6]&1; + colour=m_HuC6270_vram[offs+7]&0xf; - switch ((state->m_HuC6270_vram[offs+6]>>4)&3) { + switch ((m_HuC6270_vram[offs+6]>>4)&3) { case 0: cgy=1; break; case 1: cgy=2; break; case 2: cgy=0; break; /* Illegal */ @@ -273,14 +272,14 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re if (fy) { my += 16*(cgy-1); yinc = -16; } /* Swap tile order on Y flips */ for (i=0; i(); - gfx_element *gfx = machine.gfx[1]; - UINT8 *source = state->m_spriteram; - UINT8 *finish = state->m_spriteram + 0x200; + gfx_element *gfx = machine().gfx[1]; + UINT8 *source = m_spriteram; + UINT8 *finish = m_spriteram + 0x200; while (source < finish) { @@ -74,7 +73,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int flipy = source[1] & 0x80; int flipx = source[1] & 0x40; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -93,7 +92,7 @@ UINT32 battlex_state::screen_update_battlex(screen_device &screen, bitmap_ind16 { m_bg_tilemap->set_scrollx(0, m_scroll_lsb | (m_scroll_msb << 8)); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/bbusters.c b/src/mame/video/bbusters.c index 9bbe0bc4b8a..85d61e3fabe 100644 --- a/src/mame/video/bbusters.c +++ b/src/mame/video/bbusters.c @@ -105,7 +105,7 @@ VIDEO_START_MEMBER(bbusters_state,mechatt) else if (dy&0x40) code+=32; \ else if (dx&0x40) code+=16 -INLINE const UINT8 *get_source_ptr(gfx_element *gfx, UINT32 sprite, int dx, int dy, int block) +inline const UINT8 *bbusters_state::get_source_ptr(gfx_element *gfx, UINT32 sprite, int dx, int dy, int block) { int code=0; @@ -143,21 +143,20 @@ INLINE const UINT8 *get_source_ptr(gfx_element *gfx, UINT32 sprite, int dx, int return gfx->get_data((sprite+code) % gfx->elements()) + ((dy%16) * gfx->rowbytes()); } -static void bbusters_draw_block(running_machine &machine, bitmap_ind16 &dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block) +void bbusters_state::bbusters_draw_block(bitmap_ind16 &dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block) { - bbusters_state *state = machine.driver_data(); - gfx_element *gfx = machine.gfx[bank]; + gfx_element *gfx = machine().gfx[bank]; pen_t pen_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors()); - UINT32 xinc=(state->m_scale_line_count * 0x10000 ) / size; + UINT32 xinc=(m_scale_line_count * 0x10000 ) / size; UINT8 pixel; int x_index; int dy=y; - int sx, ex = state->m_scale_line_count; + int sx, ex = m_scale_line_count; - while (state->m_scale_line_count) { + while (m_scale_line_count) { if (dy>=16 && dy<240) { UINT16 *destline = &dest.pix16(dy); - UINT8 srcline=*state->m_scale_table_ptr; + UINT8 srcline=*m_scale_table_ptr; const UINT8 *srcptr=0; if (!flipy) @@ -184,15 +183,14 @@ static void bbusters_draw_block(running_machine &machine, bitmap_ind16 &dest,int } dy++; - state->m_scale_table_ptr--; - state->m_scale_line_count--; + m_scale_table_ptr--; + m_scale_line_count--; } } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const UINT16 *source, int bank, int colval, int colmask) +void bbusters_state::draw_sprites(bitmap_ind16 &bitmap, const UINT16 *source, int bank, int colval, int colmask) { - bbusters_state *state = machine.driver_data(); - const UINT8 *scale_table=state->memregion("user1")->base(); + const UINT8 *scale_table=memregion("user1")->base(); int offs; for (offs = 0;offs <0x800 ;offs += 4) { @@ -237,27 +235,27 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const U switch ((source[offs+0]>>8)&0x3) { case 0: scale=source[offs+0]&0x7; - state->m_scale_table_ptr = scale_table+0x387f+(0x80*scale); - state->m_scale_line_count = 0x10-scale; - bbusters_draw_block(machine,bitmap,x,y,16,fx,fy,sprite,colour,bank,block); + m_scale_table_ptr = scale_table+0x387f+(0x80*scale); + m_scale_line_count = 0x10-scale; + bbusters_draw_block(bitmap,x,y,16,fx,fy,sprite,colour,bank,block); break; case 1: /* 2 x 2 */ scale=source[offs+0]&0xf; - state->m_scale_table_ptr = scale_table+0x707f+(0x80*scale); - state->m_scale_line_count = 0x20-scale; - bbusters_draw_block(machine,bitmap,x,y,32,fx,fy,sprite,colour,bank,block); + m_scale_table_ptr = scale_table+0x707f+(0x80*scale); + m_scale_line_count = 0x20-scale; + bbusters_draw_block(bitmap,x,y,32,fx,fy,sprite,colour,bank,block); break; case 2: /* 64 by 64 block (2 x 2) x 2 */ scale=source[offs+0]&0x1f; - state->m_scale_table_ptr = scale_table+0xa07f+(0x80*scale); - state->m_scale_line_count = 0x40-scale; - bbusters_draw_block(machine,bitmap,x,y,64,fx,fy,sprite,colour,bank,block); + m_scale_table_ptr = scale_table+0xa07f+(0x80*scale); + m_scale_line_count = 0x40-scale; + bbusters_draw_block(bitmap,x,y,64,fx,fy,sprite,colour,bank,block); break; case 3: /* 2 x 2 x 2 x 2 */ scale=source[offs+0]&0x3f; - state->m_scale_table_ptr = scale_table+0xc07f+(0x80*scale); - state->m_scale_line_count = 0x80-scale; - bbusters_draw_block(machine,bitmap,x,y,128,fx,fy,sprite,colour,bank,block); + m_scale_table_ptr = scale_table+0xc07f+(0x80*scale); + m_scale_line_count = 0x80-scale; + bbusters_draw_block(bitmap,x,y,128,fx,fy,sprite,colour,bank,block); break; } } @@ -275,8 +273,8 @@ UINT32 bbusters_state::screen_update_bbuster(screen_device &screen, bitmap_ind16 m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); //draw_sprites(machine(), bitmap, m_spriteram2->buffer(), 2, 0x8, 0x8); m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, m_spriteram2->buffer(), 2, 0, 0); - draw_sprites(machine(), bitmap, m_spriteram->buffer(), 1, 0, 0); + draw_sprites(bitmap, m_spriteram2->buffer(), 2, 0, 0); + draw_sprites(bitmap, m_spriteram->buffer(), 1, 0, 0); m_fix_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } @@ -290,7 +288,7 @@ UINT32 bbusters_state::screen_update_mechatt(screen_device &screen, bitmap_ind16 m_pf2_tilemap->draw(bitmap, cliprect, 0, 0); m_pf1_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, m_spriteram->buffer(), 1, 0, 0); + draw_sprites(bitmap, m_spriteram->buffer(), 1, 0, 0); m_fix_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } diff --git a/src/mame/video/bigevglf.c b/src/mame/video/bigevglf.c index 6efa2c817f4..4345cd91af9 100644 --- a/src/mame/video/bigevglf.c +++ b/src/mame/video/bigevglf.c @@ -64,20 +64,19 @@ void bigevglf_state::video_start() save_pointer(NAME(m_vidram), 0x100 * 0x100 * 4); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bigevglf_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - bigevglf_state *state = machine.driver_data(); int i, j; for (i = 0xc0-4; i >= 0; i-= 4) { int code, sx, sy; - code = state->m_spriteram2[i + 1]; - sx = state->m_spriteram2[i + 3]; - sy = 200 - state->m_spriteram2[i]; + code = m_spriteram2[i + 1]; + sx = m_spriteram2[i + 3]; + sy = 200 - m_spriteram2[i]; for (j = 0; j < 16; j++) - drawgfx_transpen(bitmap, cliprect, machine.gfx[0], - state->m_spriteram1[(code << 4) + j] + ((state->m_spriteram1[0x400 + (code << 4) + j] & 0xf) << 8), - state->m_spriteram2[i + 2] & 0xf, + drawgfx_transpen(bitmap, cliprect, machine().gfx[0], + m_spriteram1[(code << 4) + j] + ((m_spriteram1[0x400 + (code << 4) + j] & 0xf) << 8), + m_spriteram2[i + 2] & 0xf, 0,0, sx + ((j & 1) << 3), sy + ((j >> 1) << 3), 0); } @@ -86,6 +85,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 bigevglf_state::screen_update_bigevglf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { copybitmap(bitmap, m_tmp_bitmap[m_plane_visible], 0, 0, 0, 0, cliprect); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/bigstrkb.c b/src/mame/video/bigstrkb.c index 4e6a27b126b..fa33dfacaa1 100644 --- a/src/mame/video/bigstrkb.c +++ b/src/mame/video/bigstrkb.c @@ -6,7 +6,7 @@ /* Sprites */ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bigstrkb_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { /*- SPR RAM Format -** @@ -16,9 +16,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r ( rest unused ) **- End of Comments -*/ - bigstrkb_state *state = machine.driver_data(); - gfx_element *gfx = machine.gfx[2]; - UINT16 *source = state->m_spriteram; + gfx_element *gfx = machine().gfx[2]; + UINT16 *source = m_spriteram; UINT16 *finish = source + 0x800/2; while( sourcedraw(bitmap, cliprect, 0,0); m_tilemap3->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(),bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_tilemap->draw(bitmap, cliprect, 0,0); // popmessage ("Regs %08x %08x %08x %08x",bsb_vidreg2[0],bsb_vidreg2[1],bsb_vidreg2[2],bsb_vidreg2[3]); diff --git a/src/mame/video/bionicc.c b/src/mame/video/bionicc.c index d54ffd20338..e2bbc32a2af 100644 --- a/src/mame/video/bionicc.c +++ b/src/mame/video/bionicc.c @@ -188,14 +188,13 @@ WRITE16_MEMBER(bionicc_state::bionicc_gfxctrl_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bionicc_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - bionicc_state *state = machine.driver_data(); - UINT16 *buffered_spriteram = state->m_spriteram->buffer(); + UINT16 *buffered_spriteram = m_spriteram->buffer(); int offs; - gfx_element *gfx = machine.gfx[3]; + gfx_element *gfx = machine().gfx[3]; - for (offs = (state->m_spriteram->bytes() - 8) / 2; offs >= 0; offs -= 4) + for (offs = (m_spriteram->bytes() - 8) / 2; offs >= 0; offs -= 4) { int tile_number = buffered_spriteram[offs] & 0x7ff; if( tile_number != 0x7ff ) @@ -210,7 +209,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (sy > 512 - 16) sy -= 512; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -233,7 +232,7 @@ UINT32 bionicc_state::screen_update_bionicc(screen_device &screen, bitmap_ind16 m_fg_tilemap->draw(bitmap, cliprect, 1 | TILEMAP_DRAW_LAYER1, 0); /* nothing in FRONT */ m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0 | TILEMAP_DRAW_LAYER1, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(bitmap, cliprect, 0 | TILEMAP_DRAW_LAYER0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0); return 0; diff --git a/src/mame/video/blktiger.c b/src/mame/video/blktiger.c index 48d4f1bc9f7..c96f9c3ad10 100644 --- a/src/mame/video/blktiger.c +++ b/src/mame/video/blktiger.c @@ -185,14 +185,13 @@ WRITE8_MEMBER(blktiger_state::blktiger_screen_layout_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void blktiger_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - blktiger_state *state = machine.driver_data(); - UINT8 *buffered_spriteram = state->m_spriteram->buffer(); + UINT8 *buffered_spriteram = m_spriteram->buffer(); int offs; /* Draw the sprites. */ - for (offs = state->m_spriteram->bytes() - 4;offs >= 0;offs -= 4) + for (offs = m_spriteram->bytes() - 4;offs >= 0;offs -= 4) { int attr = buffered_spriteram[offs+1]; int sx = buffered_spriteram[offs + 3] - ((attr & 0x10) << 4); @@ -201,17 +200,17 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int color = attr & 0x07; int flipx = attr & 0x08; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; flipx = !flipx; } - drawgfx_transpen(bitmap,cliprect,machine.gfx[2], + drawgfx_transpen(bitmap,cliprect,machine().gfx[2], code, color, - flipx,state->flip_screen(), + flipx,flip_screen(), sx,sy,15); } } @@ -224,7 +223,7 @@ UINT32 blktiger_state::screen_update_blktiger(screen_device &screen, bitmap_ind1 (m_screen_layout ? m_bg_tilemap8x4 : m_bg_tilemap4x8)->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); if (m_objon) - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); if (m_bgon) (m_screen_layout ? m_bg_tilemap8x4 : m_bg_tilemap4x8)->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); diff --git a/src/mame/video/blmbycar.c b/src/mame/video/blmbycar.c index c2d85f60770..5abd340b47a 100644 --- a/src/mame/video/blmbycar.c +++ b/src/mame/video/blmbycar.c @@ -157,13 +157,12 @@ void blmbycar_state::video_start() ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void blmbycar_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - blmbycar_state *state = machine.driver_data(); UINT16 *source, *finish; - source = state->m_spriteram + 0x6 / 2; // ! - finish = state->m_spriteram + state->m_spriteram.bytes() / 2 - 8 / 2; + source = m_spriteram + 0x6 / 2; // ! + finish = m_spriteram + m_spriteram.bytes() / 2 - 8 / 2; /* Find "the end of sprites" marker */ @@ -173,7 +172,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const /* Draw sprites in reverse order for pdrawfgfx */ source -= 8 / 2; - finish = state->m_spriteram; + finish = m_spriteram; for ( ; source >= finish; source -= 8 / 2 ) { @@ -192,12 +191,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const x = (x & 0x1ff) - 0x10; y = 0xf0 - ((y & 0xff) - (y & 0x100)); - pdrawgfx_transpen(bitmap, cliprect, machine.gfx[0], + pdrawgfx_transpen(bitmap, cliprect, machine().gfx[0], code, 0x20 + (attr & 0xf), flipx, flipy, x, y, - machine.priority_bitmap, + machine().priority_bitmap, pri_mask,0); } } @@ -247,7 +246,7 @@ if (machine().input().code_pressed(KEYCODE_Z)) m_tilemap_1->draw(bitmap, cliprect, i, i); if (layers_ctrl & 8) - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/blockout.c b/src/mame/video/blockout.c index 789cc4f1b76..d97971b20e4 100644 --- a/src/mame/video/blockout.c +++ b/src/mame/video/blockout.c @@ -8,7 +8,7 @@ #include "includes/blockout.h" -static void setcolor( running_machine &machine, int color, int rgb ) +void blockout_state::setcolor( int color, int rgb ) { int bit0, bit1, bit2, bit3; int r, g, b; @@ -35,19 +35,19 @@ static void setcolor( running_machine &machine, int color, int rgb ) bit3 = (rgb >> 11) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - palette_set_color(machine, color, MAKE_RGB(r,g,b)); + palette_set_color(machine(), color, MAKE_RGB(r,g,b)); } WRITE16_MEMBER(blockout_state::blockout_paletteram_w) { COMBINE_DATA(&m_paletteram[offset]); - setcolor(machine(), offset, m_paletteram[offset]); + setcolor(offset, m_paletteram[offset]); } WRITE16_MEMBER(blockout_state::blockout_frontcolor_w) { COMBINE_DATA(&m_color); - setcolor(machine(), 512, m_color); + setcolor(512, m_color); } @@ -64,32 +64,31 @@ void blockout_state::video_start() save_item(NAME(m_tmpbitmap)); } -static void update_pixels( running_machine &machine, int x, int y ) +void blockout_state::update_pixels( int x, int y ) { - blockout_state *state = machine.driver_data(); UINT16 front, back; int color; - const rectangle &visarea = machine.primary_screen->visible_area(); + const rectangle &visarea = machine().primary_screen->visible_area(); if (!visarea.contains(x, y)) return; - front = state->m_videoram[y * 256 + x / 2]; - back = state->m_videoram[0x10000 + y * 256 + x / 2]; + front = m_videoram[y * 256 + x / 2]; + back = m_videoram[0x10000 + y * 256 + x / 2]; if (front >> 8) color = front >> 8; else color = (back >> 8) + 256; - state->m_tmpbitmap.pix16(y, x) = color; + m_tmpbitmap.pix16(y, x) = color; if (front & 0xff) color = front & 0xff; else color = (back & 0xff) + 256; - state->m_tmpbitmap.pix16(y, x + 1) = color; + m_tmpbitmap.pix16(y, x + 1) = color; } @@ -97,7 +96,7 @@ static void update_pixels( running_machine &machine, int x, int y ) WRITE16_MEMBER(blockout_state::blockout_videoram_w) { COMBINE_DATA(&m_videoram[offset]); - update_pixels(machine(), (offset % 256) * 2, (offset / 256) % 256); + update_pixels((offset % 256) * 2, (offset / 256) % 256); } diff --git a/src/mame/video/bloodbro.c b/src/mame/video/bloodbro.c index 8b74bb39b0f..1698f64a995 100644 --- a/src/mame/video/bloodbro.c +++ b/src/mame/video/bloodbro.c @@ -138,12 +138,11 @@ WRITE16_MEMBER(bloodbro_state::bloodbro_txvideoram_w) -------X XXXXXXXX -------- YYYYYYYY */ -static void bloodbro_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void bloodbro_state::bloodbro_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - bloodbro_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram; + UINT16 *spriteram16 = m_spriteram; int offs; - for (offs = 0;offs < state->m_spriteram.bytes()/2;offs += 4) + for (offs = 0;offs < m_spriteram.bytes()/2;offs += 4) { int sx,sy,x,y,width,height,attributes,tile_number,color,flipx,flipy,pri_mask; @@ -167,12 +166,12 @@ static void bloodbro_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap { for (y = 0;y <= height;y++) { - pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], + pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3], tile_number++, color, flipx,flipy, flipx ? (sx + 16*(width-x)) : (sx + 16*x),flipy ? (sy + 16*(height-y)) : (sy + 16*y), - machine.priority_bitmap, + machine().priority_bitmap, pri_mask,15); } } @@ -187,14 +186,13 @@ static void bloodbro_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap -------X XXXXXXXX */ -static void weststry_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void bloodbro_state::weststry_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - bloodbro_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram; + UINT16 *spriteram16 = m_spriteram; int offs; /* TODO: the last two entries are not sprites - control registers? */ - for (offs = 0;offs < state->m_spriteram.bytes()/2 - 8;offs += 4) + for (offs = 0;offs < m_spriteram.bytes()/2 - 8;offs += 4) { int data = spriteram16[offs+2]; int data0 = spriteram16[offs+0]; @@ -213,12 +211,12 @@ static void weststry_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap /* Remap code 0x800 <-> 0x1000 */ code = (code&0x7ff) | ((code&0x800)<<1) | ((code&0x1000)>>1); - pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], + pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3], code, color, flipx,flipy, sx,sy, - machine.priority_bitmap, + machine().priority_bitmap, pri_mask,15); } } @@ -236,7 +234,7 @@ UINT32 bloodbro_state::screen_update_bloodbro(screen_device &screen, bitmap_ind1 m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,1); - bloodbro_draw_sprites(machine(),bitmap,cliprect); + bloodbro_draw_sprites(bitmap,cliprect); m_tx_tilemap->draw(bitmap, cliprect, 0,0); return 0; } @@ -252,7 +250,7 @@ UINT32 bloodbro_state::screen_update_weststry(screen_device &screen, bitmap_ind1 m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,1); - weststry_draw_sprites(machine(),bitmap,cliprect); + weststry_draw_sprites(bitmap,cliprect); m_tx_tilemap->draw(bitmap, cliprect, 0,0); return 0; } @@ -269,7 +267,7 @@ UINT32 bloodbro_state::screen_update_skysmash(screen_device &screen, bitmap_ind1 m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,1); - bloodbro_draw_sprites(machine(),bitmap,cliprect); + bloodbro_draw_sprites(bitmap,cliprect); m_tx_tilemap->draw(bitmap, cliprect, 0,0); return 0; } diff --git a/src/mame/video/blueprnt.c b/src/mame/video/blueprnt.c index aa846e3b0ea..eaeda2fadb3 100644 --- a/src/mame/video/blueprnt.c +++ b/src/mame/video/blueprnt.c @@ -124,20 +124,19 @@ VIDEO_START_MEMBER(blueprnt_state,blueprnt) } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void blueprnt_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - blueprnt_state *state = machine.driver_data(); int offs; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { - int code = state->m_spriteram[offs + 1]; - int sx = state->m_spriteram[offs + 3]; - int sy = 240 - state->m_spriteram[offs]; - int flipx = state->m_spriteram[offs + 2] & 0x40; - int flipy = state->m_spriteram[offs + 2 - 4] & 0x80; // -4? Awkward, isn't it? + int code = m_spriteram[offs + 1]; + int sx = m_spriteram[offs + 3]; + int sy = 240 - m_spriteram[offs]; + int flipx = m_spriteram[offs + 2] & 0x40; + int flipy = m_spriteram[offs + 2 - 4] & 0x80; // -4? Awkward, isn't it? - if (state->flip_screen()) + if (flip_screen()) { sx = 248 - sx; sy = 240 - sy; @@ -146,7 +145,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } // sprites are slightly misplaced, regardless of the screen flip - drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, 0, flipx, flipy, 2 + sx, sy - 1, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, 0, flipx, flipy, 2 + sx, sy - 1, 0); } } @@ -163,7 +162,7 @@ UINT32 blueprnt_state::screen_update_blueprnt(screen_device &screen, bitmap_ind1 bitmap.fill(get_black_pen(machine()), cliprect); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_bg_tilemap->draw(bitmap, cliprect, 1, 0); return 0; } diff --git a/src/mame/video/bogeyman.c b/src/mame/video/bogeyman.c index 51c2ad0b2ae..229078cb6ec 100644 --- a/src/mame/video/bogeyman.c +++ b/src/mame/video/bogeyman.c @@ -94,28 +94,27 @@ void bogeyman_state::video_start() m_fg_tilemap->set_transparent_pen(0); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bogeyman_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - bogeyman_state *state = machine.driver_data(); int offs; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { - int attr = state->m_spriteram[offs]; + int attr = m_spriteram[offs]; if (attr & 0x01) { - int code = state->m_spriteram[offs + 1] + ((attr & 0x40) << 2); + int code = m_spriteram[offs + 1] + ((attr & 0x40) << 2); int color = (attr & 0x08) >> 3; int flipx = !(attr & 0x04); int flipy = attr & 0x02; - int sx = state->m_spriteram[offs + 3]; - int sy = (240 - state->m_spriteram[offs + 2]) & 0xff; + int sx = m_spriteram[offs + 3]; + int sy = (240 - m_spriteram[offs + 2]) & 0xff; int multi = attr & 0x10; if (multi) sy -= 16; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -124,7 +123,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } drawgfx_transpen(bitmap, cliprect, - machine.gfx[2], + machine().gfx[2], code, color, flipx, flipy, sx, sy, 0); @@ -132,10 +131,10 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (multi) { drawgfx_transpen(bitmap,cliprect, - machine.gfx[2], + machine().gfx[2], code + 1, color, flipx, flipy, - sx, sy + (state->flip_screen() ? -16 : 16), 0); + sx, sy + (flip_screen() ? -16 : 16), 0); } } } @@ -144,7 +143,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 bogeyman_state::screen_update_bogeyman(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; } diff --git a/src/mame/video/bombjack.c b/src/mame/video/bombjack.c index 7068258bf1a..a8880767def 100644 --- a/src/mame/video/bombjack.c +++ b/src/mame/video/bombjack.c @@ -68,12 +68,11 @@ void bombjack_state::video_start() m_fg_tilemap->set_transparent_pen(0); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bombjack_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - bombjack_state *state = machine.driver_data(); int offs; - for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) { /* abbbbbbb cdefgggg hhhhhhhh iiiiiiii @@ -91,19 +90,19 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int sx,sy,flipx,flipy; - sx = state->m_spriteram[offs + 3]; + sx = m_spriteram[offs + 3]; - if (state->m_spriteram[offs] & 0x80) - sy = 225 - state->m_spriteram[offs + 2]; + if (m_spriteram[offs] & 0x80) + sy = 225 - m_spriteram[offs + 2]; else - sy = 241 - state->m_spriteram[offs + 2]; + sy = 241 - m_spriteram[offs + 2]; - flipx = state->m_spriteram[offs + 1] & 0x40; - flipy = state->m_spriteram[offs + 1] & 0x80; + flipx = m_spriteram[offs + 1] & 0x40; + flipy = m_spriteram[offs + 1] & 0x80; - if (state->flip_screen()) + if (flip_screen()) { - if (state->m_spriteram[offs + 1] & 0x20) + if (m_spriteram[offs + 1] & 0x20) { sx = 224 - sx; sy = 224 - sy; @@ -117,9 +116,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const flipy = !flipy; } - drawgfx_transpen(bitmap,cliprect,machine.gfx[(state->m_spriteram[offs] & 0x80) ? 3 : 2], - state->m_spriteram[offs] & 0x7f, - state->m_spriteram[offs + 1] & 0x0f, + drawgfx_transpen(bitmap,cliprect,machine().gfx[(m_spriteram[offs] & 0x80) ? 3 : 2], + m_spriteram[offs] & 0x7f, + m_spriteram[offs + 1] & 0x0f, flipx,flipy, sx,sy,0); } @@ -129,6 +128,6 @@ UINT32 bombjack_state::screen_update_bombjack(screen_device &screen, bitmap_ind1 { 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); return 0; } diff --git a/src/mame/video/boogwing.c b/src/mame/video/boogwing.c index a1b1ffec16e..1136254c7c9 100644 --- a/src/mame/video/boogwing.c +++ b/src/mame/video/boogwing.c @@ -20,20 +20,19 @@ void boogwing_state::video_start() apparently priority is based on a PROM, that should be used if possible. */ -static void mix_boogwing(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void boogwing_state::mix_boogwing(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - boogwing_state *state = machine.driver_data(); int y, x; - const pen_t *paldata = machine.pens; + const pen_t *paldata = machine().pens; bitmap_ind16 *sprite_bitmap1, *sprite_bitmap2; bitmap_ind8* priority_bitmap; - address_space &space = machine.driver_data()->generic_space(); - UINT16 priority = decocomn_priority_r(state->m_decocomn, space, 0, 0xffff); + address_space &space = machine().driver_data()->generic_space(); + UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff); - sprite_bitmap1 = &state->m_sprgen1->get_sprite_temp_bitmap(); - sprite_bitmap2 = &state->m_sprgen1->get_sprite_temp_bitmap(); - priority_bitmap = &machine.priority_bitmap; + sprite_bitmap1 = &m_sprgen1->get_sprite_temp_bitmap(); + sprite_bitmap2 = &m_sprgen1->get_sprite_temp_bitmap(); + priority_bitmap = &machine().priority_bitmap; UINT32* dstline; UINT16 *srcline1, *srcline2; @@ -225,7 +224,7 @@ UINT32 boogwing_state::screen_update_boogwing(screen_device &screen, bitmap_rgb3 deco16ic_tilemap_2_draw(m_deco_tilegen1, bitmap, cliprect, 0, 32); } - mix_boogwing(machine(), bitmap,cliprect); + mix_boogwing(bitmap,cliprect); deco16ic_tilemap_1_draw(m_deco_tilegen1, bitmap, cliprect, 0, 0); return 0; diff --git a/src/mame/video/brkthru.c b/src/mame/video/brkthru.c index ded68fb860b..d36a9512efe 100644 --- a/src/mame/video/brkthru.c +++ b/src/mame/video/brkthru.c @@ -147,7 +147,7 @@ WRITE8_MEMBER(brkthru_state::brkthru_1800_w) #if 0 -static void show_register( bitmap_ind16 &bitmap, int x, int y, UINT32 data ) +void brkthru_state::show_register( bitmap_ind16 &bitmap, int x, int y, UINT32 data ) { char buf[5]; @@ -157,9 +157,8 @@ static void show_register( bitmap_ind16 &bitmap, int x, int y, UINT32 data ) #endif -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int prio ) +void brkthru_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int prio ) { - brkthru_state *state = machine.driver_data(); int offs; /* Draw the sprites. Note that it is important to draw them exactly in this */ /* order, to have the correct priorities. */ @@ -176,64 +175,64 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const ---- ---- ---- ---- ---- ---- xxxx xxxx = X position */ - for (offs = 0;offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0;offs < m_spriteram.bytes(); offs += 4) { - if ((state->m_spriteram[offs] & 0x09) == prio) /* Enable && Low Priority */ + if ((m_spriteram[offs] & 0x09) == prio) /* Enable && Low Priority */ { int sx, sy, code, color; - sx = 240 - state->m_spriteram[offs + 3]; + sx = 240 - m_spriteram[offs + 3]; if (sx < -7) sx += 256; - sy = 240 - state->m_spriteram[offs + 2]; - code = state->m_spriteram[offs + 1] + 128 * (state->m_spriteram[offs] & 0x06); - color = (state->m_spriteram[offs] & 0xe0) >> 5; - if (state->m_flipscreen) + sy = 240 - m_spriteram[offs + 2]; + code = m_spriteram[offs + 1] + 128 * (m_spriteram[offs] & 0x06); + color = (m_spriteram[offs] & 0xe0) >> 5; + if (m_flipscreen) { sx = 240 - sx; sy = 240 - sy; } - if (state->m_spriteram[offs] & 0x10) /* double height */ + if (m_spriteram[offs] & 0x10) /* double height */ { - drawgfx_transpen(bitmap,cliprect,machine.gfx[9], + drawgfx_transpen(bitmap,cliprect,machine().gfx[9], code & ~1, color, - state->m_flipscreen, state->m_flipscreen, - sx, state->m_flipscreen ? sy + 16 : sy - 16,0); - drawgfx_transpen(bitmap,cliprect,machine.gfx[9], + m_flipscreen, m_flipscreen, + sx, m_flipscreen ? sy + 16 : sy - 16,0); + drawgfx_transpen(bitmap,cliprect,machine().gfx[9], code | 1, color, - state->m_flipscreen, state->m_flipscreen, + m_flipscreen, m_flipscreen, sx,sy,0); /* redraw with wraparound */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[9], + drawgfx_transpen(bitmap,cliprect,machine().gfx[9], code & ~1, color, - state->m_flipscreen, state->m_flipscreen, - sx,(state->m_flipscreen ? sy + 16 : sy - 16) + 256,0); - drawgfx_transpen(bitmap,cliprect,machine.gfx[9], + m_flipscreen, m_flipscreen, + sx,(m_flipscreen ? sy + 16 : sy - 16) + 256,0); + drawgfx_transpen(bitmap,cliprect,machine().gfx[9], code | 1, color, - state->m_flipscreen, state->m_flipscreen, + m_flipscreen, m_flipscreen, sx,sy + 256,0); } else { - drawgfx_transpen(bitmap,cliprect,machine.gfx[9], + drawgfx_transpen(bitmap,cliprect,machine().gfx[9], code, color, - state->m_flipscreen, state->m_flipscreen, + m_flipscreen, m_flipscreen, sx,sy,0); /* redraw with wraparound */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[9], + drawgfx_transpen(bitmap,cliprect,machine().gfx[9], code, color, - state->m_flipscreen, state->m_flipscreen, + m_flipscreen, m_flipscreen, sx,sy + 256,0); } @@ -247,13 +246,13 @@ UINT32 brkthru_state::screen_update_brkthru(screen_device &screen, bitmap_ind16 m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); /* low priority sprites */ - draw_sprites(machine(), bitmap, cliprect, 0x01); + draw_sprites(bitmap, cliprect, 0x01); /* draw background over low priority sprites */ m_bg_tilemap->draw(bitmap, cliprect, 0, 0); /* high priority sprites */ - draw_sprites(machine(), bitmap, cliprect, 0x09); + draw_sprites(bitmap, cliprect, 0x09); /* fg layer */ m_fg_tilemap->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/bsktball.c b/src/mame/video/bsktball.c index 769b8de52f4..fa3f88fc0dc 100644 --- a/src/mame/video/bsktball.c +++ b/src/mame/video/bsktball.c @@ -29,29 +29,28 @@ void bsktball_state::video_start() m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(bsktball_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 bsktball_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - bsktball_state *state = machine.driver_data(); int mot; for (mot = 0; mot < 16; mot++) { - int pic = state->m_motion[mot * 4]; - int sy = 28 * 8 - state->m_motion[mot * 4 + 1]; - int sx = state->m_motion[mot * 4 + 2]; - int color = state->m_motion[mot * 4 + 3]; + int pic = m_motion[mot * 4]; + int sy = 28 * 8 - m_motion[mot * 4 + 1]; + int sx = m_motion[mot * 4 + 2]; + int color = m_motion[mot * 4 + 3]; int flipx = (pic & 0x80) >> 7; pic = (pic & 0x3f); color = (color & 0x3f); - drawgfx_transpen(bitmap, cliprect, machine.gfx[1], pic, color, flipx, 0, sx, sy, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[1], pic, color, flipx, 0, sx, sy, 0); } } UINT32 bsktball_state::screen_update_bsktball(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; } diff --git a/src/mame/video/btime.c b/src/mame/video/btime.c index 5f25efbf3a0..3938a6db769 100644 --- a/src/mame/video/btime.c +++ b/src/mame/video/btime.c @@ -289,42 +289,40 @@ WRITE8_MEMBER(btime_state::disco_video_control_w) } -static void draw_chars( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 transparency, UINT8 color, int priority ) +void btime_state::draw_chars( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 transparency, UINT8 color, int priority ) { - btime_state *state = machine.driver_data(); offs_t offs; - for (offs = 0; offs < state->m_videoram.bytes(); offs++) + for (offs = 0; offs < m_videoram.bytes(); offs++) { UINT8 x = 31 - (offs / 32); UINT8 y = offs % 32; - UINT16 code = state->m_videoram[offs] + 256 * (state->m_colorram[offs] & 3); + UINT16 code = m_videoram[offs] + 256 * (m_colorram[offs] & 3); /* check priority */ if ((priority != -1) && (priority != ((code >> 7) & 0x01))) continue; - if (state->flip_screen()) + if (flip_screen()) { x = 31 + 16 - x; y = 33 - y; } - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], code, color, - state->flip_screen(),state->flip_screen(), + flip_screen(),flip_screen(), 8*x,8*y, transparency ? 0 : -1); } } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 color, +void btime_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 color, UINT8 sprite_y_adjust, UINT8 sprite_y_adjust_flip_screen, UINT8 *sprite_ram, offs_t interleave ) { - btime_state *state = machine.driver_data(); int i; offs_t offs; @@ -342,7 +340,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const flipx = sprite_ram[offs + 0] & 0x04; flipy = sprite_ram[offs + 0] & 0x02; - if (state->flip_screen()) + if (flip_screen()) { x = 240 + 128 - x; y = 256 - y + sprite_y_adjust_flip_screen; @@ -353,16 +351,16 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const y = y - sprite_y_adjust; - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], sprite_ram[offs + interleave], color, flipx,flipy, x, y,0); - y = y + (state->flip_screen() ? -256 : 256); + y = y + (flip_screen() ? -256 : 256); // Wrap around - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], sprite_ram[offs + interleave], color, flipx,flipy, @@ -371,12 +369,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } -static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* tmap, UINT8 color ) +void btime_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* tmap, UINT8 color ) { - btime_state *state = machine.driver_data(); int i; - const UINT8 *gfx = state->memregion("bg_map")->base(); - int scroll = -(state->m_bnj_scroll2 | ((state->m_bnj_scroll1 & 0x03) << 8)); + const UINT8 *gfx = memregion("bg_map")->base(); + int scroll = -(m_bnj_scroll2 | ((m_bnj_scroll1 & 0x03) << 8)); // One extra iteration for wrap around for (i = 0; i < 5; i++, scroll += 256) @@ -395,16 +392,16 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con int x = 240 - (16 * (offs / 16) + scroll) - 1; int y = 16 * (offs % 16); - if (state->flip_screen()) + if (flip_screen()) { x = 240 + 128 - x; y = 256 - y; } - drawgfx_opaque(bitmap, cliprect,machine.gfx[2], + drawgfx_opaque(bitmap, cliprect,machine().gfx[2], gfx[tileoffset + offs], color, - state->flip_screen(),state->flip_screen(), + flip_screen(),flip_screen(), x,y); } } @@ -429,13 +426,13 @@ UINT32 btime_state::screen_update_btime(screen_device &screen, bitmap_ind16 &bit start = (start + 1) & 0x03; } - draw_background(machine(), bitmap, cliprect, m_btime_tilemap, 0); - draw_chars(machine(), bitmap, cliprect, TRUE, 0, -1); + draw_background(bitmap, cliprect, m_btime_tilemap, 0); + draw_chars(bitmap, cliprect, TRUE, 0, -1); } else - draw_chars(machine(), bitmap, cliprect, FALSE, 0, -1); + draw_chars(bitmap, cliprect, FALSE, 0, -1); - draw_sprites(machine(), bitmap, cliprect, 0, 1, 0, m_videoram, 0x20); + draw_sprites(bitmap, cliprect, 0, 1, 0, m_videoram, 0x20); return 0; } @@ -443,8 +440,8 @@ UINT32 btime_state::screen_update_btime(screen_device &screen, bitmap_ind16 &bit UINT32 btime_state::screen_update_eggs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_chars(machine(), bitmap, cliprect, FALSE, 0, -1); - draw_sprites(machine(), bitmap, cliprect, 0, 0, 0, m_videoram, 0x20); + draw_chars(bitmap, cliprect, FALSE, 0, -1); + draw_sprites(bitmap, cliprect, 0, 0, 0, m_videoram, 0x20); return 0; } @@ -452,8 +449,8 @@ UINT32 btime_state::screen_update_eggs(screen_device &screen, bitmap_ind16 &bitm UINT32 btime_state::screen_update_lnc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_chars(machine(), bitmap, cliprect, FALSE, 0, -1); - draw_sprites(machine(), bitmap, cliprect, 0, 1, 2, m_videoram, 0x20); + draw_chars(bitmap, cliprect, FALSE, 0, -1); + draw_sprites(bitmap, cliprect, 0, 1, 2, m_videoram, 0x20); return 0; } @@ -463,15 +460,15 @@ UINT32 btime_state::screen_update_zoar(screen_device &screen, bitmap_ind16 &bitm { if (m_bnj_scroll1 & 0x04) { - draw_background(machine(), bitmap, cliprect, m_zoar_scrollram, m_btime_palette); - draw_chars(machine(), bitmap, cliprect, TRUE, m_btime_palette + 1, -1); + draw_background(bitmap, cliprect, m_zoar_scrollram, m_btime_palette); + draw_chars(bitmap, cliprect, TRUE, m_btime_palette + 1, -1); } else - draw_chars(machine(), bitmap, cliprect, FALSE, m_btime_palette + 1, -1); + draw_chars(bitmap, cliprect, FALSE, m_btime_palette + 1, -1); /* The order is important for correct priorities */ - draw_sprites(machine(), bitmap, cliprect, m_btime_palette + 1, 1, 2, m_videoram + 0x1f, 0x20); - draw_sprites(machine(), bitmap, cliprect, m_btime_palette + 1, 1, 2, m_videoram, 0x20); + draw_sprites(bitmap, cliprect, m_btime_palette + 1, 1, 2, m_videoram + 0x1f, 0x20); + draw_sprites(bitmap, cliprect, m_btime_palette + 1, 1, 2, m_videoram, 0x20); return 0; } @@ -512,14 +509,14 @@ UINT32 btime_state::screen_update_bnj(screen_device &screen, bitmap_ind16 &bitma /* copy the low priority characters followed by the sprites then the high priority characters */ - draw_chars(machine(), bitmap, cliprect, TRUE, 0, 1); - draw_sprites(machine(), bitmap, cliprect, 0, 0, 0, m_videoram, 0x20); - draw_chars(machine(), bitmap, cliprect, TRUE, 0, 0); + draw_chars(bitmap, cliprect, TRUE, 0, 1); + draw_sprites(bitmap, cliprect, 0, 0, 0, m_videoram, 0x20); + draw_chars(bitmap, cliprect, TRUE, 0, 0); } else { - draw_chars(machine(), bitmap, cliprect, FALSE, 0, -1); - draw_sprites(machine(), bitmap, cliprect, 0, 0, 0, m_videoram, 0x20); + draw_chars(bitmap, cliprect, FALSE, 0, -1); + draw_sprites(bitmap, cliprect, 0, 0, 0, m_videoram, 0x20); } return 0; @@ -550,8 +547,8 @@ UINT32 btime_state::screen_update_cookrace(screen_device &screen, bitmap_ind16 & 8*sx,8*sy); } - draw_chars(machine(), bitmap, cliprect, TRUE, 0, -1); - draw_sprites(machine(), bitmap, cliprect, 0, 1, 0, m_videoram, 0x20); + draw_chars(bitmap, cliprect, TRUE, 0, -1); + draw_sprites(bitmap, cliprect, 0, 1, 0, m_videoram, 0x20); return 0; } @@ -559,8 +556,8 @@ UINT32 btime_state::screen_update_cookrace(screen_device &screen, bitmap_ind16 & UINT32 btime_state::screen_update_disco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_chars(machine(), bitmap, cliprect, FALSE, m_btime_palette, -1); - draw_sprites(machine(), bitmap, cliprect, m_btime_palette, 0, 0, m_spriteram, 1); + draw_chars(bitmap, cliprect, FALSE, m_btime_palette, -1); + draw_sprites(bitmap, cliprect, m_btime_palette, 0, 0, m_spriteram, 1); return 0; } diff --git a/src/mame/video/buggychl.c b/src/mame/video/buggychl.c index 6dce4fd4e09..1f8a6259d38 100644 --- a/src/mame/video/buggychl.c +++ b/src/mame/video/buggychl.c @@ -73,7 +73,7 @@ WRITE8_MEMBER(buggychl_state::buggychl_bg_scrollx_w) } -static void draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ) +void buggychl_state::draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ) { int x, y; @@ -83,70 +83,68 @@ static void draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ) } -static void draw_bg( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void buggychl_state::draw_bg( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - buggychl_state *state = machine.driver_data(); int offs; int scroll[256]; /* prevent wraparound */ rectangle clip = cliprect; - if (state->flip_screen_x()) clip.min_x += 8*8; + if (flip_screen_x()) clip.min_x += 8*8; else clip.max_x -= 8*8; for (offs = 0; offs < 0x400; offs++) { - int code = state->m_videoram[0x400 + offs]; + int code = m_videoram[0x400 + offs]; int sx = offs % 32; int sy = offs / 32; - if (state->flip_screen_x()) + if (flip_screen_x()) sx = 31 - sx; - if (state->flip_screen_y()) + if (flip_screen_y()) sy = 31 - sy; - drawgfx_opaque(state->m_tmp_bitmap1, state->m_tmp_bitmap1.cliprect(), machine.gfx[0], + drawgfx_opaque(m_tmp_bitmap1, m_tmp_bitmap1.cliprect(), machine().gfx[0], code, 2, - state->flip_screen_x(),state->flip_screen_y(), + flip_screen_x(),flip_screen_y(), 8*sx,8*sy); } /* first copy to a temp bitmap doing column scroll */ for (offs = 0; offs < 256; offs++) - scroll[offs] = -state->m_scrollv[offs / 8]; + scroll[offs] = -m_scrollv[offs / 8]; - copyscrollbitmap(state->m_tmp_bitmap2, state->m_tmp_bitmap1, 1, &state->m_bg_scrollx, 256, scroll, state->m_tmp_bitmap2.cliprect()); + copyscrollbitmap(m_tmp_bitmap2, m_tmp_bitmap1, 1, &m_bg_scrollx, 256, scroll, m_tmp_bitmap2.cliprect()); /* then copy to the screen doing row scroll */ for (offs = 0; offs < 256; offs++) - scroll[offs] = -state->m_scrollh[offs]; + scroll[offs] = -m_scrollh[offs]; - copyscrollbitmap_trans(bitmap, state->m_tmp_bitmap2, 256, scroll, 0, 0, clip, 32); + copyscrollbitmap_trans(bitmap, m_tmp_bitmap2, 256, scroll, 0, 0, clip, 32); } -static void draw_fg( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void buggychl_state::draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - buggychl_state *state = machine.driver_data(); int offs; for (offs = 0; offs < 0x400; offs++) { int sx = offs % 32; int sy = offs / 32; - int flipx = state->flip_screen_x(); - int flipy = state->flip_screen_y(); + int flipx = flip_screen_x(); + int flipy = flip_screen_y(); - int code = state->m_videoram[offs]; + int code = m_videoram[offs]; if (flipx) sx = 31 - sx; if (flipy) sy = 31 - sy; - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], code, 0, flipx,flipy, @@ -156,17 +154,16 @@ static void draw_fg( running_machine &machine, bitmap_ind16 &bitmap, const recta } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - buggychl_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; const UINT8 *gfx; g_profiler.start(PROFILER_USER1); - gfx = state->memregion("gfx2")->base(); - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + gfx = memregion("gfx2")->base(); + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { int sx, sy, flipy, zoom, ch, x, px, y; const UINT8 *lookup; @@ -179,11 +176,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const zoomy_rom = gfx + (zoom << 6); zoomx_rom = gfx + 0x2000 + (zoom << 3); - lookup = state->m_sprite_lookup + ((spriteram[offs + 2] & 0x7f) << 6); + lookup = m_sprite_lookup + ((spriteram[offs + 2] & 0x7f) << 6); for (y = 0; y < 64; y++) { - int dy = state->flip_screen_y() ? (255 - sy - y) : (sy + y); + int dy = flip_screen_y() ? (255 - sy - y) : (sy + y); if ((dy & ~0xff) == 0) { @@ -204,16 +201,16 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; code += (realflipy ? (charline ^ 7) : charline); - pendata = machine.gfx[1]->get_data(code); + pendata = machine().gfx[1]->get_data(code); for (x = 0; x < 16; x++) { int col = pendata[x]; if (col) { - int dx = state->flip_screen_x() ? (255 - sx - px) : (sx + px); + int dx = flip_screen_x() ? (255 - sx - px) : (sx + px); if ((dx & ~0xff) == 0) - bitmap.pix16(dy, dx) = state->m_sprite_color_base + col; + bitmap.pix16(dy, dx) = m_sprite_color_base + col; } /* the following line is almost certainly wrong */ @@ -237,11 +234,11 @@ UINT32 buggychl_state::screen_update_buggychl(screen_device &screen, bitmap_ind1 bitmap.fill(0, cliprect); if (m_bg_on) - draw_bg(machine(), bitmap, cliprect); + draw_bg(bitmap, cliprect); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); - draw_fg(machine(), bitmap, cliprect); + draw_fg(bitmap, cliprect); return 0; } diff --git a/src/mame/video/bwing.c b/src/mame/video/bwing.c index 4a12bfc045f..9768816347d 100644 --- a/src/mame/video/bwing.c +++ b/src/mame/video/bwing.c @@ -21,7 +21,7 @@ drivers by Acho A. Tang //**************************************************************************** // Local Functions -static void fill_srxlat( int *xlat ) +void bwing_state::fill_srxlat( int *xlat ) { unsigned base, offset, i; @@ -240,11 +240,10 @@ void bwing_state::video_start() //**************************************************************************** // Realtime -static void draw_sprites( running_machine &machine, bitmap_ind16 &bmp, const rectangle &clip, UINT8 *ram, int pri ) +void bwing_state::draw_sprites( bitmap_ind16 &bmp, const rectangle &clip, UINT8 *ram, int pri ) { - bwing_state *state = machine.driver_data(); int attrib, fx, fy, code, x, y, color, i; - gfx_element *gfx = machine.gfx[1]; + gfx_element *gfx = machine().gfx[1]; for (i = 0; i < 0x200; i += 4) { @@ -265,7 +264,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bmp, const rec fy = ~attrib & 0x02; // normal/cocktail - if (state->m_mapmask & 0x20) + if (m_mapmask & 0x20) { fx = !fx; fy = !fy; @@ -311,7 +310,7 @@ UINT32 bwing_state::screen_update_bwing(screen_device &screen, bitmap_ind16 &bit bitmap.fill(get_black_pen(machine()), cliprect); // draw low priority sprites - draw_sprites(machine(), bitmap, cliprect, m_spriteram, 0); + draw_sprites(bitmap, cliprect, m_spriteram, 0); // draw foreground if (!(m_mapmask & 2)) @@ -325,7 +324,7 @@ UINT32 bwing_state::screen_update_bwing(screen_device &screen, bitmap_ind16 &bit } // draw high priority sprites - draw_sprites(machine(), bitmap, cliprect, m_spriteram, 1); + draw_sprites(bitmap, cliprect, m_spriteram, 1); // draw text layer // if (m_mapmask & 4)