Reply to Error in map_tile(); documentation.
If you don't have an account, just leave the password field blank.
While I don't think people have actually used this function, dinkc.chm has things wrong here:
The tile_index will range from 1 to 4428. tile_index 1 is the tile in the upper-left corner of tileset 1, tile 109 is the tile in the upper-left corner of tileset 2, and so on.
The tile_index will range from 0 to 5355. tile_index 0 is the tile in the upper-left corner of tileset 1, tile 128 is the tile in the upper-left corner of tileset 2, and so on.
The get_map_tile_index() function provided after it is wrong as well, here is a modified version that's correct:
If you know what tile on what tileset you're looking for, you can use that function to get the appropriate tile_index:
The tile_index will range from 1 to 4428. tile_index 1 is the tile in the upper-left corner of tileset 1, tile 109 is the tile in the upper-left corner of tileset 2, and so on.
The tile_index will range from 0 to 5355. tile_index 0 is the tile in the upper-left corner of tileset 1, tile 128 is the tile in the upper-left corner of tileset 2, and so on.
The get_map_tile_index() function provided after it is wrong as well, here is a modified version that's correct:
// get_map_tile_index
// &arg1 = Tileset (1-41)
// &arg2 = Tile X coordinate (1-12)
// &arg3 = Tile Y coordinate (1-9)
void get_map_tile_index( void )
{
// Calculate the Tileset offset
int &temp = &arg1;
&temp -= 1;
&temp * 128;
int &index = &temp;
// Calculate the X offset
&temp = &arg2;
&temp -= 1;
&index += &temp;
// Calculate the Y offset
&temp = &arg3;
&temp -= 1;
&temp * 12;
&index += &temp;
return(&index);
}
If you know what tile on what tileset you're looking for, you can use that function to get the appropriate tile_index:
void main( void )
{
// Assuming the above procedure lives in tiles.c
// Retrieve the tile_index for the tile on tileset 5, second column, first row.
external("tiles","get_map_tile_index",5,2,1);
// Replace the top-left tile of the current screen with the tile on tileset 5, second column, first row, of which we just got the tile_index.
map_tile(1, &return);
// Needed to see it happen:
draw_background();
}







