+static void DrawSpritesFromCacheAS(int *hc, int maxwidth, int prio, int sh)\r
+{\r
+ int code, tile, sx, delta, width;\r
+ int pal;\r
+ int (*fTileFunc)(int sx,int addr,int pal);\r
+\r
+ // *(*hc)++ = (tile<<16)|((code&0x0800)<<5)|((sx<<6)&0x0000ffc0)|((code>>9)&0x30)|((sprite[0]>>24)&0xf);\r
+\r
+ while((code=*hc++)) {\r
+ pal=(code&0x30);\r
+ delta=code&0xf;\r
+ width=delta>>2; delta&=3;\r
+ width++; delta++; // Width and height in tiles\r
+ if (code&0x10000) delta=-delta; // Flip X\r
+ delta<<=4;\r
+ tile=((unsigned int)code>>17)<<1;\r
+ sx=(code<<16)>>22; // sx can be negative (start offscreen), so sign extend\r
+\r
+ if(sh && pal == 0x30) { //\r
+ if(code&0x10000) fTileFunc=TileFlipSHAS;\r
+ else fTileFunc=TileNormSHAS;\r
+ } else {\r
+ if(code&0x10000) fTileFunc=TileFlipAS;\r
+ else fTileFunc=TileNormAS;\r
+ }\r
+\r
+ for (; width; width--,sx+=8,tile+=delta)\r
+ {\r
+ if(sx<=0) continue;\r
+ if(sx>=328) break; // Offscreen\r
+\r
+ tile&=0x7fff; // Clip tile address\r
+ fTileFunc(sx,tile,pal);\r
+ }\r
+ }\r
+}\r
+\r