Page 1 of 1

Help setting IMAGE mapbase

Posted: Sat Aug 08, 2020 6:03 pm
by cloudstrifer
Hi.

How to set mapbase?
I want to use VDP_setTileMap.

Code: Select all

IMAGE stage_01_05_watter_01_A "gfx/stage_01_05_watter/01_A.png" NONE ALL ??mapbase????
https://github.com/Stephane-D/SGDK/blob ... escomp.txt

Thank you!

Re: Help setting IMAGE mapbase

Posted: Mon Aug 10, 2020 8:14 am
by Stef
mapbase is the equivalent of base_attr parameter in setTileMapEx..
So you need to specify at which tile index you want to put your tile data for this map (for instance TILE_USERINDEX) and also specify palette index if you plane to not use palette 0 for the map, palette index need to be shifted by 13 (TILE_ATTR_PALETTE_SFT) so for instance if you want to use palette 1 and tile index 100 you need to specify : (1 << 13) + 100 = 8192 + 100 = 8292
The difference with setTileMapEx(...) is that all map data is fixed and cannot be changed at runtime but at the expense of faster processing (setTileMapEx is slower than setTileMap) so basically you have to manually expand the TILE_ATTR_FULL macro from SGDK here.

Re: Help setting IMAGE mapbase

Posted: Tue Aug 11, 2020 2:06 pm
by cloudstrifer
Nice.

Sorry, but I dont understand one thing, why +100 two times?

Then the parameter will be the result of:

Code: Select all

(((flipH) << 11) + ((flipV) << 12) + ((pal) << 13) + ((prio) << 15) + (index))
?

Thank you!

Re: Help setting IMAGE mapbase

Posted: Wed Aug 12, 2020 8:08 am
by Stef
only once, it's just because i decomposed the calculation but indeed it correspond to the TILE_ATTR_FULL stuff :) This is the same parameter, except you define it at compile time instead that on runtime (sort of) :)