From cf1d94c9bb52d9c58c1cd338f5bbb74830997b4c Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@users.noreply.github.com>
Date: Sun, 18 Jun 2017 09:23:56 +0200
Subject: [PATCH] - fixed blood translation's alpha so that CreateTexBuffer can
 assume that all palette entries in translations are correct.

---
 src/gl/textures/gl_material.cpp | 21 +--------------------
 src/r_data/r_translate.cpp      |  2 +-
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp
index fb1ee3cda..f45a702b9 100644
--- a/src/gl/textures/gl_material.cpp
+++ b/src/gl/textures/gl_material.cpp
@@ -242,26 +242,7 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F
 	{
 		// When using translations everything must be mapped to the base palette.
 		// so use CopyTrueColorTranslated
-		PalEntry penew[256];
-		PalEntry *pal;
-
-		// Todo: Give all palettes proper alpha and make sure the software renderer can handle it.
-		PalEntry *ptrans = GLTranslationPalette::GetPalette(translation);
-		if (ptrans && !alphatrans)
-		{
-			for (int i = 1; i < 256; i++)
-			{
-				penew[i] = (ptrans[i] | 0xff000000);
-			}
-			penew[0] = 0;
-			pal = penew;
-		}
-		else if (ptrans)
-		{
-			pal = ptrans;
-		}
-
-		tex->CopyTrueColorTranslated(&bmp, exx, exx, 0, pal);
+		tex->CopyTrueColorTranslated(&bmp, exx, exx, 0, GLTranslationPalette::GetPalette(translation));
 		isTransparent = 0;
 		// This is not conclusive for setting the texture's transparency info.
 	}
diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp
index b069aa9f3..2b8849b68 100644
--- a/src/r_data/r_translate.cpp
+++ b/src/r_data/r_translate.cpp
@@ -757,7 +757,7 @@ int CreateBloodTranslation(PalEntry color)
 	for (i = 0; i < 256; i++)
 	{
 		int bright = MAX(MAX(GPalette.BaseColors[i].r, GPalette.BaseColors[i].g), GPalette.BaseColors[i].b);
-		PalEntry pe = PalEntry(color.r*bright/255, color.g*bright/255, color.b*bright/255);
+		PalEntry pe = PalEntry(255, color.r*bright/255, color.g*bright/255, color.b*bright/255);
 		int entry = ColorMatcher.Pick(pe.r, pe.g, pe.b);
 
 		trans->Palette[i] = pe;