mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Integrated CClientState into GameEngine class
This commit is contained in:
@ -48,16 +48,16 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
|
||||
if (videoPlayer->pos.h == 400)
|
||||
videoPlayer->moveBy(Point(0, 100));
|
||||
|
||||
CCS->musich->setVolume(CCS->musich->getVolume() / 2); // background volume is too loud by default
|
||||
CCS->musich->playMusic(spe.prologMusic, true, true);
|
||||
voiceDurationMilliseconds = CCS->soundh->getSoundDurationMilliseconds(spe.prologVoice);
|
||||
voiceSoundHandle = CCS->soundh->playSound(spe.prologVoice);
|
||||
ENGINE->music().setVolume(ENGINE->music().getVolume() / 2); // background volume is too loud by default
|
||||
ENGINE->music().playMusic(spe.prologMusic, true, true);
|
||||
voiceDurationMilliseconds = ENGINE->sound().getSoundDurationMilliseconds(spe.prologVoice);
|
||||
voiceSoundHandle = ENGINE->sound().playSound(spe.prologVoice);
|
||||
auto onVoiceStop = [this]()
|
||||
{
|
||||
voiceStopped = true;
|
||||
elapsedTimeMilliseconds = 0;
|
||||
};
|
||||
CCS->soundh->setCallback(voiceSoundHandle, onVoiceStop);
|
||||
ENGINE->sound().setCallback(voiceSoundHandle, onVoiceStop);
|
||||
|
||||
text = std::make_shared<CMultiLineLabel>(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText.toString());
|
||||
if(text->getLines().size() == 3)
|
||||
@ -92,11 +92,11 @@ void CPrologEpilogVideo::show(Canvas & to)
|
||||
|
||||
void CPrologEpilogVideo::clickPressed(const Point & cursorPosition)
|
||||
{
|
||||
CCS->musich->setVolume(CCS->musich->getVolume() * 2); // restore background volume
|
||||
ENGINE->music().setVolume(ENGINE->music().getVolume() * 2); // restore background volume
|
||||
close();
|
||||
CCS->soundh->resetCallback(voiceSoundHandle); // reset callback to avoid memory corruption since 'this' will be destroyed
|
||||
CCS->soundh->stopSound(voiceSoundHandle);
|
||||
CCS->soundh->stopSound(videoSoundHandle);
|
||||
ENGINE->sound().resetCallback(voiceSoundHandle); // reset callback to avoid memory corruption since 'this' will be destroyed
|
||||
ENGINE->sound().stopSound(voiceSoundHandle);
|
||||
ENGINE->sound().stopSound(videoSoundHandle);
|
||||
if(exitCb)
|
||||
exitCb();
|
||||
}
|
||||
|
Reference in New Issue
Block a user