mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
allow custom loadbar-backgrounds for campaigns
This commit is contained in:
parent
0b8f92250d
commit
16cbd6a7d2
@ -532,7 +532,10 @@ void CServerHandler::sendGuiAction(ui8 action) const
|
||||
|
||||
void CServerHandler::sendRestartGame() const
|
||||
{
|
||||
GH.windows().createAndPushWindow<CLoadingScreen>();
|
||||
if(si->campState && !si->campState->getLoadingBackground().empty())
|
||||
GH.windows().createAndPushWindow<CLoadingScreen>(si->campState->getLoadingBackground());
|
||||
else
|
||||
GH.windows().createAndPushWindow<CLoadingScreen>();
|
||||
|
||||
LobbyRestartGame endGame;
|
||||
sendLobbyPack(endGame);
|
||||
@ -576,7 +579,12 @@ void CServerHandler::sendStartGame(bool allowOnlyAI) const
|
||||
verifyStateBeforeStart(allowOnlyAI ? true : settings["session"]["onlyai"].Bool());
|
||||
|
||||
if(!settings["session"]["headless"].Bool())
|
||||
GH.windows().createAndPushWindow<CLoadingScreen>();
|
||||
{
|
||||
if(si->campState && !si->campState->getLoadingBackground().empty())
|
||||
GH.windows().createAndPushWindow<CLoadingScreen>(si->campState->getLoadingBackground());
|
||||
else
|
||||
GH.windows().createAndPushWindow<CLoadingScreen>();
|
||||
}
|
||||
|
||||
LobbyPrepareStartGame lpsg;
|
||||
sendLobbyPack(lpsg);
|
||||
|
@ -629,7 +629,12 @@ void CSimpleJoinScreen::startConnection(const std::string & addr, ui16 port)
|
||||
}
|
||||
|
||||
CLoadingScreen::CLoadingScreen()
|
||||
: CWindowObject(BORDERED, getBackground())
|
||||
: CLoadingScreen(getBackground())
|
||||
{
|
||||
}
|
||||
|
||||
CLoadingScreen::CLoadingScreen(ImagePath background)
|
||||
: CWindowObject(BORDERED, background)
|
||||
{
|
||||
OBJECT_CONSTRUCTION;
|
||||
|
||||
|
@ -192,6 +192,7 @@ class CLoadingScreen : virtual public CWindowObject, virtual public Load::Progre
|
||||
|
||||
public:
|
||||
CLoadingScreen();
|
||||
CLoadingScreen(ImagePath background);
|
||||
~CLoadingScreen();
|
||||
|
||||
void tick(uint32_t msPassed) override;
|
||||
|
@ -27,6 +27,7 @@
|
||||
{ "voiceProlog": "Hc1_G2C" },
|
||||
{ "voiceProlog": "Hc1_ABvoFL3" },
|
||||
{ "voiceProlog": "Hc1_H3x2BBf", "voiceEpilog": "Hc1_N1C_D" }
|
||||
]
|
||||
],
|
||||
"loadingBackground": "Hc1_LoadBar"
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ In header are parameters describing campaign properties
|
||||
- `"campaignVersion"` is creator defined version
|
||||
- `"creationDateTime"` unix time of campaign creation
|
||||
- `"allowDifficultySelection"` is a boolean field (`true`/`false`) which allows or disallows to choose difficulty before scenario start
|
||||
- `"loadingBackground"` is for setting a different loading screen background
|
||||
|
||||
## Scenario description
|
||||
|
||||
|
@ -168,6 +168,7 @@ void CampaignHandler::readHeaderFromJson(CampaignHeader & ret, JsonNode & reader
|
||||
ret.filename = filename;
|
||||
ret.modName = modName;
|
||||
ret.encoding = encoding;
|
||||
ret.loadingBackground = ImagePath::fromJson(reader["loadingBackground"]);
|
||||
}
|
||||
|
||||
CampaignScenario CampaignHandler::readScenarioFromJson(JsonNode & reader)
|
||||
|
@ -205,6 +205,11 @@ AudioPath CampaignHeader::getMusic() const
|
||||
return music;
|
||||
}
|
||||
|
||||
ImagePath CampaignHeader::getLoadingBackground() const
|
||||
{
|
||||
return loadingBackground;
|
||||
}
|
||||
|
||||
const CampaignRegions & CampaignHeader::getRegions() const
|
||||
{
|
||||
return campaignRegions;
|
||||
@ -472,6 +477,8 @@ void Campaign::overrideCampaign(bool scenario)
|
||||
{
|
||||
if(!entry.second["regions"].isNull() && !entry.second["scenarioCount"].isNull())
|
||||
loadLegacyData(CampaignRegions::fromJson(entry.second["regions"]), entry.second["scenarioCount"].Integer());
|
||||
if(!entry.second["loadingBackground"].isNull())
|
||||
loadingBackground = ImagePath::builtin(entry.second["loadingBackground"].String());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -97,6 +97,7 @@ class DLL_LINKAGE CampaignHeader : public boost::noncopyable
|
||||
std::string filename;
|
||||
std::string modName;
|
||||
std::string encoding;
|
||||
ImagePath loadingBackground;
|
||||
|
||||
int numberOfScenarios = 0;
|
||||
bool difficultyChosenByPlayer = false;
|
||||
@ -120,6 +121,7 @@ public:
|
||||
std::string getModName() const;
|
||||
std::string getEncoding() const;
|
||||
AudioPath getMusic() const;
|
||||
ImagePath getLoadingBackground() const;
|
||||
|
||||
const CampaignRegions & getRegions() const;
|
||||
TextContainerRegistrable & getTexts();
|
||||
@ -145,6 +147,10 @@ public:
|
||||
h & encoding;
|
||||
if (h.version >= Handler::Version::RELEASE_143)
|
||||
h & textContainer;
|
||||
if (h.version >= Handler::Version::CHRONICLES_SUPPORT)
|
||||
{
|
||||
h & loadingBackground;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -67,6 +67,7 @@ enum class ESerializationVersion : int32_t
|
||||
STATISTICS_SCREEN, // 856 - extent statistic functions
|
||||
NEW_MARKETS, // 857 - reworked market classes
|
||||
PLAYER_STATE_OWNED_OBJECTS, // 858 - player state stores all owned objects in a single list
|
||||
CHRONICLES_SUPPORT, // 859 - support for heroes chronicles
|
||||
|
||||
CURRENT = PLAYER_STATE_OWNED_OBJECTS
|
||||
CURRENT = CHRONICLES_SUPPORT
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user