rendered paste bodyvoid ClipSprite8_OR(short x, short y, short h, unsigned char *sprite, unsigned char *dest){ short first_byte, bit, i; unsigned char clipped; // Return if will never see if (x < -7 || y < -7) return; // Calculate first_byte = (y * 30) + (x >> 3); bit = x & 7; for(i=0; i<h; i++) { // Clip Y if (first_byte + (30 * i) < 0 || first_byte + (30 * i) > LCD_SIZE) continue; // Clip X if (x < 0) { clipped = *(sprite + i) << -x; clipped >>= -x; } else if (x > 159) { clipped = *(sprite + i) >> (x - 239); clipped <<= (x - 239); } else clipped = *(sprite + i); // OR Sprite now *(dest+first_byte+(30 * i)) |= clipped >> bit; if(bit) *(dest+first_byte+(30 * i)+1) |= clipped << (8 - bit); }}