MCPcopy Create free account
hub / github.com/ZDoom/Raze / PerformWipe

Function PerformWipe

source/common/2d/wipe.cpp:517–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515
516
517void PerformWipe(FTexture* startimg, FTexture* endimg, int wipe_type, bool stopsound, std::function<void()> overlaydrawer)
518{
519 // wipe update
520 uint64_t wipestart, nowtime, diff;
521 double diff_frac;
522 bool done;
523
524 GSnd->SetSfxPaused(true, 1);
525 I_FreezeTime(true);
526 twod->End();
527 assert(startimg != nullptr && endimg != nullptr);
528 auto starttex = MakeGameTexture(startimg, nullptr, ETextureType::SWCanvas);
529 auto endtex = MakeGameTexture(endimg, nullptr, ETextureType::SWCanvas);
530 auto wiper = Wiper::Create(wipe_type);
531 wiper->SetTextures(starttex, endtex);
532
533 wipestart = I_msTime();
534
535 do
536 {
537 if (wiper->Interpolatable() && !cl_capfps)
538 {
539 nowtime = I_msTime();
540 diff_frac = (nowtime - wipestart) * 40. / 1000.; // Using 35 here feels too slow.
541 wipestart = nowtime;
542 twod->Begin(screen->GetWidth(), screen->GetHeight());
543 done = wiper->RunInterpolated(diff_frac);
544 if (overlaydrawer) overlaydrawer();
545 twod->End();
546 screen->Update();
547 twod->OnFrameDone();
548 }
549 else
550 {
551 do
552 {
553 I_WaitVBL(2);
554 nowtime = I_msTime();
555 diff = (nowtime - wipestart) * 40 / 1000; // Using 35 here feels too slow.
556 } while (diff < 1);
557 wipestart = nowtime;
558 twod->Begin(screen->GetWidth(), screen->GetHeight());
559 done = wiper->Run(1);
560 if (overlaydrawer) overlaydrawer();
561 twod->End();
562 screen->Update();
563 twod->OnFrameDone();
564 }
565 } while (!done);
566 delete wiper;
567 I_FreezeTime(false);
568 GSnd->SetSfxPaused(false, 1);
569
570}

Callers 1

DisplayFunction · 0.85

Calls 15

I_FreezeTimeFunction · 0.85
MakeGameTextureFunction · 0.85
CreateFunction · 0.85
I_msTimeFunction · 0.85
I_WaitVBLFunction · 0.85
OnFrameDoneMethod · 0.80
SetSfxPausedMethod · 0.45
EndMethod · 0.45
SetTexturesMethod · 0.45
InterpolatableMethod · 0.45
BeginMethod · 0.45
GetWidthMethod · 0.45

Tested by

no test coverage detected