1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-27 00:41:08 +02:00

move logic to tick

This commit is contained in:
Laserlicht
2024-01-26 20:13:02 +01:00
committed by GitHub
parent c426382687
commit 3d57437e52
2 changed files with 11 additions and 14 deletions

View File

@ -183,7 +183,7 @@ void CSoundHandler::ambientStopSound(const AudioPath & soundId)
setChannelVolume(ambientChannels[soundId], volume); setChannelVolume(ambientChannels[soundId], volume);
} }
double CSoundHandler::getSoundDuration(const AudioPath & sound) uint32_t CSoundHandler::getSoundDurationMilliseconds(const AudioPath & sound)
{ {
if (!initialized || sound.empty()) if (!initialized || sound.empty())
return 0.0; return 0.0;

View File

@ -49,13 +49,6 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
void CPrologEpilogVideo::tick(uint32_t msPassed) void CPrologEpilogVideo::tick(uint32_t msPassed)
{ {
elapsedTimeMilliseconds += msPassed; elapsedTimeMilliseconds += msPassed;
}
void CPrologEpilogVideo::show(Canvas & to)
{
to.drawColor(pos, Colors::BLACK);
//some videos are 800x600 in size while some are 800x400
CCS->videoh->update(pos.x, pos.y + (CCS->videoh->size().y == 400 ? 100 : 0), to.getInternalSurface(), true, false);
const uint32_t speed = (voiceDurationMilliseconds == 0) ? 100 : (voiceDurationMilliseconds / (text->textSize.y)); const uint32_t speed = (voiceDurationMilliseconds == 0) ? 100 : (voiceDurationMilliseconds / (text->textSize.y));
@ -65,13 +58,17 @@ void CPrologEpilogVideo::show(Canvas & to)
elapsedTimeMilliseconds -= speed; elapsedTimeMilliseconds -= speed;
++positionCounter; ++positionCounter;
} }
else else if(elapsedTimeMilliseconds > (voiceDurationMilliseconds == 0.0 ? 6000 : 3000) && voiceStopped) // pause after completed scrolling (longer for intros missing voice)
{ clickPressed(GH.getCursorPosition());
text->showAll(to); // blit text over video, if needed }
if(elapsedTimeMilliseconds > (voiceDurationMilliseconds == 0.0 ? 6000 : 3000) && voiceStopped) // pause after completed scrolling (longer for intros missing voice) void CPrologEpilogVideo::show(Canvas & to)
clickPressed(GH.getCursorPosition()); {
} to.drawColor(pos, Colors::BLACK);
//some videos are 800x600 in size while some are 800x400
CCS->videoh->update(pos.x, pos.y + (CCS->videoh->size().y == 400 ? 100 : 0), to.getInternalSurface(), true, false);
text->showAll(to); // blit text over video, if needed
} }
void CPrologEpilogVideo::clickPressed(const Point & cursorPosition) void CPrologEpilogVideo::clickPressed(const Point & cursorPosition)