2
0
Эх сурвалжийг харах

Refactor more fields from campaign header

nordsoft 2 жил өмнө
parent
commit
91b4782a2f

+ 2 - 2
client/mainmenu/CPrologEpilogVideo.cpp

@@ -29,8 +29,8 @@ CPrologEpilogVideo::CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog
 	pos = center(Rect(0, 0, 800, 600));
 	pos = center(Rect(0, 0, 800, 600));
 	updateShadow();
 	updateShadow();
 
 
-	CCS->videoh->open(CCampaignHandler::prologVideoName(spe.prologVideo));
-	CCS->musich->playMusic("Music/" + CCampaignHandler::prologMusicName(spe.prologMusic), true, true);
+	CCS->videoh->open(spe.prologVideo);
+	CCS->musich->playMusic("Music/" + spe.prologMusic, true, true);
 	// MPTODO: Custom campaign crashing on this?
 	// MPTODO: Custom campaign crashing on this?
 //	voiceSoundHandle = CCS->soundh->playSound(CCampaignHandler::prologVoiceName(spe.prologVideo));
 //	voiceSoundHandle = CCS->soundh->playSound(CCampaignHandler::prologVoiceName(spe.prologVideo));
 
 

+ 5 - 5
lib/mapping/CCampaignHandler.cpp

@@ -254,8 +254,8 @@ CCampaignScenario CCampaignHandler::readScenarioFromJson(JsonNode & reader)
 		ret.hasPrologEpilog = !identifier.isNull();
 		ret.hasPrologEpilog = !identifier.isNull();
 		if(ret.hasPrologEpilog)
 		if(ret.hasPrologEpilog)
 		{
 		{
-			ret.prologVideo = identifier["video"].Integer();
-			ret.prologMusic = identifier["music"].Integer();
+			ret.prologVideo = identifier["video"].String();
+			ret.prologMusic = identifier["music"].String();
 			ret.prologText = identifier["text"].String();
 			ret.prologText = identifier["text"].String();
 		}
 		}
 		return ret;
 		return ret;
@@ -508,8 +508,8 @@ CCampaignScenario CCampaignHandler::readScenarioFromMemory( CBinaryReader & read
 		ret.hasPrologEpilog = reader.readUInt8();
 		ret.hasPrologEpilog = reader.readUInt8();
 		if(ret.hasPrologEpilog)
 		if(ret.hasPrologEpilog)
 		{
 		{
-			ret.prologVideo = reader.readUInt8();
-			ret.prologMusic = reader.readUInt8();
+			ret.prologVideo = CCampaignHandler::prologVideoName(reader.readUInt8());
+			ret.prologMusic = CCampaignHandler::prologMusicName(reader.readUInt8());
 			ret.prologText = readLocalizedString(reader, header.filename, header.modName, header.encoding, identifier);
 			ret.prologText = readLocalizedString(reader, header.filename, header.modName, header.encoding, identifier);
 		}
 		}
 		return ret;
 		return ret;
@@ -519,7 +519,7 @@ CCampaignScenario CCampaignHandler::readScenarioFromMemory( CBinaryReader & read
 	ret.conquered = false;
 	ret.conquered = false;
 	ret.mapName = reader.readBaseString();
 	ret.mapName = reader.readBaseString();
 	ret.packedMapSize = reader.readUInt32();
 	ret.packedMapSize = reader.readUInt32();
-	if(header.numberOfScenarios > 0) //unholy alliance
+	if(header.numberOfScenarios > 8) //unholy alliance
 	{
 	{
 		ret.loadPreconditionRegions(reader.readUInt16());
 		ret.loadPreconditionRegions(reader.readUInt16());
 	}
 	}

+ 3 - 3
lib/mapping/CCampaignHandler.h

@@ -161,8 +161,8 @@ public:
 	struct DLL_LINKAGE SScenarioPrologEpilog
 	struct DLL_LINKAGE SScenarioPrologEpilog
 	{
 	{
 		bool hasPrologEpilog = false;
 		bool hasPrologEpilog = false;
-		ui8 prologVideo = 0; // from CmpMovie.txt
-		ui8 prologMusic = 0; // from CmpMusic.txt
+		std::string prologVideo; // from CmpMovie.txt
+		std::string prologMusic; // from CmpMusic.txt
 		std::string prologText;
 		std::string prologText;
 
 
 		template <typename Handler> void serialize(Handler &h, const int formatVersion)
 		template <typename Handler> void serialize(Handler &h, const int formatVersion)
@@ -285,11 +285,11 @@ class DLL_LINKAGE CCampaignHandler
 	/// headerOnly - only header will be decompressed, returned vector wont have any maps
 	/// headerOnly - only header will be decompressed, returned vector wont have any maps
 	static std::vector<std::vector<ui8>> getFile(std::unique_ptr<CInputStream> file, bool headerOnly);
 	static std::vector<std::vector<ui8>> getFile(std::unique_ptr<CInputStream> file, bool headerOnly);
 
 
-public:
 	static std::string prologVideoName(ui8 index);
 	static std::string prologVideoName(ui8 index);
 	static std::string prologMusicName(ui8 index);
 	static std::string prologMusicName(ui8 index);
 	static std::string prologVoiceName(ui8 index);
 	static std::string prologVoiceName(ui8 index);
 
 
+public:
 	static CCampaignHeader getHeader( const std::string & name); //name - name of appropriate file
 	static CCampaignHeader getHeader( const std::string & name); //name - name of appropriate file
 
 
 	static std::unique_ptr<CCampaign> getCampaign(const std::string & name); //name - name of appropriate file
 	static std::unique_ptr<CCampaign> getCampaign(const std::string & name); //name - name of appropriate file