// void SCR_UpdateScreen (void); // This is called every frame, and can also be called explicitly to flush // text to the screen. // // WARNING: be very careful calling this from elsewhere, because the refresh // needs almost the entire 256k of stack space! public static void UpdateScreen() { if (BlockDrawing || !_IsInitialized || _InUpdate) { return; } _InUpdate = true; try { if (MainForm.Instance != null) { if ((MainForm.Instance.VSync == VSyncMode.On) != Vid.Wait) { MainForm.Instance.VSync = (Vid.Wait ? VSyncMode.On : VSyncMode.Off); } } _VidDef.numpages = 2 + (int)_glTripleBuffer.Value; CopyTop = false; _CopyEverything = false; if (IsDisabledForLoading) { if ((Host.RealTime - _DisabledTime) > 60) { IsDisabledForLoading = false; Con.Print("Load failed.\n"); } else { return; } } if (!Con.IsInitialized) { return; // not initialized yet } BeginRendering(); // // determine size of refresh window // if (_OldFov != _Fov.Value) { _OldFov = _Fov.Value; _VidDef.recalc_refdef = true; } if (_OldScreenSize != _ViewSize.Value) { _OldScreenSize = _ViewSize.Value; _VidDef.recalc_refdef = true; } if (_VidDef.recalc_refdef) { CalcRefdef(); } // // do 3D refresh drawing, and then update the screen // SetUpToDrawConsole(); View.RenderView(); Set2D(); // // draw any areas not covered by the refresh // Scr.TileClear(); if (_DrawDialog) { Sbar.Draw(); Drawer.FadeScreen(); DrawNotifyString(); _CopyEverything = true; } else if (_DrawLoading) { DrawLoading(); Sbar.Draw(); } else if (Client.cl.intermission == 1 && Key.Destination == keydest_t.key_game) { Sbar.IntermissionOverlay(); } else if (Client.cl.intermission == 2 && Key.Destination == keydest_t.key_game) { Sbar.FinaleOverlay(); CheckDrawCenterString(); } else { if (View.Crosshair > 0) { Drawer.DrawCharacter(_VRect.x + _VRect.width / 2, _VRect.y + _VRect.height / 2, '+'); } DrawRam(); DrawNet(); DrawTurtle(); DrawPause(); CheckDrawCenterString(); Sbar.Draw(); DrawConsole(); Menu.Draw(); } View.UpdatePalette(); EndRendering(); } finally { _InUpdate = false; } }