From 876aa9663710f56a7031e69bbd4b2f56d1fc2ce2 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 23 Dec 2012 06:21:01 +0100 Subject: [PATCH] Fix messed up view angle after taking screenshots Pretty much like https://github.com/dhewm/dhewm3/issues/18 but here it took some more changes --- neo/framework/Common.h | 4 +++- neo/framework/Common_local.h | 4 +++- neo/framework/common_frame.cpp | 7 +++++-- neo/renderer/RenderSystem_init.cpp | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/neo/framework/Common.h b/neo/framework/Common.h index 1f75164e..2eedf254 100644 --- a/neo/framework/Common.h +++ b/neo/framework/Common.h @@ -214,9 +214,11 @@ public: // Called repeatedly as the foreground thread for rendering and game logic. virtual void Frame() = 0; + // DG: added possibility to *not* release mouse in UpdateScreen(), it fucks up the view angle for screenshots // Redraws the screen, handling games, guis, console, etc // in a modal manner outside the normal frame loop - virtual void UpdateScreen( bool captureToImage ) = 0; + virtual void UpdateScreen( bool captureToImage, bool releaseMouse = true ) = 0; + // DG end virtual void UpdateLevelLoadPacifier() = 0; diff --git a/neo/framework/Common_local.h b/neo/framework/Common_local.h index cd34a0f3..590f3e9b 100644 --- a/neo/framework/Common_local.h +++ b/neo/framework/Common_local.h @@ -148,7 +148,9 @@ public: virtual void Quit(); virtual bool IsInitialized() const; virtual void Frame(); - virtual void UpdateScreen( bool captureToImage ); + // DG: added possibility to *not* release mouse in UpdateScreen(), it fucks up the view angle for screenshots + virtual void UpdateScreen( bool captureToImage, bool releaseMouse = true ); + // DG end virtual void UpdateLevelLoadPacifier(); virtual void StartupVariable( const char* match ); virtual void WriteConfigToFile( const char* filename ); diff --git a/neo/framework/common_frame.cpp b/neo/framework/common_frame.cpp index 4d053fee..a1968f50 100644 --- a/neo/framework/common_frame.cpp +++ b/neo/framework/common_frame.cpp @@ -349,7 +349,8 @@ idCommonLocal::UpdateScreen This is an out-of-sequence screen update, not the normal game rendering =============== */ -void idCommonLocal::UpdateScreen( bool captureToImage ) +// DG: added possibility to *not* release mouse in UpdateScreen(), it fucks up the view angle for screenshots +void idCommonLocal::UpdateScreen( bool captureToImage, bool releaseMouse ) { if( insideUpdateScreen ) { @@ -361,7 +362,9 @@ void idCommonLocal::UpdateScreen( bool captureToImage ) gameThread.WaitForThread(); // release the mouse capture back to the desktop - Sys_GrabMouseCursor( false ); + if( releaseMouse ) + Sys_GrabMouseCursor( false ); + // DG end // build all the draw commands without running a new game tic Draw(); diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index b5de4e09..c10b83e1 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -1298,7 +1298,7 @@ void R_ReadTiledPixels( int width, int height, byte* buffer, renderView_t* ref = else { const bool captureToImage = false; - common->UpdateScreen( captureToImage ); + common->UpdateScreen( captureToImage, false ); } int w = sysWidth;