diff --git a/src/level.cpp b/src/level.cpp index acc891d..ff5a23b 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -329,12 +329,17 @@ bool level_is_same_type(Levelp l, int x, int y, int z, Tpp tp) return false; } - auto id = l->thing_id[ x ][ y ][ z ][ tp_z_depth_get(tp) ]; - if (! id) { - return false; + for (auto slot = 0; slot < MAP_SLOTS; slot++) { + Tpp it_tp; + Thingp it = level_thing_and_tp_get(l, x, y, z, slot, &it_tp); + if (! it) { + continue; + } + if (it_tp == tp) { + return true; + } } - - return id == tp_id_get(tp); + return false; } void level_bounds_set(Levelp l) diff --git a/src/level_display.cpp b/src/level_display.cpp index 8f1cd73..e6075af 100644 --- a/src/level_display.cpp +++ b/src/level_display.cpp @@ -117,6 +117,7 @@ static void level_display_obj(Levelp l, int x, int y, Tpp tp, Thingp t, bool dec } if (deco) { + return; tile_index += 47; } diff --git a/src/level_tiles.cpp b/src/level_tiles.cpp index a9bc9b4..55e42d2 100644 --- a/src/level_tiles.cpp +++ b/src/level_tiles.cpp @@ -188,7 +188,7 @@ void level_assign_tiles(Levelp l, int z) auto which = std::string(tile_name) + "." + is_join_enum_val2str((is_join_enum) block_type); auto tile = tile_find_mand(which.c_str()); if (tile) { - t->tile_index = tile_index(tile); + t->tile_index = tile_global_index(tile); t->anim_index = pcg_random_range_inclusive(0, tp_tiles_size(tp) - 1); t->anim_ms_remaining = pcg_random_range_inclusive(0, tile_delay_ms(tile)); } diff --git a/src/tp.cpp b/src/tp.cpp index b8a9e50..4bb3a45 100644 --- a/src/tp.cpp +++ b/src/tp.cpp @@ -79,7 +79,7 @@ class Tp bool is_able_to_walk_through_walls {}; // end sort marker1 } - uint8_t flag[ THING_FLAG_MAX ]; + uint8_t flag[ THING_FLAG_MAX ] = {}; // begin sort marker2 { int chance_d1000_appearing {};