Fix capitalization.
This commit is contained in:
@@ -17,6 +17,8 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
{
|
{
|
||||||
public class Beacon : IEffect
|
public class Beacon : IEffect
|
||||||
{
|
{
|
||||||
|
static readonly int MaxArrowHeight = 512;
|
||||||
|
|
||||||
readonly Player owner;
|
readonly Player owner;
|
||||||
readonly WPos position;
|
readonly WPos position;
|
||||||
readonly string palettePrefix;
|
readonly string palettePrefix;
|
||||||
@@ -26,8 +28,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
readonly Animation poster;
|
readonly Animation poster;
|
||||||
readonly Animation clock;
|
readonly Animation clock;
|
||||||
|
|
||||||
static readonly int maxArrowHeight = 512;
|
int arrowHeight = MaxArrowHeight;
|
||||||
int arrowHeight = maxArrowHeight;
|
|
||||||
int arrowSpeed = 50;
|
int arrowSpeed = 50;
|
||||||
|
|
||||||
// Player-placed beacons are removed after a delay
|
// Player-placed beacons are removed after a delay
|
||||||
@@ -69,7 +70,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
{
|
{
|
||||||
arrowHeight += arrowSpeed;
|
arrowHeight += arrowSpeed;
|
||||||
var clamped = arrowHeight.Clamp(0, maxArrowHeight);
|
var clamped = arrowHeight.Clamp(0, MaxArrowHeight);
|
||||||
if (arrowHeight != clamped)
|
if (arrowHeight != clamped)
|
||||||
{
|
{
|
||||||
arrowHeight = clamped;
|
arrowHeight = clamped;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
{
|
{
|
||||||
public class FloatingText : IEffect
|
public class FloatingText : IEffect
|
||||||
{
|
{
|
||||||
|
static readonly WVec Velocity = new WVec(0, 0, 86);
|
||||||
|
|
||||||
readonly SpriteFont font;
|
readonly SpriteFont font;
|
||||||
readonly string text;
|
readonly string text;
|
||||||
Color color;
|
Color color;
|
||||||
@@ -34,13 +36,12 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
this.remaining = duration;
|
this.remaining = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly WVec velocity = new WVec(0, 0, 86);
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
{
|
{
|
||||||
if (--remaining <= 0)
|
if (--remaining <= 0)
|
||||||
world.AddFrameEndTask(w => w.Remove(this));
|
world.AddFrameEndTask(w => w.Remove(this));
|
||||||
|
|
||||||
pos += velocity;
|
pos += Velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
this.zOffset = zOffset;
|
this.zOffset = zOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WPos Pos { get { return trail[idx(next - 1)]; } }
|
public WPos Pos { get { return trail[Index(next - 1)]; } }
|
||||||
public float Scale { get { return 1f; } }
|
public float Scale { get { return 1f; } }
|
||||||
public PaletteReference Palette { get { return null; } }
|
public PaletteReference Palette { get { return null; } }
|
||||||
public int ZOffset { get { return zOffset; } }
|
public int ZOffset { get { return zOffset; } }
|
||||||
@@ -67,13 +67,13 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
wlr.LineWidth = wr.Viewport.Zoom;
|
wlr.LineWidth = wr.Viewport.Zoom;
|
||||||
|
|
||||||
// Start of the first line segment is the tail of the list - don't smooth it.
|
// Start of the first line segment is the tail of the list - don't smooth it.
|
||||||
var curPos = trail[idx(next - skip - 1)];
|
var curPos = trail[Index(next - skip - 1)];
|
||||||
var curCell = wr.world.Map.CellContaining(curPos);
|
var curCell = wr.world.Map.CellContaining(curPos);
|
||||||
var curColor = color;
|
var curColor = color;
|
||||||
for (var i = 0; i < length - skip - 4; i++)
|
for (var i = 0; i < length - skip - 4; i++)
|
||||||
{
|
{
|
||||||
var j = next - skip - i - 2;
|
var j = next - skip - i - 2;
|
||||||
var nextPos = Average(trail[idx(j)], trail[idx(j - 1)], trail[idx(j - 2)], trail[idx(j - 3)]);
|
var nextPos = Average(trail[Index(j)], trail[Index(j - 1)], trail[Index(j - 2)], trail[Index(j - 3)]);
|
||||||
var nextCell = wr.world.Map.CellContaining(nextPos);
|
var nextCell = wr.world.Map.CellContaining(nextPos);
|
||||||
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
|
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
public void RenderDebugGeometry(WorldRenderer wr) { }
|
public void RenderDebugGeometry(WorldRenderer wr) { }
|
||||||
|
|
||||||
// Array index modulo length
|
// Array index modulo length
|
||||||
int idx(int i)
|
int Index(int i)
|
||||||
{
|
{
|
||||||
var j = i % trail.Length;
|
var j = i % trail.Length;
|
||||||
return j < 0 ? j + trail.Length : j;
|
return j < 0 ? j + trail.Length : j;
|
||||||
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
public void Update(WPos pos)
|
public void Update(WPos pos)
|
||||||
{
|
{
|
||||||
trail[next] = pos;
|
trail[next] = pos;
|
||||||
next = idx(next + 1);
|
next = Index(next + 1);
|
||||||
|
|
||||||
if (length < trail.Length)
|
if (length < trail.Length)
|
||||||
length++;
|
length++;
|
||||||
|
|||||||
@@ -87,13 +87,13 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
public IRenderable AsDecoration() { return this; }
|
public IRenderable AsDecoration() { return this; }
|
||||||
|
|
||||||
// This will need generalizing once we support TS/RA2 terrain
|
// This will need generalizing once we support TS/RA2 terrain
|
||||||
static readonly float[] groundNormal = new float[] { 0, 0, 1, 1 };
|
static readonly float[] GroundNormal = new float[] { 0, 0, 1, 1 };
|
||||||
public void BeforeRender(WorldRenderer wr)
|
public void BeforeRender(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
var draw = voxels.Where(v => v.DisableFunc == null || !v.DisableFunc());
|
var draw = voxels.Where(v => v.DisableFunc == null || !v.DisableFunc());
|
||||||
|
|
||||||
renderProxy = Game.Renderer.WorldVoxelRenderer.RenderAsync(
|
renderProxy = Game.Renderer.WorldVoxelRenderer.RenderAsync(
|
||||||
wr, draw, camera, scale, groundNormal, lightSource,
|
wr, draw, camera, scale, GroundNormal, lightSource,
|
||||||
lightAmbientColor, lightDiffuseColor,
|
lightAmbientColor, lightDiffuseColor,
|
||||||
palette, normalsPalette, shadowPalette);
|
palette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
@@ -154,15 +154,15 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly uint[] ix = new uint[] { 0, 0, 0, 0, 3, 3, 3, 3 };
|
static readonly uint[] CornerXIndex = new uint[] { 0, 0, 0, 0, 3, 3, 3, 3 };
|
||||||
static readonly uint[] iy = new uint[] { 1, 1, 4, 4, 1, 1, 4, 4 };
|
static readonly uint[] CornerYIndex = new uint[] { 1, 1, 4, 4, 1, 1, 4, 4 };
|
||||||
static readonly uint[] iz = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 };
|
static readonly uint[] CornerZIndex = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 };
|
||||||
static void DrawBoundsBox(float2 pxPos, float[] transform, float[] bounds, Color c)
|
static void DrawBoundsBox(float2 pxPos, float[] transform, float[] bounds, Color c)
|
||||||
{
|
{
|
||||||
var corners = new float2[8];
|
var corners = new float2[8];
|
||||||
for (var i = 0; i < 8; i++)
|
for (var i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
var vec = new float[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 };
|
var vec = new float[] { bounds[CornerXIndex[i]], bounds[CornerYIndex[i]], bounds[CornerZIndex[i]], 1 };
|
||||||
var screen = Util.MatrixVectorMultiply(transform, vec);
|
var screen = Util.MatrixVectorMultiply(transform, vec);
|
||||||
corners[i] = pxPos + new float2(screen[0], screen[1]);
|
corners[i] = pxPos + new float2(screen[0], screen[1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
{
|
{
|
||||||
var group = actors.ToList();
|
var group = actors.ToList();
|
||||||
var copy = (LuaFunction)func.CopyReference();
|
var copy = (LuaFunction)func.CopyReference();
|
||||||
Action<Actor> OnMemberKilled = m =>
|
Action<Actor> onMemberKilled = m =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var a in group)
|
foreach (var a in group)
|
||||||
GetScriptTriggers(a).OnKilledInternal += OnMemberKilled;
|
GetScriptTriggers(a).OnKilledInternal += onMemberKilled;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Call a function when one of the actors in a group is killed. The callback " +
|
[Desc("Call a function when one of the actors in a group is killed. The callback " +
|
||||||
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
{
|
{
|
||||||
var called = false;
|
var called = false;
|
||||||
var copy = (LuaFunction)func.CopyReference();
|
var copy = (LuaFunction)func.CopyReference();
|
||||||
Action<Actor> OnMemberKilled = m =>
|
Action<Actor> onMemberKilled = m =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var a in actors)
|
foreach (var a in actors)
|
||||||
GetScriptTriggers(a).OnKilledInternal += OnMemberKilled;
|
GetScriptTriggers(a).OnKilledInternal += onMemberKilled;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Call a function when this actor produces another actor. " +
|
[Desc("Call a function when this actor produces another actor. " +
|
||||||
@@ -192,7 +192,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
var group = actors.ToList();
|
var group = actors.ToList();
|
||||||
|
|
||||||
var copy = (LuaFunction)func.CopyReference();
|
var copy = (LuaFunction)func.CopyReference();
|
||||||
Action<Actor> OnMemberRemoved = m =>
|
Action<Actor> onMemberRemoved = m =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -210,7 +210,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var a in group)
|
foreach (var a in group)
|
||||||
GetScriptTriggers(a).OnRemovedInternal += OnMemberRemoved;
|
GetScriptTriggers(a).OnRemovedInternal += onMemberRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Call a function when this actor is captured. The callback function " +
|
[Desc("Call a function when this actor is captured. The callback function " +
|
||||||
@@ -227,7 +227,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
var called = false;
|
var called = false;
|
||||||
|
|
||||||
var copy = (LuaFunction)func.CopyReference();
|
var copy = (LuaFunction)func.CopyReference();
|
||||||
Action<Actor> OnKilledOrCaptured = m =>
|
Action<Actor> onKilledOrCaptured = m =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -244,8 +244,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GetScriptTriggers(a).OnCapturedInternal += OnKilledOrCaptured;
|
GetScriptTriggers(a).OnCapturedInternal += onKilledOrCaptured;
|
||||||
GetScriptTriggers(a).OnKilledInternal += OnKilledOrCaptured;
|
GetScriptTriggers(a).OnKilledInternal += onKilledOrCaptured;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Call a function when all of the actors in a group have been killed or captured. " +
|
[Desc("Call a function when all of the actors in a group have been killed or captured. " +
|
||||||
@@ -255,7 +255,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
var group = actors.ToList();
|
var group = actors.ToList();
|
||||||
|
|
||||||
var copy = (LuaFunction)func.CopyReference();
|
var copy = (LuaFunction)func.CopyReference();
|
||||||
Action<Actor> OnMemberKilledOrCaptured = m =>
|
Action<Actor> onMemberKilledOrCaptured = m =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -277,8 +277,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
|
|
||||||
foreach (var a in group)
|
foreach (var a in group)
|
||||||
{
|
{
|
||||||
GetScriptTriggers(a).OnCapturedInternal += OnMemberKilledOrCaptured;
|
GetScriptTriggers(a).OnCapturedInternal += onMemberKilledOrCaptured;
|
||||||
GetScriptTriggers(a).OnKilledInternal += OnMemberKilledOrCaptured;
|
GetScriptTriggers(a).OnKilledInternal += onMemberKilledOrCaptured;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
{
|
{
|
||||||
public class PlayerPinger : ServerTrait, ITick
|
public class PlayerPinger : ServerTrait, ITick
|
||||||
{
|
{
|
||||||
int PingInterval = 5000; // Ping every 5 seconds
|
static readonly int PingInterval = 5000; // Ping every 5 seconds
|
||||||
int ConnReportInterval = 20000; // Report every 20 seconds
|
static readonly int ConnReportInterval = 20000; // Report every 20 seconds
|
||||||
int ConnTimeout = 90000; // Drop unresponsive clients after 90 seconds
|
static readonly int ConnTimeout = 90000; // Drop unresponsive clients after 90 seconds
|
||||||
|
|
||||||
// TickTimeout is in microseconds
|
// TickTimeout is in microseconds
|
||||||
public int TickTimeout { get { return PingInterval * 100; } }
|
public int TickTimeout { get { return PingInterval * 100; } }
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public class NukePaletteEffect : IPaletteModifier, ITick
|
public class NukePaletteEffect : IPaletteModifier, ITick
|
||||||
{
|
{
|
||||||
const int nukeEffectLength = 20;
|
const int NukeEffectLength = 20;
|
||||||
int remainingFrames;
|
int remainingFrames;
|
||||||
|
|
||||||
public void Enable()
|
public void Enable()
|
||||||
{
|
{
|
||||||
remainingFrames = nukeEffectLength;
|
remainingFrames = NukeEffectLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (remainingFrames == 0)
|
if (remainingFrames == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var frac = (float)remainingFrames / nukeEffectLength;
|
var frac = (float)remainingFrames / NukeEffectLength;
|
||||||
|
|
||||||
foreach (var pal in palettes)
|
foreach (var pal in palettes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (uint)c[i % 8].ToArgb())));
|
wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (uint)c[i % 8].ToArgb())));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Color[] Fog = new[]
|
static readonly Color[] Fog = new[]
|
||||||
{
|
{
|
||||||
Color.Transparent, Color.Green,
|
Color.Transparent, Color.Green,
|
||||||
Color.Blue, Color.Yellow,
|
Color.Blue, Color.Yellow,
|
||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Color.FromArgb(32, 0, 0, 0)
|
Color.FromArgb(32, 0, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static Color[] Shroud = new[]
|
static readonly Color[] Shroud = new[]
|
||||||
{
|
{
|
||||||
Color.Transparent, Color.Green,
|
Color.Transparent, Color.Green,
|
||||||
Color.Blue, Color.Yellow,
|
Color.Blue, Color.Yellow,
|
||||||
|
|||||||
@@ -22,7 +22,10 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public float[] VRange = { 0.2f, 1.0f };
|
public float[] VRange = { 0.2f, 1.0f };
|
||||||
public event Action OnChange = () => { };
|
public event Action OnChange = () => { };
|
||||||
|
|
||||||
float H, S, V;
|
public float H { get; private set; }
|
||||||
|
public float S { get; private set; }
|
||||||
|
public float V { get; private set; }
|
||||||
|
|
||||||
byte[] front, back;
|
byte[] front, back;
|
||||||
Sprite mixerSprite;
|
Sprite mixerSprite;
|
||||||
bool isMoving;
|
bool isMoving;
|
||||||
|
|||||||
Reference in New Issue
Block a user