From ef886e4b80c6d91950e74fc4eb8cfccfc6ac2272 Mon Sep 17 00:00:00 2001
From: toaster <rollerorbital@gmail.com>
Date: Mon, 4 Nov 2019 13:11:04 +0000
Subject: [PATCH] Fix TC_DASHMODE and associated not being applied in GL.
 (Won't conflict with md3 branch because these lines weren't modified there!)

---
 src/hardware/hw_main.c |  9 +++++++++
 src/hardware/hw_md2.c  | 19 ++++++++++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index f2658707db..4b4011eeaa 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -5755,6 +5755,15 @@ static void HWR_ProjectSprite(mobj_t *thing)
 		// New colormap stuff for skins Tails 06-07-2002
 		if (thing->colorized)
 			vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE);
+		else if (thing->player && thing->player->dashmode >= DASHMODE_THRESHOLD
+			&& (thing->player->charflags & SF_DASHMODE)
+			&& ((leveltime/2) & 1))
+		{
+			if (thing->player->charflags & SF_MACHINE)
+				vis->colormap = R_GetTranslationColormap(TC_DASHMODE, 0, GTC_CACHE);
+			else
+				vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE);
+		}
 		else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
 		{
 			size_t skinnum = (skin_t*)thing->skin-skins;
diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c
index b847fdbc35..490ed318a4 100644
--- a/src/hardware/hw_md2.c
+++ b/src/hardware/hw_md2.c
@@ -1397,16 +1397,21 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
 				}
 				else if (spr->mobj->color)
 				{
-					if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
+					if (spr->mobj->colorized)
+						skinnum = TC_RAINBOW;
+					else if (spr->mobj->player && spr->mobj->player->dashmode >= DASHMODE_THRESHOLD
+						&& (spr->mobj->player->charflags & SF_DASHMODE)
+						&& ((leveltime/2) & 1))
 					{
-						if (spr->mobj->colorized)
-							skinnum = TC_RAINBOW;
+						if (spr->mobj->player->charflags & SF_MACHINE)
+							skinnum = TC_DASHMODE;
 						else
-						{
-							skinnum = (INT32)((skin_t*)spr->mobj->skin-skins);
-						}
+							skinnum = TC_RAINBOW;
 					}
-					else skinnum = TC_DEFAULT;
+					else if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
+						skinnum = (INT32)((skin_t*)spr->mobj->skin-skins);
+					else
+						skinnum = TC_DEFAULT;
 				}
 				HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color);
 			}
-- 
GitLab