mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
skippable video intro
This commit is contained in:
@@ -293,24 +293,7 @@ CMainMenu::CMainMenu(bool playVideoIntro)
|
||||
OBJECT_CONSTRUCTION;
|
||||
backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
|
||||
|
||||
if(playVideoIntro)
|
||||
{
|
||||
auto playVideo = [](std::string video, bool rim, float scaleFactor, std::function<void()> cb){
|
||||
if(CCS->videoh->open(VideoPath::builtin(video), scaleFactor))
|
||||
GH.windows().createAndPushWindow<CampaignRimVideo>(VideoPath::builtin(video), rim ? ImagePath::builtin("INTRORIM") : ImagePath::builtin(""), true, scaleFactor, [cb](){ cb(); });
|
||||
else
|
||||
cb();
|
||||
};
|
||||
playVideo("3DOLOGO.SMK", false, 1, [playVideo](){
|
||||
playVideo("NWCLOGO.SMK", false, 2, [playVideo](){
|
||||
playVideo("H3INTRO.SMK", true, 1, [](){
|
||||
CCS->musich->playMusic(AudioPath::builtin("Music/MainMenu"), true, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
CCS->musich->playMusic(AudioPath::builtin("Music/MainMenu"), true, true);
|
||||
playIntroVideos(playVideoIntro);
|
||||
}
|
||||
|
||||
CMainMenu::~CMainMenu()
|
||||
@@ -319,6 +302,35 @@ CMainMenu::~CMainMenu()
|
||||
GH.curInt = nullptr;
|
||||
}
|
||||
|
||||
void CMainMenu::playIntroVideos(bool playVideoIntro)
|
||||
{
|
||||
auto playMusic = [](){ CCS->musich->playMusic(AudioPath::builtin("Music/MainMenu"), true, true); };
|
||||
if(playVideoIntro)
|
||||
{
|
||||
auto playVideo = [](std::string video, bool rim, float scaleFactor, std::function<void(bool)> cb){
|
||||
if(CCS->videoh->open(VideoPath::builtin(video), scaleFactor))
|
||||
GH.windows().createAndPushWindow<CampaignRimVideo>(VideoPath::builtin(video), rim ? ImagePath::builtin("INTRORIM") : ImagePath::builtin(""), true, scaleFactor, [cb](bool skipped){ cb(skipped); });
|
||||
else
|
||||
cb(true);
|
||||
};
|
||||
playVideo("3DOLOGO.SMK", false, 1, [playVideo, playMusic](bool skipped){
|
||||
if(!skipped)
|
||||
playVideo("NWCLOGO.SMK", false, 2, [playVideo, playMusic](bool skipped){
|
||||
if(!skipped)
|
||||
playVideo("H3INTRO.SMK", true, 1, [playMusic](bool skipped){
|
||||
playMusic();
|
||||
});
|
||||
else
|
||||
playMusic();
|
||||
});
|
||||
else
|
||||
playMusic();
|
||||
});
|
||||
}
|
||||
else
|
||||
playMusic();
|
||||
}
|
||||
|
||||
void CMainMenu::activate()
|
||||
{
|
||||
// check if screen was resized while main menu was inactive - e.g. in gameplay mode
|
||||
|
||||
Reference in New Issue
Block a user