Skip to content

Commit 96bd679

Browse files
committed
Fix undying alpha textures
1 parent 7cb96da commit 96bd679

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

Inc/D3D9Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
#define UTGLR_NO_LODMESH 1
8989
#define UTGLR_NO_VECTOR_MEM 1
9090
#define UTGLR_HAS_DARK_LIGHT 1
91-
//#define UTGLR_USES_ALPHABLEND 1
91+
#define UTGLR_NO_PALETTE_ALPHA_FIX 1
9292
#else
9393
#define UTGLR_VALID_BUILD_CONFIG 0
9494
#endif

Inc/D3D9RenderDevice.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,14 @@ static inline DWORD getBasePolyFlags(AActor* actor) {
335335
else if (actor->Style == STY_Modulated) {
336336
basePolyFlags |= PF_Modulated;
337337
}
338+
#if UNDYING
339+
else if (actor->Style == STY_AlphaBlend) {
340+
basePolyFlags |= PF_Modulated | PF_Translucent;
341+
}
342+
else if (actor->Style == STY_AlphaBlendZ) {
343+
basePolyFlags |= PF_Modulated | PF_Translucent | PF_Occlude;
344+
}
345+
#endif
338346

339347
if (actor->bNoSmooth) basePolyFlags |= PF_NoSmooth;
340348
if (actor->bSelected) basePolyFlags |= PF_Selected;
@@ -1101,6 +1109,18 @@ class UD3D9RenderDevice : public RENDERDEVICE_SUPER {
11011109
PolyFlags &= ~PF_Masked;
11021110
}
11031111

1112+
#if UNDYING
1113+
// Clear the unused NoPass flag, which == PF_AlphaBlend
1114+
static_assert(PF_NoPass == PF_AlphaBlend);
1115+
PolyFlags &= ~PF_NoPass;
1116+
if (PolyFlags & PF_Translucent && PolyFlags & PF_Modulated) {
1117+
// Translucent + Modulated indicates AlphaBlend
1118+
PolyFlags |= PF_AlphaBlend;
1119+
// Don't act as these anymore
1120+
PolyFlags &= ~(PF_Translucent | PF_Modulated);
1121+
}
1122+
#endif
1123+
11041124
//Only check relevant blend flags
11051125
DWORD blendFlags = PolyFlags & (
11061126
PF_Translucent |

Src/D3D9Render.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ void UD3D9Render::drawFrame(FSceneNode* frame, UD3D9RenderDevice* d3d9Dev, Model
571571
}
572572
for (AActor* actor : visibleActors) {
573573
UBOOL bTranslucent = actor->Style == STY_Translucent;
574-
#if RUNE
574+
#if RUNE || UNDYING
575575
bTranslucent |= actor->Style == STY_AlphaBlend;
576576
#endif
577577
if ((pass == RPASS::NONSOLID && bTranslucent) || (pass == RPASS::SOLID && !bTranslucent)) {

sdks

0 commit comments

Comments
 (0)