Help setting IMAGE mapbase

SGDK only sub forum

Moderator: Stef

Post Reply
cloudstrifer
Very interested
Posts: 118
Joined: Mon Feb 19, 2018 7:31 pm

Help setting IMAGE mapbase

Post by cloudstrifer » Sat Aug 08, 2020 6:03 pm

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!

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Help setting IMAGE mapbase

Post by Stef » Mon Aug 10, 2020 8:14 am

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.

cloudstrifer
Very interested
Posts: 118
Joined: Mon Feb 19, 2018 7:31 pm

Re: Help setting IMAGE mapbase

Post by cloudstrifer » Tue Aug 11, 2020 2:06 pm

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!

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Help setting IMAGE mapbase

Post by Stef » Wed Aug 12, 2020 8:08 am

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) :)

Post Reply