MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Frame

Method Frame

neo/framework/Session.cpp:2649–2863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2647extern bool CheckOpenALDeviceAndRecoverIfNeeded();
2648extern int g_screenshotFormat;
2649void idSessionLocal::Frame() {
2650 D3P_ScopedCPUSample(Session_Frame);
2651
2652 if ( com_asyncSound.GetInteger() == 0 ) {
2653 soundSystem->AsyncUpdateWrite( Sys_Milliseconds() );
2654 }
2655
2656 // DG: periodically check if sound device is still there and try to reset it if not
2657 // (calling this from idSoundSystem::AsyncUpdate(), which runs in a separate thread
2658 // by default, causes a deadlock when calling idCommon->Warning())
2659 CheckOpenALDeviceAndRecoverIfNeeded();
2660
2661 // Editors that completely take over the game
2662 if ( com_editorActive && ( com_editors & ( EDITOR_RADIANT | EDITOR_GUI ) ) ) {
2663 return;
2664 }
2665
2666#if 0 // handled via Sys_GenerateEvents() -> handleMouseGrab()
2667 // if the console is down, we don't need to hold
2668 // the mouse cursor
2669 if ( console->Active() || com_editorActive ) {
2670 Sys_GrabMouseCursor( false );
2671 } else {
2672 Sys_GrabMouseCursor( true );
2673 }
2674#endif
2675
2676 // save the screenshot and audio from the last draw if needed
2677 if ( aviCaptureMode ) {
2678 idStr name;
2679
2680 name = va("demos/%s/%s_%05i.tga", aviDemoShortName.c_str(), aviDemoShortName.c_str(), aviTicStart );
2681
2682 float ratio = 30.0f / ( 1000.0f / USERCMD_MSEC / com_aviDemoTics.GetInteger() );
2683 aviDemoFrameCount += ratio;
2684 if ( aviTicStart + 1 != ( int )aviDemoFrameCount ) {
2685 // skipped frames so write them out
2686 int c = aviDemoFrameCount - aviTicStart;
2687 while ( c-- ) {
2688 g_screenshotFormat = 0;
2689 renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL );
2690 name = va("demos/%s/%s_%05i.tga", aviDemoShortName.c_str(), aviDemoShortName.c_str(), ++aviTicStart );
2691 }
2692 }
2693 aviTicStart = aviDemoFrameCount;
2694
2695 // remove any printed lines at the top before taking the screenshot
2696 console->ClearNotifyLines();
2697
2698 // this will call Draw, possibly multiple times if com_aviDemoSamples is > 1
2699 g_screenshotFormat = 0;
2700 renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL );
2701 }
2702
2703 // at startup, we may be backwards
2704 if ( latchedTicNumber > com_ticNumber ) {
2705 latchedTicNumber = com_ticNumber;
2706 }

Callers 6

ShowLoadingGuiMethod · 0.45
Common.cppFile · 0.45
GUIFrameMethod · 0.45
mainFunction · 0.45
SDL_mainFunction · 0.45
dhewm3game_entryFunction · 0.45

Calls 15

Sys_MillisecondsFunction · 0.85
Sys_GrabMouseCursorFunction · 0.85
vaFunction · 0.85
Com_WaitForNextTicStartFunction · 0.85
GetIntegerMethod · 0.80
AsyncUpdateWriteMethod · 0.80
TakeScreenshotMethod · 0.80
ClearNotifyLinesMethod · 0.80
GetDirectUsercmdMethod · 0.80
GetModifiedFlagsMethod · 0.80
MoveCVarsToDictMethod · 0.80

Tested by

no test coverage detected