Here's a collision routine I wrote, it gives pixel perfect collision and it's reasonably fast. Feel free to use it if it helps.
It takes the same parameters as GpTransBlt so it's nice and easy to use.
Dave
int images_collide(int dx1, int dy1, int dw1, int dh1, uchar * src1, int sx1, int sy1, int sw1, int sh1, int c1, int dx2, int dy2, int dw2, int dh2, uchar * src2, int sx2, int sy2, int sw2, int sh2, int c2)
{
int close;
close=0;
int cl,cr,ct,cb,cx,cy,ofx1,ofx2,ofy1,ofy2;
//**** Check to see whether the 2 gfx are even close - no point pixel checking if not ****
if ((dx1 >= dx2-dw1) && (dx1 <= dx2+dw2) && (dy1 >= dy2-dh1) && (dy1 <= dy2+dh2)) close=1;
// if ((dx2 >= dx1-dw2) && (dx2 <= dx1+dw1) && (dy2 >= dy1-dh2) && (dy2 <= dy1+dh1)) close=1;
if (close==0) return (close);
//**** Work out total region that may have a collision within ****
cl=dx1;
if (dx2 < dx1) cl=dx2;
cr=dx1+dw1;
if (dx2+dw2 > dx1+dw1) cr=dx2+dw2;
ct=dy1;
if (dy2 < dy1) ct=dy2;
cb=dy1+dh1;
if (dy2+dh2 > dy1+dh1) cb=dy2+dh2;
//**** Go through the collision region and see if both gfx have an unmasked pixel ****
for (cx=cl;cx<=cr;cx++)
for (cy=ct;cy<=cb;cy++)
{
if ((cx>dx1) && (cx<=dx1+dw1) && (cy>dy1) && (cy<=dy1+dh1))
{
if (*(src1+((cx-dx1)+sx1-1)*sh1+sh1-((cy-dy1)+sy1)) != c1)
{
if ((cx>dx2) && (cx<=dx2+dw2) && (cy>dy2) && (cy<=dy2+dh2))
{
if (*(src2+((cx-dx2)+sx2-1)*sh2+sh2-((cy-dy2)+sy2)) != c2) return (1);
}
}
}
}
//**** If we've got here then no collision detected so return zero ****
return(0);
}