From 033090b2c883f9f6df1de1555f1e0037ab06bd1f Mon Sep 17 00:00:00 2001
From: wolfy852 <wolfy852@hotmail.com>
Date: Thu, 31 Mar 2016 20:47:57 -0500
Subject: [PATCH 1/7] Remove p_fab.c from Code::Blocks project

---
 SRB2.cbp | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/SRB2.cbp b/SRB2.cbp
index 5a03955b8..43696ee2e 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -3293,23 +3293,6 @@ HW3SOUND for 3D hardware sound  support
 			<Option target="Debug Mingw64/DirectX" />
 			<Option target="Release Mingw64/DirectX" />
 		</Unit>
-		<Unit filename="src/p_fab.c">
-			<Option compilerVar="CC" />
-			<Option target="Debug Native/SDL" />
-			<Option target="Release Native/SDL" />
-			<Option target="Debug Mingw/SDL" />
-			<Option target="Release Mingw/SDL" />
-			<Option target="Debug Mingw/DirectX" />
-			<Option target="Release Mingw/DirectX" />
-			<Option target="Debug Any/Dummy" />
-			<Option target="Release Any/Dummy" />
-			<Option target="Debug Linux/SDL" />
-			<Option target="Release Linux/SDL" />
-			<Option target="Debug Mingw64/SDL" />
-			<Option target="Release Mingw64/SDL" />
-			<Option target="Debug Mingw64/DirectX" />
-			<Option target="Release Mingw64/DirectX" />
-		</Unit>
 		<Unit filename="src/p_floor.c">
 			<Option compilerVar="CC" />
 			<Option target="Debug Native/SDL" />

From aab5e656ea4d50e7bf2d8ac521711fcb6511e487 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Sat, 2 Apr 2016 17:01:58 +0100
Subject: [PATCH 2/7] removed unused "total" variable in P_GroupLines

---
 src/p_setup.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/p_setup.c b/src/p_setup.c
index a778469fb..f165aa1e2 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -1888,7 +1888,7 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum)
 //
 static void P_GroupLines(void)
 {
-	size_t i, j, total = 0;
+	size_t i, j;
 	line_t *li;
 	sector_t *sector;
 	subsector_t *ss = subsectors;
@@ -1922,14 +1922,10 @@ static void P_GroupLines(void)
 	// count number of lines in each sector
 	for (i = 0, li = lines; i < numlines; i++, li++)
 	{
-		total++;
 		li->frontsector->linecount++;
 
 		if (li->backsector && li->backsector != li->frontsector)
-		{
 			li->backsector->linecount++;
-			total++;
-		}
 	}
 
 	// allocate linebuffers for each sector

From cf89a5bb11a55929f7e987d4584d77f9e02192c1 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Sat, 2 Apr 2016 17:04:23 +0100
Subject: [PATCH 3/7] Removed obsolete PORTAL_LIMIT macro

---
 src/doomdef.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/doomdef.h b/src/doomdef.h
index c3a0bfa6e..88575ea7c 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -427,10 +427,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
 // None of these that are disabled in the normal build are guaranteed to work perfectly
 // Compile them at your own risk!
 
-///	Max recursive portal renders
-///	\note	obsoleted by cv_maxportals
-//#define PORTAL_LIMIT 8
-
 /// Kalaron/Eternity Engine slope code (SRB2CB ported)
 #define ESLOPE
 

From 5f3beb68992828cd4a82fc652a4dc740290d1af7 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Sat, 2 Apr 2016 20:09:00 +0100
Subject: [PATCH 4/7] Fix M_PI not being defined for Visual Studio

---
 src/doomdef.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/doomdef.h b/src/doomdef.h
index 88575ea7c..e6327998a 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -101,6 +101,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
 #include <math.h>
 
 #ifdef GETTEXT

From 1db51f5a23117c0750da916fa186dfae732b7358 Mon Sep 17 00:00:00 2001
From: Inuyasha <MattWCSTRFAN@gmail.com>
Date: Sun, 3 Apr 2016 19:49:27 -0700
Subject: [PATCH 5/7] doomed# 750 shouldn't ever spawn objects

---
 src/p_mobj.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/p_mobj.c b/src/p_mobj.c
index 4e60ad612..be1fd9a02 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -8557,6 +8557,9 @@ void P_SpawnMapThing(mapthing_t *mthing)
 		return;
 	}
 
+	else if (mthing->type == 750) // Slope vertex point (formerly chaos spawn)
+		return;
+
 	else if (mthing->type == 300 // Ring
 		|| mthing->type == 308 || mthing->type == 309 // Team Rings
 		|| mthing->type == 1706 // Nights Wing
@@ -8590,8 +8593,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
 
 	if (i == NUMMOBJTYPES)
 	{
-		if (mthing->type == 3328 // 3D Mode start Thing
-		 || mthing->type == 750) // Chaos mode spawn
+		if (mthing->type == 3328) // 3D Mode start Thing
 			return;
 		CONS_Alert(CONS_WARNING, M_GetText("Unknown thing type %d placed at (%d, %d)\n"), mthing->type, mthing->x, mthing->y);
 		i = MT_UNKNOWN;

From 7a369a5650796c007db66126eee1a3826df122f3 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Tue, 5 Apr 2016 12:39:53 +0100
Subject: [PATCH 6/7] Turns out boss thing types re-setting mthing->z is a
 left-over from 1.09.4 and older versions

Apparently bosses and players used to use options >> 5 instead of 4 for z heights, or so it seems
---
 src/p_mobj.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/p_mobj.c b/src/p_mobj.c
index be1fd9a02..42571a5c3 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -8901,6 +8901,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
 		const size_t mthingi = (size_t)(mthing - mapthings);
 
 		// Why does P_FindSpecialLineFromTag not work here?!?
+		// Monster Iestyn: tag lists haven't been initialised yet for the map, that's why
 		for (line = 0; line < numlines; line++)
 		{
 			if (lines[line].special == 9 && lines[line].tag == mthing->angle)
@@ -9050,10 +9051,6 @@ ML_NOCLIMB : Direction not controllable
 	{
 		if (mthing->options & MTF_OBJECTSPECIAL) // No egg trap for this boss
 			mobj->flags2 |= MF2_BOSSNOTRAP;
-
-		z = ss->sector->floorheight + ((mthing->options >> (ZSHIFT)) << FRACBITS);
-
-		mthing->z = (INT16)(z>>FRACBITS);
 	}
 
 	if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE) // Axis Points

From 69a58d836963b0cd1c8325fa3b3162c1418debe9 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Tue, 5 Apr 2016 15:33:55 +0100
Subject: [PATCH 7/7] Fix lighting parity between resolutions for sprites and
 FOFs

---
 src/r_segs.c   | 6 +++---
 src/r_things.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/r_segs.c b/src/r_segs.c
index 252f6face..0e2b9ea5c 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -198,7 +198,7 @@ static void R_DrawWallSplats(void)
 		// draw the columns
 		for (dc_x = x1; dc_x <= x2; dc_x++, spryscale += rw_scalestep)
 		{
-			pindex = spryscale>>LIGHTSCALESHIFT;
+			pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
 			if (pindex >= MAXLIGHTSCALE)
 				pindex = MAXLIGHTSCALE - 1;
 			dc_colormap = walllights[pindex];
@@ -942,7 +942,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
 						else
 							xwalllights = scalelight[lightnum];
 
-						pindex = spryscale>>LIGHTSCALESHIFT;
+						pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
 
 						if (pindex >=  MAXLIGHTSCALE)
 							pindex = MAXLIGHTSCALE-1;
@@ -1030,7 +1030,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
 			}
 
 			// calculate lighting
-			pindex = spryscale>>LIGHTSCALESHIFT;
+			pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
 
 			if (pindex >= MAXLIGHTSCALE)
 				pindex = MAXLIGHTSCALE - 1;
diff --git a/src/r_things.c b/src/r_things.c
index f4e5e07a1..5616c2224 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1013,7 +1013,7 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
 			if (!((thing->frame & (FF_FULLBRIGHT|FF_TRANSMASK) || thing->flags2 & MF2_SHADOW)
 				&& (!newsprite->extra_colormap || !newsprite->extra_colormap->fog)))
 			{
-				lindex = sprite->xscale>>(LIGHTSCALESHIFT);
+				lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT);
 
 				if (lindex >= MAXLIGHTSCALE)
 					lindex = MAXLIGHTSCALE-1;
@@ -1329,7 +1329,7 @@ static void R_ProjectSprite(mobj_t *thing)
 	else
 	{
 		// diminished light
-		lindex = xscale>>(LIGHTSCALESHIFT);
+		lindex = FixedMul(xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT);
 
 		if (lindex >= MAXLIGHTSCALE)
 			lindex = MAXLIGHTSCALE-1;