mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +02:00
video fix
This commit is contained in:
parent
2e3e116bc4
commit
42bf5fdd58
@ -23,6 +23,7 @@ public:
|
|||||||
virtual bool nextFrame()=0;
|
virtual bool nextFrame()=0;
|
||||||
virtual void show(int x, int y, SDL_Surface *dst, bool update = true)=0;
|
virtual void show(int x, int y, SDL_Surface *dst, bool update = true)=0;
|
||||||
virtual void redraw(int x, int y, SDL_Surface *dst, bool update = true)=0; //reblits buffer
|
virtual void redraw(int x, int y, SDL_Surface *dst, bool update = true)=0; //reblits buffer
|
||||||
|
virtual VideoPath videoName()=0;
|
||||||
virtual bool wait()=0;
|
virtual bool wait()=0;
|
||||||
virtual int curFrame() const =0;
|
virtual int curFrame() const =0;
|
||||||
virtual int frameCount() const =0;
|
virtual int frameCount() const =0;
|
||||||
@ -46,6 +47,7 @@ public:
|
|||||||
void redraw( int x, int y, SDL_Surface *dst, bool update = true ) override {};
|
void redraw( int x, int y, SDL_Surface *dst, bool update = true ) override {};
|
||||||
void show( int x, int y, SDL_Surface *dst, bool update = true ) override {};
|
void show( int x, int y, SDL_Surface *dst, bool update = true ) override {};
|
||||||
bool nextFrame() override {return false;};
|
bool nextFrame() override {return false;};
|
||||||
|
VideoPath videoName() override {return VideoPath();};
|
||||||
void close() override {};
|
void close() override {};
|
||||||
bool wait() override {return false;};
|
bool wait() override {return false;};
|
||||||
bool open(const VideoPath & name, bool scale = false) override {return false;};
|
bool open(const VideoPath & name, bool scale = false) override {return false;};
|
||||||
@ -106,6 +108,8 @@ public:
|
|||||||
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
||||||
bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false) override;
|
bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false) override;
|
||||||
|
|
||||||
|
VideoPath videoName() override {return fname;};
|
||||||
|
|
||||||
//TODO:
|
//TODO:
|
||||||
bool wait() override {return false;};
|
bool wait() override {return false;};
|
||||||
int curFrame() const override {return -1;};
|
int curFrame() const override {return -1;};
|
||||||
|
@ -566,9 +566,16 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
|
|||||||
if((br.winner == 0 && weAreAttacker) || (br.winner == 1 && !weAreAttacker)) //we've won
|
if((br.winner == 0 && weAreAttacker) || (br.winner == 1 && !weAreAttacker)) //we've won
|
||||||
{
|
{
|
||||||
int text = 304;
|
int text = 304;
|
||||||
|
AudioPath musicName = AudioPath::builtin("Music/Win Battle");
|
||||||
|
VideoPath videoName = VideoPath::builtin("WIN3.BIK");
|
||||||
switch(br.result)
|
switch(br.result)
|
||||||
{
|
{
|
||||||
case EBattleResult::NORMAL:
|
case EBattleResult::NORMAL:
|
||||||
|
if(owner.cb->getBattle(br.battleID)->battleGetDefendedTown() && !weAreAttacker)
|
||||||
|
{
|
||||||
|
musicName = AudioPath::builtin("Music/Defend Castle");
|
||||||
|
videoName = VideoPath::builtin("DEFENDALL.BIK");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EBattleResult::ESCAPE:
|
case EBattleResult::ESCAPE:
|
||||||
text = 303;
|
text = 303;
|
||||||
@ -581,8 +588,8 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCS->musich->playMusic(AudioPath::builtin("Music/Win Battle"), false, true);
|
CCS->musich->playMusic(musicName, false, true);
|
||||||
CCS->videoh->open(VideoPath::builtin("WIN3.BIK"));
|
CCS->videoh->open(videoName);
|
||||||
std::string str = CGI->generaltexth->allTexts[text];
|
std::string str = CGI->generaltexth->allTexts[text];
|
||||||
|
|
||||||
const CGHeroInstance * ourHero = owner.cb->getBattle(br.battleID)->battleGetMyHero();
|
const CGHeroInstance * ourHero = owner.cb->getBattle(br.battleID)->battleGetMyHero();
|
||||||
@ -603,6 +610,11 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
|
|||||||
switch(br.result)
|
switch(br.result)
|
||||||
{
|
{
|
||||||
case EBattleResult::NORMAL:
|
case EBattleResult::NORMAL:
|
||||||
|
if(owner.cb->getBattle(br.battleID)->battleGetDefendedTown() && !weAreAttacker)
|
||||||
|
{
|
||||||
|
musicName = AudioPath::builtin("Music/LoseCastle");
|
||||||
|
videoName = VideoPath::builtin("LOSECSTL.BIK");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EBattleResult::ESCAPE:
|
case EBattleResult::ESCAPE:
|
||||||
musicName = AudioPath::builtin("Music/Retreat Battle");
|
musicName = AudioPath::builtin("Music/Retreat Battle");
|
||||||
@ -634,7 +646,30 @@ void BattleResultWindow::activate()
|
|||||||
void BattleResultWindow::show(Canvas & to)
|
void BattleResultWindow::show(Canvas & to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
CCS->videoh->update(pos.x + 107, pos.y + 70, to.getInternalSurface(), true, false);
|
CCS->videoh->update(pos.x + 107, pos.y + 70, to.getInternalSurface(), true, false,
|
||||||
|
[&]()
|
||||||
|
{
|
||||||
|
if(CCS->videoh->videoName() == VideoPath::builtin("VIDEO/LBSTART"))
|
||||||
|
{
|
||||||
|
CCS->videoh->close();
|
||||||
|
CCS->videoh->open(VideoPath::builtin("VIDEO/LBLOOP"));
|
||||||
|
}
|
||||||
|
if(CCS->videoh->videoName() == VideoPath::builtin("VIDEO/RTSTART"))
|
||||||
|
{
|
||||||
|
CCS->videoh->close();
|
||||||
|
CCS->videoh->open(VideoPath::builtin("VIDEO/RTLOOP"));
|
||||||
|
}
|
||||||
|
if(CCS->videoh->videoName() == VideoPath::builtin("VIDEO/LOSECSTL"))
|
||||||
|
{
|
||||||
|
CCS->videoh->close();
|
||||||
|
CCS->videoh->open(VideoPath::builtin("VIDEO/LOSECSLP"));
|
||||||
|
}
|
||||||
|
if(CCS->videoh->videoName() == VideoPath::builtin("VIDEO/DEFENDALL"))
|
||||||
|
{
|
||||||
|
CCS->videoh->close();
|
||||||
|
CCS->videoh->open(VideoPath::builtin("VIDEO/DEFENDLOOP"));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleResultWindow::buttonPressed(int button)
|
void BattleResultWindow::buttonPressed(int button)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user