09/09/2000 :
New MagicKit and HuC released!
Assembler 2.5.0 -> 2.5.1
HuC 1.4 -> 1.4.2
#inctile(tiles, "tiles.pcx", 16, 1) load_vram(0x1400, tiles + (i << 6), 64); |
#incbin(level1, "level1.fmp") /* 16x16 */ #incchr(font, "font.pcx", 16, 6) char tile; int data; tile = level1[x + (y << 4)]; data = font[(i << 4)]; |
get_tile(x, y)get_map_width()get_map_height().scan_map_table() function is used to scan this table.
It will return the map that is at the requested position :
#incbin(level1, "level1.fmp") /* 256x256 */
#incbin(level2, "level2.fmp") /* 256x256 */
#incbin(level3, "level3.fmp") /* 256x256 */
#incbin(level4, "level4.fmp") /* 256x256 */
const int big_map[] = {
/* width & height of all the maps
* put together
*/
512, 512,
/* the following lines declare all
* the small maps (one line per map) :
*
* the two first values are the top/left
* coordinates of the small map inside
* the big map, the two followings values
* are bottom/right coordinates (inclusive),
* and the two last values are the map
* address in ROM
*/
0, 0, 255, 255, bank(level1), level1,
256, 0, 511, 255, bank(level2), level2,
0, 256, 255, 511, bank(level3), level3,
256, 256, 511, 511, bank(level4), level4,
/* -1 closes the table */
-1
};
|
scan_map_table()
function could be :
warp(x , y)
int x;
int y;
{
int *ptr;
ptr = scan_map_table(&x, &y);
set_map_data(ptr);
load_map(0, 0, x, y, 16, 14);
}
|
scan_map_table() 'x' and
'y' variables contain
global coordinates in the big map, but on return they contains
local coordinates in the map pointed to by 'ptr'.
The pointer returned by scan_map_table() is in fact a pointer
to a map line in the big map definition array (this pointer can
directly be passed to the set_map_data() function).
load_map() is still limited
to 256x256 maps, it can not handle map boundary crossing.
If you have to display a map section that is crossing
a map boundary you will need to call scan_map_table()
and load_map() functions for each map crossed (use the
map_get_width()
and map_get_height() functions, and the returned
'x' and 'y' coordinates to check if
a map section is crossing a boundary).