gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Troubles with TEXTBG tile mode

#23980 - Rommel - Sun Jul 25, 2004 11:49 pm

I've had no trouble getting rot tile bgs to work, at all. However when it comes to using TextBG mode, I'm having a few troubles. First off, I know it isn't read in the same way as the Rotation Tiles are if you are using 512x256, or 512x512 maps. I can get the 512x256 modes working, off of a little code that is on the PernProject site

Code:
      int OFFSET = 32;
   for(tile_y = 0; tile_y < 64; tile_y++)
   {
   for(tile_x = 0; tile_x < 64; tile_x++)
   {
   if(tile_x < 32)
   bg2.mapData[tile_x + tile_y * 32] = test[tile_x + tile_y * 64];
   else
   bg2.mapData[ (tile_x-32) + tile_y * 32 + OFFSET] = test[tile_x + tile_y * 64];


However when I try to figure out what I need to get 512x512 to work I get a little lost. Here is a code snippet from Pern again.
Code:

int OFFSET = 32x32; //offset to get to the right hand part of the map
for(tile_y == 0; tile_y < 32; tile_y++)
{
for(tile_x == 0; tile_x < 64; tile_x++)
{
if(tile_x < 32) //It is in the left hand block
MapPointer[tile_x + tile_y * 32] == MapData[tile_x + tile_y * 64]
else //it is in the right hand block so add the offset of the first block and subtract 32 from tile_x
MapPointer[ (tile_x-32) + tile_y * 32 + OFFSET] == MapData[tile_x + tile_y * 64];
}
}


My problem here, is trying to figure out where exactly in my bg2.mapData array, I need to access to store the data from MapPointer. I tried making it by what is said from the comments, but what I have tried putting there is not doing the trick. If anyone has any pointers, as to what I need to be adding to that code to get textbgs working it'd be a great help.

Thanks in advance

#23982 - dovoto - Sun Jul 25, 2004 11:58 pm

If you look under day 6 there is full source code for displaying just about any sized/type background available. If this is what you are looking at allready then I will try to clarify. I am curently rewriting the tutorials and will be getting to backgrounds later this week.
_________________
www.drunkencoders.com

#23983 - Rommel - Mon Jul 26, 2004 12:06 am

Wow... I never saw those. Worthless post from me then, thanks much. Those are exactly what I was looking for.

Thanks again :)