diff -r 3293d23b602a planet/Graphics.c4g/Logo.png
Binary file planet/Graphics.c4g/Logo.png has changed
diff -r 3293d23b602a planet/System.c4g/Colors.c
--- a/planet/System.c4g/Colors.c	Sat Aug 15 12:22:52 2009 -0400
+++ b/planet/System.c4g/Colors.c	Sun Aug 23 16:56:00 2009 -0400
@@ -10,7 +10,7 @@
 global func HSL(int h, int s, int l)  { return HSL2RGB(RGB(h,s,l)); }
 global func HSLa(int h, int s, int l, int a) { return  HSL2RGB(RGB(h,s,l)) | (a & 255)<<24; }
 
-global func RGB(int r, int g, int b) { return (r & 255)<<16 | (g & 255)<<8 | (b & 255); }
+global func RGB(int r, int g, int b) { return (255 << 24) | (r & 255)<<16 | (g & 255)<<8 | (b & 255); }
 global func RGBa (int r, int g, int b, int a) { return (a & 255)<<24 | (r & 255)<<16 | (g & 255)<<8 | (b & 255); }
 
 global func GetRGBaValue(int val, int sel) { return (val>>((3-sel)*8)&255); }
diff -r 3293d23b602a src/control/C4PlayerInfo.cpp
--- a/src/control/C4PlayerInfo.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/control/C4PlayerInfo.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -48,7 +48,7 @@
 	pRes = NULL;
 	ResCore.Clear();
 	// default fields
-	dwColor = dwOriginalColor = 0xffffff;
+	dwColor = dwOriginalColor = 0xffffffff;
 	dwAlternateColor = 0;
 	dwFlags = 0;
 	iID = idSavegamePlayer = idTeam = 0;
@@ -91,8 +91,8 @@
 	eType = C4PT_User;
 	sName = C4P.PrefName;
 	this->szFilename = szFilename;
-	dwColor = dwOriginalColor = C4P.PrefColorDw & 0xffffff; // ignore alpha
-	dwAlternateColor = C4P.PrefColor2Dw & 0xffffff; // ignore alpha
+	dwColor = dwOriginalColor = 0xff000000 | (C4P.PrefColorDw & 0xffffff); // ignore alpha
+	dwAlternateColor = 0xff000000 | (C4P.PrefColor2Dw & 0xffffff); // ignore alpha
 	// network: ressource (not for replays, because everyone has the player files there...)
 	if (::Network.isEnabled() && !Game.C4S.Head.Replay)
 		{
@@ -118,7 +118,7 @@
 	Clear();
 	// set parameters
 	eType = C4PT_Script;
-	dwColor = dwOriginalColor = dwColor & 0xffffff; // ignore alpha
+	dwColor = dwOriginalColor = 0xff000000 | (dwColor & 0xffffff); // ignore alpha
 	dwAlternateColor = 0;
 	this->sName.CopyValidated(szName);
 	idExtraData = idExtra;
diff -r 3293d23b602a src/control/C4PlayerInfo.h
--- a/src/control/C4PlayerInfo.h	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/control/C4PlayerInfo.h	Sun Aug 23 16:56:00 2009 -0400
@@ -105,8 +105,8 @@
 
 	public:
 		C4PlayerInfo()                           // construct empty
-			:  dwFlags(0), iID(0), pRes(0), szFilename(0), dwColor(0xffffff), sLeagueAccount(""),
-			dwOriginalColor(0xffffff), dwAlternateColor(0), idSavegamePlayer(0), idTeam(0),
+			:  dwFlags(0), iID(0), pRes(0), szFilename(0), dwColor(0xffffffff), sLeagueAccount(""),
+			dwOriginalColor(0xffffffff), dwAlternateColor(0), idSavegamePlayer(0), idTeam(0),
 			iLeagueScore(0), iLeagueRank(0), iLeagueRankSymbol(0), iLeagueProjectedGain(-1),
 			iInGameNumber(-1), iInGameJoinFrame(-1), iInGamePartFrame(-1), eType(C4PT_User), idExtraData(C4ID_None) { }
 
diff -r 3293d23b602a src/editor/C4EditCursor.cpp
--- a/src/editor/C4EditCursor.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/editor/C4EditCursor.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -413,7 +413,7 @@
 			{
 			uint32_t dwOldMod = cobj->ColorMod;
 			uint32_t dwOldBlitMode = cobj->BlitMode;
-			cobj->ColorMod = 0xffffff;
+			cobj->ColorMod = 0xffffffff;
 			cobj->BlitMode = C4GFXBLIT_CLRSFC_MOD2 | C4GFXBLIT_ADDITIVE;
 			cobj->Draw(cgo,-1);
 			cobj->DrawTopFace(cgo, -1);
@@ -441,21 +441,21 @@
 
 	if (!cgo.Surface) return;
 
-	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.top,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.left+1,frame.top,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.top+1,0xFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.top,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.left+1,frame.top,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.top+1,0xFFFFFFFF);
 
-	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-1,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.left+1,frame.bottom-1,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-2,0xFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-1,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.left+1,frame.bottom-1,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-2,0xFFFFFFFF);
 
-	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.top,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.right-2,frame.top,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.top+1,0xFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.top,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.right-2,frame.top,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.top+1,0xFFFFFFFF);
 
-	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-1,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.right-2,frame.bottom-1,0xFFFFFF);
-	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-2,0xFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-1,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.right-2,frame.bottom-1,0xFFFFFFFF);
+	Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-2,0xFFFFFFFF);
 	}
 
 
diff -r 3293d23b602a src/game/landscape/C4Landscape.cpp
--- a/src/game/landscape/C4Landscape.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/game/landscape/C4Landscape.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -2491,7 +2491,7 @@
 	// everything clipped?
 	if (To.Wdt<=0 || To.Hgt<=0) return true;
 	if (!Surface32->Lock()) return false;
-	Surface32->ClearBoxDw(To.x, To.y, To.Wdt, To.Hgt);
+	Surface32->ClearBoxDw(To.x, To.y, To.Wdt, To.Hgt); // TODO: Why do we clear here when we set new pixel values for all pixels in that region anyway?
 
 	if(lpDDraw->IsShaderific() && Config.Graphics.HighResLandscape)
 		{
@@ -2774,8 +2774,8 @@
 				= Surface8->pPal->Colors[(MatTex2PixCol(tex)+IFT)*3+rgb]
 				= dwPix >> ((2-rgb) * 8);
 		// alpha
-		Surface8->pPal->Alpha[MatTex2PixCol(tex)] = 0;
-		Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = 0;
+		Surface8->pPal->Alpha[MatTex2PixCol(tex)] = 0xff;
+		Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = 0xff;
 		}
 	// success
 	return true;
diff -r 3293d23b602a src/game/landscape/C4Particles.cpp
--- a/src/game/landscape/C4Particles.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/game/landscape/C4Particles.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -568,7 +568,7 @@
 	// set kind - ydir is unused anyway; set last kind reeeaaally seldom
 	pPrt->ydir=(float) SafeRandom(15)+SafeRandom(300)/299;
 	// set color
-	if (!pPrt->b) pPrt->b=0xff4b4b4b; else pPrt->b|=0xff000000;
+	if (!pPrt->b) pPrt->b=0x004b4b4b; else pPrt->b&=~0xff000000;
 	// always OK
 	return true;
 	}
@@ -584,14 +584,14 @@
 		// decrease init-time
 		pPrt->life-=0x010000;
 		// increase color value
-		pPrt->b-=0x10000000;
+		pPrt->b+=0x10000000;
 		// if full-grown, adjust to lifetime
 		if (!(pPrt->life&0x7fff0000))
-			pPrt->b=(pPrt->b&0xffffff)|((255-pPrt->life)<<24);
+			pPrt->b=(pPrt->b&0xffffff)|((pPrt->life)<<24);
 		}
 	// color change
 	DWORD dwClr = pPrt->b;
-	pPrt->b = (LightenClrBy(dwClr, 1)&0xffffff) | Min<int32_t>((dwClr>>24)+1, 255)<<24;
+	pPrt->b = (LightenClrBy(dwClr, 1)&0xffffff) | Min<int32_t>((dwClr>>24)-1, 255)<<24;
 	// wind to float
 	if (!(pPrt->b%12) || fBuilding)
 		{
@@ -645,7 +645,7 @@
 		// init lifetime as phase
 		pPrt->life=SafeRandom(pPrt->pDef->Length);
 	// default color
-	if (!pPrt->b) pPrt->b=0xffffff;
+	if (!pPrt->b) pPrt->b=0xffffffff;
 	// always OK
 	return true;
 	}
@@ -709,8 +709,8 @@
 		{
 			DWORD dwClr=pPrt->b;
 			int32_t iAlpha=dwClr>>24;
-			iAlpha+=pPrt->pDef->AlphaFade;
-			if (iAlpha>=0xff) return false;
+			iAlpha-=pPrt->pDef->AlphaFade;
+			if (iAlpha<=0x00) return false;
 			pPrt->b=(dwClr&0xffffff) | (iAlpha<<24);
 		}
 		}
diff -r 3293d23b602a src/game/landscape/C4Sky.cpp
--- a/src/game/landscape/C4Sky.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/game/landscape/C4Sky.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -123,7 +123,7 @@
 			FadeClr2=Surface->pPal->GetClr(19);
 			}
 		else*/
-			FadeClr1=FadeClr2=0xffffff;
+			FadeClr1=FadeClr2=0xffffffff;
 		// enlarge surface to avoid slow 1*1-px-skies
 		if (!SurfaceEnsureSize(&Surface, 128, 128)) return FALSE;
 
@@ -175,7 +175,7 @@
 	Width=Height=0;
 	Surface=NULL;
 	x=y=xdir=ydir=0;
-	Modulation=0x00ffffff;
+	Modulation=0xffffffff;
 	ParX=ParY=10;
 	ParallaxMode=C4SkyPM_Fixed;
 	BackClr=0;
@@ -190,7 +190,7 @@
 void C4Sky::Clear()
 	{
 	delete Surface; Surface=NULL;
-	Modulation=0x00ffffff;
+	Modulation=0xffffffff;
 	}
 
 BOOL C4Sky::Save(C4Group &hGroup)
@@ -227,7 +227,7 @@
 	// background color?
 	if (BackClrEnabled) Application.DDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X+cgo.Wdt, cgo.Y+cgo.Hgt, BackClr);
 	// sky surface?
-	if (Modulation != 0xffffff) Application.DDraw->ActivateBlitModulation(Modulation);
+	if (Modulation != 0xffffffff) Application.DDraw->ActivateBlitModulation(Modulation);
 	if (Surface)
 		{
 		// blit parallax sky
@@ -242,7 +242,7 @@
 		DWORD dwClr2=GetSkyFadeClr(cgo.TargetY+cgo.Hgt);
 		Application.DDraw->DrawBoxFade(cgo.Surface, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, dwClr1, dwClr1, dwClr2, dwClr2, cgo.TargetX, cgo.TargetY);
 		}
-	if (Modulation != 0xffffff) Application.DDraw->DeactivateBlitModulation();
+	if (Modulation != 0xffffffff) Application.DDraw->DeactivateBlitModulation();
 	// done
 	}
 
@@ -258,7 +258,7 @@
 	{
 	Modulation=dwWithClr;
 	BackClr=dwBackClr;
-	BackClrEnabled=(Modulation>>24) ? TRUE : FALSE;
+	BackClrEnabled=(Modulation>>24 != 0xff) ? TRUE : FALSE;
 	return true;
 	}
 
@@ -268,7 +268,7 @@
 	pComp->Value(mkNamingAdapt(mkCastIntAdapt(y),   "Y",                     Fix0));
 	pComp->Value(mkNamingAdapt(mkCastIntAdapt(xdir),"XDir",                  Fix0));
 	pComp->Value(mkNamingAdapt(mkCastIntAdapt(ydir),"YDir",                  Fix0));
-	pComp->Value(mkNamingAdapt(Modulation,      "Modulation",            0x00ffffffU));
+	pComp->Value(mkNamingAdapt(Modulation,      "Modulation",            0xffffffffU));
 	pComp->Value(mkNamingAdapt(ParX,            "ParX",                  10));
 	pComp->Value(mkNamingAdapt(ParY,            "ParY",                  10));
 	pComp->Value(mkNamingAdapt(ParallaxMode,    "ParMode",               C4SkyPM_Fixed));
diff -r 3293d23b602a src/game/object/C4Object.cpp
--- a/src/game/object/C4Object.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/game/object/C4Object.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -148,7 +148,8 @@
 	MaterialContents=NULL;
 	LocalNamed.Reset();
 	Marker=0;
-	ColorMod=BlitMode=0;
+	ColorMod=0xffffffff;
+	BlitMode=0;
 	CrewDisabled=FALSE;
 	pLayer=NULL;
 	pSolidMaskData=NULL;
@@ -2379,7 +2380,7 @@
 		}
 
 	// color modulation (including construction sign...)
-	if (ColorMod || BlitMode) if (!eDrawMode) PrepareDrawing();
+	if (ColorMod != 0xffffffff || BlitMode) if (!eDrawMode) PrepareDrawing();
 
 	// Not active or rotated: BaseFace only
 	if (!Action.pActionDef)
@@ -2410,7 +2411,7 @@
 		}
 
 	// end of color modulation
-	if (ColorMod || BlitMode) if (!eDrawMode) FinishedDrawing();
+	if (ColorMod != 0xffffffff || BlitMode) if (!eDrawMode) FinishedDrawing();
 
 	// draw overlays - after blit mode changes, because overlay gfx set their own
 	if (pGfxOverlay) if (eDrawMode!=ODM_BaseOnly)
@@ -2601,7 +2602,7 @@
 	// Draw line segments
 	C4Value colorsV; GetProperty(Strings.P[P_LineColors], colorsV);
 	C4ValueArray *colors = colorsV.getArray();
-	int32_t color0 = 0x00FF00FF, color1 = 0x00FF00FF;	// use bright colors so author notices
+	int32_t color0 = 0xFFFF00FF, color1 = 0xFFFF00FF;	// use bright colors so author notices
 	if (colors)
 		{
 		color0 = colors->GetItem(0).getInt(); color1 = colors->GetItem(1).getInt();
@@ -2727,7 +2728,7 @@
 	pComp->Value(mkNamingAdapt( Contents,													"Contents"															));
 	pComp->Value(mkNamingAdapt( PlrViewRange,											"PlrViewRange",				0									));
 	pComp->Value(mkNamingAdapt( LocalNamed,												"LocalNamed"														));
-	pComp->Value(mkNamingAdapt( ColorMod,													"ColorMod",						0u								));
+	pComp->Value(mkNamingAdapt( ColorMod,													"ColorMod",						0xffffffffu								));
 	pComp->Value(mkNamingAdapt( BlitMode,													"BlitMode",						0u								));
 	pComp->Value(mkNamingAdapt( CrewDisabled,											"CrewDisabled",				false							));
 	pComp->Value(mkNamingAdapt( nLayer,         					        "Layer",          		0									));
@@ -3071,7 +3072,7 @@
 	fctPicture.Set(GetGraphics()->GetBitmap(Color),fctPicRect.x,fctPicRect.y,fctPicRect.Wdt,fctPicRect.Hgt);
 
 	// use direct facet w/o own data if possible
-	if (!ColorMod && BlitMode == C4GFXBLIT_NORMAL && !pGfxOverlay)
+	if (ColorMod == 0xffffffff && BlitMode == C4GFXBLIT_NORMAL && !pGfxOverlay)
 		{
 		cgo.Set(fctPicture);
 		return;
@@ -5481,7 +5482,7 @@
 void C4Object::PrepareDrawing()
 	{
 	// color modulation
-	if (ColorMod || (BlitMode & (C4GFXBLIT_MOD2 | C4GFXBLIT_CLRSFC_MOD2))) Application.DDraw->ActivateBlitModulation(ColorMod);
+	if (ColorMod != 0xffffffff || (BlitMode & (C4GFXBLIT_MOD2 | C4GFXBLIT_CLRSFC_MOD2))) Application.DDraw->ActivateBlitModulation(ColorMod);
 	// other blit modes
 	Application.DDraw->SetBlitMode(BlitMode);
 	}
diff -r 3293d23b602a src/game/player/C4Player.cpp
--- a/src/game/player/C4Player.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/game/player/C4Player.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -661,7 +661,7 @@
 
 DWORD RandomPlayerColor() // generate a random player color
 	{
-	return RGB(Min(SafeRandom(302), 256), Min(SafeRandom(302), 256), Min(SafeRandom(302), 256));
+	return 0xff<<24 | RGB(Min(SafeRandom(302), 256), Min(SafeRandom(302), 256), Min(SafeRandom(302), 256));
 	}
 
 BOOL C4Player::ScenarioInit()
@@ -1972,7 +1972,7 @@
 			if (Distance(cobj->GetX(), cobj->GetY(), x, y) < Abs(iRange))
 				if (iRange < 0)
           {
-          if (!(cobj->ColorMod & 0xff000000)) // faded generators generate darkness only; no FoW blocking
+          if ((cobj->ColorMod & 0xff000000) != 0xff000000) // faded generators generate darkness only; no FoW blocking
 					  return false; // shadowed by FoW-generator
           }
 				else
diff -r 3293d23b602a src/game/script/C4Script.cpp
--- a/src/game/script/C4Script.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/game/script/C4Script.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -5384,8 +5384,7 @@
 		throw new C4AulExecError(ctx->Obj, "CustomMessage: Only one vertical positioning flag allowed!");
 		}
 	// message color
-	if (!dwClr) dwClr = 0xffffff;
-	dwClr = InvertRGBAAlpha(dwClr);
+	if (!dwClr) dwClr = 0xffffffff;
 	// message type
 	int32_t iType;
 	if (pObj)
diff -r 3293d23b602a src/gui/C4Gui.h
--- a/src/gui/C4Gui.h	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/gui/C4Gui.h	Sun Aug 23 16:56:00 2009 -0400
@@ -69,31 +69,31 @@
 #define C4GUI_GfxTabCaptInactiveClr 0xff000000
 
 // other colors
-#define C4GUI_ImportantBGColor   0xcf00007f
-#define C4GUI_ProgressBarColor   0xafffffff
-#define C4GUI_ListBoxSelColor    0xafaf0000
-#define C4GUI_ListBoxInactSelColor  0xaf7f7f7f
-#define C4GUI_ContextSelColor    0xafaf0000
-#define C4GUI_ContextBGColor     0x4f3f1a00
-#define C4GUI_StandardBGColor    0x5f000000
+#define C4GUI_ImportantBGColor   0x2f00007f
+#define C4GUI_ProgressBarColor   0x4fffffff
+#define C4GUI_ListBoxSelColor    0x4faf0000
+#define C4GUI_ListBoxInactSelColor  0x4f7f7f7f
+#define C4GUI_ContextSelColor    0x4faf0000
+#define C4GUI_ContextBGColor     0xaf3f1a00
+#define C4GUI_StandardBGColor    0x9f000000
 #define C4GUI_ActiveTabBGColor   C4GUI_StandardBGColor
 #define C4GUI_ListBoxBarColor    0x7f772200
 #define C4GUI_EditBGColor        0x7f000000
 #define C4GUI_EditFontColor      0xffffffff
 
-#define C4GUI_ToolTipBGColor     0x00F1EA78
+#define C4GUI_ToolTipBGColor     0xFFF1EA78
 #define C4GUI_ToolTipFrameColor  0x7f000000
 #define C4GUI_ToolTipColor       0xFF483222
 
 // winner/loser color marking
 #define C4GUI_WinningTextColor        0xffffdf00
-#define C4GUI_WinningBackgroundColor  0x4faf7a00
+#define C4GUI_WinningBackgroundColor  0xafaf7a00
 #define C4GUI_LosingTextColor         0xffffffff
 #define C4GUI_LosingBackgroundColor   0x7fafafaf
 
 
 // border colors for 3D-frames
-#define C4GUI_BorderAlpha        0xaf
+#define C4GUI_BorderAlpha        0x4f
 #define C4GUI_BorderColor1       0x772200
 #define C4GUI_BorderColor2       0x331100
 #define C4GUI_BorderColor3       0xaa4400
diff -r 3293d23b602a src/gui/C4GuiDialogs.cpp
--- a/src/gui/C4GuiDialogs.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/gui/C4GuiDialogs.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -545,11 +545,11 @@
 	if (iFade < 100)
 		{
 		if (iFade <= 0) return;
-		lpDDraw->ActivateBlitModulation(((100-iFade)*255/100)<<24 | 0xffffff);
+		lpDDraw->ActivateBlitModulation((iFade*255/100)<<24 | 0xffffff);
 		}
 	// seperate window: Clear background
 	if (pWindow)
-		lpDDraw->DrawBoxDw(cgo.Surface, rcBounds.x, rcBounds.y, rcBounds.Wdt-1, rcBounds.Hgt-1, C4GUI_StandardBGColor & 0xffffff);
+		lpDDraw->DrawBoxDw(cgo.Surface, rcBounds.x, rcBounds.y, rcBounds.Wdt-1, rcBounds.Hgt-1, (0xff << 24) | (C4GUI_StandardBGColor & 0xffffff) );
 	// draw window + contents (evaluates IsVisible)
 	Window::Draw(cgo);
 	// reset blit modulation
diff -r 3293d23b602a src/gui/C4LoaderScreen.cpp
--- a/src/gui/C4LoaderScreen.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/gui/C4LoaderScreen.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -185,7 +185,7 @@
 		Application.DDraw->TextOutDw(szInfo, cgo.Surface, cgo.Wdt/2, cgo.Hgt/2+20);*/
 	//
 	// draw progress bar
-	Application.DDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin, 0x4f000000);
+	Application.DDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin, 0xb0000000);
 	int iProgressBarWdt=cgo.Wdt-iHIndent*2-2;
 	if (C4GUI::IsGUIValid())
 		{
@@ -193,7 +193,7 @@
 		}
 	else
 		{
-		Application.DDraw->DrawBoxDw(cgo.Surface, iHIndent+1, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt+1, iHIndent+1+iProgressBarWdt*iProgress/100, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-1, 0x4fff0000);
+		Application.DDraw->DrawBoxDw(cgo.Surface, iHIndent+1, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt+1, iHIndent+1+iProgressBarWdt*iProgress/100, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-1, 0xb0ff0000);
 		}
 	Application.DDraw->StringOut(FormatString("%i%%", iProgress).getData(), rProgressBarFont, 1.0f, cgo.Surface,
 		cgo.Wdt/2, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-rProgressBarFont.iLineHgt/2-iProgressBarHgt/2, 0xffffffff,
diff -r 3293d23b602a src/gui/C4Startup.h
--- a/src/gui/C4Startup.h	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/gui/C4Startup.h	Sun Aug 23 16:56:00 2009 -0400
@@ -28,11 +28,11 @@
 // special colors for startup designs
 const int32_t C4StartupFontClr         = 0xff000000,
               C4StartupFontClrDisabled = 0xff7f7f7f,
-              C4StartupEditBGColor     = 0xff000000,
-							C4StartupEditBorderColor = 0x00a4947a,
+              C4StartupEditBGColor     = 0x00000000,
+							C4StartupEditBorderColor = 0xffa4947a,
               C4StartupBtnFontClr      = 0xff202020,
-							C4StartupBtnBorderColor1 = 0x00ccc3b4,
-							C4StartupBtnBorderColor2 = 0x0094846a;
+							C4StartupBtnBorderColor1 = 0xffccc3b4,
+							C4StartupBtnBorderColor2 = 0xff94846a;
 
 // graphics needed only by startup
 class C4StartupGraphics
diff -r 3293d23b602a src/gui/C4StartupOptionsDlg.cpp
--- a/src/gui/C4StartupOptionsDlg.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/gui/C4StartupOptionsDlg.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -213,10 +213,10 @@
 	cgoDraw.Y += iKeyIndent*3/4; cgoDraw.Hgt -= 2*iKeyIndent;
 	if (fDown) cgoDraw.Y += iKeyIndent/2;
 	bool fDoHightlight = fHighlight || HasDrawFocus() || (fMouseOver && IsInActiveDlg(false));
-	bool fHadBlitMod=false; DWORD dwOldBlitModClr=0xffffff;
+	bool fHadBlitMod=false; DWORD dwOldBlitModClr=0xffffffff;
 	if (!fDoHightlight)
 		{
-		DWORD dwModClr = 0x7f7f7f;
+		DWORD dwModClr = 0xff7f7f7f;
 		if (fHadBlitMod = lpDDraw->GetBlitModulation(dwOldBlitModClr))
 			ModulateClr(dwModClr, dwOldBlitModClr);
 		lpDDraw->ActivateBlitModulation(dwModClr);
diff -r 3293d23b602a src/gui/C4StartupScenSelDlg.cpp
--- a/src/gui/C4StartupScenSelDlg.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/gui/C4StartupScenSelDlg.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -362,7 +362,7 @@
 			if (pScen->sTitle.getLength()>0)
 				{
 				pBtn->SetText(pScen->sTitle.getData());
-				pBtn->SetTextColors(InvertRGBAAlpha(pScen->dwTitleInactClr), InvertRGBAAlpha(pScen->dwTitleActClr));
+				pBtn->SetTextColors(pScen->dwTitleInactClr, pScen->dwTitleActClr);
 				pBtn->SetTextPos(pScen->iTitleOffX, pScen->iTitleOffY, pScen->byTitleAlign);
 				CStdFont *pUseFont; float fFontZoom=1.0f;
 				if (pScen->fTitleBookFont)
@@ -500,7 +500,7 @@
 						if (Inside<uint8_t>(dwPix & 0xff, 0xb8, 0xff))
 							if (Inside<uint8_t>((dwPix>>0x08) & 0xff, 0x00, 0x0f))
 								if (Inside<uint8_t>((dwPix>>0x10) & 0xff, 0xb8, 0xff))
-									fctTemp.Surface->SetPixDw(x,y,0xffffffff);
+									fctTemp.Surface->SetPixDw(x,y,0x00ffffff);
 						}
 				fctTemp.Surface->Unlock();
 				int iIconSize = C4Startup::Get()->Graphics.fctScenSelIcons.Hgt;
diff -r 3293d23b602a src/gui/C4Viewport.cpp
--- a/src/gui/C4Viewport.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/gui/C4Viewport.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -1002,7 +1002,7 @@
 		if (::MouseControl.IsDragging() && ::MouseControl.IsViewport(this))
 			{
 			fDragging = true;
-			lpDDraw->ActivateBlitModulation(0xafffffff);
+			lpDDraw->ActivateBlitModulation(0x4fffffff);
 			}
 		// draw menu
 		pPlr->Cursor->Menu->Draw(cgo);
diff -r 3293d23b602a src/lib/Standard.h
--- a/src/lib/Standard.h	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/Standard.h	Sun Aug 23 16:56:00 2009 -0400
@@ -174,7 +174,7 @@
 BOOL LogSilentF(const char *strMessage, ...) GNUC_FORMAT_ATTRIBUTE;
 
 // Color triplets
-#define C4RGB(r, g, b) ((((DWORD)(r)&0xff)<<16)|(((DWORD)(g)&0xff)<<8)|((b)&0xff))
+#define C4RGB(r, g, b) (((DWORD)(0xff)<<24)|(((DWORD)(r)&0xff)<<16)|(((DWORD)(g)&0xff)<<8)|((b)&0xff))
 
 // Small helpers
 template <class T> inline T Max(T val1, T val2) { return val1 > val2 ? val1 : val2; }
diff -r 3293d23b602a src/lib/StdColors.h
--- a/src/lib/StdColors.h	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/StdColors.h	Sun Aug 23 16:56:00 2009 -0400
@@ -36,23 +36,23 @@
 inline void BltAlpha(DWORD &dwDst, DWORD dwSrc)
 	{
 	// blit one color value w/alpha on another
-	if (dwDst>>24 == 0xff) { dwDst=dwSrc; return; }
-	BYTE byAlphaDst=BYTE(dwSrc>>24); BYTE byAlphaSrc=255-byAlphaDst;
+	if (dwDst>>24 == 0x00) { dwDst=dwSrc; return; }
+	BYTE byAlphaSrc=BYTE(dwSrc>>24); BYTE byAlphaDst=255-byAlphaSrc;
 	dwDst = Min<uint32_t>((int(dwDst    & 0xff ) * byAlphaDst + int(dwSrc & 0xff    ) * byAlphaSrc) >>8,            0xff)      | // blue
 	        Min<uint32_t>((int(dwDst   & 0xff00) * byAlphaDst + int(dwSrc & 0xff00  ) * byAlphaSrc) >>8 & 0xff00,   0xff00)    | // green
 					Min<uint32_t>((int(dwDst & 0xff0000) * byAlphaDst + int(dwSrc & 0xff0000) * byAlphaSrc) >>8 & 0xff0000, 0xff0000)  | // red
-				  uint32_t(Max((int) (dwDst >> 24) - byAlphaSrc, 0)) << 24; // alpha
+				  Min<uint32_t>( (dwDst >> 24) + byAlphaSrc, 255) << 24; // alpha
 	}
 
 inline void BltAlphaAdd(DWORD &dwDst, DWORD dwSrc)
 	{
 	// blit one color value w/alpha on another in additive mode
-	if (dwDst>>24 == 0xff) { dwDst=dwSrc; return; }
-	BYTE byAlphaSrc=255-BYTE(dwSrc>>24);
+	if (dwDst>>24 == 0x00) { dwDst=dwSrc; return; }
+	BYTE byAlphaSrc=BYTE(dwSrc>>24);
 	dwDst = Min<uint32_t>((dwDst    & 0xff ) + ((int(dwSrc    & 0xff  ) * byAlphaSrc) >>8)       , 0xff)      | // blue
 	        Min<uint32_t>((dwDst   & 0xff00) + (int(dwSrc>>8 & 0xff  ) * byAlphaSrc) & 0x00ffff00, 0xff00)    | // green
 					Min<uint32_t>((dwDst & 0xff0000) + (int(dwSrc>>8 & 0xff00) * byAlphaSrc) & 0xffff0000, 0xff0000)  | // red
-				  uint32_t(Max((int) (dwDst >> 24) - byAlphaSrc, 0)) << 24; // alpha
+				  Min<uint32_t>( (dwDst >> 24) + byAlphaSrc, 255) << 24; // alpha
 	}
 
 inline void ModulateClr(DWORD &dwDst, DWORD dwMod) // modulate two color values
@@ -61,46 +61,77 @@
 	// get alpha
 	int iA1=dwDst>>24, iA2=dwMod>>24;
 	// modulate color values; mod alpha upwards
+#if 0
 	dwDst = ((dwDst     & 0xff) * (dwMod    &   0xff))    >>  8   | // blue
 	        ((dwDst>> 8 & 0xff) * (dwMod>>8 &   0xff)) &   0xff00 | // green
-				  ((dwDst>>16 & 0xff) * (dwMod>>8 & 0xff00)) & 0xff0000 | // red
-				  uint32_t(Min(iA1+iA2 - ((iA1*iA2)>>8), 255))  << 24   ; // alpha (=255-(255*iA1)(255*iA2)/255)
+	        ((dwDst>>16 & 0xff) * (dwMod>>8 & 0xff00)) & 0xff0000 | // red
+	        Min(iA1*iA2>>8, 255) << 24; // alpha (TODO: We don't need Min() here, do we?)
+#else
+	// More exact calculation, but might be slightly slower:
+	dwDst = ((dwDst     & 0xff) * (dwMod     & 0xff) / 0xff)      | // blue
+	        ((dwDst>> 8 & 0xff) * (dwMod>> 8 & 0xff) / 0xff) << 8 | // green
+	        ((dwDst>>16 & 0xff) * (dwMod>>16 & 0xff) / 0xff) << 16| // red
+	        Min(iA1*iA2/0xff, 255)                           << 24; // alpha (TODO: We don't need Min() here, do we?)
+#endif
 	}
 
 inline void ModulateClrA(DWORD &dwDst, DWORD dwMod) // modulate two color values and add alpha value
 	{
 	// modulate two color values and add alpha value
+#if 0
 	dwDst = (((dwDst&0xff)*(dwMod&0xff))>>8) |  // B
-		      (((dwDst>>8&0xff)*(dwMod>>8&0xff))&0xff00) | // G
-					(((dwDst>>16&0xff)*(dwMod>>8&0xff00))&0xff0000) | // R
-					Min<uint32_t>((dwDst>>24)+(dwMod>>24), 0xff)<<24;
+	        (((dwDst>>8&0xff)*(dwMod>>8&0xff))&0xff00) | // G
+	        (((dwDst>>16&0xff)*(dwMod>>8&0xff00))&0xff0000) | // R
+	        (Max<uint32_t>((dwDst>>24)+(dwMod>>24), 0xff) - 0xff)<<24;
+#else
+	// More exact calculation, but might be slightly slower:
+	dwDst = ((dwDst     & 0xff) * (dwMod     & 0xff) / 0xff)      | // B
+	        ((dwDst>> 8 & 0xff) * (dwMod>> 8 & 0xff) / 0xff) << 8 | // G
+	        ((dwDst>>16 & 0xff) * (dwMod>>16 & 0xff) / 0xff) << 16| // R
+	        (Max<uint32_t>((dwDst>>24)+(dwMod>>24), 0xff) - 0xff)<<24;
+#endif
 	}
-
 inline void ModulateClrMOD2(DWORD &dwDst, DWORD dwMod) // clr1+clr2-0.5
 	{
 	// signed color addition
 	dwDst = (BoundBy<int>(((int)(dwDst&0xff)+(dwMod&0xff)-0x7f)<<1,0,0xff)&0xff) |  // B
-		      (BoundBy<int>(((int)(dwDst&0xff00)+(dwMod&0xff00)-0x7f00)<<1,0,0xff00)&0xff00) | // G
-					(BoundBy<int>(((int)(dwDst&0xff0000)+(dwMod&0xff0000)-0x7f0000)<<1,0,0xff0000)&0xff0000) | // R
-					Min<uint32_t>((dwDst>>24)+(dwMod>>24), 0xff)<<24;
+	        (BoundBy<int>(((int)(dwDst&0xff00)+(dwMod&0xff00)-0x7f00)<<1,0,0xff00)&0xff00) | // G
+	        (BoundBy<int>(((int)(dwDst&0xff0000)+(dwMod&0xff0000)-0x7f0000)<<1,0,0xff0000)&0xff0000) | // R
+	        (Max<uint32_t>((dwDst>>24)+(dwMod>>24), 0xff) - 0xff)<<24;
 	}
 
 inline void ModulateClrMono(DWORD &dwDst, BYTE byMod)
 	{
 	// darken a color value by constant modulation
+#if 0
 	dwDst = ((dwDst     & 0xff) * byMod)    >>  8   | // blue
 	        ((dwDst>> 8 & 0xff) * byMod) &   0xff00 | // green
 				  ((dwDst>> 8 & 0xff00) * byMod) & 0xff0000 | // red
 				  (dwDst & 0xff000000);                     // alpha
+#else
+	// More exact calculation, but might be slightly slower:
+	dwDst = ((dwDst     & 0xff) * byMod / 0xff)      | // blue
+	        ((dwDst>> 8 & 0xff) * byMod / 0xff) << 8 | // green
+	        ((dwDst>>16 & 0xff) * byMod / 0xff) << 16| // red
+	        (dwDst & 0xff000000);                     // alpha
+#endif
 	}
 
 inline void ModulateClrMonoA(DWORD &dwDst, BYTE byMod, BYTE byA)
 	{
 	// darken a color value by constant modulation and add an alpha value
+#if 0
 	dwDst = ((dwDst     & 0xff) * byMod)    >>  8   | // blue
 	        ((dwDst>> 8 & 0xff) * byMod) &   0xff00 | // green
 				  ((dwDst>> 8 & 0xff00) * byMod) & 0xff0000 | // red
-				  Min<uint32_t>((dwDst>>24) + byA, 255) << 24;        // alpha
+				  (Max<uint32_t>((dwDst>>24) + byA, 0xff) - 0xff) << 24; // alpha
+#else
+	// More exact calculation, but might be slightly slower:
+	dwDst = ((dwDst     & 0xff) * byMod / 0xff)      | // blue
+	        ((dwDst>> 8 & 0xff) * byMod / 0xff) << 8 | // green
+	        ((dwDst>>16 & 0xff) * byMod / 0xff) << 16| // red
+	        (Max<uint32_t>((dwDst>>24) + byA, 0xff) - 0xff) << 24; // alpha
+#endif
 	}
 
 
@@ -179,10 +210,10 @@
 		int bR=sR+(cR*255)/diffN;
 		int bG=sG+(cG*255)/diffN;
 		int bB=sB+(cB*255)/diffN;
-		dwBack=RGBA(bR, bG, bB, 0);
+		dwBack=RGBA(bR, bG, bB, 255);
 		}
 	if (!sR) sR=1; if (!sG) sG=1; if (!sB) sB=1;
-	return RGBA(Min((int)dR*256/sR, 255), Min((int)dG*256/sG, 255), Min((int)dB*256/sB, 255), diffN);
+	return RGBA(Min((int)dR*256/sR, 255), Min((int)dG*256/sG, 255), Min((int)dB*256/sB, 255), 255-diffN);
 	}
 
 inline DWORD NormalizeColors(DWORD &dwClr1, DWORD &dwClr2, DWORD &dwClr3, DWORD &dwClr4)
@@ -198,11 +229,6 @@
 	return dwClr2=dwClr3=dwClr4=dwClr1;
 	}
 
-inline DWORD InvertRGBAAlpha(DWORD dwFromClr)
-	{
-	return (dwFromClr&0xffffff) | (255-(dwFromClr>>24))<<24;
-	}
-
 inline WORD ClrDw2W(DWORD dwClr)
 	{
 	return
@@ -270,14 +296,14 @@
 struct CStdPalette
 	{
 	BYTE Colors[3*256];
-	BYTE Alpha[3*256];
+	BYTE Alpha[3*256]; // TODO: alphapal: Why 3*? Isn't Alpha[256] enough?
 
 	DWORD GetClr(BYTE byCol)
 		{ return RGB(Colors[byCol*3+2], Colors[byCol*3+1], Colors[byCol*3])+(Alpha[byCol]<<24); }
 
 	void EnforceC0Transparency()
 		{
-		Colors[0]=Colors[1]=Colors[2]=0; Alpha[0]=255;
+		Colors[0]=Colors[1]=Colors[2]=0; Alpha[0]=0;
 		}
 	};
 
diff -r 3293d23b602a src/lib/StdMarkup.cpp
--- a/src/lib/StdMarkup.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/StdMarkup.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -87,7 +87,6 @@
 				}
 			// adjust alpha if not given
 			if (iParLen<=6) dwClr|=0xff000000;
-			dwClr = InvertRGBAAlpha(dwClr);
 			// create color tag
 			pNewTag=new CMarkupTagColor(dwClr);
 			}
diff -r 3293d23b602a src/lib/texture/C4Facet.cpp
--- a/src/lib/texture/C4Facet.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/texture/C4Facet.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -150,8 +150,8 @@
 	// stretched fullscreen blit: make sure right and lower side are cleared, because this may be missed due to stretching
 	if (cgo.Wdt > Wdt+2 || cgo.Hgt > Wdt+2)
 		{
-		lpDDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y+cgo.Hgt-1, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0x00000000);
-		lpDDraw->DrawBoxDw(cgo.Surface, cgo.X+cgo.Wdt-1, cgo.Y, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0x00000000);
+		lpDDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y+cgo.Hgt-1, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0xff000000);
+		lpDDraw->DrawBoxDw(cgo.Surface, cgo.X+cgo.Wdt-1, cgo.Y, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0xff000000);
 		}
 	// normal blit OK
 	Draw(cgo, FALSE);
diff -r 3293d23b602a src/lib/texture/C4GraphicsResource.cpp
--- a/src/lib/texture/C4GraphicsResource.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/texture/C4GraphicsResource.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -187,15 +187,15 @@
 		if (!pPalGrp->AccessEntry("C4.pal")) { LogFatal("Pal error!"); return FALSE; }
 		if (!pPalGrp->Read(GamePalette,256*3)) { LogFatal("Pal error!"); return FALSE; }
 		for (int32_t cnt=0; cnt<256*3; cnt++)	GamePalette[cnt]<<=2;
-		ZeroMemory(&AlphaPalette, 256);
+		for (int32_t cnt=0; cnt<256; cnt++)     AlphaPalette[cnt]=0xff;
 		// Set default force field color
 		GamePalette[191*3+0]=0;
 		GamePalette[191*3+1]=0;
 		GamePalette[191*3+2]=255;
+		AlphaPalette[191]=127;
 		// color 0 is transparent
 		GamePalette[0]=GamePalette[1]=GamePalette[2]=0;
-		AlphaPalette[0]=255;
-		AlphaPalette[191]=127;
+		AlphaPalette[0]=0;
 		// update game pal
 		if (!::GraphicsSystem.SetPalette()) { LogFatal("Pal error (2)!"); return FALSE; }
 		idPalGrp = idNewPalGrp;
@@ -222,6 +222,7 @@
 	if (!LoadCursorGfx())                                               return FALSE;
 	if (!LoadFile(fctSelectMark,	"SelectMark",		Files, C4FCT_Height))	return FALSE;
 	if (!LoadFile(fctMenu,				"Menu",					Files, 35,35))				return FALSE;
+
 	if (!LoadFile(fctLogo,				"Logo",					Files))								return FALSE;
 	if (!LoadFile(fctConstruction,"Construction",	Files))								return FALSE;	// (new)
 	if (!LoadFile(fctEnergy,			"Energy",				Files))								return FALSE;	// (new)
diff -r 3293d23b602a src/lib/texture/C4GraphicsResource.h
--- a/src/lib/texture/C4GraphicsResource.h	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/texture/C4GraphicsResource.h	Sun Aug 23 16:56:00 2009 -0400
@@ -47,7 +47,7 @@
 	public:
 		C4GroupSet Files;
 		BYTE GamePalette[256*3];
-		BYTE AlphaPalette[256*3];
+		BYTE AlphaPalette[256*3]; // TODO: alphapal: Why *3?
 		C4FacetID fctPlayer;
 		C4FacetID fctFlag;
 		C4FacetID fctCrew;
diff -r 3293d23b602a src/lib/texture/C4Surface.cpp
--- a/src/lib/texture/C4Surface.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/texture/C4Surface.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -191,7 +191,7 @@
 				DWORD *pPix=(DWORD *) (((char *) pTexRef->texLock.pBits) + iY * pTexRef->texLock.Pitch);
 				memcpy (pPix, png.GetRow(rY) + tX * iTexSize, maxX * 4);
 				int iX = maxX;
-				while (iX--) { if (((BYTE *)pPix)[3] == 0xff) *pPix = 0xff000000; ++pPix; }
+				while (iX--) { if (((BYTE *)pPix)[3] == 0x00) *pPix = 0x00000000; ++pPix; }
 				}
 			else
 #endif
@@ -201,7 +201,7 @@
 					{
 					uint32_t dwCol = png.GetPix(iX + tX * iTexSize, rY);
 					// if color is fully transparent, ensure it's black
-					if (dwCol>>24 == 0xff) dwCol=0xff000000;
+					if (dwCol>>24 == 0x00) dwCol=0x00000000;
 					// set pix in surface
 					if (byBytesPP == 4)
 						{
diff -r 3293d23b602a src/lib/texture/StdPNG.cpp
--- a/src/lib/texture/StdPNG.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/lib/texture/StdPNG.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -59,8 +59,6 @@
 	if (setjmp(png_ptr->jmpbuf)) return false;
 	// set file-reading proc
 	png_set_read_fn(png_ptr, png_get_io_ptr(png_ptr), &CPNGReadFn);
-	// invert alpha
-	png_set_invert_alpha(png_ptr);
 	// read info
 	png_read_info(png_ptr, info_ptr);
 	// assign local vars
@@ -186,7 +184,7 @@
 	switch (iClrType)
 		{
 		case PNG_COLOR_TYPE_RGB:
-			return RGB(pPix[0], pPix[1], pPix[2]);
+			return 0xff << 24 | RGB(pPix[0], pPix[1], pPix[2]);
 		case PNG_COLOR_TYPE_RGB_ALPHA:
             return pPix[3] << 24 | RGB(pPix[0], pPix[1], pPix[2]);
 		}
@@ -272,8 +270,6 @@
 		// this won't go well, so better abort
 		Clear(); return false;
 		}
-	// write inverted alpha channel
-	png_set_invert_alpha(png_ptr);
 	// write png header
 	png_write_info(png_ptr, info_ptr);
 	// image data is given as bgr...
diff -r 3293d23b602a src/platform/StdDDraw2.cpp
--- a/src/platform/StdDDraw2.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/platform/StdDDraw2.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -205,7 +205,7 @@
 
 DWORD CGammaControl::ApplyTo(DWORD dwClr)
 	{
-	// apply to reg, green and blue color component
+	// apply to red, green and blue color component
 	return RGBA(ramp.red[GetBValue(dwClr)]>>8, ramp.green[GetGValue(dwClr)]>>8, ramp.blue[GetRValue(dwClr)]>>8, dwClr>>24);
 	}
 
@@ -333,14 +333,15 @@
 	int tx2 = Min(tx + 1, Wdt-1);
 	int ty2 = Min(ty + 1, Hgt-1);
 
+	// TODO: Alphafixed. Correct?
 	unsigned char Vis = pMap[ty*Wdt+tx];
-	uint32_t c1 = FadeTransparent ? 0xffffff | ((255u - Vis) << 24) : RGB(Vis, Vis, Vis);
+	uint32_t c1 = FadeTransparent ? 0xffffff | (Vis << 24) : 0xff000000|RGB(Vis, Vis, Vis);
 	Vis = pMap[ty*Wdt+tx2];
-	uint32_t c2 = FadeTransparent ? 0xffffff | ((255u - Vis) << 24) : RGB(Vis, Vis, Vis);
+	uint32_t c2 = FadeTransparent ? 0xffffff | (Vis << 24) : 0xff000000|RGB(Vis, Vis, Vis);
 	Vis = pMap[ty2*Wdt+tx];
-	uint32_t c3 = FadeTransparent ? 0xffffff | ((255u  -Vis) << 24) : RGB(Vis, Vis, Vis);
+	uint32_t c3 = FadeTransparent ? 0xffffff | (Vis << 24) : 0xff000000|RGB(Vis, Vis, Vis);
 	Vis = pMap[ty2*Wdt+tx2];
-	uint32_t c4 = FadeTransparent ? 0xffffff | ((255u - Vis) << 24) : RGB(Vis, Vis, Vis);
+	uint32_t c4 = FadeTransparent ? 0xffffff | (Vis << 24) : 0xff000000|RGB(Vis, Vis, Vis);
 	CColorFadeMatrix clrs(tx*ResolutionX, ty*ResolutionY, ResolutionX, ResolutionY, c1, c2, c3, c4);
 	return clrs.GetColorAt(x, y);
 #endif
@@ -1011,7 +1012,7 @@
 				pBaseTex = *(sfcSource->pMainSfc->ppTex + iY * sfcSource->iTexX + iX);
 				}
 			// base blit
-			PerformBlt(BltData, pBaseTex, BlitModulated ? BlitModulateClr : 0xffffff, !!(dwBlitMode & C4GFXBLIT_MOD2), fExact);
+			PerformBlt(BltData, pBaseTex, BlitModulated ? BlitModulateClr : 0xffffffff, !!(dwBlitMode & C4GFXBLIT_MOD2), fExact);
 			// overlay
 			if (fBaseSfc)
 				{
diff -r 3293d23b602a src/platform/StdFont.cpp
--- a/src/platform/StdFont.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/platform/StdFont.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -222,12 +222,12 @@
 	for (int y=0; y<size.cy; ++y) for (int x=0; x<size.cx; ++x)
 		{
 		// get value; determine shadow value by pos moved 1px to upper left
-		BYTE bAlpha = 255 - (BYTE)(pBitmapBits[iBitmapSize*y + x] & 0xff);
+		BYTE bAlpha = (BYTE)(pBitmapBits[iBitmapSize*y + x] & 0xff);
 		BYTE bAlphaShadow;
 		if (x&&y && fDoShadow)
-			bAlphaShadow = 255 - (BYTE)((pBitmapBits[iBitmapSize*(y-1) + x-1] & 0xff)*1/1);
+			bAlphaShadow = (BYTE)((pBitmapBits[iBitmapSize*(y-1) + x-1] & 0xff)*1/1);
 		else
-			bAlphaShadow = 255;
+			bAlphaShadow = 0;
 		// calc pixel value: white char on black shadow (if shadow is desired)
 		DWORD dwPixVal = bAlphaShadow << 24;
 		BltAlpha(dwPixVal, bAlpha << 24 | 0xffffff);
@@ -282,12 +282,12 @@
 			{
 			unsigned char bAlpha, bAlphaShadow;
 			if (x < slot->bitmap.width && y < slot->bitmap.rows)
-				bAlpha = 255 - (unsigned char)(slot->bitmap.buffer[slot->bitmap.width * y + x]);
+				bAlpha = (unsigned char)(slot->bitmap.buffer[slot->bitmap.width * y + x]);
 			else
-				bAlpha = 255;
+				bAlpha = 0;
 			// Make a shadow from the upper-left pixel, and blur with the eight neighbors
 			DWORD dwPixVal = 0u;
-			bAlphaShadow = 255;
+			bAlphaShadow = 0;
 			if ((x || y) && fDoShadow)
 				{
 				int iShadow = 0;
@@ -300,10 +300,10 @@
 				if (x < slot->bitmap.width && y > 0                ) iShadow += slot->bitmap.buffer[(x - 0) + slot->bitmap.width * (y - 1)];
 				if (x > 1                  && y > 0                ) iShadow += slot->bitmap.buffer[(x - 2) + slot->bitmap.width * (y - 1)];
 				if (x > 0                  && y > 0                ) iShadow += slot->bitmap.buffer[(x - 1) + slot->bitmap.width * (y - 1)]*8;
-				bAlphaShadow -= iShadow / 16;
+				bAlphaShadow += iShadow / 16;
 				// because blitting on a black pixel reduces luminosity as compared to shadowless font,
 				// assume luminosity as if blitting shadowless font on a 50% gray background
-				unsigned char cBack = (255-bAlpha);
+				unsigned char cBack = bAlpha;
 				dwPixVal = RGB(cBack/2, cBack/2, cBack/2);
 				}
 			dwPixVal += bAlphaShadow << 24;
@@ -1027,12 +1027,12 @@
 	{
 	CBltTransform bt, *pbt=NULL;
 	// set blit color
-	dwColor = InvertRGBAAlpha(dwColor);
 	DWORD dwOldModClr;
 	bool fWasModulated = lpDDraw->GetBlitModulation(dwOldModClr);
 	if (fWasModulated) ModulateClr(dwColor, dwOldModClr);
 	// get alpha fade percentage
-	DWORD dwAlphaMod = BoundBy<int>((((int)(dwColor>>0x18)-0x50)*0xff)/0xaf, 0, 255)<<0x18 | 0xffffff;
+	DWORD dwAlphaMod = Min<uint32_t>(((dwColor>>0x18)*0xff)/0xaf, 255)<<0x18 | 0xffffff;
+
 /*	char TEXT[8192];
 	sprintf(TEXT, "%s(%x-%x-%x)", szText, dwAlphaMod>>0x18, dwColor>>0x15, (((int)(dwColor>>0x15)-0x50)*0xff)/0xaf); szText=TEXT;*/
 	// adjust text starting position (horizontal only)
@@ -1104,7 +1104,7 @@
 				continue;
 				}
 			//normal: not modulated, unless done by transform or alpha fadeout
-			if ((dwColor>>0x18) <= 0x50)
+			if ((dwColor>>0x18) >= 0xaf)
 				lpDDraw->DeactivateBlitModulation();
 			else
 				lpDDraw->ActivateBlitModulation((dwColor&0xff000000) | 0xffffff);
diff -r 3293d23b602a src/platform/StdGL.cpp
--- a/src/platform/StdGL.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/platform/StdGL.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -102,7 +102,7 @@
 void CStdGL::FillBG(DWORD dwClr)
 	{
 	if (!pCurrCtx) if (!MainCtx.Select()) return;
-	glClearColor((float)GetBValue(dwClr)/255.0f, (float)GetGValue(dwClr)/255.0f, (float)GetRValue(dwClr)/255.0f, 1.0f);
+	glClearColor((float)GetBValue(dwClr)/255.0f, (float)GetGValue(dwClr)/255.0f, (float)GetRValue(dwClr)/255.0f, 0.0f);
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 	}
 
@@ -184,7 +184,7 @@
 		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
 		glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, fMod2 ? GL_ADD_SIGNED : GL_MODULATE);
 		glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, fMod2 ? 2.0f : 1.0f);
-		glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD);
+		glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); // TODO: This was GL_ADD. Is GL_MODULATE correct for inverted alpha? Others seem to break things... - ModulateClrA was changed to do a+b-1, but there is no GL_-constant for this...
 		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
 		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
 		glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
@@ -204,8 +204,8 @@
 	if (DDrawCfg.ClipManually && rBltData.pTransform) ClipPoly(rBltData);
 	// global modulation map
 	int i;
-	bool fAnyModNotBlack = !!dwModClr;
-	if (!shaders[0] && fUseClrModMap && dwModClr)
+	bool fAnyModNotBlack = (dwModClr != 0xff000000);
+	if (!shaders[0] && fUseClrModMap && dwModClr != 0xff000000)
 		{
 		fAnyModNotBlack = false;
 		for (i=0; i<rBltData.byNumVertices; ++i)
@@ -218,7 +218,7 @@
 				}
 			DWORD c = pClrModMap->GetModAt(int(x), int(y));
 			ModulateClr(c, dwModClr);
-			if (c) fAnyModNotBlack = true;
+			if (c != 0xff000000) fAnyModNotBlack = true;
 			DwTo4UB(c, rBltData.vtVtx[i].color);
 			}
 		}
@@ -396,7 +396,7 @@
 		for (int iX=iTexX; iX<iTexX2; ++iX)
 			{
 			// blit
-			DWORD dwModClr = BlitModulated ? BlitModulateClr : 0xffffff;
+			DWORD dwModClr = BlitModulated ? BlitModulateClr : 0xffffffff;
 
 			glActiveTexture(GL_TEXTURE0);
 			CTexRef *pTex = *(sfcSource->ppTex + iY * sfcSource->iTexX + iX);
@@ -606,7 +606,7 @@
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-	const char * linedata = byByteCnt == 2 ? "\xff\xff\xff\xf0" : "\xff\xff\xff\xff\xff\xff\xff\x00";
+	const char * linedata = byByteCnt == 2 ? "\xff\xf0\xff\xff" : "\xff\xff\xff\x00\xff\xff\xff\xff";
 	glTexImage2D(GL_TEXTURE_2D, 0, 4, 1, 2, 0, GL_BGRA, byByteCnt == 2 ? GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_UNSIGNED_INT_8_8_8_8_REV, linedata);
 	return RestoreDeviceObjects();
 	}
@@ -638,7 +638,7 @@
 		glShadeModel((dwClr1 == dwClr2 && dwClr1 == dwClr3 && dwClr1 == dwClr4) ? GL_FLAT : GL_SMOOTH);
 	// set blitting state
 	int iAdditive = dwBlitMode & C4GFXBLIT_ADDITIVE;
-	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, iAdditive ? GL_ONE : GL_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, iAdditive ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA);
 	// draw two triangles
 	glInterleavedArrays(GL_V2F, sizeof(float)*2, ipVtx);
 	GLubyte colors[4][4];
@@ -751,7 +751,7 @@
 		glBlendFunc(GL_SRC_ALPHA, iAdditive ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA);
 		// convert the alpha value for that blendfunc
 		glBegin(GL_POINTS);
-		glColorDw(InvertRGBAAlpha(dwClr));
+		glColorDw(dwClr);
 		glVertex2f(tx + 0.5f, ty + 0.5f);
 		glEnd();
 		}
@@ -891,7 +891,7 @@
 
 void CStdGL::SetTexture()
 	{
-	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, (dwBlitMode & C4GFXBLIT_ADDITIVE) ? GL_ONE : GL_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, (dwBlitMode & C4GFXBLIT_ADDITIVE) ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA);
 	if (shaders[0] && fUseClrModMap)
 		{
 		glEnable(GL_FRAGMENT_PROGRAM_ARB);
diff -r 3293d23b602a src/platform/StdSurface2.cpp
--- a/src/platform/StdSurface2.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/platform/StdSurface2.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -399,7 +399,7 @@
 			// set in this surface
 			SetPixDw(iX, iY, dwPix);
 			// clear in the other
-			pMainSfc->SetPixDw(iX, iY, 0xffffffff);
+			pMainSfc->SetPixDw(iX, iY, 0x00ffffff);
 			}
 	// unlock
 	Unlock();
@@ -708,7 +708,7 @@
 		if (!fIsBackground)
 			SetPix(i%Wdt, i/Wdt, 0);
 		else
-			SetPixDw(i%Wdt, i/Wdt, 0x00000000);
+			SetPixDw(i%Wdt, i/Wdt, 0xff000000);
 	Unlock();
 	// success
 	return TRUE;
@@ -944,7 +944,7 @@
 		{
 		BYTE byAlpha=BYTE(dwPix>>24);
 		// pix is fully transparent?
-		if (byAlpha==0xff)
+		if (byAlpha==0x00)
 			// then get the main surfaces's pixel
 			dwPix = pMainSfc->GetPixDw(iX2, iY2, fApplyModulation);
 		else
@@ -1056,7 +1056,7 @@
 	// get+lock affected texture
 	if (!ppTex) return false;
 	// if color is fully transparent, ensure it's black
-	if (dwClr>>24 == 0xff) dwClr=0xff000000;
+	if (dwClr>>24 == 0x00) dwClr=0x00000000;
 	CTexRef *pTexRef;
 #ifdef USE_GL
 	// openGL: use glTexSubImage2D
@@ -1296,7 +1296,7 @@
 			}
 		// empty texture
 		if (!Lock()) return;
-		FillMemory(texLock.pBits, texLock.Pitch*iSize, 0xff);
+		FillMemory(texLock.pBits, texLock.Pitch*iSize, 0x00);
 		Unlock();
 		}
 	else
@@ -1308,7 +1308,7 @@
 		// create mem array for texture creation
 		texLock.pBits = new unsigned char[iSize*iSize*pGL->byByteCnt];
 		texLock.Pitch = iSize*pGL->byByteCnt;
-		memset(texLock.pBits, 0xff, texLock.Pitch*iSize);
+		memset(texLock.pBits, 0x00, texLock.Pitch*iSize);
 		// turn mem array into texture
 		Unlock();
 		}
@@ -1317,7 +1317,7 @@
 	if (lpDDraw) {
 		texLock.pBits = new unsigned char[iSize*iSize*lpDDraw->byByteCnt];
 		texLock.Pitch = iSize*lpDDraw->byByteCnt;
-		memset(texLock.pBits, 0xff, texLock.Pitch*iSize);
+		memset(texLock.pBits, 0x00, texLock.Pitch*iSize);
 		// Always locked
 		LockSize.left = LockSize.top = 0;
 		LockSize.right = LockSize.bottom = iSize;
@@ -1497,14 +1497,14 @@
 			for (y=rtClear.top; y<rtClear.bottom; ++y)
 				{
 				for (int x = rtClear.left; x < rtClear.right; ++x)
-					SetPix2(x, y, 0xf000);
+					SetPix2(x, y, 0x0000);
 				}
 			break;
 		case 4:
 			for (y=rtClear.top; y<rtClear.bottom; ++y)
 				{
 				for (int x = rtClear.left; x < rtClear.right; ++x)
-					SetPix4(x, y, 0xff000000);
+					SetPix4(x, y, 0x00000000);
 				}
 			break;
 		}
@@ -1517,7 +1517,24 @@
 	// ensure locked
 	if (!Lock()) return false;
 	// clear pixels
-	ZeroMemory(texLock.pBits, lpDDraw->byByteCnt*iSize*iSize);
+	int y;
+	switch (lpDDraw->byByteCnt)
+		{
+		case 2:
+			for (y=0; y<iSize; ++y)
+				{
+				for (int x = 0; x < iSize; ++x)
+					SetPix2(x, y, 0xf000);
+				}
+			break;
+		case 4:
+			for (y=0; y<iSize; ++y)
+				{
+				for (int x = 0; x < iSize; ++x)
+					SetPix4(x, y, 0xff000000);
+				}
+			break;
+		}
 	// success
 	return true;
 	}
diff -r 3293d23b602a src/platform/StdSurface8.cpp
--- a/src/platform/StdSurface8.cpp	Sat Aug 15 12:22:52 2009 -0400
+++ b/src/platform/StdSurface8.cpp	Sun Aug 23 16:56:00 2009 -0400
@@ -146,7 +146,7 @@
 				pPal->Colors[cnt*3+0]=BitmapInfo.Colors[cnt].rgbRed;
 				pPal->Colors[cnt*3+1]=BitmapInfo.Colors[cnt].rgbGreen;
 				pPal->Colors[cnt*3+2]=BitmapInfo.Colors[cnt].rgbBlue;
-				pPal->Alpha[cnt]=0;
+				pPal->Alpha[cnt]=0xff;
 				}
 			}
 		}
