26 lines
937 B
C
26 lines
937 B
C
#include "display_engine.h"
|
|
|
|
void display_map(const int x_offset, const int y_offset)
|
|
{
|
|
extern const struct map map_world;
|
|
extern const bopti_image_t img_tileset;
|
|
|
|
for (int layer = 0 ; layer < map_world.nb_layers; layer++)
|
|
{
|
|
for (int y = 0 ; y <= map_world.height; y ++)
|
|
{
|
|
for (int x = 0 ; x <= map_world.width; x ++)
|
|
{
|
|
unsigned int tile_id = map_world.layers[layer][y * map_world.width + x];
|
|
if (tile_id != 0)
|
|
{
|
|
tile_id --;
|
|
unsigned int tile_x = (TILE_SIZE + 1) * (tile_id % TILESET_WIDTH);
|
|
unsigned int tile_y = (TILE_SIZE + 1) * (tile_id / TILESET_WIDTH);
|
|
|
|
dsubimage(x_offset + x * TILE_SIZE, y_offset + y * TILE_SIZE, &img_tileset, tile_x, tile_y, TILE_SIZE, TILE_SIZE, DIMAGE_NONE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |