diff --git a/Build/Scripting/ZDoom_DECORATE.cfg b/Build/Scripting/ZDoom_DECORATE.cfg index fc6ae3d876320901c01dcff16393c71c3779e5c1..23efb9d1d48cd33ebe7e87c27e9bfc60ac1f913e 100644 --- a/Build/Scripting/ZDoom_DECORATE.cfg +++ b/Build/Scripting/ZDoom_DECORATE.cfg @@ -296,6 +296,7 @@ keywords A_Lower = "A_Lower"; A_Raise = "A_Raise"; A_ReFire = "A_ReFire[(str state = \"Hold\")]"; + A_ClearOverlays = "int A_ClearOverlays[(int start = 0, int stop = 0, bool safety = true)]"; A_ClearReFire = "A_ClearReFire"; A_GunFlash = "A_GunFlash[(str state = \"Flash\"[, int flags = 0])]\nflags: GFF flags."; A_CheckReload = "A_CheckReload"; @@ -306,7 +307,7 @@ keywords A_Light1 = "A_Light1"; A_Light2 = "A_Light2"; A_LightInverse = "A_LightInverse"; - A_Overlay = "A_Overlay(int layer[, state start])"; + A_Overlay = "bool A_Overlay(int layer[, state start[, bool nooverride]])"; A_OverlayFlags = "A_OverlayFlags(int layer, int flags, bool set)\nflags: PSPF flags."; A_OverlayOffset = "A_OverlayOffset[(int layer = 0[, float x = 0.0f[, float y = 32.0f[, int flags = 0]]]])]\nflags: WOF flags."; A_Recoil = "A_Recoil(float force)"; @@ -418,7 +419,6 @@ keywords tanh = "tanh(x)\nTrigonometry function, x must be in radians."; atan2 = "atan2(y, x)\nTrigonometry function, Returns an angle in degrees."; VectorAngle = "VectorAngle(x, y)\nTrigonometry function."; - GetAngle = "GetAngle(bool relative[, int ptr_target = AAPTR_TARGET])\nGets the angle in degrees (normalized to -180..180)"; //Randum number functions random = "int random[identifier](min, max)\nReturns a random integer value between min and max."; random2 = "int random2[identifier](mask)\nReturns a random integer value between -mask and +mask."; @@ -430,15 +430,17 @@ keywords Offset = "Offset(int x, int y)"; //Special functions CheckClass = "bool CheckClass(str classname[, int ptr_select = AAPTR_DEFAULT[, bool match_superclass = false]])"; - IsPointerEqual = "bool IsPointerEqual(int ptr1, int ptr2)"; CountInv = "int CountInv(str itemclassname[, int ptr_select = AAPTR_DEFAULT])"; + GetAngle = "GetAngle(bool relative[, int ptr_target = AAPTR_TARGET])\nGets the angle in degrees (normalized to -180..180)"; + GetCVar = "int GetCVar(str name)"; + GetUserCVar = "int GetUserCVar(int playernum, str name)"; + GetCrouchFactor = "float GetCrouchFactor(int ptr = AAPTR_PLAYER1)"; GetDistance = "float GetDistance(bool checkz[, int ptr_select = AAPTR_TARGET])"; + GetGibHealth = "int GetGibHealth()"; + GetPlayerInput = "int GetPlayerInput(int numinput[, int ptr = AAPTR_DEFAULT])"; GetSpawnHealth = "int GetSpawnHealth()"; GetZAt = "float GetZAt([float x = 0.0[, float y = 0.0[, float angle = 0.0[, int flags = 0[, int pick_pointer = AAPTR_TARGET]]]]])"; - GetGibHealth = "int GetGibHealth()"; - GetCrouchFactor = "float GetCrouchFactor(int ptr = AAPTR_PLAYER1)"; - GetCVar = "int GetCVar(str name)"; - GetUserCVar = "int GetUserCVar(int playernum, str name)"; + IsPointerEqual = "bool IsPointerEqual(int ptr1, int ptr2)"; } properties diff --git a/Source/Core/Config/GameConfiguration.cs b/Source/Core/Config/GameConfiguration.cs index 91ec92b6598badf0c22de0bcf08c481136677920..4c1c854082ecf346af36d5e283abc639162192db 100644 --- a/Source/Core/Config/GameConfiguration.cs +++ b/Source/Core/Config/GameConfiguration.cs @@ -1075,15 +1075,19 @@ namespace CodeImp.DoomBuilder.Config if(effect > 0) { int cureffect = effect; - for(int i = options.Count - 1; i > -1; i--) + + if(General.Map.Config.GeneralizedEffects) { - for(int j = options[i].Bits.Count - 1; j > -1; j--) + for(int i = options.Count - 1; i > -1; i--) { - GeneralizedBit bit = options[i].Bits[j]; - if(bit.Index > 0 && (cureffect & bit.Index) == bit.Index) + for(int j = options[i].Bits.Count - 1; j > -1; j--) { - cureffect -= bit.Index; - result.GeneralizedBits.Add(bit.Index); + GeneralizedBit bit = options[i].Bits[j]; + if(bit.Index > 0 && (cureffect & bit.Index) == bit.Index) + { + cureffect -= bit.Index; + result.GeneralizedBits.Add(bit.Index); + } } } } diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorEffect.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorEffect.cs index f51533c91a78e9d1dd5291b7592c090e28f8567b..f90f1ca9054018c16cb026d117ef77a323edbf15 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorEffect.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorEffect.cs @@ -93,16 +93,32 @@ namespace CodeImp.DoomBuilder.BuilderModes if(int.TryParse(value, out effect)) { //mxd - List<int> expectedbits = GetGeneralizedBits(effect); + SectorEffectData sd = General.Map.Config.GetSectorEffectData(effect); // Where to search? - ICollection<Sector> list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors; + ICollection<Sector> list = (withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors); // Go for all sectors foreach(Sector s in list) { - // Effect matches? -1 means any effect (mxd) - if((effect == -1 && s.Effect > 0) || (effect > -1 && (s.Effect == effect || BitsMatch(s.Effect, expectedbits)))) + bool match = false; + + //mxd. Effect matches? -1 means any effect + if(effect == -1) + { + match = s.Effect > 0; + } + else if(effect == s.Effect) + { + match = true; + } + else if(General.Map.Config.GeneralizedEffects && effect != 0 && s.Effect != 0) + { + SectorEffectData sdo = General.Map.Config.GetSectorEffectData(s.Effect); + match = (sd.Effect == sdo.Effect || (sd.GeneralizedBits.Count == sdo.GeneralizedBits.Count && sd.GeneralizedBits.Overlaps(sdo.GeneralizedBits))); + } + + if(match) { // Replace if(replace) s.Effect = replaceeffect; @@ -119,37 +135,6 @@ namespace CodeImp.DoomBuilder.BuilderModes return objs.ToArray(); } - //mxd - private static List<int> GetGeneralizedBits(int effect) - { - if(!General.Map.Config.GeneralizedEffects) return new List<int>(); - List<int> bits = new List<int>(); - - foreach(GeneralizedOption option in General.Map.Config.GenEffectOptions) - { - foreach(GeneralizedBit bit in option.Bits) - { - if(bit.Index > 0 && (effect & bit.Index) == bit.Index) - bits.Add(bit.Index); - } - } - - return bits; - } - - //mxd - private static bool BitsMatch(int effect, IEnumerable<int> expectedbits) - { - if(!General.Map.Config.GeneralizedEffects) return false; - - foreach(int bit in expectedbits) - { - if((effect & bit) != bit) return false; - } - - return true; - } - #endregion } }