Prior to deleting the TileMap to see if I can just replace it with new features in Map and textures::.
This commit is contained in:
parent
f45dbe8c48
commit
ea9f6bf383
5 changed files with 15 additions and 8 deletions
|
@ -4,27 +4,31 @@
|
|||
"foreground": [40, 15, 125],
|
||||
"background": [200, 15, 75],
|
||||
"collision": false,
|
||||
"display": 10398
|
||||
"display": 10398,
|
||||
"id": 0
|
||||
},
|
||||
"WALL_MOSS": {
|
||||
"texture": "assets/glowing_moss_wall-256.png",
|
||||
"foreground": [230, 20, 30],
|
||||
"background": [230, 20, 120],
|
||||
"collision": true,
|
||||
"display": 8820
|
||||
"display": 8820,
|
||||
"id": 1
|
||||
},
|
||||
"WALL_PLAIN": {
|
||||
"texture": "assets/wall_texture_test-256.png",
|
||||
"foreground": [230, 20, 30],
|
||||
"background": [230, 20, 120],
|
||||
"collision": true,
|
||||
"display": 9608
|
||||
"display": 9608,
|
||||
"id": 2
|
||||
},
|
||||
"WALL_VINES": {
|
||||
"texture": "assets/wall_with_vines-256.png",
|
||||
"foreground": [230, 20, 30],
|
||||
"background": [230, 20, 120],
|
||||
"collision": false,
|
||||
"display": 35
|
||||
"display": 35,
|
||||
"id": 3
|
||||
}
|
||||
}
|
||||
|
|
1
map.cpp
1
map.cpp
|
@ -149,6 +149,7 @@ void Map::load_tiles() {
|
|||
}
|
||||
|
||||
void Map::enclose() {
|
||||
// wraps the outside edge with solid walls
|
||||
std::array<Point, 4> starts{{
|
||||
{0,0}, {$width-1, 0}, {$width-1, $height-1}, {0, $height-1}
|
||||
}};
|
||||
|
|
|
@ -383,6 +383,8 @@ void Raycaster::draw_ceiling_floor() {
|
|||
int map_y = int(floor_y);
|
||||
int light_level = matrix::inbounds(lights, map_x, map_y) ? lights[map_y][map_x] : 30;
|
||||
|
||||
// NOTE: use map_x/y to get the floor, ceiling texture.
|
||||
|
||||
// FLOOR
|
||||
color = $floor_texture[texture_width * ty + tx];
|
||||
$pixels[pixcoord(x, y)] = lighting_calc(color, row_distance, light_level);
|
||||
|
|
|
@ -38,8 +38,8 @@ void TileMap::dump(int show_x, int show_y) {
|
|||
std::cout << to_string(show_x, show_y) << std::endl;
|
||||
}
|
||||
|
||||
void TileMap::set_tile(size_t x, size_t y, string tile_name) {
|
||||
json tile_conf = $config[tile_name];
|
||||
void TileMap::set_tile(size_t x, size_t y, const string& tile_name) {
|
||||
json& tile_conf = $config[tile_name];
|
||||
|
||||
auto tile = components::convert<Tile>(tile_conf);
|
||||
$tile_ids[y][x] = tile.display;
|
||||
|
|
|
@ -28,8 +28,8 @@ public:
|
|||
size_t width() { return $width; }
|
||||
size_t height() { return $height; }
|
||||
void load(matrix::Matrix &walls);
|
||||
const components::Tile &at(size_t x, size_t y);
|
||||
void set_tile(size_t x, size_t y, std::string tile_name);
|
||||
const components::Tile& at(size_t x, size_t y);
|
||||
void set_tile(size_t x, size_t y, const std::string& tile_name);
|
||||
std::vector<std::string> tile_names(bool collision);
|
||||
|
||||
std::string to_string(int show_x, int show_y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue