trunk/src/mame/drivers/coolridr.c
| r21324 | r21325 | |
| 613 | 613 | } |
| 614 | 614 | #endif |
| 615 | 615 | |
| 616 | #define YLOOP_START \ |
| 617 | for (int y = 0; y < blockhigh; y++) \ |
| 618 | { \ |
| 619 | int realy = ((y*incy)>>21); \ |
| 620 | if (!hZoomTable[realy]) \ |
| 621 | continue; \ |
| 622 | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; \ |
| 623 | const int drawy = pixelOffsetY+y; \ |
| 624 | if ((drawy>383) || (drawy<0)) continue; \ |
| 625 | line = &drawbitmap->pix32(drawy); \ |
| 626 | int blockwide = ((16*hZoomTable[realy])/0x40); \ |
| 627 | UINT32 incx = 0x8000000 / hZoomTable[realy]; \ |
| 628 | |
| 629 | #define XLOOP_START \ |
| 630 | for (int x = 0; x < blockwide; x++) \ |
| 631 | { \ |
| 632 | const int drawx = pixelOffsetX+x; \ |
| 633 | if ((drawx>=495 || drawx<0)) continue; \ |
| 634 | int realx = ((x*incx)>>21); \ |
| 635 | |
| 636 | |
| 637 | |
| 616 | 638 | #define DRAW_PIX \ |
| 617 | 639 | if (pix) \ |
| 618 | 640 | { \ |
| r21324 | r21325 | |
| 731 | 753 | int indirect_zoom_enable = (m_spriteblit[5] & 0x00000001); |
| 732 | 754 | |
| 733 | 755 | |
| 734 | | if (blit5_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, blit5_unused); |
| 756 | if (blit5_unused) printf("unknown bits in blit word %d - %08x\n", 5, blit5_unused); |
| 735 | 757 | // 00010000 (text) |
| 736 | 758 | // 00000001 (other) |
| 737 | 759 | |
| r21324 | r21325 | |
| 745 | 767 | |
| 746 | 768 | /************* m_spriteblit[7] *************/ |
| 747 | 769 | |
| 748 | | UINT16 vOrigin = (m_spriteblit[7] & 0xffff0000) >> 16; |
| 749 | | UINT16 hOrigin = (m_spriteblit[7] & 0x0000ffff); |
| 770 | UINT16 vOrigin = (m_spriteblit[7] & 0x00030000) >> 16; |
| 771 | UINT16 hOrigin = (m_spriteblit[7] & 0x00000003); |
| 772 | UINT16 OriginUnused = (m_spriteblit[7] & 0xfffcfffc); |
| 773 | |
| 774 | if (blit5_unused) printf("unknown bits in blit word %d - %08x\n", 7, OriginUnused); |
| 775 | |
| 750 | 776 | //printf("%04x %04x\n", vOrigin, hOrigin); |
| 751 | 777 | |
| 752 | 778 | /************* m_spriteblit[8] *************/ |
| r21324 | r21325 | |
| 852 | 878 | |
| 853 | 879 | for (int idx=0;idx<16;idx++) |
| 854 | 880 | { |
| 881 | |
| 855 | 882 | if (indirect_zoom_enable) |
| 856 | 883 | { |
| 857 | 884 | UINT32 dword = space.read_dword(blit10); |
| 858 | 885 | |
| 859 | | hZoomTable[idx] = (dword>>16); // add original value? |
| 860 | | int linescroll = dword&0xffff; |
| 861 | | if (linescroll & 0x8000) linescroll -= 0x10000; |
| 886 | hZoomTable[idx] = hZoom + (dword>>16); // add original value? |
| 887 | |
| 888 | // bit 0x8000 does get set too, but only on some lines, might have another meaning? |
| 889 | int linescroll = dword&0x7fff; |
| 890 | if (linescroll & 0x4000) linescroll -= 0x8000; |
| 862 | 891 | |
| 863 | 892 | hPositionTable[idx] = linescroll + hPosition; |
| 864 | 893 | blit10+=4; |
| r21324 | r21325 | |
| 871 | 900 | hPositionTable[idx] = hPosition; |
| 872 | 901 | } |
| 873 | 902 | |
| 874 | | |
| 875 | | int sizex = used_hCellCount * 16 * hZoomTable[idx]; |
| 903 | // DON'T use the table hZoom in this calc? (road..) |
| 904 | int sizex = used_hCellCount * 16 * hZoom; |
| 876 | 905 | |
| 877 | 906 | hPositionTable[idx] *= 0x40; |
| 878 | 907 | |
| r21324 | r21325 | |
| 896 | 925 | |
| 897 | 926 | } |
| 898 | 927 | |
| 928 | //if ((hOrigin & 3) != 1) |
| 929 | // return; |
| 899 | 930 | |
| 900 | 931 | for (int h = 0; h < used_hCellCount; h++) |
| 901 | 932 | { |
| r21324 | r21325 | |
| 1032 | 1063 | { |
| 1033 | 1064 | if (used_flipy) |
| 1034 | 1065 | { |
| 1035 | | for (int y = 0; y < blockhigh; y++) |
| 1036 | | { |
| 1037 | | int realy = ((y*incy)>>21); |
| 1038 | | if (!hZoomTable[realy]) |
| 1039 | | continue; |
| 1040 | | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1041 | | const int drawy = pixelOffsetY+y; |
| 1042 | | if ((drawy>383) || (drawy<0)) continue; |
| 1043 | | line = &drawbitmap->pix32(drawy); |
| 1044 | | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1045 | | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1066 | YLOOP_START |
| 1046 | 1067 | |
| 1047 | | |
| 1048 | 1068 | if (used_flipx) |
| 1049 | 1069 | { |
| 1050 | | for (int x = 0; x < blockwide; x++) |
| 1051 | | { |
| 1052 | | |
| 1070 | XLOOP_START |
| 1053 | 1071 | |
| 1054 | | const int drawx = pixelOffsetX+x; |
| 1055 | | if ((drawx>=495 || drawx<0)) continue; |
| 1056 | | int realx = ((x*incx)>>21); |
| 1057 | | |
| 1058 | 1072 | UINT16 pix = tempshape[(15-realx)*16+(15-realy)]; |
| 1059 | 1073 | DRAW_PIX |
| 1060 | 1074 | } |
| 1061 | 1075 | } |
| 1062 | 1076 | else |
| 1063 | 1077 | { |
| 1064 | | for (int x = 0; x < blockwide; x++) |
| 1065 | | { |
| 1066 | | const int drawx = pixelOffsetX+x; |
| 1067 | | if ((drawx>=495 || drawx<0)) continue; |
| 1068 | | int realx = ((x*incx)>>21); |
| 1078 | XLOOP_START |
| 1069 | 1079 | |
| 1070 | 1080 | UINT16 pix = tempshape[(15-realx)*16+realy]; |
| 1071 | 1081 | DRAW_PIX |
| r21324 | r21325 | |
| 1075 | 1085 | } |
| 1076 | 1086 | else |
| 1077 | 1087 | { |
| 1078 | | for (int y = 0; y < blockhigh; y++) |
| 1079 | | { |
| 1080 | | int realy = ((y*incy)>>21); |
| 1081 | | if (!hZoomTable[realy]) |
| 1082 | | continue; |
| 1083 | | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1084 | | const int drawy = pixelOffsetY+y; |
| 1085 | | if ((drawy>383) || (drawy<0)) continue; |
| 1086 | | line = &drawbitmap->pix32(drawy); |
| 1087 | | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1088 | | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1088 | YLOOP_START |
| 1089 | 1089 | |
| 1090 | 1090 | |
| 1091 | 1091 | if (used_flipx) |
| 1092 | 1092 | { |
| 1093 | | for (int x = 0; x < blockwide; x++) |
| 1094 | | { |
| 1095 | | const int drawx = pixelOffsetX+x; |
| 1096 | | if ((drawx>=495 || drawx<0)) continue; |
| 1097 | | int realx = ((x*incx)>>21); |
| 1093 | XLOOP_START |
| 1098 | 1094 | |
| 1099 | 1095 | UINT16 pix = tempshape[realx*16+(15-realy)]; |
| 1100 | 1096 | DRAW_PIX |
| r21324 | r21325 | |
| 1102 | 1098 | } |
| 1103 | 1099 | else |
| 1104 | 1100 | { |
| 1105 | | for (int x = 0; x < blockwide; x++) |
| 1106 | | { |
| 1107 | | const int drawx = pixelOffsetX+x; |
| 1108 | | if ((drawx>=495 || drawx<0)) continue; |
| 1109 | | int realx = ((x*incx)>>21); |
| 1101 | XLOOP_START |
| 1110 | 1102 | |
| 1111 | 1103 | UINT16 pix = tempshape[realx*16+realy]; |
| 1112 | 1104 | DRAW_PIX |
| r21324 | r21325 | |
| 1119 | 1111 | { |
| 1120 | 1112 | if (used_flipy) |
| 1121 | 1113 | { |
| 1122 | | for (int y = 0; y < blockhigh; y++) |
| 1123 | | { |
| 1124 | | int realy = ((y*incy)>>21); |
| 1125 | | if (!hZoomTable[realy]) |
| 1126 | | continue; |
| 1127 | | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1128 | | const int drawy = pixelOffsetY+y; |
| 1129 | | if ((drawy>383) || (drawy<0)) continue; |
| 1130 | | line = &drawbitmap->pix32(drawy); |
| 1131 | | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1132 | | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1114 | YLOOP_START |
| 1133 | 1115 | |
| 1134 | | |
| 1135 | 1116 | if (used_flipx) |
| 1136 | 1117 | { |
| 1137 | | for (int x = 0; x < blockwide; x++) |
| 1138 | | { |
| 1139 | | const int drawx = pixelOffsetX+x; |
| 1140 | | if ((drawx>=495 || drawx<0)) continue; |
| 1141 | | int realx = ((x*incx)>>21); |
| 1118 | XLOOP_START |
| 1142 | 1119 | |
| 1143 | 1120 | UINT16 pix = tempshape[(15-realy)*16+(15-realx)]; |
| 1144 | 1121 | DRAW_PIX |
| r21324 | r21325 | |
| 1146 | 1123 | } |
| 1147 | 1124 | else |
| 1148 | 1125 | { |
| 1149 | | for (int x = 0; x < blockwide; x++) |
| 1150 | | { |
| 1151 | | const int drawx = pixelOffsetX+x; |
| 1152 | | if ((drawx>=495 || drawx<0)) continue; |
| 1153 | | int realx = ((x*incx)>>21); |
| 1126 | XLOOP_START |
| 1154 | 1127 | UINT16 pix = tempshape[(15-realy)*16+realx]; |
| 1155 | 1128 | DRAW_PIX |
| 1156 | 1129 | } |
| r21324 | r21325 | |
| 1159 | 1132 | } |
| 1160 | 1133 | else // no rotate, no flipy |
| 1161 | 1134 | { |
| 1162 | | for (int y = 0; y < blockhigh; y++) |
| 1163 | | { |
| 1164 | | int realy = ((y*incy)>>21); |
| 1165 | | if (!hZoomTable[realy]) |
| 1166 | | continue; |
| 1167 | | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1168 | | const int drawy = pixelOffsetY+y; |
| 1169 | | if ((drawy>383) || (drawy<0)) continue; |
| 1170 | | line = &drawbitmap->pix32(drawy); |
| 1171 | | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1172 | | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1135 | YLOOP_START |
| 1173 | 1136 | |
| 1174 | 1137 | |
| 1175 | 1138 | if (used_flipx) |
| 1176 | 1139 | { |
| 1177 | | for (int x = 0; x < blockwide; x++) |
| 1178 | | { |
| 1179 | | const int drawx = pixelOffsetX+x; |
| 1180 | | if ((drawx>=495 || drawx<0)) continue; |
| 1181 | | int realx = ((x*incx)>>21); |
| 1140 | XLOOP_START |
| 1182 | 1141 | |
| 1183 | 1142 | UINT16 pix = tempshape[realy*16+(15-realx)]; |
| 1184 | 1143 | DRAW_PIX |
| 1185 | 1144 | } |
| 1186 | 1145 | } |
| 1187 | | |
| 1188 | | |
| 1189 | | |
| 1190 | 1146 | else // no rotate, no flipy, no flipx |
| 1191 | 1147 | { |
| 1192 | | for (int x = 0; x < blockwide; x++) |
| 1193 | | { |
| 1194 | | const int drawx = pixelOffsetX+x; |
| 1195 | | if ((drawx>=495 || drawx<0)) continue; |
| 1196 | | int realx = ((x*incx)>>21); |
| 1148 | XLOOP_START |
| 1197 | 1149 | |
| 1198 | 1150 | UINT16 pix = tempshape[realy*16+realx]; |
| 1199 | 1151 | DRAW_PIX |
| r21324 | r21325 | |
| 1201 | 1153 | } |
| 1202 | 1154 | } |
| 1203 | 1155 | } |
| 1156 | |
| 1157 | |
| 1204 | 1158 | } |
| 1205 | 1159 | } |
| 1206 | 1160 | } |