trunk/src/mame/drivers/raiden2.c
| r31919 | r31920 | |
| 799 | 799 | |
| 800 | 800 | /* SPRITE DRAWING (move to video file) */ |
| 801 | 801 | |
| 802 | | void raiden2_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ,int pri_mask ) |
| 802 | void raiden2_state::draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &priority, const rectangle &cliprect) |
| 803 | 803 | { |
| 804 | | UINT16 *source = sprites + sprites_cur_start/2 - 4; |
| 804 | UINT16 *source = sprites; |
| 805 | 805 | |
| 806 | 806 | gfx_element *gfx = m_gfxdecode->gfx(2); |
| 807 | 807 | |
| 808 | | // static int ytlim = 1; |
| 809 | | // static int xtlim = 1; |
| 810 | | |
| 811 | | // if ( machine.input().code_pressed_once(KEYCODE_Q) ) ytlim--; |
| 812 | | // if ( machine.input().code_pressed_once(KEYCODE_W) ) ytlim++; |
| 813 | | |
| 814 | | // if ( machine.input().code_pressed_once(KEYCODE_A) ) xtlim--; |
| 815 | | // if ( machine.input().code_pressed_once(KEYCODE_S) ) xtlim++; |
| 816 | | |
| 817 | | |
| 818 | | /*00 ???? ???? (colour / priority?) |
| 819 | | 01 fhhh Fwww h = height f=flipy w = width F = flipx |
| 820 | | 02 nnnn nnnn n = tileno |
| 821 | | 03 nnnn nnnn n = tileno |
| 822 | | 04 xxxx xxxx x = xpos |
| 823 | | 05 xxxx xxxx x = xpos |
| 824 | | 06 yyyy yyyy y = ypos |
| 825 | | 07 yyyy yyyy y = ypos |
| 826 | | |
| 808 | /* |
| 809 | 00 fhhh Fwww ppcc cccc h = height f=flipy w = width F = flipx p = priority c = color |
| 810 | 02 nnnn nnnn nnnn nnnn n = tileno |
| 811 | 04 xxxx xxxx xxxx xxxx x = xpos |
| 812 | 06 yyyy yyyy yyyy yyyy y = ypos |
| 827 | 813 | */ |
| 828 | 814 | |
| 829 | | |
| 830 | | while( source>sprites ){ |
| 815 | while( source<sprites + sprites_cur_start/2 ){ |
| 831 | 816 | int tile_number = source[1]; |
| 832 | 817 | int sx = source[2]; |
| 833 | 818 | int sy = source[3]; |
| r31919 | r31920 | |
| 836 | 821 | int ytlim, xtlim; |
| 837 | 822 | int xflip, yflip; |
| 838 | 823 | int xstep, ystep; |
| 824 | int pri, pri_mask; |
| 839 | 825 | |
| 840 | | |
| 841 | 826 | ytlim = (source[0] >> 12) & 0x7; |
| 842 | | xtlim = (source[0] >> 8) & 0x7; |
| 827 | xtlim = (source[0] >> 8 ) & 0x7; |
| 843 | 828 | |
| 844 | 829 | xflip = (source[0] >> 15) & 0x1; |
| 845 | 830 | yflip = (source[0] >> 11) & 0x1; |
| 846 | 831 | |
| 847 | 832 | colr = source[0] & 0x3f; |
| 848 | 833 | |
| 834 | static const UINT32 pri_masks[5] = { 0xfffe, 0xfffc, 0xfff0, 0xff00 }; |
| 835 | pri = (source[0] >> 6) & 3; |
| 836 | pri_mask = pri_masks[pri]; |
| 837 | |
| 849 | 838 | ytlim += 1; |
| 850 | 839 | xtlim += 1; |
| 851 | 840 | |
| r31919 | r31920 | |
| 875 | 864 | |
| 876 | 865 | |
| 877 | 866 | |
| 878 | | gfx->transpen( |
| 867 | gfx->prio_transpen( |
| 879 | 868 | bitmap, |
| 880 | 869 | cliprect, |
| 881 | 870 | tile_number, |
| 882 | 871 | colr, |
| 883 | 872 | yflip,xflip, |
| 884 | | (sx+xstep*xtiles)&ZEROTEAM_MASK_X,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y,15); |
| 873 | (sx+xstep*xtiles)&ZEROTEAM_MASK_X,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y, priority, pri_mask, 15); |
| 885 | 874 | |
| 886 | 875 | |
| 887 | | gfx->transpen( |
| 876 | gfx->prio_transpen( |
| 888 | 877 | bitmap, |
| 889 | 878 | cliprect, |
| 890 | 879 | tile_number, |
| 891 | 880 | colr, |
| 892 | 881 | yflip,xflip, |
| 893 | | ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y,15); |
| 882 | ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y, priority, pri_mask, 15); |
| 894 | 883 | |
| 895 | 884 | |
| 896 | | gfx->transpen( |
| 885 | gfx->prio_transpen( |
| 897 | 886 | bitmap, |
| 898 | 887 | cliprect, |
| 899 | 888 | tile_number, |
| 900 | 889 | colr, |
| 901 | 890 | yflip,xflip, |
| 902 | | (sx+xstep*xtiles)&ZEROTEAM_MASK_X,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200,15); |
| 891 | (sx+xstep*xtiles)&ZEROTEAM_MASK_X,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200, priority, pri_mask, 15); |
| 903 | 892 | |
| 904 | 893 | |
| 905 | | gfx->transpen( |
| 894 | gfx->prio_transpen( |
| 906 | 895 | bitmap, |
| 907 | 896 | cliprect, |
| 908 | 897 | tile_number, |
| 909 | 898 | colr, |
| 910 | 899 | yflip,xflip, |
| 911 | | ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200,15); |
| 900 | ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200, priority, pri_mask, 15); |
| 912 | 901 | |
| 913 | 902 | |
| 914 | 903 | tile_number++; |
| 915 | 904 | } |
| 916 | 905 | } |
| 917 | 906 | |
| 918 | | source-=4; |
| 907 | source += 4; |
| 919 | 908 | } |
| 920 | 909 | |
| 921 | 910 | } |
| r31919 | r31920 | |
| 1084 | 1073 | UINT32 raiden2_state::screen_update_raiden2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1085 | 1074 | { |
| 1086 | 1075 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 1076 | screen.priority().fill(0, cliprect); |
| 1087 | 1077 | |
| 1088 | | //if (!machine().input().code_pressed(KEYCODE_Q)) |
| 1089 | | { |
| 1090 | | if (!(raiden2_tilemap_enable & 1)) |
| 1091 | | background_layer->draw(screen, bitmap, cliprect, 0, 0); |
| 1092 | | } |
| 1078 | if (!(raiden2_tilemap_enable & 1)) |
| 1079 | background_layer->draw(screen, bitmap, cliprect, 0, 1); |
| 1093 | 1080 | |
| 1094 | | //if (!machine().input().code_pressed(KEYCODE_W)) |
| 1095 | | { |
| 1096 | | if (!(raiden2_tilemap_enable & 2)) |
| 1097 | | midground_layer->draw(screen, bitmap, cliprect, 0, 0); |
| 1098 | | } |
| 1081 | if (!(raiden2_tilemap_enable & 2)) |
| 1082 | midground_layer->draw(screen, bitmap, cliprect, 0, 2); |
| 1099 | 1083 | |
| 1100 | | //if (!machine().input().code_pressed(KEYCODE_E)) |
| 1101 | | { |
| 1102 | | if (!(raiden2_tilemap_enable & 4)) |
| 1103 | | foreground_layer->draw(screen, bitmap, cliprect, 0, 0); |
| 1104 | | } |
| 1084 | if (!(raiden2_tilemap_enable & 4)) |
| 1085 | foreground_layer->draw(screen, bitmap, cliprect, 0, 4); |
| 1105 | 1086 | |
| 1106 | | //if (!machine().input().code_pressed(KEYCODE_S)) |
| 1107 | | { |
| 1108 | | if (!(raiden2_tilemap_enable & 0x10)) |
| 1109 | | draw_sprites(bitmap, cliprect, 0); |
| 1110 | | } |
| 1087 | if (!(raiden2_tilemap_enable & 8)) |
| 1088 | text_layer->draw(screen, bitmap, cliprect, 0, 8); |
| 1111 | 1089 | |
| 1112 | | //if (!machine().input().code_pressed(KEYCODE_A)) |
| 1113 | | { |
| 1114 | | if (!(raiden2_tilemap_enable & 8)) |
| 1115 | | text_layer->draw(screen, bitmap, cliprect, 0, 0); |
| 1116 | | } |
| 1090 | if (!(raiden2_tilemap_enable & 0x10)) |
| 1091 | draw_sprites(bitmap, screen.priority(), cliprect); |
| 1117 | 1092 | |
| 1118 | 1093 | return 0; |
| 1119 | 1094 | } |
| r31919 | r31920 | |
| 1354 | 1329 | |
| 1355 | 1330 | UINT16 head1 = space.read_word(src+0x60); |
| 1356 | 1331 | UINT16 head2 = space.read_word(src+0x62); |
| 1357 | | UINT16 oxy = space.read_word(src+0x66); |
| 1358 | 1332 | |
| 1359 | 1333 | int w = (((head1 >> 8 ) & 7) + 1) << 3; |
| 1360 | 1334 | int h = (((head1 >> 12) & 7) + 1) << 3; |
| 1361 | 1335 | |
| 1362 | | int ox = INT8(oxy); |
| 1363 | | int oy = INT8(oxy >> 8); |
| 1364 | | |
| 1365 | | UINT16 flag = x-ox > -w && x-ox < cop_spr_maxx+w && y-oy > -h && y-oy < 240+h ? 1 : 0; |
| 1336 | UINT16 flag = x-w > -w && x-w < cop_spr_maxx+w && y-h > -h && y-h < 240+h ? 1 : 0; |
| 1366 | 1337 | |
| 1367 | 1338 | flag = (space.read_word(src) & 0xfffe) | flag; |
| 1368 | 1339 | space.write_word(src, flag); |
| r31919 | r31920 | |
| 1371 | 1342 | { |
| 1372 | 1343 | space.write_word(dst1, head1); |
| 1373 | 1344 | space.write_word(dst1+2, head2); |
| 1374 | | space.write_word(dst1+4, x-ox); |
| 1375 | | space.write_word(dst1+6, y-oy); |
| 1345 | space.write_word(dst1+4, x-w); |
| 1346 | space.write_word(dst1+6, y-h); |
| 1376 | 1347 | |
| 1377 | 1348 | dst1 += 8; |
| 1378 | 1349 | } |