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.

Graphics > Map Editor Help needed

#6884 - einhaender - Wed Jun 04, 2003 5:52 am

Hi, iam having a little difficulties here. I have a very large tileset and every tile is different.

#define BG_WIDTH 160
#define BG_HEIGHT 128
const u16 BgData[] = { .... }

Now with Map Editor Beta I built my Background and exported it to a
.c file. However, since the the Editor builds something like
const u8 map[ 64 * 64 ] = { .. } , and there are so many tiles, the map
array will hold illegal integer values like:
const u8 map[ 64 * 64 ] = {
... 0x104,0x105,0x106 ...
}
There seems to be no posibility to change the datatype in Map Editor beta.
Then I tried Mappy with Fmp2Gba but the output is different and there are no good examples on how to use it. Since Iam coming from gbajunkies tutorial which uses Map Editor beta, my code reading the mapdata array looks like:

typedef struct Bg
{ ... }Bg;

Bg bg0;

// load Background Palette
for(loop = 0; loop < 256; loop++) {
BGPaletteMem[loop] = BgPalette[loop];
}

// load background tile data
for(loop = 0; loop < BG_WIDTH * BG_HEIGHT /2; loop++) {
bg0.tileData[loop] = BgData[loop];
}

temp = (u16*)maparray;
for(loop = 0; loop < 32*8/2; loop++)
bg0.mapData[loop] = temp[loop];

So if anyone found a solution for Map Editor beta to deal with large tilesets and the exported Maps, or has easy to understand explaination on how to use Mappy with the above code, that would be nice.
Thanks in advance

#9363 - www-fmsoftware-info - Sat Aug 02, 2003 11:55 pm

Quote:
temp = (u16*)maparray;
for(loop = 0; loop < 32*8/2; loop++)
bg0.mapData[loop] = temp[loop];


This may be the problem. If the map is 256x256 its made from 32x32 8x8 tiles:
for(loop = 0; loop < (32*32)/2; loop++)
bg0.mapData[loop] = temp[loop];

If the map is 512x512 its made from 64x64 8x8 tiles:
for(loop = 0; loop < (64*64)/2; loop++)
bg0.mapData[loop] = temp[loop];

If the map is 1024x1024 its made from 128x128 8x8 tiles:
for(loop = 0; loop < (128*128)/2; loop++)
bg0.mapData[loop] = temp[loop];

hope this helps.
_________________
[Images not permitted - Click here to view it]
www.fmsoftware.info