1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* prologue videos (according to Randjan's list)

This commit is contained in:
mateuszb 2013-02-22 21:03:56 +00:00
parent 9fa59276c9
commit fbb1ae1bb8
5 changed files with 157 additions and 12 deletions

View File

@ -411,9 +411,9 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
int text=-1;
switch(br.result)
{
case 0: text = 304; break;
case 1: text = 303; break;
case 2: text = 302; break;
case BattleResult::NORMAL: text = 304; break;
case BattleResult::ESCAPE: text = 303; break;
case BattleResult::SURRENDER: text = 302; break;
}
CCS->musich->playMusic("Music/Win Battle", false);
@ -434,21 +434,21 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
{
switch(br.result)
{
case 0: //normal victory
case BattleResult::NORMAL:
{
CCS->musich->playMusic("Music/LoseCombat", false);
CCS->videoh->open("LBSTART.BIK");
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[311]);
break;
}
case 1: //flee
case BattleResult::ESCAPE: //flee
{
CCS->musich->playMusic("Music/Retreat Battle", false);
CCS->videoh->open("RTSTART.BIK");
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[310]);
break;
}
case 2: //surrender
case BattleResult::SURRENDER:
{
CCS->musich->playMusic("Music/Surrender Battle", false);
CCS->videoh->open("SURRENDER.BIK");

View File

@ -4091,7 +4091,7 @@ void CLoadingScreen::showAll(SDL_Surface *to)
}
CPrologEpilogVideo::CPrologEpilogVideo( CCampaignScenario::SScenarioPrologEpilog _spe, std::function<void()> callback )
: spe(_spe), exitCb(callback)
: spe(_spe), exitCb(callback), decrementDelayCounter(0)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
addUsedEvents(LCLICK);
@ -4101,18 +4101,30 @@ CPrologEpilogVideo::CPrologEpilogVideo( CCampaignScenario::SScenarioPrologEpilog
auto lines = CMessage::breakText(spe.prologText, 500, EFonts::FONT_BIG);
txt = CSDL_Ext::newSurface(500, 25 * lines.size());
txt = CSDL_Ext::newSurface(500, 20 * lines.size() + 5);
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");
//SDL_SaveBMP(txt, "txtsrfc.bmp");
}
void CPrologEpilogVideo::show( SDL_Surface * to )
{
memset(to->pixels, 0, to->h*to->pitch); //make bg black
CCS->videoh->update(pos.x, pos.y, to, true, false);
SDL_Rect tmp, our;
our = Rect(0, to->h-100, to->w, 100);
SDL_GetClipRect(to, &tmp);
SDL_SetClipRect(to, &our);
blitAt(txt, (to->w-txt->w)/2, curTxtH, to);
CCS->videoh->show(0, 0, to);
curTxtH = std::max(curTxtH - 1, to->h - txt->h);
SDL_SetClipRect(to, &tmp);
//move text every 5 calls/frames; seems to be good enough
++decrementDelayCounter;
if(decrementDelayCounter == 5)
{
curTxtH = std::max(curTxtH - 1, to->h - txt->h);
decrementDelayCounter = 0;
}
}
void CPrologEpilogVideo::clickLeft( tribool down, bool previousState )

View File

@ -544,7 +544,7 @@ class CPrologEpilogVideo : public CIntObject
{
CCampaignScenario::SScenarioPrologEpilog spe;
SDL_Surface * txt;
int curTxtH;
int curTxtH, decrementDelayCounter;
std::function<void()> exitCb;
public:
CPrologEpilogVideo(CCampaignScenario::SScenarioPrologEpilog _spe, std::function<void()> callback);

129
config/campaignMedia.json Normal file
View File

@ -0,0 +1,129 @@
{
"videos": [
//Restoration of Erathia
//Long live the Queen
"GOOD1A.SMK", //Good1_a
"GOOD1B.SMK", //Good1_b
"GOOD1C.SMK", //Good1_c
//Dungeons and devils
"EVIL1A.SMK", //Evil1_a
"EVIL1B.SMK", //Evil1_b
"EVIL1C.SMK", //Evil1_c
//Spoils of War
"NEUTRALA.SMK", //Neutral1_a
"NEUTRALB.SMK", //Neutral1_b
"NEUTRALC.SMK", //Neutral1_c
//Liberation
"GOOD2A.SMK", //Good2_a
"GOOD2B.SMK", //Good2_b
"GOOD2C.SMK", //Good2_c
"GOOD2D.SMK", //Good2_d
//Long Live the King
"EVIL2A.SMK", //Evil2_a
"EVIL2AP1.SMK", //Evil2ap1
"EVIL2B.SMK", //Evil2_b
"EVIL2C.SMK", //Evil2_c
"EVIL2D.SMK", //Evil2_d
//Song for the Father
"GOOD3A.SMK", //Good3_a
"GOOD3B.SMK", //Good3_b
"GOOD3C.SMK", //Good3_c
//Seeds Of Discontent
"SECRETA.SMK", //Secret_a
"SECRETB.SMK", //Secret_b
"SECRETC.SMK", //Secret_c
//Armageddon's Blade
//Armageddon's Blade
"H3ABab1.smk", //ArmageddonsBlade_a
"H3ABab2.smk", //ArmageddonsBlade_b
"H3ABab3.smk", //ArmageddonsBlade_c
"H3ABab4.smk", //ArmageddonsBlade_d
"H3ABab5.smk", //ArmageddonsBlade_e
"H3ABab6.smk", //ArmageddonsBlade_f
"H3ABab7.smk", //ArmageddonsBlade_g
"H3ABab8.smk", //ArmageddonsBlade_h
"H3ABab9.smk", //ArmageddonsBlade_end
//Dragon's Blood
"H3ABdb1.smk", //DragonsBlood_a
"H3ABdb2.smk", //DragonsBlood_b
"H3ABdb3.smk", //DragonsBlood_c
"H3ABdb4.smk", //DragonsBlood_d
"H3ABdb5.smk", //DragonsBlood_end
//Dragon Slayer
"H3ABds1.smk", //DragonSlayer_a
"H3ABds2.smk", //DragonSlayer_b
"H3ABds3.smk", //DragonSlayer_c
"H3ABds4.smk", //DragonSlayer_d
"H3ABds5.smk", //DragonSlayer_end
//Festival of Life
"H3ABfl1.smk", //FestivalOfLife_a
"H3ABfl2.smk", //FestivalOfLife_b
"H3ABfl3.smk", //FestivalOfLife_c
"H3ABfl4.smk", //FestivalOfLife_d
"H3ABfl5.smk", //FestivalOfLife_end
//Foolhardy Waywardness
"H3ABfw1.smk", //FoolhardyWaywardness_a
"H3ABfw2.smk", //FoolhardyWaywardness_b
"H3ABfw3.smk", //FoolhardyWaywardness_c
"H3ABfw4.smk", //FoolhardyWaywardness_d
"H3ABfw5.smk", //FoolhardyWaywardness_end
//Playing with Fire
"H3ABpf1.smk", //PlayingWithFire_a
"H3ABpf2.smk", //PlayingWithFire_b
"3ABpf3.smk", //PlayingWithFire_c
"H3ABpf4.smk", //PlayingWithFire_end
//Shadow of Death Campaigns
//Birth of a Barbarian
"H3x2_BBa.smk", //BirthOfABarbarian_a
"H3x2_BBb.smk", //BirthOfABarbarian_b
"H3x2_BBc.smk", //BirthOfABarbarian_c
"H3x2_BBd.smk", //BirthOfABarbarian_d
"H3x2_BBe.smk", //BirthOfABarbarian_e
"H3x2_BBf.smk", //BirthOfABarbarian_end
//Elixir of Life
"H3x2_Ela.smk", //ElixirOfLife_a
"H3x2_Elb.smk", //ElixirOfLife_b
"H3x2_Elc.smk", //ElixirOfLife_c
"H3x2_Eld.smk", //ElixirOfLife_d
"H3x2_Ele.smk", //ElixirOfLife_end
//Hack and Slash
"H3x2_HSa.smk", //HackAndSlash_a
"EVIL2C.SMK", //HackAndSlash_b
"H3x2_HSc.smk", //HackAndSlash_c
"H3x2_HSd.smk", //HackAndSlash_d
"H3x2_HSe.smk", //HackAndSlash_end
//New Beginning
"H3x2_NBa.smk", //NewBeginning_a
"H3x2_NBb.smk", //NewBeginning_b
"H3x2_Nbc.smk", //NewBeginning_c
"H3x2_Nbd.smk", //NewBeginning_d
"H3x2_Nbe.smk", //NewBeginning_end
//Rise of the Necromancer
"H3x2_RNa.smk", //RiseOfTheNecromancer_a
"H3x2_RNb.smk", //RiseOfTheNecromancer_b
"H3x2_RNc.smk", //RiseOfTheNecromancer_c
"H3x2_RNd.smk", //RiseOfTheNecromancer_d
"H3x2_RNe1.smk", //RiseOfTheNecromancer_end
//Spectre of Power
"H3x2_SPa.smk", //SpectreOfPower_a
"H3x2_SPb.smk", //SpectreOfPower_b
"H3x2_SPc.smk", //SpectreOfPower_c
"H3x2_SPd.smk", //SpectreOfPower_d
"H3x2_SPe.smk", //SpectreOfPower_end
//Unholy Alliance
"H3x2_UAa.smk", //UnholyAlliance_a
"H3x2_UAb.smk", //UnholyAlliance_b
"H3x2_UAc.smk", //UnholyAlliance_c
"H3x2_UAd.smk", //UnholyAlliance_d
"H3x2_UAe.smk", //UnholyAlliance_e
"H3x2_UAf.smk", //UnholyAlliance_f
"H3x2_UAg.smk", //UnholyAlliance_g
"H3x2_UAh.smk", //UnholyAlliance_h
"H3x2_UAi.smk", //UnholyAlliance_i
"H3x2_UAj.smk", //UnholyAlliance_j
"H3x2_UAk.smk", //UnholyAlliance_k
"H3x2_UAl.smk", //UnholyAlliance_l
"H3x2_UAm.smk", //UnholyAlliance_end //H3x2_UAm.bik?
],
"music" : []
}

View File

@ -470,6 +470,10 @@ CCampaignState::CCampaignState( unique_ptr<CCampaign> _camp ) : camp(std::move(_
std::string CCampaignHandler::prologVideoName(ui8 index)
{
JsonNode config(ResourceID(std::string("CONFIG/campaignMedia"), EResType::TEXT));
auto vids = config["videos"].Vector();
if(index < vids.size())
return vids[index].String();
return "";
}