diff --git a/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs b/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs index 4f2affb8f..d0f9934d0 100644 --- a/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs +++ b/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs @@ -117,32 +117,6 @@ namespace ClassicalSharp { } } - public override void DrawClippedText(ref DrawTextArgs args, int x, int y, float maxWidth, float maxHeight) { - if (EmptyText(args.Text)) return; - if (!args.SkipPartsCheck) - GetTextParts(args.Text); - - Brush shadowBrush = GetOrCreateBrush(PackedCol.Black); - StringFormatFlags flags = format.FormatFlags; - format.FormatFlags |= StringFormatFlags.NoWrap; - format.Trimming = StringTrimming.EllipsisCharacter; - float textX = x; - - for (int i = 0; i < parts.Count; i++) { - TextPart part = parts[i]; - Brush textBrush = GetOrCreateBrush(part.Col); - RectangleF rect = new RectangleF(textX + Offset, y + Offset, maxWidth, maxHeight); - if (args.UseShadow) - g.DrawString(part.Text, args.Font, shadowBrush, rect, format); - - rect = new RectangleF(textX, y, maxWidth, maxHeight); - g.DrawString(part.Text, args.Font, textBrush, rect, format); - textX += g.MeasureString(part.Text, args.Font, Int32.MaxValue, format).Width; - } - format.Trimming = StringTrimming.None; - format.FormatFlags = flags; - } - FastBitmap bitmapWrapper = new FastBitmap(); protected override void DrawBitmappedText(ref DrawTextArgs args, int x, int y) { using (bitmapWrapper) { diff --git a/ClassicalSharp/2D/Drawing/IDrawer2D.cs b/ClassicalSharp/2D/Drawing/IDrawer2D.cs index 93e53067a..ceaa515ab 100644 --- a/ClassicalSharp/2D/Drawing/IDrawer2D.cs +++ b/ClassicalSharp/2D/Drawing/IDrawer2D.cs @@ -68,10 +68,6 @@ namespace ClassicalSharp { protected abstract void DrawSysText(ref DrawTextArgs args, int x, int y); - /// Draws a string using the specified arguments and fonts at the - /// specified coordinates in the currently bound bitmap, clipping if necessary. - public abstract void DrawClippedText(ref DrawTextArgs args, int x, int y, float maxWidth, float maxHeight); - protected abstract void DrawBitmappedText(ref DrawTextArgs args, int x, int y); public void DrawText(ref DrawTextArgs args, int x, int y) { diff --git a/ClassicalSharp/2D/Utils/PackedCol.cs b/ClassicalSharp/2D/Utils/PackedCol.cs index c814daed7..5760e2852 100644 --- a/ClassicalSharp/2D/Utils/PackedCol.cs +++ b/ClassicalSharp/2D/Utils/PackedCol.cs @@ -9,7 +9,8 @@ using AndroidColor = Android.Graphics.Color; namespace ClassicalSharp { /// Structure that can be used for quick manipulations of A/R/G/B colours. - /// This structure is **not** suitable for interop with OpenGL or Direct3D. + /// This structure is suitable for interop with OpenGL or Direct3D. + /// The order of each colour component differs depending on the underlying API. [StructLayout(LayoutKind.Explicit)] public struct PackedCol : IEquatable { @@ -44,8 +45,8 @@ namespace ClassicalSharp { public PackedCol(int r, int g, int b) { Packed = 0; A = 255; R = (byte)r; G = (byte)g; B = (byte)b; - } - + } + /// Multiplies the RGB components of this instance by the /// specified t parameter, where 0 ≤ t ≤ 1 public static PackedCol Scale(PackedCol value, float t) { @@ -71,21 +72,21 @@ namespace ClassicalSharp { lo * ((hex >> 0) & 1) + hi * (hex >> 3)); } -#if !LAUNCHER + #if !LAUNCHER public const float ShadeX = 0.6f, ShadeZ = 0.8f, ShadeYBottom = 0.5f; - public static void GetShaded(PackedCol normal, out PackedCol xSide, + public static void GetShaded(PackedCol normal, out PackedCol xSide, out PackedCol zSide, out PackedCol yBottom) { xSide = PackedCol.Scale(normal, ShadeX); zSide = PackedCol.Scale(normal, ShadeZ); yBottom = PackedCol.Scale(normal, ShadeYBottom); } -#endif + #endif /// Packs this instance into a 32 bit integer, where A occupies /// the highest 8 bits and B occupies the lowest 8 bits. - public int ToArgb() { return A << 24 | R << 16 | G << 8 | B; } - + public int ToArgb() { return A << 24 | R << 16 | G << 8 | B; } + public static PackedCol Argb(int c) { PackedCol col = default(PackedCol); col.A = (byte)(c >> 24); @@ -99,20 +100,19 @@ namespace ClassicalSharp { return (obj is PackedCol) && Equals((PackedCol)obj); } - public bool Equals(PackedCol other) { return Packed == other.Packed; } + public bool Equals(PackedCol other) { return Packed == other.Packed; } public override int GetHashCode() { return (int)Packed; } public override string ToString() { return R + ", " + G + ", " + B + " : " + A; } - public static bool operator == (PackedCol left, PackedCol right) { - return left.Equals(right); + return left.Packed == right.Packed; } public static bool operator != (PackedCol left, PackedCol right) { - return !left.Equals(right); + return left.Packed != right.Packed; } public static PackedCol operator * (PackedCol left, PackedCol right) { @@ -142,14 +142,14 @@ namespace ClassicalSharp { public static PackedCol Yellow = new PackedCol(255, 255, 0); public static PackedCol Magenta = new PackedCol(255, 0, 255); public static PackedCol Cyan = new PackedCol(0, 255, 255); - + public string ToHex() { byte[] array = new byte[] { R, G, B }; int len = array.Length; char[] hex = new char[len * 2]; for (int i = 0; i < array.Length; i++) { - int value = array[i], hi = value >> 4, lo = value & 0x0F; + int value = array[i], hi = value >> 4, lo = value & 0x0F; // 48 = index of 0, 55 = index of (A - 10) hex[i * 2 + 0] = hi < 10 ? (char)(hi + 48) : (char)(hi + 55); hex[i * 2 + 1] = lo < 10 ? (char)(lo + 48) : (char)(lo + 55); diff --git a/ClassicalSharp/GraphicsAPI/D3D9.cs b/ClassicalSharp/GraphicsAPI/D3D9.cs index 477417ee7..69eecce87 100644 --- a/ClassicalSharp/GraphicsAPI/D3D9.cs +++ b/ClassicalSharp/GraphicsAPI/D3D9.cs @@ -434,7 +434,6 @@ namespace SharpDX.Direct3D9 { SpecularEnable = 29, FogColor = 34, FogTableMode = 35, - FogStart = 36, FogEnd = 37, FogDensity = 38, Lighting = 137, diff --git a/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs b/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs index 4b3092c2f..84a73517a 100644 --- a/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs +++ b/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs @@ -128,19 +128,13 @@ namespace ClassicalSharp.GraphicsAPI { Device.SetRenderState(device, RenderState.FogColor, (int)fogCol.Packed); } - float fogDensity = -1, fogStart = -1, fogEnd = -1; + float fogDensity = -1, fogEnd = -1; public override void SetFogDensity(float value) { if (value == fogDensity) return; fogDensity = value; if (LostContext) return; Device.SetRenderState(device, RenderState.FogDensity, value); } - - public override void SetFogStart(float value) { - fogStart = value; - if (LostContext) return; - Device.SetRenderState(device, RenderState.FogStart, value); - } public override void SetFogEnd(float value) { if (value == fogEnd) return; @@ -484,7 +478,6 @@ namespace ClassicalSharp.GraphicsAPI { Device.SetRenderState(device, RenderState.FogEnable, fogEnable); Device.SetRenderState(device, RenderState.FogColor, (int)fogCol.Packed); Device.SetRenderState(device, RenderState.FogDensity, fogDensity); - Device.SetRenderState(device, RenderState.FogStart, fogStart); Device.SetRenderState(device, RenderState.FogEnd, fogEnd); Device.SetRenderState(device, RenderState.FogTableMode, (int)fogTableMode); Device.SetRenderState(device, RenderState.ZFunc, (int)depthTestFunc); diff --git a/ClassicalSharp/GraphicsAPI/GL.cs b/ClassicalSharp/GraphicsAPI/GL.cs index 2f5c8f6ef..0508ac6a8 100644 --- a/ClassicalSharp/GraphicsAPI/GL.cs +++ b/ClassicalSharp/GraphicsAPI/GL.cs @@ -353,7 +353,6 @@ namespace OpenTK.Graphics.OpenGL { public enum FogParameter : int { FogDensity = 0x0B62, - FogStart = 0x0B63, FogEnd = 0x0B64, FogMode = 0x0B65, FogColor = 0x0B66, diff --git a/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs b/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs index a4d0a56da..bafdcb543 100644 --- a/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs +++ b/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs @@ -59,7 +59,6 @@ namespace ClassicalSharp.GraphicsAPI { public abstract bool Fog { get; set; } public abstract void SetFogCol(PackedCol col); public abstract void SetFogDensity(float value); - public abstract void SetFogStart(float value); public abstract void SetFogEnd(float value); public abstract void SetFogMode(Fog fogMode); diff --git a/ClassicalSharp/GraphicsAPI/OpenGLApi.cs b/ClassicalSharp/GraphicsAPI/OpenGLApi.cs index b7a53a98c..3527ef2ee 100644 --- a/ClassicalSharp/GraphicsAPI/OpenGLApi.cs +++ b/ClassicalSharp/GraphicsAPI/OpenGLApi.cs @@ -113,10 +113,6 @@ namespace ClassicalSharp.GraphicsAPI { lastFogDensity = value; } - public override void SetFogStart(float value) { - GL.Fogf(FogParameter.FogStart, value); - } - public override void SetFogEnd(float value) { if (value == lastFogEnd) return; GL.Fogf(FogParameter.FogEnd, value); diff --git a/ClassicalSharp/GraphicsAPI/OpenGLESApi.cs b/ClassicalSharp/GraphicsAPI/OpenGLESApi.cs index bea3e8a3e..555ca26be 100644 --- a/ClassicalSharp/GraphicsAPI/OpenGLESApi.cs +++ b/ClassicalSharp/GraphicsAPI/OpenGLESApi.cs @@ -56,15 +56,11 @@ namespace ClassicalSharp.GraphicsAPI { } } - float lastFogStart = -1, lastFogEnd = -1, lastFogDensity = -1; + float lastFogEnd = -1, lastFogDensity = -1; public override void SetFogDensity(float value) { FogParam(All.FogDensity, value, ref lastFogDensity); } - public override void SetFogStart(float value) { - FogParam(All.FogStart, value, ref lastFogStart); - } - public override void SetFogEnd(float value) { FogParam(All.FogEnd, value, ref lastFogEnd); } diff --git a/Launcher2/Drawing/Drawer2DExt.cs b/Launcher2/Drawing/Drawer2DExt.cs index ec35a3424..581a7fb00 100644 --- a/Launcher2/Drawing/Drawer2DExt.cs +++ b/Launcher2/Drawing/Drawer2DExt.cs @@ -18,7 +18,7 @@ namespace Launcher.Drawing { row[x + xx] = pixel; } } - + public static bool ClampCoords(FastBitmap bmp, Rectangle rect, out int x, out int y, out int width, out int height) { width = rect.Width; height = rect.Height; @@ -28,35 +28,50 @@ namespace Launcher.Drawing { if (x < 0) { width += x; x = 0; } if (y < 0) { height += y; y = 0; } - width = Math.Min(x + width, bmp.Width) - x; + width = Math.Min(x + width, bmp.Width) - x; height = Math.Min(y + height, bmp.Height) - y; return width > 0 && height > 0; - } + } + static bool TryDraw(ref DrawTextArgs args, IDrawer2D drawer, + int x, int y, int maxWidth) { + Size size = drawer.MeasureSize(ref args); + if (size.Width > maxWidth) return false; + + args.SkipPartsCheck = true; + drawer.DrawText(ref args, x, y); + return true; + } + public static void DrawClippedText(ref DrawTextArgs args, IDrawer2D drawer, int x, int y, int maxWidth) { Size size = drawer.MeasureSize(ref args); - // No clipping necessary - if (size.Width <= maxWidth) { drawer.DrawText(ref args, x, y); return; } - DrawTextArgs copy = args; - copy.SkipPartsCheck = true; + // No clipping needed + if (size.Width <= maxWidth) { + args.SkipPartsCheck = true; + drawer.DrawText(ref args, x, y); return; + } - char[] chars = new char[args.Text.Length + 2]; - for (int i = 0; i < args.Text.Length; i++) - chars[i] = args.Text[i]; - chars[args.Text.Length] = '.'; - chars[args.Text.Length + 1] = '.'; + string text = args.Text; + char[] chars = new char[text.Length + 2]; - for (int len = args.Text.Length; len > 0; len--) { - chars[len] = '.'; - if (chars[len - 1] == ' ') continue; + for (int i = 0; i < text.Length; i++) { chars[i] = text[i]; } + chars[text.Length] = '.'; + chars[text.Length + 1] = '.'; + + DrawTextArgs part = args; + for (int i = text.Length - 1; i > 0; i--) { + chars[i] = '.'; + if (text[i - 1] == ' ') continue; - copy.Text = new string(chars, 0, len + 2); - size = drawer.MeasureSize(ref copy); - if (size.Width > maxWidth) continue; + part.Text = new string(chars, 0, i + 2); + if (TryDraw(ref part, drawer, x, y, maxWidth)) return; - drawer.DrawText(ref copy, x, y); return; + // If down to <= 2 chars, try omit trailing .. + if (i > 2) continue; + part.Text = new string(chars, 0, i); + if (TryDraw(ref part, drawer, x, y, maxWidth)) return; } } } diff --git a/Launcher2/Gui/TableWidget/TableView.cs b/Launcher2/Gui/TableWidget/TableView.cs index 98fceae2d..6f0d05bf4 100644 --- a/Launcher2/Gui/TableWidget/TableView.cs +++ b/Launcher2/Gui/TableWidget/TableView.cs @@ -159,8 +159,7 @@ namespace Launcher.Gui.Widgets { if (!empty) { size.Width = Math.Min(maxWidth, size.Width); args.SkipPartsCheck = false; - //Drawer2DExt.DrawClippedText(ref args, drawer, x, y, maxWidth); - drawer.DrawClippedText(ref args, x, y, maxWidth, 30); + Drawer2DExt.DrawClippedText(ref args, drawer, x, y, maxWidth); } y += size.Height + 2; return true; diff --git a/src/Client/AsyncDownloader.c b/src/Client/AsyncDownloader.c index e1c2afca8..84d59a6f7 100644 --- a/src/Client/AsyncDownloader.c +++ b/src/Client/AsyncDownloader.c @@ -92,7 +92,7 @@ static void AsyncDownloader_Add(String* url, bool priority, String* id, UInt8 ty if (etag) { String reqEtag = String_FromEmptyArray(req.Etag); String_Set(&reqEtag, etag); } - //request.Data = data; TODO: Implement this. do we need to copy or expect caller to malloc it? + /* request.Data = data; TODO: Implement this. do we need to copy or expect caller to malloc it? */ Platform_CurrentUTCTime(&req.TimeAdded); if (priority) { diff --git a/src/Client/AsyncDownloader.h b/src/Client/AsyncDownloader.h index 70eda71ca..a4aa5b193 100644 --- a/src/Client/AsyncDownloader.h +++ b/src/Client/AsyncDownloader.h @@ -10,9 +10,11 @@ struct IGameComponent; struct ScheduledTask; enum REQUEST_TYPE { REQUEST_TYPE_DATA, REQUEST_TYPE_CONTENT_LENGTH }; -#define ASYNC_PROGRESS_NOTHING -3 -#define ASYNC_PROGRESS_MAKING_REQUEST -2 -#define ASYNC_PROGRESS_FETCHING_DATA -1 +enum ASYNC_PROGRESS { + ASYNC_PROGRESS_NOTHING = -3, + ASYNC_PROGRESS_MAKING_REQUEST = -2, + ASYNC_PROGRESS_FETCHING_DATA = -1, +}; struct AsyncRequest { UChar URL[String_BufferSize(STRING_SIZE)]; @@ -37,7 +39,7 @@ void AsyncDownloader_GetSkin(STRING_PURE String* id, STRING_PURE String* skinNam void AsyncDownloader_GetData(STRING_PURE String* url, bool priority, STRING_PURE String* id); void AsyncDownloader_GetContentLength(STRING_PURE String* url, bool priority, STRING_PURE String* id); /* TODO: Implement post */ -//void AsyncDownloader_PostString(STRING_PURE String* url, bool priority, STRING_PURE String* id, STRING_PURE String* contents); +/* void AsyncDownloader_PostString(STRING_PURE String* url, bool priority, STRING_PURE String* id, STRING_PURE String* contents); */ void AsyncDownloader_GetDataEx(STRING_PURE String* url, bool priority, STRING_PURE String* id, DateTime* lastModified, STRING_PURE String* etag); bool AsyncDownloader_Get(STRING_PURE String* id, struct AsyncRequest* item); diff --git a/src/Client/D3D9Api.c b/src/Client/D3D9Api.c index dfce99954..795945521 100644 --- a/src/Client/D3D9Api.c +++ b/src/Client/D3D9Api.c @@ -311,14 +311,6 @@ void Gfx_SetFogDensity(Real32 value) { D3D9_SetRenderState(D3DRS_FOGDENSITY, raw.uVal, "D3D9_SetFogDensity"); } -Real32 d3d9_fogStart = -1.0f; -void Gfx_SetFogStart(Real32 value) { - d3d9_fogStart = value; - if (Gfx_LostContext) return; - IntAndFloat raw; raw.fVal = value; - D3D9_SetRenderState(D3DRS_FOGSTART, raw.uVal, "D3D9_SetFogStart"); -} - Real32 d3d9_fogEnd = -1.0f; void Gfx_SetFogEnd(Real32 value) { if (value == d3d9_fogEnd) return; @@ -656,8 +648,6 @@ static void D3D9_RestoreRenderStates(void) { D3D9_SetRenderState2(D3DRS_FOGCOLOR, d3d9_fogCol, "D3D9_FogColor"); raw.fVal = d3d9_fogDensity; D3D9_SetRenderState2(D3DRS_FOGDENSITY, raw.uVal, "D3D9_FogDensity"); - raw.fVal = d3d9_fogStart; - D3D9_SetRenderState2(D3DRS_FOGSTART, raw.uVal, "D3D9_FogStart"); raw.fVal = d3d9_fogEnd; D3D9_SetRenderState2(D3DRS_FOGEND, raw.uVal, "D3D9_FogEnd"); D3D9_SetRenderState2(D3DRS_FOGTABLEMODE, d3d9_fogTableMode, "D3D9_FogMode"); diff --git a/src/Client/Drawer2D.c b/src/Client/Drawer2D.c index be66761cc..c7b25cc5e 100644 --- a/src/Client/Drawer2D.c +++ b/src/Client/Drawer2D.c @@ -295,7 +295,7 @@ static void Drawer2D_DrawUnderline(struct DrawTextArgs* args, Int32 x, Int32 y, UChar c = text.buffer[i]; if (c == '&' && Drawer2D_ValidColCodeAt(&text, i + 1)) { col = Drawer2D_Cols[text.buffer[i + 1]]; - i++; continue; // Skip over the colour code. + i++; continue; /* Skip over the colour code */ } Int32 dstWidth = Drawer2D_Width(point, c); diff --git a/src/Client/EnvRenderer.c b/src/Client/EnvRenderer.c index 337a02948..726fb3272 100644 --- a/src/Client/EnvRenderer.c +++ b/src/Client/EnvRenderer.c @@ -299,35 +299,35 @@ void EnvRenderer_RenderSkybox(Real64 deltaTime) { Gfx_SetDepthWrite(true); } -VertexP3fT2fC4b skybox_vertices[SKYBOX_COUNT] = { - /* Front quad */ - { 1, -1, -1, {0,0,0,0}, 0.25f, 1.00f }, { -1, -1, -1, {0,0,0,0}, 0.50f, 1.00f }, - { -1, 1, -1, {0,0,0,0}, 0.50f, 0.50f }, { 1, 1, -1, {0,0,0,0}, 0.25f, 0.50f }, - /* Left quad */ - { 1, -1, 1, {0,0,0,0}, 0.00f, 1.00f }, { 1, -1, -1, {0,0,0,0}, 0.25f, 1.00f }, - { 1, 1, -1, {0,0,0,0}, 0.25f, 0.50f }, { 1, 1, 1, {0,0,0,0}, 0.00f, 0.50f }, - /* Back quad */ - { -1, -1, 1, {0,0,0,0}, 0.75f, 1.00f }, { 1, -1, 1, {0,0,0,0}, 1.00f, 1.00f }, - { 1, 1, 1, {0,0,0,0}, 1.00f, 0.50f }, { -1, 1, 1, {0,0,0,0}, 0.75f, 0.50f }, - /* Right quad */ - { -1, -1, -1, {0,0,0,0}, 0.50f, 1.00f }, { -1, -1, 1, {0,0,0,0}, 0.75f, 1.00f }, - { -1, 1, 1, {0,0,0,0}, 0.75f, 0.50f }, { -1, 1, -1, {0,0,0,0}, 0.50f, 0.50f }, - /* Top quad */ - { -1, 1, -1, {0,0,0,0}, 0.50f, 0.50f }, { -1, 1, 1, {0,0,0,0}, 0.50f, 0.00f }, - { 1, 1, 1, {0,0,0,0}, 0.25f, 0.00f }, { 1, 1, -1, {0,0,0,0}, 0.25f, 0.50f }, - /* Bottom quad */ - { -1, -1, -1, {0,0,0,0}, 0.75f, 0.50f }, { -1, -1, 1, {0,0,0,0}, 0.75f, 0.00f }, - { 1, -1, 1, {0,0,0,0}, 0.50f, 0.00f }, { 1, -1, -1, {0,0,0,0}, 0.50f, 0.50f }, -}; - static void EnvRenderer_UpdateSkybox(void) { if (Gfx_LostContext) return; Gfx_DeleteVb(&skybox_vb); if (EnvRenderer_Minimal) return; + static VertexP3fT2fC4b vertices[SKYBOX_COUNT] = { + /* Front quad */ + { 1, -1, -1, {0,0,0,0}, 0.25f, 1.00f }, { -1, -1, -1, {0,0,0,0}, 0.50f, 1.00f }, + { -1, 1, -1, {0,0,0,0}, 0.50f, 0.50f }, { 1, 1, -1, {0,0,0,0}, 0.25f, 0.50f }, + /* Left quad */ + { 1, -1, 1, {0,0,0,0}, 0.00f, 1.00f }, { 1, -1, -1, {0,0,0,0}, 0.25f, 1.00f }, + { 1, 1, -1, {0,0,0,0}, 0.25f, 0.50f }, { 1, 1, 1, {0,0,0,0}, 0.00f, 0.50f }, + /* Back quad */ + { -1, -1, 1, {0,0,0,0}, 0.75f, 1.00f }, { 1, -1, 1, {0,0,0,0}, 1.00f, 1.00f }, + { 1, 1, 1, {0,0,0,0}, 1.00f, 0.50f }, { -1, 1, 1, {0,0,0,0}, 0.75f, 0.50f }, + /* Right quad */ + { -1, -1, -1, {0,0,0,0}, 0.50f, 1.00f }, { -1, -1, 1, {0,0,0,0}, 0.75f, 1.00f }, + { -1, 1, 1, {0,0,0,0}, 0.75f, 0.50f }, { -1, 1, -1, {0,0,0,0}, 0.50f, 0.50f }, + /* Top quad */ + { -1, 1, -1, {0,0,0,0}, 0.50f, 0.50f }, { -1, 1, 1, {0,0,0,0}, 0.50f, 0.00f }, + { 1, 1, 1, {0,0,0,0}, 0.25f, 0.00f }, { 1, 1, -1, {0,0,0,0}, 0.25f, 0.50f }, + /* Bottom quad */ + { -1, -1, -1, {0,0,0,0}, 0.75f, 0.50f }, { -1, -1, 1, {0,0,0,0}, 0.75f, 0.00f }, + { 1, -1, 1, {0,0,0,0}, 0.50f, 0.00f }, { 1, -1, -1, {0,0,0,0}, 0.50f, 0.50f }, + }; + Int32 i; - for (i = 0; i < SKYBOX_COUNT; i++) { skybox_vertices[i].Col = WorldEnv_CloudsCol; } - skybox_vb = Gfx_CreateVb(skybox_vertices, VERTEX_FORMAT_P3FT2FC4B, SKYBOX_COUNT); + for (i = 0; i < SKYBOX_COUNT; i++) { vertices[i].Col = WorldEnv_CloudsCol; } + skybox_vb = Gfx_CreateVb(vertices, VERTEX_FORMAT_P3FT2FC4B, SKYBOX_COUNT); } diff --git a/src/Client/GraphicsAPI.h b/src/Client/GraphicsAPI.h index ef5d6cd94..e4a126655 100644 --- a/src/Client/GraphicsAPI.h +++ b/src/Client/GraphicsAPI.h @@ -56,7 +56,6 @@ bool Gfx_GetFog(void); void Gfx_SetFog(bool enabled); void Gfx_SetFogCol(PackedCol col); void Gfx_SetFogDensity(Real32 value); -void Gfx_SetFogStart(Real32 value); void Gfx_SetFogEnd(Real32 value); void Gfx_SetFogMode(Int32 fogMode); diff --git a/src/Client/GraphicsCommon.c b/src/Client/GraphicsCommon.c index 984767999..f8a207754 100644 --- a/src/Client/GraphicsCommon.c +++ b/src/Client/GraphicsCommon.c @@ -167,7 +167,7 @@ static UInt32 GfxCommon_Average(UInt32 p1, UInt32 p2) { UInt32 a1 = ((p1 & alphaMask) >> 24) & 0xFF; UInt32 a2 = ((p2 & alphaMask) >> 24) & 0xFF; UInt32 aSum = (a1 + a2); - aSum = aSum > 0 ? aSum : 1; // avoid divide by 0 below + aSum = aSum > 0 ? aSum : 1; /* avoid divide by 0 below */ /* Convert RGB to pre-multiplied form */ UInt32 r1 = ((p1 >> 16) & 0xFF) * a1, g1 = ((p1 >> 8) & 0xFF) * a1, b1 = (p1 & 0xFF) * a1; diff --git a/src/Client/OpenGLApi.c b/src/Client/OpenGLApi.c index 3a997749d..40bad9f34 100644 --- a/src/Client/OpenGLApi.c +++ b/src/Client/OpenGLApi.c @@ -203,10 +203,6 @@ void Gfx_SetFogDensity(Real32 value) { gl_lastFogDensity = value; } -void Gfx_SetFogStart(Real32 value) { - glFogf(GL_FOG_START, value); -} - void Gfx_SetFogEnd(Real32 value) { if (value == gl_lastFogEnd) return; glFogf(GL_FOG_END, value); diff --git a/src/Client/PackedCol.h b/src/Client/PackedCol.h index 97eed6cde..decc4a0e2 100644 --- a/src/Client/PackedCol.h +++ b/src/Client/PackedCol.h @@ -6,15 +6,13 @@ */ /* Represents an ARGB colour, in a format suitable for the native graphics api. */ -typedef struct PackedCol_ { - union { +typedef union PackedCol_ { #if CC_BUILD_D3D9 - struct { UInt8 B; UInt8 G; UInt8 R; UInt8 A; }; + struct { UInt8 B; UInt8 G; UInt8 R; UInt8 A; }; #else - struct { UInt8 R; UInt8 G; UInt8 B; UInt8 A; }; + struct { UInt8 R; UInt8 G; UInt8 B; UInt8 A; }; #endif - UInt32 Packed; - }; + UInt32 Packed; } PackedCol; #if CC_BUILD_D3D9 diff --git a/src/Client/Program.c b/src/Client/Program.c index cb5f35082..9f5135ade 100644 --- a/src/Client/Program.c +++ b/src/Client/Program.c @@ -154,10 +154,12 @@ String lines10[3] = { 0 }; WordWrap_Do(&text10, lines10, 3, 4); */ -//#include int main_test(int argc, char* argv[]) { return 0; - /*void* file; + /* + #include + + void* file; String path = String_FromConstant("H:\\PortableApps\\GitPortable\\App\\Git\\ClassicalSharp\\output\\release\\texpacks\\skybox.png"); ReturnCode openCode = Platform_FileOpen(&file, &path); Stream fileStream; diff --git a/src/Client/Screens.c b/src/Client/Screens.c index b230f180a..cefe4b3da 100644 --- a/src/Client/Screens.c +++ b/src/Client/Screens.c @@ -814,11 +814,10 @@ static void ChatScreen_CheckOtherStatuses(struct ChatScreen* screen) { bool hasRequest = AsyncDownloader_GetCurrent(&request, &progress); String id = String_FromRawArray(request.ID); - String terrain = String_FromConst("terrain"); String texPack = String_FromConst("texturePack"); /* Is terrain / texture pack currently being downloaded? */ - if (!hasRequest || !(String_Equals(&id, &terrain) || String_Equals(&id, &texPack))) { + if (!hasRequest || !String_Equals(&id, &texPack)) { if (screen->Status.Textures[1].ID) { String empty = String_MakeNull(); TextGroupWidget_SetText(&screen->Status, 1, &empty); diff --git a/src/Client/Typedefs.h b/src/Client/Typedefs.h index b67e0da4a..d21c2025e 100644 --- a/src/Client/Typedefs.h +++ b/src/Client/Typedefs.h @@ -59,7 +59,7 @@ struct FontDesc { void* Handle; UInt16 Size, Style; }; #define UInt32_MaxValue ((UInt32)4294967295UL) #define CC_BUILD_GL11 false -#define CC_BUILD_D3D9 true +#define CC_BUILD_D3D9 false #define CC_BUILD_WIN true #define CC_BUILD_OSX false diff --git a/src/Client/X11Window.c b/src/Client/X11Window.c index fd6bbb4d2..cc4380e87 100644 --- a/src/Client/X11Window.c +++ b/src/Client/X11Window.c @@ -556,9 +556,9 @@ void Window_ProcessEvents(void) { Event_RaiseVoid(&WindowEvents_WindowStateChanged); } - //if (e.xproperty.atom == net_frame_extents) { - // RefreshWindowBorders(); - //} + /*if (e.xproperty.atom == net_frame_extents) { + RefreshWindowBorders(); + }*/ break; case SelectionNotify: @@ -721,10 +721,9 @@ void GLContext_SetVSync(bool enabled) { static void GLContext_GetAttribs(struct GraphicsMode mode, Int32* attribs) { Int32 i = 0; struct ColorFormat color = mode.Format; - // See http://www-01.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.opengl/doc/openglrf/glXChooseFBConfig.htm%23glxchoosefbconfig - // See http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.opengl/doc/openglrf/glXChooseVisual.htm%23b5c84be452rree - // for the attribute declarations. Note that the attributes are different than those used in Glx.ChooseVisual. - + /* See http://www-01.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.opengl/doc/openglrf/glXChooseFBConfig.htm%23glxchoosefbconfig */ + /* See http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.opengl/doc/openglrf/glXChooseVisual.htm%23b5c84be452rree */ + /* for the attribute declarations. Note that the attributes are different than those used in Glx.ChooseVisual */ if (!color.IsIndexed) { attribs[i++] = GLX_RGBA;