Add in some achievement icons and file hashing saving/loading of save files. Release Build 8515.
This commit is contained in:
		
							parent
							
								
									d1f95e03c9
								
							
						
					
					
						commit
						3256a686a3
					
				| @ -178,7 +178,14 @@ const void SaveFile::SaveGame(){ | ||||
| 		saveSystemFile["Fullscreen"].SetBool(game->IsFullscreen()); | ||||
| 	#pragma endregion | ||||
| 
 | ||||
| 	saveFile["Hash"].SetString(""); | ||||
| 
 | ||||
| 	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)); | ||||
| 	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(saveSystemFile,"save_file_path"_S+"system.conf"); | ||||
| 	utils::datafile metadata; | ||||
| 	if(onlineMode){ | ||||
| @ -279,6 +286,24 @@ void SaveFile::LoadFile(){ | ||||
| 
 | ||||
| 	if(std::filesystem::exists(loadFilename)){ | ||||
| 		utils::datafile::Read(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); | ||||
| 		if(!loadFile.HasProperty("Hash")){ | ||||
| 			LOG(std::format("WARNING! Filehash for file {} does not exist!","save_file_path"_S+std::format("save.{:04}",saveFileID))); | ||||
| 			return; | ||||
| 		} | ||||
| 		if(loadFile.HasProperty("Hash")){ | ||||
| 			std::string expectedFileHash=loadFile["Hash"].GetString(); | ||||
| 			loadFile["Hash"].SetString(""); | ||||
| 			utils::datafile::Write(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); | ||||
| 			std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID)); | ||||
| 
 | ||||
| 			if(expectedFileHash!=fileHash){ | ||||
| 				LOG(std::format("WARNING! Filehash for file {} was not identified as proper! Will not load this file!","save_file_path"_S+std::format("save.{:04}",saveFileID))); | ||||
| 				return; | ||||
| 			} | ||||
| 
 | ||||
| 			loadFile["Hash"].SetString(expectedFileHash); //Now write the hash back into the file since we tampered with it.
 | ||||
| 			utils::datafile::Write(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); | ||||
| 		} | ||||
| 		game->ResetGame(); | ||||
| 		for(auto&[key,data]:loadFile["Items"].GetOrderedKeys()){ | ||||
| 			std::weak_ptr<Item>newItem=Inventory::AddItem(data["Item Name"].GetString(),data["Amt"].GetInt()); | ||||
|  | ||||
| @ -10,6 +10,28 @@ Upon the second time entering a stage, the game will spawn a timer that the play | ||||
| Upon completion of a stage in time trial mode if the player beat their previous time (which they likely will) the record will update. | ||||
| 	For each class and stage combination there will be a "dev time" | ||||
| 
 | ||||
| Achievements | ||||
| A Good Night's Rest - Unlock the Camp | ||||
| Handyman - Unlock Greg the Blacksmith | ||||
| A Strange Gemstone - Complete Chapter 1 | ||||
| Slime Hunter(100), Killer(250), Slayer(1000) | ||||
| Slime King | ||||
| Slime King Destroyer (<1 Minute Kill) | ||||
| Ursule, Mother of Bears | ||||
| Ursule, Mother of Bears Destroyer (<1 Minute Kill) | ||||
| Tough as Steel - Obtain Level 5 on Warrior | ||||
| Skilled Marksman - Obtain Level 5 on Ranger | ||||
| Controller of Elements - Obtain Level 5 on Wizard | ||||
| Maxed out a Weapon in Chapter 1 | ||||
| Maxed out an Armor piece in Chapter 1 | ||||
| Wear a full set of maxed out gear | ||||
| Beat the Devs - Obtained a Time Medal | ||||
| Speedrunner - Obtained 11 Time Medals | ||||
| 
 | ||||
| SetAchievement | ||||
| 
 | ||||
| File Hash on Save/Load. | ||||
| 
 | ||||
| ============================================ | ||||
| 
 | ||||
| Make another actions config file for the main build (The app # is different) | ||||
| @ -39,7 +39,7 @@ All rights reserved. | ||||
| #define VERSION_MAJOR 1 | ||||
| #define VERSION_MINOR 0 | ||||
| #define VERSION_PATCH 0 | ||||
| #define VERSION_BUILD 8507 | ||||
| #define VERSION_BUILD 8515 | ||||
| 
 | ||||
| #define stringify(a) stringify_(a) | ||||
| #define stringify_(a) #a | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/BronzeBorder.xcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/BronzeBorder.xcf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/GoldBorder.xcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/GoldBorder.xcf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/SilverBorder.xcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/SilverBorder.xcf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/kill_slime_1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/kill_slime_1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.5 KiB | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 155 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/kill_slime_2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/kill_slime_2.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.6 KiB | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 168 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/kill_slime_3.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Adventures in Lestoria/assets/Achievements/kill_slime_3.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 2.2 KiB | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 127 KiB | 
| @ -148,6 +148,31 @@ std::u32string util::WrapText(PixelGameEngine*pge,std::u32string str,int width,F | ||||
| 	return newStr; | ||||
| } | ||||
| 
 | ||||
| std::string util::GetHash(std::string fileName){ | ||||
| 	std::ifstream file(fileName); | ||||
| 	std::string hash=""; | ||||
| 	uint8_t hashIndex=0; | ||||
| 	while(file.good()){ | ||||
| 		uint8_t hashChar=0; | ||||
| 		if(hash.size()==std::numeric_limits<uint8_t>::max()){ | ||||
| 			hashChar=hash[hashIndex]; | ||||
| 		} | ||||
| 		hashChar+=file.get()*21-7; | ||||
| 		hashChar^=hashIndex; | ||||
| 		if(hashIndex>0)hashChar+=hash[hashIndex-1]; | ||||
| 		hashChar%=94; | ||||
| 		hashChar+=32; | ||||
| 		if(hashChar=='"'){hashChar+=60;} | ||||
| 		if(hash.size()<std::numeric_limits<uint8_t>::max()){ | ||||
| 			hash+=hashChar; | ||||
| 		}else{ | ||||
| 			hash[hashIndex]=hashChar; | ||||
| 		} | ||||
| 		hashIndex++; | ||||
| 	} | ||||
| 	return hash; | ||||
| } | ||||
| 
 | ||||
| long double operator""_Pixels(long double unitDist){ | ||||
| 	return unitDist/100*24.; | ||||
| } | ||||
|  | ||||
| @ -58,6 +58,7 @@ namespace olc::util{ | ||||
| 	std::string WrapText(PixelGameEngine*pge,std::string str,int width,bool proportional,vd2d scale); | ||||
| 	std::u32string WrapText(PixelGameEngine*pge,std::u32string str,int width,Font&font,vd2d scale); | ||||
| 	float angle_difference(float angle_1, float angle_2); | ||||
| 	std::string GetHash(std::string file); | ||||
| } | ||||
| 
 | ||||
| template<class TL, class TR> | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user