Пример #1
0
        public static bool PropertiesMatch(SidedefPropertiesCopySettings flags, Sidedef source, Sidedef target)
        {
            // Built-in properties
            if (flags.OffsetX && source.OffsetX != target.OffsetX)
            {
                return(false);
            }
            if (flags.OffsetY && source.OffsetY != target.OffsetY)
            {
                return(false);
            }
            if (flags.UpperTexture && source.HighTexture != target.HighTexture)
            {
                return(false);
            }
            if (flags.MiddleTexture && source.MiddleTexture != target.MiddleTexture)
            {
                return(false);
            }
            if (flags.LowerTexture && source.LowTexture != target.LowTexture)
            {
                return(false);
            }
            if (!General.Map.UDMF)
            {
                return(true);
            }

            // UDMF-specific properties
            if (flags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags()))
            {
                return(false);
            }

            // UI fields
            if (!UIFieldsMatch(flags, source, target))
            {
                return(false);
            }

            // Custom fields
            return(!flags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields));
        }
Пример #2
0
        public static bool PropertiesMatch(VertexPropertiesCopySettings flags, Vertex source, Vertex target)
        {
            if (!General.Map.UDMF)
            {
                return(true);
            }

            // Built-in properties
            if (flags.ZCeiling && source.ZCeiling != target.ZCeiling)
            {
                return(false);
            }
            if (flags.ZFloor && source.ZFloor != target.ZFloor)
            {
                return(false);
            }

            // Custom fields
            return(!flags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields));
        }
Пример #3
0
        public static bool PropertiesMatch(ThingPropertiesCopySettings flags, Thing source, Thing target)
        {
            // Built-in properties
            if (flags.Type && source.Type != target.Type)
            {
                return(false);
            }
            if (flags.Angle && source.AngleDoom != target.AngleDoom)
            {
                return(false);
            }
            if (flags.Action && source.Action != target.Action)
            {
                return(false);
            }
            if (flags.Arguments)
            {
                // Classic args
                for (int i = 0; i < source.Args.Length; i++)
                {
                    if (source.Args[i] != target.Args[i])
                    {
                        return(false);
                    }
                }

                // String args
                if (General.Map.UDMF)
                {
                    if (!UniFields.ValuesMatch("arg0str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg1str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg2str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg3str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg4str", source, target))
                    {
                        return(false);
                    }
                }
            }
            if (flags.Tag && source.Tag != target.Tag)
            {
                return(false);
            }
            if (flags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags()))
            {
                return(false);
            }
            if (!General.Map.UDMF)
            {
                return(true);
            }

            // UDMF-specific properties
            if (flags.Pitch && source.Pitch != target.Pitch)
            {
                return(false);
            }
            if (flags.Roll && source.Roll != target.Roll)
            {
                return(false);
            }
            if (flags.Scale && (source.ScaleX != target.ScaleX) || (source.ScaleY != target.ScaleY))
            {
                return(false);
            }

            // UI fields
            if (!UIFieldsMatch(flags, source, target))
            {
                return(false);
            }

            // Custom fields
            return(!flags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields));
        }
Пример #4
0
        public static bool PropertiesMatch(LinedefPropertiesCopySettings linedefflags, SidedefPropertiesCopySettings sideflags, Linedef source, Linedef target)
        {
            // Built-in properties
            if (linedefflags.Action && source.Action != target.Action)
            {
                return(false);
            }
            if (linedefflags.Activation && source.Activate != target.Activate)
            {
                return(false);
            }
            if (linedefflags.Tag && !TagsMatch(source.Tags, target.Tags))
            {
                return(false);
            }
            if (linedefflags.Arguments)
            {
                // Classic args
                for (int i = 0; i < source.Args.Length; i++)
                {
                    if (source.Args[i] != target.Args[i])
                    {
                        return(false);
                    }
                }

                // String args
                if (General.Map.UDMF)
                {
                    if (!UniFields.ValuesMatch("arg0str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg1str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg2str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg3str", source, target))
                    {
                        return(false);
                    }
                    if (!UniFields.ValuesMatch("arg4str", source, target))
                    {
                        return(false);
                    }
                }
            }
            if (linedefflags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags()))
            {
                return(false);
            }

            if (General.Map.UDMF)
            {
                // UI fields
                if (!UIFieldsMatch(linedefflags, source, target))
                {
                    return(false);
                }

                // Custom fields
                if (linedefflags.Fields && !UniFields.CustomFieldsMatch(source.Fields, target.Fields))
                {
                    return(false);
                }
            }

            // Sidedef properties
            return((source.Front != null && target.Front != null && PropertiesMatch(sideflags, source.Front, target.Front)) ||
                   (source.Front != null && target.Back != null && PropertiesMatch(sideflags, source.Front, target.Back)) ||
                   (source.Back != null && target.Front != null && PropertiesMatch(sideflags, source.Back, target.Front)) ||
                   (source.Back != null && target.Back != null && PropertiesMatch(sideflags, source.Back, target.Back)));
        }
Пример #5
0
        public static bool PropertiesMatch(SectorPropertiesCopySettings flags, Sector source, Sector target)
        {
            // Built-in properties
            if (flags.FloorHeight && source.FloorHeight != target.FloorHeight)
            {
                return(false);
            }
            if (flags.CeilingHeight && source.CeilHeight != target.CeilHeight)
            {
                return(false);
            }
            if (flags.FloorTexture && source.FloorTexture != target.FloorTexture)
            {
                return(false);
            }
            if (flags.CeilingTexture && source.CeilTexture != target.CeilTexture)
            {
                return(false);
            }
            if (flags.Brightness && source.Brightness != target.Brightness)
            {
                return(false);
            }
            if (flags.Tag && !TagsMatch(source.Tags, target.Tags))
            {
                return(false);
            }
            if (flags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags()))
            {
                return(false);
            }

            // Generalized effects require more tender loving care...
            if (flags.Special && source.Effect != target.Effect)
            {
                if (!General.Map.Config.GeneralizedEffects || source.Effect == 0 || target.Effect == 0)
                {
                    return(false);
                }

                // Get effect bits...
                SectorEffectData sourcedata = General.Map.Config.GetSectorEffectData(source.Effect);
                SectorEffectData targetdata = General.Map.Config.GetSectorEffectData(target.Effect);

                // No bits match when at least one effect is not generalized, or when bits don't overlap
                if (sourcedata.Effect != targetdata.Effect ||
                    sourcedata.GeneralizedBits.Count != targetdata.GeneralizedBits.Count ||
                    !sourcedata.GeneralizedBits.Overlaps(targetdata.GeneralizedBits))
                {
                    return(false);
                }
            }

            if (!General.Map.UDMF)
            {
                return(true);
            }

            // UI fields
            if (!UIFieldsMatch(flags, source, target))
            {
                return(false);
            }

            // Custom fields
            return(!flags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields));
        }