diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2013-02-08 11:39:01 +0000 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2013-02-08 11:39:01 +0000 |
commit | 0af8c1b855e673526d09b00c42742582ca47b18b (patch) | |
tree | e0c091e6408b64653d751f59215857f1e731dd73 | |
parent | 18dcd633bc0d0c3a7c6a900b5d5d8dec2a782307 (diff) |
Modernization of drivers part 6 (no whatsnew)
84 files changed, 1290 insertions, 1368 deletions
diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c index b47f02b7be6..13f77c567c5 100644 --- a/src/mame/drivers/gaiden.c +++ b/src/mame/drivers/gaiden.c @@ -1506,12 +1506,12 @@ DRIVER_INIT_MEMBER(gaiden_state,raiga) machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this)); } -static void descramble_drgnbowl_gfx(running_machine &machine) +void gaiden_state::descramble_drgnbowl_gfx() { int i; - UINT8 *ROM = machine.root_device().memregion("maincpu")->base(); - size_t size = machine.root_device().memregion("maincpu")->bytes(); - UINT8 *buffer = auto_alloc_array(machine, UINT8, size); + UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); + size_t size = machine().root_device().memregion("maincpu")->bytes(); + UINT8 *buffer = auto_alloc_array(machine(), UINT8, size); memcpy(buffer, ROM, size); for( i = 0; i < size; i++ ) @@ -1524,11 +1524,11 @@ static void descramble_drgnbowl_gfx(running_machine &machine) 3, 2, 1, 0)]; } - auto_free(machine, buffer); + auto_free(machine(), buffer); - ROM = machine.root_device().memregion("gfx2")->base(); - size = machine.root_device().memregion("gfx2")->bytes(); - buffer = auto_alloc_array(machine, UINT8, size); + ROM = machine().root_device().memregion("gfx2")->base(); + size = machine().root_device().memregion("gfx2")->bytes(); + buffer = auto_alloc_array(machine(), UINT8, size); memcpy(buffer,ROM,size); for( i = 0; i < size; i++ ) @@ -1541,23 +1541,23 @@ static void descramble_drgnbowl_gfx(running_machine &machine) 5, 2, 1, 0)]; } - auto_free(machine, buffer); + auto_free(machine(), buffer); } DRIVER_INIT_MEMBER(gaiden_state,drgnbowl) { m_raiga_jumppoints = jumppoints_00; - descramble_drgnbowl_gfx(machine()); + descramble_drgnbowl_gfx(); } -static void descramble_mastninj_gfx(running_machine &machine, UINT8* src) +void gaiden_state::descramble_mastninj_gfx(UINT8* src) { UINT8 *buffer; int len = 0x80000; /* rearrange gfx */ - buffer = auto_alloc_array(machine, UINT8, len); + buffer = auto_alloc_array(machine(), UINT8, len); { int i; for (i = 0;i < len; i++) @@ -1571,10 +1571,10 @@ static void descramble_mastninj_gfx(running_machine &machine, UINT8* src) 3,2,1,0)]; } memcpy(src, buffer, len); - auto_free(machine, buffer); + auto_free(machine(), buffer); } - buffer = auto_alloc_array(machine, UINT8, len); + buffer = auto_alloc_array(machine(), UINT8, len); { int i; for (i = 0; i < len; i++) @@ -1588,15 +1588,15 @@ static void descramble_mastninj_gfx(running_machine &machine, UINT8* src) 3,2,1,0)]; } memcpy(src, buffer, len); - auto_free(machine, buffer); + auto_free(machine(), buffer); } } DRIVER_INIT_MEMBER(gaiden_state,mastninj) { // rearrange the graphic roms into a format that MAME can decode - descramble_mastninj_gfx(machine(), machine().root_device().memregion("gfx2")->base()); - descramble_mastninj_gfx(machine(), machine().root_device().memregion("gfx3")->base()); + descramble_mastninj_gfx(machine().root_device().memregion("gfx2")->base()); + descramble_mastninj_gfx(machine().root_device().memregion("gfx3")->base()); DRIVER_INIT_CALL(shadoww); } diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c index f78da2faad9..6e71b86ee4e 100644 --- a/src/mame/drivers/galaga.c +++ b/src/mame/drivers/galaga.c @@ -882,21 +882,20 @@ MACHINE_START_MEMBER(galaga_state,galaga) save_item(NAME(m_sub2_nmi_mask)); } -static void bosco_latch_reset(running_machine &machine) +void galaga_state::bosco_latch_reset() { - galaga_state *state = machine.driver_data<galaga_state>(); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int i; /* Reset all latches */ for (i = 0;i < 8;i++) - state->bosco_latch_w(space,i,0); + bosco_latch_w(space,i,0); } MACHINE_RESET_MEMBER(galaga_state,galaga) { /* Reset all latches */ - bosco_latch_reset(machine()); + bosco_latch_reset(); m_cpu3_interrupt_timer->adjust(machine().primary_screen->time_until_pos(64), 64); } diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index e59c4034dd8..71aa6f9361c 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -827,15 +827,14 @@ READ8_MEMBER(galaxian_state::monsterz_protection_r) } -static void monsterz_set_latch(running_machine &machine) +void galaxian_state::monsterz_set_latch() { // read from a rom (which one?? "a-3e.k3" from audiocpu ($2700-$2fff) looks very suspicious) - galaxian_state *state = machine.driver_data<galaxian_state>(); - UINT8 *rom = state->memregion("audiocpu")->base(); - state->m_protection_result = rom[0x2000 | (state->m_protection_state & 0x1fff)]; // probably needs a BITSWAP8 + UINT8 *rom = memregion("audiocpu")->base(); + m_protection_result = rom[0x2000 | (m_protection_state & 0x1fff)]; // probably needs a BITSWAP8 // and an irq on the main z80 afterwards - machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE ); + machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE ); } @@ -844,7 +843,7 @@ WRITE8_MEMBER(galaxian_state::monsterz_porta_1_w) // d7 high: set latch + advance address high bits (and reset low bits?) if (data & 0x80) { - monsterz_set_latch(machine()); + monsterz_set_latch(); m_protection_state = (m_protection_state + 0x100) & 0xff00; } } @@ -854,7 +853,7 @@ WRITE8_MEMBER(galaxian_state::monsterz_portb_1_w) // d3 high: set latch + advance address low bits if (data & 0x08) { - monsterz_set_latch(machine()); + monsterz_set_latch(); m_protection_state = ((m_protection_state + 1) & 0x00ff) | (m_protection_state & 0xff00); } } @@ -2514,9 +2513,9 @@ MACHINE_CONFIG_END * *************************************/ -static void decode_mooncrst(running_machine &machine, int length, UINT8 *dest) +void galaxian_state::decode_mooncrst(int length, UINT8 *dest) { - UINT8 *rom = machine.root_device().memregion("maincpu")->base(); + UINT8 *rom = machine().root_device().memregion("maincpu")->base(); int offs; for (offs = 0; offs < length; offs++) @@ -2531,7 +2530,7 @@ static void decode_mooncrst(running_machine &machine, int length, UINT8 *dest) } -static void decode_checkman(running_machine &machine) +void galaxian_state::decode_checkman() { /* Encryption Table @@ -2578,8 +2577,8 @@ static void decode_checkman(running_machine &machine) { 0,2,0,2 }, { 1,4,1,4 } }; - UINT8 *rombase = machine.root_device().memregion("maincpu")->base(); - UINT32 romlength = machine.root_device().memregion("maincpu")->bytes(); + UINT8 *rombase = machine().root_device().memregion("maincpu")->base(); + UINT32 romlength = machine().root_device().memregion("maincpu")->bytes(); UINT32 offs; for (offs = 0; offs < romlength; offs++) @@ -2593,10 +2592,10 @@ static void decode_checkman(running_machine &machine) } -static void decode_dingoe(running_machine &machine) +void galaxian_state::decode_dingoe() { - UINT8 *rombase = machine.root_device().memregion("maincpu")->base(); - UINT32 romlength = machine.root_device().memregion("maincpu")->bytes(); + UINT8 *rombase = machine().root_device().memregion("maincpu")->base(); + UINT32 romlength = machine().root_device().memregion("maincpu")->bytes(); UINT32 offs; for (offs = 0; offs < romlength; offs++) @@ -2616,9 +2615,9 @@ static void decode_dingoe(running_machine &machine) } -static void decode_frogger_sound(running_machine &machine) +void galaxian_state::decode_frogger_sound() { - UINT8 *rombase = machine.root_device().memregion("audiocpu")->base(); + UINT8 *rombase = machine().root_device().memregion("audiocpu")->base(); UINT32 offs; /* the first ROM of the sound CPU has data lines D0 and D1 swapped */ @@ -2627,9 +2626,9 @@ static void decode_frogger_sound(running_machine &machine) } -static void decode_frogger_gfx(running_machine &machine) +void galaxian_state::decode_frogger_gfx() { - UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); + UINT8 *rombase = machine().root_device().memregion("gfx1")->base(); UINT32 offs; /* the 2nd gfx ROM has data lines D0 and D1 swapped */ @@ -2638,11 +2637,11 @@ static void decode_frogger_gfx(running_machine &machine) } -static void decode_anteater_gfx(running_machine &machine) +void galaxian_state::decode_anteater_gfx() { - UINT32 romlength = machine.root_device().memregion("gfx1")->bytes(); - UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); - UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength); + UINT32 romlength = machine().root_device().memregion("gfx1")->bytes(); + UINT8 *rombase = machine().root_device().memregion("gfx1")->base(); + UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength); UINT32 offs; memcpy(scratch, rombase, romlength); @@ -2654,15 +2653,15 @@ static void decode_anteater_gfx(running_machine &machine) srcoffs |= (BIT(offs,0) ^ BIT(offs,6) ^ 1) << 10; rombase[offs] = scratch[srcoffs]; } - auto_free(machine, scratch); + auto_free(machine(), scratch); } -static void decode_losttomb_gfx(running_machine &machine) +void galaxian_state::decode_losttomb_gfx() { - UINT32 romlength = machine.root_device().memregion("gfx1")->bytes(); - UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); - UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength); + UINT32 romlength = machine().root_device().memregion("gfx1")->bytes(); + UINT8 *rombase = machine().root_device().memregion("gfx1")->base(); + UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength); UINT32 offs; memcpy(scratch, rombase, romlength); @@ -2674,18 +2673,18 @@ static void decode_losttomb_gfx(running_machine &machine) srcoffs |= ((BIT(offs,1) & BIT(offs,7)) | ((1 ^ BIT(offs,1)) & (BIT(offs,8)))) << 10; rombase[offs] = scratch[srcoffs]; } - auto_free(machine, scratch); + auto_free(machine(), scratch); } -static void decode_superbon(running_machine &machine) +void galaxian_state::decode_superbon() { offs_t i; UINT8 *RAM; /* Deryption worked out by hand by Chris Hardy. */ - RAM = machine.root_device().memregion("maincpu")->base(); + RAM = machine().root_device().memregion("maincpu")->base(); for (i = 0;i < 0x1000;i++) { @@ -2715,30 +2714,25 @@ static void decode_superbon(running_machine &machine) * *************************************/ -static void common_init( - running_machine &machine, - galaxian_draw_bullet_func draw_bullet, - galaxian_draw_background_func draw_background, - galaxian_extend_tile_info_func extend_tile_info, - galaxian_extend_sprite_info_func extend_sprite_info) +void galaxian_state::common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background, + galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - state->m_irq_enabled = 0; - state->m_irq_line = INPUT_LINE_NMI; - state->m_numspritegens = 1; - state->m_bullets_base = 0x60; - state->m_frogger_adjust = FALSE; - state->m_sfx_tilemap = FALSE; - state->m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : galaxian_draw_bullet; - state->m_draw_background_ptr = (draw_background != NULL) ? draw_background : galaxian_draw_background; - state->m_extend_tile_info_ptr = extend_tile_info; - state->m_extend_sprite_info_ptr = extend_sprite_info; + m_irq_enabled = 0; + m_irq_line = INPUT_LINE_NMI; + m_numspritegens = 1; + m_bullets_base = 0x60; + m_frogger_adjust = FALSE; + m_sfx_tilemap = FALSE; + m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : &galaxian_state::galaxian_draw_bullet; + m_draw_background_ptr = (draw_background != NULL) ? draw_background : &galaxian_state::galaxian_draw_background; + m_extend_tile_info_ptr = extend_tile_info; + m_extend_sprite_info_ptr = extend_sprite_info; } -static void unmap_galaxian_sound(running_machine &machine, offs_t base) +void galaxian_state::unmap_galaxian_sound(offs_t base) { - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.unmap_write(base + 0x0004, base + 0x0007, 0, 0x07f8); space.unmap_write(base + 0x0800, base + 0x0807, 0, 0x07f8); @@ -2755,7 +2749,7 @@ static void unmap_galaxian_sound(running_machine &machine, offs_t base) DRIVER_INIT_MEMBER(galaxian_state,galaxian) { - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); } @@ -2776,7 +2770,7 @@ DRIVER_INIT_MEMBER(galaxian_state,azurian) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* yellow bullets instead of white ones */ - common_init(machine(), scramble_draw_bullet, galaxian_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); /* coin lockout disabled */ space.unmap_write(0x6002, 0x6002, 0, 0x7f8); @@ -2788,7 +2782,7 @@ DRIVER_INIT_MEMBER(galaxian_state,gmgalax) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::gmgalax_extend_tile_info, &galaxian_state::gmgalax_extend_sprite_info); /* ROM is banked */ space.install_read_bank(0x0000, 0x3fff, "bank1"); @@ -2805,7 +2799,7 @@ DRIVER_INIT_MEMBER(galaxian_state,pisces) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info); /* coin lockout replaced by graphics bank */ space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); @@ -2817,7 +2811,7 @@ DRIVER_INIT_MEMBER(galaxian_state,batman2) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); /* coin lockout replaced by graphics bank */ space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); @@ -2829,7 +2823,7 @@ DRIVER_INIT_MEMBER(galaxian_state,frogg) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* same as galaxian... */ - common_init(machine(), galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); /* ...but needs a full 2k of RAM */ space.install_ram(0x4000, 0x47ff); @@ -2846,17 +2840,17 @@ DRIVER_INIT_MEMBER(galaxian_state,frogg) DRIVER_INIT_MEMBER(galaxian_state,mooncrst) { /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); /* decrypt program code */ - decode_mooncrst(machine(), 0x8000, machine().root_device().memregion("maincpu")->base()); + decode_mooncrst(0x8000, machine().root_device().memregion("maincpu")->base()); } DRIVER_INIT_MEMBER(galaxian_state,mooncrsu) { /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); } @@ -2865,7 +2859,7 @@ DRIVER_INIT_MEMBER(galaxian_state,mooncrgx) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); /* LEDs and coin lockout replaced by graphics banking */ space.install_write_handler(0x6000, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); @@ -2878,10 +2872,10 @@ DRIVER_INIT_MEMBER(galaxian_state,moonqsr) UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, moonqsr_extend_tile_info, moonqsr_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::moonqsr_extend_tile_info, &galaxian_state::moonqsr_extend_sprite_info); /* decrypt program code */ - decode_mooncrst(machine(), 0x8000, decrypt); + decode_mooncrst(0x8000, decrypt); space.set_decrypted_region(0x0000, 0x7fff, decrypt); } @@ -2957,7 +2951,7 @@ DRIVER_INIT_MEMBER(galaxian_state,tenspot) which tenspot appears to have copied */ /* video extensions */ - //common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); + //common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); /* coin lockout replaced by graphics bank */ //space.install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(galaxian_gfxbank_w)); @@ -2979,7 +2973,7 @@ DRIVER_INIT_MEMBER(galaxian_state,tenspot) DRIVER_INIT_MEMBER(galaxian_state,devilfsg) { /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); /* IRQ line is INT, not NMI */ m_irq_line = 0; @@ -2991,7 +2985,7 @@ DRIVER_INIT_MEMBER(galaxian_state,zigzag) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), NULL, galaxian_draw_background, NULL, NULL); + common_init(NULL, &galaxian_state::galaxian_draw_background, NULL, NULL); m_draw_bullet_ptr = NULL; /* two sprite generators */ @@ -3016,7 +3010,7 @@ DRIVER_INIT_MEMBER(galaxian_state,zigzag) space.unmap_write(0x6002, 0x6002, 0, 0x7f8); /* remove the galaxian sound hardware */ - unmap_galaxian_sound(machine(), 0x6000); + unmap_galaxian_sound( 0x6000); /* install our AY-8910 handler */ space.install_write_handler(0x4800, 0x4fff, write8_delegate(FUNC(galaxian_state::zigzag_ay8910_w),this)); @@ -3026,7 +3020,7 @@ DRIVER_INIT_MEMBER(galaxian_state,zigzag) DRIVER_INIT_MEMBER(galaxian_state,jumpbug) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, jumpbug_draw_background, jumpbug_extend_tile_info, jumpbug_extend_sprite_info); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::jumpbug_draw_background, &galaxian_state::jumpbug_extend_tile_info, &galaxian_state::jumpbug_extend_sprite_info); } @@ -3036,7 +3030,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkman) address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); /* move the interrupt enable from $b000 to $b001 */ space.unmap_write(0xb000, 0xb000, 0, 0x7f8); @@ -3046,7 +3040,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkman) iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); /* decrypt program code */ - decode_checkman(machine()); + decode_checkman(); } @@ -3055,7 +3049,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkmaj) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); /* attach the sound command handler */ space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); @@ -3070,7 +3064,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingo) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); /* attach the sound command handler */ space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); @@ -3086,7 +3080,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingoe) address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); /* move the interrupt enable from $b000 to $b001 */ space.unmap_write(0xb000, 0xb000, 0, 0x7f8); @@ -3098,7 +3092,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingoe) space.install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),this)); /* Protection check */ /* decrypt program code */ - decode_dingoe(machine()); + decode_dingoe(); } @@ -3107,7 +3101,7 @@ DRIVER_INIT_MEMBER(galaxian_state,skybase) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info); /* coin lockout replaced by graphics bank */ space.install_write_handler(0xa002, 0xa002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); @@ -3125,7 +3119,7 @@ DRIVER_INIT_MEMBER(galaxian_state,kong) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info); /* needs a full 2k of RAM */ space.install_ram(0x8000, 0x87ff); @@ -3135,11 +3129,11 @@ DRIVER_INIT_MEMBER(galaxian_state,kong) } -static void mshuttle_decode(running_machine &machine, const UINT8 convtable[8][16]) +void galaxian_state::mshuttle_decode(const UINT8 convtable[8][16]) { - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); - UINT8 *rom = machine.root_device().memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + UINT8 *rom = machine().root_device().memregion("maincpu")->base(); + UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000); int A; space.set_decrypted_region(0x0000, 0xffff, decrypt); @@ -3178,13 +3172,13 @@ DRIVER_INIT_MEMBER(galaxian_state,mshuttle) }; /* video extensions */ - common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info); + common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info); /* IRQ line is INT, not NMI */ m_irq_line = 0; /* decrypt the code */ - mshuttle_decode(machine(), convtable); + mshuttle_decode(convtable); } @@ -3203,20 +3197,20 @@ DRIVER_INIT_MEMBER(galaxian_state,mshuttlj) }; /* video extensions */ - common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info); + common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info); /* IRQ line is INT, not NMI */ m_irq_line = 0; /* decrypt the code */ - mshuttle_decode(machine(), convtable); + mshuttle_decode(convtable); } DRIVER_INIT_MEMBER(galaxian_state,fantastc) { /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info); /* two sprite generators */ m_numspritegens = 2; @@ -3251,7 +3245,7 @@ DRIVER_INIT_MEMBER(galaxian_state,kingball) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); /* disable the stars */ space.unmap_write(0xb004, 0xb004, 0, 0x07f8); @@ -3271,7 +3265,7 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpnmc) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); /* move the interrupt enable from $b000 to $b001 */ space.unmap_write(0xb000, 0xb000, 0, 0x7f8); @@ -3292,7 +3286,7 @@ DRIVER_INIT_MEMBER(galaxian_state,thepitm) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); + common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); /* move the interrupt enable from $b000 to $b001 */ space.unmap_write(0xb000, 0xb000, 0, 0x7f8); @@ -3316,7 +3310,7 @@ DRIVER_INIT_MEMBER(galaxian_state,theend) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), theend_draw_bullet, galaxian_draw_background, NULL, NULL); + common_init(&galaxian_state::theend_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL); /* coin counter on the upper bit of port C */ space.unmap_write(0x6802, 0x6802, 0, 0x7f8); @@ -3326,7 +3320,7 @@ DRIVER_INIT_MEMBER(galaxian_state,theend) DRIVER_INIT_MEMBER(galaxian_state,scramble) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); } @@ -3335,7 +3329,7 @@ DRIVER_INIT_MEMBER(galaxian_state,explorer) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); /* watchdog works for writes as well? (or is it just disabled?) */ space.install_write_handler(0x7000, 0x7000, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::watchdog_reset_w),this)); @@ -3354,7 +3348,7 @@ DRIVER_INIT_MEMBER(galaxian_state,explorer) DRIVER_INIT_MEMBER(galaxian_state,sfx) { /* basic configuration */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, upper_extend_tile_info, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::upper_extend_tile_info, NULL); m_sfx_tilemap = TRUE; /* sound board has space for extra ROM */ @@ -3368,7 +3362,7 @@ DRIVER_INIT_MEMBER(galaxian_state,atlantis) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); /* watchdog is at $7800? (or is it just disabled?) */ space.unmap_read(0x7000, 0x7000, 0, 0x7ff); @@ -3379,29 +3373,29 @@ DRIVER_INIT_MEMBER(galaxian_state,atlantis) DRIVER_INIT_MEMBER(galaxian_state,scobra) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); } DRIVER_INIT_MEMBER(galaxian_state,losttomb) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); /* decrypt */ - decode_losttomb_gfx(machine()); + decode_losttomb_gfx(); } DRIVER_INIT_MEMBER(galaxian_state,frogger) { /* video extensions */ - common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); + common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); m_frogger_adjust = TRUE; /* decrypt */ - decode_frogger_sound(machine()); - decode_frogger_gfx(machine()); + decode_frogger_sound(); + decode_frogger_gfx(); } @@ -3410,7 +3404,7 @@ DRIVER_INIT_MEMBER(galaxian_state,froggrmc) address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ - common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); + common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); space.install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),this)); space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::froggrmc_sound_control_w),this)); @@ -3419,24 +3413,24 @@ DRIVER_INIT_MEMBER(galaxian_state,froggrmc) space.install_ram(0x8000, 0x87ff); /* decrypt */ - decode_frogger_sound(machine()); + decode_frogger_sound(); } DRIVER_INIT_MEMBER(galaxian_state,froggers) { /* video extensions */ - common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); + common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); /* decrypt */ - decode_frogger_sound(machine()); + decode_frogger_sound(); } DRIVER_INIT_MEMBER(galaxian_state,turtles) { /* video extensions */ - common_init(machine(), NULL, turtles_draw_background, NULL, NULL); + common_init(NULL, &galaxian_state::turtles_draw_background, NULL, NULL); } @@ -3445,7 +3439,7 @@ DRIVER_INIT_MEMBER(galaxian_state,amidar) { /* no existing amidar sets run on Amidar hardware as described by Amidar schematics! */ /* video extensions */ - common_init(machine(), scramble_draw_bullet, amidar_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::amidar_draw_background, NULL, NULL); } #endif @@ -3454,7 +3448,7 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpion) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); - common_init(machine(), scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info); /* hook up AY8910 */ machine().device("audiocpu")->memory().space(AS_IO).install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this)); @@ -3490,41 +3484,41 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpion) DRIVER_INIT_MEMBER(galaxian_state,anteater) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL); /* decode graphics */ - decode_anteater_gfx(machine()); + decode_anteater_gfx(); } DRIVER_INIT_MEMBER(galaxian_state,anteateruk) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL); } DRIVER_INIT_MEMBER(galaxian_state,superbon) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); /* decode code */ - decode_superbon(machine()); + decode_superbon(); } DRIVER_INIT_MEMBER(galaxian_state,calipso) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, calipso_extend_sprite_info); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, &galaxian_state::calipso_extend_sprite_info); } DRIVER_INIT_MEMBER(galaxian_state,moonwar) { /* video extensions */ - common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); + common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL); state_save_register_global(machine(), m_moonwar_port_select); } @@ -3543,11 +3537,11 @@ DRIVER_INIT_MEMBER( galaxian_state, ghostmun ) DRIVER_INIT_MEMBER( galaxian_state, froggrs ) { /* video extensions */ - common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); + common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info); /* decrypt */ - decode_frogger_sound(machine()); - decode_frogger_gfx(machine()); + decode_frogger_sound(); + decode_frogger_gfx(); } diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c index 52716029dcc..c85738f8089 100644 --- a/src/mame/drivers/galpani2.c +++ b/src/mame/drivers/galpani2.c @@ -118,10 +118,10 @@ WRITE8_MEMBER(galpani2_state::galpani2_mcu_init_w) machine().device("sub")->execute().set_input_line(INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised } -static void galpani2_mcu_nmi1(running_machine &machine) +void galpani2_state::galpani2_mcu_nmi1() { - address_space &srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM); - address_space &dstspace = machine.device("sub")->memory().space(AS_PROGRAM); + address_space &srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &dstspace = machine().device("sub")->memory().space(AS_PROGRAM); UINT32 mcu_list, mcu_command, mcu_address, mcu_extra, mcu_src, mcu_dst, mcu_size; for ( mcu_list = 0x100021; mcu_list < (0x100021 + 0x40); mcu_list += 4 ) @@ -137,7 +137,7 @@ static void galpani2_mcu_nmi1(running_machine &machine) if (mcu_command != 0) { logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n", - machine.describe_context(), + machine().describe_context(), mcu_list, srcspace.read_byte(0x100020), mcu_command, @@ -160,7 +160,7 @@ static void galpani2_mcu_nmi1(running_machine &machine) mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) + (srcspace.read_byte(mcu_address + 9)<<0) ; - logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); + logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine().describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); for( ; mcu_size > 0 ; mcu_size-- ) { @@ -185,7 +185,7 @@ static void galpani2_mcu_nmi1(running_machine &machine) mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) + (srcspace.read_byte(mcu_address + 9)<<0) ; - logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); + logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine().describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); for( ; mcu_size > 0 ; mcu_size-- ) { @@ -213,7 +213,7 @@ static void galpani2_mcu_nmi1(running_machine &machine) srcspace.write_byte(mcu_address+0,0xff); srcspace.write_byte(mcu_address+1,0xff); - logerror("%s : MCU ERROR, unknown command $%02X\n",machine.describe_context(),mcu_command); + logerror("%s : MCU ERROR, unknown command $%02X\n",machine().describe_context(),mcu_command); } /* Erase command (so that it won't be processed again)? */ @@ -221,10 +221,10 @@ static void galpani2_mcu_nmi1(running_machine &machine) } } -static void galpani2_mcu_nmi2(running_machine &machine) +void galpani2_state::galpani2_mcu_nmi2() { - galpani2_write_kaneko(machine.device("maincpu")); - //logerror("%s : MCU executes CHECKs synchro\n", machine.describe_context()); + galpani2_write_kaneko(machine().device("maincpu")); + //logerror("%s : MCU executes CHECKs synchro\n", machine().describe_context()); } WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR @@ -233,7 +233,7 @@ WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR //Triggered from 'maincpu' (00007D60),once, with no command, using alternate line, during init //Triggered from 'maincpu' (000080BE),once, for unknown command, during init //Triggered from 'maincpu' (0000741E),from here on...driven by int5, even if there's no command - if ( (data & 1) && !(m_old_mcu_nmi1 & 1) ) galpani2_mcu_nmi1(machine()); + if ( (data & 1) && !(m_old_mcu_nmi1 & 1) ) galpani2_mcu_nmi1(); //if ( (data & 0x10) && !(m_old_mcu_nmi1 & 0x10) ) galpani2_mcu_nmi1(machine()); //alternate line, same function? m_old_mcu_nmi1 = data; @@ -241,7 +241,7 @@ WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi2_w)//driven by CPU2's int5 ISR { - if ( (data & 1) && !(m_old_mcu_nmi2 & 1) ) galpani2_mcu_nmi2(machine()); + if ( (data & 1) && !(m_old_mcu_nmi2 & 1) ) galpani2_mcu_nmi2(); m_old_mcu_nmi2 = data; } diff --git a/src/mame/drivers/gijoe.c b/src/mame/drivers/gijoe.c index e06f13b7290..77e468551c8 100644 --- a/src/mame/drivers/gijoe.c +++ b/src/mame/drivers/gijoe.c @@ -82,14 +82,13 @@ WRITE16_MEMBER(gijoe_state::control2_w) } } -static void gijoe_objdma( running_machine &machine ) +void gijoe_state::gijoe_objdma( ) { - gijoe_state *state = machine.driver_data<gijoe_state>(); UINT16 *src_head, *src_tail, *dst_head, *dst_tail; - src_head = state->m_spriteram; - src_tail = state->m_spriteram + 255 * 8; - k053247_get_ram(state->m_k053246, &dst_head); + src_head = m_spriteram; + src_tail = m_spriteram + 255 * 8; + k053247_get_ram(m_k053246, &dst_head); dst_tail = dst_head + 255 * 8; for (; src_head <= src_tail; src_head += 8) @@ -121,7 +120,7 @@ INTERRUPT_GEN_MEMBER(gijoe_state::gijoe_interrupt) if (k053246_is_irq_enabled(m_k053246)) { - gijoe_objdma(machine()); + gijoe_objdma(); // 42.7us(clr) + 341.3us(xfer) delay at 6Mhz dotclock m_dmadelay_timer->adjust(JOE_DMADELAY); diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c index 45f7578eb19..8e096cc78b4 100644 --- a/src/mame/drivers/gladiatr.c +++ b/src/mame/drivers/gladiatr.c @@ -982,7 +982,7 @@ ROM_START( gcastle ) ROM_END -static void swap_block(UINT8 *src1,UINT8 *src2,int len) +void gladiatr_state::swap_block(UINT8 *src1,UINT8 *src2,int len) { int i,t; diff --git a/src/mame/drivers/glass.c b/src/mame/drivers/glass.c index 65c07c97db8..d0f1850b195 100644 --- a/src/mame/drivers/glass.c +++ b/src/mame/drivers/glass.c @@ -284,15 +284,15 @@ ROM_END ***************************************************************************/ -static void glass_ROM16_split_gfx( running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 ) +void glass_state::glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 ) { int i; /* get a pointer to the source data */ - UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base(); + UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base(); /* get a pointer to the destination data */ - UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base(); + UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base(); /* fill destination areas with the proper data */ for (i = 0; i < length / 2; i++) @@ -404,10 +404,10 @@ DRIVER_INIT_MEMBER(glass_state,glass) */ /* split ROM H13 */ - glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000); + glass_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000); /* split ROM H11 */ - glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000); + glass_ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000); /* install custom handler over RAM for protection */ machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this)); diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index d0f954e8600..d2e15295054 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -10906,7 +10906,7 @@ DRIVER_INIT_MEMBER(goldstar_state,goldstar) // this block swapping is the same for chry10, chrygld and cb3 // the underlying bitswaps / xors are different however -static void do_blockswaps(running_machine &machine, UINT8* ROM) +void goldstar_state::do_blockswaps(UINT8* ROM) { int A; UINT8 *buffer; @@ -10925,7 +10925,7 @@ static void do_blockswaps(running_machine &machine, UINT8* ROM) 0xa000, 0xa800, 0xb000, 0xb800, }; - buffer = auto_alloc_array(machine, UINT8, 0x10000); + buffer = auto_alloc_array(machine(), UINT8, 0x10000); memcpy(buffer,ROM,0x10000); // swap some 0x800 blocks around.. @@ -10934,16 +10934,16 @@ static void do_blockswaps(running_machine &machine, UINT8* ROM) memcpy(ROM+A*0x800,buffer+cherry_swaptables[A],0x800); } - auto_free(machine, buffer); + auto_free(machine(), buffer); } -static void dump_to_file(running_machine& machine, UINT8* ROM) +void goldstar_state::dump_to_file( UINT8* ROM) { #if 0 { FILE *fp; char filename[256]; - sprintf(filename,"decrypted_%s", machine.system().name); + sprintf(filename,"decrypted_%s", machine().system().name); fp=fopen(filename, "w+b"); if (fp) { @@ -10954,7 +10954,7 @@ static void dump_to_file(running_machine& machine, UINT8* ROM) #endif } -static UINT8 decrypt(UINT8 cipherText, UINT16 address) +UINT8 goldstar_state::decrypt(UINT8 cipherText, UINT16 address) { int idx; UINT8 output; @@ -10971,7 +10971,7 @@ static UINT8 decrypt(UINT8 cipherText, UINT16 address) return output ^ sbox[idx]; } -static UINT8 chry10_decrypt(UINT8 cipherText) +UINT8 goldstar_state::chry10_decrypt(UINT8 cipherText) { return cipherText ^ (BIT(cipherText, 4) << 3) ^ (BIT(cipherText, 1) << 5) ^ (BIT(cipherText, 6) << 7); } @@ -10989,7 +10989,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chry10) ROM[i] = chry10_decrypt(ROM[i]); } - do_blockswaps(machine(), ROM); + do_blockswaps(ROM); /* The game has a PIC for protection. If the code enter to this sub, just @@ -10997,7 +10997,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chry10) */ ROM[0xA5DC] = 0xc9; - dump_to_file(machine(), ROM); + dump_to_file(ROM); } DRIVER_INIT_MEMBER(goldstar_state,cb3) @@ -11013,8 +11013,8 @@ DRIVER_INIT_MEMBER(goldstar_state,cb3) ROM[i] = decrypt(ROM[i], i); } - do_blockswaps(machine(), ROM); - dump_to_file(machine(), ROM); + do_blockswaps(ROM); + dump_to_file(ROM); } @@ -11022,7 +11022,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chrygld) { int A; UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); - do_blockswaps(machine(), ROM); + do_blockswaps(ROM); // a data bitswap for (A = 0;A < 0x10000;A++) @@ -11032,7 +11032,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chrygld) ROM[A] = dat; } - dump_to_file(machine(), ROM); + dump_to_file(ROM); } DRIVER_INIT_MEMBER(goldstar_state,cm) diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c index 29847b232ee..0e494ef1929 100644 --- a/src/mame/drivers/gottlieb.c +++ b/src/mame/drivers/gottlieb.c @@ -483,63 +483,63 @@ TIMER_CALLBACK_MEMBER(gottlieb_state::laserdisc_bit_callback) * *************************************/ -INLINE void audio_end_state(gottlieb_state *state) +inline void gottlieb_state::audio_end_state() { /* this occurs either when the "break in transmission" condition is hit (no zero crossings for 400usec) or when the entire audio buffer is full */ - state->m_laserdisc_status |= 0x08; - state->m_laserdisc_audio_bit_count = 0; - state->m_laserdisc_audio_address = 0; - if (state->m_laserdisc_audio_address != 0) - printf("Got %d bytes\n", state->m_laserdisc_audio_address); + m_laserdisc_status |= 0x08; + m_laserdisc_audio_bit_count = 0; + m_laserdisc_audio_address = 0; + if (m_laserdisc_audio_address != 0) + printf("Got %d bytes\n", m_laserdisc_audio_address); } -static void audio_process_clock(gottlieb_state *state, int logit) +void gottlieb_state::audio_process_clock(int logit) { /* clock the bit through the shift register */ - state->m_laserdisc_audio_bits >>= 1; - if (state->m_laserdisc_zero_seen) - state->m_laserdisc_audio_bits |= 0x80; - state->m_laserdisc_zero_seen = 0; + m_laserdisc_audio_bits >>= 1; + if (m_laserdisc_zero_seen) + m_laserdisc_audio_bits |= 0x80; + m_laserdisc_zero_seen = 0; /* if the buffer ready flag is set, then we are looking for the magic $67 pattern */ - if (state->m_laserdisc_status & 0x08) + if (m_laserdisc_status & 0x08) { - if (state->m_laserdisc_audio_bits == 0x67) + if (m_laserdisc_audio_bits == 0x67) { if (logit) logerror(" -- got 0x67"); - state->m_laserdisc_status &= ~0x08; - state->m_laserdisc_audio_address = 0; + m_laserdisc_status &= ~0x08; + m_laserdisc_audio_address = 0; } } /* otherwise, we keep clocking bytes into the audio buffer */ else { - state->m_laserdisc_audio_bit_count++; + m_laserdisc_audio_bit_count++; /* if we collect 8 bits, add to the buffer */ - if (state->m_laserdisc_audio_bit_count == 8) + if (m_laserdisc_audio_bit_count == 8) { if (logit) - logerror(" -- got new byte %02X", state->m_laserdisc_audio_bits); - state->m_laserdisc_audio_bit_count = 0; - state->m_laserdisc_audio_buffer[state->m_laserdisc_audio_address++] = state->m_laserdisc_audio_bits; + logerror(" -- got new byte %02X", m_laserdisc_audio_bits); + m_laserdisc_audio_bit_count = 0; + m_laserdisc_audio_buffer[m_laserdisc_audio_address++] = m_laserdisc_audio_bits; /* if we collect a full buffer, signal */ - if (state->m_laserdisc_audio_address >= AUDIORAM_SIZE) - audio_end_state(state); + if (m_laserdisc_audio_address >= AUDIORAM_SIZE) + audio_end_state(); } } } -static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, int logit) +void gottlieb_state::audio_handle_zero_crossing(attotime zerotime, int logit) { /* compute time from last clock */ - attotime deltaclock = zerotime - state->m_laserdisc_last_clock; + attotime deltaclock = zerotime - m_laserdisc_last_clock; if (logit) logerror(" -- zero @ %s (delta=%s)", zerotime.as_string(6), deltaclock.as_string(6)); @@ -548,7 +548,7 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, { if (logit) logerror(" -- count as bit"); - state->m_laserdisc_zero_seen++; + m_laserdisc_zero_seen++; return; } @@ -556,8 +556,8 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, else if (deltaclock < attotime::from_usec(215)) { if (logit) - logerror(" -- clock, bit=%d", state->m_laserdisc_zero_seen); - state->m_laserdisc_last_clock = zerotime; + logerror(" -- clock, bit=%d", m_laserdisc_zero_seen); + m_laserdisc_last_clock = zerotime; } /* if we are outside of 215usec, we are technically a missing clock @@ -567,7 +567,7 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, { if (logit) logerror(" -- skewed clock, correcting"); - state->m_laserdisc_last_clock += attotime::from_usec(200); + m_laserdisc_last_clock += attotime::from_usec(200); } /* we'll count anything more than 275us as an actual missing clock */ @@ -575,11 +575,11 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, { if (logit) logerror(" -- missing clock"); - state->m_laserdisc_last_clock = zerotime; + m_laserdisc_last_clock = zerotime; } /* we have a clock, process it */ - audio_process_clock(state, logit); + audio_process_clock(logit); } @@ -612,7 +612,7 @@ static void laserdisc_audio_process(device_t *dummy, laserdisc_device &device, i /* if we are past the "break in transmission" time, reset everything */ if ((curtime - state->m_laserdisc_last_clock) > attotime::from_usec(400)) - audio_end_state(state); + state->audio_end_state(); /* if this sample reinforces that the previous one ended a zero crossing, count it */ if ((sample >= 256 && state->m_laserdisc_last_samples[1] >= 0 && state->m_laserdisc_last_samples[0] < 0) || @@ -628,7 +628,7 @@ static void laserdisc_audio_process(device_t *dummy, laserdisc_device &device, i zerotime = curtime + time_per_sample * fractime / 1000; /* determine if this is a clock; if it is, process */ - audio_handle_zero_crossing(state, zerotime, logit); + state->audio_handle_zero_crossing(zerotime, logit); } if (logit) logerror(" \n"); diff --git a/src/mame/drivers/gridlee.c b/src/mame/drivers/gridlee.c index 149d3c8ca27..ee9f072edf9 100644 --- a/src/mame/drivers/gridlee.c +++ b/src/mame/drivers/gridlee.c @@ -87,10 +87,6 @@ /* constants */ #define FIRQ_SCANLINE 92 - -/* local prototypes */ -static void poly17_init(running_machine &machine); - /************************************* * * Interrupt handling @@ -142,7 +138,7 @@ void gridlee_state::machine_start() m_maincpu = machine().device<cpu_device>("maincpu"); /* create the polynomial tables */ - poly17_init(machine()); + poly17_init(); state_save_register_global_array(machine(), m_last_analog_input); state_save_register_global_array(machine(), m_last_analog_output); @@ -221,15 +217,14 @@ READ8_MEMBER(gridlee_state::analog_port_r) #define POLY17_SHR 10 #define POLY17_ADD 0x18000 -static void poly17_init(running_machine &machine) +void gridlee_state::poly17_init() { - gridlee_state *state = machine.driver_data<gridlee_state>(); UINT32 i, x = 0; UINT8 *p, *r; /* allocate memory */ - p = state->m_poly17 = auto_alloc_array(machine, UINT8, 2 * (POLY17_SIZE + 1)); - r = state->m_rand17 = state->m_poly17 + POLY17_SIZE + 1; + p = m_poly17 = auto_alloc_array(machine(), UINT8, 2 * (POLY17_SIZE + 1)); + r = m_rand17 = m_poly17 + POLY17_SIZE + 1; /* generate the polynomial */ for (i = 0; i < POLY17_SIZE; i++) diff --git a/src/mame/drivers/gstriker.c b/src/mame/drivers/gstriker.c index 01cfd79a59d..0b62125e9bc 100644 --- a/src/mame/drivers/gstriker.c +++ b/src/mame/drivers/gstriker.c @@ -1018,36 +1018,35 @@ WRITE16_MEMBER(gstriker_state::vbl_toggle_w) } } -static void mcu_init( running_machine &machine ) +void gstriker_state::mcu_init( ) { - gstriker_state *state = machine.driver_data<gstriker_state>(); - state->m_dmmy_8f_ret = 0xFFFF; - state->m_pending_command = 0; - state->m_mcu_data = 0; + m_dmmy_8f_ret = 0xFFFF; + m_pending_command = 0; + m_mcu_data = 0; - machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),state)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),this)); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),state)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),this)); } DRIVER_INIT_MEMBER(gstriker_state,twrldc94) { m_gametype = 1; - mcu_init( machine() ); + mcu_init(); } DRIVER_INIT_MEMBER(gstriker_state,twrldc94a) { m_gametype = 2; - mcu_init( machine() ); + mcu_init(); } DRIVER_INIT_MEMBER(gstriker_state,vgoalsoc) { m_gametype = 3; - mcu_init( machine() ); + mcu_init(); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this)); diff --git a/src/mame/drivers/gsword.c b/src/mame/drivers/gsword.c index bfcccea8c97..f45e00d7091 100644 --- a/src/mame/drivers/gsword.c +++ b/src/mame/drivers/gsword.c @@ -150,10 +150,10 @@ reg: 0->1 (main->2nd) / : (1->0) 2nd->main : #if 0 -static int gsword_coins_in(void) +int ::gsword_coins_in(void) { /* emulate 8741 coin slot */ - if (machine.root_device().ioport("IN4")->read() & 0xc0) + if (machine().root_device().ioport("IN4")->read() & 0xc0) { logerror("Coin In\n"); return 0x80; diff --git a/src/mame/includes/gaelco.h b/src/mame/includes/gaelco.h index ba57d4a3e90..1af44aafdc7 100644 --- a/src/mame/includes/gaelco.h +++ b/src/mame/includes/gaelco.h @@ -41,4 +41,5 @@ public: DECLARE_VIDEO_START(maniacsq); UINT32 screen_update_bigkarnk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_maniacsq(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/gaelco2.h b/src/mame/includes/gaelco2.h index b50c10b4d1c..bee52dce8a8 100644 --- a/src/mame/includes/gaelco2.h +++ b/src/mame/includes/gaelco2.h @@ -56,4 +56,7 @@ public: DECLARE_WRITE16_MEMBER(gaelco2_eeprom_cs_w); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_sk_w); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_data_w); + void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs); + UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index); + void gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2); }; diff --git a/src/mame/includes/gaelco3d.h b/src/mame/includes/gaelco3d.h index 261a9c71a8d..343069cac44 100644 --- a/src/mame/includes/gaelco3d.h +++ b/src/mame/includes/gaelco3d.h @@ -119,8 +119,5 @@ public: INTERRUPT_GEN_MEMBER(vblank_gen); TIMER_CALLBACK_MEMBER(delayed_sound_w); TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq); + void gaelco3d_render(screen_device &screen); }; - -/*----------- defined in video/gaelco3d.c -----------*/ - -void gaelco3d_render(screen_device &screen); diff --git a/src/mame/includes/gaiden.h b/src/mame/includes/gaiden.h index 54b36909b7c..3820363d10b 100644 --- a/src/mame/includes/gaiden.h +++ b/src/mame/includes/gaiden.h @@ -88,4 +88,9 @@ public: UINT32 screen_update_gaiden(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_drgnbowl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_raiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void drgnbowl_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void descramble_drgnbowl_gfx(); + void descramble_mastninj_gfx(UINT8* src); + void blendbitmaps(bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3, + int sx,int sy,const rectangle &cliprect); }; diff --git a/src/mame/includes/galaga.h b/src/mame/includes/galaga.h index b14bbcddbab..9111da1b548 100644 --- a/src/mame/includes/galaga.h +++ b/src/mame/includes/galaga.h @@ -61,6 +61,9 @@ public: INTERRUPT_GEN_MEMBER(main_vblank_irq); INTERRUPT_GEN_MEMBER(sub_vblank_irq); TIMER_CALLBACK_MEMBER(cpu3_interrupt_callback); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect ); + void bosco_latch_reset(); }; class xevious_state : public galaga_state @@ -98,6 +101,7 @@ public: UINT32 screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(battles_interrupt_4); TIMER_DEVICE_CALLBACK_MEMBER(battles_nmi_generate); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); }; @@ -129,6 +133,11 @@ public: DECLARE_PALETTE_INIT(bosco); UINT32 screen_update_bosco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_bosco(screen_device &screen, bool state); + + inline void get_tile_info_bosco(tile_data &tileinfo,int tile_index,int ram_offs); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip); }; class digdug_state : public galaga_state @@ -155,6 +164,7 @@ public: DECLARE_VIDEO_START(digdug); DECLARE_PALETTE_INIT(digdug); UINT32 screen_update_digdug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); }; /*----------- defined in video/bosco.c -----------*/ diff --git a/src/mame/includes/galastrm.h b/src/mame/includes/galastrm.h index a62e2d4ca8c..0629515045b 100644 --- a/src/mame/includes/galastrm.h +++ b/src/mame/includes/galastrm.h @@ -51,4 +51,7 @@ public: INTERRUPT_GEN_MEMBER(galastrm_interrupt); TIMER_CALLBACK_MEMBER(galastrm_interrupt6); void galastrm_exit(); + void draw_sprites_pre(int x_offs, int y_offs); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority); + void tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip); }; diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index acea0f40e23..f45881c5e8d 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -27,12 +27,6 @@ #define GALAXIAN_VBEND (16) #define GALAXIAN_VBSTART (224+16) -/* video extension callbacks */ -typedef void (*galaxian_extend_tile_info_func)(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -typedef void (*galaxian_extend_sprite_info_func)(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); -typedef void (*galaxian_draw_bullet_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); -typedef void (*galaxian_draw_background_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); - class galaxian_state : public driver_device { @@ -70,10 +64,18 @@ public: int m_tenspot_current_game; UINT8 m_frogger_adjust; UINT8 m_sfx_tilemap; + + /* video extension callbacks */ + typedef void (galaxian_state::*galaxian_extend_tile_info_func)(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + typedef void (galaxian_state::*galaxian_extend_sprite_info_func)(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + typedef void (galaxian_state::*galaxian_draw_bullet_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); + typedef void (galaxian_state::*galaxian_draw_background_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect); + galaxian_extend_tile_info_func m_extend_tile_info_ptr; galaxian_extend_sprite_info_func m_extend_sprite_info_ptr; galaxian_draw_bullet_func m_draw_bullet_ptr; galaxian_draw_background_func m_draw_background_ptr; + tilemap_t *m_bg_tilemap; UINT8 m_flipscreen_x; UINT8 m_flipscreen_y; @@ -230,60 +232,56 @@ public: INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen); TIMER_DEVICE_CALLBACK_MEMBER(checkmaj_irq0_gen); TIMER_DEVICE_CALLBACK_MEMBER(galaxian_stars_blink_timer); + void state_save_register(); + void sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase); + void bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base); + void stars_init(); + void stars_update_origin(); + void stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask); + void galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped); + void scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx); + void scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); + int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect); + void amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect); + inline void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color); + void galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); + void jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); + void monsterz_set_latch(); + void decode_mooncrst(int length, UINT8 *dest); + void decode_checkman(); + void decode_dingoe(); + void decode_frogger_sound(); + void decode_frogger_gfx(); + void decode_anteater_gfx(); + void decode_losttomb_gfx(); + void decode_superbon(); + void unmap_galaxian_sound(offs_t base); + void mshuttle_decode(const UINT8 convtable[8][16]); + void common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background, + galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info); }; - - -/*----------- defined in video/galaxian.c -----------*/ - -/* special purpose background rendering */ -void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); -void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); -//void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); -void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); -void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); -void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); -void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -/* special purpose bullet rendering */ -void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); -void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); -void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); -void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y); - -/* generic extensions */ -void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Frogger extensions */ -void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Ghostmuncher Galaxian extensions */ -void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Pisces extensions */ -void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Batman Part 2 extensions */ -void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); - -/* Moon Cresta extensions */ -void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Moon Quasar extensions */ -void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Moon Shuttle extensions */ -void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Calipso extensions */ -void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); - -/* Jumpbug extensions */ -void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x); -void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color); diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h index 90345a9453e..08a23e46dcb 100644 --- a/src/mame/includes/galaxold.h +++ b/src/mame/includes/galaxold.h @@ -54,20 +54,20 @@ public: UINT8 m_color_mask; tilemap_t *m_dambustr_tilemap2; UINT8 *m_dambustr_videoram2; - void (*m_modify_charcode)(running_machine &machine, UINT16 *code, UINT8 x); /* function to call to do character banking */ - void (*m_modify_spritecode)(running_machine &machine, UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */ - void (*m_modify_color)(UINT8 *color); /* function to call to do modify how the color codes map to the PROM */ - void (*m_modify_ypos)(UINT8*); /* function to call to do modify how vertical positioning bits are connected */ + void (galaxold_state::*m_modify_charcode)(UINT16 *code, UINT8 x); /* function to call to do character banking */ + void (galaxold_state::*m_modify_spritecode)(UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */ + void (galaxold_state::*m_modify_color)(UINT8 *color); /* function to call to do modify how the color codes map to the PROM */ + void (galaxold_state::*m_modify_ypos)(UINT8*); /* function to call to do modify how vertical positioning bits are connected */ UINT8 m_timer_adjusted; UINT8 m_darkplnt_bullet_color; - void (*m_draw_bullets)(running_machine &,bitmap_ind16 &,const rectangle &, int, int, int); /* function to call to draw a bullet */ + void (galaxold_state::*m_draw_bullets)(bitmap_ind16 &,const rectangle &, int, int, int); /* function to call to draw a bullet */ UINT8 m_background_enable; UINT8 m_background_red; UINT8 m_background_green; UINT8 m_background_blue; - void (*m_draw_background)(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); /* function to call to draw the background */ + void (galaxold_state::*m_draw_background)(bitmap_ind16 &bitmap, const rectangle &cliprect); /* function to call to draw the background */ UINT16 m_rockclim_v; UINT16 m_rockclim_h; int m_dambustr_bg_split_line; @@ -77,7 +77,7 @@ public: int m_dambustr_char_bank; bitmap_ind16 *m_dambustr_tmpbitmap; - void (*m_draw_stars)(running_machine &machine, bitmap_ind16 &, const rectangle &); /* function to call to draw the star layer */ + void (galaxold_state::*m_draw_stars)(bitmap_ind16 &, const rectangle &); /* function to call to draw the star layer */ int m_stars_colors_start; INT32 m_stars_scrollpos; UINT8 m_stars_on; @@ -188,12 +188,57 @@ public: DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_1_callback); DECLARE_VIDEO_START(bagmanmc); IRQ_CALLBACK_MEMBER(hunchbkg_irq_callback); + void state_save_register(); + void video_start_common(); + void pisces_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void mooncrst_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void batman2_modify_charcode(UINT16 *code, UINT8 x); + void rockclim_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void rockclim_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void harem_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void mooncrst_modify_charcode(UINT16 *code, UINT8 x); + void pisces_modify_charcode(UINT16 *code, UINT8 x); + void mimonkey_modify_charcode(UINT16 *code, UINT8 x); + void mariner_modify_charcode(UINT16 *code, UINT8 x); + void dambustr_modify_charcode(UINT16 *code, UINT8 x); + void mshuttle_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void mimonkey_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void batman2_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void dkongjrm_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void ad2083_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void dambustr_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void drivfrcg_modify_color(UINT8 *color); + void galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); + void galaxold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void scrambold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void ad2083_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void stratgyx_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void minefld_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void rescue_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void mariner_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void dambustr_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void dambustr_draw_upper_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void galaxold_init_stars(int colors_offset); + void plot_star(bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect); + void noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); + void galaxold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); + void scrambold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); + void rescue_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); + void mariner_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect); + void start_stars_blink_timer(double ra, double rb, double c); + void start_stars_scroll_timer(); + void draw_bullets_common(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size); + void bagmanmc_modify_charcode(UINT16 *code, UINT8 x); + void bagmanmc_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); + void machine_reset_common(int line); + UINT8 decode_mooncrst(UINT8 data,offs_t addr); }; -/*----------- defined in video/galaxold.c -----------*/ -void galaxold_init_stars(running_machine &machine, int colors_offset); -void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); - #define galaxold_coin_counter_0_w galaxold_coin_counter_w #endif diff --git a/src/mame/includes/galivan.h b/src/mame/includes/galivan.h index e2fa2eacc09..e0d9429e36d 100644 --- a/src/mame/includes/galivan.h +++ b/src/mame/includes/galivan.h @@ -58,6 +58,7 @@ public: DECLARE_VIDEO_START(ninjemak); UINT32 screen_update_galivan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ninjemak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; /*----------- defined in video/galivan.c -----------*/ diff --git a/src/mame/includes/galpani2.h b/src/mame/includes/galpani2.h index 4457f58621f..e4ec9cbaadb 100644 --- a/src/mame/includes/galpani2.h +++ b/src/mame/includes/galpani2.h @@ -53,6 +53,8 @@ public: UINT32 screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt1); TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt2); + void galpani2_mcu_nmi1(); + void galpani2_mcu_nmi2(); }; diff --git a/src/mame/includes/galpanic.h b/src/mame/includes/galpanic.h index 3e790d958c3..ccffa1bd99a 100644 --- a/src/mame/includes/galpanic.h +++ b/src/mame/includes/galpanic.h @@ -29,6 +29,8 @@ public: void screen_eof_galpanic(screen_device &screen, bool state); TIMER_DEVICE_CALLBACK_MEMBER(galpanic_scanline); TIMER_DEVICE_CALLBACK_MEMBER(galhustl_scanline); + void comad_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); }; /*----------- defined in video/galpanic.c -----------*/ diff --git a/src/mame/includes/galspnbl.h b/src/mame/includes/galspnbl.h index a47ed961528..a5a6d0efff2 100644 --- a/src/mame/includes/galspnbl.h +++ b/src/mame/includes/galspnbl.h @@ -32,4 +32,5 @@ public: virtual void machine_start(); virtual void palette_init(); UINT32 screen_update_galspnbl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/gameplan.h b/src/mame/includes/gameplan.h index 0d4f31536e8..5cbe1a390ec 100644 --- a/src/mame/includes/gameplan.h +++ b/src/mame/includes/gameplan.h @@ -79,6 +79,8 @@ public: DECLARE_WRITE8_MEMBER(leprechn_video_command_w); DECLARE_WRITE_LINE_MEMBER(video_command_trigger_w); DECLARE_READ8_MEMBER(vblank_r); + void gameplan_get_pens( pen_t *pens ); + void leprechn_get_pens( pen_t *pens ); }; /*----------- defined in video/gameplan.c -----------*/ diff --git a/src/mame/includes/gaplus.h b/src/mame/includes/gaplus.h index 3c4705fe055..5c70100ca3b 100644 --- a/src/mame/includes/gaplus.h +++ b/src/mame/includes/gaplus.h @@ -51,4 +51,7 @@ public: INTERRUPT_GEN_MEMBER(gaplus_vblank_sub_irq); INTERRUPT_GEN_MEMBER(gaplus_vblank_sub2_irq); TIMER_CALLBACK_MEMBER(namcoio_run); + void starfield_init(); + void starfield_render(bitmap_ind16 &bitmap); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/gberet.h b/src/mame/includes/gberet.h index c0e762b39ae..91c404b6925 100644 --- a/src/mame/includes/gberet.h +++ b/src/mame/includes/gberet.h @@ -58,4 +58,6 @@ public: UINT32 screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(gberet_interrupt_tick); + void gberet_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void gberetb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/gcpinbal.h b/src/mame/includes/gcpinbal.h index 11c762353a2..e15cc1f9720 100644 --- a/src/mame/includes/gcpinbal.h +++ b/src/mame/includes/gcpinbal.h @@ -62,4 +62,6 @@ public: INTERRUPT_GEN_MEMBER(gcpinbal_interrupt); TIMER_CALLBACK_MEMBER(gcpinbal_interrupt1); TIMER_CALLBACK_MEMBER(gcpinbal_interrupt3); + void gcpinbal_core_vh_start( ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ); }; diff --git a/src/mame/includes/gijoe.h b/src/mame/includes/gijoe.h index 0223027f5f1..c2259727629 100644 --- a/src/mame/includes/gijoe.h +++ b/src/mame/includes/gijoe.h @@ -47,6 +47,7 @@ public: UINT32 screen_update_gijoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(gijoe_interrupt); TIMER_CALLBACK_MEMBER(dmaend_callback); + void gijoe_objdma( ); }; /*----------- defined in video/gijoe.c -----------*/ diff --git a/src/mame/includes/ginganin.h b/src/mame/includes/ginganin.h index 2dec583883c..cd54a1fa0f3 100644 --- a/src/mame/includes/ginganin.h +++ b/src/mame/includes/ginganin.h @@ -46,4 +46,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_ginganin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ); }; diff --git a/src/mame/includes/gladiatr.h b/src/mame/includes/gladiatr.h index f9791954b30..e342856a2d8 100644 --- a/src/mame/includes/gladiatr.h +++ b/src/mame/includes/gladiatr.h @@ -66,4 +66,6 @@ public: DECLARE_VIDEO_START(gladiatr); UINT32 screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void swap_block(UINT8 *src1,UINT8 *src2,int len); }; diff --git a/src/mame/includes/glass.h b/src/mame/includes/glass.h index 7a35d3a406f..6620735128d 100644 --- a/src/mame/includes/glass.h +++ b/src/mame/includes/glass.h @@ -48,4 +48,6 @@ public: virtual void video_start(); UINT32 screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(glass_interrupt); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 ); }; diff --git a/src/mame/includes/gng.h b/src/mame/includes/gng.h index 47b6a00b201..424acfdc98e 100644 --- a/src/mame/includes/gng.h +++ b/src/mame/includes/gng.h @@ -43,4 +43,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_gng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/goal92.h b/src/mame/includes/goal92.h index 42a3ef90a13..9692f495aa7 100644 --- a/src/mame/includes/goal92.h +++ b/src/mame/includes/goal92.h @@ -53,4 +53,5 @@ public: virtual void video_start(); UINT32 screen_update_goal92(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_goal92(screen_device &screen, bool state); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); }; diff --git a/src/mame/includes/goindol.h b/src/mame/includes/goindol.h index 057115add10..c171243f977 100644 --- a/src/mame/includes/goindol.h +++ b/src/mame/includes/goindol.h @@ -48,4 +48,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_goindol(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram ); }; diff --git a/src/mame/includes/goldstar.h b/src/mame/includes/goldstar.h index 240db5510d1..22bc2a1468c 100644 --- a/src/mame/includes/goldstar.h +++ b/src/mame/includes/goldstar.h @@ -150,4 +150,8 @@ public: UINT32 screen_update_amcoe1a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_unkch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(lucky8_irq); + void do_blockswaps(UINT8* ROM); + void dump_to_file( UINT8* ROM); + UINT8 decrypt(UINT8 cipherText, UINT16 address); + UINT8 chry10_decrypt(UINT8 cipherText); }; diff --git a/src/mame/includes/gotcha.h b/src/mame/includes/gotcha.h index 9c93da0072b..69f55af2c02 100644 --- a/src/mame/includes/gotcha.h +++ b/src/mame/includes/gotcha.h @@ -47,4 +47,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_gotcha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + inline void get_tile_info( tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs); }; diff --git a/src/mame/includes/gottlieb.h b/src/mame/includes/gottlieb.h index 5859b2cced4..2a410c0674f 100644 --- a/src/mame/includes/gottlieb.h +++ b/src/mame/includes/gottlieb.h @@ -314,6 +314,10 @@ public: TIMER_CALLBACK_MEMBER(laserdisc_bit_off_callback); TIMER_CALLBACK_MEMBER(laserdisc_bit_callback); TIMER_CALLBACK_MEMBER(nmi_clear); + void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); + inline void audio_end_state(); + void audio_process_clock(int logit); + void audio_handle_zero_crossing(attotime zerotime, int logit); }; /*----------- defined in audio/gottlieb.c -----------*/ diff --git a/src/mame/includes/gotya.h b/src/mame/includes/gotya.h index 7e456bde65c..2dd33540907 100644 --- a/src/mame/includes/gotya.h +++ b/src/mame/includes/gotya.h @@ -38,4 +38,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_status_row( bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/grchamp.h b/src/mame/includes/grchamp.h index 2fb985cf265..b35630bb9d6 100644 --- a/src/mame/includes/grchamp.h +++ b/src/mame/includes/grchamp.h @@ -75,6 +75,7 @@ public: INTERRUPT_GEN_MEMBER(grchamp_cpu0_interrupt); INTERRUPT_GEN_MEMBER(grchamp_cpu1_interrupt); TIMER_CALLBACK_MEMBER(main_to_sub_comm_sync_w); + void draw_objects(int y, UINT8 *objdata); }; /* Discrete Sound Input Nodes */ diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h index f518f48c5c4..7b8a3b2da8c 100644 --- a/src/mame/includes/gridlee.h +++ b/src/mame/includes/gridlee.h @@ -61,6 +61,7 @@ public: TIMER_CALLBACK_MEMBER(firq_off_tick); TIMER_CALLBACK_MEMBER(firq_timer_tick); void expand_pixels(); + void poly17_init(); }; diff --git a/src/mame/includes/groundfx.h b/src/mame/includes/groundfx.h index 8449ac2e953..f17d9a895ab 100644 --- a/src/mame/includes/groundfx.h +++ b/src/mame/includes/groundfx.h @@ -40,4 +40,5 @@ public: UINT32 screen_update_groundfx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(groundfx_interrupt); TIMER_CALLBACK_MEMBER(groundfx_interrupt5); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs); }; diff --git a/src/mame/includes/gstriker.h b/src/mame/includes/gstriker.h index 630fa33a18f..341ec38acb4 100644 --- a/src/mame/includes/gstriker.h +++ b/src/mame/includes/gstriker.h @@ -99,6 +99,17 @@ public: DECLARE_VIDEO_START(vgoalsoc); DECLARE_VIDEO_START(twrldc94); UINT32 screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void VS920A_init(int numchips); + tilemap_t* VS920A_get_tilemap(int numchip); + void VS920A_set_pal_base(int numchip, int pal_base); + void VS920A_set_gfx_region(int numchip, int gfx_region); + void VS920A_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority); + void MB60553_init(int numchips); + void MB60553_set_pal_base(int numchip, int pal_base); + void MB60553_set_gfx_region(int numchip, int gfx_region); + void MB60553_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority); + tilemap_t* MB60553_get_tilemap(int numchip); + void mcu_init( ); }; #endif diff --git a/src/mame/includes/gsword.h b/src/mame/includes/gsword.h index 5633645b13b..40d48ff1006 100644 --- a/src/mame/includes/gsword.h +++ b/src/mame/includes/gsword.h @@ -47,4 +47,6 @@ public: DECLARE_PALETTE_INIT(josvolly); UINT32 screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(gsword_snd_interrupt); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + int gsword_coins_in(void); }; diff --git a/src/mame/includes/gunbustr.h b/src/mame/includes/gunbustr.h index d34f741fbc5..77e52b28137 100644 --- a/src/mame/includes/gunbustr.h +++ b/src/mame/includes/gunbustr.h @@ -42,4 +42,5 @@ public: UINT32 screen_update_gunbustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(gunbustr_interrupt); TIMER_CALLBACK_MEMBER(gunbustr_interrupt5); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs); }; diff --git a/src/mame/includes/gunsmoke.h b/src/mame/includes/gunsmoke.h index 74057778468..7b6971ba846 100644 --- a/src/mame/includes/gunsmoke.h +++ b/src/mame/includes/gunsmoke.h @@ -41,4 +41,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_gunsmoke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/gyruss.h b/src/mame/includes/gyruss.h index 662af9a56c4..e25e6c30d66 100644 --- a/src/mame/includes/gyruss.h +++ b/src/mame/includes/gyruss.h @@ -56,4 +56,5 @@ public: UINT32 screen_update_gyruss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(master_vblank_irq); INTERRUPT_GEN_MEMBER(slave_vblank_irq); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx ); }; diff --git a/src/mame/machine/gaelco2.c b/src/mame/machine/gaelco2.c index 703a47993ed..dd6f3522def 100644 --- a/src/mame/machine/gaelco2.c +++ b/src/mame/machine/gaelco2.c @@ -17,15 +17,15 @@ ***************************************************************************/ -static void gaelco2_ROM16_split_gfx(running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2) +void gaelco2_state::gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2) { int i; /* get a pointer to the source data */ - UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base(); + UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base(); /* get a pointer to the destination data */ - UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base(); + UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base(); /* fill destination areas with the proper data */ for (i = 0; i < length/2; i++){ @@ -62,16 +62,16 @@ DRIVER_INIT_MEMBER(gaelco2_state,alighunt) */ /* split ROM u48 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); /* split ROM u47 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000); /* split ROM u50 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); /* split ROM u49 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000); } @@ -93,13 +93,13 @@ DRIVER_INIT_MEMBER(gaelco2_state,touchgo) */ /* split ROM ic65 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); /* split ROM ic66 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0200000, 0x0200000, 0x0600000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0200000, 0x0200000, 0x0600000); /* split ROM ic67 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); } @@ -121,13 +121,13 @@ DRIVER_INIT_MEMBER(gaelco2_state,snowboar) */ /* split ROM sb44 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); /* split ROM sb45 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000); /* split ROM sb46 */ - gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); + gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); } /*************************************************************************** diff --git a/src/mame/machine/galaxold.c b/src/mame/machine/galaxold.c index e5e37a56c50..ffa479d3dff 100644 --- a/src/mame/machine/galaxold.c +++ b/src/mame/machine/galaxold.c @@ -64,12 +64,11 @@ TIMER_DEVICE_CALLBACK_MEMBER(galaxold_state::galaxold_interrupt_timer) } -static void machine_reset_common(running_machine &machine, int line) +void galaxold_state::machine_reset_common(int line) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - ttl7474_device *ttl7474_9m_1 = machine.device<ttl7474_device>("7474_9m_1"); - ttl7474_device *ttl7474_9m_2 = machine.device<ttl7474_device>("7474_9m_2"); - state->m_irq_line = line; + ttl7474_device *ttl7474_9m_1 = machine().device<ttl7474_device>("7474_9m_1"); + ttl7474_device *ttl7474_9m_2 = machine().device<ttl7474_device>("7474_9m_2"); + m_irq_line = line; /* initalize main CPU interrupt generator flip-flops */ ttl7474_9m_2->preset_w(1); @@ -80,23 +79,23 @@ static void machine_reset_common(running_machine &machine, int line) ttl7474_9m_1->preset_w(0); /* start a timer to generate interrupts */ - timer_device *int_timer = machine.device<timer_device>("int_timer"); - int_timer->adjust(machine.primary_screen->time_until_pos(0)); + timer_device *int_timer = machine().device<timer_device>("int_timer"); + int_timer->adjust(machine().primary_screen->time_until_pos(0)); } MACHINE_RESET_MEMBER(galaxold_state,galaxold) { - machine_reset_common(machine(), INPUT_LINE_NMI); + machine_reset_common(INPUT_LINE_NMI); } MACHINE_RESET_MEMBER(galaxold_state,devilfsg) { - machine_reset_common(machine(), 0); + machine_reset_common(0); } MACHINE_RESET_MEMBER(galaxold_state,hunchbkg) { - machine_reset_common(machine(), 0); + machine_reset_common(0); machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(galaxold_state::hunchbkg_irq_callback),this)); } @@ -281,7 +280,7 @@ DRIVER_INIT_MEMBER(galaxold_state,dingo) } -static UINT8 decode_mooncrst(UINT8 data,offs_t addr) +UINT8 galaxold_state::decode_mooncrst(UINT8 data,offs_t addr) { UINT8 res; diff --git a/src/mame/video/bosco.c b/src/mame/video/bosco.c index 8923a7f9dfe..0542337a4f0 100644 --- a/src/mame/video/bosco.c +++ b/src/mame/video/bosco.c @@ -92,28 +92,26 @@ TILEMAP_MAPPER_MEMBER(bosco_state::fg_tilemap_scan ) } -INLINE void get_tile_info_bosco(running_machine &machine,tile_data &tileinfo,int tile_index,int ram_offs) +inline void bosco_state::get_tile_info_bosco(tile_data &tileinfo,int tile_index,int ram_offs) { - bosco_state *state = machine.driver_data<bosco_state>(); - - UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800]; + UINT8 attr = m_videoram[ram_offs + tile_index + 0x800]; tileinfo.category = (attr & 0x20) >> 5; tileinfo.group = attr & 0x3f; - SET_TILE_INFO( + SET_TILE_INFO_MEMBER( 0, - state->m_videoram[ram_offs + tile_index], + m_videoram[ram_offs + tile_index], attr & 0x3f, TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX); } TILE_GET_INFO_MEMBER(bosco_state::bg_get_tile_info ) { - get_tile_info_bosco(machine(),tileinfo,tile_index,0x400); + get_tile_info_bosco(tileinfo,tile_index,0x400); } TILE_GET_INFO_MEMBER(bosco_state::fg_get_tile_info ) { - get_tile_info_bosco(machine(),tileinfo,tile_index,0x000); + get_tile_info_bosco(tileinfo,tile_index,0x000); } @@ -188,14 +186,13 @@ WRITE8_HANDLER( bosco_starclr_w ) ***************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bosco_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - bosco_state *state = machine.driver_data<bosco_state>(); - UINT8 *spriteram = state->m_spriteram; - UINT8 *spriteram_2 = state->m_spriteram2; + UINT8 *spriteram = m_spriteram; + UINT8 *spriteram_2 = m_spriteram2; int offs; - for (offs = 0;offs < state->m_spriteram_size;offs += 2) + for (offs = 0;offs < m_spriteram_size;offs += 2) { int sx = spriteram[offs + 1] - 1; int sy = 240 - spriteram_2[offs]; @@ -203,40 +200,39 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r int flipy = spriteram[offs] & 2; int color = spriteram_2[offs + 1] & 0x3f; - if (state->flip_screen()) + if (flip_screen()) { sx += 128-2; sy += 8; } - drawgfx_transmask(bitmap,cliprect,machine.gfx[1], + drawgfx_transmask(bitmap,cliprect,machine().gfx[1], (spriteram[offs] & 0xfc) >> 2, color, flipx,flipy, sx,sy, - colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x0f)); + colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x0f)); } } -static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bosco_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect) { - bosco_state *state = machine.driver_data<bosco_state>(); int offs; for (offs = 4; offs < 0x10;offs++) { - int x = state->m_bosco_radarx[offs] + ((~state->m_bosco_radarattr[offs] & 0x01) << 8); - int y = 253 - state->m_bosco_radary[offs]; + int x = m_bosco_radarx[offs] + ((~m_bosco_radarattr[offs] & 0x01) << 8); + int y = 253 - m_bosco_radary[offs]; - if (state->flip_screen()) + if (flip_screen()) { x += 96-2; y += 8; } - drawgfx_transmask(bitmap,cliprect,machine.gfx[2], - ((state->m_bosco_radarattr[offs] & 0x0e) >> 1) ^ 0x07, + drawgfx_transmask(bitmap,cliprect,machine().gfx[2], + ((m_bosco_radarattr[offs] & 0x0e) >> 1) ^ 0x07, 0, 0,0, x,y,0xf0); @@ -244,18 +240,16 @@ static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const r } -static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip) +void bosco_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip) { - bosco_state *state = machine.driver_data<bosco_state>(); - if (1) { int star_cntr; int set_a, set_b; /* two sets of stars controlled by these bits */ - set_a = (state->m_bosco_starblink[0] & 1); - set_b = (state->m_bosco_starblink[1] & 1) | 2; + set_a = (m_bosco_starblink[0] & 1); + set_b = (m_bosco_starblink[1] & 1) | 2; for (star_cntr = 0;star_cntr < MAX_STARS;star_cntr++) { @@ -263,8 +257,8 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) ) { - x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256; - y = (star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256; + x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256; + y = (star_seed_tab[star_cntr].y + m_stars_scrolly) % 256; /* dont draw the stars that are off the screen */ if ( x < 224 ) @@ -298,18 +292,18 @@ UINT32 bosco_state::screen_update_bosco(screen_device &screen, bitmap_ind16 &bit } bitmap.fill(get_black_pen(machine()), cliprect); - draw_stars(machine(),bitmap,cliprect,flip_screen()); + draw_stars(bitmap,cliprect,flip_screen()); m_bg_tilemap->draw(bitmap, bg_clip, 0,0); m_fg_tilemap->draw(bitmap, fg_clip, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); /* draw the high priority characters */ m_bg_tilemap->draw(bitmap, bg_clip, 1,0); m_fg_tilemap->draw(bitmap, fg_clip, 1,0); - draw_bullets(machine(), bitmap,cliprect); + draw_bullets(bitmap,cliprect); return 0; } diff --git a/src/mame/video/digdug.c b/src/mame/video/digdug.c index 88ee578537b..22b84f6904a 100644 --- a/src/mame/video/digdug.c +++ b/src/mame/video/digdug.c @@ -237,19 +237,18 @@ WRITE8_HANDLER( digdug_PORT_w ) ***************************************************************************/ -static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void digdug_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { - digdug_state *state = machine.driver_data<digdug_state>(); - UINT8 *spriteram = state->m_digdug_objram + 0x380; - UINT8 *spriteram_2 = state->m_digdug_posram + 0x380; - UINT8 *spriteram_3 = state->m_digdug_flpram + 0x380; + UINT8 *spriteram = m_digdug_objram + 0x380; + UINT8 *spriteram_2 = m_digdug_posram + 0x380; + UINT8 *spriteram_3 = m_digdug_flpram + 0x380; int offs; // mask upper and lower columns rectangle visarea = cliprect; visarea.min_x = 2*8; visarea.max_x = 34*8-1; - if (state->flip_screen()) + if (flip_screen()) { visarea.min_x += 12*8; visarea.max_x += 12*8; @@ -277,7 +276,7 @@ static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap, const r sy -= 16 * size; sy = (sy & 0xff) - 32; // fix wraparound - if (state->flip_screen()) + if (flip_screen()) { flipx ^= 1; flipy ^= 1; @@ -289,14 +288,14 @@ static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap, const r { for (x = 0;x <= size;x++) { - UINT32 transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x1f); - drawgfx_transmask(bitmap,visarea,machine.gfx[1], + UINT32 transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x1f); + drawgfx_transmask(bitmap,visarea,machine().gfx[1], sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)], color, flipx,flipy, ((sx + 16*x) & 0xff), sy + 16*y,transmask); /* wraparound */ - drawgfx_transmask(bitmap,visarea,machine.gfx[1], + drawgfx_transmask(bitmap,visarea,machine().gfx[1], sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)], color, flipx,flipy, @@ -311,6 +310,6 @@ UINT32 digdug_state::screen_update_digdug(screen_device &screen, bitmap_ind16 &b { 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/fastfred.c b/src/mame/video/fastfred.c index 8e81baa31d3..271b2f47d6f 100644 --- a/src/mame/video/fastfred.c +++ b/src/mame/video/fastfred.c @@ -352,7 +352,7 @@ VIDEO_START_MEMBER(fastfred_state,imago) m_fg_tilemap->set_transparent_pen(0); /* the game has a galaxian starfield */ - galaxold_init_stars(machine(), 256); + galaxold_init_stars(256); m_stars_on = 1; /* web colors */ @@ -363,7 +363,7 @@ VIDEO_START_MEMBER(fastfred_state,imago) UINT32 fastfred_state::screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_web_tilemap->draw(bitmap, cliprect, 0,0); - galaxold_draw_stars(machine(), bitmap, cliprect); + galaxold_draw_stars(bitmap, cliprect); m_bg_tilemap->draw(bitmap, cliprect, 0,0); draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(bitmap, cliprect, 0,0); diff --git a/src/mame/video/gaelco.c b/src/mame/video/gaelco.c index 8d995fc90e9..af3750f75d2 100644 --- a/src/mame/video/gaelco.c +++ b/src/mame/video/gaelco.c @@ -116,23 +116,22 @@ VIDEO_START_MEMBER(gaelco_state,maniacsq) 3 | xxxxxxxx xxxxxx-- | sprite code */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gaelco_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - gaelco_state *state = machine.driver_data<gaelco_state>(); int i, x, y, ex, ey; - gfx_element *gfx = machine.gfx[0]; + gfx_element *gfx = machine().gfx[0]; static const int x_offset[2] = {0x0,0x2}; static const int y_offset[2] = {0x0,0x1}; for (i = 0x800 - 4 - 1; i >= 3; i -= 4) { - int sx = state->m_spriteram[i + 2] & 0x01ff; - int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff; - int number = state->m_spriteram[i + 3]; - int color = (state->m_spriteram[i + 2] & 0x7e00) >> 9; - int attr = (state->m_spriteram[i] & 0xfe00) >> 9; - int priority = (state->m_spriteram[i] & 0x3000) >> 12; + int sx = m_spriteram[i + 2] & 0x01ff; + int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff; + int number = m_spriteram[i + 3]; + int color = (m_spriteram[i + 2] & 0x7e00) >> 9; + int attr = (m_spriteram[i] & 0xfe00) >> 9; + int priority = (m_spriteram[i] & 0x3000) >> 12; int xflip = attr & 0x20; int yflip = attr & 0x40; @@ -170,7 +169,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const pdrawgfx_transpen(bitmap,cliprect,gfx,number + x_offset[ex] + y_offset[ey], color,xflip,yflip, sx-0x0f+x*8,sy+y*8, - machine.priority_bitmap,pri_mask,0); + machine().priority_bitmap,pri_mask,0); } } } @@ -205,7 +204,7 @@ UINT32 gaelco_state::screen_update_maniacsq(screen_device &screen, bitmap_ind16 m_tilemap[1]->draw(bitmap, cliprect, 0, 4); m_tilemap[0]->draw(bitmap, cliprect, 0, 4); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } @@ -244,6 +243,6 @@ UINT32 gaelco_state::screen_update_bigkarnk(screen_device &screen, bitmap_ind16 m_tilemap[1]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8); m_tilemap[0]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/gaelco2.c b/src/mame/video/gaelco2.c index 24f6c3c08c5..7e87a8a3d3d 100644 --- a/src/mame/video/gaelco2.c +++ b/src/mame/video/gaelco2.c @@ -332,19 +332,18 @@ VIDEO_START_MEMBER(gaelco2_state,gaelco2_dual) ***************************************************************************/ -static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs) +void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs) { - gaelco2_state *state = screen.machine().driver_data<gaelco2_state>(); - UINT16 *buffered_spriteram16 = state->m_spriteram->buffer(); + UINT16 *buffered_spriteram16 = m_spriteram->buffer(); int j, x, y, ex, ey, px, py; gfx_element *gfx = screen.machine().gfx[0]; /* get sprite ram start and end offsets */ - int start_offset = (state->m_vregs[1] & 0x10)*0x100; + int start_offset = (m_vregs[1] & 0x10)*0x100; int end_offset = start_offset + 0x1000; /* sprite offset is based on the visible area */ - int spr_x_adjust = (screen.visible_area().max_x - 320 + 1) - (511 - 320 - 1) - ((state->m_vregs[0] >> 4) & 0x01) + xoffs; + int spr_x_adjust = (screen.visible_area().max_x - 320 + 1) - (511 - 320 - 1) - ((m_vregs[0] >> 4) & 0x01) + xoffs; for (j = start_offset; j < end_offset; j += 8){ int data = buffered_spriteram16[(j/2) + 0]; @@ -361,7 +360,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect int xsize = ((data3 >> 12) & 0x0f) + 1; int ysize = ((data2 >> 12) & 0x0f) + 1; - if (state->m_dual_monitor && ((data & 0x8000) != mask)) continue; + if (m_dual_monitor && ((data & 0x8000) != mask)) continue; /* if it's enabled, draw it */ if ((data2 & 0x0200) != 0){ @@ -371,7 +370,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect int data5 = buffered_spriteram16[((data4/2) + (y*xsize + x)) & 0x7fff]; int number = ((data & 0x1ff) << 10) + (data5 & 0x0fff); int color = ((data >> 9) & 0x7f) + ((data5 >> 12) & 0x0f); - int color_effect = state->m_dual_monitor ? ((color & 0x3f) == 0x3f) : (color == 0x7f); + int color_effect = m_dual_monitor ? ((color & 0x3f) == 0x3f) : (color == 0x7f); ex = xflip ? (xsize - 1 - x) : x; ey = yflip ? (ysize - 1 - y) : y; @@ -458,31 +457,30 @@ UINT32 gaelco2_state::screen_update_gaelco2(screen_device &screen, bitmap_ind16 return 0; } -static UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index) +UINT32 gaelco2_state::dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index) { - gaelco2_state *state = screen.machine().driver_data<gaelco2_state>(); int i; /* read scroll values */ - int scroll0x = state->m_videoram[0x2802/2] + 0x14; - int scroll1x = state->m_videoram[0x2806/2] + 0x10; - int scroll0y = state->m_videoram[0x2800/2] + 0x01; - int scroll1y = state->m_videoram[0x2804/2] + 0x01; + int scroll0x = m_videoram[0x2802/2] + 0x14; + int scroll1x = m_videoram[0x2806/2] + 0x10; + int scroll0y = m_videoram[0x2800/2] + 0x01; + int scroll1y = m_videoram[0x2804/2] + 0x01; /* set y scroll registers */ - state->m_pant[0]->set_scrolly(0, scroll0y & 0x1ff); - state->m_pant[1]->set_scrolly(0, scroll1y & 0x1ff); + m_pant[0]->set_scrolly(0, scroll0y & 0x1ff); + m_pant[1]->set_scrolly(0, scroll1y & 0x1ff); /* set x linescroll registers */ for (i = 0; i < 512; i++){ - state->m_pant[0]->set_scrollx(i & 0x1ff, (state->m_vregs[0] & 0x8000) ? (state->m_videoram[(0x2000/2) + i] + 0x14) & 0x3ff : scroll0x & 0x3ff); - state->m_pant[1]->set_scrollx(i & 0x1ff, (state->m_vregs[1] & 0x8000) ? (state->m_videoram[(0x2400/2) + i] + 0x10) & 0x3ff : scroll1x & 0x3ff); + m_pant[0]->set_scrollx(i & 0x1ff, (m_vregs[0] & 0x8000) ? (m_videoram[(0x2000/2) + i] + 0x14) & 0x3ff : scroll0x & 0x3ff); + m_pant[1]->set_scrollx(i & 0x1ff, (m_vregs[1] & 0x8000) ? (m_videoram[(0x2400/2) + i] + 0x10) & 0x3ff : scroll1x & 0x3ff); } /* draw screen */ bitmap.fill(0, cliprect); - state->m_pant[index]->draw(bitmap, cliprect, 0, 0); + m_pant[index]->draw(bitmap, cliprect, 0, 0); draw_sprites(screen,bitmap,cliprect, 0x8000 * index, 0); return 0; diff --git a/src/mame/video/gaelco3d.c b/src/mame/video/gaelco3d.c index 882f329741d..02753a36873 100644 --- a/src/mame/video/gaelco3d.c +++ b/src/mame/video/gaelco3d.c @@ -346,16 +346,16 @@ void gaelco3d_renderer::render_alphablend(INT32 scanline, const extent_t &extent * *************************************/ -void gaelco3d_render(screen_device &screen) +void gaelco3d_state::gaelco3d_render(screen_device &screen) { gaelco3d_state *state = screen.machine().driver_data<gaelco3d_state>(); /* wait for any queued stuff to complete */ - state->m_poly->wait("Time to render"); + m_poly->wait("Time to render"); #if DISPLAY_STATS { int scan = screen.vpos(); - popmessage("Polys = %4d Timeleft = %3d", state->m_poly->polygons(), (state->m_lastscan < scan) ? (scan - state->m_lastscan) : (scan + (state->m_lastscan - screen.visible_area().max_y))); + popmessage("Polys = %4d Timeleft = %3d", m_poly->polygons(), (m_lastscan < scan) ? (scan - m_lastscan) : (scan + (m_lastscan - screen.visible_area().max_y))); } #endif diff --git a/src/mame/video/gaiden.c b/src/mame/video/gaiden.c index 0a3997c910b..1ed6bd0e352 100644 --- a/src/mame/video/gaiden.c +++ b/src/mame/video/gaiden.c @@ -272,12 +272,11 @@ WRITE16_MEMBER(gaiden_state::gaiden_videoram_w) to blend into the final 32-bit rgb bitmaps, this is currently broken (due to zsolt's core changes?) it appears that the sprite drawing is no longer putting the correct raw data in the bitmaps? */ -static void blendbitmaps(running_machine &machine, - bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3, +void gaiden_state::blendbitmaps(bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3, int sx,int sy,const rectangle &cliprect) { int y,x; - const pen_t *paldata = machine.pens; + const pen_t *paldata = machine().pens; for (y = cliprect.min_y; y <= cliprect.max_y; y++) { @@ -330,10 +329,9 @@ static void blendbitmaps(running_machine &machine, * |---------x------- | x position (high bit) */ -static void drgnbowl_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void gaiden_state::drgnbowl_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - gaiden_state *state = machine.driver_data<gaiden_state>(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int i, code, color, x, y, flipx, flipy, priority_mask; for( i = 0; i < 0x800/2; i += 4 ) @@ -355,18 +353,18 @@ static void drgnbowl_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap else priority_mask = 0; - pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3], + pdrawgfx_transpen_raw(bitmap,cliprect,machine().gfx[3], code, - machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(), + machine().gfx[3]->colorbase() + color * machine().gfx[3]->granularity(), flipx,flipy,x,y, - machine.priority_bitmap, priority_mask,15); + machine().priority_bitmap, priority_mask,15); /* wrap x*/ - pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3], + pdrawgfx_transpen_raw(bitmap,cliprect,machine().gfx[3], code, - machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(), + machine().gfx[3]->colorbase() + color * machine().gfx[3]->granularity(), flipx,flipy,x-512,y, - machine.priority_bitmap, priority_mask,15); + machine().priority_bitmap, priority_mask,15); } } @@ -391,7 +389,7 @@ UINT32 gaiden_state::screen_update_gaiden(screen_device &screen, bitmap_rgb32 &b gaiden_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen()); /* mix & blend the tilemaps and sprites into a 32-bit bitmap */ - blendbitmaps(machine(), bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect); + blendbitmaps(bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect); return 0; } @@ -416,7 +414,7 @@ UINT32 gaiden_state::screen_update_raiga(screen_device &screen, bitmap_rgb32 &bi raiga_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen()); /* mix & blend the tilemaps and sprites into a 32-bit bitmap */ - blendbitmaps(machine(), bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect); + blendbitmaps(bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect); return 0; } @@ -427,6 +425,6 @@ UINT32 gaiden_state::screen_update_drgnbowl(screen_device &screen, bitmap_ind16 m_background->draw(bitmap, cliprect, 0, 1); m_foreground->draw(bitmap, cliprect, 0, 2); m_text_layer->draw(bitmap, cliprect, 0, 4); - drgnbowl_draw_sprites(machine(), bitmap, cliprect); + drgnbowl_draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/galaga.c b/src/mame/video/galaga.c index e93644d886e..b392e364027 100644 --- a/src/mame/video/galaga.c +++ b/src/mame/video/galaga.c @@ -470,13 +470,12 @@ WRITE8_MEMBER(galaga_state::gatsbee_bank_w) ***************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void galaga_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { - galaga_state *state = machine.driver_data<galaga_state>(); - UINT8 *spriteram = state->m_galaga_ram1 + 0x380; - UINT8 *spriteram_2 = state->m_galaga_ram2 + 0x380; - UINT8 *spriteram_3 = state->m_galaga_ram3 + 0x380; + UINT8 *spriteram = m_galaga_ram1 + 0x380; + UINT8 *spriteram_2 = m_galaga_ram2 + 0x380; + UINT8 *spriteram_3 = m_galaga_ram3 + 0x380; int offs; @@ -500,7 +499,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r sy -= 16 * sizey; sy = (sy & 0xff) - 32; // fix wraparound - if (state->flip_screen()) + if (flip_screen()) { flipx ^= 1; flipy ^= 1; @@ -512,35 +511,34 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r { for (x = 0;x <= sizex;x++) { - drawgfx_transmask(bitmap,cliprect,machine.gfx[1], + drawgfx_transmask(bitmap,cliprect,machine().gfx[1], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, sx + 16*x, sy + 16*y, - colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x0f)); + colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x0f)); } } } } -static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void galaga_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect ) { - galaga_state *state = machine.driver_data<galaga_state>(); /* draw the stars */ /* $a005 controls the stars ON/OFF */ - if ( (state->m_galaga_starcontrol[5] & 1) == 1 ) + if ( (m_galaga_starcontrol[5] & 1) == 1 ) { int y_align = 112; /* 112 is a tweak to get alignment about perfect */ - int x_align = state->flip_screen() ? 112 : 16; + int x_align = flip_screen() ? 112 : 16; int star_cntr; int set_a, set_b; /* two sets of stars controlled by these bits */ - set_a = (state->m_galaga_starcontrol[3] & 1); - set_b = (state->m_galaga_starcontrol[4] & 1) | 2; + set_a = (m_galaga_starcontrol[3] & 1); + set_b = (m_galaga_starcontrol[4] & 1) | 2; for (star_cntr = 0;star_cntr < MAX_STARS ;star_cntr++) { @@ -548,8 +546,8 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) ) { - x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256 + x_align; - y = (y_align + star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256; + x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256 + x_align; + y = (y_align + star_seed_tab[star_cntr].y + m_stars_scrolly) % 256; if (cliprect.contains(x, y)) bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col; @@ -562,8 +560,8 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec UINT32 galaga_state::screen_update_galaga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(get_black_pen(machine()), cliprect); - draw_stars(machine(),bitmap,cliprect); - draw_sprites(machine(),bitmap,cliprect); + draw_stars(bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_fg_tilemap->draw(bitmap, cliprect, 0,0); return 0; } diff --git a/src/mame/video/galastrm.c b/src/mame/video/galastrm.c index 0794a57bfe6..7c3615f32c0 100644 --- a/src/mame/video/galastrm.c +++ b/src/mame/video/galastrm.c @@ -82,11 +82,10 @@ Heavy use is made of sprite zooming. ********************************************************/ -static void draw_sprites_pre(running_machine &machine, int x_offs, int y_offs) +void galastrm_state::draw_sprites_pre(int x_offs, int y_offs) { - galastrm_state *state = machine.driver_data<galastrm_state>(); - UINT32 *spriteram32 = state->m_spriteram; - UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base(); + UINT32 *spriteram32 = m_spriteram; + UINT16 *spritemap = (UINT16 *)memregion("user1")->base(); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; int sprites_flipscreen = 0; @@ -96,9 +95,9 @@ static void draw_sprites_pre(running_machine &machine, int x_offs, int y_offs) /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list while processing sprite ram and then draw them all at the end */ - state->m_sprite_ptr_pre = state->m_spritelist; + m_sprite_ptr_pre = m_spritelist; - for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) + for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) { data = spriteram32[offs+0]; flipx = (data & 0x00800000) >> 23; @@ -171,43 +170,42 @@ static void draw_sprites_pre(running_machine &machine, int x_offs, int y_offs) flipy = !flipy; } - state->m_sprite_ptr_pre->gfx = 0; - state->m_sprite_ptr_pre->code = code; - state->m_sprite_ptr_pre->color = color; - state->m_sprite_ptr_pre->flipx = !flipx; - state->m_sprite_ptr_pre->flipy = flipy; - state->m_sprite_ptr_pre->x = curx; - state->m_sprite_ptr_pre->y = cury; - state->m_sprite_ptr_pre->zoomx = zx << 12; - state->m_sprite_ptr_pre->zoomy = zy << 12; - state->m_sprite_ptr_pre->primask = priority; - - state->m_sprite_ptr_pre++; + m_sprite_ptr_pre->gfx = 0; + m_sprite_ptr_pre->code = code; + m_sprite_ptr_pre->color = color; + m_sprite_ptr_pre->flipx = !flipx; + m_sprite_ptr_pre->flipy = flipy; + m_sprite_ptr_pre->x = curx; + m_sprite_ptr_pre->y = cury; + m_sprite_ptr_pre->zoomx = zx << 12; + m_sprite_ptr_pre->zoomy = zy << 12; + m_sprite_ptr_pre->primask = priority; + + m_sprite_ptr_pre++; } if (bad_chunks) logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); } } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority) +void galastrm_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority) { - galastrm_state *state = machine.driver_data<galastrm_state>(); - struct tempsprite *sprite_ptr = state->m_sprite_ptr_pre; + struct tempsprite *sprite_ptr = m_sprite_ptr_pre; - while (sprite_ptr != state->m_spritelist) + while (sprite_ptr != m_spritelist) { sprite_ptr--; if ((priority != 0 && sprite_ptr->primask != 0) || (priority == 0 && sprite_ptr->primask == 0)) { - pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], + pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->x,sprite_ptr->y, sprite_ptr->zoomx,sprite_ptr->zoomy, - machine.priority_bitmap,primasks[sprite_ptr->primask],0); + machine().priority_bitmap,primasks[sprite_ptr->primask],0); } } } @@ -238,18 +236,17 @@ static void tc0610_draw_scanline(void *dest, INT32 scanline, const poly_extent * } } -static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip) +void galastrm_state::tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip) { - galastrm_state *state = machine.driver_data<galastrm_state>(); - poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly); + poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(m_poly); poly_draw_scanline_func callback; poly_vertex vert[4]; - int rsx = state->m_tc0610_ctrl_reg[1][0]; - int rsy = state->m_tc0610_ctrl_reg[1][1]; - const int rzx = state->m_tc0610_ctrl_reg[1][2]; - const int rzy = state->m_tc0610_ctrl_reg[1][3]; - const int ryx = state->m_tc0610_ctrl_reg[1][5]; - const int ryy = state->m_tc0610_ctrl_reg[1][4]; + int rsx = m_tc0610_ctrl_reg[1][0]; + int rsy = m_tc0610_ctrl_reg[1][1]; + const int rzx = m_tc0610_ctrl_reg[1][2]; + const int rzy = m_tc0610_ctrl_reg[1][3]; + const int ryx = m_tc0610_ctrl_reg[1][5]; + const int ryy = m_tc0610_ctrl_reg[1][4]; const int lx = srcbitmap.width(); const int ly = srcbitmap.height(); @@ -283,48 +280,48 @@ static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, b zcs = ((float)pxx/4096.0) / (float)(lx / 2); - if ((rsx == -240 && rsy == 1072) || !state->m_tc0610_ctrl_reg[1][7]) + if ((rsx == -240 && rsy == 1072) || !m_tc0610_ctrl_reg[1][7]) { - state->m_rsxoffs = 0; - state->m_rsyoffs = 0; + m_rsxoffs = 0; + m_rsyoffs = 0; } else { - if (rsx > state->m_rsxb && state->m_rsxb < 0 && rsx-state->m_rsxb > 0x8000) + if (rsx > m_rsxb && m_rsxb < 0 && rsx-m_rsxb > 0x8000) { - if (state->m_rsxoffs == 0) - state->m_rsxoffs = -0x10000; + if (m_rsxoffs == 0) + m_rsxoffs = -0x10000; else - state->m_rsxoffs = 0; + m_rsxoffs = 0; } - if (rsx < state->m_rsxb && state->m_rsxb > 0 && state->m_rsxb-rsx > 0x8000) + if (rsx < m_rsxb && m_rsxb > 0 && m_rsxb-rsx > 0x8000) { - if (state->m_rsxoffs == 0) - state->m_rsxoffs = 0x10000-1; + if (m_rsxoffs == 0) + m_rsxoffs = 0x10000-1; else - state->m_rsxoffs = 0; + m_rsxoffs = 0; } - if (rsy > state->m_rsyb && state->m_rsyb < 0 && rsy-state->m_rsyb > 0x8000) + if (rsy > m_rsyb && m_rsyb < 0 && rsy-m_rsyb > 0x8000) { - if (state->m_rsyoffs == 0) - state->m_rsyoffs = -0x10000; + if (m_rsyoffs == 0) + m_rsyoffs = -0x10000; else - state->m_rsyoffs = 0; + m_rsyoffs = 0; } - if (rsy < state->m_rsyb && state->m_rsyb > 0 && state->m_rsyb-rsy > 0x8000) + if (rsy < m_rsyb && m_rsyb > 0 && m_rsyb-rsy > 0x8000) { - if (state->m_rsyoffs == 0) - state->m_rsyoffs = 0x10000-1; + if (m_rsyoffs == 0) + m_rsyoffs = 0x10000-1; else - state->m_rsyoffs = 0; + m_rsyoffs = 0; } } - state->m_rsxb = rsx; - state->m_rsyb = rsy; - if (state->m_rsxoffs) rsx += state->m_rsxoffs; - if (state->m_rsyoffs) rsy += state->m_rsyoffs; - if (rsx < -0x14000 || rsx >= 0x14000) state->m_rsxoffs = 0; - if (rsy < -0x14000 || rsy >= 0x14000) state->m_rsyoffs = 0; + m_rsxb = rsx; + m_rsyb = rsy; + if (m_rsxoffs) rsx += m_rsxoffs; + if (m_rsyoffs) rsy += m_rsyoffs; + if (rsx < -0x14000 || rsx >= 0x14000) m_rsxoffs = 0; + if (rsy < -0x14000 || rsy >= 0x14000) m_rsyoffs = 0; pxx = 0; @@ -338,7 +335,7 @@ static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, b //ysn = 0.0; //ycs = 0.0; - if (state->m_tc0610_ctrl_reg[1][7]) + if (m_tc0610_ctrl_reg[1][7]) { if (ryx != 0 || ryy != 0) { @@ -423,7 +420,7 @@ static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, b extra->texbase = &srcbitmap; callback = tc0610_draw_scanline; - poly_render_quad(state->m_poly, &bitmap, clip, callback, 2, &vert[0], &vert[1], &vert[2], &vert[3]); + poly_render_quad(m_poly, &bitmap, clip, callback, 2, &vert[0], &vert[1], &vert[2], &vert[3]); } /************************************************************** @@ -542,15 +539,15 @@ UINT32 galastrm_state::screen_update_galastrm(screen_device &screen, bitmap_ind1 } } - draw_sprites_pre(machine(), 42-X_OFFSET, -571+Y_OFFSET); - draw_sprites(machine(),m_tmpbitmaps,clip,primasks,1); + draw_sprites_pre(42-X_OFFSET, -571+Y_OFFSET); + draw_sprites(m_tmpbitmaps,clip,primasks,1); copybitmap_trans(bitmap,m_polybitmap,0,0, 0,0,cliprect,0); m_polybitmap.fill(0, clip); - tc0610_rotate_draw(machine(),m_polybitmap,m_tmpbitmaps,cliprect); + tc0610_rotate_draw(m_polybitmap,m_tmpbitmaps,cliprect); priority_bitmap.fill(0, cliprect); - draw_sprites(machine(),bitmap,cliprect,primasks,0); + draw_sprites(bitmap,cliprect,primasks,0); tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); diff --git a/src/mame/video/galaxian.c b/src/mame/video/galaxian.c index c4edeccdbdd..1641c4b10dc 100644 --- a/src/mame/video/galaxian.c +++ b/src/mame/video/galaxian.c @@ -227,26 +227,6 @@ H=B0: 0C,0C,0D,0D,0E,0E,0F,0F 0C,0C,2D,2D,0E,0E,2F,2F #define RGB_MAXIMUM 224 - -/************************************* - * - * Function prototypes - * - *************************************/ - -static void state_save_register(running_machine &machine); - - -static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase); - -static void stars_init(running_machine &machine); -static void stars_update_origin(running_machine &machine); -static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask); - -static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base); - - - /************************************* * * Palette setup @@ -417,29 +397,28 @@ void galaxian_state::video_start() m_background_green = 0; /* initialize stars */ - stars_init(machine()); + stars_init(); /* register for save states */ - state_save_register(machine()); + state_save_register(); } -static void state_save_register(running_machine &machine) +void galaxian_state::state_save_register() { - galaxian_state *state = machine.driver_data<galaxian_state>(); - state_save_register_global(machine, state->m_flipscreen_x); - state_save_register_global(machine, state->m_flipscreen_y); - state_save_register_global(machine, state->m_background_enable); - state_save_register_global(machine, state->m_background_red); - state_save_register_global(machine, state->m_background_green); - state_save_register_global(machine, state->m_background_blue); - - state_save_register_global_array(machine, state->m_gfxbank); - - state_save_register_global(machine, state->m_stars_enabled); - state_save_register_global(machine, state->m_star_rng_origin); - state_save_register_global(machine, state->m_star_rng_origin_frame); - state_save_register_global(machine, state->m_stars_blink_state); + state_save_register_global(machine(), m_flipscreen_x); + state_save_register_global(machine(), m_flipscreen_y); + state_save_register_global(machine(), m_background_enable); + state_save_register_global(machine(), m_background_red); + state_save_register_global(machine(), m_background_green); + state_save_register_global(machine(), m_background_blue); + + state_save_register_global_array(machine(), m_gfxbank); + + state_save_register_global(machine(), m_stars_enabled); + state_save_register_global(machine(), m_star_rng_origin); + state_save_register_global(machine(), m_star_rng_origin_frame); + state_save_register_global(machine(), m_stars_blink_state); } @@ -453,18 +432,18 @@ static void state_save_register(running_machine &machine) UINT32 galaxian_state::screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { /* draw the background layer (including stars) */ - (*m_draw_background_ptr)(machine(), bitmap, cliprect); + (this->*m_draw_background_ptr)(bitmap, cliprect); /* draw the tilemap characters over top */ m_bg_tilemap->draw(bitmap, cliprect, 0, 0); /* render the sprites next. Some custom pcbs (eg. zigzag, fantastc) have more than one sprite generator (ideally, this should be rendered in parallel) */ for (int i = 0; i < m_numspritegens; i++) - sprites_draw(machine(), bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]); + sprites_draw(bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]); /* if we have bullets to draw, render them following */ if (m_draw_bullet_ptr != NULL) - bullets_draw(machine(), bitmap, cliprect, &m_spriteram[m_bullets_base]); + bullets_draw(bitmap, cliprect, &m_spriteram[m_bullets_base]); return 0; } @@ -487,7 +466,7 @@ TILE_GET_INFO_MEMBER(galaxian_state::bg_get_tile_info) UINT8 color = attrib & 7; if (m_extend_tile_info_ptr != NULL) - (*m_extend_tile_info_ptr)(machine(), &code, &color, attrib, x); + (this->*m_extend_tile_info_ptr)(&code, &color, attrib, x); SET_TILE_INFO_MEMBER(0, code, color, 0); } @@ -545,9 +524,8 @@ WRITE8_MEMBER(galaxian_state::galaxian_objram_w) * *************************************/ -static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase) +void galaxian_state::sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase) { - galaxian_state *state = machine.driver_data<galaxian_state>(); rectangle clip = cliprect; int sprnum; @@ -556,8 +534,8 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */ /* according to the schematics, it should be the first 16 pixels */ - clip.min_x = MAX(clip.min_x, (!state->m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE); - clip.max_x = MIN(clip.max_x, (256 - state->m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1); + clip.min_x = MAX(clip.min_x, (!m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE); + clip.max_x = MIN(clip.max_x, (256 - m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1); /* The line buffer is only written if it contains a '0' currently; */ /* it is cleared during the visible area, and populated during HBLANK */ @@ -567,7 +545,7 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r { const UINT8 *base = &spritebase[sprnum * 4]; /* Frogger: top and bottom 4 bits swapped entering the adder */ - UINT8 base0 = state->m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0]; + UINT8 base0 = m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0]; /* the first three sprites match against y-1 */ UINT8 sy = 240 - (base0 - (sprnum < 3)); UINT16 code = base[1] & 0x3f; @@ -577,18 +555,18 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r UINT8 sx = base[3] + hoffset; /* extend the sprite information */ - if (state->m_extend_sprite_info_ptr != NULL) - (*state->m_extend_sprite_info_ptr)(machine, base, &sx, &sy, &flipx, &flipy, &code, &color); + if (m_extend_sprite_info_ptr != NULL) + (this->*m_extend_sprite_info_ptr)(base, &sx, &sy, &flipx, &flipy, &code, &color); /* apply flipscreen in X direction */ - if (state->m_flipscreen_x) + if (m_flipscreen_x) { sx = 240 - sx; flipx = !flipx; } /* apply flipscreen in Y direction */ - if (state->m_flipscreen_y) + if (m_flipscreen_y) { sy = 240 - sy; flipy = !flipy; @@ -596,7 +574,7 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r /* draw */ drawgfx_transpen(bitmap, clip, - machine.gfx[1], + machine().gfx[1], code, color, flipx, flipy, GALAXIAN_H0START + GALAXIAN_XSCALE * sx, sy, 0); @@ -611,9 +589,8 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r * *************************************/ -static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base) +void galaxian_state::bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base) { - galaxian_state *state = machine.driver_data<galaxian_state>(); int y; /* iterate over scanlines */ @@ -624,13 +601,13 @@ static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r int which; /* the first 3 entries match Y-1 */ - effy = state->m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1); + effy = m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1); for (which = 0; which < 3; which++) if ((UINT8)(base[which*4+1] + effy) == 0xff) shell = which; /* remaining entries match Y */ - effy = state->m_flipscreen_y ? (y ^ 255) : y; + effy = m_flipscreen_y ? (y ^ 255) : y; for (which = 3; which < 8; which++) if ((UINT8)(base[which*4+1] + effy) == 0xff) { @@ -642,9 +619,9 @@ static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r /* draw the shell */ if (shell != 0xff) - (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, shell, 255 - base[shell*4+3], y); + (this->*m_draw_bullet_ptr)(bitmap, cliprect, shell, 255 - base[shell*4+3], y); if (missile != 0xff) - (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, missile, 255 - base[missile*4+3], y); + (this->*m_draw_bullet_ptr)(bitmap, cliprect, missile, 255 - base[missile*4+3], y); } } @@ -665,7 +642,7 @@ WRITE8_MEMBER(galaxian_state::galaxian_flip_screen_x_w) /* when the direction changes, we count a different number of clocks */ /* per frame, so we need to reset the origin of the stars to the current */ /* frame before we flip */ - stars_update_origin(machine()); + stars_update_origin(); m_flipscreen_x = data & 0x01; m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0)); @@ -774,18 +751,17 @@ WRITE8_MEMBER(galaxian_state::galaxian_gfxbank_w) * *************************************/ -static void stars_init(running_machine &machine) +void galaxian_state::stars_init() { - galaxian_state *state = machine.driver_data<galaxian_state>(); UINT32 shiftreg; int i; /* reset the blink and enabled states */ - state->m_stars_enabled = FALSE; - state->m_stars_blink_state = 0; + m_stars_enabled = FALSE; + m_stars_blink_state = 0; /* precalculate the RNG */ - state->m_stars = auto_alloc_array(machine, UINT8, STAR_RNG_PERIOD); + m_stars = auto_alloc_array(machine(), UINT8, STAR_RNG_PERIOD); shiftreg = 0; for (i = 0; i < STAR_RNG_PERIOD; i++) { @@ -796,7 +772,7 @@ static void stars_init(running_machine &machine) int color = (~shiftreg & 0x1f8) >> 3; /* store the color value in the low 6 bits and the enable in the upper bit */ - state->m_stars[i] = color | (enabled << 7); + m_stars[i] = color | (enabled << 7); /* the LFSR is fed based on the XOR of bit 12 and the inverse of bit 0 */ shiftreg = (shiftreg >> 1) | ((((shiftreg >> 12) ^ ~shiftreg) & 1) << 16); @@ -811,13 +787,12 @@ static void stars_init(running_machine &machine) * *************************************/ -static void stars_update_origin(running_machine &machine) +void galaxian_state::stars_update_origin() { - galaxian_state *state = machine.driver_data<galaxian_state>(); - int curframe = machine.primary_screen->frame_number(); + int curframe = machine().primary_screen->frame_number(); /* only update on a different frame */ - if (curframe != state->m_star_rng_origin_frame) + if (curframe != m_star_rng_origin_frame) { /* The RNG period is 2^17-1; each frame, the shift register is clocked */ /* 512*256 = 2^17 times. This means that we clock one extra time each */ @@ -825,16 +800,16 @@ static void stars_update_origin(running_machine &machine) /* at 6B which delay the count so that we count 512*256-2 = 2^17-2 times. */ /* In this case, we only one time less than the period each frame. Both */ /* of these off-by-one countings produce the horizontal star scrolling. */ - int per_frame_delta = state->m_flipscreen_x ? 1 : -1; - int total_delta = per_frame_delta * (curframe - state->m_star_rng_origin_frame); + int per_frame_delta = m_flipscreen_x ? 1 : -1; + int total_delta = per_frame_delta * (curframe - m_star_rng_origin_frame); /* we can't just use % here because mod of a negative number is undefined */ while (total_delta < 0) total_delta += STAR_RNG_PERIOD; /* now that everything is positive, do the mod */ - state->m_star_rng_origin = (state->m_star_rng_origin + total_delta) % STAR_RNG_PERIOD; - state->m_star_rng_origin_frame = curframe; + m_star_rng_origin = (m_star_rng_origin + total_delta) % STAR_RNG_PERIOD; + m_star_rng_origin_frame = curframe; } } @@ -859,7 +834,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(galaxian_state::galaxian_stars_blink_timer) * *************************************/ -static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask) +void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask) { int x; @@ -891,20 +866,20 @@ static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx */ /* first RNG clock: one pixel */ - star = state->m_stars[star_offs++]; + star = m_stars[star_offs++]; if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) - bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = state->m_star_color[star & 0x3f]; + bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; /* second RNG clock: two pixels */ - star = state->m_stars[star_offs++]; + star = m_stars[star_offs++]; if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) { - bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = state->m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = state->m_star_color[star & 0x3f]; + bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; } } } @@ -917,35 +892,33 @@ static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx * *************************************/ -void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void galaxian_state::galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* erase the background to black first */ bitmap.fill(RGB_BLACK, cliprect); /* update the star origin to the current frame */ - stars_update_origin(machine); + stars_update_origin(); /* render stars if enabled */ - if (state->m_stars_enabled) + if (m_stars_enabled) { int y; /* iterate over scanlines */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - UINT32 star_offs = state->m_star_rng_origin + y * 512; - stars_draw_row(state, bitmap, 256, y, star_offs, 0xff); + UINT32 star_offs = m_star_rng_origin + y * 512; + stars_draw_row(bitmap, 256, y, star_offs, 0xff); } } } -static void background_draw_colorsplit(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped) +void galaxian_state::background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* horizontal bgcolor split */ - if (state->m_flipscreen_x) + if (m_flipscreen_x) { rectangle draw = cliprect; draw.max_x = MIN(draw.max_x, split_flipped * GALAXIAN_XSCALE - 1); @@ -972,16 +945,15 @@ static void background_draw_colorsplit(running_machine &machine, bitmap_rgb32 &b } -static void scramble_draw_stars(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx) +void galaxian_state::scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* update the star origin to the current frame */ - stars_update_origin(machine); + stars_update_origin(); /* render stars if enabled */ - if (state->m_stars_enabled) + if (m_stars_enabled) { - int blink_state = state->m_stars_blink_state & 3; + int blink_state = m_stars_blink_state & 3; int y; /* iterate over scanlines */ @@ -992,47 +964,43 @@ static void scramble_draw_stars(running_machine &machine, bitmap_rgb32 &bitmap, { /* blink states 0 and 1 suppress stars when certain bits of the color == 0 */ static const UINT8 colormask_table[4] = { 0x20, 0x08, 0xff, 0xff }; - stars_draw_row(state, bitmap, maxx, y, y * 512, colormask_table[blink_state]); + stars_draw_row(bitmap, maxx, y, y * 512, colormask_table[blink_state]); } } } } -void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void galaxian_state::scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* blue background - 390 ohm resistor */ - bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); + bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); - scramble_draw_stars(machine, bitmap, cliprect, 256); + scramble_draw_stars(bitmap, cliprect, 256); } -void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void galaxian_state::anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* blue background, horizontal split as seen on flyer and real cabinet */ - background_draw_colorsplit(machine, bitmap, cliprect, state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56); + background_draw_colorsplit(bitmap, cliprect, m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56); - scramble_draw_stars(machine, bitmap, cliprect, 256); + scramble_draw_stars(bitmap, cliprect, 256); } -void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void galaxian_state::jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* blue background - 390 ohm resistor */ - bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); + bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); /* render stars same as scramble but nothing in the status area */ - scramble_draw_stars(machine, bitmap, cliprect, 240); + scramble_draw_stars(bitmap, cliprect, 240); } -void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void galaxian_state::turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* The background color generator is connected this way: @@ -1040,24 +1008,23 @@ void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, con GREEN - 470 ohm resistor BLUE - 390 ohm resistor */ - bitmap.fill(MAKE_RGB(state->m_background_red * 0x55, state->m_background_green * 0x47, state->m_background_blue * 0x55), cliprect); + bitmap.fill(MAKE_RGB(m_background_red * 0x55, m_background_green * 0x47, m_background_blue * 0x55), cliprect); } -void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void galaxian_state::frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) { /* color split point verified on real machine */ /* hmmm, according to schematics it is at 128+8; which is right? */ - background_draw_colorsplit(machine, bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8); + background_draw_colorsplit(bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8); } #ifdef UNUSED_FUNCTION -static int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect) +int galaxian_state::flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect) { - galaxian_state *state = machine.driver_data<galaxian_state>(); draw = cliprect; - if (!state->m_flipscreen_x) + if (!m_flipscreen_x) { draw.min_x = xstart * GALAXIAN_XSCALE; draw.max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1); @@ -1071,10 +1038,9 @@ static int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle return (draw.min_x <= draw.max_x); } -void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void galaxian_state::amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - const UINT8 *prom = state->memregion("user1")->base(); + const UINT8 *prom = memregion("user1")->base(); rectangle draw; int x; @@ -1095,9 +1061,9 @@ void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons GREEN - 560 ohm resistor BLUE - 470 ohm resistor */ - UINT8 red = ((~prom[x] & 0x02) && state->m_background_red) ? 0x7c : 0x00; - UINT8 green = ((~prom[x] & 0x02) && state->m_background_green) ? 0x3c : 0x00; - UINT8 blue = ((~prom[x] & 0x01) && state->m_background_blue) ? 0x47 : 0x00; + UINT8 red = ((~prom[x] & 0x02) && m_background_red) ? 0x7c : 0x00; + UINT8 green = ((~prom[x] & 0x02) && m_background_green) ? 0x3c : 0x00; + UINT8 blue = ((~prom[x] & 0x01) && m_background_blue) ? 0x47 : 0x00; bitmap.fill(MAKE_RGB(red, green, blue, draw)); } } @@ -1111,7 +1077,7 @@ void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons * *************************************/ -INLINE void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color) +inline void galaxian_state::galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color) { if (y >= cliprect.min_y && y <= cliprect.max_y) { @@ -1131,9 +1097,8 @@ INLINE void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, } -void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxian_state::galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* Both "shells" and "missiles" begin displaying when the horizontal counter reaches $FC, and they stop displaying when it reaches $00, resulting in @@ -1141,14 +1106,14 @@ void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const white; the final entry is called a "missile" and renders as yellow. */ x -= 4; - galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); - galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); - galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); - galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); + galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); + galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); + galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); + galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]); } -void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxian_state::mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) { /* verified by schematics: * both "W" and "Y" bullets are 4 pixels long @@ -1177,7 +1142,7 @@ void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const } -void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxian_state::scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) { /* Scramble only has "shells", which begin displaying when the counter @@ -1189,15 +1154,14 @@ void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const } -void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxian_state::theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - galaxian_state *state = machine.driver_data<galaxian_state>(); /* Same as galaxian except blue/green are swapped */ x -= 4; - galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); - galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); - galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); - galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); + galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); + galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); + galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); + galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs]))); } @@ -1209,13 +1173,13 @@ void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const re *************************************/ /*** generic ***/ -void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { /* tiles are in the upper half of a larger ROM */ *code += 0x100; } -void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { /* sprites are in the upper half of a larger ROM */ *code += 0x40; @@ -1223,98 +1187,91 @@ void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 /*** Frogger ***/ -void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); } -void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); } /*** Ghostmuncher Galaxian ***/ -void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - *code |= state->m_gfxbank[0] << 9; -// *color |= state->m_gfxbank[0] << 3; + *code |= m_gfxbank[0] << 9; +// *color |= m_gfxbank[0] << 3; } -void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - *code |= (state->m_gfxbank[0] << 7) | 0x40; - *color |= state->m_gfxbank[0] << 3; + *code |= (m_gfxbank[0] << 7) | 0x40; + *color |= m_gfxbank[0] << 3; } /*** Pisces ***/ -void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - *code |= state->m_gfxbank[0] << 8; + *code |= m_gfxbank[0] << 8; } -void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - *code |= state->m_gfxbank[0] << 6; + *code |= m_gfxbank[0] << 6; } /*** Batman Part 2 ***/ -void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { - galaxian_state *state = machine.driver_data<galaxian_state>(); if (*code & 0x80) - *code |= state->m_gfxbank[0] << 8; + *code |= m_gfxbank[0] << 8; } /*** Moon Cresta ***/ -void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - if (state->m_gfxbank[2] && (*code & 0xc0) == 0x80) - *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100; + if (m_gfxbank[2] && (*code & 0xc0) == 0x80) + *code = (*code & 0x3f) | (m_gfxbank[0] << 6) | (m_gfxbank[1] << 7) | 0x0100; } -void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - if (state->m_gfxbank[2] && (*code & 0x30) == 0x20) - *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40; + if (m_gfxbank[2] && (*code & 0x30) == 0x20) + *code = (*code & 0x0f) | (m_gfxbank[0] << 4) | (m_gfxbank[1] << 5) | 0x40; } /*** Moon Quasar ***/ -void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { *code |= (attrib & 0x20) << 3; } -void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { *code |= (base[2] & 0x20) << 1; } /*** Moon Shuttle ***/ -void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { *code |= (attrib & 0x30) << 4; } -void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { *code |= (base[2] & 0x30) << 2; } /*** Calipso ***/ -void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { /* same as the others, but no sprite flipping, but instead the bits are used as extra sprite code bits, giving 256 sprite images */ @@ -1326,22 +1283,20 @@ void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UIN /*** Jumpbug ***/ -void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) +void galaxian_state::jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - if ((*code & 0xc0) == 0x80 && (state->m_gfxbank[2] & 0x01)) - *code += 128 + (( state->m_gfxbank[0] & 0x01) << 6) + - (( state->m_gfxbank[1] & 0x01) << 7) + - ((~state->m_gfxbank[4] & 0x01) << 8); + if ((*code & 0xc0) == 0x80 && (m_gfxbank[2] & 0x01)) + *code += 128 + (( m_gfxbank[0] & 0x01) << 6) + + (( m_gfxbank[1] & 0x01) << 7) + + ((~m_gfxbank[4] & 0x01) << 8); } -void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) +void galaxian_state::jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) { - galaxian_state *state = machine.driver_data<galaxian_state>(); - if ((*code & 0x30) == 0x20 && (state->m_gfxbank[2] & 0x01) != 0) + if ((*code & 0x30) == 0x20 && (m_gfxbank[2] & 0x01) != 0) { - *code += 32 + (( state->m_gfxbank[0] & 0x01) << 4) + - (( state->m_gfxbank[1] & 0x01) << 5) + - ((~state->m_gfxbank[4] & 0x01) << 6); + *code += 32 + (( m_gfxbank[0] & 0x01) << 4) + + (( m_gfxbank[1] & 0x01) << 5) + + ((~m_gfxbank[4] & 0x01) << 6); } } diff --git a/src/mame/video/galaxold.c b/src/mame/video/galaxold.c index 50899f2a547..4528ddc1692 100644 --- a/src/mame/video/galaxold.c +++ b/src/mame/video/galaxold.c @@ -7,61 +7,9 @@ #include "emu.h" #include "includes/galaxold.h" -#define STARS_COLOR_BASE_LEGACY (machine.root_device().memregion("proms")->bytes()) #define STARS_COLOR_BASE (machine().root_device().memregion("proms")->bytes()) #define BULLETS_COLOR_BASE (STARS_COLOR_BASE + 64) -#define BULLETS_COLOR_BASE_LEGACY (STARS_COLOR_BASE_LEGACY + 64) #define BACKGROUND_COLOR_BASE (BULLETS_COLOR_BASE + 2) -#define BACKGROUND_COLOR_BASE_LEGACY (BULLETS_COLOR_BASE_LEGACY + 2) - - - - -static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); -static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); -static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); -static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); -static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); - -static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); -static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); -static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); -static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); -static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); -static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); - -static void drivfrcg_modify_color(UINT8 *color); - - - - - void galaxold_init_stars(running_machine &machine, int colors_offset); -static void noop_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); - void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void mariner_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c); -static void start_stars_scroll_timer(running_machine &machine); - -/* bullets circuit */ -static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); -static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); -static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); -static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y); - -/* background circuit */ -static void galaxold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void scrambold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void ad2083_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void mariner_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void minefld_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void rescue_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); -static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); - - - /*************************************************************************** @@ -127,7 +75,7 @@ PALETTE_INIT_MEMBER(galaxold_state,galaxold) } - galaxold_init_stars(machine(), STARS_COLOR_BASE); + galaxold_init_stars(STARS_COLOR_BASE); /* bullets - yellow and white */ @@ -372,7 +320,7 @@ PALETTE_INIT_MEMBER(galaxold_state,dambustr) } - galaxold_init_stars(machine(), STARS_COLOR_BASE); + galaxold_init_stars(STARS_COLOR_BASE); /* bullets - yellow and white */ @@ -430,56 +378,54 @@ PALETTE_INIT_MEMBER(galaxold_state,turtles) ***************************************************************************/ -static void state_save_register(running_machine &machine) +void galaxold_state::state_save_register() { - galaxold_state *state = machine.driver_data<galaxold_state>(); - state_save_register_global_array(machine, state->m_gfxbank); - state_save_register_global(machine, state->m_flipscreen_x); - state_save_register_global(machine, state->m_flipscreen_y); + state_save_register_global_array(machine(), m_gfxbank); + state_save_register_global(machine(), m_flipscreen_x); + state_save_register_global(machine(), m_flipscreen_y); - state_save_register_global(machine, state->m_stars_on); - state_save_register_global(machine, state->m_stars_scrollpos); - state_save_register_global(machine, state->m_stars_blink_state); + state_save_register_global(machine(), m_stars_on); + state_save_register_global(machine(), m_stars_scrollpos); + state_save_register_global(machine(), m_stars_blink_state); - state_save_register_global(machine, state->m_darkplnt_bullet_color); + state_save_register_global(machine(), m_darkplnt_bullet_color); - state_save_register_global(machine, state->m_background_enable); - state_save_register_global(machine, state->m_background_red); - state_save_register_global(machine, state->m_background_green); - state_save_register_global(machine, state->m_background_blue); + state_save_register_global(machine(), m_background_enable); + state_save_register_global(machine(), m_background_red); + state_save_register_global(machine(), m_background_green); + state_save_register_global(machine(), m_background_blue); } -static void video_start_common(running_machine &machine) +void galaxold_state::video_start_common() { - galaxold_state *state = machine.driver_data<galaxold_state>(); - state->m_modify_charcode = 0; - state->m_modify_spritecode = 0; - state->m_modify_color = 0; - state->m_modify_ypos = 0; + m_modify_charcode = 0; + m_modify_spritecode = 0; + m_modify_color = 0; + m_modify_ypos = 0; - state->m_mooncrst_gfxextend = 0; + m_mooncrst_gfxextend = 0; - state->m_draw_bullets = 0; + m_draw_bullets = 0; - state->m_draw_background = galaxold_draw_background; - state->m_background_enable = 0; - state->m_background_blue = 0; - state->m_background_red = 0; - state->m_background_green = 0; + m_draw_background = &galaxold_state::galaxold_draw_background; + m_background_enable = 0; + m_background_blue = 0; + m_background_red = 0; + m_background_green = 0; - state->m_draw_stars = noop_draw_stars; + m_draw_stars = &galaxold_state::noop_draw_stars; - state->m_flipscreen_x = 0; - state->m_flipscreen_y = 0; + m_flipscreen_x = 0; + m_flipscreen_y = 0; - state->m_spriteram2_present = 0; + m_spriteram2_present = 0; - state_save_register(machine); + state_save_register(); } VIDEO_START_MEMBER(galaxold_state,galaxold_plain) { - video_start_common(machine()); + video_start_common(); m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); m_bg_tilemap->set_transparent_pen(0); @@ -492,9 +438,9 @@ VIDEO_START_MEMBER(galaxold_state,galaxold) { VIDEO_START_CALL_MEMBER(galaxold_plain); - m_draw_stars = galaxold_draw_stars; + m_draw_stars = &galaxold_state::galaxold_draw_stars; - m_draw_bullets = galaxold_draw_bullets; + m_draw_bullets = &galaxold_state::galaxold_draw_bullets; } VIDEO_START_MEMBER(galaxold_state,scrambold) @@ -506,11 +452,11 @@ VIDEO_START_MEMBER(galaxold_state,scrambold) */ m_bg_tilemap->set_scrolldx(0, 0); - m_draw_stars = scrambold_draw_stars; + m_draw_stars = &galaxold_state::scrambold_draw_stars; - m_draw_bullets = scrambold_draw_bullets; + m_draw_bullets = &galaxold_state::scrambold_draw_bullets; - m_draw_background = scrambold_draw_background; + m_draw_background = &galaxold_state::scrambold_draw_background; } VIDEO_START_MEMBER(galaxold_state,darkplnt) @@ -518,68 +464,68 @@ VIDEO_START_MEMBER(galaxold_state,darkplnt) VIDEO_START_CALL_MEMBER(galaxold_plain); m_bg_tilemap->set_scrolldx(0, 0); - m_draw_bullets = darkplnt_draw_bullets; + m_draw_bullets = &galaxold_state::darkplnt_draw_bullets; } VIDEO_START_MEMBER(galaxold_state,rescue) { VIDEO_START_CALL_MEMBER(scrambold); - m_draw_stars = rescue_draw_stars; + m_draw_stars = &galaxold_state::rescue_draw_stars; - m_draw_background = rescue_draw_background; + m_draw_background = &galaxold_state::rescue_draw_background; } VIDEO_START_MEMBER(galaxold_state,minefld) { VIDEO_START_CALL_MEMBER(scrambold); - m_draw_stars = rescue_draw_stars; + m_draw_stars = &galaxold_state::rescue_draw_stars; - m_draw_background = minefld_draw_background; + m_draw_background = &galaxold_state::minefld_draw_background; } VIDEO_START_MEMBER(galaxold_state,stratgyx) { VIDEO_START_CALL_MEMBER(galaxold_plain); - m_draw_background = stratgyx_draw_background; + m_draw_background = &galaxold_state::stratgyx_draw_background; } VIDEO_START_MEMBER(galaxold_state,ckongs) { VIDEO_START_CALL_MEMBER(scrambold); - m_modify_spritecode = mshuttle_modify_spritecode; + m_modify_spritecode = &galaxold_state::mshuttle_modify_spritecode; } VIDEO_START_MEMBER(galaxold_state,mariner) { VIDEO_START_CALL_MEMBER(galaxold_plain); - m_draw_stars = mariner_draw_stars; + m_draw_stars = &galaxold_state::mariner_draw_stars; - m_draw_bullets = scrambold_draw_bullets; + m_draw_bullets = &galaxold_state::scrambold_draw_bullets; - m_draw_background = mariner_draw_background; + m_draw_background = &galaxold_state::mariner_draw_background; - m_modify_charcode = mariner_modify_charcode; + m_modify_charcode = &galaxold_state::mariner_modify_charcode; } VIDEO_START_MEMBER(galaxold_state,mimonkey) { VIDEO_START_CALL_MEMBER(scrambold); - m_modify_charcode = mimonkey_modify_charcode; - m_modify_spritecode = mimonkey_modify_spritecode; + m_modify_charcode = &galaxold_state::mimonkey_modify_charcode; + m_modify_spritecode = &galaxold_state::mimonkey_modify_spritecode; } VIDEO_START_MEMBER(galaxold_state,dkongjrm) { VIDEO_START_CALL_MEMBER(galaxold_plain); - m_modify_charcode = pisces_modify_charcode; - m_modify_spritecode = dkongjrm_modify_spritecode; + m_modify_charcode = &galaxold_state::pisces_modify_charcode; + m_modify_spritecode = &galaxold_state::dkongjrm_modify_spritecode; m_spriteram2_present= 1; } @@ -588,25 +534,24 @@ VIDEO_START_MEMBER(galaxold_state,scorpion) { VIDEO_START_CALL_MEMBER(scrambold); - m_modify_spritecode = batman2_modify_spritecode; + m_modify_spritecode = &galaxold_state::batman2_modify_spritecode; } -static void pisces_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::pisces_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - *code |= (state->m_gfxbank[0] << 6); + *code |= (m_gfxbank[0] << 6); } VIDEO_START_MEMBER(galaxold_state,pisces) { VIDEO_START_CALL_MEMBER(galaxold); - m_modify_charcode = pisces_modify_charcode; - m_modify_spritecode = pisces_modify_spritecode; + m_modify_charcode = &galaxold_state::pisces_modify_charcode; + m_modify_spritecode = &galaxold_state::pisces_modify_spritecode; } #ifdef UNUSED_FUNCTION -static void theend_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxold_state::theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { int i; @@ -625,16 +570,15 @@ VIDEO_START_MEMBER(galaxold_state,theend) { VIDEO_START_CALL_MEMBER(galaxold); - m_draw_bullets = theend_draw_bullets; + m_draw_bullets = &galaxold_state::theend_draw_bullets; } #endif -static void mooncrst_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::mooncrst_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_gfxbank[2] && ((*code & 0x30) == 0x20)) + if (m_gfxbank[2] && ((*code & 0x30) == 0x20)) { - *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40; + *code = (*code & 0x0f) | (m_gfxbank[0] << 4) | (m_gfxbank[1] << 5) | 0x40; } } @@ -642,16 +586,15 @@ VIDEO_START_MEMBER(galaxold_state,mooncrst) { VIDEO_START_CALL_MEMBER(galaxold); - m_modify_charcode = mooncrst_modify_charcode; - m_modify_spritecode = mooncrst_modify_spritecode; + m_modify_charcode = &galaxold_state::mooncrst_modify_charcode; + m_modify_spritecode = &galaxold_state::mooncrst_modify_spritecode; } -static void batman2_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) +void galaxold_state::batman2_modify_charcode(UINT16 *code, UINT8 x) { - galaxold_state *state = machine.driver_data<galaxold_state>(); if (*code & 0x80) { - *code |= (state->m_gfxbank[0] << 8); + *code |= (m_gfxbank[0] << 8); } } @@ -659,22 +602,20 @@ VIDEO_START_MEMBER(galaxold_state,batman2) { VIDEO_START_CALL_MEMBER(galaxold); - m_modify_charcode = batman2_modify_charcode; - m_modify_spritecode = batman2_modify_spritecode; + m_modify_charcode = &galaxold_state::batman2_modify_charcode; + m_modify_spritecode = &galaxold_state::batman2_modify_spritecode; } -static void rockclim_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::rockclim_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - state->m_rockclim_tilemap->draw(bitmap, cliprect, 0,0); + m_rockclim_tilemap->draw(bitmap, cliprect, 0,0); } -static void rockclim_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::rockclim_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_gfxbank[2]) *code|=0x40; + if (m_gfxbank[2]) *code|=0x40; } VIDEO_START_MEMBER(galaxold_state,rockclim) @@ -682,9 +623,9 @@ VIDEO_START_MEMBER(galaxold_state,rockclim) VIDEO_START_CALL_MEMBER(galaxold); m_rockclim_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::rockclim_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); - m_draw_background = rockclim_draw_background; - m_modify_charcode = mooncrst_modify_charcode; - m_modify_spritecode = rockclim_modify_spritecode; + m_draw_background = &galaxold_state::rockclim_draw_background; + m_modify_charcode = &galaxold_state::mooncrst_modify_charcode; + m_modify_spritecode = &galaxold_state::rockclim_modify_spritecode; m_rockclim_v = m_rockclim_h = 0; state_save_register_global(machine(), m_rockclim_v); @@ -706,31 +647,31 @@ TILE_GET_INFO_MEMBER(galaxold_state::drivfrcg_get_tile_info) VIDEO_START_MEMBER(galaxold_state,drivfrcg) { - video_start_common(machine()); + video_start_common(); m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::drivfrcg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); m_bg_tilemap->set_transparent_pen(0); m_bg_tilemap->set_scroll_cols(32); - m_modify_spritecode = mshuttle_modify_spritecode; - m_modify_color = drivfrcg_modify_color; + m_modify_spritecode = &galaxold_state::mshuttle_modify_spritecode; + m_modify_color = &galaxold_state::drivfrcg_modify_color; m_color_mask = 0xff; } VIDEO_START_MEMBER(galaxold_state,ad2083) { - video_start_common(machine()); + video_start_common(); m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::drivfrcg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); m_bg_tilemap->set_transparent_pen(0); m_bg_tilemap->set_scroll_cols(32); - m_modify_spritecode = ad2083_modify_spritecode; + m_modify_spritecode = &galaxold_state::ad2083_modify_spritecode; - m_draw_bullets = scrambold_draw_bullets; + m_draw_bullets = &galaxold_state::scrambold_draw_bullets; - m_draw_background = ad2083_draw_background; + m_draw_background = &galaxold_state::ad2083_draw_background; m_color_mask = 7; } @@ -756,7 +697,7 @@ TILE_GET_INFO_MEMBER(galaxold_state::racknrol_get_tile_info) VIDEO_START_MEMBER(galaxold_state,racknrol) { - video_start_common(machine()); + video_start_common(); m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::racknrol_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); m_bg_tilemap->set_transparent_pen(0); @@ -780,15 +721,14 @@ TILE_GET_INFO_MEMBER(galaxold_state::harem_get_tile_info) SET_TILE_INFO_MEMBER(0, code, color, 0); } -static void harem_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::harem_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - *code |= (state->m_gfxbank[0] << 7) | 0x40; + *code |= (m_gfxbank[0] << 7) | 0x40; } VIDEO_START_MEMBER(galaxold_state,harem) { - video_start_common(machine()); + video_start_common(); m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::harem_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); // m_bg_tilemap->set_transparent_pen(0); // opaque tilemap to get sky and sand colors @@ -796,7 +736,7 @@ VIDEO_START_MEMBER(galaxold_state,harem) m_color_mask = (machine().gfx[0]->granularity() == 4) ? 7 : 3; - m_modify_spritecode = harem_modify_spritecode; + m_modify_spritecode = &galaxold_state::harem_modify_spritecode; } VIDEO_START_MEMBER(galaxold_state,ozon1) @@ -812,7 +752,7 @@ VIDEO_START_MEMBER(galaxold_state,bongo) m_bg_tilemap->set_scrolldx(0, 384-256); - m_modify_spritecode = batman2_modify_spritecode; + m_modify_spritecode = &galaxold_state::batman2_modify_spritecode; } TILE_GET_INFO_MEMBER(galaxold_state::dambustr_get_tile_info2) @@ -824,12 +764,12 @@ TILE_GET_INFO_MEMBER(galaxold_state::dambustr_get_tile_info2) if (m_modify_charcode) { - (*m_modify_charcode)(machine(), &code, x); + (this->*m_modify_charcode)(&code, x); } if (m_modify_color) { - (*m_modify_color)(&color); + (this->*m_modify_color)(&color); } SET_TILE_INFO_MEMBER(0, code, color, 0); @@ -845,12 +785,12 @@ VIDEO_START_MEMBER(galaxold_state,dambustr) m_dambustr_bg_priority = 0; m_dambustr_char_bank = 0; - m_draw_background = dambustr_draw_background; + m_draw_background = &galaxold_state::dambustr_draw_background; - m_modify_charcode = dambustr_modify_charcode; - m_modify_spritecode = dambustr_modify_spritecode; + m_modify_charcode = &galaxold_state::dambustr_modify_charcode; + m_modify_spritecode = &galaxold_state::dambustr_modify_spritecode; - m_draw_bullets = dambustr_draw_bullets; + m_draw_bullets = &galaxold_state::dambustr_draw_bullets; /* allocate the temporary bitmap for the background priority */ m_dambustr_tmpbitmap = auto_bitmap_ind16_alloc(machine(), machine().primary_screen->width(), machine().primary_screen->height()); @@ -891,7 +831,7 @@ WRITE8_MEMBER(galaxold_state::galaxold_attributesram_w) { if (m_modify_ypos) { - (*m_modify_ypos)(&data); + (this->*m_modify_ypos)(&data); } m_bg_tilemap->set_scrolly(offset >> 1, data); @@ -1036,43 +976,39 @@ WRITE8_MEMBER(galaxold_state::dambustr_bg_color_w) /* character banking functions */ -static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) +void galaxold_state::mooncrst_modify_charcode(UINT16 *code, UINT8 x) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_gfxbank[2] && ((*code & 0xc0) == 0x80)) + if (m_gfxbank[2] && ((*code & 0xc0) == 0x80)) { - *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100; + *code = (*code & 0x3f) | (m_gfxbank[0] << 6) | (m_gfxbank[1] << 7) | 0x0100; } } -static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) +void galaxold_state::pisces_modify_charcode(UINT16 *code, UINT8 x) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - *code |= (state->m_gfxbank[0] << 8); + *code |= (m_gfxbank[0] << 8); } -static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) +void galaxold_state::mimonkey_modify_charcode(UINT16 *code, UINT8 x) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - *code |= (state->m_gfxbank[0] << 8) | (state->m_gfxbank[2] << 9); + *code |= (m_gfxbank[0] << 8) | (m_gfxbank[2] << 9); } -static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) +void galaxold_state::mariner_modify_charcode(UINT16 *code, UINT8 x) { UINT8 *prom; /* bit 0 of the PROM controls character banking */ - prom = machine.root_device().memregion("user2")->base(); + prom = machine().root_device().memregion("user2")->base(); *code |= ((prom[x] & 0x01) << 8); } -static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) +void galaxold_state::dambustr_modify_charcode(UINT16 *code, UINT8 x) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_dambustr_char_bank == 0) { // text mode + if (m_dambustr_char_bank == 0) { // text mode *code |= 0x0300; } else { // graphics mode @@ -1087,39 +1023,38 @@ static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UIN /* sprite banking functions */ -static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::mshuttle_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { *code |= ((spriteram[offs + 2] & 0x30) << 2); } -static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::mimonkey_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - *code |= (state->m_gfxbank[0] << 6) | (state->m_gfxbank[2] << 7); + *code |= (m_gfxbank[0] << 6) | (m_gfxbank[2] << 7); } -static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::batman2_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { /* only the upper 64 sprites are used */ *code |= 0x40; } -static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::dkongjrm_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { /* No x flip */ *code = (spriteram[offs + 1] & 0x7f) | 0x80; *flipx = 0; } -static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::ad2083_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { /* No x flip */ *code = (spriteram[offs + 1] & 0x7f) | ((spriteram[offs + 2] & 0x30) << 2); *flipx = 0; } -static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::dambustr_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { *code += 0x40; } @@ -1127,7 +1062,7 @@ static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spritera /* color PROM mapping functions */ -static void drivfrcg_modify_color(UINT8 *color) +void galaxold_state::drivfrcg_modify_color(UINT8 *color) { *color = ((*color & 0x40) >> 3) | (*color & 7); } @@ -1137,7 +1072,7 @@ static void drivfrcg_modify_color(UINT8 *color) /* bullet drawing functions */ -static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxold_state::galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { int i; @@ -1152,42 +1087,39 @@ static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap /* yellow missile, white shells (this is the terminology on the schematics) */ - color = ((offs == 7*4) ? BULLETS_COLOR_BASE_LEGACY : BULLETS_COLOR_BASE_LEGACY + 1); + color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); bitmap.pix16(y, x) = color; } } } -static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxold_state::scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_flipscreen_x) x++; + if (m_flipscreen_x) x++; x = x - 6; if (cliprect.contains(x, y)) /* yellow bullets */ - bitmap.pix16(y, x) = BULLETS_COLOR_BASE_LEGACY; + bitmap.pix16(y, x) = BULLETS_COLOR_BASE; } -static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_flipscreen_x) x++; + if (m_flipscreen_x) x++; x = x - 6; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 32 + state->m_darkplnt_bullet_color; + bitmap.pix16(y, x) = 32 + m_darkplnt_bullet_color; } -static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) +void galaxold_state::dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - galaxold_state *state = machine.driver_data<galaxold_state>(); int i, color; - if (state->flip_screen_x()) x++; + if (flip_screen_x()) x++; x = x - 6; @@ -1196,11 +1128,11 @@ static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap { if (offs < 4*4) { - color = BULLETS_COLOR_BASE_LEGACY; + color = BULLETS_COLOR_BASE; y--; } else { - color = BULLETS_COLOR_BASE_LEGACY + 1; + color = BULLETS_COLOR_BASE + 1; x--; } @@ -1213,35 +1145,32 @@ static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap /* background drawing functions */ -static void galaxold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::galaxold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* plain black background */ bitmap.fill(0, cliprect); } -static void scrambold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::scrambold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_background_enable) - bitmap.fill(BACKGROUND_COLOR_BASE_LEGACY, cliprect); + if (m_background_enable) + bitmap.fill(BACKGROUND_COLOR_BASE, cliprect); else bitmap.fill(0, cliprect); } -static void ad2083_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::ad2083_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - int color = (state->m_background_blue << 2) | (state->m_background_green << 1) | state->m_background_red; + int color = (m_background_blue << 2) | (m_background_green << 1) | m_background_red; - bitmap.fill(BACKGROUND_COLOR_BASE_LEGACY + color, cliprect); + bitmap.fill(BACKGROUND_COLOR_BASE + color, cliprect); } -static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::stratgyx_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); UINT8 x; UINT8 *prom; - int base = BACKGROUND_COLOR_BASE_LEGACY; + int base = BACKGROUND_COLOR_BASE; /* the background PROM is connected the following way: @@ -1251,7 +1180,7 @@ static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bit the green gun if BCG is asserted bits 2-7 are unconnected */ - prom = state->memregion("user1")->base(); + prom = memregion("user1")->base(); for (x = 0; x < 32; x++) { @@ -1260,11 +1189,11 @@ static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bit color = 0; - if ((~prom[x] & 0x02) && state->m_background_red) color |= 0x01; - if ((~prom[x] & 0x02) && state->m_background_green) color |= 0x02; - if ((~prom[x] & 0x01) && state->m_background_blue) color |= 0x04; + if ((~prom[x] & 0x02) && m_background_red) color |= 0x01; + if ((~prom[x] & 0x02) && m_background_green) color |= 0x02; + if ((~prom[x] & 0x01) && m_background_blue) color |= 0x04; - if (state->m_flipscreen_x) + if (m_flipscreen_x) sx = 8 * (31 - x); else sx = 8 * x; @@ -1273,12 +1202,11 @@ static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bit } } -static void minefld_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::minefld_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_background_enable) + if (m_background_enable) { - int base = BACKGROUND_COLOR_BASE_LEGACY; + int base = BACKGROUND_COLOR_BASE; int x; @@ -1294,12 +1222,11 @@ static void minefld_draw_background(running_machine &machine, bitmap_ind16 &bitm bitmap.fill(0, cliprect); } -static void rescue_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::rescue_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->m_background_enable) + if (m_background_enable) { - int base = BACKGROUND_COLOR_BASE_LEGACY; + int base = BACKGROUND_COLOR_BASE; int x; for (x = 0; x < 128; x++) @@ -1314,10 +1241,9 @@ static void rescue_draw_background(running_machine &machine, bitmap_ind16 &bitma bitmap.fill(0, cliprect); } -static void mariner_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::mariner_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - int base = BACKGROUND_COLOR_BASE_LEGACY; + int base = BACKGROUND_COLOR_BASE; UINT8 x; UINT8 *prom; @@ -1326,9 +1252,9 @@ static void mariner_draw_background(running_machine &machine, bitmap_ind16 &bitm line (column) of the screen. The first 0x20 bytes for unflipped, and the 2nd 0x20 bytes for flipped screen. */ - prom = state->memregion("user1")->base(); + prom = memregion("user1")->base(); - if (state->m_flipscreen_x) + if (m_flipscreen_x) { for (x = 0; x < 32; x++) { @@ -1358,39 +1284,37 @@ static void mariner_draw_background(running_machine &machine, bitmap_ind16 &bitm } } -static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::dambustr_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - int base = BACKGROUND_COLOR_BASE_LEGACY; - int col1 = base + state->m_dambustr_bg_color_1; - int col2 = base + state->m_dambustr_bg_color_2; + int base = BACKGROUND_COLOR_BASE; + int col1 = base + m_dambustr_bg_color_1; + int col2 = base + m_dambustr_bg_color_2; - if (state->flip_screen_x()) + if (flip_screen_x()) { - bitmap.plot_box( 0, 0, 256-state->m_dambustr_bg_split_line, 256, col2); - bitmap.plot_box(256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col1); + bitmap.plot_box( 0, 0, 256-m_dambustr_bg_split_line, 256, col2); + bitmap.plot_box(256-m_dambustr_bg_split_line, 0, m_dambustr_bg_split_line, 256, col1); } else { - bitmap.plot_box( 0, 0, 256-state->m_dambustr_bg_split_line, 256, col1); - bitmap.plot_box(256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col2); + bitmap.plot_box( 0, 0, 256-m_dambustr_bg_split_line, 256, col1); + bitmap.plot_box(256-m_dambustr_bg_split_line, 0, m_dambustr_bg_split_line, 256, col2); } } -static void dambustr_draw_upper_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::dambustr_draw_upper_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - if (state->flip_screen_x()) + if (flip_screen_x()) { - rectangle clip(254 - state->m_dambustr_bg_split_line, state->m_dambustr_bg_split_line, 0, 255); - copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); + rectangle clip(254 - m_dambustr_bg_split_line, m_dambustr_bg_split_line, 0, 255); + copybitmap(bitmap, *m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); } else { - rectangle clip(0, 254 - state->m_dambustr_bg_split_line, 0, 255); - copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); + rectangle clip(0, 254 - m_dambustr_bg_split_line, 0, 255); + copybitmap(bitmap, *m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); } } @@ -1398,22 +1322,21 @@ static void dambustr_draw_upper_background(running_machine &machine, bitmap_ind1 /* star drawing functions */ -void galaxold_init_stars(running_machine &machine, int colors_offset) +void galaxold_state::galaxold_init_stars(int colors_offset) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - struct star *stars = state->m_stars; + struct star *stars = m_stars; int i; int total_stars; UINT32 generator; int x,y; - state->m_stars_on = 0; - state->m_stars_blink_state = 0; - state->m_stars_blink_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_blink_callback),state)); - state->m_stars_scroll_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_scroll_callback),state)); - state->m_timer_adjusted = 0; - state->m_stars_colors_start = colors_offset; + m_stars_on = 0; + m_stars_blink_state = 0; + m_stars_blink_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_blink_callback),this)); + m_stars_scroll_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_scroll_callback),this)); + m_timer_adjusted = 0; + m_stars_colors_start = colors_offset; for (i = 0;i < 64;i++) { @@ -1427,7 +1350,7 @@ void galaxold_init_stars(running_machine &machine, int colors_offset) g = map[bits]; bits = (i >> 4) & 0x03; b = map[bits]; - palette_set_color_rgb(machine,colors_offset+i,r,g,b); + palette_set_color_rgb(machine(),colors_offset+i,r,g,b); } @@ -1471,33 +1394,32 @@ void galaxold_init_stars(running_machine &machine, int colors_offset) } } -static void plot_star(galaxold_state *state, bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect) +void galaxold_state::plot_star(bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect) { - if (state->m_flipscreen_x) + if (m_flipscreen_x) x = 255 - x; - if (state->m_flipscreen_y) + if (m_flipscreen_y) y = 255 - y; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = state->m_stars_colors_start + color; + bitmap.pix16(y, x) = m_stars_colors_start + color; } -static void noop_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) { } -void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::galaxold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - struct star *stars = state->m_stars; + struct star *stars = m_stars; int offs; - if (!state->m_timer_adjusted) + if (!m_timer_adjusted) { - start_stars_scroll_timer(machine); - state->m_timer_adjusted = 1; + start_stars_scroll_timer(); + m_timer_adjusted = 1; } @@ -1506,27 +1428,26 @@ void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const r int x,y; - x = ((stars[offs].x + state->m_stars_scrollpos) & 0x01ff) >> 1; - y = ( stars[offs].y + ((state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; + x = ((stars[offs].x + m_stars_scrollpos) & 0x01ff) >> 1; + y = ( stars[offs].y + ((m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; if ((y & 0x01) ^ ((x >> 3) & 0x01)) { - plot_star(state, bitmap, x, y, stars[offs].color, cliprect); + plot_star(bitmap, x, y, stars[offs].color, cliprect); } } } -static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::scrambold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - struct star *stars = state->m_stars; + struct star *stars = m_stars; int offs; - if (!state->m_timer_adjusted) + if (!m_timer_adjusted) { - start_stars_blink_timer(machine, 100000, 10000, 0.00001); - state->m_timer_adjusted = 1; + start_stars_blink_timer(100000, 10000, 0.00001); + m_timer_adjusted = 1; } @@ -1541,7 +1462,7 @@ static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, if ((y & 0x01) ^ ((x >> 3) & 0x01)) { /* determine when to skip plotting */ - switch (state->m_stars_blink_state & 0x03) + switch (m_stars_blink_state & 0x03) { case 0: if (!(stars[offs].color & 0x01)) continue; @@ -1557,24 +1478,23 @@ static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, break; } - plot_star(state, bitmap, x, y, stars[offs].color, cliprect); + plot_star(bitmap, x, y, stars[offs].color, cliprect); } } } -static void rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::rescue_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - struct star *stars = state->m_stars; + struct star *stars = m_stars; int offs; /* same as Scramble, but only top (left) half of screen */ - if (!state->m_timer_adjusted) + if (!m_timer_adjusted) { - start_stars_blink_timer(machine, 100000, 10000, 0.00001); - state->m_timer_adjusted = 1; + start_stars_blink_timer(100000, 10000, 0.00001); + m_timer_adjusted = 1; } @@ -1589,7 +1509,7 @@ static void rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, co if ((x < 128) && ((y & 0x01) ^ ((x >> 3) & 0x01))) { /* determine when to skip plotting */ - switch (state->m_stars_blink_state & 0x03) + switch (m_stars_blink_state & 0x03) { case 0: if (!(stars[offs].color & 0x01)) continue; @@ -1605,43 +1525,42 @@ static void rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, co break; } - plot_star(state, bitmap, x, y, stars[offs].color, cliprect); + plot_star(bitmap, x, y, stars[offs].color, cliprect); } } } -static void mariner_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::mariner_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - struct star *stars = state->m_stars; + struct star *stars = m_stars; int offs; UINT8 *prom; - if (!state->m_timer_adjusted) + if (!m_timer_adjusted) { - start_stars_scroll_timer(machine); - state->m_timer_adjusted = 1; + start_stars_scroll_timer(); + m_timer_adjusted = 1; } /* bit 2 of the PROM controls star visibility */ - prom = machine.root_device().memregion("user2")->base(); + prom = machine().root_device().memregion("user2")->base(); for (offs = 0;offs < STAR_COUNT;offs++) { int x,y; - x = ((stars[offs].x + -state->m_stars_scrollpos) & 0x01ff) >> 1; - y = ( stars[offs].y + ((-state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; + x = ((stars[offs].x + -m_stars_scrollpos) & 0x01ff) >> 1; + y = ( stars[offs].y + ((-m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; if ((y & 0x01) ^ ((x >> 3) & 0x01)) { if (prom[(x/8 + 1) & 0x1f] & 0x04) { - plot_star(state, bitmap, x, y, stars[offs].color, cliprect); + plot_star(bitmap, x, y, stars[offs].color, cliprect); } } } @@ -1652,14 +1571,13 @@ TIMER_CALLBACK_MEMBER(galaxold_state::stars_blink_callback) m_stars_blink_state++; } -static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c) +void galaxold_state::start_stars_blink_timer(double ra, double rb, double c) { - galaxold_state *state = machine.driver_data<galaxold_state>(); /* calculate the period using the formula given in the 555 datasheet */ int period_in_ms = 693 * (ra + 2.0 * rb) * c; - state->m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); + m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); } @@ -1671,10 +1589,9 @@ TIMER_CALLBACK_MEMBER(galaxold_state::stars_scroll_callback) } } -static void start_stars_scroll_timer(running_machine &machine) +void galaxold_state::start_stars_scroll_timer() { - galaxold_state *state = machine.driver_data<galaxold_state>(); - state->m_stars_scroll_timer->adjust(machine.primary_screen->frame_period(), 0, machine.primary_screen->frame_period()); + m_stars_scroll_timer->adjust(machine().primary_screen->frame_period(), 0, machine().primary_screen->frame_period()); } @@ -1688,12 +1605,12 @@ TILE_GET_INFO_MEMBER(galaxold_state::get_tile_info) if (m_modify_charcode) { - (*m_modify_charcode)(machine(), &code, x); + (this->*m_modify_charcode)(&code, x); } if (m_modify_color) { - (*m_modify_color)(&color); + (this->*m_modify_color)(&color); } SET_TILE_INFO_MEMBER(0, code, color, 0); @@ -1705,32 +1622,30 @@ TILE_GET_INFO_MEMBER(galaxold_state::rockclim_get_tile_info) SET_TILE_INFO_MEMBER(2, code, 0, 0); } -static void draw_bullets_common(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galaxold_state::draw_bullets_common(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galaxold_state *state = machine.driver_data<galaxold_state>(); int offs; - for (offs = 0;offs < state->m_bulletsram.bytes();offs += 4) + for (offs = 0;offs < m_bulletsram.bytes();offs += 4) { UINT8 sx,sy; - sy = 255 - state->m_bulletsram[offs + 1]; - sx = 255 - state->m_bulletsram[offs + 3]; + sy = 255 - m_bulletsram[offs + 1]; + sx = 255 - m_bulletsram[offs + 3]; - if (state->m_flipscreen_y) sy = 255 - sy; + if (m_flipscreen_y) sy = 255 - sy; - (*state->m_draw_bullets)(machine, bitmap, cliprect, offs, sx, sy); + (this->*m_draw_bullets)(bitmap, cliprect, offs, sx, sy); } } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size) +void galaxold_state::draw_sprites(bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size) { const rectangle spritevisiblearea(2*8+1, 32*8-1, 2*8, 30*8-1); const rectangle spritevisibleareaflipx(0*8, 30*8-2, 2*8, 30*8-1); - galaxold_state *state = machine.driver_data<galaxold_state>(); int offs; @@ -1745,30 +1660,30 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, UINT8 * flipx = spriteram[offs + 1] & 0x40; flipy = spriteram[offs + 1] & 0x80; code = spriteram[offs + 1] & 0x3f; - color = spriteram[offs + 2] & state->m_color_mask; + color = spriteram[offs + 2] & m_color_mask; - if (state->m_modify_spritecode) + if (m_modify_spritecode) { - (*state->m_modify_spritecode)(machine, spriteram, &code, &flipx, &flipy, offs); + (this->*m_modify_spritecode)(spriteram, &code, &flipx, &flipy, offs); } - if (state->m_modify_color) + if (m_modify_color) { - (*state->m_modify_color)(&color); + (this->*m_modify_color)(&color); } - if (state->m_modify_ypos) + if (m_modify_ypos) { - (*state->m_modify_ypos)(&sy); + (this->*m_modify_ypos)(&sy); } - if (state->m_flipscreen_x) + if (m_flipscreen_x) { sx = 240 - sx; flipx = !flipx; } - if (state->m_flipscreen_y) + if (m_flipscreen_y) { flipy = !flipy; } @@ -1786,7 +1701,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, UINT8 * if (offs < 3*4) sy++; - drawgfx_transpen(bitmap, state->m_flipscreen_x ? spritevisibleareaflipx : spritevisiblearea, machine.gfx[1], + drawgfx_transpen(bitmap, m_flipscreen_x ? spritevisibleareaflipx : spritevisiblearea, machine().gfx[1], code,color, flipx,flipy, sx,sy,0); @@ -1796,11 +1711,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, UINT8 * UINT32 galaxold_state::screen_update_galaxold(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - (*m_draw_background)(machine(), bitmap, cliprect); + (this->*m_draw_background)(bitmap, cliprect); if (m_stars_on) { - (*m_draw_stars)(machine(), bitmap, cliprect); + (this->*m_draw_stars)(bitmap, cliprect); } @@ -1808,15 +1723,15 @@ UINT32 galaxold_state::screen_update_galaxold(screen_device &screen, bitmap_ind1 if (m_draw_bullets) { - draw_bullets_common(machine(), bitmap, cliprect); + draw_bullets_common(bitmap, cliprect); } - draw_sprites(machine(), bitmap, m_spriteram, m_spriteram.bytes()); + draw_sprites(bitmap, m_spriteram, m_spriteram.bytes()); if (m_spriteram2_present) { - draw_sprites(machine(), bitmap, m_spriteram2, m_spriteram2.bytes()); + draw_sprites(bitmap, m_spriteram2, m_spriteram2.bytes()); } return 0; } @@ -1827,11 +1742,11 @@ UINT32 galaxold_state::screen_update_dambustr(screen_device &screen, bitmap_ind1 int i, j; UINT8 color; - (*m_draw_background)(machine(), bitmap, cliprect); + (this->*m_draw_background)(bitmap, cliprect); if (m_stars_on) { - (*m_draw_stars)(machine(), bitmap, cliprect); + (this->*m_draw_stars)(bitmap, cliprect); } /* save the background for drawing it again later, if background has priority over characters */ @@ -1841,15 +1756,15 @@ UINT32 galaxold_state::screen_update_dambustr(screen_device &screen, bitmap_ind1 if (m_draw_bullets) { - draw_bullets_common(machine(), bitmap, cliprect); + draw_bullets_common(bitmap, cliprect); } - draw_sprites(machine(), bitmap, m_spriteram, m_spriteram.bytes()); + draw_sprites(bitmap, m_spriteram, m_spriteram.bytes()); if (m_dambustr_bg_priority) { /* draw the upper part of the background, as it has priority */ - dambustr_draw_upper_background(machine(), bitmap, cliprect); + dambustr_draw_upper_background(bitmap, cliprect); /* only rows with color code > 3 are stronger than the background */ memset(m_dambustr_videoram2, 0x20, 0x0400); @@ -1867,22 +1782,20 @@ UINT32 galaxold_state::screen_update_dambustr(screen_device &screen, bitmap_ind1 return 0; } -static void bagmanmc_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) +void galaxold_state::bagmanmc_modify_charcode(UINT16 *code, UINT8 x) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - *code |= (state->m_gfxbank[0] << 9); + *code |= (m_gfxbank[0] << 9); } -static void bagmanmc_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) +void galaxold_state::bagmanmc_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - galaxold_state *state = machine.driver_data<galaxold_state>(); - *code |= (state->m_gfxbank[0] << 7) | 0x40; + *code |= (m_gfxbank[0] << 7) | 0x40; } VIDEO_START_MEMBER(galaxold_state,bagmanmc) { VIDEO_START_CALL_MEMBER(galaxold); - m_modify_charcode = bagmanmc_modify_charcode; - m_modify_spritecode = bagmanmc_modify_spritecode; + m_modify_charcode = &galaxold_state::bagmanmc_modify_charcode; + m_modify_spritecode = &galaxold_state::bagmanmc_modify_spritecode; } diff --git a/src/mame/video/galivan.c b/src/mame/video/galivan.c index 4c9bf898d95..ba3d3ec9114 100644 --- a/src/mame/video/galivan.c +++ b/src/mame/video/galivan.c @@ -294,15 +294,14 @@ WRITE8_MEMBER(galivan_state::galivan_scrolly_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void galivan_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - galivan_state *state = machine.driver_data<galivan_state>(); - const UINT8 *spritepalettebank = state->memregion("user1")->base(); - UINT8 *spriteram = state->m_spriteram; + const UINT8 *spritepalettebank = memregion("user1")->base(); + UINT8 *spriteram = m_spriteram; int offs; /* draw the sprites */ - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { int code; int attr = spriteram[offs + 2]; @@ -313,7 +312,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const sx = (spriteram[offs + 3] - 0x80) + 256 * (attr & 0x01); sy = 240 - spriteram[offs]; - if (state->m_flipscreen) + if (m_flipscreen) { sx = 240 - sx; sy = 240 - sy; @@ -324,7 +323,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const // code = spriteram[offs + 1] + ((attr & 0x02) << 7); code = spriteram[offs + 1] + ((attr & 0x06) << 7); // for ninjemak, not sure ? - drawgfx_transpen(bitmap,cliprect,machine.gfx[2], + drawgfx_transpen(bitmap,cliprect,machine().gfx[2], code, color + 16 * (spritepalettebank[code >> 2] & 0x0f), flipx,flipy, @@ -347,11 +346,11 @@ UINT32 galivan_state::screen_update_galivan(screen_device &screen, bitmap_ind16 { m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 1, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); } else { - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 1, 0); } @@ -370,7 +369,7 @@ UINT32 galivan_state::screen_update_ninjemak(screen_device &screen, bitmap_ind16 else m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_tx_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } diff --git a/src/mame/video/galpanic.c b/src/mame/video/galpanic.c index f05b0b6e950..b0471a20e96 100644 --- a/src/mame/video/galpanic.c +++ b/src/mame/video/galpanic.c @@ -45,14 +45,13 @@ WRITE16_HANDLER( galpanic_paletteram_w ) } -static void comad_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galpanic_state::comad_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galpanic_state *state = machine.driver_data<galpanic_state>(); - UINT16 *spriteram16 = state->m_spriteram; + UINT16 *spriteram16 = m_spriteram; int offs; int sx=0, sy=0; - for (offs = 0;offs < state->m_spriteram.bytes()/2;offs += 4) + for (offs = 0;offs < m_spriteram.bytes()/2;offs += 4) { int code,color,flipx,flipy; @@ -75,7 +74,7 @@ static void comad_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, c sx = (sx&0x1ff) - (sx&0x200); sy = (sy&0x1ff) - (sy&0x200); - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], code, color, flipx,flipy, @@ -83,18 +82,17 @@ static void comad_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, c } } -static void draw_fgbitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - galpanic_state *state = machine.driver_data<galpanic_state>(); int offs; - for (offs = 0;offs < state->m_fgvideoram.bytes()/2;offs++) + for (offs = 0;offs < m_fgvideoram.bytes()/2;offs++) { int sx,sy,color; sx = offs % 256; sy = offs / 256; - color = state->m_fgvideoram[offs]; + color = m_fgvideoram[offs]; if (color) bitmap.pix16(sy, sx) = color; } @@ -107,7 +105,7 @@ UINT32 galpanic_state::screen_update_galpanic(screen_device &screen, bitmap_ind1 /* copy the temporary bitmap to the screen */ copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect); - draw_fgbitmap(machine(), bitmap, cliprect); + draw_fgbitmap(bitmap, cliprect); pandora_update(pandora, bitmap, cliprect); @@ -119,13 +117,13 @@ UINT32 galpanic_state::screen_update_comad(screen_device &screen, bitmap_ind16 & /* copy the temporary bitmap to the screen */ copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect); - draw_fgbitmap(machine(), bitmap, cliprect); + draw_fgbitmap(bitmap, cliprect); // if(galpanic_clear_sprites) { m_sprites_bitmap.fill(0, cliprect); - comad_draw_sprites(machine(),bitmap,cliprect); + comad_draw_sprites(bitmap,cliprect); } // else // { diff --git a/src/mame/video/galspnbl.c b/src/mame/video/galspnbl.c index 1f012c361f7..21cfa32b883 100644 --- a/src/mame/video/galspnbl.c +++ b/src/mame/video/galspnbl.c @@ -13,19 +13,18 @@ void galspnbl_state::palette_init() -static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void galspnbl_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - galspnbl_state *state = machine.driver_data<galspnbl_state>(); offs_t offs; -// int screenscroll = 4 - (state->m_scroll[0] & 0xff); +// int screenscroll = 4 - (m_scroll[0] & 0xff); for (offs = 0; offs < 0x20000; offs++) { int y = offs >> 9; int x = offs & 0x1ff; - bitmap.pix16(y, x) = 1024 + (state->m_bgvideoram[offs] >> 1); + bitmap.pix16(y, x) = 1024 + (m_bgvideoram[offs] >> 1); } } @@ -34,7 +33,7 @@ UINT32 galspnbl_state::screen_update_galspnbl(screen_device &screen, bitmap_ind1 { int offs; - draw_background(machine(), bitmap, cliprect); + draw_background(bitmap, cliprect); galspnbl_draw_sprites(machine(), bitmap, cliprect, 0, m_spriteram, m_spriteram.bytes()); diff --git a/src/mame/video/gameplan.c b/src/mame/video/gameplan.c index 1f90fcad169..9f7cdaf2104 100644 --- a/src/mame/video/gameplan.c +++ b/src/mame/video/gameplan.c @@ -36,7 +36,7 @@ driver by Chris Moore * *************************************/ -static void gameplan_get_pens( pen_t *pens ) +void gameplan_state::gameplan_get_pens( pen_t *pens ) { offs_t i; @@ -46,7 +46,7 @@ static void gameplan_get_pens( pen_t *pens ) /* RGBI palette. Is it correct, or does it use the standard RGB? */ -static void leprechn_get_pens( pen_t *pens ) +void gameplan_state::leprechn_get_pens( pen_t *pens ) { offs_t i; diff --git a/src/mame/video/gaplus.c b/src/mame/video/gaplus.c index 62522485c3f..541743f9d11 100644 --- a/src/mame/video/gaplus.c +++ b/src/mame/video/gaplus.c @@ -125,18 +125,17 @@ TILE_GET_INFO_MEMBER(gaplus_state::get_tile_info) #define SPEED_2 1.0 #define SPEED_3 2.0 -static void starfield_init(running_machine &machine) +void gaplus_state::starfield_init() { - gaplus_state *state = machine.driver_data<gaplus_state>(); - struct star *stars = state->m_stars; + struct star *stars = m_stars; int generator = 0; int x,y; int set = 0; - int width = machine.primary_screen->width(); - int height = machine.primary_screen->height(); + int width = machine().primary_screen->width(); + int height = machine().primary_screen->height(); - state->m_total_stars = 0; + m_total_stars = 0; /* precalculate the star background */ /* this comes from the Galaxian hardware, Gaplus is probably different */ @@ -155,16 +154,16 @@ static void starfield_init(running_machine &machine) int color; color = (~(generator >> 8)) & 0x3f; - if ( color && state->m_total_stars < MAX_STARS ) { - stars[state->m_total_stars].x = x; - stars[state->m_total_stars].y = y; - stars[state->m_total_stars].col = color; - stars[state->m_total_stars].set = set++; + if ( color && m_total_stars < MAX_STARS ) { + stars[m_total_stars].x = x; + stars[m_total_stars].y = y; + stars[m_total_stars].col = color; + stars[m_total_stars].set = set++; if ( set == 3 ) set = 0; - state->m_total_stars++; + m_total_stars++; } } } @@ -185,7 +184,7 @@ void gaplus_state::video_start() colortable_configure_tilemap_groups(machine().colortable, m_bg_tilemap, machine().gfx[0], 0xff); - starfield_init(machine()); + starfield_init(); } @@ -221,21 +220,20 @@ WRITE8_MEMBER(gaplus_state::gaplus_starfield_control_w) ***************************************************************************/ -static void starfield_render(running_machine &machine, bitmap_ind16 &bitmap) +void gaplus_state::starfield_render(bitmap_ind16 &bitmap) { - gaplus_state *state = machine.driver_data<gaplus_state>(); - struct star *stars = state->m_stars; + struct star *stars = m_stars; int i; - int width = machine.primary_screen->width(); - int height = machine.primary_screen->height(); + int width = machine().primary_screen->width(); + int height = machine().primary_screen->height(); /* check if we're running */ - if ( ( state->m_starfield_control[0] & 1 ) == 0 ) + if ( ( m_starfield_control[0] & 1 ) == 0 ) return; /* draw the starfields */ - for ( i = 0; i < state->m_total_stars; i++ ) + for ( i = 0; i < m_total_stars; i++ ) { int x, y; @@ -249,10 +247,9 @@ static void starfield_render(running_machine &machine, bitmap_ind16 &bitmap) } } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gaplus_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { - gaplus_state *state = machine.driver_data<gaplus_state>(); - UINT8 *spriteram = state->m_spriteram + 0x780; + UINT8 *spriteram = m_spriteram + 0x780; UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800; int offs; @@ -278,7 +275,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r int duplicate = spriteram_3[offs] & 0x80; int x,y; - if (state->flip_screen()) + if (flip_screen()) { flipx ^= 1; flipy ^= 1; @@ -291,12 +288,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r { for (x = 0;x <= sizex;x++) { - drawgfx_transmask(bitmap,cliprect,machine.gfx[1], + drawgfx_transmask(bitmap,cliprect,machine().gfx[1], sprite + (duplicate ? 0 : (gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)])), color, flipx,flipy, sx + 16*x,sy + 16*y, - colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0xff)); + colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0xff)); } } } @@ -310,12 +307,12 @@ UINT32 gaplus_state::screen_update_gaplus(screen_device &screen, bitmap_ind16 &b bitmap.fill(0, cliprect); - starfield_render(machine(), bitmap); + starfield_render(bitmap); /* draw the low priority characters */ m_bg_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); /* draw the high priority characters */ /* (I don't know if this feature is used by Gaplus, but it's shown in the schematics) */ diff --git a/src/mame/video/gberet.c b/src/mame/video/gberet.c index d593b155e3e..b517529c43f 100644 --- a/src/mame/video/gberet.c +++ b/src/mame/video/gberet.c @@ -125,16 +125,15 @@ VIDEO_START_MEMBER(gberet_state,gberet) m_bg_tilemap->set_scroll_rows(32); } -static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gberet_state::gberet_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - gberet_state *state = machine.driver_data<gberet_state>(); int offs; UINT8 *sr; - if (state->m_spritebank & 0x08) - sr = state->m_spriteram2; + if (m_spritebank & 0x08) + sr = m_spriteram2; else - sr = state->m_spriteram; + sr = m_spriteram; for (offs = 0; offs < 0xc0; offs += 4) { @@ -148,7 +147,7 @@ static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, int flipx = attr & 0x10; int flipy = attr & 0x20; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -156,8 +155,8 @@ static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, flipy = !flipy; } - drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, - colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); + drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy, + colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0)); } } } @@ -165,7 +164,7 @@ static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, UINT32 gberet_state::screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); - gberet_draw_sprites(machine(), bitmap, cliprect); + gberet_draw_sprites(bitmap, cliprect); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } @@ -183,13 +182,12 @@ WRITE8_MEMBER(gberet_state::gberetb_scroll_w) m_bg_tilemap->set_scrollx(offset, scroll + 64 - 8); } -static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gberet_state::gberetb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - gberet_state *state = machine.driver_data<gberet_state>(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; - for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) { if (spriteram[offs + 1]) { @@ -201,7 +199,7 @@ static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap int flipx = attr & 0x10; int flipy = attr & 0x20; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -209,8 +207,8 @@ static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap flipy = !flipy; } - drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, - colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); + drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy, + colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0)); } } } @@ -218,7 +216,7 @@ static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap UINT32 gberet_state::screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); - gberetb_draw_sprites(machine(), bitmap, cliprect); + gberetb_draw_sprites(bitmap, cliprect); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } diff --git a/src/mame/video/gcpinbal.c b/src/mame/video/gcpinbal.c index c3086e6f901..7badfa32d81 100644 --- a/src/mame/video/gcpinbal.c +++ b/src/mame/video/gcpinbal.c @@ -40,32 +40,31 @@ TILE_GET_INFO_MEMBER(gcpinbal_state::get_fg_tile_info) 0); } -static void gcpinbal_core_vh_start( running_machine &machine ) +void gcpinbal_state::gcpinbal_core_vh_start( ) { - gcpinbal_state *state = machine.driver_data<gcpinbal_state>(); int xoffs = 0; int yoffs = 0; - state->m_tilemap[0] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg0_tile_info),state),TILEMAP_SCAN_ROWS,16,16,32,32); - state->m_tilemap[1] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg1_tile_info),state),TILEMAP_SCAN_ROWS,16,16,32,32); - state->m_tilemap[2] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_fg_tile_info),state), TILEMAP_SCAN_ROWS,8,8,64,64); + m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg0_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); + m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg1_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); + m_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS,8,8,64,64); - state->m_tilemap[0]->set_transparent_pen(0); - state->m_tilemap[1]->set_transparent_pen(0); - state->m_tilemap[2]->set_transparent_pen(0); + m_tilemap[0]->set_transparent_pen(0); + m_tilemap[1]->set_transparent_pen(0); + m_tilemap[2]->set_transparent_pen(0); /* flipscreen n/a */ - state->m_tilemap[0]->set_scrolldx(-xoffs, 0); - state->m_tilemap[1]->set_scrolldx(-xoffs, 0); - state->m_tilemap[2]->set_scrolldx(-xoffs, 0); - state->m_tilemap[0]->set_scrolldy(-yoffs, 0); - state->m_tilemap[1]->set_scrolldy(-yoffs, 0); - state->m_tilemap[2]->set_scrolldy(-yoffs, 0); + m_tilemap[0]->set_scrolldx(-xoffs, 0); + m_tilemap[1]->set_scrolldx(-xoffs, 0); + m_tilemap[2]->set_scrolldx(-xoffs, 0); + m_tilemap[0]->set_scrolldy(-yoffs, 0); + m_tilemap[1]->set_scrolldy(-yoffs, 0); + m_tilemap[2]->set_scrolldy(-yoffs, 0); } void gcpinbal_state::video_start() { - gcpinbal_core_vh_start(machine()); + gcpinbal_core_vh_start(); } @@ -164,10 +163,9 @@ WRITE16_MEMBER(gcpinbal_state::gcpinbal_ctrl_word_w) ****************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) +void gcpinbal_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) { - gcpinbal_state *state = machine.driver_data<gcpinbal_state>(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int offs, chain_pos; int x, y, curx, cury; int priority = 0; @@ -175,9 +173,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT16 code; /* According to Raine, word in ioc_ram determines sprite/tile priority... */ - priority = (state->m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1; + priority = (m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1; - for (offs = state->m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8) + for (offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8) { code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8); code &= 0x3fff; @@ -204,12 +202,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const for (chain_pos = chain; chain_pos >= 0; chain_pos--) { - pdrawgfx_transpen(bitmap, cliprect,machine.gfx[0], + pdrawgfx_transpen(bitmap, cliprect,machine().gfx[0], code, col, flipx, flipy, curx,cury, - machine.priority_bitmap, + machine().priority_bitmap, priority ? 0xfc : 0xf0,0); code++; @@ -310,7 +308,7 @@ UINT32 gcpinbal_state::screen_update_gcpinbal(screen_device &screen, bitmap_ind1 m_tilemap[layer[2]]->draw(bitmap, cliprect, 0, 4); - draw_sprites(machine(), bitmap, cliprect, 16); + draw_sprites(bitmap, cliprect, 16); #if 0 { diff --git a/src/mame/video/ginganin.c b/src/mame/video/ginganin.c index 84357d0b1ab..b370600c556 100644 --- a/src/mame/video/ginganin.c +++ b/src/mame/video/ginganin.c @@ -203,13 +203,12 @@ Offset: Values: Format: ------------------------------------------------------------------------ */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect ) +void ginganin_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ) { - ginganin_state *state = machine.driver_data<ginganin_state>(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int offs; - for (offs = 0; offs < (state->m_spriteram.bytes() >> 1); offs += 4) + for (offs = 0; offs < (m_spriteram.bytes() >> 1); offs += 4) { int y = spriteram[offs + 0]; int x = spriteram[offs + 1]; @@ -221,7 +220,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const r x = (x & 0xff) - (x & 0x100); y = (y & 0xff) - (y & 0x100); - if (state->m_flipscreen) + if (m_flipscreen) { x = 240 - x; y = 240 - y; @@ -229,7 +228,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const r flipy = !flipy; } - drawgfx_transpen(bitmap,cliprect,machine.gfx[3], + drawgfx_transpen(bitmap,cliprect,machine().gfx[3], code & 0x3fff, attr >> 12, flipx, flipy, @@ -279,7 +278,7 @@ if (machine().input().code_pressed(KEYCODE_Z)) if (layers_ctrl1 & 2) m_fg_tilemap->draw(bitmap, cliprect, 0, 0); if (layers_ctrl1 & 8) - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); if (layers_ctrl1 & 4) m_tx_tilemap->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/gladiatr.c b/src/mame/video/gladiatr.c index 0f071fc8c0c..60e875b8e89 100644 --- a/src/mame/video/gladiatr.c +++ b/src/mame/video/gladiatr.c @@ -189,9 +189,8 @@ WRITE8_MEMBER(gladiatr_state::gladiatr_video_registers_w) ***************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void gladiatr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - gladiatr_state *state = machine.driver_data<gladiatr_state>(); int offs; for (offs = 0;offs < 0x80;offs += 2) @@ -201,10 +200,10 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r {0x0,0x1}, {0x2,0x3}, }; - UINT8 *src = &state->m_spriteram[offs + (state->m_sprite_buffer << 7)]; + UINT8 *src = &m_spriteram[offs + (m_sprite_buffer << 7)]; int attributes = src[0x800]; int size = (attributes & 0x10) >> 4; - int bank = (attributes & 0x01) + ((attributes & 0x02) ? state->m_sprite_bank : 0); + int bank = (attributes & 0x01) + ((attributes & 0x02) ? m_sprite_bank : 0); int tile_number = (src[0]+256*bank); int sx = src[0x400+1] + 256*(src[0x801]&1) - 0x38; int sy = 240 - src[0x400] - (size ? 16 : 0); @@ -213,7 +212,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r int color = src[1] & 0x1f; int x,y; - if (state->flip_screen()) + if (flip_screen()) { xflip = !xflip; yflip = !yflip; @@ -228,7 +227,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r int t = tile_offset[ey][ex] + tile_number; - drawgfx_transpen(bitmap,cliprect,machine.gfx[2], + drawgfx_transpen(bitmap,cliprect,machine().gfx[2], t, color, xflip, yflip, @@ -243,7 +242,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r UINT32 gladiatr_state::screen_update_ppking(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); /* the fg layer just selects the upper palette bank on underlying pixels */ { @@ -290,7 +289,7 @@ UINT32 gladiatr_state::screen_update_gladiatr(screen_device &screen, bitmap_ind1 m_fg_tilemap->set_scrolly(0, m_fg_scrolly); 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); } else diff --git a/src/mame/video/glass.c b/src/mame/video/glass.c index 59e9349d7ad..e186bfcba06 100644 --- a/src/mame/video/glass.c +++ b/src/mame/video/glass.c @@ -159,19 +159,18 @@ void glass_state::video_start() 3 | xxxxxxxx xxxxxxxx | sprite code */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void glass_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - glass_state *state = machine.driver_data<glass_state>(); int i; - gfx_element *gfx = machine.gfx[0]; + gfx_element *gfx = machine().gfx[0]; for (i = 3; i < (0x1000 - 6) / 2; i += 4) { - int sx = state->m_spriteram[i + 2] & 0x01ff; - int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff; - int number = state->m_spriteram[i + 3]; - int color = (state->m_spriteram[i + 2] & 0x1e00) >> 9; - int attr = (state->m_spriteram[i] & 0xfe00) >> 9; + int sx = m_spriteram[i + 2] & 0x01ff; + int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff; + int number = m_spriteram[i + 3]; + int color = (m_spriteram[i + 2] & 0x1e00) >> 9; + int attr = (m_spriteram[i] & 0xfe00) >> 9; int xflip = attr & 0x20; int yflip = attr & 0x40; @@ -203,6 +202,6 @@ UINT32 glass_state::screen_update_glass(screen_device &screen, bitmap_ind16 &bit copybitmap(bitmap, *m_screen_bitmap, 0, 0, 0x18, 0x24, cliprect); m_pant[1]->draw(bitmap, cliprect, 0, 0); m_pant[0]->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/gng.c b/src/mame/video/gng.c index d0ec7b8fc7d..2633d17e172 100644 --- a/src/mame/video/gng.c +++ b/src/mame/video/gng.c @@ -101,15 +101,14 @@ WRITE8_MEMBER(gng_state::gng_flipscreen_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gng_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - gng_state *state = machine.driver_data<gng_state>(); - UINT8 *buffered_spriteram = state->m_spriteram->buffer(); - gfx_element *gfx = machine.gfx[2]; + UINT8 *buffered_spriteram = m_spriteram->buffer(); + gfx_element *gfx = machine().gfx[2]; int offs; - for (offs = state->m_spriteram->bytes() - 4; offs >= 0; offs -= 4) + for (offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4) { UINT8 attributes = buffered_spriteram[offs + 1]; int sx = buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01); @@ -117,7 +116,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int flipx = attributes & 0x04; int flipy = attributes & 0x08; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -136,7 +135,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 gng_state::screen_update_gng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; diff --git a/src/mame/video/goal92.c b/src/mame/video/goal92.c index 007dffc4fc4..7e4073949cd 100644 --- a/src/mame/video/goal92.c +++ b/src/mame/video/goal92.c @@ -84,10 +84,9 @@ TILE_GET_INFO_MEMBER(goal92_state::get_fore_tile_info) SET_TILE_INFO_MEMBER(region, tile, color, 0); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) +void goal92_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) { - goal92_state *state = machine.driver_data<goal92_state>(); - UINT16 *buffered_spriteram16 = state->m_buffered_spriteram; + UINT16 *buffered_spriteram16 = m_buffered_spriteram; int offs, fx, fy, x, y, color, sprite; for (offs = 3; offs <= 0x400 - 5; offs += 4) @@ -122,7 +121,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const y = 256 - (y + 7); - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + drawgfx_transpen(bitmap,cliprect,machine().gfx[0], sprite, color,fx,fy,x,y,15); } @@ -162,18 +161,18 @@ UINT32 goal92_state::screen_update_goal92(screen_device &screen, bitmap_ind16 &b bitmap.fill(get_black_pen(machine()), cliprect); m_bg_layer->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect, 2); + draw_sprites(bitmap, cliprect, 2); if (!(m_fg_bank & 0xff)) - draw_sprites(machine(), bitmap, cliprect, 1); + draw_sprites(bitmap, cliprect, 1); m_fg_layer->draw(bitmap, cliprect, 0, 0); if(m_fg_bank & 0xff) - draw_sprites(machine(), bitmap, cliprect, 1); + draw_sprites(bitmap, cliprect, 1); - draw_sprites(machine(), bitmap, cliprect, 0); - draw_sprites(machine(), bitmap, cliprect, 3); + draw_sprites(bitmap, cliprect, 0); + draw_sprites(bitmap, cliprect, 3); m_tx_layer->draw(bitmap, cliprect, 0, 0); return 0; } diff --git a/src/mame/video/goindol.c b/src/mame/video/goindol.c index ae3352cfb02..db5d7821bd6 100644 --- a/src/mame/video/goindol.c +++ b/src/mame/video/goindol.c @@ -80,17 +80,16 @@ WRITE8_MEMBER(goindol_state::goindol_bg_videoram_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram ) +void goindol_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram ) { - goindol_state *state = machine.driver_data<goindol_state>(); int offs, sx, sy, tile, palette; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { sx = sprite_ram[offs]; sy = 240 - sprite_ram[offs + 1]; - if (state->flip_screen()) + if (flip_screen()) { sx = 248 - sx; sy = 248 - sy; @@ -103,17 +102,17 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const palette = sprite_ram[offs + 2] >> 3; drawgfx_transpen(bitmap,cliprect, - machine.gfx[gfxbank], + machine().gfx[gfxbank], tile, palette, - state->flip_screen(),state->flip_screen(), + flip_screen(),flip_screen(), sx,sy, 0); drawgfx_transpen(bitmap,cliprect, - machine.gfx[gfxbank], + machine().gfx[gfxbank], tile+1, palette, - state->flip_screen(),state->flip_screen(), - sx,sy + (state->flip_screen() ? -8 : 8), 0); + flip_screen(),flip_screen(), + sx,sy + (flip_screen() ? -8 : 8), 0); } } } @@ -125,7 +124,7 @@ UINT32 goindol_state::screen_update_goindol(screen_device &screen, bitmap_ind16 m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect, 1, m_spriteram); - draw_sprites(machine(), bitmap, cliprect, 0, m_spriteram2); + draw_sprites(bitmap, cliprect, 1, m_spriteram); + draw_sprites(bitmap, cliprect, 0, m_spriteram2); return 0; } diff --git a/src/mame/video/gotcha.c b/src/mame/video/gotcha.c index 215e89774e6..46ce0442370 100644 --- a/src/mame/video/gotcha.c +++ b/src/mame/video/gotcha.c @@ -13,23 +13,22 @@ TILEMAP_MAPPER_MEMBER(gotcha_state::gotcha_tilemap_scan) return (col & 0x1f) | (row << 5) | ((col & 0x20) << 5); } -INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs) +inline void gotcha_state::get_tile_info( tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs) { - gotcha_state *state = machine.driver_data<gotcha_state>(); UINT16 data = vram[tile_index]; - int code = (data & 0x3ff) | (state->m_gfxbank[(data & 0x0c00) >> 10] << 10); + int code = (data & 0x3ff) | (m_gfxbank[(data & 0x0c00) >> 10] << 10); - SET_TILE_INFO(0, code, (data >> 12) + color_offs, 0); + SET_TILE_INFO_MEMBER(0, code, (data >> 12) + color_offs, 0); } TILE_GET_INFO_MEMBER(gotcha_state::fg_get_tile_info) { - get_tile_info(machine(), tileinfo, tile_index, m_fgvideoram, 0); + get_tile_info(tileinfo, tile_index, m_fgvideoram, 0); } TILE_GET_INFO_MEMBER(gotcha_state::bg_get_tile_info) { - get_tile_info(machine(), tileinfo, tile_index, m_bgvideoram, 16); + get_tile_info(tileinfo, tile_index, m_bgvideoram, 16); } diff --git a/src/mame/video/gottlieb.c b/src/mame/video/gottlieb.c index 7d7d4279866..a9af5f715dd 100644 --- a/src/mame/video/gottlieb.c +++ b/src/mame/video/gottlieb.c @@ -198,10 +198,9 @@ VIDEO_START_MEMBER(gottlieb_state,screwloo) * *************************************/ -static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void gottlieb_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - gottlieb_state *state = machine.driver_data<gottlieb_state>(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; rectangle clip = cliprect; int offs; @@ -215,15 +214,15 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r /* of level animation. */ int sx = (spriteram[offs + 1]) - 4; int sy = (spriteram[offs]) - 13; - int code = (255 ^ spriteram[offs + 2]) + 256 * state->m_spritebank; + int code = (255 ^ spriteram[offs + 2]) + 256 * m_spritebank; - if (state->flip_screen_x()) sx = 233 - sx; - if (state->flip_screen_y()) sy = 244 - sy; + if (flip_screen_x()) sx = 233 - sx; + if (flip_screen_y()) sy = 244 - sy; drawgfx_transpen(bitmap, clip, - machine.gfx[2], + machine().gfx[2], code, 0, - state->flip_screen_x(), state->flip_screen_y(), + flip_screen_x(), flip_screen_y(), sx,sy, 0); } } @@ -245,7 +244,7 @@ UINT32 gottlieb_state::screen_update_gottlieb(screen_device &screen, bitmap_rgb3 bitmap.fill(machine().pens[0], cliprect); /* draw the sprites */ - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); /* if the background has higher priority, render it now */ if (m_background_priority) diff --git a/src/mame/video/gotya.c b/src/mame/video/gotya.c index a9fc7c3415d..a8e742429ea 100644 --- a/src/mame/video/gotya.c +++ b/src/mame/video/gotya.c @@ -110,12 +110,11 @@ void gotya_state::video_start() m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gotya_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(gotya_state::tilemap_scan_rows_thehand),this), 8, 8, 64, 32); } -static void draw_status_row( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col ) +void gotya_state::draw_status_row( bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col ) { - gotya_state *state = machine.driver_data<gotya_state>(); int row; - if (state->flip_screen()) + if (flip_screen()) { sx = 35 - sx; } @@ -124,24 +123,23 @@ static void draw_status_row( running_machine &machine, bitmap_ind16 &bitmap, con { int sy; - if (state->flip_screen()) + if (flip_screen()) sy = row; else sy = 31 - row; drawgfx_opaque(bitmap,cliprect, - machine.gfx[0], - state->m_videoram2[row * 32 + col], - state->m_videoram2[row * 32 + col + 0x10] & 0x0f, - state->flip_screen_x(), state->flip_screen_y(), + machine().gfx[0], + m_videoram2[row * 32 + col], + m_videoram2[row * 32 + col + 0x10] & 0x0f, + flip_screen_x(), flip_screen_y(), 8 * sx, 8 * sy); } } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gotya_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - gotya_state *state = machine.driver_data<gotya_state>(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; for (offs = 2; offs < 0x0e; offs += 2) @@ -151,32 +149,32 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int sx = 256 - spriteram[offs + 0x10] + (spriteram[offs + 0x01] & 0x01) * 256; int sy = spriteram[offs + 0x00]; - if (state->flip_screen()) + if (flip_screen()) sy = 240 - sy; drawgfx_transpen(bitmap,cliprect, - machine.gfx[1], + machine().gfx[1], code, color, - state->flip_screen_x(), state->flip_screen_y(), + flip_screen_x(), flip_screen_y(), sx, sy, 0); } } -static void draw_status( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gotya_state::draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - draw_status_row(machine, bitmap, cliprect, 0, 1); - draw_status_row(machine, bitmap, cliprect, 1, 0); - draw_status_row(machine, bitmap, cliprect, 2, 2); /* these two are blank, but I dont' know if the data comes */ - draw_status_row(machine, bitmap, cliprect, 33, 13); /* from RAM or 'hardcoded' into the hardware. Likely the latter */ - draw_status_row(machine, bitmap, cliprect, 35, 14); - draw_status_row(machine, bitmap, cliprect, 34, 15); + draw_status_row(bitmap, cliprect, 0, 1); + draw_status_row(bitmap, cliprect, 1, 0); + draw_status_row(bitmap, cliprect, 2, 2); /* these two are blank, but I dont' know if the data comes */ + draw_status_row(bitmap, cliprect, 33, 13); /* from RAM or 'hardcoded' into the hardware. Likely the latter */ + draw_status_row(bitmap, cliprect, 35, 14); + draw_status_row(bitmap, cliprect, 34, 15); } UINT32 gotya_state::screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->set_scrollx(0, -(*m_scroll + (m_scroll_bit_8 * 256)) - 2 * 8); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); - draw_status(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); + draw_status(bitmap, cliprect); return 0; } diff --git a/src/mame/video/grchamp.c b/src/mame/video/grchamp.c index 87173cefc9d..d4f905ab8e6 100644 --- a/src/mame/video/grchamp.c +++ b/src/mame/video/grchamp.c @@ -108,13 +108,13 @@ void grchamp_state::video_start() } #if 0 -static int collision_check(running_machine &machine, grchamp_state *state, bitmap_ind16 &bitmap, int which ) +int grchamp_state::collision_check(grchamp_state *state, bitmap_ind16 &bitmap, int which ) { - int bgcolor = machine.pens[0]; - int sprite_transp = machine.pens[0x24]; - const rectangle &visarea = machine.primary_screen->visible_area(); - int y0 = 240 - state->m_cpu0_out[3]; - int x0 = 256 - state->m_cpu0_out[2]; + int bgcolor = machine().pens[0]; + int sprite_transp = machine().pens[0x24]; + const rectangle &visarea = machine().primary_screen->visible_area(); + int y0 = 240 - m_cpu0_out[3]; + int x0 = 256 - m_cpu0_out[2]; int x,y,sx,sy; int pixel; int result = 0; @@ -122,10 +122,10 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma if( which==0 ) { /* draw the current player sprite into a work bitmap */ - drawgfx_opaque( state->m_work_bitmap, - state->m_work_bitmap.cliprect(), - machine.gfx[4], - state->m_cpu0_out[4]&0xf, + drawgfx_opaque( m_work_bitmap, + m_work_bitmap.cliprect(), + machine().gfx[4], + m_cpu0_out[4]&0xf, 1, /* color */ 0,0, 0,0 ); @@ -135,7 +135,7 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma { for( x = 0; x<32; x++ ) { - pixel = state->m_work_bitmap.pix16(y, x); + pixel = m_work_bitmap.pix16(y, x); if( pixel != sprite_transp ){ sx = x+x0; sy = y+y0; @@ -158,7 +158,7 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma return result?(1<<which):0; } -static void draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect, int fog) +void grchamp_state::draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect, int fog) { int x,y,offs; @@ -175,11 +175,11 @@ static void draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle } } -static void draw_sprites(running_machine &machine, grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect) +void grchamp_state::draw_sprites(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect) { - gfx_element *gfx = machine.gfx[5]; - int bank = (state->m_cpu0_out[0] & 0x20) ? 0x40 : 0x00; - const UINT8 *source = state->m_spriteram + 0x40; + gfx_element *gfx = machine().gfx[5]; + int bank = (m_cpu0_out[0] & 0x20) ? 0x40 : 0x00; + const UINT8 *source = m_spriteram + 0x40; const UINT8 *finish = source + 0x40; while (source < finish) @@ -201,7 +201,7 @@ static void draw_sprites(running_machine &machine, grchamp_state *state, bitmap_ #endif -static void draw_objects(running_machine &machine, grchamp_state *state, int y, UINT8 *objdata) +void grchamp_state::draw_objects(int y, UINT8 *objdata) { /* CPU 5/7: @@ -238,16 +238,16 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y, */ - const UINT8 *prom = machine.root_device().memregion("proms")->base() + 0x20; + const UINT8 *prom = machine().root_device().memregion("proms")->base() + 0x20; gfx_element *gfx; - int change = (state->m_cpu0_out[0] & 0x20) << 3; + int change = (m_cpu0_out[0] & 0x20) << 3; int num; /* first clear to 0; this is done as the previous scanline was scanned */ memset(objdata, 0, 256); /* now draw the sprites; this is done during HBLANK */ - gfx = machine.gfx[4]; + gfx = machine().gfx[4]; for (num = 0; num < 16; num++) { /* @@ -261,23 +261,23 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y, /* the first of the 4 bytes is the Y position; this is used to match the scanline */ /* we match this scanline if the sum & 0xf0 == 0 */ - int sy = state->m_spriteram[0x40 + (dataoffs & ~0x20)]; + int sy = m_spriteram[0x40 + (dataoffs & ~0x20)]; int dy = sy + ~y; if ((dy & 0xf0) == 0) { /* the second byte is: code is in bits 0-5, xflip in bit 6, yflip in bit 7 */ /* note that X flip is reversed (on purpose) */ - int codeflip = state->m_spriteram[0x41 + dataoffs]; + int codeflip = m_spriteram[0x41 + dataoffs]; int code = (codeflip & 0x3f) + (change >> 2); int yflip = (codeflip & 0x80) ? 0x0f : 0x00; int xflip = (codeflip & 0x40) ? 0x0f : 0x00; const UINT8 *src = gfx->get_data(code) + ((dy ^ yflip) & 15) * gfx->rowbytes(); /* the third byte is: color in bits 0-2 */ - int color = (state->m_spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2; + int color = (m_spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2; /* the fourth byte is the X position */ - int sx = state->m_spriteram[0x43 + dataoffs]; + int sx = m_spriteram[0x43 + dataoffs]; int x; /* draw 16 pixels */ @@ -299,7 +299,7 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y, } /* finally draw the text characters; this is done as we read out the object buffers */ - gfx = machine.gfx[0]; + gfx = machine().gfx[0]; for (num = 0; num < 32; num++) { /* @@ -311,10 +311,10 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y, */ int hprime = num ^ 0x1f; int dataoffs = hprime << 1; - int sy = state->m_spriteram[0x00 + dataoffs]; + int sy = m_spriteram[0x00 + dataoffs]; int dy = sy + ~y; - int color = (state->m_spriteram[0x01 + dataoffs] & 0x07) << 2; - int code = state->m_videoram[hprime | ((dy & 0xf8) << 2)] + change; + int color = (m_spriteram[0x01 + dataoffs] & 0x07) << 2; + int code = m_videoram[hprime | ((dy & 0xf8) << 2)] + change; const UINT8 *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes(); int x; @@ -398,7 +398,7 @@ UINT32 grchamp_state::screen_update_grchamp(screen_device &screen, bitmap_rgb32 UINT8 objdata[256]; /* draw the objects for this scanline */ - draw_objects(machine(), this, y, objdata); + draw_objects(y, objdata); /* iterate over columns */ for (x = cliprect.min_x; x <= cliprect.max_x; x++) diff --git a/src/mame/video/groundfx.c b/src/mame/video/groundfx.c index 4ff7969ddf1..6ddf8599aa3 100644 --- a/src/mame/video/groundfx.c +++ b/src/mame/video/groundfx.c @@ -59,11 +59,10 @@ Heavy use is made of sprite zooming. ***************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs) +void groundfx_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs) { - groundfx_state *state = machine.driver_data<groundfx_state>(); - UINT32 *spriteram32 = state->m_spriteram; - UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base(); + UINT32 *spriteram32 = m_spriteram; + UINT16 *spritemap = (UINT16 *)memregion("user1")->base(); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; int sprites_flipscreen = 0; @@ -74,9 +73,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list while processing sprite ram and then draw them all at the end */ - struct tempsprite *sprite_ptr = state->m_spritelist; + struct tempsprite *sprite_ptr = m_spritelist; - for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) + for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) { data = spriteram32[offs+0]; flipx = (data & 0x00800000) >> 23; @@ -170,24 +169,24 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re } /* this happens only if primsks != NULL */ - while (sprite_ptr != state->m_spritelist) + while (sprite_ptr != m_spritelist) { const rectangle *clipper; sprite_ptr--; if (do_hack && sprite_ptr->pri==1 && sprite_ptr->y<100) - clipper=&state->m_hack_cliprect; + clipper=&m_hack_cliprect; else clipper=&cliprect; - pdrawgfxzoom_transpen(bitmap,*clipper,machine.gfx[sprite_ptr->gfx], + pdrawgfxzoom_transpen(bitmap,*clipper,machine().gfx[sprite_ptr->gfx], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->x,sprite_ptr->y, sprite_ptr->zoomx,sprite_ptr->zoomy, - machine.priority_bitmap,primasks[sprite_ptr->pri],0); + machine().priority_bitmap,primasks[sprite_ptr->pri],0); } } @@ -252,7 +251,7 @@ UINT32 groundfx_state::screen_update_groundfx(screen_device &screen, bitmap_ind1 if (tc0480scp_long_r(tc0480scp, space, 0x20 / 4, 0xffffffff) != 0x240866) /* Stupid hack for start of race */ tc0480scp_tilemap_draw(tc0480scp, bitmap, m_hack_cliprect, layer[0], 0, 0); - draw_sprites(machine(), bitmap, cliprect, 1, 44, -574); + draw_sprites(bitmap, cliprect, 1, 44, -574); } else { @@ -263,7 +262,7 @@ UINT32 groundfx_state::screen_update_groundfx(screen_device &screen, bitmap_ind1 tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); - draw_sprites(machine(), bitmap, cliprect, 0, 44, -574); + draw_sprites(bitmap, cliprect, 0, 44, -574); } tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); /* TC0480SCP text layer */ diff --git a/src/mame/video/gstriker.c b/src/mame/video/gstriker.c index d95090dce39..635802b9862 100644 --- a/src/mame/video/gstriker.c +++ b/src/mame/video/gstriker.c @@ -50,9 +50,8 @@ WRITE16_MEMBER(gstriker_state::VS920A_1_vram_w) m_VS920A[1].tmap->mark_tile_dirty(offset); } -static void VS920A_init(running_machine &machine, int numchips) +void gstriker_state::VS920A_init(int numchips) { - gstriker_state *state = machine.driver_data<gstriker_state>(); int i; if (numchips > MAX_VS920A) @@ -60,32 +59,32 @@ static void VS920A_init(running_machine &machine, int numchips) for (i=0;i<numchips;i++) { - state->m_VS920A[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),state),TILEMAP_SCAN_ROWS,8,8,64,32); + m_VS920A[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); - state->m_VS920A[i].tmap->set_transparent_pen(0); + m_VS920A[i].tmap->set_transparent_pen(0); } } -static tilemap_t* VS920A_get_tilemap(gstriker_state *state, int numchip) +tilemap_t* gstriker_state::VS920A_get_tilemap(int numchip) { - return state->m_VS920A[numchip].tmap; + return m_VS920A[numchip].tmap; } -static void VS920A_set_pal_base(gstriker_state *state, int numchip, int pal_base) +void gstriker_state::VS920A_set_pal_base(int numchip, int pal_base) { - state->m_VS920A[numchip].pal_base = pal_base; + m_VS920A[numchip].pal_base = pal_base; } -static void VS920A_set_gfx_region(gstriker_state *state, int numchip, int gfx_region) +void gstriker_state::VS920A_set_gfx_region(int numchip, int gfx_region) { - state->m_VS920A[numchip].gfx_region = gfx_region; + m_VS920A[numchip].gfx_region = gfx_region; } -static void VS920A_draw(gstriker_state *state, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) +void gstriker_state::VS920A_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) { - state->m_VS920A_cur_chip = &state->m_VS920A[numchip]; + m_VS920A_cur_chip = &m_VS920A[numchip]; - state->m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority); + m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority); } @@ -207,9 +206,8 @@ TILEMAP_MAPPER_MEMBER(gstriker_state::twc94_scan) return (row*64) + (col&63) + ((col&64)<<6); } -static void MB60553_init(running_machine &machine, int numchips) +void gstriker_state::MB60553_init(int numchips) { - gstriker_state *state = machine.driver_data<gstriker_state>(); int i; if (numchips > MAX_MB60553) @@ -217,32 +215,31 @@ static void MB60553_init(running_machine &machine, int numchips) for (i=0;i<numchips;i++) { - state->m_MB60553[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),state),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),state), 16,16,128,64); + m_MB60553[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),this),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),this), 16,16,128,64); - state->m_MB60553[i].tmap->set_transparent_pen(0); + m_MB60553[i].tmap->set_transparent_pen(0); } } -static void MB60553_set_pal_base(gstriker_state *state, int numchip, int pal_base) +void gstriker_state::MB60553_set_pal_base(int numchip, int pal_base) { - state->m_MB60553[numchip].pal_base = pal_base; + m_MB60553[numchip].pal_base = pal_base; } -static void MB60553_set_gfx_region(gstriker_state *state, int numchip, int gfx_region) +void gstriker_state::MB60553_set_gfx_region(int numchip, int gfx_region) { - state->m_MB60553[numchip].gfx_region = gfx_region; + m_MB60553[numchip].gfx_region = gfx_region; } /* THIS IS STILL WRONG! */ -static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) +void gstriker_state::MB60553_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) { - gstriker_state *state = machine.driver_data<gstriker_state>(); int line; rectangle clip; - state->m_MB60553_cur_chip = &state->m_MB60553[numchip]; + m_MB60553_cur_chip = &m_MB60553[numchip]; - clip.min_x = machine.primary_screen->visible_area().min_x; - clip.max_x = machine.primary_screen->visible_area().max_x; + clip.min_x = machine().primary_screen->visible_area().min_x; + clip.max_x = machine().primary_screen->visible_area().max_x; for (line = 0; line < 224;line++) { @@ -253,19 +250,19 @@ static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& sc UINT32 incxx,incyy; - startx = state->m_MB60553_cur_chip->regs[0]; - starty = state->m_MB60553_cur_chip->regs[1]; + startx = m_MB60553_cur_chip->regs[0]; + starty = m_MB60553_cur_chip->regs[1]; startx += (24<<4); // maybe not.. - startx -= state->m_lineram[(line)*8+7]/2; + startx -= m_lineram[(line)*8+7]/2; - incxx = state->m_lineram[(line)*8+0]<<4; - incyy = state->m_lineram[(line)*8+3]<<4; + incxx = m_lineram[(line)*8+0]<<4; + incyy = m_lineram[(line)*8+3]<<4; clip.min_y = clip.max_y = line; - state->m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12, + m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12, incxx,0,0,incyy, 1, 0,priority); @@ -276,9 +273,9 @@ static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& sc } -static tilemap_t* MB60553_get_tilemap(gstriker_state *state, int numchip) +tilemap_t* gstriker_state::MB60553_get_tilemap(int numchip) { - return state->m_MB60553[numchip].tmap; + return m_MB60553[numchip].tmap; } @@ -338,11 +335,11 @@ UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind1 // Sandwitched screen/sprite0/score/sprite1. Surely wrong, probably // needs sprite orthogonality - MB60553_draw(machine(), 0, bitmap,cliprect, 0); + MB60553_draw(0, bitmap,cliprect, 0); m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x0); - VS920A_draw(this, 0, bitmap, cliprect, 0); + VS920A_draw(0, bitmap, cliprect, 0); m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x2); @@ -367,16 +364,16 @@ VIDEO_START_MEMBER(gstriker_state,gstriker) // Palette bases are hardcoded, but should be probably extracted from the mixer registers // Initalize the chip for the score plane - VS920A_init(machine(), 1); - VS920A_set_gfx_region(this, 0, 0); - VS920A_set_pal_base(this, 0, 0x30); - VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); + VS920A_init(1); + VS920A_set_gfx_region(0, 0); + VS920A_set_pal_base(0, 0x30); + VS920A_get_tilemap(0)->set_transparent_pen(0xf); // Initalize the chip for the screen plane - MB60553_init(machine(), 1); - MB60553_set_gfx_region(this, 0, 1); - MB60553_set_pal_base(this, 0, 0); - MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); + MB60553_init(1); + MB60553_set_gfx_region(0, 1); + MB60553_set_pal_base(0, 0); + MB60553_get_tilemap(0)->set_transparent_pen(0xf); } VIDEO_START_MEMBER(gstriker_state,twrldc94) @@ -384,16 +381,16 @@ VIDEO_START_MEMBER(gstriker_state,twrldc94) // Palette bases are hardcoded, but should be probably extracted from the mixer registers // Initalize the chip for the score plane - VS920A_init(machine(), 1); - VS920A_set_gfx_region(this, 0, 0); - VS920A_set_pal_base(this, 0, 0x40); - VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); + VS920A_init(1); + VS920A_set_gfx_region(0, 0); + VS920A_set_pal_base(0, 0x40); + VS920A_get_tilemap(0)->set_transparent_pen(0xf); // Initalize the chip for the screen plane - MB60553_init(machine(), 1); - MB60553_set_gfx_region(this, 0, 1); - MB60553_set_pal_base(this, 0, 0x50); - MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); + MB60553_init(1); + MB60553_set_gfx_region(0, 1); + MB60553_set_pal_base(0, 0x50); + MB60553_get_tilemap(0)->set_transparent_pen(0xf); } VIDEO_START_MEMBER(gstriker_state,vgoalsoc) @@ -401,14 +398,14 @@ VIDEO_START_MEMBER(gstriker_state,vgoalsoc) // Palette bases are hardcoded, but should be probably extracted from the mixer registers // Initalize the chip for the score plane - VS920A_init(machine(), 1); - VS920A_set_gfx_region(this, 0, 0); - VS920A_set_pal_base(this, 0, 0x30); - VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); + VS920A_init(1); + VS920A_set_gfx_region(0, 0); + VS920A_set_pal_base(0, 0x30); + VS920A_get_tilemap(0)->set_transparent_pen(0xf); // Initalize the chip for the screen plane - MB60553_init(machine(), 1); - MB60553_set_gfx_region(this, 0, 1); - MB60553_set_pal_base(this, 0, 0x20); - MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); + MB60553_init(1); + MB60553_set_gfx_region(0, 1); + MB60553_set_pal_base(0, 0x20); + MB60553_get_tilemap(0)->set_transparent_pen(0xf); } diff --git a/src/mame/video/gsword.c b/src/mame/video/gsword.c index 844f31e6592..82f81f57f0a 100644 --- a/src/mame/video/gsword.c +++ b/src/mame/video/gsword.c @@ -158,24 +158,23 @@ void gsword_state::video_start() 8, 8, 32, 64); } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void gsword_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - gsword_state *state = machine.driver_data<gsword_state>(); int offs; - for (offs = 0; offs < state->m_spritexy_ram.bytes() - 1; offs+=2) + for (offs = 0; offs < m_spritexy_ram.bytes() - 1; offs+=2) { int sx,sy,flipx,flipy,spritebank,tile,color; - if (state->m_spritexy_ram[offs]!=0xf1) + if (m_spritexy_ram[offs]!=0xf1) { spritebank = 0; - tile = state->m_spritetile_ram[offs]; - color = state->m_spritetile_ram[offs+1] & 0x3f; - sy = 241-state->m_spritexy_ram[offs]; - sx = state->m_spritexy_ram[offs+1]-56; - flipx = state->m_spriteattrib_ram[offs] & 0x02; - flipy = state->m_spriteattrib_ram[offs] & 0x01; + tile = m_spritetile_ram[offs]; + color = m_spritetile_ram[offs+1] & 0x3f; + sy = 241-m_spritexy_ram[offs]; + sx = m_spritexy_ram[offs+1]-56; + flipx = m_spriteattrib_ram[offs] & 0x02; + flipy = m_spriteattrib_ram[offs] & 0x01; // Adjust sprites that should be far far right! if (sx<0) sx+=256; @@ -187,17 +186,17 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r tile -= 128; sy-=16; } - if (state->m_flipscreen) + if (m_flipscreen) { flipx = !flipx; flipy = !flipy; } - drawgfx_transmask(bitmap,cliprect,machine.gfx[1+spritebank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[1+spritebank], tile, color, flipx,flipy, sx,sy, - colortable_get_transpen_mask(machine.colortable, machine.gfx[1+spritebank], color, 0x8f)); + colortable_get_transpen_mask(machine().colortable, machine().gfx[1+spritebank], color, 0x8f)); } } } @@ -205,6 +204,6 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r UINT32 gsword_state::screen_update_gsword(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/gunbustr.c b/src/mame/video/gunbustr.c index 7fa55af0dd8..d28427db485 100644 --- a/src/mame/video/gunbustr.c +++ b/src/mame/video/gunbustr.c @@ -55,11 +55,10 @@ Heavy use is made of sprite zooming. ********************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs) +void gunbustr_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs) { - gunbustr_state *state = machine.driver_data<gunbustr_state>(); - UINT32 *spriteram32 = state->m_spriteram; - UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base(); + UINT32 *spriteram32 = m_spriteram; + UINT16 *spritemap = (UINT16 *)memregion("user1")->base(); int offs, data, tilenum, color, flipx, flipy; int x, y, priority, dblsize, curx, cury; int sprites_flipscreen = 0; @@ -69,9 +68,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list while processing sprite ram and then draw them all at the end */ - struct tempsprite *sprite_ptr = state->m_spritelist; + struct tempsprite *sprite_ptr = m_spritelist; - for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) + for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) { data = spriteram32[offs+0]; flipx = (data & 0x00800000) >> 23; @@ -166,7 +165,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re } else { - drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], + drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, @@ -181,17 +180,17 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); } /* this happens only if primsks != NULL */ - while (sprite_ptr != state->m_spritelist) + while (sprite_ptr != m_spritelist) { sprite_ptr--; - pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], + pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->x,sprite_ptr->y, sprite_ptr->zoomx,sprite_ptr->zoomy, - machine.priority_bitmap,sprite_ptr->primask,0); + machine().priority_bitmap,sprite_ptr->primask,0); } } @@ -235,7 +234,7 @@ UINT32 gunbustr_state::screen_update_gunbustr(screen_device &screen, bitmap_ind1 tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2); tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4); tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8); /* text layer */ - draw_sprites(machine(), bitmap, cliprect, primasks, 48, -116); + draw_sprites(bitmap, cliprect, primasks, 48, -116); #endif return 0; } diff --git a/src/mame/video/gunsmoke.c b/src/mame/video/gunsmoke.c index 0bff28b640a..2c7f90ee907 100644 --- a/src/mame/video/gunsmoke.c +++ b/src/mame/video/gunsmoke.c @@ -133,13 +133,12 @@ void gunsmoke_state::video_start() colortable_configure_tilemap_groups(machine().colortable, m_fg_tilemap, machine().gfx[0], 0x4f); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void gunsmoke_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - gunsmoke_state *state = machine.driver_data<gunsmoke_state>(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; 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 = spriteram[offs + 1]; int bank = (attr & 0xc0) >> 6; @@ -151,11 +150,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int sy = spriteram[offs + 2]; if (bank == 3) - bank += state->m_sprite3bank; + bank += m_sprite3bank; code += 256 * bank; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -163,7 +162,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const flipy = !flipy; } - drawgfx_transpen(bitmap, cliprect, machine.gfx[2], code, color, flipx, flipy, sx, sy, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[2], code, color, flipx, flipy, sx, sy, 0); } } @@ -178,7 +177,7 @@ UINT32 gunsmoke_state::screen_update_gunsmoke(screen_device &screen, bitmap_ind1 bitmap.fill(get_black_pen(machine()), cliprect); if (m_objon) - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); if (m_chon) m_fg_tilemap->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/gyruss.c b/src/mame/video/gyruss.c index 478738f0ae1..02ae7b5dc6a 100644 --- a/src/mame/video/gyruss.c +++ b/src/mame/video/gyruss.c @@ -127,21 +127,20 @@ READ8_MEMBER(gyruss_state::gyruss_scanline_r) } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx ) +void gyruss_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx ) { - gyruss_state *state = machine.driver_data<gyruss_state>(); int offs; for (offs = 0xbc; offs >= 0; offs -= 4) { - int x = state->m_spriteram[offs]; - int y = 241 - state->m_spriteram[offs + 3]; + int x = m_spriteram[offs]; + int y = 241 - m_spriteram[offs + 3]; - int gfx_bank = state->m_spriteram[offs + 1] & 0x01; - int code = ((state->m_spriteram[offs + 2] & 0x20) << 2) | ( state->m_spriteram[offs + 1] >> 1); - int color = state->m_spriteram[offs + 2] & 0x0f; - int flip_x = ~state->m_spriteram[offs + 2] & 0x40; - int flip_y = state->m_spriteram[offs + 2] & 0x80; + int gfx_bank = m_spriteram[offs + 1] & 0x01; + int code = ((m_spriteram[offs + 2] & 0x20) << 2) | ( m_spriteram[offs + 1] >> 1); + int color = m_spriteram[offs + 2] & 0x0f; + int flip_x = ~m_spriteram[offs + 2] & 0x40; + int flip_y = m_spriteram[offs + 2] & 0x80; drawgfx_transpen(bitmap, cliprect, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, 0); } @@ -157,7 +156,7 @@ UINT32 gyruss_state::screen_update_gyruss(screen_device &screen, bitmap_ind16 &b } m_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - draw_sprites(machine(), bitmap, cliprect, machine().gfx); + draw_sprites(bitmap, cliprect, machine().gfx); m_tilemap->draw(bitmap, cliprect, 0, 0); return 0; diff --git a/src/mame/video/xevious.c b/src/mame/video/xevious.c index a073e52275e..263f0017dd2 100644 --- a/src/mame/video/xevious.c +++ b/src/mame/video/xevious.c @@ -410,13 +410,11 @@ ROM 3M,3L color replace table for sprite ***************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) +void xevious_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { - xevious_state *state = machine.driver_data<xevious_state>(); - - UINT8 *spriteram = state->m_xevious_sr3 + 0x780; - UINT8 *spriteram_2 = state->m_xevious_sr1 + 0x780; - UINT8 *spriteram_3 = state->m_xevious_sr2 + 0x780; + UINT8 *spriteram = m_xevious_sr3 + 0x780; + UINT8 *spriteram_2 = m_xevious_sr1 + 0x780; + UINT8 *spriteram_3 = m_xevious_sr2 + 0x780; int offs,sx,sy; for (offs = 0;offs < 0x80;offs += 2) @@ -444,7 +442,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1); sy = 28*8-spriteram_2[offs]-1; - if (state->flip_screen()) + if (flip_screen()) { flipx = !flipx; flipy = !flipy; @@ -452,41 +450,41 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re sx += 96; } - transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[bank], color, 0x80); + transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[bank], color, 0x80); if (spriteram_3[offs] & 2) /* double height (?) */ { if (spriteram_3[offs] & 1) /* double width, double height */ { code &= ~3; - drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[bank], code+3,color,flipx,flipy, flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask); - drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[bank], code+1,color,flipx,flipy, flipx ? sx : sx+16,flipy ? sy : sy-16,transmask); } code &= ~2; - drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[bank], code+2,color,flipx,flipy, flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask); - drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[bank], code,color,flipx,flipy, flipx ? sx+16 : sx,flipy ? sy : sy-16,transmask); } else if (spriteram_3[offs] & 1) /* double width */ { code &= ~1; - drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[bank], code,color,flipx,flipy, flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask); - drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[bank], code+1,color,flipx,flipy, flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask); } else /* normal */ { - drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], + drawgfx_transmask(bitmap,cliprect,machine().gfx[bank], code,color,flipx,flipy,sx,sy,transmask); } } @@ -497,7 +495,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re UINT32 xevious_state::screen_update_xevious(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; } |