diff --git a/code/apps/server/source/blocks_list.c b/code/apps/server/source/blocks_list.c index 2786a1d..47c0731 100644 --- a/code/apps/server/source/blocks_list.c +++ b/code/apps/server/source/blocks_list.c @@ -1,7 +1,8 @@ #include "blocks.h" +#include "atlas_shared.h" static block blocks[] = { - {.tex_id = 0, .name = "base-ground", .flags = 0, .kind = BLOCK_KIND_GROUND, .biome = 0, .symbol = '.'}, - {.tex_id = 1, .name = "base-wall", .flags = BLOCK_FLAG_COLLISION, .kind = BLOCK_KIND_WALL, .biome = 0, .symbol = '#'}, - {.tex_id = 2, .name = "base-water", .flags = BLOCK_FLAG_COLLISION, .kind = BLOCK_KIND_WATER, .biome = 0, .symbol = '~'}, + {.tex_id = ATLAS_XY(0, 0), .name = "base-ground", .flags = 0, .kind = BLOCK_KIND_GROUND, .biome = 0, .symbol = '.'}, + {.tex_id = ATLAS_XY(1, 0), .name = "base-wall", .flags = BLOCK_FLAG_COLLISION, .kind = BLOCK_KIND_WALL, .biome = 0, .symbol = '#'}, + {.tex_id = ATLAS_XY(0, 1), .name = "base-water", .flags = BLOCK_FLAG_COLLISION, .kind = BLOCK_KIND_WATER, .biome = 0, .symbol = '~'}, }; diff --git a/code/common/atlas_shared.h b/code/common/atlas_shared.h new file mode 100644 index 0000000..4eb66dc --- /dev/null +++ b/code/common/atlas_shared.h @@ -0,0 +1,4 @@ +#pragma once + +#define ATLAS_STRIDE 10 +#define ATLAS_XY(x,y) ((y*ATLAS_STRIDE)+x)