trunk/src/mame/drivers/orbit.c
| r20972 | r20973 | |
| 59 | 59 | * |
| 60 | 60 | *************************************/ |
| 61 | 61 | |
| 62 | | static void update_misc_flags(address_space &space, UINT8 val) |
| 62 | void orbit_state::update_misc_flags(address_space &space, UINT8 val) |
| 63 | 63 | { |
| 64 | | orbit_state *state = space.machine().driver_data<orbit_state>(); |
| 64 | m_misc_flags = val; |
| 65 | 65 | |
| 66 | | state->m_misc_flags = val; |
| 67 | | |
| 68 | 66 | /* BIT0 => UNUSED */ |
| 69 | 67 | /* BIT1 => LOCKOUT */ |
| 70 | 68 | /* BIT2 => NMI ENABLE */ |
| r20972 | r20973 | |
| 74 | 72 | /* BIT6 => HYPER LED */ |
| 75 | 73 | /* BIT7 => WARNING SND */ |
| 76 | 74 | |
| 77 | | discrete_sound_w(state->m_discrete, space, ORBIT_WARNING_EN, BIT(state->m_misc_flags, 7)); |
| 75 | discrete_sound_w(m_discrete, space, ORBIT_WARNING_EN, BIT(m_misc_flags, 7)); |
| 78 | 76 | |
| 79 | | set_led_status(space.machine(), 0, BIT(state->m_misc_flags, 3)); |
| 80 | | set_led_status(space.machine(), 1, BIT(state->m_misc_flags, 6)); |
| 77 | set_led_status(machine(), 0, BIT(m_misc_flags, 3)); |
| 78 | set_led_status(machine(), 1, BIT(m_misc_flags, 6)); |
| 81 | 79 | |
| 82 | | coin_lockout_w(space.machine(), 0, !BIT(state->m_misc_flags, 1)); |
| 83 | | coin_lockout_w(space.machine(), 1, !BIT(state->m_misc_flags, 1)); |
| 80 | coin_lockout_w(machine(), 0, !BIT(m_misc_flags, 1)); |
| 81 | coin_lockout_w(machine(), 1, !BIT(m_misc_flags, 1)); |
| 84 | 82 | } |
| 85 | 83 | |
| 86 | 84 | |
trunk/src/mame/machine/opwolf.c
| r20972 | r20973 | |
| 312 | 312 | m_current_cmd = 0; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | | static void updateDifficulty( running_machine &machine, int mode ) |
| 315 | void opwolf_state::updateDifficulty( int mode ) |
| 316 | 316 | { |
| 317 | | opwolf_state *state = machine.driver_data<opwolf_state>(); |
| 318 | 317 | |
| 319 | 318 | // The game is made up of 6 rounds, when you complete the |
| 320 | 319 | // sixth you return to the start but with harder difficulty. |
| 321 | 320 | if (mode == 0) |
| 322 | 321 | { |
| 323 | | switch (state->m_cchip_ram[0x15]&3) // Dipswitch B |
| 322 | switch (m_cchip_ram[0x15]&3) // Dipswitch B |
| 324 | 323 | { |
| 325 | 324 | case 3: |
| 326 | | state->m_cchip_ram[0x2c] = 0x31; |
| 327 | | state->m_cchip_ram[0x77] = 0x05; |
| 328 | | state->m_cchip_ram[0x25] = 0x0f; |
| 329 | | state->m_cchip_ram[0x26] = 0x0b; |
| 325 | m_cchip_ram[0x2c] = 0x31; |
| 326 | m_cchip_ram[0x77] = 0x05; |
| 327 | m_cchip_ram[0x25] = 0x0f; |
| 328 | m_cchip_ram[0x26] = 0x0b; |
| 330 | 329 | break; |
| 331 | 330 | case 0: |
| 332 | | state->m_cchip_ram[0x2c] = 0x20; |
| 333 | | state->m_cchip_ram[0x77] = 0x06; |
| 334 | | state->m_cchip_ram[0x25] = 0x07; |
| 335 | | state->m_cchip_ram[0x26] = 0x03; |
| 331 | m_cchip_ram[0x2c] = 0x20; |
| 332 | m_cchip_ram[0x77] = 0x06; |
| 333 | m_cchip_ram[0x25] = 0x07; |
| 334 | m_cchip_ram[0x26] = 0x03; |
| 336 | 335 | break; |
| 337 | 336 | case 1: |
| 338 | | state->m_cchip_ram[0x2c] = 0x31; |
| 339 | | state->m_cchip_ram[0x77] = 0x05; |
| 340 | | state->m_cchip_ram[0x25] = 0x0f; |
| 341 | | state->m_cchip_ram[0x26] = 0x0b; |
| 337 | m_cchip_ram[0x2c] = 0x31; |
| 338 | m_cchip_ram[0x77] = 0x05; |
| 339 | m_cchip_ram[0x25] = 0x0f; |
| 340 | m_cchip_ram[0x26] = 0x0b; |
| 342 | 341 | break; |
| 343 | 342 | case 2: |
| 344 | | state->m_cchip_ram[0x2c] = 0x3c; |
| 345 | | state->m_cchip_ram[0x77] = 0x04; |
| 346 | | state->m_cchip_ram[0x25] = 0x13; |
| 347 | | state->m_cchip_ram[0x26] = 0x0f; |
| 343 | m_cchip_ram[0x2c] = 0x3c; |
| 344 | m_cchip_ram[0x77] = 0x04; |
| 345 | m_cchip_ram[0x25] = 0x13; |
| 346 | m_cchip_ram[0x26] = 0x0f; |
| 348 | 347 | break; |
| 349 | 348 | } |
| 350 | 349 | } |
| 351 | 350 | else |
| 352 | 351 | { |
| 353 | | switch (state->m_cchip_ram[0x15]&3) // Dipswitch B |
| 352 | switch (m_cchip_ram[0x15]&3) // Dipswitch B |
| 354 | 353 | { |
| 355 | 354 | case 3: |
| 356 | | state->m_cchip_ram[0x2c] = 0x46; |
| 357 | | state->m_cchip_ram[0x77] = 0x05; |
| 358 | | state->m_cchip_ram[0x25] = 0x11; |
| 359 | | state->m_cchip_ram[0x26] = 0x0e; |
| 355 | m_cchip_ram[0x2c] = 0x46; |
| 356 | m_cchip_ram[0x77] = 0x05; |
| 357 | m_cchip_ram[0x25] = 0x11; |
| 358 | m_cchip_ram[0x26] = 0x0e; |
| 360 | 359 | break; |
| 361 | 360 | case 0: |
| 362 | | state->m_cchip_ram[0x2c] = 0x30; |
| 363 | | state->m_cchip_ram[0x77] = 0x06; |
| 364 | | state->m_cchip_ram[0x25] = 0x0b; |
| 365 | | state->m_cchip_ram[0x26] = 0x03; |
| 361 | m_cchip_ram[0x2c] = 0x30; |
| 362 | m_cchip_ram[0x77] = 0x06; |
| 363 | m_cchip_ram[0x25] = 0x0b; |
| 364 | m_cchip_ram[0x26] = 0x03; |
| 366 | 365 | break; |
| 367 | 366 | case 1: |
| 368 | | state->m_cchip_ram[0x2c] = 0x3a; |
| 369 | | state->m_cchip_ram[0x77] = 0x05; |
| 370 | | state->m_cchip_ram[0x25] = 0x0f; |
| 371 | | state->m_cchip_ram[0x26] = 0x09; |
| 367 | m_cchip_ram[0x2c] = 0x3a; |
| 368 | m_cchip_ram[0x77] = 0x05; |
| 369 | m_cchip_ram[0x25] = 0x0f; |
| 370 | m_cchip_ram[0x26] = 0x09; |
| 372 | 371 | break; |
| 373 | 372 | case 2: |
| 374 | | state->m_cchip_ram[0x2c] = 0x4c; |
| 375 | | state->m_cchip_ram[0x77] = 0x04; |
| 376 | | state->m_cchip_ram[0x25] = 0x19; |
| 377 | | state->m_cchip_ram[0x26] = 0x11; |
| 373 | m_cchip_ram[0x2c] = 0x4c; |
| 374 | m_cchip_ram[0x77] = 0x04; |
| 375 | m_cchip_ram[0x25] = 0x19; |
| 376 | m_cchip_ram[0x26] = 0x11; |
| 378 | 377 | break; |
| 379 | 378 | }; |
| 380 | 379 | } |
| r20972 | r20973 | |
| 395 | 394 | |
| 396 | 395 | m_cchip_ram[0x3d] = 1; |
| 397 | 396 | m_cchip_ram[0x7a] = 1; |
| 398 | | updateDifficulty(machine(), 0); |
| 397 | updateDifficulty(0); |
| 399 | 398 | } |
| 400 | 399 | |
| 401 | 400 | WRITE16_MEMBER(opwolf_state::opwolf_cchip_bank_w) |
| r20972 | r20973 | |
| 485 | 484 | // Dip switch B |
| 486 | 485 | if (offset == 0x15) |
| 487 | 486 | { |
| 488 | | updateDifficulty(machine(), 0); |
| 487 | updateDifficulty(0); |
| 489 | 488 | } |
| 490 | 489 | } |
| 491 | 490 | } |
| r20972 | r20973 | |
| 632 | 631 | if (m_cchip_ram[0x76] == 0) |
| 633 | 632 | { |
| 634 | 633 | m_cchip_ram[0x76] = 1; |
| 635 | | updateDifficulty(machine(), 1); |
| 634 | updateDifficulty(1); |
| 636 | 635 | } |
| 637 | 636 | } |
| 638 | 637 | |
| 639 | 638 | // These variables are cleared every frame during attract mode and the intro. |
| 640 | 639 | if (m_cchip_ram[0x34] < 2) |
| 641 | 640 | { |
| 642 | | updateDifficulty(machine(), 0); |
| 641 | updateDifficulty(0); |
| 643 | 642 | m_cchip_ram[0x76] = 0; |
| 644 | 643 | m_cchip_ram[0x75] = 0; |
| 645 | 644 | m_cchip_ram[0x74] = 0; |
| r20972 | r20973 | |
| 708 | 707 | * |
| 709 | 708 | *************************************/ |
| 710 | 709 | |
| 711 | | void opwolf_cchip_init( running_machine &machine ) |
| 710 | void opwolf_state::opwolf_cchip_init( ) |
| 712 | 711 | { |
| 713 | | opwolf_state *state = machine.driver_data<opwolf_state>(); |
| 714 | 712 | |
| 715 | | state->m_cchip_ram.allocate(0x400 * 8); |
| 713 | m_cchip_ram.allocate(0x400 * 8); |
| 716 | 714 | |
| 717 | | state->save_item(NAME(state->m_current_bank)); |
| 718 | | state->save_item(NAME(state->m_current_cmd)); |
| 719 | | state->save_item(NAME(state->m_cchip_last_7a)); |
| 720 | | state->save_item(NAME(state->m_cchip_last_04)); |
| 721 | | state->save_item(NAME(state->m_cchip_last_05)); |
| 722 | | state->save_item(NAME(state->m_c588)); |
| 723 | | state->save_item(NAME(state->m_c589)); |
| 724 | | state->save_item(NAME(state->m_c58a)); |
| 725 | | state->save_item(NAME(state->m_cchip_coins)); |
| 726 | | state->save_item(NAME(state->m_cchip_coins_for_credit)); |
| 727 | | state->save_item(NAME(state->m_cchip_credits_for_coin)); |
| 715 | save_item(NAME(m_current_bank)); |
| 716 | save_item(NAME(m_current_cmd)); |
| 717 | save_item(NAME(m_cchip_last_7a)); |
| 718 | save_item(NAME(m_cchip_last_04)); |
| 719 | save_item(NAME(m_cchip_last_05)); |
| 720 | save_item(NAME(m_c588)); |
| 721 | save_item(NAME(m_c589)); |
| 722 | save_item(NAME(m_c58a)); |
| 723 | save_item(NAME(m_cchip_coins)); |
| 724 | save_item(NAME(m_cchip_coins_for_credit)); |
| 725 | save_item(NAME(m_cchip_credits_for_coin)); |
| 728 | 726 | |
| 729 | | state->m_current_bank = 0; |
| 730 | | state->m_current_cmd = 0; |
| 731 | | state->m_cchip_last_7a = 0; |
| 732 | | state->m_cchip_last_04 = 0xfc; |
| 733 | | state->m_cchip_last_05 = 0xff; |
| 734 | | state->m_c588 = 0; |
| 735 | | state->m_c589 = 0; |
| 736 | | state->m_c58a = 0; |
| 737 | | state->m_cchip_coins[0] = 0; |
| 738 | | state->m_cchip_coins[1] = 0; |
| 739 | | state->m_cchip_coins_for_credit[0] = 1; |
| 740 | | state->m_cchip_credits_for_coin[0] = 1; |
| 741 | | state->m_cchip_coins_for_credit[1] = 1; |
| 742 | | state->m_cchip_credits_for_coin[1] = 1; |
| 727 | m_current_bank = 0; |
| 728 | m_current_cmd = 0; |
| 729 | m_cchip_last_7a = 0; |
| 730 | m_cchip_last_04 = 0xfc; |
| 731 | m_cchip_last_05 = 0xff; |
| 732 | m_c588 = 0; |
| 733 | m_c589 = 0; |
| 734 | m_c58a = 0; |
| 735 | m_cchip_coins[0] = 0; |
| 736 | m_cchip_coins[1] = 0; |
| 737 | m_cchip_coins_for_credit[0] = 1; |
| 738 | m_cchip_credits_for_coin[0] = 1; |
| 739 | m_cchip_coins_for_credit[1] = 1; |
| 740 | m_cchip_credits_for_coin[1] = 1; |
| 743 | 741 | |
| 744 | | machine.scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(opwolf_state::cchip_timer),state)); |
| 742 | machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(opwolf_state::cchip_timer),this)); |
| 745 | 743 | } |
trunk/src/mame/video/ojankohs.c
| r20972 | r20973 | |
| 181 | 181 | |
| 182 | 182 | ******************************************************************************/ |
| 183 | 183 | |
| 184 | | void ojankoc_flipscreen( address_space &space, int data ) |
| 184 | void ojankohs_state::ojankoc_flipscreen( address_space &space, int data ) |
| 185 | 185 | { |
| 186 | | ojankohs_state *state = space.machine().driver_data<ojankohs_state>(); |
| 187 | 186 | int x, y; |
| 188 | 187 | UINT8 color1, color2; |
| 189 | 188 | |
| 190 | | state->m_flipscreen = BIT(data, 7); |
| 189 | m_flipscreen = BIT(data, 7); |
| 191 | 190 | |
| 192 | | if (state->m_flipscreen == state->m_flipscreen_old) |
| 191 | if (m_flipscreen == m_flipscreen_old) |
| 193 | 192 | return; |
| 194 | 193 | |
| 195 | 194 | for (y = 0; y < 0x40; y++) |
| 196 | 195 | { |
| 197 | 196 | for (x = 0; x < 0x100; x++) |
| 198 | 197 | { |
| 199 | | color1 = state->m_videoram[0x0000 + ((y * 256) + x)]; |
| 200 | | color2 = state->m_videoram[0x3fff - ((y * 256) + x)]; |
| 201 | | state->ojankoc_videoram_w(space, 0x0000 + ((y * 256) + x), color2); |
| 202 | | state->ojankoc_videoram_w(space, 0x3fff - ((y * 256) + x), color1); |
| 198 | color1 = m_videoram[0x0000 + ((y * 256) + x)]; |
| 199 | color2 = m_videoram[0x3fff - ((y * 256) + x)]; |
| 200 | ojankoc_videoram_w(space, 0x0000 + ((y * 256) + x), color2); |
| 201 | ojankoc_videoram_w(space, 0x3fff - ((y * 256) + x), color1); |
| 203 | 202 | |
| 204 | | color1 = state->m_videoram[0x4000 + ((y * 256) + x)]; |
| 205 | | color2 = state->m_videoram[0x7fff - ((y * 256) + x)]; |
| 206 | | state->ojankoc_videoram_w(space, 0x4000 + ((y * 256) + x), color2); |
| 207 | | state->ojankoc_videoram_w(space, 0x7fff - ((y * 256) + x), color1); |
| 203 | color1 = m_videoram[0x4000 + ((y * 256) + x)]; |
| 204 | color2 = m_videoram[0x7fff - ((y * 256) + x)]; |
| 205 | ojankoc_videoram_w(space, 0x4000 + ((y * 256) + x), color2); |
| 206 | ojankoc_videoram_w(space, 0x7fff - ((y * 256) + x), color1); |
| 208 | 207 | } |
| 209 | 208 | } |
| 210 | 209 | |
| 211 | | state->m_flipscreen_old = state->m_flipscreen; |
| 210 | m_flipscreen_old = m_flipscreen; |
| 212 | 211 | } |
| 213 | 212 | |
| 214 | 213 | WRITE8_MEMBER(ojankohs_state::ojankoc_videoram_w) |
trunk/src/mame/video/othunder.c
| r20972 | r20973 | |
| 62 | 62 | ********************************************************/ |
| 63 | 63 | |
| 64 | 64 | |
| 65 | | static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs ) |
| 65 | void othunder_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs ) |
| 66 | 66 | { |
| 67 | | othunder_state *state = machine.driver_data<othunder_state>(); |
| 68 | | UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base(); |
| 69 | | UINT16 tile_mask = (machine.gfx[0]->elements()) - 1; |
| 70 | | UINT16 *spriteram16 = state->m_spriteram; |
| 67 | UINT16 *spritemap = (UINT16 *)memregion("user1")->base(); |
| 68 | UINT16 tile_mask = (machine().gfx[0]->elements()) - 1; |
| 69 | UINT16 *spriteram16 = m_spriteram; |
| 71 | 70 | int offs, data, tilenum, color, flipx, flipy; |
| 72 | 71 | int x, y, priority, curx, cury; |
| 73 | 72 | int sprites_flipscreen = 0; |
| r20972 | r20973 | |
| 77 | 76 | |
| 78 | 77 | /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list |
| 79 | 78 | while processing sprite ram and then draw them all at the end */ |
| 80 | | struct othunder_tempsprite *sprite_ptr = state->m_spritelist; |
| 79 | struct othunder_tempsprite *sprite_ptr = m_spritelist; |
| 81 | 80 | |
| 82 | | for (offs = (state->m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4) |
| 81 | for (offs = (m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4) |
| 83 | 82 | { |
| 84 | 83 | data = spriteram16[offs + 0]; |
| 85 | 84 | zoomy = (data & 0xfe00) >> 9; |
| r20972 | r20973 | |
| 166 | 165 | } |
| 167 | 166 | else |
| 168 | 167 | { |
| 169 | | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0], |
| 168 | drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0], |
| 170 | 169 | sprite_ptr->code, |
| 171 | 170 | sprite_ptr->color, |
| 172 | 171 | sprite_ptr->flipx,sprite_ptr->flipy, |
| r20972 | r20973 | |
| 180 | 179 | } |
| 181 | 180 | |
| 182 | 181 | /* this happens only if primsks != NULL */ |
| 183 | | while (sprite_ptr != state->m_spritelist) |
| 182 | while (sprite_ptr != m_spritelist) |
| 184 | 183 | { |
| 185 | 184 | sprite_ptr--; |
| 186 | 185 | |
| 187 | | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0], |
| 186 | pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0], |
| 188 | 187 | sprite_ptr->code, |
| 189 | 188 | sprite_ptr->color, |
| 190 | 189 | sprite_ptr->flipx,sprite_ptr->flipy, |
| 191 | 190 | sprite_ptr->x,sprite_ptr->y, |
| 192 | 191 | sprite_ptr->zoomx,sprite_ptr->zoomy, |
| 193 | | machine.priority_bitmap,sprite_ptr->primask,0); |
| 192 | machine().priority_bitmap,sprite_ptr->primask,0); |
| 194 | 193 | } |
| 195 | 194 | } |
| 196 | 195 | |
| r20972 | r20973 | |
| 221 | 220 | /* Sprites can be under/over the layer below text layer */ |
| 222 | 221 | { |
| 223 | 222 | static const int primasks[2] = {0xf0, 0xfc}; |
| 224 | | draw_sprites(machine(), bitmap, cliprect, primasks, 3); |
| 223 | draw_sprites(bitmap, cliprect, primasks, 3); |
| 225 | 224 | } |
| 226 | 225 | |
| 227 | 226 | return 0; |
trunk/src/mame/video/ohmygod.c
| r20972 | r20973 | |
| 70 | 70 | |
| 71 | 71 | ***************************************************************************/ |
| 72 | 72 | |
| 73 | | static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 73 | void ohmygod_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 74 | 74 | { |
| 75 | | ohmygod_state *state = machine.driver_data<ohmygod_state>(); |
| 76 | | UINT16 *spriteram = state->m_spriteram; |
| 75 | UINT16 *spriteram = m_spriteram; |
| 77 | 76 | int offs; |
| 78 | 77 | |
| 79 | | for (offs = 0; offs < state->m_spriteram.bytes() / 4; offs += 4) |
| 78 | for (offs = 0; offs < m_spriteram.bytes() / 4; offs += 4) |
| 80 | 79 | { |
| 81 | 80 | int sx, sy, code, color, flipx; |
| 82 | 81 | UINT16 *sr; |
| 83 | 82 | |
| 84 | | sr = state->m_spritebank ? (spriteram + state->m_spriteram.bytes() / 4) : spriteram; |
| 83 | sr = m_spritebank ? (spriteram + m_spriteram.bytes() / 4) : spriteram; |
| 85 | 84 | |
| 86 | 85 | code = sr[offs + 3] & 0x0fff; |
| 87 | 86 | color = sr[offs + 2] & 0x000f; |
| r20972 | r20973 | |
| 91 | 90 | sy -= 65536; |
| 92 | 91 | flipx = sr[offs + 3] & 0x8000; |
| 93 | 92 | |
| 94 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 93 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 95 | 94 | code, |
| 96 | 95 | color, |
| 97 | 96 | flipx,0, |
| r20972 | r20973 | |
| 102 | 101 | UINT32 ohmygod_state::screen_update_ohmygod(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 103 | 102 | { |
| 104 | 103 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 105 | | draw_sprites(machine(), bitmap, cliprect); |
| 104 | draw_sprites(bitmap, cliprect); |
| 106 | 105 | return 0; |
| 107 | 106 | } |
trunk/src/mame/video/oneshot.c
| r20972 | r20973 | |
| 58 | 58 | m_fg_tilemap->set_transparent_pen(0); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | | static void draw_crosshairs( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 61 | void oneshot_state::draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 62 | 62 | { |
| 63 | | oneshot_state *state = machine.driver_data<oneshot_state>(); |
| 64 | 63 | //int xpos,ypos; |
| 65 | 64 | |
| 66 | 65 | /* get gun raw coordinates (player 1) */ |
| 67 | | state->m_gun_x_p1 = (state->ioport("LIGHT0_X")->read() & 0xff) * 320 / 256; |
| 68 | | state->m_gun_y_p1 = (state->ioport("LIGHT0_Y")->read() & 0xff) * 240 / 256; |
| 66 | m_gun_x_p1 = (ioport("LIGHT0_X")->read() & 0xff) * 320 / 256; |
| 67 | m_gun_y_p1 = (ioport("LIGHT0_Y")->read() & 0xff) * 240 / 256; |
| 69 | 68 | |
| 70 | 69 | /* compute the coordinates for drawing (from routine at 0x009ab0) */ |
| 71 | | //xpos = state->m_gun_x_p1; |
| 72 | | //ypos = state->m_gun_y_p1; |
| 70 | //xpos = m_gun_x_p1; |
| 71 | //ypos = m_gun_y_p1; |
| 73 | 72 | |
| 74 | | state->m_gun_x_p1 += state->m_gun_x_shift; |
| 73 | m_gun_x_p1 += m_gun_x_shift; |
| 75 | 74 | |
| 76 | | state->m_gun_y_p1 -= 0x0a; |
| 77 | | if (state->m_gun_y_p1 < 0) |
| 78 | | state->m_gun_y_p1 = 0; |
| 75 | m_gun_y_p1 -= 0x0a; |
| 76 | if (m_gun_y_p1 < 0) |
| 77 | m_gun_y_p1 = 0; |
| 79 | 78 | |
| 80 | 79 | |
| 81 | 80 | /* get gun raw coordinates (player 2) */ |
| 82 | | state->m_gun_x_p2 = (state->ioport("LIGHT1_X")->read() & 0xff) * 320 / 256; |
| 83 | | state->m_gun_y_p2 = (state->ioport("LIGHT1_Y")->read() & 0xff) * 240 / 256; |
| 81 | m_gun_x_p2 = (ioport("LIGHT1_X")->read() & 0xff) * 320 / 256; |
| 82 | m_gun_y_p2 = (ioport("LIGHT1_Y")->read() & 0xff) * 240 / 256; |
| 84 | 83 | |
| 85 | 84 | /* compute the coordinates for drawing (from routine at 0x009b6e) */ |
| 86 | | //xpos = state->m_gun_x_p2; |
| 87 | | //ypos = state->m_gun_y_p2; |
| 85 | //xpos = m_gun_x_p2; |
| 86 | //ypos = m_gun_y_p2; |
| 88 | 87 | |
| 89 | | state->m_gun_x_p2 += state->m_gun_x_shift - 0x0a; |
| 90 | | if (state->m_gun_x_p2 < 0) |
| 91 | | state->m_gun_x_p2 = 0; |
| 88 | m_gun_x_p2 += m_gun_x_shift - 0x0a; |
| 89 | if (m_gun_x_p2 < 0) |
| 90 | m_gun_x_p2 = 0; |
| 92 | 91 | } |
| 93 | 92 | |
| 94 | | static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 93 | void oneshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 95 | 94 | { |
| 96 | | oneshot_state *state = machine.driver_data<oneshot_state>(); |
| 97 | | const UINT16 *source = state->m_sprites; |
| 95 | const UINT16 *source = m_sprites; |
| 98 | 96 | const UINT16 *finish = source + (0x1000 / 2); |
| 99 | | gfx_element *gfx = machine.gfx[1]; |
| 97 | gfx_element *gfx = machine().gfx[1]; |
| 100 | 98 | |
| 101 | 99 | int xpos, ypos; |
| 102 | 100 | |
| r20972 | r20973 | |
| 157 | 155 | |
| 158 | 156 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 159 | 157 | m_mid_tilemap->draw(bitmap, cliprect, 0, 0); |
| 160 | | draw_sprites(machine(), bitmap, cliprect); |
| 158 | draw_sprites(bitmap, cliprect); |
| 161 | 159 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 162 | | draw_crosshairs(machine(), bitmap, cliprect); |
| 160 | draw_crosshairs(bitmap, cliprect); |
| 163 | 161 | return 0; |
| 164 | 162 | } |
| 165 | 163 | |
| r20972 | r20973 | |
| 172 | 170 | m_mid_tilemap->draw(bitmap, cliprect, 0, 0); |
| 173 | 171 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 174 | 172 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 175 | | draw_sprites(machine(), bitmap, cliprect); |
| 173 | draw_sprites(bitmap, cliprect); |
| 176 | 174 | |
| 177 | 175 | // popmessage ("%04x %04x %04x %04x %04x %04x %04x %04x", m_scroll[0], m_scroll[1], m_scroll[2], m_scroll[3], m_scroll[4], m_scroll[5], m_scroll[6], m_scroll[7]); |
| 178 | 176 | return 0; |
trunk/src/mame/video/othldrby.c
| r20972 | r20973 | |
| 13 | 13 | |
| 14 | 14 | ***************************************************************************/ |
| 15 | 15 | |
| 16 | | INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int plane ) |
| 16 | inline void othldrby_state::get_tile_info( tile_data &tileinfo, int tile_index, int plane ) |
| 17 | 17 | { |
| 18 | | othldrby_state *state = machine.driver_data<othldrby_state>(); |
| 19 | 18 | UINT16 attr; |
| 20 | 19 | |
| 21 | 20 | tile_index = 2 * tile_index + 0x800 * plane; |
| 22 | | attr = state->m_vram[tile_index]; |
| 23 | | SET_TILE_INFO( |
| 21 | attr = m_vram[tile_index]; |
| 22 | SET_TILE_INFO_MEMBER( |
| 24 | 23 | 1, |
| 25 | | state->m_vram[tile_index + 1], |
| 24 | m_vram[tile_index + 1], |
| 26 | 25 | attr & 0x7f, |
| 27 | 26 | 0); |
| 28 | 27 | tileinfo.category = (attr & 0x0600) >> 9; |
| r20972 | r20973 | |
| 30 | 29 | |
| 31 | 30 | TILE_GET_INFO_MEMBER(othldrby_state::get_tile_info0) |
| 32 | 31 | { |
| 33 | | get_tile_info(machine(), tileinfo, tile_index, 0); |
| 32 | get_tile_info(tileinfo, tile_index, 0); |
| 34 | 33 | } |
| 35 | 34 | |
| 36 | 35 | TILE_GET_INFO_MEMBER(othldrby_state::get_tile_info1) |
| 37 | 36 | { |
| 38 | | get_tile_info(machine(), tileinfo, tile_index, 1); |
| 37 | get_tile_info(tileinfo, tile_index, 1); |
| 39 | 38 | } |
| 40 | 39 | |
| 41 | 40 | TILE_GET_INFO_MEMBER(othldrby_state::get_tile_info2) |
| 42 | 41 | { |
| 43 | | get_tile_info(machine(), tileinfo, tile_index, 2); |
| 42 | get_tile_info(tileinfo, tile_index, 2); |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | |
| r20972 | r20973 | |
| 126 | 125 | |
| 127 | 126 | ***************************************************************************/ |
| 128 | 127 | |
| 129 | | static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) |
| 128 | void othldrby_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) |
| 130 | 129 | { |
| 131 | | othldrby_state *state = machine.driver_data<othldrby_state>(); |
| 132 | 130 | int offs; |
| 133 | 131 | |
| 134 | 132 | for (offs = 0; offs < SPRITERAM_SIZE; offs += 4) |
| 135 | 133 | { |
| 136 | 134 | int x, y, color, code, sx, sy, flipx, flipy, sizex, sizey, pri; |
| 137 | 135 | |
| 138 | | pri = (state->m_buf_spriteram[offs] & 0x0600) >> 9; |
| 136 | pri = (m_buf_spriteram[offs] & 0x0600) >> 9; |
| 139 | 137 | if (pri != priority) |
| 140 | 138 | continue; |
| 141 | 139 | |
| 142 | | flipx = state->m_buf_spriteram[offs] & 0x1000; |
| 140 | flipx = m_buf_spriteram[offs] & 0x1000; |
| 143 | 141 | flipy = 0; |
| 144 | | color = (state->m_buf_spriteram[offs] & 0x01fc) >> 2; |
| 145 | | code = state->m_buf_spriteram[offs + 1] | ((state->m_buf_spriteram[offs] & 0x0003) << 16); |
| 146 | | sx = (state->m_buf_spriteram[offs + 2] >> 7); |
| 147 | | sy = (state->m_buf_spriteram[offs + 3] >> 7); |
| 148 | | sizex = (state->m_buf_spriteram[offs + 2] & 0x000f) + 1; |
| 149 | | sizey = (state->m_buf_spriteram[offs + 3] & 0x000f) + 1; |
| 142 | color = (m_buf_spriteram[offs] & 0x01fc) >> 2; |
| 143 | code = m_buf_spriteram[offs + 1] | ((m_buf_spriteram[offs] & 0x0003) << 16); |
| 144 | sx = (m_buf_spriteram[offs + 2] >> 7); |
| 145 | sy = (m_buf_spriteram[offs + 3] >> 7); |
| 146 | sizex = (m_buf_spriteram[offs + 2] & 0x000f) + 1; |
| 147 | sizey = (m_buf_spriteram[offs + 3] & 0x000f) + 1; |
| 150 | 148 | |
| 151 | | if (state->flip_screen()) |
| 149 | if (flip_screen()) |
| 152 | 150 | { |
| 153 | 151 | flipx = !flipx; |
| 154 | 152 | flipy = !flipy; |
| r20972 | r20973 | |
| 160 | 158 | { |
| 161 | 159 | for (x = 0; x < sizex; x++) |
| 162 | 160 | { |
| 163 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[0], |
| 161 | drawgfx_transpen(bitmap,cliprect,machine().gfx[0], |
| 164 | 162 | code + x + sizex * y, |
| 165 | 163 | color, |
| 166 | 164 | flipx,flipy, |
| 167 | | (sx + (flipx ? (-8*(x+1)+1) : 8*x) - state->m_vreg[6]+44) & 0x1ff,(sy + (flipy ? (-8*(y+1)+1) : 8*y) - state->m_vreg[7]-9) & 0x1ff,0); |
| 165 | (sx + (flipx ? (-8*(x+1)+1) : 8*x) - m_vreg[6]+44) & 0x1ff,(sy + (flipy ? (-8*(y+1)+1) : 8*y) - m_vreg[7]-9) & 0x1ff,0); |
| 168 | 166 | } |
| 169 | 167 | } |
| 170 | 168 | } |
| r20972 | r20973 | |
| 196 | 194 | |
| 197 | 195 | for (layer = 0; layer < 3; layer++) |
| 198 | 196 | m_bg_tilemap[layer]->draw(bitmap, cliprect, 0, 0); |
| 199 | | draw_sprites(machine(), bitmap, cliprect, 0); |
| 197 | draw_sprites(bitmap, cliprect, 0); |
| 200 | 198 | |
| 201 | 199 | for (layer = 0; layer < 3; layer++) |
| 202 | 200 | m_bg_tilemap[layer]->draw(bitmap, cliprect, 1, 0); |
| 203 | | draw_sprites(machine(), bitmap, cliprect, 1); |
| 201 | draw_sprites(bitmap, cliprect, 1); |
| 204 | 202 | |
| 205 | 203 | for (layer = 0; layer < 3; layer++) |
| 206 | 204 | m_bg_tilemap[layer]->draw(bitmap, cliprect, 2, 0); |
| 207 | | draw_sprites(machine(), bitmap, cliprect, 2); |
| 205 | draw_sprites(bitmap, cliprect, 2); |
| 208 | 206 | |
| 209 | 207 | for (layer = 0; layer < 3; layer++) |
| 210 | 208 | m_bg_tilemap[layer]->draw(bitmap, cliprect, 3, 0); |
| 211 | | draw_sprites(machine(), bitmap, cliprect, 3); |
| 209 | draw_sprites(bitmap, cliprect, 3); |
| 212 | 210 | |
| 213 | 211 | return 0; |
| 214 | 212 | } |