Remove unnecessary parentheses
This commit is contained in:
@@ -183,6 +183,9 @@ dotnet_diagnostic.IDE0041.severity = warning
|
|||||||
# Make field readonly.
|
# Make field readonly.
|
||||||
dotnet_diagnostic.IDE0044.severity = warning
|
dotnet_diagnostic.IDE0044.severity = warning
|
||||||
|
|
||||||
|
# Remove unnecessary parentheses.
|
||||||
|
dotnet_diagnostic.IDE0047.severity = warning
|
||||||
|
|
||||||
# Remove unused private member.
|
# Remove unused private member.
|
||||||
dotnet_diagnostic.IDE0051.severity = warning
|
dotnet_diagnostic.IDE0051.severity = warning
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ namespace OpenRA.Graphics
|
|||||||
else
|
else
|
||||||
Zoom = Zoom.Clamp(minZoom, maxZoom);
|
Zoom = Zoom.Clamp(minZoom, maxZoom);
|
||||||
|
|
||||||
var maxSize = (1f / (unlockMinZoom ? unlockedMinZoom : minZoom) * new float2(Game.Renderer.NativeResolution));
|
var maxSize = 1f / (unlockMinZoom ? unlockedMinZoom : minZoom) * new float2(Game.Renderer.NativeResolution);
|
||||||
Game.Renderer.SetMaximumViewportSize(new Size((int)maxSize.X, (int)maxSize.Y));
|
Game.Renderer.SetMaximumViewportSize(new Size((int)maxSize.X, (int)maxSize.Y));
|
||||||
|
|
||||||
foreach (var t in worldRenderer.World.WorldActor.TraitsImplementing<INotifyViewportZoomExtentsChanged>())
|
foreach (var t in worldRenderer.World.WorldActor.TraitsImplementing<INotifyViewportZoomExtentsChanged>())
|
||||||
@@ -296,8 +296,8 @@ namespace OpenRA.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int2 ViewToWorldPx(int2 view) { return (graphicSettings.UIScale / Zoom * view.ToFloat2()).ToInt2() + TopLeft; }
|
public int2 ViewToWorldPx(int2 view) { return (graphicSettings.UIScale / Zoom * view.ToFloat2()).ToInt2() + TopLeft; }
|
||||||
public int2 WorldToViewPx(int2 world) { return ((Zoom / graphicSettings.UIScale) * (world - TopLeft).ToFloat2()).ToInt2(); }
|
public int2 WorldToViewPx(int2 world) { return (Zoom / graphicSettings.UIScale * (world - TopLeft).ToFloat2()).ToInt2(); }
|
||||||
public int2 WorldToViewPx(in float3 world) { return ((Zoom / graphicSettings.UIScale) * (world - TopLeft).XY).ToInt2(); }
|
public int2 WorldToViewPx(in float3 world) { return (Zoom / graphicSettings.UIScale * (world - TopLeft).XY).ToInt2(); }
|
||||||
|
|
||||||
public void Center(IEnumerable<Actor> actors)
|
public void Center(IEnumerable<Actor> actors)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
// TODO: Remember to remove this when rewriting tile variants / PickAny
|
// TODO: Remember to remove this when rewriting tile variants / PickAny
|
||||||
if (index == byte.MaxValue)
|
if (index == byte.MaxValue)
|
||||||
index = (byte)(i % 4 + (j % 4) * 4);
|
index = (byte)(i % 4 + j % 4 * 4);
|
||||||
|
|
||||||
Tiles[new MPos(i, j)] = new TerrainTile(tile, index);
|
Tiles[new MPos(i, j)] = new TerrainTile(tile, index);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,13 +118,13 @@ namespace OpenRA
|
|||||||
items.Add(t.Id, t);
|
items.Add(t.Id, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IReadOnlyDictionary<string, ITerrainInfo>)(new ReadOnlyDictionary<string, ITerrainInfo>(items));
|
return (IReadOnlyDictionary<string, ITerrainInfo>)new ReadOnlyDictionary<string, ITerrainInfo>(items);
|
||||||
});
|
});
|
||||||
|
|
||||||
defaultSequences = Exts.Lazy(() =>
|
defaultSequences = Exts.Lazy(() =>
|
||||||
{
|
{
|
||||||
var items = DefaultTerrainInfo.ToDictionary(t => t.Key, t => new SequenceProvider(DefaultFileSystem, this, t.Key, null));
|
var items = DefaultTerrainInfo.ToDictionary(t => t.Key, t => new SequenceProvider(DefaultFileSystem, this, t.Key, null));
|
||||||
return (IReadOnlyDictionary<string, SequenceProvider>)(new ReadOnlyDictionary<string, SequenceProvider>(items));
|
return (IReadOnlyDictionary<string, SequenceProvider>)new ReadOnlyDictionary<string, SequenceProvider>(items);
|
||||||
});
|
});
|
||||||
|
|
||||||
initialThreadId = Environment.CurrentManagedThreadId;
|
initialThreadId = Environment.CurrentManagedThreadId;
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ namespace OpenRA.Network
|
|||||||
var clientsNode = new MiniYaml("");
|
var clientsNode = new MiniYaml("");
|
||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var c in Clients)
|
foreach (var c in Clients)
|
||||||
clientsNode.Nodes.Add(new MiniYamlNode("Client@" + (i++).ToString(), FieldSaver.Save(c)));
|
clientsNode.Nodes.Add(new MiniYamlNode("Client@" + i++.ToString(), FieldSaver.Save(c)));
|
||||||
|
|
||||||
root.Add(new MiniYamlNode("Clients", clientsNode));
|
root.Add(new MiniYamlNode("Clients", clientsNode));
|
||||||
return new MiniYaml("", root)
|
return new MiniYaml("", root)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
var currentTimestep = timestep();
|
var currentTimestep = timestep();
|
||||||
|
|
||||||
var integralTickTimestep = (tickDelta / currentTimestep) * currentTimestep;
|
var integralTickTimestep = tickDelta / currentTimestep * currentTimestep;
|
||||||
lastTickTime += integralTickTimestep >= Game.TimestepJankThreshold
|
lastTickTime += integralTickTimestep >= Game.TimestepJankThreshold
|
||||||
? integralTickTimestep
|
? integralTickTimestep
|
||||||
: currentTimestep;
|
: currentTimestep;
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ namespace OpenRA.Traits
|
|||||||
float2 GetScrollOffset()
|
float2 GetScrollOffset()
|
||||||
{
|
{
|
||||||
return GetMultiplier() * GetIntensity() * new float2(
|
return GetMultiplier() * GetIntensity() * new float2(
|
||||||
(float)Math.Sin((ticks * 2 * Math.PI) / 4),
|
(float)Math.Sin(ticks * 2 * Math.PI / 4),
|
||||||
(float)Math.Cos((ticks * 2 * Math.PI) / 5));
|
(float)Math.Cos(ticks * 2 * Math.PI / 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
float2 GetMultiplier()
|
float2 GetMultiplier()
|
||||||
|
|||||||
@@ -250,7 +250,11 @@ namespace OpenRA.Mods.Cnc.FileFormats
|
|||||||
{
|
{
|
||||||
*op++ = *ip++;
|
*op++ = *ip++;
|
||||||
if (t > 2)
|
if (t > 2)
|
||||||
|
{
|
||||||
|
#pragma warning disable IDE0047
|
||||||
(*op++) = *ip++;
|
(*op++) = *ip++;
|
||||||
|
#pragma warning restore IDE0047
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t = *ip++;
|
t = *ip++;
|
||||||
|
|||||||
@@ -110,13 +110,13 @@ namespace OpenRA.Mods.Cnc.Graphics
|
|||||||
static IEnumerable<IFinalizedRenderable> DrawZapWandering(WorldRenderer wr, float2 from, float2 to, ISpriteSequence s, string pal)
|
static IEnumerable<IFinalizedRenderable> DrawZapWandering(WorldRenderer wr, float2 from, float2 to, ISpriteSequence s, string pal)
|
||||||
{
|
{
|
||||||
var dist = to - from;
|
var dist = to - from;
|
||||||
var norm = (1f / dist.Length) * new float2(-dist.Y, dist.X);
|
var norm = 1f / dist.Length * new float2(-dist.Y, dist.X);
|
||||||
|
|
||||||
var renderables = new List<IFinalizedRenderable>();
|
var renderables = new List<IFinalizedRenderable>();
|
||||||
if (Game.CosmeticRandom.Next(2) != 0)
|
if (Game.CosmeticRandom.Next(2) != 0)
|
||||||
{
|
{
|
||||||
var p1 = from + (1 / 3f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
|
var p1 = from + 1 / 3f * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
|
||||||
var p2 = from + (2 / 3f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
|
var p2 = from + 2 / 3f * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
|
||||||
|
|
||||||
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
|
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
|
||||||
renderables.AddRange(DrawZap(wr, p1, p2, s, out p2, pal));
|
renderables.AddRange(DrawZap(wr, p1, p2, s, out p2, pal));
|
||||||
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Cnc.Graphics
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var p1 = from + (1 / 2f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
|
var p1 = from + 1 / 2f * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Length * dist.Length / 4096 * norm;
|
||||||
|
|
||||||
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
|
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
|
||||||
renderables.AddRange(DrawZap(wr, p1, to, s, out _, pal));
|
renderables.AddRange(DrawZap(wr, p1, to, s, out _, pal));
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
var minefield = GetMinefieldCells(minefieldStart, cell, Info.MinefieldDepth)
|
var minefield = GetMinefieldCells(minefieldStart, cell, Info.MinefieldDepth)
|
||||||
.Where(c => IsCellAcceptable(self, c) && self.Owner.Shroud.IsExplored(c)
|
.Where(c => IsCellAcceptable(self, c) && self.Owner.Shroud.IsExplored(c)
|
||||||
&& movement.CanEnterCell(c, null, BlockedByActor.Immovable) && (movement is Mobile mobile && mobile.CanStayInCell(c)))
|
&& movement.CanEnterCell(c, null, BlockedByActor.Immovable) && movement is Mobile mobile && mobile.CanStayInCell(c))
|
||||||
.OrderBy(c => (c - minefieldStart).LengthSquared).ToList();
|
.OrderBy(c => (c - minefieldStart).LengthSquared).ToList();
|
||||||
|
|
||||||
self.QueueActivity(order.Queued, new LayMines(self, minefield));
|
self.QueueActivity(order.Queued, new LayMines(self, minefield));
|
||||||
@@ -180,7 +180,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
// TODO: proper endcaps, if anyone cares (which won't happen unless depth is large)
|
// TODO: proper endcaps, if anyone cares (which won't happen unless depth is large)
|
||||||
var p = end - start;
|
var p = end - start;
|
||||||
var q = new float2(p.Y, -p.X);
|
var q = new float2(p.Y, -p.X);
|
||||||
q = (start != end) ? (1 / q.Length) * q : new float2(1, 0);
|
q = (start != end) ? 1 / q.Length * q : new float2(1, 0);
|
||||||
var c = -float2.Dot(q, new float2(start.X, start.Y));
|
var c = -float2.Dot(q, new float2(start.X, start.Y));
|
||||||
|
|
||||||
// return all points such that |ax + by + c| < depth
|
// return all points such that |ax + by + c| < depth
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
|||||||
|
|
||||||
data.AppendLine($"\t\t\t\tMinColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
data.AppendLine($"\t\t\t\tMinColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
||||||
data.AppendLine($"\t\t\t\tMaxColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
data.AppendLine($"\t\t\t\tMaxColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
||||||
data.AppendLine($"\t\t\t\tZOffset: {(-tileSize.Height / 2.0f)}");
|
var zOffset = -tileSize.Height / 2.0f;
|
||||||
|
data.AppendLine($"\t\t\t\tZOffset: {zOffset}");
|
||||||
data.AppendLine("\t\t\t\tZRamp: 0");
|
data.AppendLine("\t\t\t\tZRamp: 0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// Cast to long to avoid overflow when multiplying by the health
|
// Cast to long to avoid overflow when multiplying by the health
|
||||||
var hp = health != null ? (long)health.HP : 1L;
|
var hp = health != null ? (long)health.HP : 1L;
|
||||||
var maxHP = health != null ? (long)health.MaxHP : 1L;
|
var maxHP = health != null ? (long)health.MaxHP : 1L;
|
||||||
var refund = (int)((sellValue * sellableInfo.RefundPercent * hp) / (100 * maxHP));
|
var refund = (int)(sellValue * sellableInfo.RefundPercent * hp / (100 * maxHP));
|
||||||
refund = playerResources.ChangeCash(refund);
|
refund = playerResources.ChangeCash(refund);
|
||||||
|
|
||||||
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
|||||||
var sb = (b & 8) != 0;
|
var sb = (b & 8) != 0;
|
||||||
b &= 7;
|
b &= 7;
|
||||||
|
|
||||||
var delta = (StepTable[index] * b) / 4 + StepTable[index] / 8;
|
var delta = StepTable[index] * b / 4 + StepTable[index] / 8;
|
||||||
if (sb)
|
if (sb)
|
||||||
delta = -delta;
|
delta = -delta;
|
||||||
|
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
{
|
{
|
||||||
for (var frame = 0; frame < length; frame++)
|
for (var frame = 0; frame < length; frame++)
|
||||||
{
|
{
|
||||||
var i = transpose ? (frame % length) * facings + facing :
|
var i = transpose ? frame % length * facings + facing :
|
||||||
(facing * stride) + (frame % length);
|
(facing * stride) + (frame % length);
|
||||||
|
|
||||||
usedFrames.Add(frames != null ? frames[i] : start + i);
|
usedFrames.Add(frames != null ? frames[i] : start + i);
|
||||||
@@ -530,7 +530,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
{
|
{
|
||||||
for (var frame = 0; frame < length; frame++)
|
for (var frame = 0; frame < length; frame++)
|
||||||
{
|
{
|
||||||
var i = transpose ? (frame % length) * facings + facing :
|
var i = transpose ? frame % length * facings + facing :
|
||||||
(facing * stride) + (frame % length);
|
(facing * stride) + (frame % length);
|
||||||
var s = frames != null ? sprites[frames[i]] : sprites[start + i];
|
var s = frames != null ? sprites[frames[i]] : sprites[start + i];
|
||||||
if (!s.Bounds.IsEmpty)
|
if (!s.Bounds.IsEmpty)
|
||||||
@@ -574,7 +574,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
if (reverseFacings)
|
if (reverseFacings)
|
||||||
f = (facings - f) % facings;
|
f = (facings - f) % facings;
|
||||||
|
|
||||||
var i = transpose ? (frame % length) * facings + f :
|
var i = transpose ? frame % length * facings + f :
|
||||||
(f * stride) + (frame % length);
|
(f * stride) + (frame % length);
|
||||||
|
|
||||||
var j = frames != null ? frames[i] : start + i;
|
var j = frames != null ? frames[i] : start + i;
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
if (map.Ramp.Contains(cell) && map.Ramp[cell] == 7)
|
if (map.Ramp.Contains(cell) && map.Ramp[cell] == 7)
|
||||||
pxOrigin += new float3(0, 0, 0.5f * map.Grid.TileSize.Height);
|
pxOrigin += new float3(0, 0, 0.5f * map.Grid.TileSize.Height);
|
||||||
|
|
||||||
var shadowOrigin = pxOrigin - groundZ * (new float2(renderProxy.ShadowDirection, 1));
|
var shadowOrigin = pxOrigin - groundZ * new float2(renderProxy.ShadowDirection, 1);
|
||||||
|
|
||||||
var psb = renderProxy.ProjectedShadowBounds;
|
var psb = renderProxy.ProjectedShadowBounds;
|
||||||
var sa = shadowOrigin + psb[0];
|
var sa = shadowOrigin + psb[0];
|
||||||
@@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
var groundPos = model.pos - new WVec(0, 0, wr.World.Map.DistanceAboveTerrain(model.pos).Length);
|
var groundPos = model.pos - new WVec(0, 0, wr.World.Map.DistanceAboveTerrain(model.pos).Length);
|
||||||
var groundZ = wr.World.Map.Grid.TileSize.Height * (groundPos.Z - model.pos.Z) / 1024f;
|
var groundZ = wr.World.Map.Grid.TileSize.Height * (groundPos.Z - model.pos.Z) / 1024f;
|
||||||
var pxOrigin = wr.Screen3DPosition(model.pos);
|
var pxOrigin = wr.Screen3DPosition(model.pos);
|
||||||
var shadowOrigin = pxOrigin - groundZ * (new float2(renderProxy.ShadowDirection, 1));
|
var shadowOrigin = pxOrigin - groundZ * new float2(renderProxy.ShadowDirection, 1);
|
||||||
|
|
||||||
// Draw sprite rect
|
// Draw sprite rect
|
||||||
var offset = pxOrigin + renderProxy.Sprite.Offset - 0.5f * renderProxy.Sprite.Size;
|
var offset = pxOrigin + renderProxy.Sprite.Offset - 0.5f * renderProxy.Sprite.Size;
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ namespace OpenRA.Mods.Common.HitShapes
|
|||||||
return new WDist(Math.Max(0, (PointB - p).Length - Radius.Length));
|
return new WDist(Math.Max(0, (PointB - p).Length - Radius.Length));
|
||||||
|
|
||||||
var projection = PointA + new int2(
|
var projection = PointA + new int2(
|
||||||
(ab.X * t) / 1024,
|
ab.X * t / 1024,
|
||||||
(ab.Y * t) / 1024);
|
ab.Y * t / 1024);
|
||||||
|
|
||||||
var distance = (projection - p).Length;
|
var distance = (projection - p).Length;
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// All weapon sequences must specify their corresponding image
|
// All weapon sequences must specify their corresponding image
|
||||||
var image = ((string)fields.First(f => f.Name == sequenceReference.ImageReference).GetValue(projectileInfo));
|
var image = (string)fields.First(f => f.Name == sequenceReference.ImageReference).GetValue(projectileInfo);
|
||||||
if (string.IsNullOrEmpty(image))
|
if (string.IsNullOrEmpty(image))
|
||||||
{
|
{
|
||||||
if (!sequenceReference.AllowNullImage)
|
if (!sequenceReference.AllowNullImage)
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
var at = (float)ticks / (length - 1);
|
var at = (float)ticks / (length - 1);
|
||||||
var attitude = angle.Tan() * (1 - 2 * at) / (4 * 1024);
|
var attitude = angle.Tan() * (1 - 2 * at) / (4 * 1024);
|
||||||
|
|
||||||
var u = (facing.Angle % 512) / 512f;
|
var u = facing.Angle % 512 / 512f;
|
||||||
var scale = 2048 * u * (1 - u);
|
var scale = 2048 * u * (1 - u);
|
||||||
|
|
||||||
var effective = (int)(facing.Angle < 512
|
var effective = (int)(facing.Angle < 512
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
// angular speed in radians per tick = rot in facing units per tick * (pi radians / 128 facing units)
|
// angular speed in radians per tick = rot in facing units per tick * (pi radians / 128 facing units)
|
||||||
// pi = 314 / 100
|
// pi = 314 / 100
|
||||||
// ==> loopRadius = (speed * 128 * 100) / (314 * rot)
|
// ==> loopRadius = (speed * 128 * 100) / (314 * rot)
|
||||||
return (speed * 6400) / (157 * rot);
|
return speed * 6400 / (157 * rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetermineLaunchSpeedAndAngleForIncline(int predClfDist, int diffClfMslHgt, int relTarHorDist,
|
void DetermineLaunchSpeedAndAngleForIncline(int predClfDist, int diffClfMslHgt, int relTarHorDist,
|
||||||
@@ -315,9 +315,9 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
|
|
||||||
// Compute minimum speed necessary to both be able to face directly upwards and have enough space
|
// Compute minimum speed necessary to both be able to face directly upwards and have enough space
|
||||||
// to hit the target without passing it by (and thus having to do horizontal loops)
|
// to hit the target without passing it by (and thus having to do horizontal loops)
|
||||||
var minSpeed = ((System.Math.Min(predClfDist * 1024 / (1024 - WAngle.FromFacing(vFacing).Sin()),
|
var minSpeed = (System.Math.Min(predClfDist * 1024 / (1024 - WAngle.FromFacing(vFacing).Sin()),
|
||||||
(relTarHorDist + predClfDist) * 1024 / (2 * (2048 - WAngle.FromFacing(vFacing).Sin())))
|
(relTarHorDist + predClfDist) * 1024 / (2 * (2048 - WAngle.FromFacing(vFacing).Sin())))
|
||||||
* info.VerticalRateOfTurn.Facing * 157) / 6400).Clamp(minLaunchSpeed, maxLaunchSpeed);
|
* info.VerticalRateOfTurn.Facing * 157 / 6400).Clamp(minLaunchSpeed, maxLaunchSpeed);
|
||||||
|
|
||||||
if ((sbyte)vFacing < 0)
|
if ((sbyte)vFacing < 0)
|
||||||
speed = minSpeed;
|
speed = minSpeed;
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
|
|
||||||
// Forward step, pointing from src to target.
|
// Forward step, pointing from src to target.
|
||||||
// QuantizationCont * forwardStep == One cycle of beam in src2target direction.
|
// QuantizationCont * forwardStep == One cycle of beam in src2target direction.
|
||||||
ForwardStep = (info.HelixPitch.Length * SourceToTarget) / (info.QuantizationCount * SourceToTarget.Length);
|
ForwardStep = info.HelixPitch.Length * SourceToTarget / (info.QuantizationCount * SourceToTarget.Length);
|
||||||
|
|
||||||
// An easy vector to find which is perpendicular vector to forwardStep, with 0 Z component
|
// An easy vector to find which is perpendicular vector to forwardStep, with 0 Z component
|
||||||
LeftVector = new WVec(ForwardStep.Y, -ForwardStep.X, 0);
|
LeftVector = new WVec(ForwardStep.Y, -ForwardStep.X, 0);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
|||||||
if (png.EmbeddedData.ContainsKey("FrameAmount"))
|
if (png.EmbeddedData.ContainsKey("FrameAmount"))
|
||||||
frameAmount = FieldLoader.GetValue<int>("FrameAmount", png.EmbeddedData["FrameAmount"]);
|
frameAmount = FieldLoader.GetValue<int>("FrameAmount", png.EmbeddedData["FrameAmount"]);
|
||||||
else
|
else
|
||||||
frameAmount = (png.Width / frameSize.Width) * (png.Height / frameSize.Height);
|
frameAmount = png.Width / frameSize.Width * (png.Height / frameSize.Height);
|
||||||
}
|
}
|
||||||
else if (png.EmbeddedData.ContainsKey("FrameAmount"))
|
else if (png.EmbeddedData.ContainsKey("FrameAmount"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return new WVec(1024, 0, 0).Rotate(rot);
|
return new WVec(1024, 0, 0).Rotate(rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (d * 1024 * 8) / (int)distSq;
|
return d * 1024 * 8 / (int)distSq;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Actor GetActorBelow()
|
public Actor GetActorBelow()
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
var totalReloadDelay = arm.Weapon.ReloadDelay + (arm.Weapon.BurstDelays[0] * (burst - 1)).Clamp(1, 200);
|
var totalReloadDelay = arm.Weapon.ReloadDelay + (arm.Weapon.BurstDelays[0] * (burst - 1)).Clamp(1, 200);
|
||||||
var damageWarheads = arm.Weapon.Warheads.OfType<DamageWarhead>();
|
var damageWarheads = arm.Weapon.Warheads.OfType<DamageWarhead>();
|
||||||
foreach (var warhead in damageWarheads)
|
foreach (var warhead in damageWarheads)
|
||||||
sumOfDamage += (warhead.Damage * burst / totalReloadDelay) * 100;
|
sumOfDamage += warhead.Damage * burst / totalReloadDelay * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sumOfDamage;
|
return sumOfDamage;
|
||||||
@@ -239,7 +239,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
if (!own.Any())
|
if (!own.Any())
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
var relative = (relativeFunc(own, getValue) / relativeFunc(enemy, getValue)) * normalizeByValue;
|
var relative = relativeFunc(own, getValue) / relativeFunc(enemy, getValue) * normalizeByValue;
|
||||||
return relative.Clamp(0.0f, 999.0f);
|
return relative.Clamp(0.0f, 999.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
var checkIndices = Exts.MakeArray(columnCount * rowCount, i => i).Shuffle(owner.World.LocalRandom);
|
var checkIndices = Exts.MakeArray(columnCount * rowCount, i => i).Shuffle(owner.World.LocalRandom);
|
||||||
foreach (var i in checkIndices)
|
foreach (var i in checkIndices)
|
||||||
{
|
{
|
||||||
var pos = new MPos((i % columnCount) * dangerRadius + dangerRadius / 2, (i / columnCount) * dangerRadius + dangerRadius / 2).ToCPos(map);
|
var pos = new MPos(i % columnCount * dangerRadius + dangerRadius / 2, i / columnCount * dangerRadius + dangerRadius / 2).ToCPos(map);
|
||||||
|
|
||||||
if (NearToPosSafely(owner, map.CenterOfCell(pos), out detectedEnemyTarget))
|
if (NearToPosSafely(owner, map.CenterOfCell(pos), out detectedEnemyTarget))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -215,10 +215,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var offset = buildingInfo.CenterOffset(self.World).Y + 1024;
|
var offset = buildingInfo.CenterOffset(self.World).Y + 1024;
|
||||||
|
|
||||||
return footprint.Select(c => (IRenderable)(new SpriteRenderable(
|
return footprint.Select(c => (IRenderable)new SpriteRenderable(
|
||||||
terrainRenderer.TileSprite(new TerrainTile(template, c.Value)),
|
terrainRenderer.TileSprite(new TerrainTile(template, c.Value)),
|
||||||
wr.World.Map.CenterOfCell(c.Key), WVec.Zero, -offset, palette, 1f, 1f,
|
wr.World.Map.CenterOfCell(c.Key), WVec.Zero, -offset, palette, 1f, 1f,
|
||||||
float3.Ones, TintModifiers.None, true))).ToArray();
|
float3.Ones, TintModifiers.None, true)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public WVec CenterOffset(World w)
|
public WVec CenterOffset(World w)
|
||||||
{
|
{
|
||||||
var off = (w.Map.CenterOfCell(new CPos(Dimensions.X, Dimensions.Y)) - w.Map.CenterOfCell(new CPos(1, 1))) / 2;
|
var off = (w.Map.CenterOfCell(new CPos(Dimensions.X, Dimensions.Y)) - w.Map.CenterOfCell(new CPos(1, 1))) / 2;
|
||||||
return (off - new WVec(0, 0, off.Z)) + LocalCenterOffset;
|
return off - new WVec(0, 0, off.Z) + LocalCenterOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseProvider FindBaseProvider(World world, Player p, CPos topLeft)
|
public BaseProvider FindBaseProvider(World world, Player p, CPos topLeft)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var bounds = map.Bounds;
|
var bounds = map.Bounds;
|
||||||
var center = new MPos(bounds.Left + bounds.Width / 2, bounds.Top + bounds.Height / 2).ToCPos(map);
|
var center = new MPos(bounds.Left + bounds.Width / 2, bounds.Top + bounds.Height / 2).ToCPos(map);
|
||||||
var spawnVec = owner.HomeLocation - center;
|
var spawnVec = owner.HomeLocation - center;
|
||||||
startPos = owner.HomeLocation + spawnVec * (Exts.ISqrt((bounds.Height * bounds.Height + bounds.Width * bounds.Width) / (4 * spawnVec.LengthSquared)));
|
startPos = owner.HomeLocation + spawnVec * Exts.ISqrt((bounds.Height * bounds.Height + bounds.Width * bounds.Width) / (4 * spawnVec.LengthSquared));
|
||||||
endPos = startPos;
|
endPos = startPos;
|
||||||
var spawnDirection = new WVec((self.Location - startPos).X, (self.Location - startPos).Y, 0);
|
var spawnDirection = new WVec((self.Location - startPos).X, (self.Location - startPos).Y, 0);
|
||||||
spawnFacing = spawnDirection.Yaw;
|
spawnFacing = spawnDirection.Yaw;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var hpToRepair = Math.Min(Info.RepairStep, health.MaxHP - health.HP);
|
var hpToRepair = Math.Min(Info.RepairStep, health.MaxHP - health.HP);
|
||||||
|
|
||||||
// Cast to long to avoid overflow when multiplying by the health
|
// Cast to long to avoid overflow when multiplying by the health
|
||||||
var cost = Math.Max(1, (int)(((long)hpToRepair * Info.RepairPercent * buildingValue) / (health.MaxHP * 100L)));
|
var cost = Math.Max(1, (int)((long)hpToRepair * Info.RepairPercent * buildingValue / (health.MaxHP * 100L)));
|
||||||
|
|
||||||
// TakeCash will return false if the player can't pay, and will stop him from contributing this Tick
|
// TakeCash will return false if the player can't pay, and will stop him from contributing this Tick
|
||||||
var activePlayers = Repairers.Count(player => player.PlayerActor.Trait<PlayerResources>().TakeCash(cost, true));
|
var activePlayers = Repairers.Count(player => player.PlayerActor.Trait<PlayerResources>().TakeCash(cost, true));
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.Count(p => !p.Trait.IsTraitDisabled && !p.Trait.IsTraitPaused && p.Actor.Owner == self.Owner && p.Trait.Info.Produces.Contains(type));
|
.Count(p => !p.Trait.IsTraitDisabled && !p.Trait.IsTraitPaused && p.Actor.Owner == self.Owner && p.Trait.Info.Produces.Contains(type));
|
||||||
|
|
||||||
var speedModifier = selfsameProductionsCount.Clamp(1, info.BuildingCountBuildTimeMultipliers.Length) - 1;
|
var speedModifier = selfsameProductionsCount.Clamp(1, info.BuildingCountBuildTimeMultipliers.Length) - 1;
|
||||||
time = (time * info.BuildingCountBuildTimeMultipliers[speedModifier]) / 100;
|
time = time * info.BuildingCountBuildTimeMultipliers[speedModifier] / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
return time;
|
return time;
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.Count(p => !p.Trait.IsTraitDisabled && !p.Trait.IsTraitPaused && p.Actor.Owner == self.Owner && p.Trait.Info.Produces.Contains(type));
|
.Count(p => !p.Trait.IsTraitDisabled && !p.Trait.IsTraitPaused && p.Actor.Owner == self.Owner && p.Trait.Info.Produces.Contains(type));
|
||||||
|
|
||||||
var speedModifier = selfsameProductionsCount.Clamp(1, info.BuildTimeSpeedReduction.Length) - 1;
|
var speedModifier = selfsameProductionsCount.Clamp(1, info.BuildTimeSpeedReduction.Length) - 1;
|
||||||
time = (time * info.BuildTimeSpeedReduction[speedModifier]) / 100;
|
time = time * info.BuildTimeSpeedReduction[speedModifier] / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
return time;
|
return time;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
if (blinkPattern != null && blinkPattern.Length > 0)
|
if (blinkPattern != null && blinkPattern.Length > 0)
|
||||||
{
|
{
|
||||||
var i = (self.World.WorldTick / Info.BlinkInterval) % blinkPattern.Length;
|
var i = self.World.WorldTick / Info.BlinkInterval % blinkPattern.Length;
|
||||||
if (blinkPattern[i] != BlinkState.On)
|
if (blinkPattern[i] != BlinkState.On)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var a = new Animation(self.World, rs.GetImage(self));
|
var a = new Animation(self.World, rs.GetImage(self));
|
||||||
a.PlayFetchIndex(info.Sequence, () =>
|
a.PlayFetchIndex(info.Sequence, () =>
|
||||||
playerResources.ResourceCapacity != 0 ?
|
playerResources.ResourceCapacity != 0 ?
|
||||||
((10 * a.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity) :
|
(10 * a.CurrentSequence.Length - 1) * playerResources.Resources / (10 * playerResources.ResourceCapacity) :
|
||||||
0);
|
0);
|
||||||
|
|
||||||
anim = new AnimationWithOffset(a, null, () => IsTraitDisabled, 1024);
|
anim = new AnimationWithOffset(a, null, () => IsTraitDisabled, 1024);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
{
|
{
|
||||||
DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence),
|
DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence),
|
||||||
() => playerResources.ResourceCapacity != 0
|
() => playerResources.ResourceCapacity != 0
|
||||||
? ((info.Stages * DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Resources) / (info.Stages * playerResources.ResourceCapacity)
|
? (info.Stages * DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Resources / (info.Stages * playerResources.ResourceCapacity)
|
||||||
: 0);
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
.Select(ma => ((IModifyableRenderable)ma).WithTint(shadowColor, ((IModifyableRenderable)ma).TintModifiers | TintModifiers.ReplaceColor)
|
.Select(ma => ((IModifyableRenderable)ma).WithTint(shadowColor, ((IModifyableRenderable)ma).TintModifiers | TintModifiers.ReplaceColor)
|
||||||
.WithAlpha(shadowAlpha)
|
.WithAlpha(shadowAlpha)
|
||||||
.OffsetBy(info.Offset - new WVec(0, 0, height))
|
.OffsetBy(info.Offset - new WVec(0, 0, height))
|
||||||
.WithZOffset(ma.ZOffset + (height + info.ZOffset))
|
.WithZOffset(ma.ZOffset + height + info.ZOffset)
|
||||||
.AsDecoration());
|
.AsDecoration());
|
||||||
|
|
||||||
return shadowSprites.Concat(r);
|
return shadowSprites.Concat(r);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// Cast to long to avoid overflow when multiplying by the health
|
// Cast to long to avoid overflow when multiplying by the health
|
||||||
var hp = health != null ? (long)health.Value.HP : 1L;
|
var hp = health != null ? (long)health.Value.HP : 1L;
|
||||||
var maxHP = health != null ? (long)health.Value.MaxHP : 1L;
|
var maxHP = health != null ? (long)health.Value.MaxHP : 1L;
|
||||||
var refund = (int)((sellValue * info.RefundPercent * hp) / (100 * maxHP));
|
var refund = (int)(sellValue * info.RefundPercent * hp / (100 * maxHP));
|
||||||
|
|
||||||
return "Refund: $" + refund;
|
return "Refund: $" + refund;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (speed > 0)
|
if (speed > 0)
|
||||||
{
|
{
|
||||||
var nodesDict = t.Value.ToDictionary();
|
var nodesDict = t.Value.ToDictionary();
|
||||||
var cost = (nodesDict.ContainsKey("PathingCost")
|
var cost = nodesDict.ContainsKey("PathingCost")
|
||||||
? FieldLoader.GetValue<short>("cost", nodesDict["PathingCost"].Value)
|
? FieldLoader.GetValue<short>("cost", nodesDict["PathingCost"].Value)
|
||||||
: 10000 / speed);
|
: 10000 / speed;
|
||||||
ret.Add(t.Key, new TerrainInfo(speed, (short)cost));
|
ret.Add(t.Key, new TerrainInfo(speed, (short)cost));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,9 +214,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// All tiles are visible in the editor
|
// All tiles are visible in the editor
|
||||||
if (w.Type == WorldType.Editor)
|
if (w.Type == WorldType.Editor)
|
||||||
cellVisibility = puv => (map.Contains(puv) ? Shroud.CellVisibility.Visible | Shroud.CellVisibility.Explored : Shroud.CellVisibility.Explored);
|
cellVisibility = puv => map.Contains(puv) ? Shroud.CellVisibility.Visible | Shroud.CellVisibility.Explored : Shroud.CellVisibility.Explored;
|
||||||
else
|
else
|
||||||
cellVisibility = puv => (map.Contains(puv) ? Shroud.CellVisibility.Visible | Shroud.CellVisibility.Explored : Shroud.CellVisibility.Hidden);
|
cellVisibility = puv => map.Contains(puv) ? Shroud.CellVisibility.Visible | Shroud.CellVisibility.Explored : Shroud.CellVisibility.Hidden;
|
||||||
|
|
||||||
var shroudBlend = shroudSprites[0].Sprite.BlendMode;
|
var shroudBlend = shroudSprites[0].Sprite.BlendMode;
|
||||||
if (shroudSprites.Any(s => s.Sprite.BlendMode != shroudBlend))
|
if (shroudSprites.Any(s => s.Sprite.BlendMode != shroudBlend))
|
||||||
@@ -309,7 +309,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Visible under shroud: Explored. Visible under fog: Visible.
|
// Visible under shroud: Explored. Visible under fog: Visible.
|
||||||
cellVisibility = puv => (map.Contains(puv) ? Shroud.CellVisibility.Visible | Shroud.CellVisibility.Explored : Shroud.CellVisibility.Hidden);
|
cellVisibility = puv => map.Contains(puv) ? Shroud.CellVisibility.Visible | Shroud.CellVisibility.Explored : Shroud.CellVisibility.Hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
shroud = newShroud;
|
shroud = newShroud;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
for (var x = 0; x < template.Size.X; x++)
|
for (var x = 0; x < template.Size.X; x++)
|
||||||
{
|
{
|
||||||
var tile = new TerrainTile(template.Id, (byte)(i++));
|
var tile = new TerrainTile(template.Id, (byte)i++);
|
||||||
if (!terrainInfo.TryGetTileInfo(tile, out var tileInfo))
|
if (!terrainInfo.TryGetTileInfo(tile, out var tileInfo))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
foreach (var node in combineNode.Value.Nodes)
|
foreach (var node in combineNode.Value.Nodes)
|
||||||
{
|
{
|
||||||
ProcessNode(modData, node, node, node.Key);
|
ProcessNode(modData, node, node, node.Key);
|
||||||
node.Key = (i++).ToString();
|
node.Key = i++.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
|
|
||||||
var png = new Png(pngData, SpriteFrameType.Indexed8, frameSize.Width, frameSize.Height, palColors);
|
var png = new Png(pngData, SpriteFrameType.Indexed8, frameSize.Width, frameSize.Height, palColors);
|
||||||
png.Save($"{prefix}-{(count++):D4}.png");
|
#pragma warning disable SA1003
|
||||||
|
png.Save($"{prefix}-{count++:D4}.png");
|
||||||
|
#pragma warning restore SA1003
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Saved {0}-[0..{1}].png", prefix, count - 1);
|
Console.WriteLine("Saved {0}-[0..{1}].png", prefix, count - 1);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
if (frameAmountField != null)
|
if (frameAmountField != null)
|
||||||
{
|
{
|
||||||
var frameAmount = FieldLoader.GetValue<int>("FrameAmount", frameAmountField);
|
var frameAmount = FieldLoader.GetValue<int>("FrameAmount", frameAmountField);
|
||||||
if (frameAmount > (png.Width / frameSize.Width) * (png.Height / frameSize.Height))
|
if (frameAmount > png.Width / frameSize.Width * (png.Height / frameSize.Height))
|
||||||
throw new InvalidDataException(".png file is too small for given FrameSize and FrameAmount.");
|
throw new InvalidDataException(".png file is too small for given FrameSize and FrameAmount.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,11 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var c = (int*)cc;
|
var c = (int*)cc;
|
||||||
for (var s = 0; s < 256; s++)
|
for (var s = 0; s < 256; s++)
|
||||||
for (var h = 0; h < 256; h++)
|
for (var h = 0; h < 256; h++)
|
||||||
|
{
|
||||||
|
#pragma warning disable IDE0047
|
||||||
(*(c + s * 256 + h)) = Color.FromAhsv(h / 255f, 1 - s / 255f, V).ToArgb();
|
(*(c + s * 256 + h)) = Color.FromAhsv(h / 255f, 1 - s / 255f, V).ToArgb();
|
||||||
|
#pragma warning restore IDE0047
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
var panelY = RenderOrigin.Y + Bounds.Height - panelRoot.RenderOrigin.Y;
|
var panelY = RenderOrigin.Y + Bounds.Height - panelRoot.RenderOrigin.Y;
|
||||||
if (panelY + oldBounds.Height > Game.Renderer.Resolution.Height)
|
if (panelY + oldBounds.Height > Game.Renderer.Resolution.Height)
|
||||||
panelY -= (Bounds.Height + oldBounds.Height);
|
panelY -= Bounds.Height + oldBounds.Height;
|
||||||
|
|
||||||
panel.Bounds = new Rectangle(
|
panel.Bounds = new Rectangle(
|
||||||
panelX,
|
panelX,
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var buildTime = tooltipIcon.ProductionQueue?.GetBuildTime(actor, buildable) ?? 0;
|
var buildTime = tooltipIcon.ProductionQueue?.GetBuildTime(actor, buildable) ?? 0;
|
||||||
var timeModifier = pm != null && pm.PowerState != PowerState.Normal ? tooltipIcon.ProductionQueue.Info.LowPowerModifier : 100;
|
var timeModifier = pm != null && pm.PowerState != PowerState.Normal ? tooltipIcon.ProductionQueue.Info.LowPowerModifier : 100;
|
||||||
|
|
||||||
timeLabel.Text = formatBuildTime.Update((buildTime * timeModifier) / 100);
|
timeLabel.Text = formatBuildTime.Update(buildTime * timeModifier / 100);
|
||||||
timeLabel.TextColor = (pm != null && pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerModifier > 100) ? Color.Red : Color.White;
|
timeLabel.TextColor = (pm != null && pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerModifier > 100) ? Color.Red : Color.White;
|
||||||
var timeSize = font.Measure(timeLabel.Text);
|
var timeSize = font.Measure(timeLabel.Text);
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var selectedSpawn = DetermineSelectedSpawnPoint(mapPreview, preview, mi);
|
var selectedSpawn = DetermineSelectedSpawnPoint(mapPreview, preview, mi);
|
||||||
|
|
||||||
var locals = orderManager.LobbyInfo.Clients.Where(c => c.Index == orderManager.LocalClient.Index || (Game.IsHost && c.Bot != null));
|
var locals = orderManager.LobbyInfo.Clients.Where(c => c.Index == orderManager.LocalClient.Index || (Game.IsHost && c.Bot != null));
|
||||||
var playerToMove = locals.FirstOrDefault(c => ((selectedSpawn == 0) ^ (c.SpawnPoint == 0) && !c.IsObserver));
|
var playerToMove = locals.FirstOrDefault(c => (selectedSpawn == 0) ^ (c.SpawnPoint == 0) && !c.IsObserver);
|
||||||
SetSpawnPoint(orderManager, playerToMove, selectedSpawn);
|
SetSpawnPoint(orderManager, playerToMove, selectedSpawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
void ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundDevice[] devices, ScrollPanelWidget scrollPanel)
|
void ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundDevice[] devices, ScrollPanelWidget scrollPanel)
|
||||||
{
|
{
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var options = devices.ToDictionary(d => (i++).ToString(), d => d);
|
var options = devices.ToDictionary(d => i++.ToString(), d => d);
|
||||||
|
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
foreach (var queue in queues)
|
foreach (var queue in queues)
|
||||||
tabs.Add(new ProductionTab()
|
tabs.Add(new ProductionTab()
|
||||||
{
|
{
|
||||||
Name = (NextQueueName++).ToString(),
|
Name = NextQueueName++.ToString(),
|
||||||
Queue = queue
|
Queue = queue
|
||||||
});
|
});
|
||||||
Tabs = tabs;
|
Tabs = tabs;
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var deltaScale = Math.Min(Game.RunTime - lastScrollTime, 25f);
|
var deltaScale = Math.Min(Game.RunTime - lastScrollTime, 25f);
|
||||||
|
|
||||||
var length = Math.Max(1, scroll.Length);
|
var length = Math.Max(1, scroll.Length);
|
||||||
scroll *= (deltaScale / (25 * length)) * Game.Settings.Game.ViewportEdgeScrollStep;
|
scroll *= deltaScale / (25 * length) * Game.Settings.Game.ViewportEdgeScrollStep;
|
||||||
|
|
||||||
worldRenderer.Viewport.Scroll(scroll, false);
|
worldRenderer.Viewport.Scroll(scroll, false);
|
||||||
lastScrollTime = Game.RunTime;
|
lastScrollTime = Game.RunTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user