I've got the formula working and the debugger is showing that I have the correct values each time. Trouble is, the transparency is not working.
What I'm trying to do is get a color fade dependent on the current and maximum HP. At 50% remaining HP, the text is yellow. At 0% remaining HP, the text is red. For values between these, the text fades from red to yellow as HP increases (it's white above 50%). To accomplish this, I have it so that the red text is drawn first. The yellow text is drawn on top and it's the yellow text that has varying opacity. Both versions of the text uses a 32-bit TGA image and a custom-made font of my own (which leaves out TrueType fonts). I'm using AlphaBlend to do the drawing in all cases. This means I need the "BlendFunction" struct, of which I have filled out. The red text is drawn normally at full opacity. The problem comes from the yellow text. If I directly set the "SourceConstantAlpha" to 153 (to simulate 30% HP remaining), the text is still drawn as if it still was at 255.
My question is, how do I get this fade effect without creating extra versions of the font for more colors? A simulation screenshot I made earlier shows what the effect should be like (note the bottom right corner).
Edit: never mind, I found the problem - it was a copy/paste mistake causing the text to yellow in both cases instead of a separate yellow and red one. It's now working as I expected it.