Improve blending with two fixed colors.

It's not right, but it's less bad.  Maybe there's a better way?

Improves Popolocrois and Lunar (battle) blending issues.
This commit is contained in:
Unknown W. Brackets 2013-05-01 00:55:30 -07:00
parent 29651c026b
commit 4009a37692

View File

@ -178,8 +178,19 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
didReportBlend = true;
DEBUG_LOG(HLE, "ERROR INVALID blendcolorstate: FixA=%06x FixB=%06x FuncA=%i FuncB=%i", gstate.getFixA(), gstate.getFixB(), gstate.getBlendFuncA(), gstate.getBlendFuncB());
glBlendFuncA = GL_ONE;
glBlendFuncB = GL_ONE;
// Let's approximate, at least.
int blendSumA = (fixA & 0xFF) + ((fixA >> 8) & 0xFF) + ((fixA >> 16) & 0xFF);
int blendSumB = (fixB & 0xFF) + ((fixB >> 8) & 0xFF) + ((fixB >> 16) & 0xFF);
if (blendSumA < 64 * 3 && blendSumB > 192 * 3) {
glBlendFuncA = GL_ZERO;
glBlendFuncB = GL_ONE;
} else if (blendSumA > 192 * 3 && blendSumB < 64 * 3) {
glBlendFuncA = GL_ONE;
glBlendFuncB = GL_ZERO;
} else {
glBlendFuncA = GL_ONE;
glBlendFuncB = GL_ONE;
}
}
}
// At this point, through all paths above, glBlendFuncA and glBlendFuncB will be set somehow.