Posted on setembro 7th, 2010 por admin
Finished writing some bitmap rotines on ZamnED. The tileset decompression routine is working nice.
I had to write a tile flip routine, because SDL doesn’t support flipping ( argh )
void flip_surface(SDL_Surface *surface, int direction)
{
unsigned char src[8*8];
unsigned char dst[8*8];
int x,rx,y,ry;
memcpy(&src,(unsigned char *)surface->pixels,8*8);
for(x=0,rx=8-1; x<8; x++, rx--)
{
for(y=0,ry=8-1; y<8; y++, ry--)
{
if(direction==0) dst[(ry*8)+x]=src[(y*8)+x];
else
if(direction==1) dst[(y*8)+rx]=src[(y*8)+x];
else
if(direction==2) dst[(ry*8)+rx]=src[(y*8)+x];
}
}
memcpy((unsigned char *)surface->pixels,&dst,8*8);
}
{
unsigned char src[8*8];
unsigned char dst[8*8];
int x,rx,y,ry;
memcpy(&src,(unsigned char *)surface->pixels,8*8);
for(x=0,rx=8-1; x<8; x++, rx--)
{
for(y=0,ry=8-1; y<8; y++, ry--)
{
if(direction==0) dst[(ry*8)+x]=src[(y*8)+x];
else
if(direction==1) dst[(y*8)+rx]=src[(y*8)+x];
else
if(direction==2) dst[(ry*8)+rx]=src[(y*8)+x];
}
}
memcpy((unsigned char *)surface->pixels,&dst,8*8);
}
The final image loaded directly from ROM:
The whole map, finally rendered.

Filed under: ZamnED | No Comments »
