diff --git a/changelog.txt b/changelog.txt index 7d3ea1e..2366060 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,8 @@ DD Mmm 17 - 1.49 +fix: broken rendering when the 2nd stage of a collapsed shader stage pair had non-white colors + fix: shader stages using "wave" were not animated when the server time was too large add: con_scaleMode specifies the console text scaling mode @@ -15,7 +17,7 @@ fix: the pukka3tourney2 slime wasn't green with r_vertexLight 1 fix: the ct3ctf1 grate near quad was getting picmipped when it wasn't supposed to be fix: improved the player name look-up behavior for these commands: kick, banUser, dumpuser - if 2 players had the same name, it would just pick the first one (lowest client number) + if 2 players had the same name, it would just pick the first one (lowest client number) fix: multi-view mouse input sensitivity is now the same as in the UI for CPMA 1.50 diff --git a/code/renderer/tr_gl2.cpp b/code/renderer/tr_gl2.cpp index 0da17ed..33f9159 100644 --- a/code/renderer/tr_gl2.cpp +++ b/code/renderer/tr_gl2.cpp @@ -185,7 +185,7 @@ static void GL2_DynLights_MultitextureStage( int stage ) GL_TexEnv( pStage->mtEnv ); R_BindAnimatedImage( &pStage->bundle ); - stageVars_t svarsMT; + static stageVars_t svarsMT; // this is a huge struct R_ComputeTexCoords( pStage, svarsMT ); qglEnableClientState( GL_TEXTURE_COORD_ARRAY ); qglTexCoordPointer( 2, GL_FLOAT, 0, svarsMT.texcoords ); diff --git a/code/renderer/tr_shader.cpp b/code/renderer/tr_shader.cpp index 0f5f1bf..c08ce37 100644 --- a/code/renderer/tr_shader.cpp +++ b/code/renderer/tr_shader.cpp @@ -1697,7 +1697,6 @@ static void CollapseStages() int numStages = shader.numStages; shaderStage_t* aStages = &stages[0]; -#define CollapseSuccess { aStages[0].mtStages = 1; aStages += 2; numStages -= 2; continue; } #define CollapseFailure { ++aStages; --numStages; continue; } while (numStages >= 2) { @@ -1723,13 +1722,30 @@ static void CollapseStages() if ( collapse[i].blendA == -1 ) CollapseFailure; + // Check that all colors are pure white on the second stage + // because the stage iterator can't currently specify + // another color array. + // Example shader broken without this extra test: + // "textures/sfx/diamond2cjumppad" + // The ring pulses in and out instead of only out. + static stageVars_t svarsMT; + R_ComputeColors( &aStages[1], svarsMT ); + const int* colors = (const int*)svarsMT.colors; + const int colorCount = tess.numVertexes; + int allOnes = -1; + for ( int c = 0; c < colorCount; ++c ) + allOnes &= colors[c]; + if ( allOnes != -1 ) + CollapseFailure; + aStages[0].stateBits &= ~GLS_BLEND_BITS; aStages[0].stateBits |= collapse[i].multitextureBlend; aStages[1].mtEnv = collapse[i].multitextureEnv; - CollapseSuccess; + aStages[0].mtStages = 1; + aStages += 2; + numStages -= 2; } -#undef CollapseSuccess #undef CollapseFailure }