void ClipSprite32_89_OR(short x, short y, short height, unsigned short *data, void *addr) { unsigned char i=0; unsigned long *pos=addr+(y*30); pos+=(x>>5); //increment pos according to x (x/32) for(;i=0) { //clip vertically if(x>=0 && x<=159-32) { //if no horiz clipping is needed *pos |= data[i]>>(x&31); //(x%32) *(pos+1) |= data[i]<<(32-(x&31)); } else { if(x<0 && x>-32) //if sprite is to the left *(pos+1) |= data[i]<<(32-(x&31)); else //if sprite is to the right *pos |= data[i]>>(x&31); } } } }