mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Improve FOF alpha/blendmode handling
This commit is contained in:
parent
1952932cc1
commit
26b0a8c6ec
1 changed files with 11 additions and 13 deletions
|
@ -24,6 +24,7 @@ using CodeImp.DoomBuilder.Geometry;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using CodeImp.DoomBuilder.IO;
|
using CodeImp.DoomBuilder.IO;
|
||||||
|
using SlimDX.DirectWrite;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -819,32 +820,29 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
//Read translucency value from texture name (#000-#255)
|
//Read translucency value from texture name (#000-#255)
|
||||||
private int ParseTranslucency(string tex)
|
private int ParseTranslucency(string tex)
|
||||||
{
|
{
|
||||||
int result = 128;
|
if (tex.StartsWith("#") && tex.Length >= 4 && int.TryParse(tex.Substring(1, 3), out int alpha))
|
||||||
if (tex.StartsWith("#"))
|
return General.Clamp(alpha, 0, 255);
|
||||||
{
|
else
|
||||||
int alpha;
|
return 128;
|
||||||
if (int.TryParse(tex.Substring(1, 3), out alpha) && alpha >= 0 && alpha <= 255) result = alpha;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
private bool ParseAdditive(string tex)
|
private bool ParseAdditive(string tex)
|
||||||
{
|
{
|
||||||
if (tex.StartsWith("#") && tex.Length >= 5)
|
if (tex.StartsWith("#") && tex.Length >= 5 && int.TryParse(tex.Substring(4, 1), out int value))
|
||||||
return int.TryParse(tex.Substring(4, 1), out int value) && value == 1;
|
return value == 1;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private bool ParseSubtractive(string tex)
|
private bool ParseSubtractive(string tex)
|
||||||
{
|
{
|
||||||
if (tex.StartsWith("#") && tex.Length >= 5)
|
if (tex.StartsWith("#") && tex.Length >= 5 && int.TryParse(tex.Substring(4, 1), out int value))
|
||||||
return int.TryParse(tex.Substring(4, 1), out int value) && value == 2;
|
return value == 2;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private bool ParseReverseSubtractive(string tex)
|
private bool ParseReverseSubtractive(string tex)
|
||||||
{
|
{
|
||||||
if (tex.StartsWith("#") && tex.Length >= 5)
|
if (tex.StartsWith("#") && tex.Length >= 5 && int.TryParse(tex.Substring(4, 1), out int value))
|
||||||
return int.TryParse(tex.Substring(4, 1), out int value) && value == 3;
|
return value == 3;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue