mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
a bit more of prologue/epilogue screen
This commit is contained in:
@@ -3587,16 +3587,23 @@ void CBonusSelection::startMap()
|
|||||||
|
|
||||||
tlog1 << "Starting scenario " << int(ourCampaign->currentMap) << "\n";
|
tlog1 << "Starting scenario " << int(ourCampaign->currentMap) << "\n";
|
||||||
|
|
||||||
|
auto exitCb = [si]()
|
||||||
|
{
|
||||||
|
CGP->showLoadingScreen(boost::bind(&startGame, si, (CConnection *)nullptr));
|
||||||
|
};
|
||||||
|
|
||||||
if (scenario.prolog.hasPrologEpilog)
|
if (scenario.prolog.hasPrologEpilog)
|
||||||
{
|
{
|
||||||
//GH.pushInt(new CPrologEpilogVideo(scenario.prolog));
|
GH.pushInt(new CPrologEpilogVideo(scenario.prolog, exitCb));
|
||||||
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";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
tlog1 << "Without prolog\n";
|
tlog1 << "Without prolog\n";
|
||||||
CGP->showLoadingScreen(boost::bind(&startGame, si, (CConnection *)nullptr));
|
exitCb();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSelection::selectBonus( int id )
|
void CBonusSelection::selectBonus( int id )
|
||||||
@@ -4083,27 +4090,33 @@ void CLoadingScreen::showAll(SDL_Surface *to)
|
|||||||
CWindowObject::showAll(to);
|
CWindowObject::showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPrologEpilogVideo::CPrologEpilogVideo( CCampaignScenario::SScenarioPrologEpilog _spe )
|
CPrologEpilogVideo::CPrologEpilogVideo( CCampaignScenario::SScenarioPrologEpilog _spe, std::function<void()> callback )
|
||||||
: spe(_spe), curTxtH(300)
|
: spe(_spe), exitCb(callback)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
|
addUsedEvents(LCLICK);
|
||||||
|
pos = Rect(screen);
|
||||||
|
|
||||||
CCS->videoh->open(CCampaignHandler::prologVideoName(spe.prologVideo));
|
CCS->videoh->open(CCampaignHandler::prologVideoName(spe.prologVideo));
|
||||||
|
|
||||||
auto lines = CMessage::breakText(spe.prologText, 50, EFonts::FONT_BIG);
|
auto lines = CMessage::breakText(spe.prologText, 500, EFonts::FONT_BIG);
|
||||||
|
|
||||||
txt = CSDL_Ext::newSurface(500, 60 * lines.size());
|
txt = CSDL_Ext::newSurface(500, 25 * lines.size());
|
||||||
graphics->fonts[FONT_BIG]->renderTextLinesCenter(txt, lines, Colors::METALLIC_GOLD, Point(0,0));
|
curTxtH = screen->h;
|
||||||
|
graphics->fonts[FONT_BIG]->renderTextLinesCenter(txt, lines, Colors::METALLIC_GOLD, Point(txt->w/2, txt->h/2));
|
||||||
|
SDL_SaveBMP(txt, "txtsrfc.bmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrologEpilogVideo::show( SDL_Surface * to )
|
void CPrologEpilogVideo::show( SDL_Surface * to )
|
||||||
{
|
{
|
||||||
blitAt(txt, 50, 200-curTxtH, to);
|
memset(to->pixels, 0, to->h*to->pitch); //make bg black
|
||||||
|
blitAt(txt, (to->w-txt->w)/2, curTxtH, to);
|
||||||
CCS->videoh->show(0, 0, to);
|
CCS->videoh->show(0, 0, to);
|
||||||
curTxtH = std::max(curTxtH - 10, to->h - txt->h);
|
curTxtH = std::max(curTxtH - 1, to->h - txt->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrologEpilogVideo::clickLeft( tribool down, bool previousState )
|
void CPrologEpilogVideo::clickLeft( tribool down, bool previousState )
|
||||||
{
|
{
|
||||||
GH.popInt(this);
|
GH.popInt(this);
|
||||||
|
exitCb();
|
||||||
}
|
}
|
||||||
|
@@ -545,8 +545,9 @@ class CPrologEpilogVideo : public CIntObject
|
|||||||
CCampaignScenario::SScenarioPrologEpilog spe;
|
CCampaignScenario::SScenarioPrologEpilog spe;
|
||||||
SDL_Surface * txt;
|
SDL_Surface * txt;
|
||||||
int curTxtH;
|
int curTxtH;
|
||||||
|
std::function<void()> exitCb;
|
||||||
public:
|
public:
|
||||||
CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog _spe);
|
CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog _spe, std::function<void()> callback);
|
||||||
|
|
||||||
void clickLeft(tribool down, bool previousState);
|
void clickLeft(tribool down, bool previousState);
|
||||||
void show(SDL_Surface * to);
|
void show(SDL_Surface * to);
|
||||||
|
@@ -468,22 +468,14 @@ CCampaignState::CCampaignState( unique_ptr<CCampaign> _camp ) : camp(std::move(_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
std::string CCampaignHandler::prologVideoName(ui8 index)
|
||||||
{
|
{
|
||||||
return indexToString("DATA/CMPMOVIE", index);
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CCampaignHandler::prologMusicName(ui8 index)
|
std::string CCampaignHandler::prologMusicName(ui8 index)
|
||||||
{
|
{
|
||||||
return indexToString("DATA/CMPMUSIC", index);
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user