diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 33f74071..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} @@ -1148,7 +1197,7 @@ if(MSVC) ${EDITOR_SOUND_INCLUDES} ${EDITOR_SOUND_SOURCES}) endif() - list(APPEND RBDOOM3_INLCUDES + list(APPEND RBDOOM3_INCLUDES ${SYS_INCLUDES} ${WIN32_INCLUDES}) diff --git a/neo/d3xp/PlayerView.cpp b/neo/d3xp/PlayerView.cpp index 55a85bf5..c45329fc 100644 --- a/neo/d3xp/PlayerView.cpp +++ b/neo/d3xp/PlayerView.cpp @@ -511,11 +511,15 @@ 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 ); } // 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 ) { @@ -538,13 +542,15 @@ 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 ); } + RB end + */ 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 +567,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 +662,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 +1082,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 +1101,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 +1207,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 +1226,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 ); } /* @@ -1357,8 +1363,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 ) @@ -1375,18 +1381,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 +1442,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 +1533,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 +1541,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 +1600,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 +1718,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 +1887,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/Common_load.cpp b/neo/framework/Common_load.cpp index 17388d30..60a7bac3 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 diff --git a/neo/framework/Console.cpp b/neo/framework/Console.cpp index ede705c5..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 ); @@ -70,6 +71,8 @@ public: void Clear(); private: + void Resize(); + void KeyDownEvent( int key ); void Linefeed(); @@ -138,6 +141,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 +362,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; @@ -419,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 @@ -514,6 +536,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 +1076,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 +1159,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 +1273,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/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/FileSystem.cpp b/neo/framework/FileSystem.cpp index 64b132db..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; @@ -2996,36 +2988,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 diff --git a/neo/framework/common_frame.cpp b/neo/framework/common_frame.cpp index ebe0b674..8a28b134 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 ); } { @@ -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; } } 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() 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/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/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.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 66dfcefc..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; @@ -357,20 +358,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 /* ================== @@ -625,7 +627,7 @@ static void R_CheckPortableExtensions() if( r_debugContext.GetInteger() >= 1 ) { - qglDebugMessageCallbackARB( DebugCallback, NULL ); + qglDebugMessageCallbackARB( ( GLDEBUGPROCARB )DebugCallback, NULL ); } if( r_debugContext.GetInteger() >= 2 ) { @@ -786,7 +788,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 ); @@ -2752,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.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..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; @@ -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_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 ); 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 ); diff --git a/neo/sys/sdl/sdl_events.cpp b/neo/sys/sdl/sdl_events.cpp index 8764656a..af229d40 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 } }