shithub: cstory

Download patch

ref: b648268283ac1506c53305a6e9c829fe97c2b45e
parent: 3eca2d7cf3299e9e45b0f66ddb6b5c45c0966ce9
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Feb 21 16:01:16 EST 2019

Changed CortBox(2) col parameter from RGB to BGR

That's how it is in the original. Look up Microsoft's COLORREF.

--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -476,7 +476,8 @@
 
 unsigned long GetCortBoxColor(unsigned long col)
 {
-	return ((col & 0xFF) << 16) | (col & 0xFF00) | ((col & 0xFF0000) >> 16);
+	// This comes in BGR, and goes out BGR
+	return col;
 }
 
 void CortBox(RECT *rect, uint32_t col)
@@ -485,7 +486,10 @@
 	SDL_Rect destRect = RectToSDLRectScaled(rect);
 	
 	//Set colour and draw
-	SDL_SetRenderDrawColor(gRenderer, (col & 0xFF0000) >> 16, (col & 0x00FF00) >> 8, col & 0x0000FF, 0xFF);
+	const unsigned char col_red = col & 0x0000FF;
+	const unsigned char col_green = (col & 0x00FF00) >> 8;
+	const unsigned char col_blue = (col & 0xFF0000) >> 16;
+	SDL_SetRenderDrawColor(gRenderer, col_red, col_green, col_blue, 0xFF);
 	SDL_RenderFillRect(gRenderer, &destRect);
 }
 
@@ -494,9 +498,10 @@
 	//Get rect
 	SDL_Rect destRect = RectToSDLRectScaled(rect);
 
-	const unsigned char col_red = (col & 0xFF0000) >> 16;
+	//Set colour and draw
+	const unsigned char col_red = col & 0x0000FF;
 	const unsigned char col_green = (col & 0x00FF00) >> 8;
-	const unsigned char col_blue = col & 0x0000FF;
+	const unsigned char col_blue = (col & 0xFF0000) >> 16;
 	SDL_FillRect(surf[surf_no].surface, &destRect, SDL_MapRGB(surf[surf_no].surface->format, col_red, col_green, col_blue));
 	surf[surf_no].needs_updating = true;
 }