From 1f5579a6978badb06dd6c1d078a51f8dc0347bce Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Tue, 13 Aug 2013 23:04:46 +0200 Subject: [PATCH 01/17] Fix compilation with SDL2 Release .. they removed ev.key.keysym.unicode - but checking for SDL_SCANCODE_GRAVE is better anyway to handle console key --- neo/sys/sdl/sdl_events.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neo/sys/sdl/sdl_events.cpp b/neo/sys/sdl/sdl_events.cpp index 8764656a..4ed83410 100644 --- a/neo/sys/sdl/sdl_events.cpp +++ b/neo/sys/sdl/sdl_events.cpp @@ -887,7 +887,13 @@ sysEvent_t Sys_GetEvent() if( key == 0 ) { - +#if SDL_VERSION_ATLEAST(2, 0, 0) + // SDL2 has no ev.key.keysym.unicode anymore.. but the scancode should work well enough for console + if( ev.type == SDL_KEYDOWN ) // FIXME: don't complain if this was an ASCII char and the console is open? + common->Warning( "unmapped SDL key %d scancode %d", ev.key.keysym.sym, ev.key.keysym.scancode ); + + return res_none; +#else unsigned char uc = ev.key.keysym.unicode & 0xff; // check if its an unmapped console key if( uc == Sys_GetConsoleKey( false ) || uc == Sys_GetConsoleKey( true ) ) @@ -901,6 +907,7 @@ sysEvent_t Sys_GetEvent() common->Warning( "unmapped SDL key %d (0x%x) scancode %d", ev.key.keysym.sym, ev.key.keysym.unicode, ev.key.keysym.scancode ); return res_none; } +#endif } } From bc45492d9ceab2a05b4a56c898eb5b4479be49d8 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Wed, 14 Aug 2013 02:48:07 +0200 Subject: [PATCH 02/17] Fixed typo that hid the sys/*.h files in the VS solutions --- neo/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 33f74071..5bb05ab8 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -1148,7 +1148,7 @@ if(MSVC) ${EDITOR_SOUND_INCLUDES} ${EDITOR_SOUND_SOURCES}) endif() - list(APPEND RBDOOM3_INLCUDES + list(APPEND RBDOOM3_INCLUDES ${SYS_INCLUDES} ${WIN32_INCLUDES}) From d3ddf61d9c08c1ba6b0a4c31a829645d2507b0de Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Thu, 29 Aug 2013 09:38:52 +0200 Subject: [PATCH 03/17] Changed signature of GLDEBUGPROCARB to match OpenGL GL_ARB_debug_output specs --- neo/renderer/OpenGL/glext.h | 4 +++- neo/renderer/RenderSystem_init.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/neo/renderer/OpenGL/glext.h b/neo/renderer/OpenGL/glext.h index 98cc7a46..5686ba54 100644 --- a/neo/renderer/OpenGL/glext.h +++ b/neo/renderer/OpenGL/glext.h @@ -5564,7 +5564,9 @@ extern "C" { #endif #ifndef GL_ARB_debug_output - typedef void ( APIENTRY* GLDEBUGPROCARB )( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam ); + // RB: added const to userParam + typedef void ( APIENTRY* GLDEBUGPROCARB )( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const GLvoid* userParam ); + // RB end #endif #ifndef GL_AMD_debug_output diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 66dfcefc..13b908bc 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -357,20 +357,21 @@ DebugCallback For ARB_debug_output ======================== */ +// RB: added const to userParam static void CALLBACK DebugCallback( unsigned int source, unsigned int type, - unsigned int id, unsigned int severity, int length, const char* message, void* userParam ) + unsigned int id, unsigned int severity, int length, const char* message, const void* userParam ) { // it probably isn't safe to do an idLib::Printf at this point - // RB begin + // RB: printf should be thread safe on Linux #if defined(_WIN32) OutputDebugString( message ); OutputDebugString( "\n" ); #else printf( "%s\n", message ); #endif - // RB end } +// RB end /* ================== From 9372fddabb6c9f78c472fdc2cf44763d0b1004de Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sat, 31 Aug 2013 19:22:04 +0200 Subject: [PATCH 04/17] Fix compile when system GLDEBUGPROCARB signature is without const .. by just casting our DebugCallback to GLDEBUGPROCARB. It shouldn't make a difference ABI-wise, if there is a const at a parameter or not. Fixes #61 --- neo/renderer/RenderSystem_init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 13b908bc..01330c5e 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -626,7 +626,7 @@ static void R_CheckPortableExtensions() if( r_debugContext.GetInteger() >= 1 ) { - qglDebugMessageCallbackARB( DebugCallback, NULL ); + qglDebugMessageCallbackARB( (GLDEBUGPROCARB)DebugCallback, NULL ); } if( r_debugContext.GetInteger() >= 2 ) { From 1c500b710bcec5a20b3c3e2f5890c7f170c05639 Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Mon, 16 Sep 2013 17:54:14 +1000 Subject: [PATCH 05/17] Mirror source code directory structure in generated MSVC projects. --- neo/CMakeLists.txt | 55 ++++++++++++++++++++++++++-- neo/idlib/CMakeLists.txt | 79 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 124 insertions(+), 10 deletions(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 5bb05ab8..0878b12a 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -174,7 +174,7 @@ file(GLOB FRAMEWORK_SOURCES framework/*.cpp) file(GLOB FRAMEWORK_ASYNC_INCLUDES framework/async/*.h) file(GLOB FRAMEWORK_ASYNC_SOURCES framework/async/*.cpp) -file(GLOB_RECURSE RENDERER_INCLUDES renderer/*.h) +file(GLOB RENDERER_INCLUDES renderer/*.h) # renderer/AutoRender.h # renderer/AutoRenderBink.h # renderer/BinaryImage.h @@ -214,7 +214,7 @@ file(GLOB_RECURSE RENDERER_INCLUDES renderer/*.h) # renderer/VertexCache.h) -file(GLOB_RECURSE RENDERER_SOURCES renderer/*.cpp) +file(GLOB RENDERER_SOURCES renderer/*.cpp) # renderer/AutoRender.cpp # renderer/Cinematic.cpp # renderer/Framebuffer.cpp @@ -275,7 +275,21 @@ file(GLOB_RECURSE RENDERER_SOURCES renderer/*.cpp) # renderer/tr_trace.cpp # renderer/tr_trisurf.cpp # renderer/tr_turboshadow.cpp) - + +file(GLOB RENDERER_COLOR_INCLUDES renderer/Color/*.h) +file(GLOB RENDERER_COLOR_SOURCES renderer/Color/*.cpp) +file(GLOB RENDERER_DXT_INCLUDES renderer/DXT/*.h) +file(GLOB RENDERER_DXT_SOURCES renderer/DXT/*.cpp) +file(GLOB RENDERER_JOBS_INCLUDES renderer/jobs/*.h) +file(GLOB RENDERER_JOBS_SOURCES renderer/jobs/*.cpp) +file(GLOB RENDERER_JOBS_DYNAMICSHADOWVOLUME_INCLUDES renderer/jobs/dynamicshadowvolume/*.h) +file(GLOB RENDERER_JOBS_DYNAMICSHADOWVOLUME_SOURCES renderer/jobs/dynamicshadowvolume/*.cpp) +file(GLOB RENDERER_JOBS_PRELIGHTSHADOWVOLUME_INCLUDES renderer/jobs/prelightshadowvolume/*.h) +file(GLOB RENDERER_JOBS_PRELIGHTSHADOWVOLUME_SOURCES renderer/jobs/prelightshadowvolume/*.cpp) +file(GLOB RENDERER_JOBS_STATICSHADOWVOLUME_INCLUDES renderer/jobs/staticshadowvolume/*.h) +file(GLOB RENDERER_JOBS_STATICSHADOWVOLUME_SOURCES renderer/jobs/staticshadowvolume/*.cpp) +file(GLOB RENDERER_OPENGL_INCLUDES renderer/OpenGL/*.h) +file(GLOB RENDERER_OPENGL_SOURCES renderer/OpenGL/*.cpp) file(GLOB IRRXML_INCLUDES libs/irrxml/src/*.h) file(GLOB IRRXML_SOURCES libs/irrxml/src/*.cpp) @@ -824,6 +838,27 @@ source_group("framework\\async" FILES ${FRAMEWORK_ASYNC_SOURCES}) source_group("renderer" FILES ${RENDERER_INCLUDES}) source_group("renderer" FILES ${RENDERER_SOURCES}) +source_group("renderer\\Color" FILES ${RENDERER_COLOR_INCLUDES}) +source_group("renderer\\Color" FILES ${RENDERER_COLOR_SOURCES}) + +source_group("renderer\\DXT" FILES ${RENDERER_DXT_INCLUDES}) +source_group("renderer\\DXT" FILES ${RENDERER_DXT_SOURCES}) + +source_group("renderer\\jobs" FILES ${RENDERER_JOBS_INCLUDES}) +source_group("renderer\\jobs" FILES ${RENDERER_JOBS_SOURCES}) + +source_group("renderer\\jobs\\dynamicshadowvolume" FILES ${RENDERER_JOBS_DYNAMICSHADOWVOLUME_INCLUDES}) +source_group("renderer\\jobs\\dynamicshadowvolume" FILES ${RENDERER_JOBS_DYNAMICSHADOWVOLUME_SOURCES}) + +source_group("renderer\\jobs\\prelightshadowvolume" FILES ${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_INCLUDES}) +source_group("renderer\\jobs\\prelightshadowvolume" FILES ${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_SOURCES}) + +source_group("renderer\\jobs\\staticshadowvolume" FILES ${RENDERER_JOBS_STATICSHADOWVOLUME_INCLUDES}) +source_group("renderer\\jobs\\staticshadowvolume" FILES ${RENDERER_JOBS_STATICSHADOWVOLUME_SOURCES}) + +source_group("renderer\\OpenGL" FILES ${RENDERER_OPENGL_INCLUDES}) +source_group("renderer\\OpenGL" FILES ${RENDERER_OPENGL_SOURCES}) + source_group("libs\\irrxml" FILES ${IRRXML_INCLUDES}) source_group("libs\\irrxml" FILES ${IRRXML_SOURCES}) @@ -975,6 +1010,13 @@ set(RBDOOM3_INCLUDES ${FRAMEWORK_INCLUDES} ${FRAMEWORK_ASYNC_INCLUDES} ${RENDERER_INCLUDES} + ${RENDERER_COLOR_INCLUDES} + ${RENDERER_DXT_INCLUDES} + ${RENDERER_JOBS_INCLUDES} + ${RENDERER_JOBS_DYNAMICSHADOWVOLUME_INCLUDES} + ${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_INCLUDES} + ${RENDERER_JOBS_STATICSHADOWVOLUME_INCLUDES} + ${RENDERER_OPENGL_INCLUDES} #${IRRXML_INCLUDES} ${JPEG_INCLUDES} #${PNG_INCLUDES} @@ -1001,6 +1043,13 @@ set(RBDOOM3_SOURCES ${FRAMEWORK_SOURCES} ${FRAMEWORK_ASYNC_SOURCES} ${RENDERER_SOURCES} + ${RENDERER_COLOR_SOURCES} + ${RENDERER_DXT_SOURCES} + ${RENDERER_JOBS_SOURCES} + ${RENDERER_JOBS_DYNAMICSHADOWVOLUME_SOURCES} + ${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_SOURCES} + ${RENDERER_JOBS_STATICSHADOWVOLUME_SOURCES} + ${RENDERER_OPENGL_SOURCES} #${IRRXML_SOURCES} ${JPEG_SOURCES} #${PNG_SOURCES} diff --git a/neo/idlib/CMakeLists.txt b/neo/idlib/CMakeLists.txt index 23d24219..0fcbfbfc 100644 --- a/neo/idlib/CMakeLists.txt +++ b/neo/idlib/CMakeLists.txt @@ -1,20 +1,85 @@ add_definitions(-D__IDLIB__ -D__DOOM_DLL__) -file(GLOB_RECURSE ID_INCLUDES *.h) -file(GLOB_RECURSE ID_SOURCES *.cpp) +file(GLOB ID__INCLUDES *.h) +file(GLOB ID__SOURCES *.cpp) +file(GLOB ID_BV_INCLUDES bv/*.h) +file(GLOB ID_BV_SOURCES bv/*.cpp) +file(GLOB ID_CONTAINERS_INCLUDES containers/*.h) +file(GLOB ID_CONTAINERS_SOURCES containers/*.cpp) +file(GLOB ID_GEOMETRY_INCLUDES geometry/*.h) +file(GLOB ID_GEOMETRY_SOURCES geometry/*.cpp) +file(GLOB ID_HASHING_INCLUDES hashing/*.h) +file(GLOB ID_HASHING_SOURCES hashing/*.cpp) +file(GLOB ID_MATH_INCLUDES math/*.h) +file(GLOB ID_MATH_SOURCES math/*.cpp) +file(GLOB ID_SYS_INCLUDES sys/*.h) +file(GLOB ID_SYS_SOURCES sys/*.cpp) if(MSVC) - list(REMOVE_ITEM ID_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sys/posix/posix_thread.cpp) + file(GLOB ID_SYS_WIN32_INCLUDES sys/win32/*.h) + file(GLOB ID_SYS_WIN32_SOURCES sys/win32/*.cpp) else() - list(REMOVE_ITEM ID_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sys/win32/win_thread.cpp) + file(GLOB ID_SYS_POSIX_INCLUDES sys/posix/*.h) + file(GLOB ID_SYS_POSIX_SOURCES sys/posix/*.cpp) +endif() + +set(ID_INCLUDES_ALL + ${ID__INCLUDES} + ${ID_BV_INCLUDES} + ${ID_CONTAINERS_INCLUDES} + ${ID_GEOMETRY_INCLUDES} + ${ID_HASHING_INCLUDES} + ${ID_MATH_INCLUDES} + ${ID_SYS_INCLUDES} + ) + +set(ID_SOURCES_ALL + ${ID__SOURCES} + ${ID_BV_SOURCES} + ${ID_CONTAINERS_SOURCES} + ${ID_GEOMETRY_SOURCES} + ${ID_HASHING_SOURCES} + ${ID_MATH_SOURCES} + ${ID_SYS_SOURCES} + ) + +if(MSVC) + list(APPEND ID_INCLUDES_ALL ${ID_SYS_WIN32_INCLUDES}) + list(APPEND ID_SOURCES_ALL ${ID_SYS_WIN32_SOURCES}) +else() + list(APPEND ID_INCLUDES_ALL ${ID_SYS_POSIX_INCLUDES}) + list(APPEND ID_SOURCES_ALL ${ID_SYS_POSIX_SOURCES}) +endif() + +source_group("" FILES ${ID__INCLUDES}) +source_group("" FILES ${ID__SOURCES}) +source_group("bv" FILES ${ID_BV_INCLUDES}) +source_group("bv" FILES ${ID_BV_SOURCES}) +source_group("containers" FILES ${ID_CONTAINERS_INCLUDES}) +source_group("containers" FILES ${ID_CONTAINERS_SOURCES}) +source_group("geometry" FILES ${ID_GEOMETRY_INCLUDES}) +source_group("geometry" FILES ${ID_GEOMETRY_SOURCES}) +source_group("hashing" FILES ${ID_HASHING_INCLUDES}) +source_group("hashing" FILES ${ID_HASHING_SOURCES}) +source_group("math" FILES ${ID_MATH_INCLUDES}) +source_group("math" FILES ${ID_MATH_SOURCES}) +source_group("sys" FILES ${ID_SYS_INCLUDES}) +source_group("sys" FILES ${ID_SYS_SOURCES}) + +if(MSVC) + source_group("sys\\win32" FILES ${ID_SYS_WIN32_INCLUDES}) + source_group("sys\\win32" FILES ${ID_SYS_WIN32_SOURCES}) +else() + source_group("sys\\posix" FILES ${ID_SYS_POSIX_INCLUDES}) + source_group("sys\\posix" FILES ${ID_SYS_POSIX_SOURCES}) endif() #if(STANDALONE) # add_definitions(-DSTANDALONE) #endif() -set(ID_PRECOMPILED_SOURCES ${ID_SOURCES}) +set(ID_PRECOMPILED_SOURCES ${ID_SOURCES_ALL}) list(REMOVE_ITEM ID_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/geometry/RenderMatrix.cpp) list(REMOVE_ITEM ID_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/SoftwareCache.cpp) @@ -36,7 +101,7 @@ if(MSVC) COMPILE_FLAGS "/Ycprecompiled.h" ) - add_library(idlib ${ID_SOURCES} ${ID_INCLUDES}) + add_library(idlib ${ID_SOURCES_ALL} ${ID_INCLUDES_ALL}) else() foreach( src_file ${ID_PRECOMPILED_SOURCES} ) #message(STATUS "-include precompiled.h for ${src_file}") @@ -68,7 +133,7 @@ else() COMMENT "Creating idlib/precompiled.h.gch for idlib" ) - add_library(idlib ${ID_SOURCES} ${ID_INCLUDES}) + add_library(idlib ${ID_SOURCES_ALL} ${ID_INCLUDES_ALL}) add_dependencies(idlib precomp_header_idlib) endif() From 45ea17fd706fafbcb3296f0ba0b58624d22b183e Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Tue, 17 Sep 2013 20:36:18 +1000 Subject: [PATCH 06/17] Removed unused FileSystem variables. --- neo/framework/FileSystem.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/neo/framework/FileSystem.cpp b/neo/framework/FileSystem.cpp index 64b132db..04b425f2 100644 --- a/neo/framework/FileSystem.cpp +++ b/neo/framework/FileSystem.cpp @@ -2996,36 +2996,6 @@ void idFileSystemLocal::SetupGameDirectories( const char* gameName ) } } - -const char* cachedStartupFiles[] = -{ - "game:\\base\\video\\loadvideo.bik" -}; -const int numStartupFiles = sizeof( cachedStartupFiles ) / sizeof( cachedStartupFiles[ 0 ] ); - -const char* cachedNormalFiles[] = -{ - "game:\\base\\_sound_xenon_en.resources", // these will fail silently on the files that are not on disc - "game:\\base\\_sound_xenon_fr.resources", - "game:\\base\\_sound_xenon_jp.resources", - "game:\\base\\_sound_xenon_sp.resources", - "game:\\base\\_sound_xenon_it.resources", - "game:\\base\\_sound_xenon_gr.resources", - "game:\\base\\_sound_xenon.resources", - "game:\\base\\_common.resources", - "game:\\base\\_ordered.resources", - "game:\\base\\video\\mars_rotation.bik" // cache this to save the consumer from hearing SEEK.. SEEK... SEEK.. SEEK SEEEK while at the main menu -}; -const int numNormalFiles = sizeof( cachedNormalFiles ) / sizeof( cachedNormalFiles[ 0 ] ); - -const char* dontCacheFiles[] = -{ - "game:\\base\\maps\\*.*", // these will fail silently on the files that are not on disc - "game:\\base\\video\\*.*", - "game:\\base\\sound\\*.*", -}; -const int numDontCacheFiles = sizeof( dontCacheFiles ) / sizeof( dontCacheFiles[ 0 ] ); - /* ================ idFileSystemLocal::InitPrecache From a1776a22d02fe207b758108e2472636862c788be Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Wed, 18 Sep 2013 12:39:31 +1000 Subject: [PATCH 07/17] r_vidMode sanity check was off by 1. --- neo/renderer/RenderSystem_init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 01330c5e..72890497 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -787,7 +787,7 @@ void R_SetNewMode( const bool fullInit ) } else { - if( r_vidMode.GetInteger() > modeList.Num() ) + if( r_vidMode.GetInteger() >= modeList.Num() ) { idLib::Printf( "r_vidMode reset from %i to 0.\n", r_vidMode.GetInteger() ); r_vidMode.SetInteger( 0 ); From adf2b63e88aee162159c36be27501be140b9a32d Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Sat, 21 Sep 2013 19:27:03 +1000 Subject: [PATCH 08/17] Skip some common SWF tags (FileAttributes, Metadata and SetBackgroundColor) instead of failing to load a SWF file if any of them are encountered. --- neo/swf/SWF.h | 3 +++ neo/swf/SWF_Load.cpp | 31 +++++++++++++++++++++++++++++++ neo/swf/SWF_Sprites.cpp | 3 +++ 3 files changed, 37 insertions(+) diff --git a/neo/swf/SWF.h b/neo/swf/SWF.h index b83d536a..926f8e9d 100644 --- a/neo/swf/SWF.h +++ b/neo/swf/SWF.h @@ -389,6 +389,9 @@ private: bool LoadSWF( const char* fullpath ); bool LoadBinary( const char* bfilename, ID_TIME_T sourceTime ); void WriteBinary( const char* bfilename ); + void FileAttributes( idSWFBitStream& bitstream ); + void Metadata( idSWFBitStream& bitstream ); + void SetBackgroundColor( idSWFBitStream& bitstream ); //---------------------------------- // SWF_Shapes.cpp diff --git a/neo/swf/SWF_Load.cpp b/neo/swf/SWF_Load.cpp index 51d3feeb..6eaabc17 100644 --- a/neo/swf/SWF_Load.cpp +++ b/neo/swf/SWF_Load.cpp @@ -526,3 +526,34 @@ void idSWF::WriteBinary( const char* bfilename ) } } } + +/* +=================== +idSWF::FileAttributes +Extra data that won't fit in a SWF header +=================== +*/ +void idSWF::FileAttributes( idSWFBitStream& bitstream ) +{ + bitstream.Seek( 5 ); // 5 booleans +} + +/* +=================== +idSWF::Metadata +=================== +*/ +void idSWF::Metadata( idSWFBitStream& bitstream ) +{ + bitstream.ReadString(); // XML string +} + +/* +=================== +idSWF::SetBackgroundColor +=================== +*/ +void idSWF::SetBackgroundColor( idSWFBitStream& bitstream ) +{ + bitstream.Seek( 4 ); // int +} diff --git a/neo/swf/SWF_Sprites.cpp b/neo/swf/SWF_Sprites.cpp index fe356248..b5f4bb9d 100644 --- a/neo/swf/SWF_Sprites.cpp +++ b/neo/swf/SWF_Sprites.cpp @@ -105,6 +105,9 @@ void idSWFSprite::Load( idSWFBitStream& bitstream, bool parseDictionary ) switch( tag ) { #define HANDLE_SWF_TAG( x ) case Tag_##x: swf->x( tagStream ); break; + HANDLE_SWF_TAG( FileAttributes ); + HANDLE_SWF_TAG( Metadata ); + HANDLE_SWF_TAG( SetBackgroundColor ); HANDLE_SWF_TAG( JPEGTables ); HANDLE_SWF_TAG( DefineBits ); HANDLE_SWF_TAG( DefineBitsJPEG2 ); From 4c7a2c5de318a49b9088d999a52576eb74cee30c Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Sat, 21 Sep 2013 19:35:00 +1000 Subject: [PATCH 09/17] Prioritize source SWF and image (for SWF atlas) files over their binary equivalents in resources files when not in production mode. Now you can replace individual menus without having to extract and delete all the base/*.resources files first. --- neo/renderer/BinaryImage.cpp | 2 +- neo/swf/SWF_Load.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/renderer/BinaryImage.cpp b/neo/renderer/BinaryImage.cpp index 10796f2f..e4d83ad4 100644 --- a/neo/renderer/BinaryImage.cpp +++ b/neo/renderer/BinaryImage.cpp @@ -466,7 +466,7 @@ bool idBinaryImage::LoadFromGeneratedFile( idFile* bFile, ID_TIME_T sourceFileTi { return false; } - if( fileData.sourceFileTime != sourceFileTime && !fileSystem->InProductionMode() ) + if( fileData.sourceFileTime != sourceFileTime && sourceFileTime != 0 && com_productionMode.GetInteger() == 0 ) { return false; } diff --git a/neo/swf/SWF_Load.cpp b/neo/swf/SWF_Load.cpp index 6eaabc17..b83c7990 100644 --- a/neo/swf/SWF_Load.cpp +++ b/neo/swf/SWF_Load.cpp @@ -152,7 +152,7 @@ bool idSWF::LoadBinary( const char* bfilename, ID_TIME_T sourceTime ) f->ReadBig( magic ); f->ReadBig( btimestamp ); - if( magic != BSWF_MAGIC || ( !fileSystem->InProductionMode() && sourceTime != btimestamp ) ) + if( magic != BSWF_MAGIC || ( com_productionMode.GetInteger() == 0 && sourceTime != FILE_NOT_FOUND_TIMESTAMP && sourceTime != btimestamp ) ) { delete f; return false; From b3983e582a20f174617c1e082c1ae3f23a253ba9 Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Sat, 21 Sep 2013 19:37:12 +1000 Subject: [PATCH 10/17] astyle --- neo/renderer/RenderSystem_init.cpp | 2 +- neo/sys/sdl/sdl_events.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 72890497..ee8c70a2 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -626,7 +626,7 @@ static void R_CheckPortableExtensions() if( r_debugContext.GetInteger() >= 1 ) { - qglDebugMessageCallbackARB( (GLDEBUGPROCARB)DebugCallback, NULL ); + qglDebugMessageCallbackARB( ( GLDEBUGPROCARB )DebugCallback, NULL ); } if( r_debugContext.GetInteger() >= 2 ) { diff --git a/neo/sys/sdl/sdl_events.cpp b/neo/sys/sdl/sdl_events.cpp index 4ed83410..af229d40 100644 --- a/neo/sys/sdl/sdl_events.cpp +++ b/neo/sys/sdl/sdl_events.cpp @@ -891,7 +891,7 @@ sysEvent_t Sys_GetEvent() // SDL2 has no ev.key.keysym.unicode anymore.. but the scancode should work well enough for console if( ev.type == SDL_KEYDOWN ) // FIXME: don't complain if this was an ASCII char and the console is open? common->Warning( "unmapped SDL key %d scancode %d", ev.key.keysym.sym, ev.key.keysym.scancode ); - + return res_none; #else unsigned char uc = ev.key.keysym.unicode & 0xff; From bb2e41b5d7121ced5ef014ee47deedbe6c9f4357 Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Sat, 21 Sep 2013 22:12:42 +1000 Subject: [PATCH 11/17] Added r_useVirtualScreenResolution cvar to control whether to do 2D rendering at 640x480 and stretch to the current resolution (default), or render at the current resolution. --- neo/d3xp/PlayerView.cpp | 46 +++++++++++++++--------------- neo/framework/Common.cpp | 20 ++++++------- neo/framework/Console.cpp | 43 ++++++++++++++++++++++------ neo/framework/common_frame.cpp | 22 +++++++------- neo/renderer/GuiModel.cpp | 4 +-- neo/renderer/RenderSystem.h | 9 ++---- neo/renderer/RenderSystem_init.cpp | 29 +++++++++++++++++++ neo/renderer/tr_local.h | 2 ++ neo/swf/SWF_Render.cpp | 2 +- 9 files changed, 115 insertions(+), 62 deletions(-) diff --git a/neo/d3xp/PlayerView.cpp b/neo/d3xp/PlayerView.cpp index 55a85bf5..fbb26f61 100644 --- a/neo/d3xp/PlayerView.cpp +++ b/neo/d3xp/PlayerView.cpp @@ -511,7 +511,7 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM if( armorPulse > 0.0f && armorPulse < 1.0f ) { renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f - armorPulse ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, armorMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, armorMaterial ); } @@ -538,13 +538,13 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM if( alpha < 1.0f ) { renderSystem->SetColor4( ( player->health <= 0.0f ) ? MS2SEC( gameLocal.slow.time ) : lastDamageTime, 1.0f, 1.0f, ( player->health <= 0.0f ) ? 0.0f : alpha ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial ); } if( bfgVision ) { renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial ); } } @@ -561,7 +561,7 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM else { renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, mtr ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, mtr ); } } } @@ -656,7 +656,7 @@ void idPlayerView::ScreenFade() if( fadeColor[ 3 ] != 0.0f ) { renderSystem->SetColor4( fadeColor[ 0 ], fadeColor[ 1 ], fadeColor[ 2 ], fadeColor[ 3 ] ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, declManager->FindMaterial( "_white" ) ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, declManager->FindMaterial( "_white" ) ); } } @@ -1076,11 +1076,11 @@ void FullscreenFX_Helltime::AccumPass( const renderView_t* view ) if( clearAccumBuffer ) { clearAccumBuffer = false; - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, initMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, initMaterial ); } else { - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, captureMaterials[level] ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, captureMaterials[level] ); } } @@ -1095,7 +1095,7 @@ void FullscreenFX_Helltime::HighQuality() float t1 = 0.0f; renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, drawMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial ); } /* @@ -1201,11 +1201,11 @@ void FullscreenFX_Multiplayer::AccumPass( const renderView_t* view ) if( clearAccumBuffer ) { clearAccumBuffer = false; - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, initMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, initMaterial ); } else { - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, captureMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, captureMaterial ); } } @@ -1220,7 +1220,7 @@ void FullscreenFX_Multiplayer::HighQuality() float t1 = 0.0f; renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, drawMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial ); } /* @@ -1375,18 +1375,18 @@ void FullscreenFX_Warp::HighQuality() p.outer1.x = center.x + x1 * radius; p.outer1.y = center.y + y1 * radius; - p.outer1.z = p.outer1.x / ( float )SCREEN_WIDTH; - p.outer1.w = 1 - ( p.outer1.y / ( float )SCREEN_HEIGHT ); + p.outer1.z = p.outer1.x / ( float )renderSystem->GetVirtualWidth(); + p.outer1.w = 1 - ( p.outer1.y / ( float )renderSystem->GetVirtualHeight() ); p.outer2.x = center.x + x2 * radius; p.outer2.y = center.y + y2 * radius; - p.outer2.z = p.outer2.x / ( float )SCREEN_WIDTH; - p.outer2.w = 1 - ( p.outer2.y / ( float )SCREEN_HEIGHT ); + p.outer2.z = p.outer2.x / ( float )renderSystem->GetVirtualWidth(); + p.outer2.w = 1 - ( p.outer2.y / ( float )renderSystem->GetVirtualHeight() ); p.center.x = center.x; p.center.y = center.y; - p.center.z = p.center.x / ( float )SCREEN_WIDTH; - p.center.w = 1 - ( p.center.y / ( float )SCREEN_HEIGHT ); + p.center.z = p.center.x / ( float )renderSystem->GetVirtualWidth(); + p.center.w = 1 - ( p.center.y / ( float )renderSystem->GetVirtualHeight() ); // draw it DrawWarp( p, interp ); @@ -1436,7 +1436,7 @@ void FullscreenFX_EnviroSuit::HighQuality() float t0 = 1.0f; float s1 = 1.0f; float t1 = 0.0f; - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material ); } /* @@ -1527,7 +1527,7 @@ void FullscreenFX_DoubleVision::HighQuality() renderSystem->SetColor4( color.x, color.y, color.z, 1.0f ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material ); renderSystem->SetColor4( color.x, color.y, color.z, 0.5f ); s0 = 0.0f; @@ -1535,7 +1535,7 @@ void FullscreenFX_DoubleVision::HighQuality() s1 = ( 1.0 - shift ); t1 = 0.0f; - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material ); } /* @@ -1594,7 +1594,7 @@ void FullscreenFX_InfluenceVision::HighQuality() if( player->GetInfluenceMaterial() ) { renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, pct ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, player->GetInfluenceMaterial() ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, player->GetInfluenceMaterial() ); } else if( player->GetInfluenceEntity() == NULL ) { @@ -1712,7 +1712,7 @@ void FullscreenFX_Bloom::HighQuality() float yScale = 1.0f; renderSystem->SetColor4( alpha, alpha, alpha, 1 ); - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s1, t2 * yScale, s2, t1 * yScale, drawMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s1, t2 * yScale, s2, t1 * yScale, drawMaterial ); shift += currentIntensity; } @@ -1881,7 +1881,7 @@ void FullscreenFXManager::Blendback( float alpha ) float t0 = 1.0f; float s1 = 1.0f; float t1 = 0.0f; - renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, blendBackMaterial ); + renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, blendBackMaterial ); } } diff --git a/neo/framework/Common.cpp b/neo/framework/Common.cpp index df870e7d..cab5ee9b 100644 --- a/neo/framework/Common.cpp +++ b/neo/framework/Common.cpp @@ -858,22 +858,22 @@ void idCommonLocal::RenderSplash() const float sysAspect = sysWidth / sysHeight; const float splashAspect = 16.0f / 9.0f; const float adjustment = sysAspect / splashAspect; - const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )SCREEN_HEIGHT * 0.25f; - const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )SCREEN_WIDTH * 0.25f; + const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )renderSystem->GetVirtualHeight() * 0.25f; + const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )renderSystem->GetVirtualWidth() * 0.25f; if( barHeight > 0.0f ) { renderSystem->SetColor( colorBlack ); - renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); - renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - barHeight, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, renderSystem->GetVirtualHeight() - barHeight, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial ); } if( barWidth > 0.0f ) { renderSystem->SetColor( colorBlack ); - renderSystem->DrawStretchPic( 0, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); - renderSystem->DrawStretchPic( SCREEN_WIDTH - barWidth, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( renderSystem->GetVirtualWidth() - barWidth, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial ); } renderSystem->SetColor4( 1, 1, 1, 1 ); - renderSystem->DrawStretchPic( barWidth, barHeight, SCREEN_WIDTH - barWidth * 2.0f, SCREEN_HEIGHT - barHeight * 2.0f, 0, 0, 1, 1, splashScreen ); + renderSystem->DrawStretchPic( barWidth, barHeight, renderSystem->GetVirtualWidth() - barWidth * 2.0f, renderSystem->GetVirtualHeight() - barHeight * 2.0f, 0, 0, 1, 1, splashScreen ); const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu ); renderSystem->RenderCommandBuffers( cmd ); @@ -890,8 +890,8 @@ void idCommonLocal::RenderBink( const char* path ) const float sysHeight = renderSystem->GetHeight(); const float sysAspect = sysWidth / sysHeight; const float movieAspect = ( 16.0f / 9.0f ); - const float imageWidth = SCREEN_WIDTH * movieAspect / sysAspect; - const float chop = 0.5f * ( SCREEN_WIDTH - imageWidth ); + const float imageWidth = renderSystem->GetVirtualWidth() * movieAspect / sysAspect; + const float chop = 0.5f * ( renderSystem->GetVirtualWidth() - imageWidth ); idStr materialText; materialText.Format( "{ translucent { videoMap %s } }", path ); @@ -902,7 +902,7 @@ void idCommonLocal::RenderBink( const char* path ) while( Sys_Milliseconds() <= material->GetCinematicStartTime() + material->CinematicLength() ) { - renderSystem->DrawStretchPic( chop, 0, imageWidth, SCREEN_HEIGHT, 0, 0, 1, 1, material ); + renderSystem->DrawStretchPic( chop, 0, imageWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, material ); const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu ); renderSystem->RenderCommandBuffers( cmd ); Sys_GenerateEvents(); diff --git a/neo/framework/Console.cpp b/neo/framework/Console.cpp index ede705c5..f10d5a2d 100644 --- a/neo/framework/Console.cpp +++ b/neo/framework/Console.cpp @@ -70,6 +70,8 @@ public: void Clear(); private: + void Resize(); + void KeyDownEvent( int key ); void Linefeed(); @@ -138,6 +140,9 @@ private: idList< overlayText_t > overlayText; idList< idDebugGraph*> debugGraphs; + int lastVirtualScreenWidth; + int lastVirtualScreenHeight; + static idCVar con_speed; static idCVar con_notifyTime; static idCVar con_noPrint; @@ -356,9 +361,9 @@ void idConsoleLocal::Init() keyCatching = false; LOCALSAFE_LEFT = 32; - LOCALSAFE_RIGHT = 608; + LOCALSAFE_RIGHT = SCREEN_WIDTH - LOCALSAFE_LEFT; LOCALSAFE_TOP = 24; - LOCALSAFE_BOTTOM = 456; + LOCALSAFE_BOTTOM = SCREEN_HEIGHT - LOCALSAFE_TOP; LOCALSAFE_WIDTH = LOCALSAFE_RIGHT - LOCALSAFE_LEFT; LOCALSAFE_HEIGHT = LOCALSAFE_BOTTOM - LOCALSAFE_TOP; @@ -514,6 +519,24 @@ void idConsoleLocal::Dump( const char* fileName ) fileSystem->CloseFile( f ); } +/* +============== +idConsoleLocal::Resize +============== +*/ +void idConsoleLocal::Resize() +{ + if( renderSystem->GetVirtualWidth() == lastVirtualScreenWidth && renderSystem->GetVirtualHeight() == lastVirtualScreenHeight ) + return; + + lastVirtualScreenWidth = renderSystem->GetVirtualWidth(); + lastVirtualScreenHeight = renderSystem->GetVirtualHeight(); + LOCALSAFE_RIGHT = renderSystem->GetVirtualWidth() - LOCALSAFE_LEFT; + LOCALSAFE_BOTTOM = renderSystem->GetVirtualHeight() - LOCALSAFE_TOP; + LOCALSAFE_WIDTH = LOCALSAFE_RIGHT - LOCALSAFE_LEFT; + LOCALSAFE_HEIGHT = LOCALSAFE_BOTTOM - LOCALSAFE_TOP; +} + /* ================ idConsoleLocal::PageUp @@ -1036,7 +1059,7 @@ void idConsoleLocal::DrawInput() renderSystem->DrawSmallChar( LOCALSAFE_LEFT + 1 * SMALLCHAR_WIDTH, y, ']' ); - consoleField.Draw( LOCALSAFE_LEFT + 2 * SMALLCHAR_WIDTH, y, SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, true ); + consoleField.Draw( LOCALSAFE_LEFT + 2 * SMALLCHAR_WIDTH, y, renderSystem->GetVirtualWidth() - 3 * SMALLCHAR_WIDTH, true ); } @@ -1119,29 +1142,29 @@ void idConsoleLocal::DrawSolidConsole( float frac ) int lines; int currentColor; - lines = idMath::Ftoi( SCREEN_HEIGHT * frac ); + lines = idMath::Ftoi( renderSystem->GetVirtualHeight() * frac ); if( lines <= 0 ) { return; } - if( lines > SCREEN_HEIGHT ) + if( lines > renderSystem->GetVirtualHeight() ) { - lines = SCREEN_HEIGHT; + lines = renderSystem->GetVirtualHeight(); } // draw the background - y = frac * SCREEN_HEIGHT - 2; + y = frac * renderSystem->GetVirtualHeight() - 2; if( y < 1.0f ) { y = 0.0f; } else { - renderSystem->DrawFilled( idVec4( 0.0f, 0.0f, 0.0f, 0.75f ), 0, 0, SCREEN_WIDTH, y ); + renderSystem->DrawFilled( idVec4( 0.0f, 0.0f, 0.0f, 0.75f ), 0, 0, renderSystem->GetVirtualWidth(), y ); } - renderSystem->DrawFilled( colorCyan, 0, y, SCREEN_WIDTH, 2 ); + renderSystem->DrawFilled( colorCyan, 0, y, renderSystem->GetVirtualWidth(), 2 ); // draw the version number @@ -1233,6 +1256,8 @@ ForceFullScreen is used by the editor */ void idConsoleLocal::Draw( bool forceFullScreen ) { + Resize(); + if( forceFullScreen ) { // if we are forced full screen because of a disconnect, diff --git a/neo/framework/common_frame.cpp b/neo/framework/common_frame.cpp index ebe0b674..887074fb 100644 --- a/neo/framework/common_frame.cpp +++ b/neo/framework/common_frame.cpp @@ -233,7 +233,7 @@ void idCommonLocal::DrawWipeModel() float fade = ( float )( currentTime - wipeStartTime ) / ( wipeStopTime - wipeStartTime ); renderSystem->SetColor4( 1, 1, 1, fade ); - renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, wipeMaterial ); + renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, wipeMaterial ); } /* @@ -262,22 +262,22 @@ void idCommonLocal::Draw() const float sysAspect = sysWidth / sysHeight; const float doomAspect = 4.0f / 3.0f; const float adjustment = sysAspect / doomAspect; - const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )SCREEN_HEIGHT * 0.25f; - const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )SCREEN_WIDTH * 0.25f; + const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )renderSystem->GetVirtualHeight() * 0.25f; + const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )renderSystem->GetVirtualWidth() * 0.25f; if( barHeight > 0.0f ) { renderSystem->SetColor( colorBlack ); - renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); - renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - barHeight, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, renderSystem->GetVirtualHeight() - barHeight, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial ); } if( barWidth > 0.0f ) { renderSystem->SetColor( colorBlack ); - renderSystem->DrawStretchPic( 0, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); - renderSystem->DrawStretchPic( SCREEN_WIDTH - barWidth, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( renderSystem->GetVirtualWidth() - barWidth, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial ); } renderSystem->SetColor4( 1, 1, 1, 1 ); - renderSystem->DrawStretchPic( barWidth, barHeight, SCREEN_WIDTH - barWidth * 2.0f, SCREEN_HEIGHT - barHeight * 2.0f, 0, 0, 1, 1, doomClassicMaterial ); + renderSystem->DrawStretchPic( barWidth, barHeight, renderSystem->GetVirtualWidth() - barWidth * 2.0f, renderSystem->GetVirtualHeight() - barHeight * 2.0f, 0, 0, 1, 1, doomClassicMaterial ); } #endif // RB end @@ -287,7 +287,7 @@ void idCommonLocal::Draw() if( !gameDraw ) { renderSystem->SetColor( colorBlack ); - renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial ); } game->Shell_Render(); } @@ -314,7 +314,7 @@ void idCommonLocal::Draw() if( !gameDraw ) { renderSystem->SetColor( colorBlack ); - renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial ); } // save off the 2D drawing from the game @@ -326,7 +326,7 @@ void idCommonLocal::Draw() else { renderSystem->SetColor4( 0, 0, 0, 1 ); - renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); + renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial ); } { diff --git a/neo/renderer/GuiModel.cpp b/neo/renderer/GuiModel.cpp index a3cb8158..10707862 100644 --- a/neo/renderer/GuiModel.cpp +++ b/neo/renderer/GuiModel.cpp @@ -266,13 +266,13 @@ void idGuiModel::EmitFullScreen() viewDef->scissor.x2 = viewDef->viewport.x2 - viewDef->viewport.x1; viewDef->scissor.y2 = viewDef->viewport.y2 - viewDef->viewport.y1; - viewDef->projectionMatrix[0 * 4 + 0] = 2.0f / SCREEN_WIDTH; + viewDef->projectionMatrix[0 * 4 + 0] = 2.0f / renderSystem->GetVirtualWidth(); viewDef->projectionMatrix[0 * 4 + 1] = 0.0f; viewDef->projectionMatrix[0 * 4 + 2] = 0.0f; viewDef->projectionMatrix[0 * 4 + 3] = 0.0f; viewDef->projectionMatrix[1 * 4 + 0] = 0.0f; - viewDef->projectionMatrix[1 * 4 + 1] = -2.0f / SCREEN_HEIGHT; + viewDef->projectionMatrix[1 * 4 + 1] = -2.0f / renderSystem->GetVirtualHeight(); viewDef->projectionMatrix[1 * 4 + 2] = 0.0f; viewDef->projectionMatrix[1 * 4 + 3] = 0.0f; diff --git a/neo/renderer/RenderSystem.h b/neo/renderer/RenderSystem.h index af3a0e5e..224bc11d 100644 --- a/neo/renderer/RenderSystem.h +++ b/neo/renderer/RenderSystem.h @@ -167,12 +167,7 @@ const int BIGCHAR_HEIGHT = 16; const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; -const int TITLESAFE_LEFT = 32; -const int TITLESAFE_RIGHT = 608; -const int TITLESAFE_TOP = 24; -const int TITLESAFE_BOTTOM = 456; -const int TITLESAFE_WIDTH = TITLESAFE_RIGHT - TITLESAFE_LEFT; -const int TITLESAFE_HEIGHT = TITLESAFE_BOTTOM - TITLESAFE_TOP; +extern idCVar r_useVirtualScreenResolution; class idRenderWorld; @@ -201,6 +196,8 @@ public: virtual bool IsFullScreen() const = 0; virtual int GetWidth() const = 0; virtual int GetHeight() const = 0; + virtual int GetVirtualWidth() const = 0; + virtual int GetVirtualHeight() const = 0; // return w/h of a single pixel. This will be 1.0 for normal cases. // A side-by-side stereo 3D frame will have a pixel aspect of 0.5. diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index ee8c70a2..28ca434f 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -206,6 +206,7 @@ idCVar stereoRender_enable( "stereoRender_enable", "0", CVAR_INTEGER | CVAR_ARCH idCVar stereoRender_swapEyes( "stereoRender_swapEyes", "0", CVAR_BOOL | CVAR_ARCHIVE, "reverse eye adjustments" ); idCVar stereoRender_deGhost( "stereoRender_deGhost", "0.05", CVAR_FLOAT | CVAR_ARCHIVE, "subtract from opposite eye to reduce ghosting" ); +idCVar r_useVirtualScreenResolution( "r_useVirtualScreenResolution", "1", CVAR_RENDERER | CVAR_BOOL | CVAR_ARCHIVE, "do 2D rendering at 640x480 and stretch to the current resolution" ); // GL_ARB_multitexture PFNGLACTIVETEXTUREPROC qglActiveTextureARB; @@ -2753,6 +2754,34 @@ int idRenderSystemLocal::GetHeight() const return glConfig.nativeScreenHeight; } +/* +======================== +idRenderSystemLocal::GetVirtualWidth +======================== +*/ +int idRenderSystemLocal::GetVirtualWidth() const +{ + if( r_useVirtualScreenResolution.GetBool() ) + { + return SCREEN_WIDTH; + } + return glConfig.nativeScreenWidth; +} + +/* +======================== +idRenderSystemLocal::GetVirtualHeight +======================== +*/ +int idRenderSystemLocal::GetVirtualHeight() const +{ + if( r_useVirtualScreenResolution.GetBool() ) + { + return SCREEN_HEIGHT; + } + return glConfig.nativeScreenHeight; +} + /* ======================== idRenderSystemLocal::GetStereo3DMode diff --git a/neo/renderer/tr_local.h b/neo/renderer/tr_local.h index 610c835b..ac808782 100644 --- a/neo/renderer/tr_local.h +++ b/neo/renderer/tr_local.h @@ -729,6 +729,8 @@ public: virtual void EnableStereoScopicRendering( const stereo3DMode_t mode ) const; virtual int GetWidth() const; virtual int GetHeight() const; + virtual int GetVirtualWidth() const; + virtual int GetVirtualHeight() const; virtual float GetPixelAspect() const; virtual float GetPhysicalScreenWidthInCentimeters() const; virtual idRenderWorld* AllocRenderWorld(); diff --git a/neo/swf/SWF_Render.cpp b/neo/swf/SWF_Render.cpp index ed7174a5..45b2fcae 100644 --- a/neo/swf/SWF_Render.cpp +++ b/neo/swf/SWF_Render.cpp @@ -140,7 +140,7 @@ void idSWF::Render( idRenderSystem* gui, int time, bool isSplitscreen ) renderBorder = renderState.matrix.tx / scale; - scaleToVirtual.Set( ( float )SCREEN_WIDTH / sysWidth, ( float )SCREEN_HEIGHT / sysHeight ); + scaleToVirtual.Set( ( float )renderSystem->GetVirtualWidth() / sysWidth, ( float )renderSystem->GetVirtualHeight() / sysHeight ); RenderSprite( gui, mainspriteInstance, renderState, time, isSplitscreen ); From c925f05f8571e3df5046f426469e64938ad3cd17 Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Sun, 22 Sep 2013 13:50:49 +1000 Subject: [PATCH 12/17] Fixed warp effect not being centered when r_useVirtualScreenResolution was 0. --- neo/d3xp/PlayerView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/d3xp/PlayerView.cpp b/neo/d3xp/PlayerView.cpp index fbb26f61..ffbe7623 100644 --- a/neo/d3xp/PlayerView.cpp +++ b/neo/d3xp/PlayerView.cpp @@ -1357,8 +1357,8 @@ void FullscreenFX_Warp::HighQuality() interp = 0.7 * ( 1 - interp ) + 0.3 * ( interp ); // draw the warps - center.x = 320; - center.y = 240; + center.x = renderSystem->GetVirtualWidth() / 2.0f; + center.y = renderSystem->GetVirtualHeight() / 2.0f; radius = 200; for( float i = 0; i < 360; i += STEP ) From c603add210547cec96a014ffddf180167346f628 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Wed, 25 Sep 2013 09:09:09 +0200 Subject: [PATCH 13/17] Reverted fs_resourceLoadPriority. Be aware to keep this changed if you work on mods or standalones. fixes #59 Player starts out with Soul Cube in Doom 3 --- neo/framework/FileSystem.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/neo/framework/FileSystem.cpp b/neo/framework/FileSystem.cpp index 04b425f2..4e4d5677 100644 --- a/neo/framework/FileSystem.cpp +++ b/neo/framework/FileSystem.cpp @@ -301,21 +301,13 @@ idCVar idFileSystemLocal::fs_debugResources( "fs_debugResources", "0", CVAR_SYST idCVar idFileSystemLocal::fs_enableBGL( "fs_enableBGL", "0", CVAR_SYSTEM | CVAR_BOOL, "" ); idCVar idFileSystemLocal::fs_debugBGL( "fs_debugBGL", "0", CVAR_SYSTEM | CVAR_BOOL, "" ); idCVar idFileSystemLocal::fs_copyfiles( "fs_copyfiles", "0", CVAR_SYSTEM | CVAR_INIT | CVAR_BOOL, "Copy every file touched to fs_savepath" ); -// RB -#if defined(RETAIL) idCVar idFileSystemLocal::fs_buildResources( "fs_buildresources", "0", CVAR_SYSTEM | CVAR_BOOL | CVAR_INIT, "Copy every file touched to a resource file" ); -#else -idCVar idFileSystemLocal::fs_buildResources( "fs_buildresources", "1", CVAR_SYSTEM | CVAR_BOOL | CVAR_INIT, "Copy every file touched to a resource file" ); -#endif -// RB end idCVar idFileSystemLocal::fs_game( "fs_game", "", CVAR_SYSTEM | CVAR_INIT | CVAR_SERVERINFO, "mod path" ); idCVar idFileSystemLocal::fs_game_base( "fs_game_base", "", CVAR_SYSTEM | CVAR_INIT | CVAR_SERVERINFO, "alternate mod path, searched after the main fs_game path, before the basedir" ); idCVar fs_basepath( "fs_basepath", "", CVAR_SYSTEM | CVAR_INIT, "" ); idCVar fs_savepath( "fs_savepath", "", CVAR_SYSTEM | CVAR_INIT, "" ); -// RB: defaulted fs_resourceLoadPriority to 0 for better modding -idCVar fs_resourceLoadPriority( "fs_resourceLoadPriority", "0", CVAR_SYSTEM , "if 1, open requests will be honored from resource files first; if 0, the resource files are checked after normal search paths" ); -// RB end +idCVar fs_resourceLoadPriority( "fs_resourceLoadPriority", "1", CVAR_SYSTEM , "if 1, open requests will be honored from resource files first; if 0, the resource files are checked after normal search paths" ); idCVar fs_enableBackgroundCaching( "fs_enableBackgroundCaching", "1", CVAR_SYSTEM , "if 1 allow the 360 to precache game files in the background" ); idFileSystemLocal fileSystemLocal; From 9e7230de34af66bd9b6e35ac93802173d4d6be14 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Wed, 25 Sep 2013 09:19:21 +0200 Subject: [PATCH 14/17] Disabled tunnel vision. Fixes #33 Red screen flash on damage does not dissapear until load or full health --- neo/d3xp/PlayerView.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neo/d3xp/PlayerView.cpp b/neo/d3xp/PlayerView.cpp index ffbe7623..c45329fc 100644 --- a/neo/d3xp/PlayerView.cpp +++ b/neo/d3xp/PlayerView.cpp @@ -516,6 +516,10 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM // tunnel vision + /* + RB: disabled tunnel vision because the renderer converts colors set by SetColor4 to bytes which are clamped to [0,255] + so materials that want to access float values greater than 1 with parm0 - parm3 are always broken + float health = 0.0f; if( g_testHealthVision.GetFloat() != 0.0f ) { @@ -540,6 +544,8 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM renderSystem->SetColor4( ( player->health <= 0.0f ) ? MS2SEC( gameLocal.slow.time ) : lastDamageTime, 1.0f, 1.0f, ( player->health <= 0.0f ) ? 0.0f : alpha ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial ); } + RB end + */ if( bfgVision ) { From 2555b804d61e9e80aaadbeae6a5737c1fff4742a Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Sun, 29 Sep 2013 21:03:32 +1000 Subject: [PATCH 15/17] Fixed ERR_DROP resulting in a glitched screen with only the console accessible - show the main menu instead. --- neo/framework/Console.cpp | 17 +++++++++++++++++ neo/framework/Console.h | 3 +++ neo/framework/common_frame.cpp | 19 ++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/neo/framework/Console.cpp b/neo/framework/Console.cpp index f10d5a2d..b329170e 100644 --- a/neo/framework/Console.cpp +++ b/neo/framework/Console.cpp @@ -57,6 +57,7 @@ public: virtual bool ProcessEvent( const sysEvent_t* event, bool forceAccept ); virtual bool Active(); virtual void ClearNotifyLines(); + virtual void Open(); virtual void Close(); virtual void Print( const char* text ); virtual void Draw( bool forceFullScreen ); @@ -424,6 +425,22 @@ void idConsoleLocal::ClearNotifyLines() } } +/* +================ +idConsoleLocal::Open +================ +*/ +void idConsoleLocal::Open() +{ + if( keyCatching ) + return; // already open + + consoleField.ClearAutoComplete(); + consoleField.Clear(); + keyCatching = true; + SetDisplayFraction( 0.5f ); +} + /* ================ idConsoleLocal::Close diff --git a/neo/framework/Console.h b/neo/framework/Console.h index 7125c2c1..5734afba 100644 --- a/neo/framework/Console.h +++ b/neo/framework/Console.h @@ -76,6 +76,9 @@ public: // clear the timers on any recent prints that are displayed in the notify lines virtual void ClearNotifyLines() = 0; + // force console open + virtual void Open() = 0; + // some console commands, like timeDemo, will force the console closed before they start virtual void Close() = 0; diff --git a/neo/framework/common_frame.cpp b/neo/framework/common_frame.cpp index 887074fb..8a28b134 100644 --- a/neo/framework/common_frame.cpp +++ b/neo/framework/common_frame.cpp @@ -853,7 +853,24 @@ void idCommonLocal::Frame() } catch( idException& ) { - return; // an ERP_DROP was thrown + // an ERP_DROP was thrown +#if defined(USE_DOOMCLASSIC) + if( currentGame == DOOM_CLASSIC || currentGame == DOOM2_CLASSIC ) + { + return; + } +#endif + + // kill loading gui + delete loadGUI; + loadGUI = NULL; + + // drop back to main menu + LeaveGame(); + + // force the console open to show error messages + console->Open(); + return; } } From db626df0782f8e08ac84c103abe21470f7ee9441 Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Sat, 19 Oct 2013 16:43:39 +1000 Subject: [PATCH 16/17] Fixed the autosave dialog being stuck on the screen when starting a map (map or devmap) via the command line, or before selecting Doom 3. --- neo/framework/Common_load.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neo/framework/Common_load.cpp b/neo/framework/Common_load.cpp index 17388d30..ba839b82 100644 --- a/neo/framework/Common_load.cpp +++ b/neo/framework/Common_load.cpp @@ -1050,13 +1050,13 @@ HandleCommonErrors */ bool HandleCommonErrors( const idSaveLoadParms& parms ) { + common->Dialog().ShowSaveIndicator( false ); + if( parms.GetError() == SAVEGAME_E_NONE ) { return true; } - - common->Dialog().ShowSaveIndicator( false ); - + if( parms.GetError() & SAVEGAME_E_CORRUPTED ) { // This one might need to be handled by the game From a92a49dc2f4b8cdbbaed0e223a69fed35a73dbb2 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Wed, 30 Oct 2013 09:42:24 +0100 Subject: [PATCH 17/17] Astyle --- neo/framework/Common_load.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/framework/Common_load.cpp b/neo/framework/Common_load.cpp index ba839b82..60a7bac3 100644 --- a/neo/framework/Common_load.cpp +++ b/neo/framework/Common_load.cpp @@ -1051,12 +1051,12 @@ HandleCommonErrors bool HandleCommonErrors( const idSaveLoadParms& parms ) { common->Dialog().ShowSaveIndicator( false ); - + if( parms.GetError() == SAVEGAME_E_NONE ) { return true; } - + if( parms.GetError() & SAVEGAME_E_CORRUPTED ) { // This one might need to be handled by the game