diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h
index fd200c8d8..e4ca894ac 100644
--- a/src/g_statusbar/sbar.h
+++ b/src/g_statusbar/sbar.h
@@ -396,6 +396,7 @@ public:
 
 	void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY);
 	void DrawString(FFont *font, const FString &cstring, double x, double y, int flags, double Alpha, int translation, int spacing, bool monospaced, int shadowX, int shadowY);
+	void TransformRect(double &x, double &y, double &w, double &h, int flags = 0);
 	void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
 	void SetClipRect(double x, double y, double w, double h, int flags = 0);
 
diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp
index 6a3bdfd55..2514cd8d2 100644
--- a/src/g_statusbar/shared_sbar.cpp
+++ b/src/g_statusbar/shared_sbar.cpp
@@ -1592,7 +1592,8 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
 		DTA_ColorOverlay, (flags & DI_DIM) ? MAKEARGB(170, 0, 0, 0) : 0,
 		DTA_Alpha, Alpha,
 		DTA_AlphaChannel, !!(flags & DI_ALPHAMAPPED),
-		DTA_FillColor, (flags & DI_ALPHAMAPPED) ? 0 : -1);
+		DTA_FillColor, (flags & DI_ALPHAMAPPED) ? 0 : -1,
+		TAG_DONE);
 }
 
 
@@ -1846,7 +1847,7 @@ DEFINE_ACTION_FUNCTION(DBaseStatusBar, DrawString)
 //
 //============================================================================
 
-void DBaseStatusBar::Fill(PalEntry color, double x, double y, double w, double h, int flags)
+void DBaseStatusBar::TransformRect(double &x, double &y, double &w, double &h, int flags)
 {
 	// resolve auto-alignment before making any adjustments to the position values.
 	if (!(flags & DI_SCREEN_MANUAL_ALIGN))
@@ -1857,8 +1858,6 @@ void DBaseStatusBar::Fill(PalEntry color, double x, double y, double w, double h
 		else flags |= DI_SCREEN_TOP;
 	}
 
-	double Alpha = color.a * this->Alpha / 255;
-	if (Alpha <= 0) return;
 	x += drawOffset.X;
 	y += drawOffset.Y;
 
@@ -1896,10 +1895,42 @@ void DBaseStatusBar::Fill(PalEntry color, double x, double y, double w, double h
 		x += orgx;
 		y += orgy;
 	}
+}
+
+
+DEFINE_ACTION_FUNCTION(DBaseStatusBar, TransformRect)
+{
+	PARAM_SELF_PROLOGUE(DBaseStatusBar);
+	PARAM_FLOAT(x);
+	PARAM_FLOAT(y);
+	PARAM_FLOAT(w);
+	PARAM_FLOAT(h);
+	PARAM_INT_DEF(flags);
+	self->TransformRect(x, y, w, h, flags);
+	if (numret > 0) ret[0].SetFloat(x);
+	if (numret > 1) ret[1].SetFloat(y);
+	if (numret > 2) ret[2].SetFloat(w);
+	if (numret > 3) ret[3].SetFloat(h);
+	return MIN(4, numret);
+}
+
+//============================================================================
+//
+// draw stuff
+//
+//============================================================================
+
+void DBaseStatusBar::Fill(PalEntry color, double x, double y, double w, double h, int flags)
+{
+	double Alpha = color.a * this->Alpha / 255;
+	if (Alpha <= 0) return;
+
+	TransformRect(x, y, w, h, flags);
+
 	int x1 = int(x);
 	int y1 = int(y);
 	int ww = int(x + w - x1);	// account for scaling to non-integers. Truncating the values separately would fail for cases like 
-	int hh = int(y + h - y1); // y=3.5, height = 5.5 where adding both values gives a larger integer than adding the two integers.
+	int hh = int(y + h - y1);	// y=3.5, height = 5.5 where adding both values gives a larger integer than adding the two integers.
 
 	screen->Dim(color, float(Alpha), x1, y1, ww, hh);
 }
@@ -1927,57 +1958,11 @@ DEFINE_ACTION_FUNCTION(DBaseStatusBar, Fill)
 
 void DBaseStatusBar::SetClipRect(double x, double y, double w, double h, int flags)
 {
-	// resolve auto-alignment before making any adjustments to the position values.
-	if (!(flags & DI_SCREEN_MANUAL_ALIGN))
-	{
-		if (x < 0) flags |= DI_SCREEN_RIGHT;
-		else flags |= DI_SCREEN_LEFT;
-		if (y < 0) flags |= DI_SCREEN_BOTTOM;
-		else flags |= DI_SCREEN_TOP;
-	}
-
-	x += drawOffset.X;
-	y += drawOffset.Y;
-
-	if (!fullscreenOffsets)
-	{
-		StatusbarToRealCoords(x, y, w, h);
-	}
-	else
-	{
-		double orgx, orgy;
-
-		switch (flags & DI_SCREEN_HMASK)
-		{
-		default: orgx = 0; break;
-		case DI_SCREEN_HCENTER: orgx = screen->GetWidth() / 2; break;
-		case DI_SCREEN_RIGHT:   orgx = screen->GetWidth(); break;
-		}
-
-		switch (flags & DI_SCREEN_VMASK)
-		{
-		default: orgy = 0; break;
-		case DI_SCREEN_VCENTER: orgy = screen->GetHeight() / 2; break;
-		case DI_SCREEN_BOTTOM: orgy = screen->GetHeight(); break;
-		}
-
-		// move stuff in the top right corner a bit down if the fps counter is on.
-		if ((flags & (DI_SCREEN_HMASK | DI_SCREEN_VMASK)) == DI_SCREEN_RIGHT_TOP && vid_fps) y += 10;
-
-		DVector2 Scale = GetHUDScale();
-
-		x *= Scale.X;
-		y *= Scale.Y;
-		w *= Scale.X;
-		h *= Scale.Y;
-		x += orgx;
-		y += orgy;
-	}
+	TransformRect(x, y, w, h, flags);
 	int x1 = int(x);
 	int y1 = int(y);
 	int ww = int(x + w - x1);	// account for scaling to non-integers. Truncating the values separately would fail for cases like 
 	int hh = int(y + h - y1); // y=3.5, height = 5.5 where adding both values gives a larger integer than adding the two integers.
-
 	screen->SetClipRect(x1, y1, ww, hh);
 }
 
diff --git a/src/gi.cpp b/src/gi.cpp
index 77a8f9eec..467847092 100644
--- a/src/gi.cpp
+++ b/src/gi.cpp
@@ -352,8 +352,8 @@ void FMapInfoParser::ParseGameInfo()
 		GAMEINFOKEY_STRINGARRAY(PrecachedClasses, "precacheclasses", 0, false)
 		GAMEINFOKEY_STRINGARRAY(PrecachedTextures, "precachetextures", 0, false)
 		GAMEINFOKEY_SOUNDARRAY(PrecachedSounds, "precachesounds", 0, false)
-		GAMEINFOKEY_STRINGARRAY(EventHandlers, "addeventhandlers", 0, true)
-		GAMEINFOKEY_STRINGARRAY(EventHandlers, "eventhandlers", 0, false)
+		GAMEINFOKEY_STRINGARRAY(EventHandlers, "addeventhandlers", 0, false)
+		GAMEINFOKEY_STRINGARRAY(EventHandlers, "eventhandlers", 0, true)
 		GAMEINFOKEY_STRING(PauseSign, "pausesign")
 		GAMEINFOKEY_STRING(quitSound, "quitSound")
 		GAMEINFOKEY_STRING(BorderFlat, "borderFlat")
diff --git a/src/gl/system/gl_swframebuffer.h b/src/gl/system/gl_swframebuffer.h
index c37cf6bf0..0f9c0a0ef 100644
--- a/src/gl/system/gl_swframebuffer.h
+++ b/src/gl/system/gl_swframebuffer.h
@@ -454,7 +454,9 @@ private:
 	int TrueHeight;
 	int PixelDoubling;
 	float Gamma;
+#ifdef _WIN32
 	bool UpdatePending;
+#endif // _WIN32
 	bool NeedPalUpdate;
 	bool NeedGammaUpdate;
 	LTRBRect BlendingRect;
diff --git a/src/nodebuild_utility.cpp b/src/nodebuild_utility.cpp
index f27b95485..754e3519c 100644
--- a/src/nodebuild_utility.cpp
+++ b/src/nodebuild_utility.cpp
@@ -71,13 +71,7 @@ static const int PO_LINE_EXPLICIT = 5;
 angle_t FNodeBuilder::PointToAngle (fixed_t x, fixed_t y)
 {
 	const double rad2bam = double(1<<30) / M_PI;
-#if defined __APPLE__ && !defined __llvm__
-	// Work-around for vectorization issue in Apple's GCC 4.x
-	// See https://gcc.gnu.org/wiki/Math_Optimization_Flags for details
-	long double ang = atan2l (double(y), double(x));
-#else // !__APPLE__ || __llvm__
 	double ang = g_atan2 (double(y), double(x));
-#endif // __APPLE__ && !__llvm__
 	// Convert to signed first since negative double to unsigned is undefined.
 	return angle_t(int(ang * rad2bam)) << 1;
 }
diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm
index dec59f705..fd09c88f8 100644
--- a/src/posix/cocoa/i_video.mm
+++ b/src/posix/cocoa/i_video.mm
@@ -339,7 +339,7 @@ private:
 	PalEntry m_flashColor;
 	int      m_flashAmount;
 
-	bool     m_isUpdatePending;
+	bool     UpdatePending;
 
 	uint8_t* m_pixelBuffer;
 	GLuint   m_texture;
@@ -881,7 +881,7 @@ CocoaFrameBuffer::CocoaFrameBuffer(int width, int height, bool bgra, bool fullsc
 , m_gamma(0.0f)
 , m_needGammaUpdate(false)
 , m_flashAmount(0)
-, m_isUpdatePending(false)
+, UpdatePending(false)
 , m_pixelBuffer(new uint8_t[width * height * BYTES_PER_PIXEL])
 , m_texture(0)
 {
@@ -945,7 +945,7 @@ bool CocoaFrameBuffer::Lock(bool buffered)
 
 void CocoaFrameBuffer::Unlock()
 {
-	if (m_isUpdatePending && LockCount == 1)
+	if (UpdatePending && LockCount == 1)
 	{
 		Update();
 	}
@@ -962,7 +962,7 @@ void CocoaFrameBuffer::Update()
 	{
 		if (LockCount > 0)
 		{
-			m_isUpdatePending = true;
+			UpdatePending = true;
 			--LockCount;
 		}
 		return;
@@ -972,7 +972,7 @@ void CocoaFrameBuffer::Update()
 
 	Buffer = NULL;
 	LockCount = 0;
-	m_isUpdatePending = false;
+	UpdatePending = false;
 
 	BlitCycles.Reset();
 	FlipCycles.Reset();
@@ -1146,8 +1146,8 @@ void CocoaFrameBuffer::Flip()
 
 SDLGLFB::SDLGLFB(void*, const int width, const int height, int, int, const bool fullscreen, bool bgra)
 : DFrameBuffer(width, height, bgra)
-, m_lock(0)
-, m_isUpdatePending(false)
+, m_Lock(0)
+, UpdatePending(false)
 {
 	CGGammaValue gammaTable[GAMMA_TABLE_SIZE];
 	uint32_t actualChannelSize;
@@ -1176,7 +1176,7 @@ SDLGLFB::~SDLGLFB()
 
 bool SDLGLFB::Lock(bool buffered)
 {
-	m_lock++;
+	m_Lock++;
 
 	Buffer = MemBuffer;
 
@@ -1185,19 +1185,19 @@ bool SDLGLFB::Lock(bool buffered)
 
 void SDLGLFB::Unlock()
 {
-	if (m_isUpdatePending && 1 == m_lock)
+	if (UpdatePending && 1 == m_Lock)
 	{
 		Update();
 	}
-	else if (--m_lock <= 0)
+	else if (--m_Lock <= 0)
 	{
-		m_lock = 0;
+		m_Lock = 0;
 	}
 }
 
 bool SDLGLFB::IsLocked()
 {
-	return m_lock > 0;
+	return m_Lock > 0;
 }
 
 
@@ -1225,12 +1225,12 @@ void SDLGLFB::InitializeState()
 
 bool SDLGLFB::CanUpdate()
 {
-	if (m_lock != 1)
+	if (m_Lock != 1)
 	{
-		if (m_lock > 0)
+		if (m_Lock > 0)
 		{
-			m_isUpdatePending = true;
-			--m_lock;
+			UpdatePending = true;
+			--m_Lock;
 		}
 
 		return false;
diff --git a/src/posix/cocoa/sdlglvideo.h b/src/posix/cocoa/sdlglvideo.h
index b0076f11b..6fd5fd72a 100644
--- a/src/posix/cocoa/sdlglvideo.h
+++ b/src/posix/cocoa/sdlglvideo.h
@@ -66,8 +66,8 @@ public:
 	int GetClientHeight();
 
 protected:
-	int                 m_lock;
-	bool                m_isUpdatePending;
+	int                 m_Lock;
+	bool                UpdatePending;
 
 	static const uint32_t GAMMA_CHANNEL_SIZE = 256;
 	static const uint32_t GAMMA_CHANNEL_COUNT = 3;
diff --git a/src/r_data/renderstyle.cpp b/src/r_data/renderstyle.cpp
index 49628c881..987de82b9 100644
--- a/src/r_data/renderstyle.cpp
+++ b/src/r_data/renderstyle.cpp
@@ -42,9 +42,6 @@ CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)
 
 // Convert legacy render styles to flexible render styles.
 
-// Apple's GCC 4.0.1 apparently wants to initialize the AsDWORD member of FRenderStyle
-// rather than the struct before it, which goes against the standard.
-#ifndef __APPLE__
 FRenderStyle LegacyRenderStyles[STYLE_Count] =
 {
 	{ { STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 } },											/* STYLE_None */  
@@ -62,42 +59,6 @@ FRenderStyle LegacyRenderStyles[STYLE_Count] =
 	{ { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_ColorIsFixed } },							/* STYLE_AddStencil */
 	{ { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed } },		/* STYLE_AddShaded */
 };
-#else
-FRenderStyle LegacyRenderStyles[STYLE_Count];
-
-static const uint8_t Styles[STYLE_Count * 4] =
-{
-	STYLEOP_None, 		STYLEALPHA_Zero,	STYLEALPHA_Zero,	0,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_InvSrc,	STYLEF_Alpha1,
-	STYLEOP_Fuzz,		STYLEALPHA_Src,		STYLEALPHA_InvSrc,	0,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_InvSrc,	STYLEF_TransSoulsAlpha,
-	STYLEOP_FuzzOrAdd,	STYLEALPHA_Src,		STYLEALPHA_InvSrc,	0,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_InvSrc,	STYLEF_Alpha1 | STYLEF_ColorIsFixed,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_InvSrc,	0,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_One,		0,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_InvSrc,	STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_InvSrc,	STYLEF_ColorIsFixed,
-	STYLEOP_Shadow,		0,					0,					0,
-	STYLEOP_RevSub,		STYLEALPHA_Src,		STYLEALPHA_One,		0,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_One,		STYLEF_Alpha1 | STYLEF_ColorIsFixed,
-	STYLEOP_Add,		STYLEALPHA_Src,		STYLEALPHA_One,		STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
-};
-
-static struct LegacyInit
-{
-	LegacyInit()
-	{
-		for (int i = 0; i < STYLE_Count; ++i)
-		{
-			LegacyRenderStyles[i].BlendOp = Styles[i*4];
-			LegacyRenderStyles[i].SrcAlpha = Styles[i*4+1];
-			LegacyRenderStyles[i].DestAlpha = Styles[i*4+2];
-			LegacyRenderStyles[i].Flags = Styles[i*4+3];
-		}
-	}
-} DoLegacyInit;
-
-#endif
 
 double GetAlpha(int type, double alpha)
 {
diff --git a/wadsrc/static/zscript/statusbar/statusbar.txt b/wadsrc/static/zscript/statusbar/statusbar.txt
index 434d4bd6a..789e3cd8d 100644
--- a/wadsrc/static/zscript/statusbar/statusbar.txt
+++ b/wadsrc/static/zscript/statusbar/statusbar.txt
@@ -323,6 +323,7 @@ class BaseStatusBar native ui
 	native void DrawTexture(TextureID texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1));
 	native void DrawImage(String texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1));
 	native void DrawString(HUDFont font, String string, Vector2 pos, int flags = 0, int translation = Font.CR_UNTRANSLATED, double Alpha = 1., int wrapwidth = -1, int linespacing = 4);
+	native double, double, double, double TransformRect(double x, double y, double w, double h, int flags = 0);
 	native void Fill(Color col, double x, double y, double w, double h, int flags = 0);
 	native static String FormatNumber(int number, int minsize = 0, int maxsize = 0, int format = 0, String prefix = "");
 	native double, double, double, double StatusbarToRealCoords(double x, double y=0, double w=0, double h=0);
@@ -580,7 +581,7 @@ class BaseStatusBar native ui
 	//
 	//============================================================================
 
-	bool CheckDiplayName(String displayname)
+	bool CheckDisplayName(String displayname)
 	{
 		if (CPlayer == null) return false;
 		return displayname == PlayerPawn.GetPrintableDisplayName(CPlayer.mo.GetClass());