I think I'm seeing a bug with the new BltFast pixel shaders in 2.03, a regression from 2.01b (last version I was using).
Old code (2.01b):
- Code:
RECT rcBar = { 0, cy, cx, cy<<1 };
GDBLTFASTFX gbffx;
gbffx.dwColorizeColor = RGB( 255, 0, 0 );
gbffx.dwColorizeOpacity = static_cast<int>( 255 - ( 255 * m_player.m_shieldStrength ) );
gbffx.dwOpacity = c_dwHUDOpacity;
hr = surface.BltFast( x, y, &m_surfHealthBar, &rcBar, GDBLTFAST_KEYSRC | GDBLTFAST_COLORIZE | GDBLTFAST_COLORIZEOPACITY | GDBLTFAST_OPACITY, &gbffx );
Assert( SUCCEEDED(hr) );
This colorizes a shield strength indicator from blue (color in the surface) to red. m_shieldStrength varies from 0 to 1. At 1 the colorization effect (dwColorizeOpacity) should be off; at 0 the colorization effect should be full.
New code (2.03):
- Code:
RECT rcBar = { 0, cy, cx, cy<<1 };
GDBLTFASTFX gbffx;
gbffx.dwFXcolor1 = RGB( 255, 0, 0 );
gbffx.dwFXopacity = static_cast<int>( 255 - ( 255 * m_player.m_shieldStrength ) );
gbffx.dwOpacity = c_dwHUDOpacity;
hr = surface.BltFast( x, y, &m_surfHealthBar, &rcBar, GDBLTFAST_KEYSRC | GDBLTFASTFX_COLORIZE | GDBLTFAST_FXOPACITY | GDBLTFAST_OPACITY , &gbffx );
Assert( SUCCEEDED(hr) );
Now, one of two things happens. If dwFXopacity is 0 then the BLT is fully transparent! If dwFXopacity is > 0, then the call to BltFast fails with E_INVALIDARG.
Everything else in my game converted flawlessly.
Silly error on my part, or a glitch in GD2.03?