diff --git a/src/ZoneCode/Game/T6/T6_Commands.txt b/src/ZoneCode/Game/T6/T6_Commands.txt index e19258fc..19107204 100644 --- a/src/ZoneCode/Game/T6/T6_Commands.txt +++ b/src/ZoneCode/Game/T6/T6_Commands.txt @@ -329,8 +329,7 @@ set count GfxPixelShaderLoadDef::program programSize; // MaterialShaderArgument use MaterialShaderArgument; -//set condition u::literalConst type == MTL_ARG_LITERAL_VERTEX_CONST || type == MTL_ARG_LITERAL_PIXEL_CONST; -set condition u::literalConst type == 1 || type == 7; +set condition u::literalConst type == MTL_ARG_LITERAL_VERTEX_CONST || type == MTL_ARG_LITERAL_PIXEL_CONST; set reusable u::literalConst; set count u::literalConst 1; diff --git a/src/ZoneCodeGenerator/Domain/Evaluation/OperandStatic.cs b/src/ZoneCodeGenerator/Domain/Evaluation/OperandStatic.cs index 42d39ac8..1649fcbb 100644 --- a/src/ZoneCodeGenerator/Domain/Evaluation/OperandStatic.cs +++ b/src/ZoneCodeGenerator/Domain/Evaluation/OperandStatic.cs @@ -9,6 +9,7 @@ namespace ZoneCodeGenerator.Domain.Evaluation class OperandStatic : IEvaluation { public int Value { get; } + public EnumMember EnumMemberValue { get; } public bool IsStatic => true; public int EvaluateNumeric() @@ -19,6 +20,13 @@ namespace ZoneCodeGenerator.Domain.Evaluation public OperandStatic(int value) { Value = value; + EnumMemberValue = null; + } + + public OperandStatic(EnumMember enumMember) + { + Value = (int) enumMember.Value; + EnumMemberValue = enumMember; } public override string ToString() diff --git a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs index 89f14b27..fbdfe81c 100644 --- a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs +++ b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestWithEvaluation.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using ZoneCodeGenerator.Domain; using ZoneCodeGenerator.Domain.Evaluation; using ZoneCodeGenerator.Domain.Information; using ZoneCodeGenerator.Parsing.Matching; @@ -94,6 +95,18 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests } var nameParts = typenameString.Split(new[] { "::" }, StringSplitOptions.None); + + if (nameParts.Length == 1 && arrayIndexStrings.Count == 0) + { + var enumMember = state.Repository.GetAllEnums().SelectMany(_enum => _enum.Members) + .FirstOrDefault(member => member.Name.Equals(nameParts[0])); + + if(enumMember != null) + { + return new OperandStatic(enumMember); + } + } + List referencedMemberChain = null; var referencedType = GetUsedTypes(state)