mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
* a bit of campaign prologue/epilogue screen
This commit is contained in:
@@ -3589,6 +3589,7 @@ void CBonusSelection::startMap()
|
|||||||
|
|
||||||
if (scenario.prolog.hasPrologEpilog)
|
if (scenario.prolog.hasPrologEpilog)
|
||||||
{
|
{
|
||||||
|
//GH.pushInt(new CPrologEpilogVideo(scenario.prolog));
|
||||||
tlog1 << "Video: " << scenario.prolog.prologVideo <<"\n";
|
tlog1 << "Video: " << scenario.prolog.prologVideo <<"\n";
|
||||||
tlog1 << "Audio: " << scenario.prolog.prologMusic <<"\n";
|
tlog1 << "Audio: " << scenario.prolog.prologMusic <<"\n";
|
||||||
tlog1 << "Text: " << scenario.prolog.prologText <<"\n";
|
tlog1 << "Text: " << scenario.prolog.prologText <<"\n";
|
||||||
@@ -4081,3 +4082,28 @@ void CLoadingScreen::showAll(SDL_Surface *to)
|
|||||||
|
|
||||||
CWindowObject::showAll(to);
|
CWindowObject::showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPrologEpilogVideo::CPrologEpilogVideo( CCampaignScenario::SScenarioPrologEpilog _spe )
|
||||||
|
: spe(_spe), curTxtH(300)
|
||||||
|
{
|
||||||
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
|
|
||||||
|
CCS->videoh->open(CCampaignHandler::prologVideoName(spe.prologVideo));
|
||||||
|
|
||||||
|
auto lines = CMessage::breakText(spe.prologText, 50, EFonts::FONT_BIG);
|
||||||
|
|
||||||
|
txt = CSDL_Ext::newSurface(500, 60 * lines.size());
|
||||||
|
graphics->fonts[FONT_BIG]->renderTextLinesCenter(txt, lines, Colors::METALLIC_GOLD, Point(0,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPrologEpilogVideo::show( SDL_Surface * to )
|
||||||
|
{
|
||||||
|
blitAt(txt, 50, 200-curTxtH, to);
|
||||||
|
CCS->videoh->show(0, 0, to);
|
||||||
|
curTxtH = std::max(curTxtH - 10, to->h - txt->h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPrologEpilogVideo::clickLeft( tribool down, bool previousState )
|
||||||
|
{
|
||||||
|
GH.popInt(this);
|
||||||
|
}
|
||||||
|
@@ -539,6 +539,19 @@ public:
|
|||||||
CHotSeatPlayers(const std::string &firstPlayer);
|
CHotSeatPlayers(const std::string &firstPlayer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CPrologEpilogVideo : public CIntObject
|
||||||
|
{
|
||||||
|
CCampaignScenario::SScenarioPrologEpilog spe;
|
||||||
|
SDL_Surface * txt;
|
||||||
|
int curTxtH;
|
||||||
|
public:
|
||||||
|
CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog _spe);
|
||||||
|
|
||||||
|
void clickLeft(tribool down, bool previousState);
|
||||||
|
void show(SDL_Surface * to);
|
||||||
|
};
|
||||||
|
|
||||||
/// Campaign screen where you can choose one out of three starting bonuses
|
/// Campaign screen where you can choose one out of three starting bonuses
|
||||||
class CBonusSelection : public CIntObject
|
class CBonusSelection : public CIntObject
|
||||||
{
|
{
|
||||||
|
@@ -467,3 +467,24 @@ CCampaignState::CCampaignState( unique_ptr<CCampaign> _camp ) : camp(std::move(_
|
|||||||
mapsRemaining.push_back(i);
|
mapsRemaining.push_back(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string indexToString(std::string fname, ui8 index)
|
||||||
|
{
|
||||||
|
CLegacyConfigParser parser(fname);
|
||||||
|
for(int i=0; i<index-1; ++i)
|
||||||
|
parser.endLine();
|
||||||
|
return parser.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CCampaignHandler::prologVideoName(ui8 index)
|
||||||
|
{
|
||||||
|
return indexToString("DATA/CMPMOVIE", index);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CCampaignHandler::prologMusicName(ui8 index)
|
||||||
|
{
|
||||||
|
return indexToString("DATA/CMPMUSIC", index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -89,13 +89,13 @@ public:
|
|||||||
std::set<ui8> preconditionRegions; //what we need to conquer to conquer this one (stored as bitfield in h3c)
|
std::set<ui8> preconditionRegions; //what we need to conquer to conquer this one (stored as bitfield in h3c)
|
||||||
ui8 regionColor;
|
ui8 regionColor;
|
||||||
ui8 difficulty;
|
ui8 difficulty;
|
||||||
ui8 conquered;
|
bool conquered;
|
||||||
|
|
||||||
std::string regionText;
|
std::string regionText;
|
||||||
|
|
||||||
struct DLL_LINKAGE SScenarioPrologEpilog
|
struct DLL_LINKAGE SScenarioPrologEpilog
|
||||||
{
|
{
|
||||||
ui8 hasPrologEpilog;
|
bool hasPrologEpilog;
|
||||||
ui8 prologVideo; // from CmpMovie.txt
|
ui8 prologVideo; // from CmpMovie.txt
|
||||||
ui8 prologMusic; // from CmpMusic.txt
|
ui8 prologMusic; // from CmpMusic.txt
|
||||||
std::string prologText;
|
std::string prologText;
|
||||||
@@ -179,6 +179,8 @@ 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(const std::string & name, bool headerOnly);
|
static std::vector< std::vector<ui8> > getFile(const std::string & name, bool headerOnly);
|
||||||
public:
|
public:
|
||||||
|
static std::string prologVideoName(ui8 index);
|
||||||
|
static std::string prologMusicName(ui8 index);
|
||||||
|
|
||||||
static CCampaignHeader getHeader( const std::string & name); //name - name of appropriate file
|
static CCampaignHeader getHeader( const std::string & name); //name - name of appropriate file
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user