This one has been actually gleaned through a usenet post, but needs a wider coverage
Trying to use dwAlphaConst member of DDOVERLAYFX structure to specify overall overlay transparency results in E_INVALIDARG error
As explained here, there is a clever bug in the parameter checking logic that results in the API soundly rejecting any combination of dwAlphaConst and dwAlphaConstBitDepth, unless dwAlphaConst == 1 << dwAlphaConstBitDepth. This is not fixed as of WM 6 AKU4. Interestingly enough the actual value of dwAlphaConstBitDepth seems to be ... ignored, once the parameter check is done. The bit depth used is always 8 bit.
- The net result of this bug is that the allowed values for the dwAlphaConstBitDepth/dwAlphaConst and the resulting opacity are
1/2 - 0.78%
2/4 - 1.6%
3/8 - 3.1%
4/16 - 6.2%
5/32 - 12.5%
6/64 - 25%
7/128 - 50%
Not using DDOVER_ALPHACONSTOVERRIDE gives you of course 100% (opaque overlay). In my experience anything under 5 (12.5%) is too small to be useful, but YMMV. Here is the code snippet:
if ( fUseAlpha )
{
if ( dwAlpha > 8 ) // Bug in ddraw
dwAlpha = 8;
if ( dwAlpha < 8 )
{
dwUpdateFlags |= DDOVER_ALPHACONSTOVERRIDE;
ovfx.dwAlphaConst = 1 << dwAlpha;
ovfx.dwAlphaConstBitDepth = dwAlpha;
}
}