diff --git a/OpenDreamClient/EntryPoint.cs b/OpenDreamClient/EntryPoint.cs index 59c831e9e6..4ef62926c8 100644 --- a/OpenDreamClient/EntryPoint.cs +++ b/OpenDreamClient/EntryPoint.cs @@ -21,6 +21,7 @@ public sealed class EntryPoint : GameClient { [Dependency] private readonly IDreamSoundEngine _soundEngine = default!; [Dependency] private readonly IOverlayManager _overlayManager = default!; [Dependency] private readonly ILightManager _lightManager = default!; + [Dependency] private readonly IConfigurationManager _configurationManager = default!; private const string UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)"; @@ -76,6 +77,12 @@ public override void PostInit() { _dreamInterface.Initialize(); IoCManager.Resolve().Initialize(); + + if (_configurationManager.GetCVar(CVars.DisplayCompat)) + _dreamInterface.OpenAlert( + "Compatibility Mode Warning", + "You are using compatibility mode. Clicking in-game objects is not supported in this mode.", + "Ok", null, null, null); } protected override void Dispose(bool disposing) { diff --git a/OpenDreamClient/Interface/DreamInterfaceManager.cs b/OpenDreamClient/Interface/DreamInterfaceManager.cs index ffd50d57f8..9f45fec40c 100644 --- a/OpenDreamClient/Interface/DreamInterfaceManager.cs +++ b/OpenDreamClient/Interface/DreamInterfaceManager.cs @@ -759,6 +759,7 @@ public interface IDreamInterfaceManager { void SaveScreenshot(bool openDialog); void LoadInterfaceFromSource(string source); + public void OpenAlert(string title, string message, string button1, string? button2, string? button3, Action? onClose); void Prompt(DreamValueType types, string title, string message, string defaultValue, Action? onClose); void RunCommand(string fullCommand); void StartRepeatingCommand(string command); diff --git a/OpenDreamClient/Interface/DummyDreamInterfaceManager.cs b/OpenDreamClient/Interface/DummyDreamInterfaceManager.cs index ed410a0ae3..dc2b53d530 100644 --- a/OpenDreamClient/Interface/DummyDreamInterfaceManager.cs +++ b/OpenDreamClient/Interface/DummyDreamInterfaceManager.cs @@ -44,6 +44,10 @@ public void WinSet(string? controlId, string winsetParams) { } + public void OpenAlert(string title, string message, string button1, string? button2, string? button3, Action? onClose) { + + } + public void Prompt(DreamValueType types, string title, string message, string defaultValue, Action? onClose) { } diff --git a/Resources/Shaders/alpha.swsl b/Resources/Shaders/alpha.swsl index bc9cd3cca5..2bd7be5618 100644 --- a/Resources/Shaders/alpha.swsl +++ b/Resources/Shaders/alpha.swsl @@ -27,7 +27,7 @@ void fragment() { // The mask is the average of RGB multiplied by A // Haven't actually tested this in BYOND, but it does give us behavior seen in SS13 - highp float mask = (mask_color.r + mask_color.g + mask_color.b) / 3 * mask_color.a; + highp float mask = (mask_color.r + mask_color.g + mask_color.b) / 3.0 * mask_color.a; if(mask_invert_flag){ new_color.a *= 1.0-mask; diff --git a/Resources/Shaders/blendoverlay.swsl b/Resources/Shaders/blendoverlay.swsl index 46c1f1c8ff..e75175193c 100644 --- a/Resources/Shaders/blendoverlay.swsl +++ b/Resources/Shaders/blendoverlay.swsl @@ -26,5 +26,5 @@ void fragment() { oldColor[2] * colorMatrix[3][2] + oldColor[3] * colorMatrix[3][3]; COLOR = zFromSrgb(COLOR + offsetVector); - COLOR.rgb *= isPlaneMaster ? 1 : COLOR.a; + COLOR.rgb *= isPlaneMaster ? 1.0 : COLOR.a; } diff --git a/Resources/Shaders/blur.swsl b/Resources/Shaders/blur.swsl index 4bfda52cb0..3503d82c4d 100644 --- a/Resources/Shaders/blur.swsl +++ b/Resources/Shaders/blur.swsl @@ -23,8 +23,8 @@ highp vec4 blur(sampler2D sp, highp vec2 uv, highp vec2 scale) { highp vec4 col = texture(sp, uv) * weight; highp float accum = weight; - for (highp int x = 0; x <= size*5; ++x) { - for (highp int y = 1; y <= size*5; ++y) { + for (highp int x = 0; x <= int(size)*5; ++x) { + for (highp int y = 1; y <= int(size)*5; ++y) { offset = vec2(x, y); weight = gaussian(offset); col += texture(sp, uv + scale * offset) * weight; @@ -49,8 +49,8 @@ void vertex() { VERTEX = apply_mvp(VERTEX); pos = (VERTEX + vec2(1.0)) / 2.0; - sigma = float(size*5) * 0.25; - sigma2 = 2. * sigma * sigma; + sigma = float(size*5.0) * 0.25; + sigma2 = 2.0 * sigma * sigma; pisigma2 = pi * sigma2; } diff --git a/Resources/Shaders/displacement.swsl b/Resources/Shaders/displacement.swsl index 10b4515799..e53949d72e 100644 --- a/Resources/Shaders/displacement.swsl +++ b/Resources/Shaders/displacement.swsl @@ -10,20 +10,18 @@ void fragment() { highp vec2 iResolution = vec2(textureSize(TEXTURE, 0))/2.0; //input texture is doubled in size, but we need the original size highp vec2 dResolution = vec2(textureSize(displacement_map, 0)); //this one is its original size - vec2 offset = vec2(x,y)/iResolution.xy; - vec2 maxdistortion = size/iResolution.xy; - + highp vec2 offset = vec2(x,y)/iResolution.xy; + highp vec2 maxdistortion = size/iResolution.xy; - vec2 subcoord = ((UV * textureSize(TEXTURE, 0)/dResolution) + (0.5 - (textureSize(TEXTURE, 0)/dResolution)/2.0)) + offset; + highp vec2 subcoord = ((UV * vec2(textureSize(TEXTURE, 0))/dResolution) + (0.5 - (vec2(textureSize(TEXTURE, 0))/dResolution)/2.0)) + offset; //sample the displacement map - vec4 dis = texture(displacement_map, subcoord); + highp vec4 dis = texture(displacement_map, subcoord); dis.r = (clamp(dis.r, 0.5-maxdistortion.x, 0.5+maxdistortion.x) - 0.5) * dis.a;//center them and apply alpha dis.g = (clamp(dis.g, 0.5-maxdistortion.y, 0.5+maxdistortion.y) - 0.5) * dis.a; - - vec2 dis_coord = vec2(dis.r, -dis.g)/2.0; + highp vec2 dis_coord = vec2(dis.r, -dis.g)/2.0; // Sample the texture - vec4 col = texture(TEXTURE, UV+dis_coord); + highp vec4 col = texture(TEXTURE, UV+dis_coord); // Output to screen COLOR = vec4(col); diff --git a/Resources/Shaders/drop_shadow.swsl b/Resources/Shaders/drop_shadow.swsl index dac64df88a..61d0d8ef50 100644 --- a/Resources/Shaders/drop_shadow.swsl +++ b/Resources/Shaders/drop_shadow.swsl @@ -8,24 +8,24 @@ uniform highp float y; uniform highp vec4 shadow_color; void fragment() { - highp float shadow_blur_samples = pow(size * 2 + 1, 2); + highp float shadow_blur_samples = pow((size * 2.0 + 1.0), 2.0); highp vec4 texture_color = zTexture(UV); highp vec2 ps = TEXTURE_PIXEL_SIZE; highp vec2 shadow_uv = UV - (ps * vec2(x, -y)); // Y is up - highp float sampled_shadow_alpha = 0; + highp float sampled_shadow_alpha = 0.0; for (highp float blur_x = -size; blur_x <= size; blur_x++) { for (highp float blur_y = -size; blur_y <= size; blur_y++) { - vec2 blur_uv = shadow_uv + ps * vec2(blur_x, blur_y); + highp vec2 blur_uv = shadow_uv + ps * vec2(blur_x, blur_y); sampled_shadow_alpha += zTexture(blur_uv).a / shadow_blur_samples; } } - vec4 final_shadow_color = vec4(shadow_color.rgb, shadow_color.a * sampled_shadow_alpha); + highp vec4 final_shadow_color = vec4(shadow_color.rgb, shadow_color.a * sampled_shadow_alpha); // Mix the shadow with the initial image based on the image's alpha - COLOR.rgb = final_shadow_color.rgb * (1 - texture_color.a) + (texture_color.rgb / texture_color.a); //texture color needs to be divided by alpha to account for alpha premultiplication in the overlay shader - COLOR.a = clamp(final_shadow_color.a + texture_color.a, 0, 1); + COLOR.rgb = final_shadow_color.rgb * (1.0 - texture_color.a) + (texture_color.rgb / texture_color.a); //texture color needs to be divided by alpha to account for alpha premultiplication in the overlay shader + COLOR.a = clamp(final_shadow_color.a + texture_color.a, 0.0, 1.0); COLOR.rgb *= COLOR.a; } \ No newline at end of file