mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
Fixed, Find & Replace mode: fixed a bug when "Find Sector Effect" search mode returned all map sectors when the effect to find was not generalized.
Updated ZDoom_DECORATE.cfg.
This commit is contained in:
parent
364b3c11c7
commit
6296ef861d
3 changed files with 40 additions and 49 deletions
|
@ -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])";
|
||||
GetDistance = "float GetDistance(bool checkz[, int ptr_select = AAPTR_TARGET])";
|
||||
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)";
|
||||
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]]]]])";
|
||||
IsPointerEqual = "bool IsPointerEqual(int ptr1, int ptr2)";
|
||||
}
|
||||
|
||||
properties
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue