diff --git a/changelog.txt b/changelog.txt index a7a50c9..f6c0551 100644 --- a/changelog.txt +++ b/changelog.txt @@ -137,6 +137,8 @@ chg: r_fullbright is now latched again chg: negative r_swapInterval values will request adaptive V-Sync when using an OpenGL back-end +fix: r_detailTextures 0 would mess up shaders where "detail" was used in a stage that isn't the last one + fix: dynamic lights could incorrectly stop applying to moving entities (e.g. cpm25 elevator) fix: crash due to lack of memory for the sound system diff --git a/code/renderer/tr_shader.cpp b/code/renderer/tr_shader.cpp index 0f4bbd0..17a2360 100644 --- a/code/renderer/tr_shader.cpp +++ b/code/renderer/tr_shader.cpp @@ -2027,10 +2027,10 @@ static shader_t* FinishShader() // ditch this stage if it's detail and detail textures are disabled // if ( pStage->isDetail && !r_detailTextures->integer ) { - if ( stage < ( MAX_SHADER_STAGES - 1 ) ) { - memmove( pStage, pStage + 1, sizeof( *pStage ) * ( MAX_SHADER_STAGES - stage - 1 ) ); - Com_Memset( pStage + 1, 0, sizeof( *pStage ) ); - } + const int toMove = MAX_SHADER_STAGES - stage - 1; + memmove( pStage, pStage + 1, sizeof( *pStage ) * toMove ); + Com_Memset( &stages[MAX_SHADER_STAGES - 1], 0, sizeof( *pStage ) ); + stage--; continue; }