Trying to load big map
Posted: Tue Mar 17, 2020 11:32 am
Hello I am trying to load a big map (8192x224) but currently getting a black screen(no erros or anything). Is there a limit on how much you can load? I got it to work trimming to half the size 4096px. I read that there is a limit about unique tiles(1200), but i dont think that limit is even close since it is a limited tile set - anyway to check if that is the case?.
here is the resource code, i have removed debug functions to simplify, but none return any errors besides currentMap returning 0 when i try to load the big map.
my metatiles are 32x32px, is there anyway i can load tileset and tilemap separated? maybe that way i could save some RAM (224x7 metatiles in this map - then i could map each metatile to individual 8x8 hardware tiles).
code:
and the loading code:
thanks!
here is the resource code, i have removed debug functions to simplify, but none return any errors besides currentMap returning 0 when i try to load the big map.
my metatiles are 32x32px, is there anyway i can load tileset and tilemap separated? maybe that way i could save some RAM (224x7 metatiles in this map - then i could map each metatile to individual 8x8 hardware tiles).
code:
Code: Select all
IMAGE level1a "gfx/Dark Wood Demo Foreground.png" NONE
Code: Select all
#include <genesis.h>
#include "gfx.h"
u16 allPaletteValues[64];
Map *currentMap;
void SetPalette(u16 paletteIndex, const u16* palette)
{
int loop = 0;
for (loop = 0; loop < 16; loop++)
{
allPaletteValues[loop + (paletteIndex << 4)] = palette[loop];
}
}
void FadeIn(u16 time)
{
VDP_fadeInAll(allPaletteValues, time, 1);
}
int main()
{
currentMap = unpackMap(level1a.map, NULL);
u16 index = TILE_USERINDEX;
SYS_disableInts();
VDP_loadTileSet(level1a.tileset, index, TRUE);
VDP_setMapEx(PLAN_A, currentMap, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, index), 0, 0, 0, 0, planWidth, planHeight);
SetPalette(PAL0, level1a.palette->data);
SYS_enableInts();
index += level1a.tileset->numTile;
FadeIn(10);
while (TRUE)
{
VDP_waitVSync();
}
return 0;
}