trunk/src/mame/machine/rainbow.c
| r20975 | r20976 | |
| 642 | 642 | 0x042C60, 0x042D38 |
| 643 | 643 | }; |
| 644 | 644 | |
| 645 | | static void request_round_data( running_machine &machine ) |
| 645 | void rbisland_state::request_round_data( ) |
| 646 | 646 | { |
| 647 | | rbisland_state *state = machine.driver_data<rbisland_state>(); |
| 648 | | int round = state->m_CRAM[1][0x141]; /* 0...49 */ |
| 647 | int round = m_CRAM[1][0x141]; /* 0...49 */ |
| 649 | 648 | |
| 650 | | memcpy(state->m_CRAM[1], CROM_BANK1, sizeof CROM_BANK1); |
| 651 | | memcpy(state->m_CRAM[2], CROM_BANK2, sizeof CROM_BANK2); |
| 649 | memcpy(m_CRAM[1], CROM_BANK1, sizeof CROM_BANK1); |
| 650 | memcpy(m_CRAM[2], CROM_BANK2, sizeof CROM_BANK2); |
| 652 | 651 | |
| 653 | | state->m_CRAM[1][1] = cchip_round_height[round] >> 0; |
| 654 | | state->m_CRAM[1][2] = cchip_round_height[round] >> 8; |
| 652 | m_CRAM[1][1] = cchip_round_height[round] >> 0; |
| 653 | m_CRAM[1][2] = cchip_round_height[round] >> 8; |
| 655 | 654 | |
| 656 | | state->m_CRAM[1][0x142] = cchip_round_address[round] >> 24; |
| 657 | | state->m_CRAM[1][0x143] = cchip_round_address[round] >> 16; |
| 658 | | state->m_CRAM[1][0x144] = cchip_round_address[round] >> 8; |
| 659 | | state->m_CRAM[1][0x145] = cchip_round_address[round] >> 0; |
| 655 | m_CRAM[1][0x142] = cchip_round_address[round] >> 24; |
| 656 | m_CRAM[1][0x143] = cchip_round_address[round] >> 16; |
| 657 | m_CRAM[1][0x144] = cchip_round_address[round] >> 8; |
| 658 | m_CRAM[1][0x145] = cchip_round_address[round] >> 0; |
| 660 | 659 | |
| 661 | 660 | /* set the secret room or boss flag */ |
| 662 | 661 | |
| 663 | | state->m_CRAM[1][0x148] = (round >= 40 || round % 4 == 3); |
| 662 | m_CRAM[1][0x148] = (round >= 40 || round % 4 == 3); |
| 664 | 663 | } |
| 665 | 664 | |
| 666 | | static void request_world_data( running_machine &machine ) |
| 665 | void rbisland_state::request_world_data( ) |
| 667 | 666 | { |
| 668 | | rbisland_state *state = machine.driver_data<rbisland_state>(); |
| 669 | | int world = state->m_CRAM[0][0x00d] / 4; /* 0...9 */ |
| 667 | int world = m_CRAM[0][0x00d] / 4; /* 0...9 */ |
| 670 | 668 | |
| 671 | 669 | /* the extra version has the world data swapped around */ |
| 672 | 670 | |
| 673 | | if (state->m_extra_version) |
| 671 | if (m_extra_version) |
| 674 | 672 | { |
| 675 | 673 | static const UINT8 world_swap[] = |
| 676 | 674 | { |
| r20975 | r20976 | |
| 682 | 680 | |
| 683 | 681 | /* first two bytes in each bank are left unchanged */ |
| 684 | 682 | |
| 685 | | memcpy(state->m_CRAM[4] + 2, CROM_BANK4[world].data, CROM_BANK4[world].size); |
| 686 | | memcpy(state->m_CRAM[5] + 2, CROM_BANK5[world].data, CROM_BANK5[world].size); |
| 687 | | memcpy(state->m_CRAM[7] + 2, CROM_BANK7[world].data, CROM_BANK7[world].size); |
| 683 | memcpy(m_CRAM[4] + 2, CROM_BANK4[world].data, CROM_BANK4[world].size); |
| 684 | memcpy(m_CRAM[5] + 2, CROM_BANK5[world].data, CROM_BANK5[world].size); |
| 685 | memcpy(m_CRAM[7] + 2, CROM_BANK7[world].data, CROM_BANK7[world].size); |
| 688 | 686 | |
| 689 | 687 | /* banks 5 and 6 are different in the extra version */ |
| 690 | 688 | |
| 691 | | if (state->m_extra_version) |
| 689 | if (m_extra_version) |
| 692 | 690 | { |
| 693 | 691 | int i; |
| 694 | 692 | |
| r20975 | r20976 | |
| 698 | 696 | |
| 699 | 697 | if (patch != 0) |
| 700 | 698 | { |
| 701 | | state->m_CRAM[5][state->m_CRAM[5][2] + 22 * i + 18] = patch >> 0; |
| 702 | | state->m_CRAM[5][state->m_CRAM[5][2] + 22 * i + 19] = patch >> 8; |
| 699 | m_CRAM[5][m_CRAM[5][2] + 22 * i + 18] = patch >> 0; |
| 700 | m_CRAM[5][m_CRAM[5][2] + 22 * i + 19] = patch >> 8; |
| 703 | 701 | } |
| 704 | 702 | } |
| 705 | 703 | |
| 706 | | memcpy(state->m_CRAM[6] + 2, CROM_BANK6_EXTRA, sizeof CROM_BANK6_EXTRA); |
| 704 | memcpy(m_CRAM[6] + 2, CROM_BANK6_EXTRA, sizeof CROM_BANK6_EXTRA); |
| 707 | 705 | } |
| 708 | 706 | else |
| 709 | 707 | { |
| 710 | | memcpy(state->m_CRAM[6] + 2, CROM_BANK6, sizeof CROM_BANK6); |
| 708 | memcpy(m_CRAM[6] + 2, CROM_BANK6, sizeof CROM_BANK6); |
| 711 | 709 | } |
| 712 | 710 | } |
| 713 | 711 | |
| 714 | | static void request_goalin_data( running_machine &machine ) |
| 712 | void rbisland_state::request_goalin_data( ) |
| 715 | 713 | { |
| 716 | | rbisland_state *state = machine.driver_data<rbisland_state>(); |
| 717 | | int n = machine.rand() % 15; |
| 714 | int n = machine().rand() % 15; |
| 718 | 715 | |
| 719 | | state->m_CRAM[1][0x14B] = 0x00; /* x coordinates */ |
| 720 | | state->m_CRAM[1][0x14D] = 0x10; |
| 721 | | state->m_CRAM[1][0x14F] = 0x20; |
| 722 | | state->m_CRAM[1][0x151] = 0x38; |
| 723 | | state->m_CRAM[1][0x153] = 0x50; |
| 724 | | state->m_CRAM[1][0x155] = 0x60; |
| 716 | m_CRAM[1][0x14B] = 0x00; /* x coordinates */ |
| 717 | m_CRAM[1][0x14D] = 0x10; |
| 718 | m_CRAM[1][0x14F] = 0x20; |
| 719 | m_CRAM[1][0x151] = 0x38; |
| 720 | m_CRAM[1][0x153] = 0x50; |
| 721 | m_CRAM[1][0x155] = 0x60; |
| 725 | 722 | |
| 726 | | state->m_CRAM[1][0x14A] = cchip_goalin[n][0]; /* y coordinates */ |
| 727 | | state->m_CRAM[1][0x14C] = cchip_goalin[n][1]; |
| 728 | | state->m_CRAM[1][0x14E] = cchip_goalin[n][2]; |
| 729 | | state->m_CRAM[1][0x150] = cchip_goalin[n][3]; |
| 730 | | state->m_CRAM[1][0x152] = cchip_goalin[n][4]; |
| 731 | | state->m_CRAM[1][0x154] = cchip_goalin[n][5]; |
| 723 | m_CRAM[1][0x14A] = cchip_goalin[n][0]; /* y coordinates */ |
| 724 | m_CRAM[1][0x14C] = cchip_goalin[n][1]; |
| 725 | m_CRAM[1][0x14E] = cchip_goalin[n][2]; |
| 726 | m_CRAM[1][0x150] = cchip_goalin[n][3]; |
| 727 | m_CRAM[1][0x152] = cchip_goalin[n][4]; |
| 728 | m_CRAM[1][0x154] = cchip_goalin[n][5]; |
| 732 | 729 | } |
| 733 | 730 | |
| 734 | 731 | TIMER_CALLBACK_MEMBER(rbisland_state::cchip_timer) |
| 735 | 732 | { |
| 736 | 733 | if (m_CRAM[1][0x100] == 1) |
| 737 | 734 | { |
| 738 | | request_round_data(machine()); |
| 735 | request_round_data(); |
| 739 | 736 | |
| 740 | 737 | m_CRAM[1][0x100] = 0xFF; |
| 741 | 738 | } |
| 742 | 739 | |
| 743 | 740 | if (m_CRAM[5][0x000] == 1) |
| 744 | 741 | { |
| 745 | | request_world_data(machine()); |
| 742 | request_world_data(); |
| 746 | 743 | |
| 747 | 744 | m_CRAM[5][0x000] = 0xFF; |
| 748 | 745 | } |
| 749 | 746 | |
| 750 | 747 | if (m_CRAM[1][0x149] == 1) |
| 751 | 748 | { |
| 752 | | request_goalin_data(machine()); |
| 749 | request_goalin_data(); |
| 753 | 750 | |
| 754 | 751 | m_CRAM[1][0x149] = 0xFF; |
| 755 | 752 | } |
| r20975 | r20976 | |
| 812 | 809 | * |
| 813 | 810 | *************************************/ |
| 814 | 811 | |
| 815 | | void rbisland_cchip_init( running_machine &machine, int version ) |
| 812 | void rbisland_state::rbisland_cchip_init( int version ) |
| 816 | 813 | { |
| 817 | | rbisland_state *state = machine.driver_data<rbisland_state>(); |
| 818 | 814 | int i; |
| 819 | 815 | |
| 820 | | state->m_extra_version = version; |
| 816 | m_extra_version = version; |
| 821 | 817 | |
| 822 | 818 | for (i = 0; i < 8; i++) |
| 823 | 819 | { |
| 824 | | state->m_CRAM[i] = auto_alloc_array(machine, UINT8, 0x400); |
| 820 | m_CRAM[i] = auto_alloc_array(machine(), UINT8, 0x400); |
| 825 | 821 | |
| 826 | | state_save_register_item_pointer(machine, "cchip", NULL, i, state->m_CRAM[i], 0x400); |
| 822 | state_save_register_item_pointer(machine(), "cchip", NULL, i, m_CRAM[i], 0x400); |
| 827 | 823 | } |
| 828 | 824 | |
| 829 | | state_save_register_item(machine, "cchip", NULL, 0, state->m_current_bank); |
| 825 | state_save_register_item(machine(), "cchip", NULL, 0, m_current_bank); |
| 830 | 826 | |
| 831 | | machine.scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(rbisland_state::cchip_timer),state)); |
| 827 | machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(rbisland_state::cchip_timer),this)); |
| 832 | 828 | } |
trunk/src/mame/video/rpunch.c
| r20975 | r20976 | |
| 191 | 191 | * |
| 192 | 192 | *************************************/ |
| 193 | 193 | |
| 194 | | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop) |
| 194 | void rpunch_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop) |
| 195 | 195 | { |
| 196 | | rpunch_state *state = machine.driver_data<rpunch_state>(); |
| 197 | | UINT16 *spriteram16 = state->m_spriteram; |
| 196 | UINT16 *spriteram16 = m_spriteram; |
| 198 | 197 | int offs; |
| 199 | 198 | |
| 200 | 199 | start *= 4; |
| r20975 | r20976 | |
| 212 | 211 | int y = 513 - (data0 & 0x1ff); |
| 213 | 212 | int xflip = data1 & 0x1000; |
| 214 | 213 | int yflip = data1 & 0x0800; |
| 215 | | int color = ((data1 >> 13) & 7) | ((state->m_videoflags & 0x0040) >> 3); |
| 214 | int color = ((data1 >> 13) & 7) | ((m_videoflags & 0x0040) >> 3); |
| 216 | 215 | |
| 217 | 216 | if (x >= BITMAP_WIDTH) x -= 512; |
| 218 | 217 | if (y >= BITMAP_HEIGHT) y -= 512; |
| 219 | 218 | |
| 220 | | drawgfx_transpen(bitmap, cliprect, machine.gfx[2], |
| 221 | | code, color + (state->m_sprite_palette / 16), xflip, yflip, x, y, 15); |
| 219 | drawgfx_transpen(bitmap, cliprect, machine().gfx[2], |
| 220 | code, color + (m_sprite_palette / 16), xflip, yflip, x, y, 15); |
| 222 | 221 | } |
| 223 | 222 | } |
| 224 | 223 | |
| r20975 | r20976 | |
| 229 | 228 | * |
| 230 | 229 | *************************************/ |
| 231 | 230 | |
| 232 | | static void draw_bitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 231 | void rpunch_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 233 | 232 | { |
| 234 | | rpunch_state *state = machine.driver_data<rpunch_state>(); |
| 235 | 233 | int colourbase; |
| 236 | 234 | int xxx=512/4; |
| 237 | 235 | int yyy=256; |
| 238 | 236 | int x,y,count; |
| 239 | 237 | |
| 240 | | colourbase = 512 + ((state->m_videoflags & 15) * 16); |
| 238 | colourbase = 512 + ((m_videoflags & 15) * 16); |
| 241 | 239 | |
| 242 | 240 | count = 0; |
| 243 | 241 | |
| r20975 | r20976 | |
| 246 | 244 | for(x=0;x<xxx;x++) |
| 247 | 245 | { |
| 248 | 246 | int coldat; |
| 249 | | coldat = (state->m_bitmapram[count]>>12)&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+0)-4)&0x1ff) = coldat+colourbase; |
| 250 | | coldat = (state->m_bitmapram[count]>>8 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+1)-4)&0x1ff) = coldat+colourbase; |
| 251 | | coldat = (state->m_bitmapram[count]>>4 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+2)-4)&0x1ff) = coldat+colourbase; |
| 252 | | coldat = (state->m_bitmapram[count]>>0 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+3)-4)&0x1ff) = coldat+colourbase; |
| 247 | coldat = (m_bitmapram[count]>>12)&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+0)-4)&0x1ff) = coldat+colourbase; |
| 248 | coldat = (m_bitmapram[count]>>8 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+1)-4)&0x1ff) = coldat+colourbase; |
| 249 | coldat = (m_bitmapram[count]>>4 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+2)-4)&0x1ff) = coldat+colourbase; |
| 250 | coldat = (m_bitmapram[count]>>0 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+3)-4)&0x1ff) = coldat+colourbase; |
| 253 | 251 | count++; |
| 254 | 252 | } |
| 255 | 253 | } |
| r20975 | r20976 | |
| 270 | 268 | effbins = (m_bins > m_gins) ? m_gins : m_bins; |
| 271 | 269 | |
| 272 | 270 | m_background[0]->draw(bitmap, cliprect, 0,0); |
| 273 | | draw_sprites(machine(), bitmap, cliprect, 0, effbins); |
| 271 | draw_sprites(bitmap, cliprect, 0, effbins); |
| 274 | 272 | m_background[1]->draw(bitmap, cliprect, 0,0); |
| 275 | | draw_sprites(machine(), bitmap, cliprect, effbins, m_gins); |
| 273 | draw_sprites(bitmap, cliprect, effbins, m_gins); |
| 276 | 274 | if (m_bitmapram) |
| 277 | | draw_bitmap(machine(), bitmap, cliprect); |
| 275 | draw_bitmap(bitmap, cliprect); |
| 278 | 276 | return 0; |
| 279 | 277 | } |
trunk/src/mame/video/rallyx.c
| r20975 | r20976 | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | |
| 225 | | INLINE void rallyx_get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int ram_offs) |
| 225 | inline void rallyx_state::rallyx_get_tile_info( tile_data &tileinfo, int tile_index, int ram_offs) |
| 226 | 226 | { |
| 227 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 228 | | UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800]; |
| 227 | UINT8 attr = m_videoram[ram_offs + tile_index + 0x800]; |
| 229 | 228 | tileinfo.category = (attr & 0x20) >> 5; |
| 230 | | SET_TILE_INFO( |
| 229 | SET_TILE_INFO_MEMBER( |
| 231 | 230 | 0, |
| 232 | | state->m_videoram[ram_offs + tile_index], |
| 231 | m_videoram[ram_offs + tile_index], |
| 233 | 232 | attr & 0x3f, |
| 234 | 233 | TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX); |
| 235 | 234 | } |
| 236 | 235 | |
| 237 | 236 | TILE_GET_INFO_MEMBER(rallyx_state::rallyx_bg_get_tile_info) |
| 238 | 237 | { |
| 239 | | rallyx_get_tile_info(machine(), tileinfo, tile_index, 0x400); |
| 238 | rallyx_get_tile_info(tileinfo, tile_index, 0x400); |
| 240 | 239 | } |
| 241 | 240 | |
| 242 | 241 | TILE_GET_INFO_MEMBER(rallyx_state::rallyx_fg_get_tile_info) |
| 243 | 242 | { |
| 244 | | rallyx_get_tile_info(machine(), tileinfo, tile_index, 0x000); |
| 243 | rallyx_get_tile_info(tileinfo, tile_index, 0x000); |
| 245 | 244 | } |
| 246 | 245 | |
| 247 | 246 | |
| 248 | | INLINE void locomotn_get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,int ram_offs) |
| 247 | inline void rallyx_state::locomotn_get_tile_info(tile_data &tileinfo,int tile_index,int ram_offs) |
| 249 | 248 | { |
| 250 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 251 | | UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800]; |
| 252 | | int code = state->m_videoram[ram_offs + tile_index]; |
| 249 | UINT8 attr = m_videoram[ram_offs + tile_index + 0x800]; |
| 250 | int code = m_videoram[ram_offs + tile_index]; |
| 253 | 251 | code = (code & 0x7f) + 2 * (attr & 0x40) + 2 * (code & 0x80); |
| 254 | 252 | tileinfo.category = (attr & 0x20) >> 5; |
| 255 | | SET_TILE_INFO( |
| 253 | SET_TILE_INFO_MEMBER( |
| 256 | 254 | 0, |
| 257 | 255 | code, |
| 258 | 256 | attr & 0x3f, |
| r20975 | r20976 | |
| 261 | 259 | |
| 262 | 260 | TILE_GET_INFO_MEMBER(rallyx_state::locomotn_bg_get_tile_info) |
| 263 | 261 | { |
| 264 | | locomotn_get_tile_info(machine(), tileinfo, tile_index, 0x400); |
| 262 | locomotn_get_tile_info(tileinfo, tile_index, 0x400); |
| 265 | 263 | } |
| 266 | 264 | |
| 267 | 265 | TILE_GET_INFO_MEMBER(rallyx_state::locomotn_fg_get_tile_info) |
| 268 | 266 | { |
| 269 | | locomotn_get_tile_info(machine(), tileinfo, tile_index, 0x000); |
| 267 | locomotn_get_tile_info(tileinfo, tile_index, 0x000); |
| 270 | 268 | } |
| 271 | 269 | |
| 272 | 270 | |
| r20975 | r20976 | |
| 277 | 275 | |
| 278 | 276 | ***************************************************************************/ |
| 279 | 277 | |
| 280 | | static void calculate_star_field( running_machine &machine ) |
| 278 | void rallyx_state::calculate_star_field( ) |
| 281 | 279 | { |
| 282 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 283 | 280 | int generator; |
| 284 | 281 | int x, y; |
| 285 | 282 | |
| 286 | 283 | /* precalculate the star background */ |
| 287 | | state->m_total_stars = 0; |
| 284 | m_total_stars = 0; |
| 288 | 285 | generator = 0; |
| 289 | 286 | |
| 290 | 287 | for (y = 0; y < 256; y++) |
| r20975 | r20976 | |
| 304 | 301 | { |
| 305 | 302 | int color = (~(generator >> 8)) & 0x3f; |
| 306 | 303 | |
| 307 | | if (color && state->m_total_stars < JUNGLER_MAX_STARS) |
| 304 | if (color && m_total_stars < JUNGLER_MAX_STARS) |
| 308 | 305 | { |
| 309 | | state->m_stars[state->m_total_stars].x = x; |
| 310 | | state->m_stars[state->m_total_stars].y = y; |
| 311 | | state->m_stars[state->m_total_stars].color = color; |
| 306 | m_stars[m_total_stars].x = x; |
| 307 | m_stars[m_total_stars].y = y; |
| 308 | m_stars[m_total_stars].color = color; |
| 312 | 309 | |
| 313 | | state->m_total_stars++; |
| 310 | m_total_stars++; |
| 314 | 311 | } |
| 315 | 312 | } |
| 316 | 313 | } |
| 317 | 314 | } |
| 318 | 315 | } |
| 319 | 316 | |
| 320 | | static void rallyx_video_start_common( running_machine &machine ) |
| 317 | void rallyx_state::rallyx_video_start_common( ) |
| 321 | 318 | { |
| 322 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 323 | 319 | int i; |
| 324 | 320 | |
| 325 | | state->m_spriteram = state->m_videoram + 0x00; |
| 326 | | state->m_spriteram2 = state->m_spriteram + 0x800; |
| 327 | | state->m_radarx = state->m_videoram + 0x20; |
| 328 | | state->m_radary = state->m_radarx + 0x800; |
| 321 | m_spriteram = m_videoram + 0x00; |
| 322 | m_spriteram2 = m_spriteram + 0x800; |
| 323 | m_radarx = m_videoram + 0x20; |
| 324 | m_radary = m_radarx + 0x800; |
| 329 | 325 | |
| 330 | 326 | for (i = 0; i < 16; i++) |
| 331 | | machine.shadow_table[i] = i + 16; |
| 327 | machine().shadow_table[i] = i + 16; |
| 332 | 328 | |
| 333 | 329 | for (i = 16; i < 32; i++) |
| 334 | | machine.shadow_table[i] = i; |
| 330 | machine().shadow_table[i] = i; |
| 335 | 331 | |
| 336 | 332 | for (i = 0; i < 3; i++) |
| 337 | | state->m_drawmode_table[i] = DRAWMODE_SHADOW; |
| 333 | m_drawmode_table[i] = DRAWMODE_SHADOW; |
| 338 | 334 | |
| 339 | | state->m_drawmode_table[3] = DRAWMODE_NONE; |
| 335 | m_drawmode_table[3] = DRAWMODE_NONE; |
| 340 | 336 | } |
| 341 | 337 | |
| 342 | 338 | VIDEO_START_MEMBER(rallyx_state,rallyx) |
| r20975 | r20976 | |
| 349 | 345 | |
| 350 | 346 | m_spriteram_base = 0x14; |
| 351 | 347 | |
| 352 | | rallyx_video_start_common(machine()); |
| 348 | rallyx_video_start_common(); |
| 353 | 349 | } |
| 354 | 350 | |
| 355 | 351 | |
| r20975 | r20976 | |
| 360 | 356 | |
| 361 | 357 | m_spriteram_base = 0x14; |
| 362 | 358 | |
| 363 | | rallyx_video_start_common(machine()); |
| 364 | | calculate_star_field(machine()); |
| 359 | rallyx_video_start_common(); |
| 360 | calculate_star_field(); |
| 365 | 361 | } |
| 366 | 362 | |
| 367 | 363 | |
| r20975 | r20976 | |
| 379 | 375 | |
| 380 | 376 | m_spriteram_base = 0x14; |
| 381 | 377 | |
| 382 | | rallyx_video_start_common(machine()); |
| 383 | | calculate_star_field(machine()); |
| 378 | rallyx_video_start_common(); |
| 379 | calculate_star_field(); |
| 384 | 380 | } |
| 385 | 381 | |
| 386 | 382 | |
| r20975 | r20976 | |
| 399 | 395 | /* commsega has more sprites and bullets than the other games */ |
| 400 | 396 | m_spriteram_base = 0x00; |
| 401 | 397 | |
| 402 | | rallyx_video_start_common(machine()); |
| 403 | | calculate_star_field(machine()); |
| 398 | rallyx_video_start_common(); |
| 399 | calculate_star_field(); |
| 404 | 400 | } |
| 405 | 401 | |
| 406 | 402 | |
| r20975 | r20976 | |
| 435 | 431 | } |
| 436 | 432 | |
| 437 | 433 | |
| 438 | | static void plot_star( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color ) |
| 434 | void rallyx_state::plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color ) |
| 439 | 435 | { |
| 440 | 436 | if (!cliprect.contains(x, y)) |
| 441 | 437 | return; |
| 442 | 438 | |
| 443 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 444 | | if (state->flip_screen_x()) |
| 439 | if (flip_screen_x()) |
| 445 | 440 | x = 255 - x; |
| 446 | 441 | |
| 447 | | if (state->flip_screen_y()) |
| 442 | if (flip_screen_y()) |
| 448 | 443 | y = 255 - y; |
| 449 | 444 | |
| 450 | | if (colortable_entry_get_value(machine.colortable, bitmap.pix16(y, x) % 0x144) == 0) |
| 445 | if (colortable_entry_get_value(machine().colortable, bitmap.pix16(y, x) % 0x144) == 0) |
| 451 | 446 | bitmap.pix16(y, x) = STARS_COLOR_BASE + color; |
| 452 | 447 | } |
| 453 | 448 | |
| 454 | | static void draw_stars( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 449 | void rallyx_state::draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 455 | 450 | { |
| 456 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 457 | 451 | int offs; |
| 458 | 452 | |
| 459 | | for (offs = 0; offs < state->m_total_stars; offs++) |
| 453 | for (offs = 0; offs < m_total_stars; offs++) |
| 460 | 454 | { |
| 461 | | int x = state->m_stars[offs].x; |
| 462 | | int y = state->m_stars[offs].y; |
| 455 | int x = m_stars[offs].x; |
| 456 | int y = m_stars[offs].y; |
| 463 | 457 | |
| 464 | 458 | if ((y & 0x01) ^ ((x >> 3) & 0x01)) |
| 465 | | plot_star(machine, bitmap, cliprect, x, y, state->m_stars[offs].color); |
| 459 | plot_star(bitmap, cliprect, x, y, m_stars[offs].color); |
| 466 | 460 | } |
| 467 | 461 | } |
| 468 | 462 | |
| 469 | 463 | |
| 470 | | static void rallyx_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement ) |
| 464 | void rallyx_state::rallyx_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement ) |
| 471 | 465 | { |
| 472 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 473 | | UINT8 *spriteram = state->m_spriteram; |
| 474 | | UINT8 *spriteram_2 = state->m_spriteram2; |
| 466 | UINT8 *spriteram = m_spriteram; |
| 467 | UINT8 *spriteram_2 = m_spriteram2; |
| 475 | 468 | int offs; |
| 476 | 469 | |
| 477 | | for (offs = 0x20 - 2; offs >= state->m_spriteram_base; offs -= 2) |
| 470 | for (offs = 0x20 - 2; offs >= m_spriteram_base; offs -= 2) |
| 478 | 471 | { |
| 479 | 472 | int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1) - displacement; |
| 480 | 473 | int sy = 241 - spriteram_2[offs] - displacement; |
| 481 | 474 | int color = spriteram_2[offs + 1] & 0x3f; |
| 482 | 475 | int flipx = spriteram[offs] & 1; |
| 483 | 476 | int flipy = spriteram[offs] & 2; |
| 484 | | if (state->flip_screen()) |
| 477 | if (flip_screen()) |
| 485 | 478 | sx -= 2 * displacement; |
| 486 | 479 | |
| 487 | | pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1], |
| 480 | pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1], |
| 488 | 481 | (spriteram[offs] & 0xfc) >> 2, |
| 489 | 482 | color, |
| 490 | 483 | flipx,flipy, |
| 491 | 484 | sx,sy, |
| 492 | | machine.priority_bitmap,0x02, |
| 493 | | colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); |
| 485 | machine().priority_bitmap,0x02, |
| 486 | colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0)); |
| 494 | 487 | } |
| 495 | 488 | } |
| 496 | 489 | |
| 497 | | static void locomotn_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement ) |
| 490 | void rallyx_state::locomotn_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement ) |
| 498 | 491 | { |
| 499 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 500 | | UINT8 *spriteram = state->m_spriteram; |
| 501 | | UINT8 *spriteram_2 = state->m_spriteram2; |
| 492 | UINT8 *spriteram = m_spriteram; |
| 493 | UINT8 *spriteram_2 = m_spriteram2; |
| 502 | 494 | int offs; |
| 503 | 495 | |
| 504 | | for (offs = 0x20 - 2; offs >= state->m_spriteram_base; offs -= 2) |
| 496 | for (offs = 0x20 - 2; offs >= m_spriteram_base; offs -= 2) |
| 505 | 497 | { |
| 506 | 498 | int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1); |
| 507 | 499 | int sy = 241 - spriteram_2[offs] - displacement; |
| 508 | 500 | int color = spriteram_2[offs + 1] & 0x3f; |
| 509 | 501 | int flip = spriteram[offs] & 2; |
| 510 | 502 | |
| 511 | | pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1], |
| 503 | pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1], |
| 512 | 504 | ((spriteram[offs] & 0x7c) >> 2) + 0x20*(spriteram[offs] & 0x01) + ((spriteram[offs] & 0x80) >> 1), |
| 513 | 505 | color, |
| 514 | 506 | flip,flip, |
| 515 | 507 | sx,sy, |
| 516 | | machine.priority_bitmap,0x02, |
| 517 | | colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); |
| 508 | machine().priority_bitmap,0x02, |
| 509 | colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0)); |
| 518 | 510 | } |
| 519 | 511 | } |
| 520 | 512 | |
| 521 | | static void rallyx_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen ) |
| 513 | void rallyx_state::rallyx_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen ) |
| 522 | 514 | { |
| 523 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 524 | 515 | int offs; |
| 525 | 516 | |
| 526 | | for (offs = state->m_spriteram_base; offs < 0x20; offs++) |
| 517 | for (offs = m_spriteram_base; offs < 0x20; offs++) |
| 527 | 518 | { |
| 528 | 519 | int x, y; |
| 529 | 520 | |
| 530 | | x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x01) << 8); |
| 531 | | y = 253 - state->m_radary[offs]; |
| 532 | | if (state->flip_screen()) |
| 521 | x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x01) << 8); |
| 522 | y = 253 - m_radary[offs]; |
| 523 | if (flip_screen()) |
| 533 | 524 | x -= 3; |
| 534 | 525 | |
| 535 | 526 | if (transpen) |
| 536 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], |
| 537 | | ((state->m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, |
| 527 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], |
| 528 | ((m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, |
| 538 | 529 | 0, |
| 539 | 530 | 0,0, |
| 540 | 531 | x,y, |
| 541 | 532 | 3); |
| 542 | 533 | else |
| 543 | | drawgfx_transtable(bitmap,cliprect,machine.gfx[2], |
| 544 | | ((state->m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, |
| 534 | drawgfx_transtable(bitmap,cliprect,machine().gfx[2], |
| 535 | ((m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07, |
| 545 | 536 | 0, |
| 546 | 537 | 0,0, |
| 547 | 538 | x,y, |
| 548 | | state->m_drawmode_table,machine.shadow_table); |
| 539 | m_drawmode_table,machine().shadow_table); |
| 549 | 540 | } |
| 550 | 541 | } |
| 551 | 542 | |
| 552 | | static void jungler_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen ) |
| 543 | void rallyx_state::jungler_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen ) |
| 553 | 544 | { |
| 554 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 555 | 545 | int offs; |
| 556 | 546 | |
| 557 | | for (offs = state->m_spriteram_base; offs < 0x20; offs++) |
| 547 | for (offs = m_spriteram_base; offs < 0x20; offs++) |
| 558 | 548 | { |
| 559 | 549 | int x, y; |
| 560 | 550 | |
| 561 | | x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x08) << 5); |
| 562 | | y = 253 - state->m_radary[offs]; |
| 551 | x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x08) << 5); |
| 552 | y = 253 - m_radary[offs]; |
| 563 | 553 | |
| 564 | 554 | if (transpen) |
| 565 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], |
| 566 | | (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 555 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], |
| 556 | (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 567 | 557 | 0, |
| 568 | 558 | 0,0, |
| 569 | 559 | x,y, |
| 570 | 560 | 3); |
| 571 | 561 | else |
| 572 | | drawgfx_transtable(bitmap,cliprect,machine.gfx[2], |
| 573 | | (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 562 | drawgfx_transtable(bitmap,cliprect,machine().gfx[2], |
| 563 | (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 574 | 564 | 0, |
| 575 | 565 | 0,0, |
| 576 | 566 | x,y, |
| 577 | | state->m_drawmode_table,machine.shadow_table); |
| 567 | m_drawmode_table,machine().shadow_table); |
| 578 | 568 | } |
| 579 | 569 | } |
| 580 | 570 | |
| 581 | | static void locomotn_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen ) |
| 571 | void rallyx_state::locomotn_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen ) |
| 582 | 572 | { |
| 583 | | rallyx_state *state = machine.driver_data<rallyx_state>(); |
| 584 | 573 | int offs; |
| 585 | 574 | |
| 586 | | for (offs = state->m_spriteram_base; offs < 0x20; offs++) |
| 575 | for (offs = m_spriteram_base; offs < 0x20; offs++) |
| 587 | 576 | { |
| 588 | 577 | int x, y; |
| 589 | 578 | |
| r20975 | r20976 | |
| 595 | 584 | so 8024-8033 and 8824-8833 are not used |
| 596 | 585 | */ |
| 597 | 586 | |
| 598 | | x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x08) << 5); |
| 599 | | y = 252 - state->m_radary[offs]; |
| 587 | x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x08) << 5); |
| 588 | y = 252 - m_radary[offs]; |
| 600 | 589 | |
| 601 | 590 | if (transpen) |
| 602 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], |
| 603 | | (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 591 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], |
| 592 | (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 604 | 593 | 0, |
| 605 | 594 | 0,0, |
| 606 | 595 | x,y, |
| 607 | 596 | 3); |
| 608 | 597 | else |
| 609 | | drawgfx_transtable(bitmap,cliprect,machine.gfx[2], |
| 610 | | (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 598 | drawgfx_transtable(bitmap,cliprect,machine().gfx[2], |
| 599 | (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07, |
| 611 | 600 | 0, |
| 612 | 601 | 0,0, |
| 613 | 602 | x,y, |
| 614 | | state->m_drawmode_table,machine.shadow_table); |
| 603 | m_drawmode_table,machine().shadow_table); |
| 615 | 604 | } |
| 616 | 605 | } |
| 617 | 606 | |
| r20975 | r20976 | |
| 641 | 630 | m_bg_tilemap->draw(bitmap, bg_clip, 1, 1); |
| 642 | 631 | m_fg_tilemap->draw(bitmap, fg_clip, 1, 1); |
| 643 | 632 | |
| 644 | | rallyx_draw_bullets(machine(), bitmap, cliprect, TRUE); |
| 645 | | rallyx_draw_sprites(machine(), bitmap, cliprect, 1); |
| 646 | | rallyx_draw_bullets(machine(), bitmap, cliprect, FALSE); |
| 633 | rallyx_draw_bullets(bitmap, cliprect, TRUE); |
| 634 | rallyx_draw_sprites(bitmap, cliprect, 1); |
| 635 | rallyx_draw_bullets(bitmap, cliprect, FALSE); |
| 647 | 636 | |
| 648 | 637 | return 0; |
| 649 | 638 | } |
| r20975 | r20976 | |
| 675 | 664 | m_bg_tilemap->draw(bitmap, bg_clip, 1, 0); |
| 676 | 665 | m_fg_tilemap->draw(bitmap, fg_clip, 1, 0); |
| 677 | 666 | |
| 678 | | jungler_draw_bullets(machine(), bitmap, cliprect, TRUE); |
| 679 | | rallyx_draw_sprites(machine(), bitmap, cliprect, 0); |
| 680 | | jungler_draw_bullets(machine(), bitmap, cliprect, FALSE); |
| 667 | jungler_draw_bullets(bitmap, cliprect, TRUE); |
| 668 | rallyx_draw_sprites(bitmap, cliprect, 0); |
| 669 | jungler_draw_bullets(bitmap, cliprect, FALSE); |
| 681 | 670 | |
| 682 | 671 | if (m_stars_enable) |
| 683 | | draw_stars(machine(), bitmap, cliprect); |
| 672 | draw_stars(bitmap, cliprect); |
| 684 | 673 | |
| 685 | 674 | return 0; |
| 686 | 675 | } |
| r20975 | r20976 | |
| 720 | 709 | m_bg_tilemap->draw(bitmap, bg_clip, 1, 1); |
| 721 | 710 | m_fg_tilemap->draw(bitmap, fg_clip, 1, 1); |
| 722 | 711 | |
| 723 | | locomotn_draw_bullets(machine(), bitmap, cliprect, TRUE); |
| 724 | | locomotn_draw_sprites(machine(), bitmap, cliprect, 0); |
| 725 | | locomotn_draw_bullets(machine(), bitmap, cliprect, FALSE); |
| 712 | locomotn_draw_bullets(bitmap, cliprect, TRUE); |
| 713 | locomotn_draw_sprites(bitmap, cliprect, 0); |
| 714 | locomotn_draw_bullets(bitmap, cliprect, FALSE); |
| 726 | 715 | |
| 727 | 716 | if (m_stars_enable) |
| 728 | | draw_stars(machine(), bitmap, cliprect); |
| 717 | draw_stars(bitmap, cliprect); |
| 729 | 718 | |
| 730 | 719 | return 0; |
| 731 | 720 | } |
trunk/src/mame/video/realbrk.c
| r20975 | r20976 | |
| 204 | 204 | |
| 205 | 205 | ***************************************************************************/ |
| 206 | 206 | |
| 207 | | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 207 | void realbrk_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 208 | 208 | { |
| 209 | | realbrk_state *state = machine.driver_data<realbrk_state>(); |
| 210 | | UINT16 *spriteram16 = state->m_spriteram; |
| 209 | UINT16 *spriteram16 = m_spriteram; |
| 211 | 210 | int offs; |
| 212 | 211 | |
| 213 | | int max_x = machine.primary_screen->width(); |
| 214 | | int max_y = machine.primary_screen->height(); |
| 212 | int max_x = machine().primary_screen->width(); |
| 213 | int max_y = machine().primary_screen->height(); |
| 215 | 214 | |
| 216 | 215 | rectangle spritetile_clip(0, 31, 0, 31); |
| 217 | 216 | |
| r20975 | r20976 | |
| 252 | 251 | xdim = ((zoom & 0x00ff) >> 0) << (16-6+4); |
| 253 | 252 | ydim = ((zoom & 0xff00) >> 8) << (16-6+4); |
| 254 | 253 | |
| 255 | | if (state->flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; } |
| 256 | | if (state->flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; } |
| 254 | if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; } |
| 255 | if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; } |
| 257 | 256 | |
| 258 | 257 | if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; } |
| 259 | 258 | else { xstart = 0; xend = xnum; xinc = +1; } |
| r20975 | r20976 | |
| 287 | 286 | // buffer the tile and rotate it into bitmap |
| 288 | 287 | if( rot ) |
| 289 | 288 | { |
| 290 | | state->m_tmpbitmap0->fill(0, spritetile_clip ); |
| 291 | | state->m_tmpbitmap1->fill(0, spritetile_clip ); |
| 292 | | drawgfxzoom_transpen( *state->m_tmpbitmap0,spritetile_clip,machine.gfx[gfx], |
| 289 | m_tmpbitmap0->fill(0, spritetile_clip ); |
| 290 | m_tmpbitmap1->fill(0, spritetile_clip ); |
| 291 | drawgfxzoom_transpen( *m_tmpbitmap0,spritetile_clip,machine().gfx[gfx], |
| 293 | 292 | code++, |
| 294 | 293 | color, |
| 295 | 294 | flipx, flipy, |
| r20975 | r20976 | |
| 297 | 296 | (rot & 1 ? scaley : scalex) << 12, (rot & 1 ? scalex : scaley) << 12,0); |
| 298 | 297 | |
| 299 | 298 | // peek at the unrotated sprite |
| 300 | | // copybitmap_trans( bitmap,*state->m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 ); |
| 299 | // copybitmap_trans( bitmap,*m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 ); |
| 301 | 300 | } |
| 302 | 301 | |
| 303 | 302 | switch( rot ) |
| 304 | 303 | { |
| 305 | 304 | case 0x10: // rot 90 |
| 306 | | copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0, |
| 305 | copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, |
| 307 | 306 | (UINT32)0<<16, |
| 308 | 307 | (UINT32)16<<16, |
| 309 | 308 | 0 << 16, |
| r20975 | r20976 | |
| 315 | 314 | currx = (sx - (y+1) * ydim) / 0x10000; |
| 316 | 315 | curry = (sy + x * xdim) / 0x10000; |
| 317 | 316 | |
| 318 | | copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); |
| 317 | copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); |
| 319 | 318 | break; |
| 320 | 319 | |
| 321 | 320 | case 0x20: // rot 180 |
| 322 | | copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0, |
| 321 | copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, |
| 323 | 322 | (UINT32)16<<16, |
| 324 | 323 | (UINT32)16<<16, |
| 325 | 324 | -1 << 16, |
| r20975 | r20976 | |
| 331 | 330 | currx = (sx - (x+1) * xdim) / 0x10000; |
| 332 | 331 | curry = (sy - (y+1) * ydim) / 0x10000; |
| 333 | 332 | |
| 334 | | copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); |
| 333 | copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); |
| 335 | 334 | break; |
| 336 | 335 | |
| 337 | 336 | case 0x30: // rot 270 |
| 338 | | copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0, |
| 337 | copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, |
| 339 | 338 | (UINT32)16<<16, |
| 340 | 339 | (UINT32)0<<16, |
| 341 | 340 | 0 << 16, |
| r20975 | r20976 | |
| 347 | 346 | currx = (sx + y * ydim) / 0x10000; |
| 348 | 347 | curry = (sy - (x+1) * xdim) / 0x10000; |
| 349 | 348 | |
| 350 | | copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); |
| 349 | copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); |
| 351 | 350 | break; |
| 352 | 351 | |
| 353 | 352 | default: |
| 354 | | drawgfxzoom_transpen( bitmap,cliprect,machine.gfx[gfx], |
| 353 | drawgfxzoom_transpen( bitmap,cliprect,machine().gfx[gfx], |
| 355 | 354 | code++, |
| 356 | 355 | color, |
| 357 | 356 | flipx, flipy, |
| r20975 | r20976 | |
| 367 | 366 | |
| 368 | 367 | /* DaiDaiKakumei */ |
| 369 | 368 | /* layer : 0== bghigh<spr 1== bglow<spr<bghigh 2==spr<bglow 3==boarder */ |
| 370 | | static void dai2kaku_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int layer) |
| 369 | void realbrk_state::dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer) |
| 371 | 370 | { |
| 372 | | realbrk_state *state = machine.driver_data<realbrk_state>(); |
| 373 | | UINT16 *spriteram16 = state->m_spriteram; |
| 371 | UINT16 *spriteram16 = m_spriteram; |
| 374 | 372 | int offs; |
| 375 | 373 | |
| 376 | | int max_x = machine.primary_screen->width(); |
| 377 | | int max_y = machine.primary_screen->height(); |
| 374 | int max_x = machine().primary_screen->width(); |
| 375 | int max_y = machine().primary_screen->height(); |
| 378 | 376 | |
| 379 | 377 | for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 ) |
| 380 | 378 | { |
| r20975 | r20976 | |
| 414 | 412 | xdim = ((zoom & 0x00ff) >> 0) << (16-6+4); |
| 415 | 413 | ydim = ((zoom & 0xff00) >> 8) << (16-6+4); |
| 416 | 414 | |
| 417 | | if (state->flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; } |
| 418 | | if (state->flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; } |
| 415 | if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; } |
| 416 | if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; } |
| 419 | 417 | |
| 420 | 418 | if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; } |
| 421 | 419 | else { xstart = 0; xend = xnum; xinc = +1; } |
| r20975 | r20976 | |
| 433 | 431 | int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx; |
| 434 | 432 | int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry; |
| 435 | 433 | |
| 436 | | drawgfxzoom_transpen( bitmap,cliprect,machine.gfx[gfx], |
| 434 | drawgfxzoom_transpen( bitmap,cliprect,machine().gfx[gfx], |
| 437 | 435 | code++, |
| 438 | 436 | color, |
| 439 | 437 | flipx, flipy, |
| r20975 | r20976 | |
| 516 | 514 | if (layers_ctrl & 2) m_tilemap_1->draw(bitmap, cliprect, 0,0); |
| 517 | 515 | if (layers_ctrl & 1) m_tilemap_0->draw(bitmap, cliprect, 0,0); |
| 518 | 516 | |
| 519 | | if (layers_ctrl & 8) draw_sprites(machine(),bitmap,cliprect); |
| 517 | if (layers_ctrl & 8) draw_sprites(bitmap,cliprect); |
| 520 | 518 | |
| 521 | 519 | if (layers_ctrl & 4) m_tilemap_2->draw(bitmap, cliprect, 0,0); |
| 522 | 520 | |
| r20975 | r20976 | |
| 586 | 584 | |
| 587 | 585 | |
| 588 | 586 | // spr 0 |
| 589 | | if (layers_ctrl & 8) dai2kaku_draw_sprites(machine(),bitmap,cliprect,2); |
| 587 | if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,2); |
| 590 | 588 | |
| 591 | 589 | // bglow |
| 592 | 590 | if( m_vregs[8/2] & (0x8000)){ |
| r20975 | r20976 | |
| 596 | 594 | } |
| 597 | 595 | |
| 598 | 596 | // spr 1 |
| 599 | | if (layers_ctrl & 8) dai2kaku_draw_sprites(machine(),bitmap,cliprect,1); |
| 597 | if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,1); |
| 600 | 598 | |
| 601 | 599 | // bghigh |
| 602 | 600 | if( m_vregs[8/2] & (0x8000)){ |
| r20975 | r20976 | |
| 606 | 604 | } |
| 607 | 605 | |
| 608 | 606 | // spr 2 |
| 609 | | if (layers_ctrl & 8) dai2kaku_draw_sprites(machine(),bitmap,cliprect,0); |
| 607 | if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,0); |
| 610 | 608 | |
| 611 | 609 | // fix |
| 612 | 610 | if (layers_ctrl & 4) m_tilemap_2->draw(bitmap, cliprect, 0,0); |