diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index d6ded494..55c70583 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -4017,8 +4017,48 @@ bool editorclass::lines_can_pass(int x, int y) return false; } +void editorclass::make_autotiling_base(void) +{ + if (cl.getroomprop(levx, levy)->directmode == 1) + { + return; + } + + for (int i = 0; i < SCREEN_WIDTH_TILES * SCREEN_HEIGHT_TILES; i++) + { + int tile_x = i % SCREEN_WIDTH_TILES; + int tile_y = i / SCREEN_WIDTH_TILES; + int tile = get_tile(tile_x, tile_y); + + if (tile == 0) + { + continue; + } + + TileTypes type = get_tile_type(tile_x, tile_y, false); + + switch (type) + { + case TileType_NONSOLID: + if (type == TileType_NONSOLID || is_warp_zone_background(tile)) + { + set_tile(tile_x, tile_y, 2); + } + break; + case TileType_SOLID: + set_tile(tile_x, tile_y, 1); + break; + case TileType_SPIKE: + set_tile(tile_x, tile_y, 6); + break; + } + } +} + void editorclass::switch_tileset(const bool reversed) { + make_autotiling_base(); + int tiles = cl.getroomprop(levx, levy)->tileset; if (reversed) @@ -4052,6 +4092,8 @@ void editorclass::switch_tileset(const bool reversed) void editorclass::switch_tilecol(const bool reversed) { + make_autotiling_base(); + int tilecol = cl.getroomprop(levx, levy)->tilecol; if (reversed) diff --git a/desktop_version/src/Editor.h b/desktop_version/src/Editor.h index 149cb005..f0f879db 100644 --- a/desktop_version/src/Editor.h +++ b/desktop_version/src/Editor.h @@ -177,6 +177,8 @@ public: bool lines_can_pass(int x, int y); + void make_autotiling_base(void); + int get_enemy_tile(int t); void switch_tileset(const bool reversed);