From 5c4247dd61492197995be0837af201d87e093ff4 Mon Sep 17 00:00:00 2001
From: toasterbabe <rollerorbital@gmail.com>
Date: Wed, 18 Oct 2017 13:58:16 +0100
Subject: [PATCH] Allow for the combination of NiGHTS and record attack HUD.

---
 src/st_stuff.c | 48 ++++++++++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/src/st_stuff.c b/src/st_stuff.c
index c3ce200f6..3f9ba1dee 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -787,6 +787,9 @@ static void ST_drawInput(void)
 
 	INT32 x = hudinfo[HUD_LIVESPIC].x, y = hudinfo[HUD_LIVESPIC].y;
 
+	if (stplyr->powers[pw_carry] == CR_NIGHTSMODE)
+		y -= 16;
+
 	// O backing
 	V_DrawFill(x, y-1, 16, 16, 20);
 	V_DrawFill(x, y+15, 16, 1, 29);
@@ -911,22 +914,23 @@ static void ST_drawInput(void)
 	drawbutt( 4,-3, BT_JUMP, 'J');
 	drawbutt(15,-3, BT_USE,  'S');
 
+	V_DrawFill(x+16+4, y+8, 21, 10, 20); // sundial backing
 	if (stplyr->mo)
 	{
 		UINT8 i, precision;
-		angle_t ang = (stplyr->mo->angle - R_PointToAngle(stplyr->mo->x, stplyr->mo->y))>>ANGLETOFINESHIFT;
+		angle_t ang = (stplyr->powers[pw_carry] == CR_NIGHTSMODE)
+		? (FixedAngle((stplyr->flyangle-90)<<FRACBITS)>>ANGLETOFINESHIFT)
+		: (stplyr->mo->angle - R_PointToAngle(stplyr->mo->x, stplyr->mo->y))>>ANGLETOFINESHIFT;
 		fixed_t xcomp = FINESINE(ang)>>13;
 		fixed_t ycomp = FINECOSINE(ang)>>14;
 		if (ycomp == 4)
 			ycomp = 3;
 
-		V_DrawFill(x+16+4, y+8, 21, 10, 20); // sundial backing
-
 		if (ycomp > 0)
 			V_DrawFill(x+16+13-xcomp, y+11-ycomp, 3, 3, accent); // point (behind)
 
 		precision = max(3, abs(xcomp));
-		for (i = 0; i < precision; i++)
+		for (i = 0; i < precision; i++) // line
 		{
 			V_DrawFill(x+16+14-(i*xcomp)/precision,
 				y+12-(i*ycomp)/precision,
@@ -942,21 +946,24 @@ static void ST_drawInput(void)
 	// text above
 	x -= 2;
 	y -= 13;
-	if (stplyr->pflags & PF_AUTOBRAKE)
+	if (!stplyr->powers[pw_carry] == CR_NIGHTSMODE)
 	{
-		V_DrawThinString(x, y,
-			((!stplyr->powers[pw_carry]
-			&& (stplyr->pflags & PF_APPLYAUTOBRAKE)
-			&& !(stplyr->cmd.sidemove || stplyr->cmd.forwardmove)
-			&& (stplyr->rmomx || stplyr->rmomy))
-			? 0 : V_GRAYMAP),
-			"AUTOBRAKE");
-		y -= 8;
-	}
-	if (stplyr->pflags & PF_ANALOGMODE)
-	{
-		V_DrawThinString(x, y, 0, "ANALOG");
-		y -= 8;
+		if (stplyr->pflags & PF_AUTOBRAKE)
+		{
+			V_DrawThinString(x, y,
+				((!stplyr->powers[pw_carry]
+				&& (stplyr->pflags & PF_APPLYAUTOBRAKE)
+				&& !(stplyr->cmd.sidemove || stplyr->cmd.forwardmove)
+				&& (stplyr->rmomx || stplyr->rmomy))
+				? 0 : V_GRAYMAP),
+				"AUTOBRAKE");
+			y -= 8;
+		}
+		if (stplyr->pflags & PF_ANALOGMODE)
+		{
+			V_DrawThinString(x, y, 0, "ANALOG");
+			y -= 8;
+		}
 	}
 	if (!demosynced) // should always be last, so it doesn't push anything else around
 		V_DrawThinString(x, y, ((leveltime & 2) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!");
@@ -2051,8 +2058,6 @@ static void ST_overlayDrawer(void)
 #endif
 			)
 				ST_drawLives();
-			else if (modeattacking)
-				ST_drawInput();
 		}
 	}
 
@@ -2274,6 +2279,9 @@ static void ST_overlayDrawer(void)
 		}
 	}
 
+	if (modeattacking)
+		ST_drawInput();
+
 	ST_drawDebugInfo();
 }