Minimap chunk revealing and updating is now stored in user save files. Fix minimap map alignment to match the tile size of the map (The camp has a different base tile size). Release Build 8825.
This commit is contained in:
parent
581128002b
commit
a37a7d41ce
@ -3778,12 +3778,13 @@ void AiL::ResetGame(bool changeToMainMenu){
|
|||||||
game->ClearLoadoutItem(i);
|
game->ClearLoadoutItem(i);
|
||||||
}
|
}
|
||||||
Unlock::Initialize();
|
Unlock::Initialize();
|
||||||
State_OverworldMap::SetStageMarker("Story I");
|
State_OverworldMap::SetStageMarker("Player.Starting Location"_S);
|
||||||
State_OverworldMap::UpdateCurrentConnectionPoint(*State_OverworldMap::currentConnectionPoint);
|
State_OverworldMap::UpdateCurrentConnectionPoint(*State_OverworldMap::currentConnectionPoint);
|
||||||
State_OverworldMap::ResetConnectionPoints();
|
State_OverworldMap::ResetConnectionPoints();
|
||||||
SetChapter(1);
|
SetChapter(1);
|
||||||
SaveFile::SetSaveFileName("");
|
SaveFile::SetSaveFileName("");
|
||||||
Tutorial::Initialize();
|
Tutorial::Initialize();
|
||||||
|
minimap.EraseChunkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AiL::OnRequestCompleted(const std::string_view receivedData)const{
|
void AiL::OnRequestCompleted(const std::string_view receivedData)const{
|
||||||
|
@ -55,8 +55,6 @@ void Minimap::Initialize(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Minimap::Reset(){
|
void Minimap::Reset(){
|
||||||
loadedChunks.clear();
|
|
||||||
|
|
||||||
if(minimap.Sprite()==nullptr)minimap.Create(1,1);
|
if(minimap.Sprite()==nullptr)minimap.Create(1,1);
|
||||||
if(cover.Sprite()==nullptr)cover.Create(1,1);
|
if(cover.Sprite()==nullptr)cover.Create(1,1);
|
||||||
|
|
||||||
@ -128,15 +126,23 @@ void Minimap::Reset(){
|
|||||||
game->SetDrawTarget(nullptr);
|
game->SetDrawTarget(nullptr);
|
||||||
|
|
||||||
minimap.Decal()->Update();
|
minimap.Decal()->Update();
|
||||||
|
|
||||||
|
#pragma region Load all minimap chunks already explored
|
||||||
|
for(auto&chunk:loadedChunks[game->GetCurrentMapName()]){
|
||||||
|
vi2d chunkPos={stoi(chunk.substr(0,chunk.find('_'))),stoi(chunk.substr(chunk.find('_')+1))};
|
||||||
|
UpdateChunk(game->GetCurrentMapName(),chunkPos);
|
||||||
|
}
|
||||||
|
#pragma endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minimap::Update(){
|
void Minimap::Update(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Minimap::UpdateChunk(const vi2d chunkPos){
|
void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){
|
||||||
if(!loadedChunks.count(std::format("{}_{}",chunkPos.x,chunkPos.y))){
|
loadedChunks[map].insert(std::format("{}_{}",chunkPos.x,chunkPos.y));
|
||||||
loadedChunks.insert(std::format("{}_{}",chunkPos.x,chunkPos.y));
|
|
||||||
|
if(game->GetCurrentMapName()!=map)return; //Don't update the minimap when the map name doesn't match the current map.
|
||||||
|
|
||||||
vi2d centerChunkPos=chunkPos*"Minimap.Chunk Size"_I;
|
vi2d centerChunkPos=chunkPos*"Minimap.Chunk Size"_I;
|
||||||
|
|
||||||
@ -168,8 +174,15 @@ void Minimap::UpdateChunk(const vi2d chunkPos){
|
|||||||
|
|
||||||
cover.Decal()->Update();
|
cover.Decal()->Update();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Minimap::Draw(){
|
void Minimap::Draw(){
|
||||||
if(!game->InBossEncounter())mapCircleHud.DrawRotatedDecal(vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/2,cover.Decal(),0.f,game->GetPlayer()->GetPos()/24,vf2d{0.5f,0.5f});
|
if(!game->InBossEncounter())mapCircleHud.DrawRotatedDecal(vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/2,cover.Decal(),0.f,game->GetPlayer()->GetPos()/game->GetCurrentMapData().tilewidth,vf2d{0.5f,0.5f});
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minimap::EraseChunkData(){
|
||||||
|
loadedChunks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::unordered_map<MapName,std::unordered_set<std::string>>&Minimap::GetChunkData(){
|
||||||
|
return loadedChunks;
|
||||||
}
|
}
|
@ -46,10 +46,13 @@ public:
|
|||||||
void Update();
|
void Update();
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
void UpdateChunk(const vi2d chunkPos);
|
void UpdateChunk(const MapName map,const vi2d chunkPos);
|
||||||
|
void EraseChunkData();
|
||||||
|
|
||||||
|
const std::unordered_map<MapName,std::unordered_set<std::string>>&GetChunkData();
|
||||||
private:
|
private:
|
||||||
ViewPort mapCircleHud;
|
ViewPort mapCircleHud;
|
||||||
Renderable minimap;
|
Renderable minimap;
|
||||||
Renderable cover;
|
Renderable cover;
|
||||||
std::unordered_set<std::string>loadedChunks;
|
std::unordered_map<MapName,std::unordered_set<std::string>>loadedChunks;
|
||||||
};
|
};
|
@ -866,7 +866,7 @@ void Player::Moved(){
|
|||||||
ForceSetPos({pos.x,float(game->GetCurrentMapData().playerSpawnLocation.y)});
|
ForceSetPos({pos.x,float(game->GetCurrentMapData().playerSpawnLocation.y)});
|
||||||
}
|
}
|
||||||
|
|
||||||
game->minimap.UpdateChunk(GetPos()/24/"Minimap.Chunk Size"_I);
|
game->minimap.UpdateChunk(game->GetCurrentMapName(),GetPos()/24/"Minimap.Chunk Size"_I);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Spin(float duration,float spinSpd){
|
void Player::Spin(float duration,float spinSpd){
|
||||||
|
@ -86,8 +86,9 @@ const void SaveFile::SaveGame(){
|
|||||||
game->SetQuitAllowed(false);
|
game->SetQuitAllowed(false);
|
||||||
|
|
||||||
std::filesystem::create_directories("save_file_path"_S);
|
std::filesystem::create_directories("save_file_path"_S);
|
||||||
utils::datafile saveFile;
|
|
||||||
utils::datafile saveSystemFile;
|
utils::datafile saveSystemFile;
|
||||||
|
{
|
||||||
|
utils::datafile saveFile;
|
||||||
utils::datafile::INITIAL_SETUP_COMPLETE=false;
|
utils::datafile::INITIAL_SETUP_COMPLETE=false;
|
||||||
for(size_t itemCount=0;auto&item:Inventory::GetInventory()){
|
for(size_t itemCount=0;auto&item:Inventory::GetInventory()){
|
||||||
saveFile["Items"][std::format("Item[{}]",itemCount)]["Amt"].SetInt(item->Amt());
|
saveFile["Items"][std::format("Item[{}]",itemCount)]["Amt"].SetInt(item->Amt());
|
||||||
@ -182,12 +183,26 @@ const void SaveFile::SaveGame(){
|
|||||||
|
|
||||||
saveFile["Hash"].SetString("");
|
saveFile["Hash"].SetString("");
|
||||||
|
|
||||||
|
|
||||||
|
for(auto&[mapName,chunks]:game->minimap.GetChunkData()){
|
||||||
|
size_t chunkInd=0;
|
||||||
|
for(auto&chunk:chunks){
|
||||||
|
saveFile["Minimap"][mapName].SetString(chunk,chunkInd);
|
||||||
|
chunkInd++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma region Save save file and prep File Hash
|
||||||
utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID));
|
utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID));
|
||||||
|
|
||||||
std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID));
|
std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID));
|
||||||
saveFile["Hash"].SetString(fileHash);
|
saveFile["Hash"].SetString(fileHash);
|
||||||
|
|
||||||
utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); //Once the hash has been computed and added, save the file a second time.
|
utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); //Once the hash has been computed and added, save the file a second time.
|
||||||
|
#pragma endregion
|
||||||
|
//WARNING! DO NOT WRITE ANY CODE BELOW HERE!!!!! THE HASH HAS ALREADY BEEN WRITTEN.
|
||||||
|
//FILES BECOME CORRUPTED IF THE SAVE FILE IS MODIFIED FROM HERE ONWARDS.
|
||||||
|
}
|
||||||
utils::datafile::Write(saveSystemFile,"save_file_path"_S+"system.conf");
|
utils::datafile::Write(saveSystemFile,"save_file_path"_S+"system.conf");
|
||||||
utils::datafile metadata;
|
utils::datafile metadata;
|
||||||
if(onlineMode){
|
if(onlineMode){
|
||||||
@ -379,6 +394,15 @@ void SaveFile::LoadFile(){
|
|||||||
game->GetPlayer()->RecalculateEquipStats();
|
game->GetPlayer()->RecalculateEquipStats();
|
||||||
if(loadFile.HasProperty("TravelingMerchant"))Merchant::SetTravelingMerchant(loadFile["TravelingMerchant"].GetString());
|
if(loadFile.HasProperty("TravelingMerchant"))Merchant::SetTravelingMerchant(loadFile["TravelingMerchant"].GetString());
|
||||||
|
|
||||||
|
if(loadFile.HasProperty("Minimap")){
|
||||||
|
for(auto&[key,size]:loadFile["Minimap"].GetKeys()){
|
||||||
|
for(const std::string&chunk:loadFile["Minimap"][key].GetValues()){
|
||||||
|
vi2d chunkPos={stoi(chunk.substr(0,chunk.find('_'))),stoi(chunk.substr(chunk.find('_')+1))};
|
||||||
|
game->minimap.UpdateChunk(key,chunkPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma region Load Keyboard/Controller mappings
|
#pragma region Load Keyboard/Controller mappings
|
||||||
//NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well!
|
//NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well!
|
||||||
const int ingameControlsRowCount=DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()%2==0?DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2:DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2+1;
|
const int ingameControlsRowCount=DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()%2==0?DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2:DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2+1;
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 1
|
#define VERSION_MINOR 1
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 8819
|
#define VERSION_BUILD 8825
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -3,6 +3,9 @@ Player
|
|||||||
BaseMana = 100
|
BaseMana = 100
|
||||||
MoveSpd = 100
|
MoveSpd = 100
|
||||||
|
|
||||||
|
# Game Map Starting Location
|
||||||
|
Starting Location = Story I
|
||||||
|
|
||||||
# Starting base crit rate.
|
# Starting base crit rate.
|
||||||
Crit Rate = 0%
|
Crit Rate = 0%
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user