Player
Player copied to clipboard
Quickload random tile layer corruption
Player platform:
Windows 10 x64
Attach files (as a .zip archive or link them):

Describe the issue in detail and how to reproduce it:
Go to the tree several times after quickload until the screen being full of the upper tile of bed (number 121). There's a workaround in the event 0003, for changing the bed tile for other tile to compare. This improve slightly if we change the tile for the invisible one (001).
Thank you, guys.
I think I know where the problem is but the issue is much bigger than this: When doing the on-map load alot of initialisation code is skipped so there will be also other problems that are less visible.
Will see if I can get the map reload working better like a title->map load.
This works for me:
diff --git a/src/game_map.cpp b/src/game_map.cpp
index f13a76571..420b20264 100644
--- a/src/game_map.cpp
+++ b/src/game_map.cpp
@@ -408,7 +408,7 @@ void Game_Map::PlayBgm() {
}
}
-const std::vector<uint8_t>& Game_Map::GetTilesLayer(int layer) {
+std::vector<uint8_t> Game_Map::GetTilesLayer(int layer) {
return layer >= 1 ? map_info.upper_tiles : map_info.lower_tiles;
}
diff --git a/src/game_map.h b/src/game_map.h
index 1f59b0933..7dfc681dd 100644
--- a/src/game_map.h
+++ b/src/game_map.h
@@ -106,7 +106,7 @@ namespace Game_Map {
/**
* Setups a map from a savegame.
- *
+ *
* @param map - The map data
* @param save_map - The map state
* @param save_boat - The boat state
@@ -227,7 +227,7 @@ namespace Game_Map {
*
* @param layer which layer to return
*/
- const std::vector<uint8_t>& GetTilesLayer(int layer);
+ std::vector<uint8_t> GetTilesLayer(int layer);
/**
* Gets the bush depth at a certain tile.
diff --git a/src/player.cpp b/src/player.cpp
index 64836f7bc..952f36005 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -1170,6 +1170,8 @@ void Player::LoadSavegame(const std::string& save_name, int save_id) {
map->Start();
if (!load_on_map) {
Scene::Push(std::make_shared<Scene_Map>(save_id));
+ } else {
+ Scene::instance->Start();
}
}
diff --git a/src/tilemap_layer.cpp b/src/tilemap_layer.cpp
index c9fa4cef5..153791812 100644
--- a/src/tilemap_layer.cpp
+++ b/src/tilemap_layer.cpp
@@ -665,6 +665,8 @@ void TilemapLayer::SetPassable(std::vector<unsigned char> npassable) {
}
void TilemapLayer::OnSubstitute() {
+ substitutions = Game_Map::GetTilesLayer(layer);
+
// Recalculate z values of all tiles
CreateTileCache(map_data);
}
diff --git a/src/tilemap_layer.h b/src/tilemap_layer.h
index c19657a49..b7b743952 100644
--- a/src/tilemap_layer.h
+++ b/src/tilemap_layer.h
@@ -99,7 +99,7 @@ private:
std::unordered_set<uint32_t> chipset_tone_tiles;
std::vector<short> map_data;
std::vector<uint8_t> passable;
- Span<const uint8_t> substitutions;
+ std::vector<uint8_t> substitutions;
int ox = 0;
int oy = 0;
int width = 0;