Page 1 of 1

Displaying the titlescreen corruption

Posted: Sun Oct 11, 2015 8:07 pm
by orlanrod
I think one is overriding another in memory, but not sure. This is what is happening on screen.

titlebg_tiles in BPLAN is corrupted.
The titlelogo_tiles in APLAN is displaying correctly.
sjaris_sprite is displaying correctly.
fcitizen_sprite is displaying with a green colors, rather then its own red colors in its palette.

Here is the code.

u16 palette[96];

VDP_setPaletteColors(0, palette_black, 96);

titlebgmap = unpackMap(titlebg_tiles.map, NULL);
indb = TILE_USERINDEX;
VDP_loadTileSet(titlebg_tiles.tileset, indb, TRUE);
VDP_setMapEx(BPLAN, titlebgmap, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, indb), PlanXPosInTile, PlanYPosInTile, MapXPosInTile, MapYPosInTile, MapWidthInTile, MapHeightInTile);
indb += titlebg_tiles.tileset->numTile;

titlelogomap = unpackMap(titlelogo_tiles.map, NULL);
inda = TILE_USERINDEX;
VDP_loadTileSet(titlelogo_tiles.tileset, inda, TRUE);
VDP_setMapEx(APLAN, titlelogomap, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, inda), 9, 1, 0, 0, 20, 17);
inda += titlelogo_tiles.tileset->numTile;

memcpy(&palette[0], titlebg_tiles.palette->data, 16 * 2);
memcpy(&palette[16], titlelogo_tiles.palette->data, 16 * 2);
memcpy(&palette[32], sjaris_sprite.palette->data, 16 * 2);
memcpy(&palette[64], fcitizen_sprite.palette->data, 16 * 2);

VDP_fadeIn(0, (3 * 16) - 1, palette, 20, FALSE);

Re: Displaying the titlescreen corruption

Posted: Sun Oct 11, 2015 10:00 pm
by orlanrod
Apparently using TILEUSERINDEX to load the next tilemap is what was causing that problem. i just use indb = 0; for one map and it works.

But now i need to fix why the fcitizen sprite is not showing its colors right.

Re: Displaying the titlescreen corruption

Posted: Sun Oct 11, 2015 10:18 pm
by orlanrod
So i stop using the fade in with the palette array, since apparently i do not know how to use it yet.
Now i just use VDP_setPalette(PAL(0,1,2...), sprite.palette->data); for each tilemap and sprite. That works fine.

I'll leave this post unsolved for now, but if you want to tell me how to use it go ahead and post, and i'll redo it.
moving onto the next thing for now.

Re: Displaying the titlescreen corruption

Posted: Mon Oct 12, 2015 9:27 am
by Stef
You should not have separate indb and inda, background plan share the same memory for their tiles.
So basically here by doing that :

Code: Select all

inda = TILE_USERINDEX;
VDP_loadTileSet(titlelogo_tiles.tileset, inda, TRUE);
you are overriding tiles from plan B by the tiles from plan A.

Just use :

Code: Select all

VDP_loadTileSet(titlelogo_tiles.tileset, ind, TRUE);
You just need to save in separate variable position of indb and inda for future reference in the setMapEx(..) methods but definitely you should keep tiles of both plan in different VRAM area.

Re: Displaying the titlescreen corruption

Posted: Mon Oct 12, 2015 4:20 pm
by orlanrod
Stef wrote:You should not have separate indb and inda, background plan share the same memory for their tiles.
So basically here by doing that :

Code: Select all

inda = TILE_USERINDEX;
VDP_loadTileSet(titlelogo_tiles.tileset, inda, TRUE);
you are overriding tiles from plan B by the tiles from plan A.

Just use :

Code: Select all

VDP_loadTileSet(titlelogo_tiles.tileset, ind, TRUE);
You just need to save in separate variable position of indb and inda for future reference in the setMapEx(..) methods but definitely you should keep tiles of both plan in different VRAM area.
Ah i see. I have corrected it now, and now using one var.