1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Campaign meta strings

This commit is contained in:
nordsoft 2023-09-28 00:10:28 +02:00
parent 5b97c323d3
commit 6da605ff83
5 changed files with 11 additions and 10 deletions

View File

@ -509,9 +509,9 @@ void CBonusSelection::CRegion::clickReleased(const Point & cursorPosition)
void CBonusSelection::CRegion::showPopupWindow(const Point & cursorPosition)
{
// FIXME: For some reason "down" is only ever contain indeterminate_value
auto text = CSH->si->campState->scenario(idOfMapAndRegion).regionText;
if(!graphicsNotSelected->getSurface()->isTransparent(cursorPosition - pos.topLeft()) && text.size())
auto & text = CSH->si->campState->scenario(idOfMapAndRegion).regionText;
if(!graphicsNotSelected->getSurface()->isTransparent(cursorPosition - pos.topLeft()) && !text.empty())
{
CRClickPopup::createAndPush(text);
CRClickPopup::createAndPush(text.toString());
}
}

View File

@ -36,7 +36,7 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
};
CCS->soundh->setCallback(voiceSoundHandle, onVoiceStop);
text = std::make_shared<CMultiLineLabel>(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText);
text = std::make_shared<CMultiLineLabel>(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText.toString());
text->scrollTextTo(-100);
}

View File

@ -169,7 +169,7 @@ CampaignScenario CampaignHandler::readScenarioFromJson(JsonNode & reader)
ret.prologVideo = VideoPath::fromJson(identifier["video"]);
ret.prologMusic = AudioPath::fromJson(identifier["music"]);
ret.prologVoice = AudioPath::fromJson(identifier["voice"]);
ret.prologText = identifier["text"].String();
ret.prologText.jsonDeserialize(identifier["text"]);
}
return ret;
};
@ -181,7 +181,7 @@ CampaignScenario CampaignHandler::readScenarioFromJson(JsonNode & reader)
ret.regionColor = reader["color"].Integer();
ret.difficulty = reader["difficulty"].Integer();
ret.regionText = reader["regionText"].String();
ret.regionText.jsonDeserialize(reader["regionText"]);
ret.prolog = prologEpilogReader(reader["prolog"]);
ret.epilog = prologEpilogReader(reader["epilog"]);
@ -410,7 +410,7 @@ CampaignScenario CampaignHandler::readScenarioFromMemory( CBinaryReader & reader
ret.prologVideo = CampaignHandler::prologVideoName(index);
ret.prologMusic = CampaignHandler::prologMusicName(reader.readUInt8());
ret.prologVoice = isOriginalCampaign ? CampaignHandler::prologVoiceName(index) : AudioPath();
ret.prologText = readLocalizedString(reader, header.filename, header.modName, header.encoding, identifier);
ret.prologText.appendTextID(readLocalizedString(reader, header.filename, header.modName, header.encoding, identifier));
}
return ret;
};
@ -428,7 +428,7 @@ CampaignScenario CampaignHandler::readScenarioFromMemory( CBinaryReader & reader
}
ret.regionColor = reader.readUInt8();
ret.difficulty = reader.readUInt8();
ret.regionText = readLocalizedString(reader, header.filename, header.modName, header.encoding, ret.mapName + ".region");
ret.regionText.appendTextID(readLocalizedString(reader, header.filename, header.modName, header.encoding, ret.mapName + ".region"));
ret.prolog = prologEpilogReader(ret.mapName + ".prolog");
ret.epilog = prologEpilogReader(ret.mapName + ".epilog");

View File

@ -10,6 +10,7 @@
#pragma once
#include "../filesystem/ResourcePath.h"
#include "../MetaString.h"
VCMI_LIB_NAMESPACE_BEGIN
@ -19,7 +20,7 @@ struct DLL_LINKAGE CampaignScenarioPrologEpilog
VideoPath prologVideo;
AudioPath prologMusic; // from CmpMusic.txt
AudioPath prologVoice;
std::string prologText;
MetaString prologText;
template <typename Handler> void serialize(Handler &h, const int formatVersion)
{

View File

@ -182,7 +182,7 @@ struct DLL_LINKAGE CampaignScenario
ui8 regionColor = 0;
ui8 difficulty = 0;
std::string regionText;
MetaString regionText;
CampaignScenarioPrologEpilog prolog;
CampaignScenarioPrologEpilog epilog;