trunk/src/mame/drivers/coolridr.c
| r21467 | r21468 | |
| 416 | 416 | UINT16 m_textOffset; |
| 417 | 417 | UINT32 m_blitterClearMode; |
| 418 | 418 | INT16 m_blitterClearCount; |
| 419 | pen_t m_tilepals[0x10000]; |
| 419 | 420 | |
| 420 | 421 | // store the blit params here |
| 421 | 422 | UINT32 m_spriteblit[12]; |
| r21467 | r21468 | |
| 446 | 447 | required_ioport m_io_an7; |
| 447 | 448 | required_ioport m_io_config; |
| 448 | 449 | |
| 449 | | bitmap_rgb32 m_temp_bitmap_sprites[4]; |
| 450 | | bitmap_rgb32 m_temp_bitmap_sprites2[4]; |
| 450 | bitmap_ind16 m_temp_bitmap_sprites; |
| 451 | bitmap_ind16 m_temp_bitmap_sprites2; |
| 451 | 452 | bitmap_ind16 m_zbuffer_bitmap; |
| 452 | 453 | bitmap_ind16 m_zbuffer_bitmap2; |
| 453 | 454 | |
| 454 | | bitmap_rgb32 m_screen1_bitmap; |
| 455 | | bitmap_rgb32 m_screen2_bitmap; |
| 455 | bitmap_ind16 m_bg_bitmap; |
| 456 | bitmap_ind16 m_bg_bitmap2; |
| 457 | |
| 458 | |
| 459 | bitmap_ind16 m_screen1_bitmap; |
| 460 | bitmap_ind16 m_screen2_bitmap; |
| 456 | 461 | int m_scsp_last_line; |
| 457 | 462 | UINT8 an_mux_data; |
| 458 | 463 | UINT8 sound_data, sound_fifo; |
| r21467 | r21468 | |
| 493 | 498 | virtual void machine_start(); |
| 494 | 499 | virtual void machine_reset(); |
| 495 | 500 | virtual void video_start(); |
| 496 | | UINT32 screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which); |
| 497 | | UINT32 screen_update_coolridr1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 498 | | UINT32 screen_update_coolridr2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 501 | |
| 502 | void coolriders_drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, |
| 503 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty); |
| 504 | |
| 505 | void coolriders_drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, |
| 506 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, |
| 507 | UINT32 transpen); |
| 508 | |
| 509 | void draw_bg_coolridr(bitmap_ind16 &bitmap, const rectangle &cliprect, int which); |
| 510 | UINT32 screen_update_coolridr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which); |
| 511 | UINT32 screen_update_coolridr1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 512 | UINT32 screen_update_coolridr2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 499 | 513 | void blit_current_sprite(address_space &space); |
| 500 | 514 | INTERRUPT_GEN_MEMBER(system_h1); |
| 501 | 515 | TIMER_DEVICE_CALLBACK_MEMBER(system_h1_main); |
| r21467 | r21468 | |
| 598 | 612 | if (machine().gfx[m_gfx_index] == 0) |
| 599 | 613 | break; |
| 600 | 614 | |
| 601 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites[0]); |
| 602 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites2[0]); |
| 615 | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites); |
| 616 | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites2); |
| 603 | 617 | machine().primary_screen->register_screen_bitmap(m_zbuffer_bitmap); |
| 604 | 618 | machine().primary_screen->register_screen_bitmap(m_zbuffer_bitmap2); |
| 619 | machine().primary_screen->register_screen_bitmap(m_bg_bitmap); |
| 620 | machine().primary_screen->register_screen_bitmap(m_bg_bitmap2); |
| 605 | 621 | |
| 606 | 622 | |
| 607 | 623 | |
| 608 | | |
| 609 | | // testing, not right |
| 610 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites[1]); |
| 611 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites2[1]); |
| 612 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites[2]); |
| 613 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites2[2]); |
| 614 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites[3]); |
| 615 | | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites2[3]); |
| 616 | | |
| 617 | 624 | machine().primary_screen->register_screen_bitmap(m_screen1_bitmap); |
| 618 | 625 | machine().primary_screen->register_screen_bitmap(m_screen2_bitmap); |
| 619 | 626 | |
| r21467 | r21468 | |
| 635 | 642 | (everything else is unknown at current time) |
| 636 | 643 | */ |
| 637 | 644 | |
| 638 | | UINT32 coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which) |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | #define COOLRIDERS_DRAWGFX_CORE(PIXEL_TYPE, COOL_PIXEL_OP) \ |
| 650 | do { \ |
| 651 | do { \ |
| 652 | const UINT8 *srcdata; \ |
| 653 | INT32 destendx, destendy; \ |
| 654 | INT32 srcx, srcy; \ |
| 655 | INT32 curx, cury; \ |
| 656 | INT32 dy; \ |
| 657 | \ |
| 658 | assert(dest.valid()); \ |
| 659 | assert(gfx != NULL); \ |
| 660 | assert(dest.cliprect().contains(cliprect)); \ |
| 661 | assert(code < gfx->elements()); \ |
| 662 | \ |
| 663 | /* ignore empty/invalid cliprects */ \ |
| 664 | if (cliprect.empty()) \ |
| 665 | break; \ |
| 666 | \ |
| 667 | /* compute final pixel in X and exit if we are entirely clipped */ \ |
| 668 | destendx = destx + gfx->width() - 1; \ |
| 669 | if (destx > cliprect.max_x || destendx < cliprect.min_x) \ |
| 670 | break; \ |
| 671 | \ |
| 672 | /* apply left clip */ \ |
| 673 | srcx = 0; \ |
| 674 | if (destx < cliprect.min_x) \ |
| 675 | { \ |
| 676 | srcx = cliprect.min_x - destx; \ |
| 677 | destx = cliprect.min_x; \ |
| 678 | } \ |
| 679 | \ |
| 680 | /* apply right clip */ \ |
| 681 | if (destendx > cliprect.max_x) \ |
| 682 | destendx = cliprect.max_x; \ |
| 683 | \ |
| 684 | /* compute final pixel in Y and exit if we are entirely clipped */ \ |
| 685 | destendy = desty + gfx->height() - 1; \ |
| 686 | if (desty > cliprect.max_y || destendy < cliprect.min_y) \ |
| 687 | break; \ |
| 688 | \ |
| 689 | /* apply top clip */ \ |
| 690 | srcy = 0; \ |
| 691 | if (desty < cliprect.min_y) \ |
| 692 | { \ |
| 693 | srcy = cliprect.min_y - desty; \ |
| 694 | desty = cliprect.min_y; \ |
| 695 | } \ |
| 696 | \ |
| 697 | /* apply bottom clip */ \ |
| 698 | if (destendy > cliprect.max_y) \ |
| 699 | destendy = cliprect.max_y; \ |
| 700 | \ |
| 701 | /* apply X flipping */ \ |
| 702 | if (flipx) \ |
| 703 | srcx = gfx->width() - 1 - srcx; \ |
| 704 | \ |
| 705 | /* apply Y flipping */ \ |
| 706 | dy = gfx->rowbytes(); \ |
| 707 | if (flipy) \ |
| 708 | { \ |
| 709 | srcy = gfx->height() - 1 - srcy; \ |
| 710 | dy = -dy; \ |
| 711 | } \ |
| 712 | \ |
| 713 | /* fetch the source data */ \ |
| 714 | srcdata = gfx->get_data(code); \ |
| 715 | \ |
| 716 | /* compute how many blocks of 4 pixels we have */ \ |
| 717 | UINT32 numblocks = (destendx + 1 - destx) / 4; \ |
| 718 | UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ |
| 719 | \ |
| 720 | /* adjust srcdata to point to the first source pixel of the row */ \ |
| 721 | srcdata += srcy * gfx->rowbytes() + srcx; \ |
| 722 | \ |
| 723 | /* non-flipped 8bpp case */ \ |
| 724 | if (!flipx) \ |
| 725 | { \ |
| 726 | /* iterate over pixels in Y */ \ |
| 727 | for (cury = desty; cury <= destendy; cury++) \ |
| 728 | { \ |
| 729 | PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ |
| 730 | const UINT8 *srcptr = srcdata; \ |
| 731 | srcdata += dy; \ |
| 732 | \ |
| 733 | /* iterate over unrolled blocks of 4 */ \ |
| 734 | for (curx = 0; curx < numblocks; curx++) \ |
| 735 | { \ |
| 736 | COOL_PIXEL_OP(destptr[0], srcptr[0]); \ |
| 737 | COOL_PIXEL_OP(destptr[1], srcptr[1]); \ |
| 738 | COOL_PIXEL_OP(destptr[2], srcptr[2]); \ |
| 739 | COOL_PIXEL_OP(destptr[3], srcptr[3]); \ |
| 740 | \ |
| 741 | srcptr += 4; \ |
| 742 | destptr += 4; \ |
| 743 | } \ |
| 744 | \ |
| 745 | /* iterate over leftover pixels */ \ |
| 746 | for (curx = 0; curx < leftovers; curx++) \ |
| 747 | { \ |
| 748 | COOL_PIXEL_OP(destptr[0], srcptr[0]); \ |
| 749 | srcptr++; \ |
| 750 | destptr++; \ |
| 751 | } \ |
| 752 | } \ |
| 753 | } \ |
| 754 | \ |
| 755 | /* flipped 8bpp case */ \ |
| 756 | else \ |
| 757 | { \ |
| 758 | /* iterate over pixels in Y */ \ |
| 759 | for (cury = desty; cury <= destendy; cury++) \ |
| 760 | { \ |
| 761 | PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ |
| 762 | const UINT8 *srcptr = srcdata; \ |
| 763 | srcdata += dy; \ |
| 764 | \ |
| 765 | /* iterate over unrolled blocks of 4 */ \ |
| 766 | for (curx = 0; curx < numblocks; curx++) \ |
| 767 | { \ |
| 768 | COOL_PIXEL_OP(destptr[0], srcptr[ 0]); \ |
| 769 | COOL_PIXEL_OP(destptr[1], srcptr[-1]); \ |
| 770 | COOL_PIXEL_OP(destptr[2], srcptr[-2]); \ |
| 771 | COOL_PIXEL_OP(destptr[3], srcptr[-3]); \ |
| 772 | \ |
| 773 | srcptr -= 4; \ |
| 774 | destptr += 4; \ |
| 775 | } \ |
| 776 | \ |
| 777 | /* iterate over leftover pixels */ \ |
| 778 | for (curx = 0; curx < leftovers; curx++) \ |
| 779 | { \ |
| 780 | COOL_PIXEL_OP(destptr[0], srcptr[0]); \ |
| 781 | srcptr--; \ |
| 782 | destptr++; \ |
| 783 | } \ |
| 784 | } \ |
| 785 | } \ |
| 786 | } while (0); \ |
| 787 | } while (0) |
| 788 | |
| 789 | |
| 790 | #define COOLRIDERS_PIXEL_OP_REMAP_OPAQUE(DEST, SOURCE) \ |
| 791 | do \ |
| 792 | { \ |
| 793 | (DEST) = paldata[SOURCE]; \ |
| 794 | } \ |
| 795 | while (0) |
| 796 | |
| 797 | #define COOLRIDERS_PIXEL_OP_REMAP_TRANSPEN(DEST, SOURCE) \ |
| 798 | do \ |
| 799 | { \ |
| 800 | UINT32 srcdata = (SOURCE); \ |
| 801 | if (srcdata != transpen) \ |
| 802 | (DEST) = paldata[srcdata]; \ |
| 803 | } \ |
| 804 | while (0) |
| 805 | |
| 806 | |
| 807 | |
| 808 | void coolridr_state::coolriders_drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, |
| 809 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty) |
| 639 | 810 | { |
| 811 | const pen_t *paldata = &m_tilepals[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; |
| 812 | code %= gfx->elements(); |
| 813 | COOLRIDERS_DRAWGFX_CORE(UINT16, COOLRIDERS_PIXEL_OP_REMAP_OPAQUE); |
| 814 | } |
| 815 | |
| 816 | void coolridr_state::coolriders_drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, |
| 817 | UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, |
| 818 | UINT32 transpen) |
| 819 | { |
| 820 | // special case invalid pens to opaque |
| 821 | if (transpen > 0xff) |
| 822 | return coolriders_drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); |
| 823 | |
| 824 | // use pen usage to optimize |
| 825 | code %= gfx->elements(); |
| 826 | if (gfx->has_pen_usage()) |
| 827 | { |
| 828 | // fully transparent; do nothing |
| 829 | UINT32 usage = gfx->pen_usage(code); |
| 830 | if ((usage & ~(1 << transpen)) == 0) |
| 831 | return; |
| 832 | |
| 833 | // fully opaque; draw as such |
| 834 | if ((usage & (1 << transpen)) == 0) |
| 835 | return coolriders_drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty); |
| 836 | } |
| 837 | |
| 838 | // render |
| 839 | const pen_t *paldata = &m_tilepals[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())] ; |
| 840 | COOLRIDERS_DRAWGFX_CORE(UINT16, COOLRIDERS_PIXEL_OP_REMAP_TRANSPEN); |
| 841 | } |
| 842 | |
| 843 | void coolridr_state::draw_bg_coolridr(bitmap_ind16 &bitmap, const rectangle &cliprect, int which) |
| 844 | { |
| 845 | |
| 640 | 846 | int bg_r,bg_g,bg_b; |
| 641 | 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 642 | 852 | if(m_pen_fill[which]) |
| 643 | 853 | { |
| 644 | | /* logic here is a bit of a guess. */ |
| 854 | #if 0 |
| 855 | /* logic here is a bit of a guess. - should probably be 555 like everything else.. or we are going to have to have a rgb32 bitmap? */ |
| 645 | 856 | bg_r = (((m_pen_fill[which] >> 16) & 0x7f) << 1) | (((m_pen_fill[which] >> 16) & 0x80) >> 7); |
| 646 | 857 | bg_g = (((m_pen_fill[which] >> 8) & 0x7f) << 1) | (((m_pen_fill[which] >> 8) & 0x80) >> 7); |
| 647 | 858 | bg_b = (((m_pen_fill[which] >> 0) & 0x7f) << 1) | (((m_pen_fill[which] >> 0) & 0x80) >> 7); |
| 648 | 859 | bitmap.fill(MAKE_ARGB(0xff,bg_r,bg_g,bg_b),cliprect); |
| 860 | #endif |
| 861 | |
| 862 | bg_r = (((m_pen_fill[which] >> 16) & 0x78) >> 2) | (((m_pen_fill[which] >> 16) & 0x80) >> 7); |
| 863 | bg_g = (((m_pen_fill[which] >> 8) & 0x78) >> 2) | (((m_pen_fill[which] >> 8) & 0x80) >> 7); |
| 864 | bg_b = (((m_pen_fill[which] >> 0) & 0x78) >> 2) | (((m_pen_fill[which] >> 0) & 0x80) >> 7); |
| 865 | bitmap.fill( (bg_r<<10) | (bg_g << 5) | bg_b ,cliprect); |
| 866 | |
| 649 | 867 | } |
| 650 | 868 | else |
| 651 | 869 | { |
| r21467 | r21468 | |
| 670 | 888 | bg_b = (VREG(0x3c) >> 0) & 0x1f; |
| 671 | 889 | apply_rgb_control(which,&bg_r,&bg_g,&bg_b); |
| 672 | 890 | |
| 673 | | bitmap.fill(MAKE_ARGB(0xff,pal5bit(bg_r),pal5bit(bg_g),pal5bit(bg_b)),cliprect); |
| 891 | bitmap.fill(VREG(0x3c),cliprect); |
| 674 | 892 | |
| 675 | | |
| 893 | |
| 676 | 894 | UINT16 basey = scrolly>>4; |
| 677 | 895 | for (int y=0;y<25;y++) |
| 678 | 896 | { |
| r21467 | r21468 | |
| 684 | 902 | /* bike select enables bits 15-12, pretty sure one of these is tile bank (because there's a solid pen on 0x3ff / 0x7ff). */ |
| 685 | 903 | tile = (vram_data & 0x7ff) | ((vram_data & 0x8000) >> 4); |
| 686 | 904 | |
| 687 | | drawgfx_transpen(bitmap,cliprect,gfx,tile,color,0,0,(x*16)-(scrollx&0xf),(y*16)-(scrolly&0xf),transpen_setting ? -1 : 0); |
| 905 | coolriders_drawgfx_transpen(bitmap,cliprect,gfx,tile,color,0,0,(x*16)-(scrollx&0xf),(y*16)-(scrolly&0xf),transpen_setting ? -1 : 0); |
| 688 | 906 | |
| 689 | 907 | basex++; |
| 690 | 908 | } |
| r21467 | r21468 | |
| 692 | 910 | } |
| 693 | 911 | } |
| 694 | 912 | |
| 913 | |
| 914 | } |
| 915 | |
| 916 | UINT32 coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which) |
| 917 | { |
| 918 | |
| 695 | 919 | if (which==0) |
| 696 | 920 | { |
| 697 | 921 | // will probably need a custom function |
| 698 | | copybitmap_trans(bitmap, m_screen1_bitmap, 0, 0, 0, 0, cliprect, 0xff000000); |
| 922 | copybitmap_trans(bitmap, m_screen1_bitmap, 0, 0, 0, 0, cliprect, 0x8000); |
| 699 | 923 | } |
| 700 | 924 | else |
| 701 | 925 | { |
| 702 | 926 | // will probably need a custom function |
| 703 | | copybitmap_trans(bitmap, m_screen2_bitmap, 0, 0, 0, 0, cliprect, 0xff000000); |
| 927 | copybitmap_trans(bitmap, m_screen2_bitmap, 0, 0, 0, 0, cliprect, 0x8000); |
| 704 | 928 | } |
| 705 | 929 | |
| 706 | 930 | return 0; |
| 707 | 931 | } |
| 708 | 932 | |
| 709 | | UINT32 coolridr_state::screen_update_coolridr1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 933 | UINT32 coolridr_state::screen_update_coolridr1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 710 | 934 | { |
| 711 | 935 | #if 0 |
| 712 | 936 | if (screen.machine().input().code_pressed_once(KEYCODE_W)) |
| r21467 | r21468 | |
| 724 | 948 | return screen_update_coolridr(screen,bitmap,cliprect,0); |
| 725 | 949 | } |
| 726 | 950 | |
| 727 | | UINT32 coolridr_state::screen_update_coolridr2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 951 | UINT32 coolridr_state::screen_update_coolridr2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 728 | 952 | { |
| 729 | 953 | return screen_update_coolridr(screen,bitmap,cliprect,1); |
| 730 | 954 | } |
| r21467 | r21468 | |
| 739 | 963 | UINT8* indirect_tiles; |
| 740 | 964 | UINT32* indirect_zoom; |
| 741 | 965 | UINT32 spriteblit[12]; |
| 742 | | bitmap_rgb32* drawbitmap; |
| 966 | bitmap_ind16* drawbitmap; |
| 743 | 967 | bitmap_ind16* zbitmap; |
| 744 | 968 | UINT16 zpri; |
| 745 | 969 | UINT8 blittype; |
| r21467 | r21468 | |
| 955 | 1179 | const int pixelOffsetnextX = ((hPositionTable) + ((h+1)* 16 * hZoomHere)) / 0x40; \ |
| 956 | 1180 | if (drawy>clipmaxY) { break; }; \ |
| 957 | 1181 | if (drawy<clipminY) { drawy++; continue; }; \ |
| 958 | | line = &drawbitmap->pix32(drawy); \ |
| 1182 | line = &drawbitmap->pix16(drawy); \ |
| 959 | 1183 | zline = &object->zbitmap->pix16(drawy); \ |
| 960 | 1184 | int blockwide = pixelOffsetnextX-pixelOffsetX; \ |
| 961 | 1185 | if (pixelOffsetX+blockwide <clipminX) { drawy++; continue; } \ |
| r21467 | r21468 | |
| 994 | 1218 | int realy = ((y*incy)>>21); \ |
| 995 | 1219 | const int drawy = pixelOffsetY+y; \ |
| 996 | 1220 | if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ |
| 997 | | line = &drawbitmap->pix32(drawy); \ |
| 1221 | line = &drawbitmap->pix16(drawy); \ |
| 998 | 1222 | zline = &object->zbitmap->pix16(drawy); \ |
| 999 | 1223 | int drawx = pixelOffsetX; \ |
| 1000 | 1224 | for (int x = 0; x < blockwide; x++) \ |
| r21467 | r21468 | |
| 1013 | 1237 | { \ |
| 1014 | 1238 | const int drawy = pixelOffsetY+realy; \ |
| 1015 | 1239 | if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ |
| 1016 | | line = &drawbitmap->pix32(drawy); \ |
| 1240 | line = &drawbitmap->pix16(drawy); \ |
| 1017 | 1241 | zline = &object->zbitmap->pix16(drawy); \ |
| 1018 | 1242 | int drawx = pixelOffsetX; \ |
| 1019 | 1243 | for (int realx = 0; realx < 16; realx++) \ |
| r21467 | r21468 | |
| 1045 | 1269 | if (object->zpri < zline[drawx]) \ |
| 1046 | 1270 | { \ |
| 1047 | 1271 | { \ |
| 1048 | | line[drawx] = (pal5bit((pix >> 10) & 0x1f)<<16)|(pal5bit((pix >> 5) & 0x1f)<<8)|pal5bit((pix >> 0) & 0x1f); \ |
| 1272 | line[drawx] = pix&0x7fff; \ |
| 1049 | 1273 | zline[drawx] = object->zpri; \ |
| 1050 | 1274 | } \ |
| 1051 | 1275 | } \ |
| r21467 | r21468 | |
| 1074 | 1298 | void *coolridr_state::draw_object_threaded(void *param, int threadid) |
| 1075 | 1299 | { |
| 1076 | 1300 | cool_render_object *object = reinterpret_cast<cool_render_object *>(param); |
| 1077 | | bitmap_rgb32* drawbitmap = object->drawbitmap; |
| 1301 | bitmap_ind16* drawbitmap = object->drawbitmap; |
| 1078 | 1302 | |
| 1079 | 1303 | /************* object->spriteblit[3] *************/ |
| 1080 | 1304 | |
| r21467 | r21468 | |
| 1766 | 1990 | UINT32 incy = 0x8000000 / vZoom; |
| 1767 | 1991 | |
| 1768 | 1992 | // DEBUG: Draw 16x16 block |
| 1769 | | UINT32* line; |
| 1993 | UINT16* line; |
| 1770 | 1994 | UINT16* zline; |
| 1771 | 1995 | |
| 1772 | 1996 | |
| r21467 | r21468 | |
| 2079 | 2303 | // which queue, which bitmap |
| 2080 | 2304 | if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60) |
| 2081 | 2305 | { |
| 2082 | | testobject->drawbitmap = &m_temp_bitmap_sprites[0]; |
| 2306 | testobject->drawbitmap = &m_temp_bitmap_sprites; |
| 2083 | 2307 | testobject->zbitmap = &m_zbuffer_bitmap; |
| 2084 | 2308 | // pass these from the type 1 writes |
| 2085 | 2309 | testobject->clipvals[0] = m_clipvals[0][0]; |
| r21467 | r21468 | |
| 2090 | 2314 | } |
| 2091 | 2315 | else // 0x90, 0xa0, 0xaf, 0xb0, 0xc0 |
| 2092 | 2316 | { |
| 2093 | | testobject->drawbitmap = &m_temp_bitmap_sprites2[0]; |
| 2317 | testobject->drawbitmap = &m_temp_bitmap_sprites2; |
| 2094 | 2318 | testobject->zbitmap = &m_zbuffer_bitmap2; |
| 2095 | 2319 | // pass these from the type 1 writes |
| 2096 | 2320 | testobject->clipvals[0] = m_clipvals[1][0]; |
| r21467 | r21468 | |
| 2316 | 2540 | { |
| 2317 | 2541 | const rectangle& visarea = machine().primary_screen->visible_area(); |
| 2318 | 2542 | |
| 2319 | | // test code |
| 2320 | | int i = 0; |
| 2321 | | |
| 2322 | 2543 | if(m_blitterClearMode == 0x8c200000) |
| 2323 | 2544 | { |
| 2545 | // wait for our sprite rendering to finish |
| 2324 | 2546 | osd_work_queue_wait(m_work_queue[0], osd_ticks_per_second() * 100); |
| 2325 | | copybitmap(m_screen1_bitmap, m_temp_bitmap_sprites[i], 0, 0, 0, 0, visarea); |
| 2326 | | m_temp_bitmap_sprites[i].fill(0xff000000, visarea); |
| 2547 | |
| 2548 | // copy our old buffer to the actual screen |
| 2549 | copybitmap(m_screen1_bitmap, m_temp_bitmap_sprites, 0, 0, 0, 0, visarea); |
| 2550 | |
| 2551 | //m_temp_bitmap_sprites.fill(0xff000000, visarea); |
| 2552 | // render the tilemap to the backbuffer, ready for having sprites drawn on it |
| 2553 | draw_bg_coolridr(m_temp_bitmap_sprites, visarea, 0); |
| 2554 | // wipe the z-buffer ready for the sprites |
| 2327 | 2555 | m_zbuffer_bitmap.fill(0xffff, visarea); |
| 2328 | 2556 | // almost certainly wrong |
| 2329 | 2557 | m_clipvals[0][0] = 0; |
| r21467 | r21468 | |
| 2333 | 2561 | } |
| 2334 | 2562 | else if(m_blitterClearMode == 0x8c800000) |
| 2335 | 2563 | { |
| 2564 | // wait for our sprite rendering to finish |
| 2336 | 2565 | osd_work_queue_wait(m_work_queue[1], osd_ticks_per_second() * 100); |
| 2337 | | copybitmap(m_screen2_bitmap, m_temp_bitmap_sprites2[i], 0, 0, 0, 0, visarea); |
| 2338 | | m_temp_bitmap_sprites2[i].fill(0xff000000, visarea); |
| 2566 | |
| 2567 | // copy our old buffer to the actual screen |
| 2568 | copybitmap(m_screen2_bitmap, m_temp_bitmap_sprites2, 0, 0, 0, 0, visarea); |
| 2569 | //m_temp_bitmap_sprites2.fill(0xff000000, visarea); |
| 2570 | // render the tilemap to the backbuffer, ready for having sprites drawn on it |
| 2571 | draw_bg_coolridr(m_temp_bitmap_sprites2, visarea, 1); |
| 2572 | // wipe the z-buffer ready for the sprites |
| 2339 | 2573 | m_zbuffer_bitmap2.fill(0xffff, visarea); |
| 2340 | 2574 | // almost certainly wrong |
| 2341 | 2575 | m_clipvals[1][0] = 0; |
| r21467 | r21468 | |
| 2444 | 2678 | b = ((m_h1_pal[offset] & 0x001f) >> 0); |
| 2445 | 2679 | apply_rgb_control(screen_type,&r,&g,&b); |
| 2446 | 2680 | |
| 2447 | | palette_set_color_rgb(machine(),offset,pal5bit(r),pal5bit(g),pal5bit(b)); |
| 2681 | // palette_set_color_rgb(machine(),offset,pal5bit(r),pal5bit(g),pal5bit(b)); |
| 2682 | m_tilepals[offset&0xffff] = (r<<10) | (g<<5) | b; |
| 2448 | 2683 | } |
| 2449 | 2684 | |
| 2450 | 2685 | void coolridr_state::sysh1_dma_transfer( address_space &space, UINT16 dma_index ) |
| r21467 | r21468 | |
| 3372 | 3607 | MCFG_SCREEN_UPDATE_DRIVER(coolridr_state, screen_update_coolridr2) |
| 3373 | 3608 | |
| 3374 | 3609 | MCFG_PALETTE_LENGTH(0x10000) |
| 3610 | MCFG_PALETTE_INIT( RRRRR_GGGGG_BBBBB ) |
| 3611 | |
| 3375 | 3612 | MCFG_DEFAULT_LAYOUT(layout_dualhsxs) |
| 3376 | 3613 | |
| 3377 | 3614 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |