Make outside background tiles ignore solid walls

This was the behavior in the old autotiling system, so this brings that
behavior back.
This commit is contained in:
AllyTally 2023-12-09 22:26:30 -04:00 committed by Misa Elizabeth Kai
parent d314672614
commit 03bc9566fb
2 changed files with 37 additions and 10 deletions

View File

@ -250,14 +250,14 @@ editorclass::editorclass(void)
register_tilecol(EditorTileset_SPACE_STATION, 30, "basic", 507, "basic", 689); register_tilecol(EditorTileset_SPACE_STATION, 30, "basic", 507, "basic", 689);
register_tilecol(EditorTileset_SPACE_STATION, 31, "basic", 510, "basic", 698); register_tilecol(EditorTileset_SPACE_STATION, 31, "basic", 510, "basic", 698);
register_tilecol(EditorTileset_OUTSIDE, 0, "basic", 480, "outside", 680); register_tilecol(EditorTileset_OUTSIDE, 0, "basic", 480, "outside", 680, false, true);
register_tilecol(EditorTileset_OUTSIDE, 1, "basic", 483, "outside", 683); register_tilecol(EditorTileset_OUTSIDE, 1, "basic", 483, "outside", 683, false, true);
register_tilecol(EditorTileset_OUTSIDE, 2, "basic", 486, "outside", 686); register_tilecol(EditorTileset_OUTSIDE, 2, "basic", 486, "outside", 686, false, true);
register_tilecol(EditorTileset_OUTSIDE, 3, "basic", 489, "outside", 689); register_tilecol(EditorTileset_OUTSIDE, 3, "basic", 489, "outside", 689, false, true);
register_tilecol(EditorTileset_OUTSIDE, 4, "basic", 492, "outside", 692); register_tilecol(EditorTileset_OUTSIDE, 4, "basic", 492, "outside", 692, false, true);
register_tilecol(EditorTileset_OUTSIDE, 5, "basic", 495, "outside", 695); register_tilecol(EditorTileset_OUTSIDE, 5, "basic", 495, "outside", 695, false, true);
register_tilecol(EditorTileset_OUTSIDE, 6, "basic", 498, "outside", 698); register_tilecol(EditorTileset_OUTSIDE, 6, "basic", 498, "outside", 698, false, true);
register_tilecol(EditorTileset_OUTSIDE, 7, "basic", 501, "outside", 701); register_tilecol(EditorTileset_OUTSIDE, 7, "basic", 501, "outside", 701, false, true);
register_tilecol(EditorTileset_LAB, 0, "lab_cyan", 280, "none", 713); register_tilecol(EditorTileset_LAB, 0, "lab_cyan", 280, "none", 713);
register_tilecol(EditorTileset_LAB, 1, "lab_red", 283, "none", 713); register_tilecol(EditorTileset_LAB, 1, "lab_red", 283, "none", 713);
@ -295,7 +295,8 @@ void editorclass::register_tilecol(
const int foreground_base, const int foreground_base,
const char* background_type, const char* background_type,
const int background_base, const int background_base,
const bool direct const bool direct,
const bool bg_ignores_walls
) { ) {
EditorTilecolInfo info; EditorTilecolInfo info;
info.foreground_type = foreground_type; info.foreground_type = foreground_type;
@ -303,6 +304,7 @@ void editorclass::register_tilecol(
info.background_type = background_type; info.background_type = background_type;
info.background_base = background_base; info.background_base = background_base;
info.direct_mode = direct; info.direct_mode = direct;
info.bg_ignores_walls = bg_ignores_walls;
tileset_colors[tileset][index] = info; tileset_colors[tileset][index] = info;
if (!direct) if (!direct)
@ -315,6 +317,18 @@ void editorclass::register_tilecol(
tileset_max_colour_direct[tileset] = SDL_max(tileset_max_colour_direct[tileset], index); tileset_max_colour_direct[tileset] = SDL_max(tileset_max_colour_direct[tileset], index);
} }
void editorclass::register_tilecol(
EditorTilesets tileset,
const int index,
const char* foreground_type,
const int foreground_base,
const char* background_type,
const int background_base,
const bool bg_ignores_walls
) {
register_tilecol(tileset, index, foreground_type, foreground_base, background_type, background_base, bg_ignores_walls, false);
}
void editorclass::register_tilecol( void editorclass::register_tilecol(
EditorTilesets tileset, EditorTilesets tileset,
const int index, const int index,
@ -3875,12 +3889,23 @@ bool editorclass::autotile_connector(int x, int y, TileTypes original_type)
return false; return false;
} }
EditorTilecolInfo data = get_tilecol_data();
if (original_type == TileType_NONSOLID)
{
if (data.bg_ignores_walls)
{
return new_type == TileType_NONSOLID || is_warp_zone_background(tile);
}
return true;
}
if (new_type == TileType_SOLID && !is_warp_zone_background(tile)) if (new_type == TileType_SOLID && !is_warp_zone_background(tile))
{ {
return true; return true;
} }
return original_type == TileType_NONSOLID; return false;
} }
int editorclass::get_enemy_tile(int t) int editorclass::get_enemy_tile(int t)

View File

@ -27,6 +27,7 @@ struct EditorTilecolInfo
const char* background_type; const char* background_type;
int background_base; int background_base;
bool direct_mode; bool direct_mode;
bool bg_ignores_walls;
}; };
enum EditorTools enum EditorTools
@ -139,6 +140,7 @@ public:
void reset(void); void reset(void);
void register_tileset(EditorTilesets tileset, const char* name); void register_tileset(EditorTilesets tileset, const char* name);
void register_tilecol(EditorTilesets tileset, int index, const char* foreground_type, int foreground_base, const char* background_type, int background_base, bool direct, bool bg_ignores_walls);
void register_tilecol(EditorTilesets tileset, int index, const char* foreground_type, int foreground_base, const char* background_type, int background_base, bool direct); void register_tilecol(EditorTilesets tileset, int index, const char* foreground_type, int foreground_base, const char* background_type, int background_base, bool direct);
void register_tilecol(EditorTilesets tileset, int index, const char* foreground_type, int foreground_base, const char* background_type, int background_base); void register_tilecol(EditorTilesets tileset, int index, const char* foreground_type, int foreground_base, const char* background_type, int background_base);