Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
This commit is contained in:
@@ -334,8 +334,9 @@ namespace OpenRA.Editor
|
|||||||
{
|
{
|
||||||
var vX = (int)Math.Floor((mousePos.X - Offset.X) / Zoom);
|
var vX = (int)Math.Floor((mousePos.X - Offset.X) / Zoom);
|
||||||
var vY = (int)Math.Floor((mousePos.Y - Offset.Y) / Zoom);
|
var vY = (int)Math.Floor((mousePos.Y - Offset.Y) / Zoom);
|
||||||
return new CPos((vX + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize,
|
return new CPos(
|
||||||
(vY + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize);
|
(vX + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize,
|
||||||
|
(vY + TileSetRenderer.TileSize - 1) / TileSetRenderer.TileSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawActor(SGraphics g, CPos p, ActorTemplate t, ColorPalette cp)
|
public void DrawActor(SGraphics g, CPos p, ActorTemplate t, ColorPalette cp)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
return (k & mod) == mod;
|
return (k & mod) == mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k)
|
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k)
|
||||||
where V : new()
|
where V : new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ namespace OpenRA
|
|||||||
else if (fieldType == typeof(decimal))
|
else if (fieldType == typeof(decimal))
|
||||||
{
|
{
|
||||||
decimal res;
|
decimal res;
|
||||||
if (decimal.TryParse(value.Replace("%", ""), NumberStyles.Float, NumberFormatInfo.InvariantInfo, out res))
|
if (decimal.TryParse(value.Replace("%", ""), NumberStyles.Float, NumberFormatInfo.InvariantInfo, out res))
|
||||||
return res * (value.Contains('%') ? 0.01m : 1m);
|
return res * (value.Contains('%') ? 0.01m : 1m);
|
||||||
return InvalidValueAction(value, fieldType, fieldName);
|
return InvalidValueAction(value, fieldType, fieldName);
|
||||||
}
|
}
|
||||||
@@ -291,7 +291,7 @@ namespace OpenRA
|
|||||||
if (Exts.TryParseIntegerInvariant(value, out rr)
|
if (Exts.TryParseIntegerInvariant(value, out rr)
|
||||||
&& Exts.TryParseIntegerInvariant(value, out rp)
|
&& Exts.TryParseIntegerInvariant(value, out rp)
|
||||||
&& Exts.TryParseIntegerInvariant(value, out ry))
|
&& Exts.TryParseIntegerInvariant(value, out ry))
|
||||||
return new WRot(new WAngle(rr), new WAngle(rp), new WAngle(ry));
|
return new WRot(new WAngle(rr), new WAngle(rp), new WAngle(ry));
|
||||||
}
|
}
|
||||||
|
|
||||||
return InvalidValueAction(value, fieldType, fieldName);
|
return InvalidValueAction(value, fieldType, fieldName);
|
||||||
|
|||||||
@@ -390,7 +390,8 @@ namespace OpenRA.FileFormats
|
|||||||
MulBignumWord(esi, globOne, tmp, 2 * len);
|
MulBignumWord(esi, globOne, tmp, 2 * len);
|
||||||
if ((*edi & 0x8000) == 0)
|
if ((*edi & 0x8000) == 0)
|
||||||
{
|
{
|
||||||
if (0 != SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len))(*edi)--;
|
if (0 != SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len))
|
||||||
|
(*edi)--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,17 +33,17 @@ namespace OpenRA.FileFormats
|
|||||||
Transforms = new float[16 * FrameCount * LimbCount];
|
Transforms = new float[16 * FrameCount * LimbCount];
|
||||||
for (var j = 0; j < FrameCount; j++)
|
for (var j = 0; j < FrameCount; j++)
|
||||||
for (var i = 0; i < LimbCount; i++)
|
for (var i = 0; i < LimbCount; i++)
|
||||||
{
|
{
|
||||||
// Convert to column-major matrices and add the final matrix row
|
// Convert to column-major matrices and add the final matrix row
|
||||||
var c = 16 * (LimbCount * j + i);
|
var c = 16 * (LimbCount * j + i);
|
||||||
Transforms[c + 3] = 0;
|
Transforms[c + 3] = 0;
|
||||||
Transforms[c + 7] = 0;
|
Transforms[c + 7] = 0;
|
||||||
Transforms[c + 11] = 0;
|
Transforms[c + 11] = 0;
|
||||||
Transforms[c + 15] = 1;
|
Transforms[c + 15] = 1;
|
||||||
|
|
||||||
for (var k = 0; k < 12; k++)
|
for (var k = 0; k < 12; k++)
|
||||||
Transforms[c + ids[k]] = s.ReadFloat();
|
Transforms[c + ids[k]] = s.ReadFloat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HvaReader Load(string filename)
|
public static HvaReader Load(string filename)
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
switch (line[0])
|
switch (line[0])
|
||||||
{
|
{
|
||||||
case ';': break;
|
case ';': break;
|
||||||
case '[': currentSection = ProcessSection(line); break;
|
case '[': currentSection = ProcessSection(line); break;
|
||||||
default: ProcessEntry(line, currentSection); break;
|
default: ProcessEntry(line, currentSection); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ namespace OpenRA.FileFormats
|
|||||||
var jmp = int2.Swap(stream.ReadUInt32());
|
var jmp = int2.Swap(stream.ReadUInt32());
|
||||||
stream.Seek(jmp, SeekOrigin.Current);
|
stream.Seek(jmp, SeekOrigin.Current);
|
||||||
type = stream.ReadASCII(4);
|
type = stream.ReadASCII(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
var length = int2.Swap(stream.ReadUInt32());
|
var length = int2.Swap(stream.ReadUInt32());
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
@@ -197,10 +197,10 @@ namespace OpenRA.FileFormats
|
|||||||
}
|
}
|
||||||
|
|
||||||
compressed = type == "SND2";
|
compressed = type == "SND2";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stream.ReadBytes((int)length);
|
stream.ReadBytes((int)length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chunks are aligned on even bytes; advance by a byte if the next one is null
|
// Chunks are aligned on even bytes; advance by a byte if the next one is null
|
||||||
@@ -230,7 +230,7 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
audioData = new byte[rightData.Length + leftData.Length];
|
audioData = new byte[rightData.Length + leftData.Length];
|
||||||
var rightIndex = 0;
|
var rightIndex = 0;
|
||||||
var leftIndex = 0;
|
var leftIndex = 0;
|
||||||
for (var i = 0; i < audioData.Length;)
|
for (var i = 0; i < audioData.Length;)
|
||||||
{
|
{
|
||||||
audioData[i++] = leftData[leftIndex++];
|
audioData[i++] = leftData[leftIndex++];
|
||||||
@@ -273,28 +273,28 @@ namespace OpenRA.FileFormats
|
|||||||
stream.Seek(length, SeekOrigin.Current);
|
stream.Seek(length, SeekOrigin.Current);
|
||||||
type = stream.ReadASCII(4);
|
type = stream.ReadASCII(4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
length = int2.Swap(stream.ReadUInt32());
|
length = int2.Swap(stream.ReadUInt32());
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case "VQFR":
|
case "VQFR":
|
||||||
DecodeVQFR(stream);
|
DecodeVQFR(stream);
|
||||||
break;
|
break;
|
||||||
case "\0VQF":
|
case "\0VQF":
|
||||||
stream.ReadByte();
|
stream.ReadByte();
|
||||||
DecodeVQFR(stream);
|
DecodeVQFR(stream);
|
||||||
break;
|
break;
|
||||||
case "VQFL":
|
case "VQFL":
|
||||||
DecodeVQFR(stream, "VQFL");
|
DecodeVQFR(stream, "VQFL");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Don't parse sound here.
|
// Don't parse sound here.
|
||||||
stream.ReadBytes((int)length);
|
stream.ReadBytes((int)length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chunks are aligned on even bytes; advance by a byte if the next one is null
|
// Chunks are aligned on even bytes; advance by a byte if the next one is null
|
||||||
@@ -343,10 +343,10 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
if (parentType == "VQFL")
|
if (parentType == "VQFL")
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case "CBF0":
|
case "CBF0":
|
||||||
cbf = s.ReadBytes(subchunkLength);
|
cbf = s.ReadBytes(subchunkLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// frame-modifier chunk
|
// frame-modifier chunk
|
||||||
case "CBP0":
|
case "CBP0":
|
||||||
@@ -366,7 +366,7 @@ namespace OpenRA.FileFormats
|
|||||||
bytes.CopyTo(cbp, chunkBufferOffset);
|
bytes.CopyTo(cbp, chunkBufferOffset);
|
||||||
chunkBufferOffset += subchunkLength;
|
chunkBufferOffset += subchunkLength;
|
||||||
currentChunkBuffer++;
|
currentChunkBuffer++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Palette
|
// Palette
|
||||||
case "CPL0":
|
case "CPL0":
|
||||||
@@ -378,7 +378,7 @@ namespace OpenRA.FileFormats
|
|||||||
palette[i] = (uint)((255 << 24) | (r << 16) | (g << 8) | b);
|
palette[i] = (uint)((255 << 24) | (r << 16) | (g << 8) | b);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Frame data
|
// Frame data
|
||||||
case "VPTZ":
|
case "VPTZ":
|
||||||
@@ -390,9 +390,9 @@ namespace OpenRA.FileFormats
|
|||||||
Array.Clear(origData, 0, origData.Length);
|
Array.Clear(origData, 0, origData.Length);
|
||||||
s.Read(fileBuffer, 0, subchunkLength);
|
s.Read(fileBuffer, 0, subchunkLength);
|
||||||
if (fileBuffer[0] != 0)
|
if (fileBuffer[0] != 0)
|
||||||
vtprSize = Format80.DecodeInto(fileBuffer, origData);
|
vtprSize = Format80.DecodeInto(fileBuffer, origData);
|
||||||
else
|
else
|
||||||
Format80.DecodeInto(fileBuffer, origData, 1, true);
|
Format80.DecodeInto(fileBuffer, origData, 1, true);
|
||||||
return;
|
return;
|
||||||
case "VPTR":
|
case "VPTR":
|
||||||
Array.Clear(origData, 0, origData.Length);
|
Array.Clear(origData, 0, origData.Length);
|
||||||
@@ -434,21 +434,21 @@ namespace OpenRA.FileFormats
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
x += para_A;
|
x += para_A;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
WriteBlock(para_B1, para_B2, ref x, ref y);
|
WriteBlock(para_B1, para_B2, ref x, ref y);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
WriteBlock(para_B1, 1, ref x, ref y);
|
WriteBlock(para_B1, 1, ref x, ref y);
|
||||||
for (var i = 0; i < para_B2; i++)
|
for (var i = 0; i < para_B2; i++)
|
||||||
WriteBlock(origData[p++], 1, ref x, ref y);
|
WriteBlock(origData[p++], 1, ref x, ref y);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
WriteBlock(para_A, 1, ref x, ref y);
|
WriteBlock(para_A, 1, ref x, ref y);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
WriteBlock(para_A, origData[p++], ref x, ref y);
|
WriteBlock(para_A, origData[p++], ref x, ref y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
public enum WaveType { Pcm = 0x1, ImaAdpcm = 0x11 }
|
public enum WaveType { Pcm = 0x1, ImaAdpcm = 0x11 }
|
||||||
public static WaveType Type { get; private set; }
|
public static WaveType Type { get; private set; }
|
||||||
|
|
||||||
public WavLoader(Stream s)
|
public WavLoader(Stream s)
|
||||||
{
|
{
|
||||||
while (s.Position < s.Length)
|
while (s.Position < s.Length)
|
||||||
@@ -92,7 +92,7 @@ namespace OpenRA.FileFormats
|
|||||||
BitsPerSample = 16;
|
BitsPerSample = 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float WaveLength(Stream s)
|
public static float WaveLength(Stream s)
|
||||||
{
|
{
|
||||||
s.Position = 12;
|
s.Position = 12;
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ namespace OpenRA.FileSystem
|
|||||||
|
|
||||||
foreach (var file in contents)
|
foreach (var file in contents)
|
||||||
using (var dataStream = File.Create(Path.Combine(path, file.Key)))
|
using (var dataStream = File.Create(Path.Combine(path, file.Key)))
|
||||||
using (var writer = new BinaryWriter(dataStream))
|
using (var writer = new BinaryWriter(dataStream))
|
||||||
writer.Write(file.Value);
|
writer.Write(file.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ namespace OpenRA.FileSystem
|
|||||||
|
|
||||||
public int Priority { get { return 1000 + priority; } }
|
public int Priority { get { return 1000 + priority; } }
|
||||||
public string Name { get { return filename; } }
|
public string Name { get { return filename; } }
|
||||||
|
|
||||||
public void Write(Dictionary<string, byte[]> contents)
|
public void Write(Dictionary<string, byte[]> contents)
|
||||||
{
|
{
|
||||||
// Cannot modify existing mixfile - rename existing file and
|
// Cannot modify existing mixfile - rename existing file and
|
||||||
|
|||||||
@@ -59,41 +59,41 @@ namespace OpenRA.FileSystem
|
|||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case PackageHashType.Classic:
|
case PackageHashType.Classic:
|
||||||
{
|
|
||||||
name = name.ToUpperInvariant();
|
|
||||||
if (name.Length % 4 != 0)
|
|
||||||
name = name.PadRight(name.Length + (4 - name.Length % 4), '\0');
|
|
||||||
|
|
||||||
var ms = new MemoryStream(Encoding.ASCII.GetBytes(name));
|
|
||||||
var reader = new BinaryReader(ms);
|
|
||||||
|
|
||||||
var len = name.Length >> 2;
|
|
||||||
uint result = 0;
|
|
||||||
|
|
||||||
while (len-- != 0)
|
|
||||||
result = ((result << 1) | (result >> 31)) + reader.ReadUInt32();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
case PackageHashType.CRC32:
|
|
||||||
{
|
|
||||||
name = name.ToUpperInvariant();
|
|
||||||
var l = name.Length;
|
|
||||||
var a = l >> 2;
|
|
||||||
if ((l & 3) != 0)
|
|
||||||
{
|
{
|
||||||
name += (char)(l - (a << 2));
|
name = name.ToUpperInvariant();
|
||||||
var i = 3 - (l & 3);
|
if (name.Length % 4 != 0)
|
||||||
while (i-- != 0)
|
name = name.PadRight(name.Length + (4 - name.Length % 4), '\0');
|
||||||
name += name[a << 2];
|
|
||||||
|
var ms = new MemoryStream(Encoding.ASCII.GetBytes(name));
|
||||||
|
var reader = new BinaryReader(ms);
|
||||||
|
|
||||||
|
var len = name.Length >> 2;
|
||||||
|
uint result = 0;
|
||||||
|
|
||||||
|
while (len-- != 0)
|
||||||
|
result = ((result << 1) | (result >> 31)) + reader.ReadUInt32();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CRC32.Calculate(Encoding.ASCII.GetBytes(name));
|
case PackageHashType.CRC32:
|
||||||
}
|
{
|
||||||
|
name = name.ToUpperInvariant();
|
||||||
|
var l = name.Length;
|
||||||
|
var a = l >> 2;
|
||||||
|
if ((l & 3) != 0)
|
||||||
|
{
|
||||||
|
name += (char)(l - (a << 2));
|
||||||
|
var i = 3 - (l & 3);
|
||||||
|
while (i-- != 0)
|
||||||
|
name += name[a << 2];
|
||||||
|
}
|
||||||
|
|
||||||
default: throw new NotImplementedException("Unknown hash type `{0}`".F(type));
|
return CRC32.Calculate(Encoding.ASCII.GetBytes(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
default: throw new NotImplementedException("Unknown hash type `{0}`".F(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ namespace OpenRA
|
|||||||
if (worldRenderer != null)
|
if (worldRenderer != null)
|
||||||
worldRenderer.Dispose();
|
worldRenderer.Dispose();
|
||||||
worldRenderer = new WorldRenderer(OrderManager.World);
|
worldRenderer = new WorldRenderer(OrderManager.World);
|
||||||
|
|
||||||
using (new PerfTimer("LoadComplete"))
|
using (new PerfTimer("LoadComplete"))
|
||||||
OrderManager.World.LoadComplete(worldRenderer);
|
OrderManager.World.LoadComplete(worldRenderer);
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ namespace OpenRA
|
|||||||
if (constructOrderCache != null)
|
if (constructOrderCache != null)
|
||||||
return constructOrderCache;
|
return constructOrderCache;
|
||||||
|
|
||||||
var source = Traits.WithInterface<ITraitInfo>().Select(i => new {
|
var source = Traits.WithInterface<ITraitInfo>().Select(i => new
|
||||||
|
{
|
||||||
Trait = i,
|
Trait = i,
|
||||||
Type = i.GetType(),
|
Type = i.GetType(),
|
||||||
Dependencies = PrerequisitesOf(i).ToList()
|
Dependencies = PrerequisitesOf(i).ToList()
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
[Desc("What types of targets are unaffected.", "Overrules ValidTargets.")]
|
[Desc("What types of targets are unaffected.", "Overrules ValidTargets.")]
|
||||||
public readonly string[] InvalidTargets = { };
|
public readonly string[] InvalidTargets = { };
|
||||||
|
|
||||||
[Desc("What diplomatic stances are affected.")]
|
[Desc("What diplomatic stances are affected.")]
|
||||||
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||||
|
|
||||||
[Desc("Can this warhead affect the actor that fired it.")]
|
[Desc("Can this warhead affect the actor that fired it.")]
|
||||||
public readonly bool AffectsParent = false;
|
public readonly bool AffectsParent = false;
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum TextureScaleFilter { Nearest, Linear }
|
public enum TextureScaleFilter { Nearest, Linear }
|
||||||
|
|
||||||
public interface ITexture : IDisposable
|
public interface ITexture : IDisposable
|
||||||
{
|
{
|
||||||
void SetData(Bitmap bitmap);
|
void SetData(Bitmap bitmap);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace OpenRA.Graphics
|
|||||||
var isAlly = actor.Owner.IsAlliedWith(actor.World.LocalPlayer)
|
var isAlly = actor.Owner.IsAlliedWith(actor.World.LocalPlayer)
|
||||||
|| (actor.EffectiveOwner != null && actor.EffectiveOwner.Disguised
|
|| (actor.EffectiveOwner != null && actor.EffectiveOwner.Disguised
|
||||||
&& actor.World.LocalPlayer.IsAlliedWith(actor.EffectiveOwner.Owner));
|
&& actor.World.LocalPlayer.IsAlliedWith(actor.EffectiveOwner.Owner));
|
||||||
return isAlly ? Color.LimeGreen : actor.Owner.NonCombatant ? Color.Tan : Color.Red;
|
return isAlly ? Color.LimeGreen : actor.Owner.NonCombatant ? Color.Tan : Color.Red;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return health.DamageState == DamageState.Critical ? Color.Red :
|
return health.DamageState == DamageState.Critical ? Color.Red :
|
||||||
|
|||||||
@@ -106,12 +106,12 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
var mtx = new float[16];
|
var mtx = new float[16];
|
||||||
for (var i = 0; i < 4; i++)
|
for (var i = 0; i < 4; i++)
|
||||||
for (var j = 0; j < 4; j++)
|
for (var j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
mtx[4 * i + j] = 0;
|
mtx[4 * i + j] = 0;
|
||||||
for (var k = 0; k < 4; k++)
|
for (var k = 0; k < 4; k++)
|
||||||
mtx[4 * i + j] += lhs[4 * k + j] * rhs[4 * i + k];
|
mtx[4 * i + j] += lhs[4 * k + j] * rhs[4 * i + k];
|
||||||
}
|
}
|
||||||
|
|
||||||
return mtx;
|
return mtx;
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ namespace OpenRA.Graphics
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
for (var i = 0; i < 16; i++)
|
for (var i = 0; i < 16; i++)
|
||||||
mtx[i] *= 1 / det;
|
mtx[i] *= 1 / det;
|
||||||
|
|
||||||
return mtx;
|
return mtx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,9 +77,10 @@ namespace OpenRA.Graphics
|
|||||||
shader.SetMatrix("View", view);
|
shader.SetMatrix("View", view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VoxelRenderProxy RenderAsync(WorldRenderer wr, IEnumerable<VoxelAnimation> voxels, WRot camera, float scale,
|
public VoxelRenderProxy RenderAsync(
|
||||||
float[] groundNormal, WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
WorldRenderer wr, IEnumerable<VoxelAnimation> voxels, WRot camera, float scale,
|
||||||
PaletteReference color, PaletteReference normals, PaletteReference shadowPalette)
|
float[] groundNormal, WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
||||||
|
PaletteReference color, PaletteReference normals, PaletteReference shadowPalette)
|
||||||
{
|
{
|
||||||
// Correct for inverted y-axis
|
// Correct for inverted y-axis
|
||||||
var scaleTransform = Util.ScaleMatrix(scale, scale, scale);
|
var scaleTransform = Util.ScaleMatrix(scale, scale, scale);
|
||||||
@@ -202,7 +203,7 @@ namespace OpenRA.Graphics
|
|||||||
var lightDirection = ExtractRotationVector(Util.MatrixMultiply(Util.MatrixInverse(t), lightTransform));
|
var lightDirection = ExtractRotationVector(Util.MatrixMultiply(Util.MatrixInverse(t), lightTransform));
|
||||||
|
|
||||||
Render(rd, Util.MatrixMultiply(transform, t), lightDirection,
|
Render(rd, Util.MatrixMultiply(transform, t), lightDirection,
|
||||||
lightAmbientColor, lightDiffuseColor, color.Index, normals.Index);
|
lightAmbientColor, lightDiffuseColor, color.Index, normals.Index);
|
||||||
|
|
||||||
// Disable shadow normals by forcing zero diffuse and identity ambient light
|
// Disable shadow normals by forcing zero diffuse and identity ambient light
|
||||||
Render(rd, Util.MatrixMultiply(shadow, t), lightDirection,
|
Render(rd, Util.MatrixMultiply(shadow, t), lightDirection,
|
||||||
@@ -249,14 +250,16 @@ namespace OpenRA.Graphics
|
|||||||
return tVec;
|
return tVec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Render(VoxelRenderData renderData,
|
void Render(
|
||||||
float[] t, float[] lightDirection,
|
VoxelRenderData renderData,
|
||||||
float[] ambientLight, float[] diffuseLight,
|
float[] t, float[] lightDirection,
|
||||||
int colorPalette, int normalsPalette)
|
float[] ambientLight, float[] diffuseLight,
|
||||||
|
int colorPalette, int normalsPalette)
|
||||||
{
|
{
|
||||||
shader.SetTexture("DiffuseTexture", renderData.Sheet.GetTexture());
|
shader.SetTexture("DiffuseTexture", renderData.Sheet.GetTexture());
|
||||||
shader.SetVec("PaletteRows", (colorPalette + 0.5f) / HardwarePalette.MaxPalettes,
|
shader.SetVec("PaletteRows",
|
||||||
(normalsPalette + 0.5f) / HardwarePalette.MaxPalettes);
|
(colorPalette + 0.5f) / HardwarePalette.MaxPalettes,
|
||||||
|
(normalsPalette + 0.5f) / HardwarePalette.MaxPalettes);
|
||||||
shader.SetMatrix("TransformMatrix", t);
|
shader.SetMatrix("TransformMatrix", t);
|
||||||
shader.SetVec("LightDirection", lightDirection, 4);
|
shader.SetVec("LightDirection", lightDirection, 4);
|
||||||
shader.SetVec("AmbientLight", ambientLight, 3);
|
shader.SetVec("AmbientLight", ambientLight, 3);
|
||||||
|
|||||||
@@ -270,8 +270,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (throwErrors)
|
if (throwErrors && noInherit.ContainsValue(false))
|
||||||
if (noInherit.ContainsValue(false))
|
|
||||||
throw new YamlException("Bogus yaml removals: {0}".F(
|
throw new YamlException("Bogus yaml removals: {0}".F(
|
||||||
noInherit.Where(x => !x.Value).JoinWith(", ")));
|
noInherit.Where(x => !x.Value).JoinWith(", ")));
|
||||||
|
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ namespace OpenRA.Network
|
|||||||
{
|
{
|
||||||
case "Handshake":
|
case "Handshake":
|
||||||
FieldLoader.Load(handshake, y.Value);
|
FieldLoader.Load(handshake, y.Value);
|
||||||
break;
|
break;
|
||||||
case "Client":
|
case "Client":
|
||||||
FieldLoader.Load(handshake.Client, y.Value);
|
FieldLoader.Load(handshake.Client, y.Value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace OpenRA.Network
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "Message": // Server message
|
case "Message": // Server message
|
||||||
Game.AddChatLine(Color.White, "Server", order.TargetString);
|
Game.AddChatLine(Color.White, "Server", order.TargetString);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Disconnected": /* reports that the target player disconnected */
|
case "Disconnected": /* reports that the target player disconnected */
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace OpenRA
|
|||||||
var it = typeof(T);
|
var it = typeof(T);
|
||||||
return GetTypes().Where(t => t != it && it.IsAssignableFrom(t));
|
return GetTypes().Where(t => t != it && it.IsAssignableFrom(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Type> GetTypes()
|
public IEnumerable<Type> GetTypes()
|
||||||
{
|
{
|
||||||
return assemblies.Select(ma => ma.First).Distinct()
|
return assemblies.Select(ma => ma.First).Distinct()
|
||||||
|
|||||||
@@ -26,24 +26,24 @@ namespace OpenRA
|
|||||||
|
|
||||||
static PlatformType GetCurrentPlatform()
|
static PlatformType GetCurrentPlatform()
|
||||||
{
|
{
|
||||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||||
return PlatformType.Windows;
|
return PlatformType.Windows;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var psi = new ProcessStartInfo("uname", "-s");
|
var psi = new ProcessStartInfo("uname", "-s");
|
||||||
psi.UseShellExecute = false;
|
psi.UseShellExecute = false;
|
||||||
psi.RedirectStandardOutput = true;
|
psi.RedirectStandardOutput = true;
|
||||||
var p = Process.Start(psi);
|
var p = Process.Start(psi);
|
||||||
var kernelName = p.StandardOutput.ReadToEnd();
|
var kernelName = p.StandardOutput.ReadToEnd();
|
||||||
if (kernelName.Contains("Linux") || kernelName.Contains("BSD"))
|
if (kernelName.Contains("Linux") || kernelName.Contains("BSD"))
|
||||||
return PlatformType.Linux;
|
return PlatformType.Linux;
|
||||||
if (kernelName.Contains("Darwin"))
|
if (kernelName.Contains("Darwin"))
|
||||||
return PlatformType.OSX;
|
return PlatformType.OSX;
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
return PlatformType.Unknown;
|
return PlatformType.Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string RuntimeVersion
|
public static string RuntimeVersion
|
||||||
@@ -58,7 +58,7 @@ namespace OpenRA
|
|||||||
if (version == null)
|
if (version == null)
|
||||||
return "Mono (unknown version) CLR {0}".F(Environment.Version);
|
return "Mono (unknown version) CLR {0}".F(Environment.Version);
|
||||||
|
|
||||||
return "Mono {0} CLR {1}".F(version.Invoke(null, null), Environment.Version);
|
return "Mono {0} CLR {1}".F(version.Invoke(null, null), Environment.Version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,16 +75,16 @@ namespace OpenRA
|
|||||||
|
|
||||||
switch (CurrentPlatform)
|
switch (CurrentPlatform)
|
||||||
{
|
{
|
||||||
case PlatformType.Windows:
|
case PlatformType.Windows:
|
||||||
dir += Path.DirectorySeparatorChar + "OpenRA";
|
dir += Path.DirectorySeparatorChar + "OpenRA";
|
||||||
break;
|
break;
|
||||||
case PlatformType.OSX:
|
case PlatformType.OSX:
|
||||||
dir += "/Library/Application Support/OpenRA";
|
dir += "/Library/Application Support/OpenRA";
|
||||||
break;
|
break;
|
||||||
case PlatformType.Linux:
|
case PlatformType.Linux:
|
||||||
default:
|
default:
|
||||||
dir += "/.openra";
|
dir += "/.openra";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Directory.Exists(dir))
|
if (!Directory.Exists(dir))
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ namespace OpenRA.Server
|
|||||||
LobbyInfo.ClientPings.Add(clientPing);
|
LobbyInfo.ClientPings.Add(clientPing);
|
||||||
|
|
||||||
Log.Write("server", "Client {0}: Accepted connection from {1}.",
|
Log.Write("server", "Client {0}: Accepted connection from {1}.",
|
||||||
newConn.PlayerIndex, newConn.Socket.RemoteEndPoint);
|
newConn.PlayerIndex, newConn.Socket.RemoteEndPoint);
|
||||||
|
|
||||||
foreach (var t in serverTraits.WithInterface<IClientJoined>())
|
foreach (var t in serverTraits.WithInterface<IClientJoined>())
|
||||||
t.ClientJoined(this, newConn);
|
t.ClientJoined(this, newConn);
|
||||||
@@ -451,20 +451,20 @@ namespace OpenRA.Server
|
|||||||
switch (so.Name)
|
switch (so.Name)
|
||||||
{
|
{
|
||||||
case "Command":
|
case "Command":
|
||||||
{
|
|
||||||
var handled = false;
|
|
||||||
foreach (var t in serverTraits.WithInterface<IInterpretCommand>())
|
|
||||||
if (handled = t.InterpretCommand(this, conn, GetClient(conn), so.Data))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!handled)
|
|
||||||
{
|
{
|
||||||
Log.Write("server", "Unknown server command: {0}", so.Data);
|
var handled = false;
|
||||||
SendOrderTo(conn, "Message", "Unknown server command: {0}".F(so.Data));
|
foreach (var t in serverTraits.WithInterface<IInterpretCommand>())
|
||||||
}
|
if (handled = t.InterpretCommand(this, conn, GetClient(conn), so.Data))
|
||||||
|
break;
|
||||||
|
|
||||||
break;
|
if (!handled)
|
||||||
}
|
{
|
||||||
|
Log.Write("server", "Unknown server command: {0}", so.Data);
|
||||||
|
SendOrderTo(conn, "Message", "Unknown server command: {0}".F(so.Data));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "HandshakeResponse":
|
case "HandshakeResponse":
|
||||||
ValidateClient(conn, so.Data);
|
ValidateClient(conn, so.Data);
|
||||||
@@ -475,33 +475,33 @@ namespace OpenRA.Server
|
|||||||
DispatchOrdersToClients(conn, 0, so.Serialize());
|
DispatchOrdersToClients(conn, 0, so.Serialize());
|
||||||
break;
|
break;
|
||||||
case "Pong":
|
case "Pong":
|
||||||
{
|
|
||||||
int pingSent;
|
|
||||||
if (!OpenRA.Exts.TryParseIntegerInvariant(so.Data, out pingSent))
|
|
||||||
{
|
{
|
||||||
Log.Write("server", "Invalid order pong payload: {0}", so.Data);
|
int pingSent;
|
||||||
|
if (!OpenRA.Exts.TryParseIntegerInvariant(so.Data, out pingSent))
|
||||||
|
{
|
||||||
|
Log.Write("server", "Invalid order pong payload: {0}", so.Data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pingFromClient = LobbyInfo.PingFromClient(GetClient(conn));
|
||||||
|
if (pingFromClient == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var history = pingFromClient.LatencyHistory.ToList();
|
||||||
|
history.Add(Game.RunTime - pingSent);
|
||||||
|
|
||||||
|
// Cap ping history at 5 values (25 seconds)
|
||||||
|
if (history.Count > 5)
|
||||||
|
history.RemoveRange(0, history.Count - 5);
|
||||||
|
|
||||||
|
pingFromClient.Latency = history.Sum() / history.Count;
|
||||||
|
pingFromClient.LatencyJitter = (history.Max() - history.Min()) / 2;
|
||||||
|
pingFromClient.LatencyHistory = history.ToArray();
|
||||||
|
|
||||||
|
SyncClientPing();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pingFromClient = LobbyInfo.PingFromClient(GetClient(conn));
|
|
||||||
if (pingFromClient == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var history = pingFromClient.LatencyHistory.ToList();
|
|
||||||
history.Add(Game.RunTime - pingSent);
|
|
||||||
|
|
||||||
// Cap ping history at 5 values (25 seconds)
|
|
||||||
if (history.Count > 5)
|
|
||||||
history.RemoveRange(0, history.Count - 5);
|
|
||||||
|
|
||||||
pingFromClient.Latency = history.Sum() / history.Count;
|
|
||||||
pingFromClient.LatencyJitter = (history.Max() - history.Min()) / 2;
|
|
||||||
pingFromClient.LatencyHistory = history.ToArray();
|
|
||||||
|
|
||||||
SyncClientPing();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,11 +61,11 @@ namespace OpenRA
|
|||||||
engine = Game.Settings.Server.Dedicated ? "Null" : engine;
|
engine = Game.Settings.Server.Dedicated ? "Null" : engine;
|
||||||
switch (engine)
|
switch (engine)
|
||||||
{
|
{
|
||||||
case "AL": return new OpenAlSoundEngine();
|
case "AL": return new OpenAlSoundEngine();
|
||||||
case "Null": return new NullSoundEngine();
|
case "Null": return new NullSoundEngine();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("Unsupported sound engine: {0}".F(engine));
|
throw new InvalidOperationException("Unsupported sound engine: {0}".F(engine));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ namespace OpenRA
|
|||||||
var type = mi.Voice.ToLowerInvariant();
|
var type = mi.Voice.ToLowerInvariant();
|
||||||
return PlayPredefined(voicedUnit.World.Map.Rules, null, voicedUnit, type, phrase, variant, true, WPos.Zero, 1f, true);
|
return PlayPredefined(voicedUnit.World.Map.Rules, null, voicedUnit, type, phrase, variant, true, WPos.Zero, 1f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool PlayVoiceLocal(string phrase, Actor voicedUnit, string variant, WPos pos, float volume)
|
public static bool PlayVoiceLocal(string phrase, Actor voicedUnit, string variant, WPos pos, float volume)
|
||||||
{
|
{
|
||||||
if (voicedUnit == null || phrase == null)
|
if (voicedUnit == null || phrase == null)
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var path = Platform.SupportDir + "Logs";
|
var path = Platform.SupportDir + "Logs";
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
for (var i = 0;; i++)
|
for (var i = 0;; i++)
|
||||||
yield return Path.Combine(path, i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename);
|
yield return Path.Combine(path, i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddChannel(string channelName, string baseFilename)
|
public static void AddChannel(string channelName, string baseFilename)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace OpenRA.Traits
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var nd in self.TraitsImplementing<INotifyDamage>()
|
foreach (var nd in self.TraitsImplementing<INotifyDamage>()
|
||||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
|
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
|
||||||
nd.Damaged(self, ai);
|
nd.Damaged(self, ai);
|
||||||
|
|
||||||
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
||||||
@@ -100,7 +100,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead)
|
if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead)
|
||||||
foreach (var nd in repairer.TraitsImplementing<INotifyAppliedDamage>()
|
foreach (var nd in repairer.TraitsImplementing<INotifyAppliedDamage>()
|
||||||
.Concat(repairer.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
.Concat(repairer.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||||
nd.AppliedDamage(repairer, self, ai);
|
nd.AppliedDamage(repairer, self, ai);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ namespace OpenRA.Traits
|
|||||||
if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead)
|
if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead)
|
||||||
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
|
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
|
||||||
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||||
nd.AppliedDamage(attacker, self, ai);
|
nd.AppliedDamage(attacker, self, ai);
|
||||||
|
|
||||||
if (hp == 0)
|
if (hp == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,15 +101,15 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case TargetType.Actor:
|
case TargetType.Actor:
|
||||||
return actor.CenterPosition;
|
return actor.CenterPosition;
|
||||||
case TargetType.FrozenActor:
|
case TargetType.FrozenActor:
|
||||||
return frozen.CenterPosition;
|
return frozen.CenterPosition;
|
||||||
case TargetType.Terrain:
|
case TargetType.Terrain:
|
||||||
return pos;
|
return pos;
|
||||||
default:
|
default:
|
||||||
case TargetType.Invalid:
|
case TargetType.Invalid:
|
||||||
throw new InvalidOperationException("Attempting to query the position of an invalid Target");
|
throw new InvalidOperationException("Attempting to query the position of an invalid Target");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,20 +122,20 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case TargetType.Actor:
|
case TargetType.Actor:
|
||||||
var targetable = actor.TraitOrDefault<ITargetable>();
|
var targetable = actor.TraitOrDefault<ITargetable>();
|
||||||
if (targetable == null)
|
if (targetable == null)
|
||||||
return new[] { actor.CenterPosition };
|
return new[] { actor.CenterPosition };
|
||||||
|
|
||||||
var positions = targetable.TargetablePositions(actor);
|
var positions = targetable.TargetablePositions(actor);
|
||||||
return positions.Any() ? positions : new[] { actor.CenterPosition };
|
return positions.Any() ? positions : new[] { actor.CenterPosition };
|
||||||
case TargetType.FrozenActor:
|
case TargetType.FrozenActor:
|
||||||
return new[] { frozen.CenterPosition };
|
return new[] { frozen.CenterPosition };
|
||||||
case TargetType.Terrain:
|
case TargetType.Terrain:
|
||||||
return new[] { pos };
|
return new[] { pos };
|
||||||
default:
|
default:
|
||||||
case TargetType.Invalid:
|
case TargetType.Invalid:
|
||||||
return NoPositions;
|
return NoPositions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Traits
|
|||||||
// depends on the order of pips in WorldRenderer.cs!
|
// depends on the order of pips in WorldRenderer.cs!
|
||||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty }
|
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty }
|
||||||
public enum TagType { None, Fake, Primary }
|
public enum TagType { None, Fake, Primary }
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Stance
|
public enum Stance
|
||||||
{
|
{
|
||||||
@@ -259,7 +259,7 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface IRenderOverlay { void Render(WorldRenderer wr); }
|
public interface IRenderOverlay { void Render(WorldRenderer wr); }
|
||||||
public interface INotifyBecomingIdle { void OnBecomingIdle(Actor self); }
|
public interface INotifyBecomingIdle { void OnBecomingIdle(Actor self); }
|
||||||
public interface INotifyIdle { void TickIdle(Actor self); }
|
public interface INotifyIdle { void TickIdle(Actor self); }
|
||||||
|
|
||||||
public interface IBlocksBullets { }
|
public interface IBlocksBullets { }
|
||||||
|
|||||||
@@ -63,16 +63,16 @@ namespace OpenRA
|
|||||||
|
|
||||||
switch (components.Length)
|
switch (components.Length)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
if (!Exts.TryParseIntegerInvariant(components[0], out cell) ||
|
if (!Exts.TryParseIntegerInvariant(components[0], out cell) ||
|
||||||
!Exts.TryParseIntegerInvariant(components[1], out subcell))
|
!Exts.TryParseIntegerInvariant(components[1], out subcell))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!Exts.TryParseIntegerInvariant(components[0], out subcell))
|
if (!Exts.TryParseIntegerInvariant(components[0], out subcell))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagate sign to fractional part
|
// Propagate sign to fractional part
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ namespace OpenRA
|
|||||||
public static WRot operator -(WRot a, WRot b) { return new WRot(a.Roll - b.Roll, a.Pitch - b.Pitch, a.Yaw - b.Yaw); }
|
public static WRot operator -(WRot a, WRot b) { return new WRot(a.Roll - b.Roll, a.Pitch - b.Pitch, a.Yaw - b.Yaw); }
|
||||||
public static WRot operator -(WRot a) { return new WRot(-a.Roll, -a.Pitch, -a.Yaw); }
|
public static WRot operator -(WRot a) { return new WRot(-a.Roll, -a.Pitch, -a.Yaw); }
|
||||||
|
|
||||||
public static bool operator ==(WRot me, WRot other) { return me.Roll == other.Roll &&
|
public static bool operator ==(WRot me, WRot other)
|
||||||
me.Pitch == other.Pitch && me.Yaw == other.Yaw; }
|
{
|
||||||
|
return me.Roll == other.Roll && me.Pitch == other.Pitch && me.Yaw == other.Yaw;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool operator !=(WRot me, WRot other) { return !(me == other); }
|
public static bool operator !=(WRot me, WRot other) { return !(me == other); }
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
// Equivalent to OnMouseUp, but without an input arg
|
// Equivalent to OnMouseUp, but without an input arg
|
||||||
public Action OnClick = () => { };
|
public Action OnClick = () => { };
|
||||||
public Action OnDoubleClick = () => { };
|
public Action OnDoubleClick = () => { };
|
||||||
public Action<KeyInput> OnKeyPress = _ => { };
|
public Action<KeyInput> OnKeyPress = _ => { };
|
||||||
|
|
||||||
protected readonly Ruleset ModRules;
|
protected readonly Ruleset ModRules;
|
||||||
@@ -149,7 +149,7 @@ namespace OpenRA.Widgets
|
|||||||
OnDoubleClick();
|
OnDoubleClick();
|
||||||
return YieldMouseFocus(mi);
|
return YieldMouseFocus(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (HasMouseFocus && mi.Event == MouseInputEvent.Up)
|
else if (HasMouseFocus && mi.Event == MouseInputEvent.Up)
|
||||||
{
|
{
|
||||||
// Only fire the onMouseUp event if we successfully lost focus, and were pressed
|
// Only fire the onMouseUp event if we successfully lost focus, and were pressed
|
||||||
@@ -197,8 +197,14 @@ namespace OpenRA.Widgets
|
|||||||
tooltipContainer.Value.RemoveTooltip();
|
tooltipContainer.Value.RemoveTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int2 ChildOrigin { get { return RenderOrigin +
|
public override int2 ChildOrigin
|
||||||
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); } }
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return RenderOrigin +
|
||||||
|
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,8 +101,7 @@ namespace OpenRA.Widgets
|
|||||||
public void ShowDropDown<T>(string panelTemplate, int maxHeight, IEnumerable<T> options, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
public void ShowDropDown<T>(string panelTemplate, int maxHeight, IEnumerable<T> options, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
||||||
{
|
{
|
||||||
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
||||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs()
|
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } });
|
||||||
{ { "substitutions", substitutions } });
|
|
||||||
|
|
||||||
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
||||||
panel.RemoveChildren();
|
panel.RemoveChildren();
|
||||||
@@ -124,8 +123,7 @@ namespace OpenRA.Widgets
|
|||||||
public void ShowDropDown<T>(string panelTemplate, int height, Dictionary<string, IEnumerable<T>> groups, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
public void ShowDropDown<T>(string panelTemplate, int height, Dictionary<string, IEnumerable<T>> groups, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
||||||
{
|
{
|
||||||
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
var substitutions = new Dictionary<string, int>() { { "DROPDOWN_WIDTH", Bounds.Width } };
|
||||||
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs()
|
var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } });
|
||||||
{ { "substitutions", substitutions } });
|
|
||||||
|
|
||||||
var headerTemplate = panel.GetOrNull<ScrollItemWidget>("HEADER");
|
var headerTemplate = panel.GetOrNull<ScrollItemWidget>("HEADER");
|
||||||
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
var itemTemplate = panel.Get<ScrollItemWidget>("TEMPLATE");
|
||||||
|
|||||||
@@ -61,22 +61,22 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
switch (mi.Event)
|
switch (mi.Event)
|
||||||
{
|
{
|
||||||
case MouseInputEvent.Up:
|
case MouseInputEvent.Up:
|
||||||
isMoving = false;
|
isMoving = false;
|
||||||
YieldMouseFocus(mi);
|
YieldMouseFocus(mi);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MouseInputEvent.Down:
|
case MouseInputEvent.Down:
|
||||||
isMoving = true;
|
isMoving = true;
|
||||||
/* TODO: handle snapping to ticks properly again */
|
/* TODO: handle snapping to ticks properly again */
|
||||||
/* TODO: handle nudge via clicking outside the thumb */
|
/* TODO: handle nudge via clicking outside the thumb */
|
||||||
UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MouseInputEvent.Move:
|
|
||||||
if (isMoving)
|
|
||||||
UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left));
|
UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MouseInputEvent.Move:
|
||||||
|
if (isMoving)
|
||||||
|
UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ThumbRect.Contains(mi.Location);
|
return ThumbRect.Contains(mi.Location);
|
||||||
|
|||||||
@@ -268,9 +268,10 @@ namespace OpenRA.Widgets
|
|||||||
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom));
|
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
var color = disabled ? TextColorDisabled
|
var color =
|
||||||
: IsValid() ? TextColor
|
disabled ? TextColorDisabled
|
||||||
: TextColorInvalid;
|
: IsValid() ? TextColor
|
||||||
|
: TextColorInvalid;
|
||||||
font.DrawText(apparentText, textPos, color);
|
font.DrawText(apparentText, textPos, color);
|
||||||
|
|
||||||
if (showCursor && HasKeyboardFocus)
|
if (showCursor && HasKeyboardFocus)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace OpenRA.Widgets
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
video.Width,
|
video.Width,
|
||||||
video.Height),
|
video.Height),
|
||||||
TextureChannel.Alpha);
|
TextureChannel.Alpha);
|
||||||
|
|
||||||
var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
|
var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
|
||||||
@@ -121,15 +121,15 @@ namespace OpenRA.Widgets
|
|||||||
skippedFrames++;
|
skippedFrames++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skippedFrames > 1)
|
if (skippedFrames > 1)
|
||||||
Log.Write("perf", "VqaPlayer : {0} skipped {1} frames at position {2}", cachedVideo, skippedFrames, video.CurrentFrame);
|
Log.Write("perf", "VqaPlayer : {0} skipped {1} frames at position {2}", cachedVideo, skippedFrames, video.CurrentFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(
|
Game.Renderer.RgbaSpriteRenderer.DrawSprite(
|
||||||
videoSprite,
|
videoSprite,
|
||||||
videoOrigin,
|
videoOrigin,
|
||||||
videoSize);
|
videoSize);
|
||||||
|
|
||||||
if (DrawOverlay)
|
if (DrawOverlay)
|
||||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, videoSize);
|
Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, videoSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ namespace OpenRA.Widgets
|
|||||||
public override string GetCursor(int2 pos) { return null; }
|
public override string GetCursor(int2 pos) { return null; }
|
||||||
public override Widget Clone() { return new ContainerWidget(this); }
|
public override Widget Clone() { return new ContainerWidget(this); }
|
||||||
public Func<KeyInput, bool> OnKeyPress = _ => false;
|
public Func<KeyInput, bool> OnKeyPress = _ => false;
|
||||||
public override bool HandleKeyPress(KeyInput e) { return OnKeyPress(e); }
|
public override bool HandleKeyPress(KeyInput e) { return OnKeyPress(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WidgetArgs : Dictionary<string, object>
|
public class WidgetArgs : Dictionary<string, object>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
if (!args.ContainsKey("modRules"))
|
if (!args.ContainsKey("modRules"))
|
||||||
args = new WidgetArgs(args) { { "modRules", modData.DefaultRules } };
|
args = new WidgetArgs(args) { { "modRules", modData.DefaultRules } };
|
||||||
|
|
||||||
var widget = NewWidget(node.Key, args);
|
var widget = NewWidget(node.Key, args);
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace OpenRA.Widgets
|
|||||||
// Background
|
// Background
|
||||||
if (ps.HasFlags(PanelSides.Center) && ss[8] != null)
|
if (ps.HasFlags(PanelSides.Center) && ss[8] != null)
|
||||||
FillRectWithSprite(new Rectangle(bounds.Left + marginLeft, bounds.Top + marginTop,
|
FillRectWithSprite(new Rectangle(bounds.Left + marginLeft, bounds.Top + marginTop,
|
||||||
bounds.Width - marginWidth, bounds.Height - marginHeight),
|
bounds.Width - marginWidth, bounds.Height - marginHeight),
|
||||||
ss[8]);
|
ss[8]);
|
||||||
|
|
||||||
// Left border
|
// Left border
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace OpenRA.Widgets
|
|||||||
var unit = World.ScreenMap.ActorsAt(xy)
|
var unit = World.ScreenMap.ActorsAt(xy)
|
||||||
.WithHighestSelectionPriority();
|
.WithHighestSelectionPriority();
|
||||||
|
|
||||||
var newSelection2 = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight,
|
var newSelection2 = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight,
|
||||||
a => unit != null && a.Info.Name == unit.Info.Name && a.Owner == unit.Owner);
|
a => unit != null && a.Info.Name == unit.Info.Name && a.Owner == unit.Owner);
|
||||||
|
|
||||||
World.Selection.Combine(World, newSelection2, true, false);
|
World.Selection.Combine(World, newSelection2, true, false);
|
||||||
@@ -98,7 +98,7 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
// don't issue orders while selecting
|
// don't issue orders while selecting
|
||||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down && !hasBox)
|
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down && !hasBox)
|
||||||
ApplyOrders(World, xy, mi);
|
ApplyOrders(World, xy, mi);
|
||||||
|
|
||||||
lastMousePosition = xy;
|
lastMousePosition = xy;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace OpenRA
|
|||||||
public bool ShroudObscures(Actor a) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(a); }
|
public bool ShroudObscures(Actor a) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(a); }
|
||||||
public bool ShroudObscures(CPos p) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(p); }
|
public bool ShroudObscures(CPos p) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(p); }
|
||||||
public bool ShroudObscures(int u, int v) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(u, v); }
|
public bool ShroudObscures(int u, int v) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(u, v); }
|
||||||
|
|
||||||
public Func<int, int, bool> FogObscuresTest(CellRegion region)
|
public Func<int, int, bool> FogObscuresTest(CellRegion region)
|
||||||
{
|
{
|
||||||
var rp = RenderPlayer;
|
var rp = RenderPlayer;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
static string processName = "OpenRA.Game.exe";
|
static string processName = "OpenRA.Game.exe";
|
||||||
static Process gameProcess;
|
static Process gameProcess;
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
@@ -67,14 +67,14 @@ namespace OpenRA
|
|||||||
Text = "OpenRA has encountered a fatal error and must close.{0}Refer to the crash logs and FAQ for more information.".F(Environment.NewLine),
|
Text = "OpenRA has encountered a fatal error and must close.{0}Refer to the crash logs and FAQ for more information.".F(Environment.NewLine),
|
||||||
TextAlign = ContentAlignment.TopCenter
|
TextAlign = ContentAlignment.TopCenter
|
||||||
};
|
};
|
||||||
|
|
||||||
var viewLogs = new Button
|
var viewLogs = new Button
|
||||||
{
|
{
|
||||||
Location = new Point(10, 80),
|
Location = new Point(10, 80),
|
||||||
Size = new Size(75, 23),
|
Size = new Size(75, 23),
|
||||||
Text = "View Logs"
|
Text = "View Logs"
|
||||||
};
|
};
|
||||||
|
|
||||||
var viewFaq = new Button
|
var viewFaq = new Button
|
||||||
{
|
{
|
||||||
Location = new Point(90, 80),
|
Location = new Point(90, 80),
|
||||||
@@ -89,7 +89,7 @@ namespace OpenRA
|
|||||||
Text = "Quit",
|
Text = "Quit",
|
||||||
DialogResult = DialogResult.Cancel
|
DialogResult = DialogResult.Cancel
|
||||||
};
|
};
|
||||||
|
|
||||||
form.Controls.Add(notice);
|
form.Controls.Add(notice);
|
||||||
form.Controls.Add(viewLogs);
|
form.Controls.Add(viewLogs);
|
||||||
form.Controls.Add(viewFaq);
|
form.Controls.Add(viewFaq);
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
state = State.Dock;
|
state = State.Dock;
|
||||||
return Util.SequenceActivities(new Drag(self, startDock, endDock, 12), this);
|
return Util.SequenceActivities(new Drag(self, startDock, endDock, 12), this);
|
||||||
case State.Dock:
|
case State.Dock:
|
||||||
ru.PlayCustomAnimation(self, "dock", () => {
|
ru.PlayCustomAnimation(self, "dock", () =>
|
||||||
|
{
|
||||||
ru.PlayCustomAnimRepeating(self, "dock-loop");
|
ru.PlayCustomAnimRepeating(self, "dock-loop");
|
||||||
if (proc.IsInWorld && !proc.IsDead)
|
if (proc.IsInWorld && !proc.IsDead)
|
||||||
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
|
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (dest == null)
|
if (dest == null)
|
||||||
{
|
{
|
||||||
var nearestAfld = ChooseAirfield(self, false);
|
var nearestAfld = ChooseAirfield(self, false);
|
||||||
|
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
if (nearestAfld != null)
|
if (nearestAfld != null)
|
||||||
return Util.SequenceActivities(new Fly(self, Target.FromActor(nearestAfld)), new FlyCircle());
|
return Util.SequenceActivities(new Fly(self, Target.FromActor(nearestAfld)), new FlyCircle());
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
var type = Target.Type;
|
var type = Target.Type;
|
||||||
if (!Target.IsValidFor(self) || type == TargetType.FrozenActor)
|
if (!Target.IsValidFor(self) || type == TargetType.FrozenActor)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
if (attack.Info.AttackRequiresEnteringCell && !positionable.CanEnterCell(Target.Actor.Location, null, false))
|
if (attack.Info.AttackRequiresEnteringCell && !positionable.CanEnterCell(Target.Actor.Location, null, false))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
ReserveStatus TryReserveElseTryAlternateReserve(Actor self)
|
ReserveStatus TryReserveElseTryAlternateReserve(Actor self)
|
||||||
{
|
{
|
||||||
for (var tries = 0;;)
|
for (var tries = 0;;)
|
||||||
switch (Reserve(self))
|
switch (Reserve(self))
|
||||||
{
|
{
|
||||||
case ReserveStatus.None:
|
case ReserveStatus.None:
|
||||||
@@ -255,7 +255,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// Check target validity if not exiting or done
|
// Check target validity if not exiting or done
|
||||||
if (nextState != State.Done && (target.Type != TargetType.Actor || !target.IsValidFor(self)))
|
if (nextState != State.Done && (target.Type != TargetType.Actor || !target.IsValidFor(self)))
|
||||||
AbortOrExit(self);
|
AbortOrExit(self);
|
||||||
|
|
||||||
// If no current activity, tick next activity
|
// If no current activity, tick next activity
|
||||||
if (inner == null && FindAndTransitionToNextState(self) == State.Done)
|
if (inner == null && FindAndTransitionToNextState(self) == State.Done)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
protected override void OnInside(Actor self)
|
protected override void OnInside(Actor self)
|
||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
if (self.IsDead || transport.IsDead || !cargo.CanLoad(transport, self))
|
if (self.IsDead || transport.IsDead || !cargo.CanLoad(transport, self))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
if (IsCanceled)
|
if (IsCanceled)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
var target = targets.ClosestTo(self);
|
var target = targets.ClosestTo(self);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
World world;
|
World world;
|
||||||
ChatCommands console;
|
ChatCommands console;
|
||||||
|
|
||||||
public HelpCommand()
|
public HelpCommand()
|
||||||
{
|
{
|
||||||
helpDescriptions = new Dictionary<string, string>();
|
helpDescriptions = new Dictionary<string, string>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
{
|
{
|
||||||
case "pause":
|
case "pause":
|
||||||
world.IssueOrder(new Order("PauseGame", null, false)
|
world.IssueOrder(new Order("PauseGame", null, false)
|
||||||
{ TargetString = world.Paused ? "UnPause" : "Pause" });
|
{
|
||||||
|
TargetString = world.Paused ? "UnPause" : "Pause"
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "surrender":
|
case "surrender":
|
||||||
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
|
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
var palette = r.Palette(palettePrefix + owner.InternalName);
|
var palette = r.Palette(palettePrefix + owner.InternalName);
|
||||||
foreach (var a in circles.Render(position, palette))
|
foreach (var a in circles.Render(position, palette))
|
||||||
yield return a;
|
yield return a;
|
||||||
|
|
||||||
foreach (var a in arrow.Render(position + new WVec(0, 0, arrowHeight), palette))
|
foreach (var a in arrow.Render(position + new WVec(0, 0, arrowHeight), palette))
|
||||||
yield return a;
|
yield return a;
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
[Desc("Explodes when leaving the following terrain type, e.g., Water for torpedoes.")]
|
[Desc("Explodes when leaving the following terrain type, e.g., Water for torpedoes.")]
|
||||||
public readonly string BoundToTerrainType = "";
|
public readonly string BoundToTerrainType = "";
|
||||||
[Desc("Explodes when inside this proximity radius to target.",
|
[Desc("Explodes when inside this proximity radius to target.",
|
||||||
"Note: If this value is lower than the missile speed, this check might",
|
"Note: If this value is lower than the missile speed, this check might",
|
||||||
"not trigger fast enough, causing the missile to fly past the target.")]
|
"not trigger fast enough, causing the missile to fly past the target.")]
|
||||||
public readonly WRange CloseEnough = new WRange(298);
|
public readonly WRange CloseEnough = new WRange(298);
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,10 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
// Generated at render-time
|
// Generated at render-time
|
||||||
VoxelRenderProxy renderProxy;
|
VoxelRenderProxy renderProxy;
|
||||||
|
|
||||||
public VoxelRenderable(IEnumerable<VoxelAnimation> voxels, WPos pos, int zOffset, WRot camera, float scale,
|
public VoxelRenderable(
|
||||||
WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
IEnumerable<VoxelAnimation> voxels, WPos pos, int zOffset, WRot camera, float scale,
|
||||||
PaletteReference color, PaletteReference normals, PaletteReference shadow)
|
WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
|
||||||
|
PaletteReference color, PaletteReference normals, PaletteReference shadow)
|
||||||
{
|
{
|
||||||
this.voxels = voxels;
|
this.voxels = voxels;
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
@@ -58,30 +59,34 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
|
|
||||||
public IRenderable WithScale(float newScale)
|
public IRenderable WithScale(float newScale)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos, zOffset, camera, newScale,
|
return new VoxelRenderable(
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
voxels, pos, zOffset, camera, newScale,
|
||||||
palette, normalsPalette, shadowPalette);
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
|
palette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable WithPalette(PaletteReference newPalette)
|
public IRenderable WithPalette(PaletteReference newPalette)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos, zOffset, camera, scale,
|
return new VoxelRenderable(
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
voxels, pos, zOffset, camera, scale,
|
||||||
newPalette, normalsPalette, shadowPalette);
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
|
newPalette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable WithZOffset(int newOffset)
|
public IRenderable WithZOffset(int newOffset)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos, newOffset, camera, scale,
|
return new VoxelRenderable(
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
voxels, pos, newOffset, camera, scale,
|
||||||
palette, normalsPalette, shadowPalette);
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
|
palette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable OffsetBy(WVec vec)
|
public IRenderable OffsetBy(WVec vec)
|
||||||
{
|
{
|
||||||
return new VoxelRenderable(voxels, pos + vec, zOffset, camera, scale,
|
return new VoxelRenderable(
|
||||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
voxels, pos + vec, zOffset, camera, scale,
|
||||||
palette, normalsPalette, shadowPalette);
|
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||||
|
palette, normalsPalette, shadowPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable AsDecoration() { return this; }
|
public IRenderable AsDecoration() { return this; }
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
public class MapGlobal : ScriptGlobal
|
public class MapGlobal : ScriptGlobal
|
||||||
{
|
{
|
||||||
SpawnMapActors sma;
|
SpawnMapActors sma;
|
||||||
public MapGlobal(ScriptContext context) : base(context)
|
public MapGlobal(ScriptContext context)
|
||||||
|
: base(context)
|
||||||
{
|
{
|
||||||
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
public class MediaGlobal : ScriptGlobal
|
public class MediaGlobal : ScriptGlobal
|
||||||
{
|
{
|
||||||
World world;
|
World world;
|
||||||
public MediaGlobal(ScriptContext context) : base(context)
|
public MediaGlobal(ScriptContext context)
|
||||||
|
: base(context)
|
||||||
{
|
{
|
||||||
world = context.World;
|
world = context.World;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
GetScriptTriggers(a).ClearAll();
|
GetScriptTriggers(a).ClearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Removes the specified trigger from this actor." +
|
[Desc("Removes the specified trigger from this actor." +
|
||||||
"Note that the removal will only take effect at the end of a tick, " +
|
"Note that the removal will only take effect at the end of a tick, " +
|
||||||
"so you must not add new triggers at the same time that you are calling this function.")]
|
"so you must not add new triggers at the same time that you are calling this function.")]
|
||||||
public void Clear(Actor a, string triggerName)
|
public void Clear(Actor a, string triggerName)
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Scripting
|
namespace OpenRA.Mods.Common.Scripting
|
||||||
{
|
{
|
||||||
public enum Trigger { OnIdle, OnDamaged, OnKilled, OnProduction, OnOtherProduction, OnPlayerWon, OnPlayerLost,
|
public enum Trigger
|
||||||
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld }
|
{
|
||||||
|
OnIdle, OnDamaged, OnKilled, OnProduction, OnOtherProduction, OnPlayerWon, OnPlayerLost,
|
||||||
|
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld
|
||||||
|
}
|
||||||
|
|
||||||
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
|
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
|
||||||
public class ScriptTriggersInfo : ITraitInfo
|
public class ScriptTriggersInfo : ITraitInfo
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
{
|
{
|
||||||
public class MasterServerPinger : ServerTrait, ITick, INotifySyncLobbyInfo, IStartGame, IEndGame
|
public class MasterServerPinger : ServerTrait, ITick, INotifySyncLobbyInfo, IStartGame, IEndGame
|
||||||
{
|
{
|
||||||
const int MasterPingInterval = 60 * 3; // 3 minutes. server has a 5 minute TTL for games, so give ourselves a bit
|
// 3 minutes. Server has a 5 minute TTL for games, so give ourselves a bit of leeway.
|
||||||
// of leeway.
|
const int MasterPingInterval = 60 * 3;
|
||||||
public int TickTimeout { get { return MasterPingInterval * 10000; } }
|
public int TickTimeout { get { return MasterPingInterval * 10000; } }
|
||||||
|
|
||||||
public void Tick(S server)
|
public void Tick(S server)
|
||||||
|
|||||||
@@ -168,26 +168,26 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
|||||||
{
|
{
|
||||||
case Format.Format20:
|
case Format.Format20:
|
||||||
case Format.Format40:
|
case Format.Format40:
|
||||||
{
|
|
||||||
if (h.RefImage.Data == null)
|
|
||||||
{
|
{
|
||||||
++recurseDepth;
|
if (h.RefImage.Data == null)
|
||||||
Decompress(h.RefImage);
|
{
|
||||||
--recurseDepth;
|
++recurseDepth;
|
||||||
|
Decompress(h.RefImage);
|
||||||
|
--recurseDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
h.Data = CopyImageData(h.RefImage.Data);
|
||||||
|
Format40.DecodeInto(shpBytes, h.Data, (int)(h.FileOffset - shpBytesFileOffset));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
h.Data = CopyImageData(h.RefImage.Data);
|
|
||||||
Format40.DecodeInto(shpBytes, h.Data, (int)(h.FileOffset - shpBytesFileOffset));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Format.Format80:
|
case Format.Format80:
|
||||||
{
|
{
|
||||||
var imageBytes = new byte[Size.Width * Size.Height];
|
var imageBytes = new byte[Size.Width * Size.Height];
|
||||||
Format80.DecodeInto(shpBytes, imageBytes, (int)(h.FileOffset - shpBytesFileOffset));
|
Format80.DecodeInto(shpBytes, imageBytes, (int)(h.FileOffset - shpBytesFileOffset));
|
||||||
h.Data = imageBytes;
|
h.Data = imageBytes;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new InvalidDataException();
|
throw new InvalidDataException();
|
||||||
|
|||||||
@@ -288,12 +288,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
switch (order.OrderString)
|
switch (order.OrderString)
|
||||||
{
|
{
|
||||||
case "Move":
|
case "Move":
|
||||||
case "Enter":
|
case "Enter":
|
||||||
case "ReturnToBase":
|
case "ReturnToBase":
|
||||||
case "Stop":
|
case "Stop":
|
||||||
return "Move";
|
return "Move";
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) { return new Fly(self, Target.FromCell(self.World, cell)); }
|
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) { return new Fly(self, Target.FromCell(self.World, cell)); }
|
||||||
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos) { return Util.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), new Fly(self, Target.FromPos(toPos))); }
|
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos) { return Util.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), new Fly(self, Target.FromPos(toPos))); }
|
||||||
public Activity MoveToTarget(Actor self, Target target) { return new Fly(self, target, WRange.FromCells(3), WRange.FromCells(5)); }
|
public Activity MoveToTarget(Actor self, Target target) { return new Fly(self, target, WRange.FromCells(3), WRange.FromCells(5)); }
|
||||||
public Activity MoveIntoTarget(Actor self, Target target) { return new Land(target); }
|
public Activity MoveIntoTarget(Actor self, Target target) { return new Land(target); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public override string[] TargetTypes
|
public override string[] TargetTypes
|
||||||
{
|
{
|
||||||
get { return (self.CenterPosition.Z > 0) ? info.TargetTypes
|
get
|
||||||
: info.GroundedTargetTypes; }
|
{
|
||||||
|
return (self.CenterPosition.Z > 0) ? info.TargetTypes
|
||||||
|
: info.GroundedTargetTypes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Has to be defined here and in weapons.yaml.")]
|
[Desc("Has to be defined here and in weapons.yaml.")]
|
||||||
public readonly string Weapon = null;
|
public readonly string Weapon = null;
|
||||||
public readonly string Turret = "primary";
|
public readonly string Turret = "primary";
|
||||||
[Desc("Time (in frames) until the weapon can fire again.")]
|
[Desc("Time (in frames) until the weapon can fire again.")]
|
||||||
public readonly int FireDelay = 0;
|
public readonly int FireDelay = 0;
|
||||||
|
|
||||||
[Desc("Muzzle position relative to turret or body. (forward, right, up) triples")]
|
[Desc("Muzzle position relative to turret or body. (forward, right, up) triples")]
|
||||||
|
|||||||
@@ -113,12 +113,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
switch (target.Type)
|
switch (target.Type)
|
||||||
{
|
{
|
||||||
case TargetType.Actor:
|
case TargetType.Actor:
|
||||||
return new Order("Attack", self, queued) { TargetActor = target.Actor };
|
return new Order("Attack", self, queued) { TargetActor = target.Actor };
|
||||||
case TargetType.FrozenActor:
|
case TargetType.FrozenActor:
|
||||||
return new Order("Attack", self, queued) { ExtraData = target.FrozenActor.ID };
|
return new Order("Attack", self, queued) { ExtraData = target.FrozenActor.ID };
|
||||||
case TargetType.Terrain:
|
case TargetType.Terrain:
|
||||||
return new Order("Attack", self, queued) { TargetLocation = self.World.Map.CellContaining(target.CenterPosition) };
|
return new Order("Attack", self, queued) { TargetLocation = self.World.Map.CellContaining(target.CenterPosition) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,13 +255,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
switch (target.Type)
|
switch (target.Type)
|
||||||
{
|
{
|
||||||
case TargetType.Actor:
|
case TargetType.Actor:
|
||||||
case TargetType.FrozenActor:
|
case TargetType.FrozenActor:
|
||||||
return CanTargetActor(self, target, modifiers, ref cursor);
|
return CanTargetActor(self, target, modifiers, ref cursor);
|
||||||
case TargetType.Terrain:
|
case TargetType.Terrain:
|
||||||
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
|
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,10 +84,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly AttackCharge attack;
|
readonly AttackCharge attack;
|
||||||
readonly Target target;
|
readonly Target target;
|
||||||
|
|
||||||
public ChargeAttack(AttackCharge attack, Target target)
|
public ChargeAttack(AttackCharge attack, Target target)
|
||||||
{
|
{
|
||||||
this.attack = attack;
|
this.attack = attack;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
@@ -109,10 +109,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly AttackCharge attack;
|
readonly AttackCharge attack;
|
||||||
readonly Target target;
|
readonly Target target;
|
||||||
|
|
||||||
public ChargeFire(AttackCharge attack, Target target)
|
public ChargeFire(AttackCharge attack, Target target)
|
||||||
{
|
{
|
||||||
this.attack = attack;
|
this.attack = attack;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Disable production when there are more than this many of this actor on the battlefield. Set to 0 to disable.")]
|
[Desc("Disable production when there are more than this many of this actor on the battlefield. Set to 0 to disable.")]
|
||||||
public readonly int BuildLimit = 0;
|
public readonly int BuildLimit = 0;
|
||||||
|
|
||||||
[Desc("What the unit should start doing. Warning: If this is not a harvester", "it will break if you use FindResources.")]
|
[Desc("What the unit should start doing. Warning: If this is not a harvester", "it will break if you use FindResources.")]
|
||||||
public readonly string InitialActivity = null;
|
public readonly string InitialActivity = null;
|
||||||
|
|
||||||
// TODO: UI fluff; doesn't belong here
|
// TODO: UI fluff; doesn't belong here
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public void Killed(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (!rs.DefaultAnimation.HasSequence("dead")) return;
|
if (!rs.DefaultAnimation.HasSequence("dead")) return;
|
||||||
|
|
||||||
if (rs.DefaultAnimation.GetSequence("dead").Length > 1)
|
if (rs.DefaultAnimation.GetSequence("dead").Length > 1)
|
||||||
rs.DefaultAnimation.Play("dead");
|
rs.DefaultAnimation.Play("dead");
|
||||||
else
|
else
|
||||||
rs.DefaultAnimation.PlayRepeating("dead");
|
rs.DefaultAnimation.PlayRepeating("dead");
|
||||||
|
|
||||||
self.World.AddFrameEndTask(
|
self.World.AddFrameEndTask(
|
||||||
w => w.Add(
|
w => w.Add(
|
||||||
new DelayedAction(info.LingerTime,
|
new DelayedAction(info.LingerTime,
|
||||||
|
|||||||
@@ -40,10 +40,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// the one we're playing in.
|
// the one we're playing in.
|
||||||
return new DisposableAction(
|
return new DisposableAction(
|
||||||
() => { reservedFor = null; reservedForAircraft = null; },
|
() => { reservedFor = null; reservedForAircraft = null; },
|
||||||
() => Game.RunAfterTick(
|
() => Game.RunAfterTick(() =>
|
||||||
() => { if (Game.IsCurrentWorld(self.World)) throw new InvalidOperationException(
|
{
|
||||||
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})"
|
if (Game.IsCurrentWorld(self.World))
|
||||||
.F(forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID)); }));
|
throw new InvalidOperationException(
|
||||||
|
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})".F(
|
||||||
|
forActor.Info.Name, forActor.ActorID, self.Info.Name, self.ActorID));
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsReserved(Actor a)
|
public static bool IsReserved(Actor a)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
lastPos = self.Location;
|
lastPos = self.Location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsVisible(Actor self, Player viewer)
|
public bool IsVisible(Actor self, Player viewer)
|
||||||
{
|
{
|
||||||
if (!Cloaked || self.Owner.IsAlliedWith(viewer))
|
if (!Cloaked || self.Owner.IsAlliedWith(viewer))
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var info = self.Info.Traits.Get<GivesBountyInfo>();
|
var info = self.Info.Traits.Get<GivesBountyInfo>();
|
||||||
|
|
||||||
if (e.Attacker == null || e.Attacker.Destroyed) return;
|
if (e.Attacker == null || e.Attacker.Destroyed) return;
|
||||||
|
|
||||||
if (!info.Stances.Contains(e.Attacker.Owner.Stances[self.Owner])) return;
|
if (!info.Stances.Contains(e.Attacker.Owner.Stances[self.Owner])) return;
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
if (available == wasAvailable)
|
if (available == wasAvailable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (available)
|
if (available)
|
||||||
foreach (var u in info.Upgrades)
|
foreach (var u in info.Upgrades)
|
||||||
manager.GrantUpgrade(self, u, this);
|
manager.GrantUpgrade(self, u, this);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor can be targeted by the Hunt activity.")]
|
[Desc("This actor can be targeted by the Hunt activity.")]
|
||||||
public class HuntableInfo : TraitInfo<Huntable> { }
|
public class HuntableInfo : TraitInfo<Huntable> { }
|
||||||
public class Huntable { }
|
public class Huntable { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Allows automatic targeting of disguised actors.")]
|
[Desc("Allows automatic targeting of disguised actors.")]
|
||||||
class IgnoresDisguiseInfo : TraitInfo<IgnoresDisguise> { }
|
class IgnoresDisguiseInfo : TraitInfo<IgnoresDisguise> { }
|
||||||
|
|
||||||
class IgnoresDisguise { }
|
class IgnoresDisguise { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// Neutral/enemy units are blockers. Allied units that are moving are not blockers.
|
// Neutral/enemy units are blockers. Allied units that are moving are not blockers.
|
||||||
if (canIgnoreMovingAllies && self.Owner.Stances[a.Owner] == Stance.Ally && IsMovingInMyDirection(self, a)) continue;
|
if (canIgnoreMovingAllies && self.Owner.Stances[a.Owner] == Stance.Ally && IsMovingInMyDirection(self, a)) continue;
|
||||||
|
|
||||||
// Non-sharable unit can enter a cell with shareable units only if it can crush all of them.
|
// Non-sharable unit can enter a cell with shareable units only if it can crush all of them.
|
||||||
if (needsCellExclusively)
|
if (needsCellExclusively)
|
||||||
return false;
|
return false;
|
||||||
@@ -218,7 +218,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// Neutral/enemy units are blockers. Allied units that are moving are not blockers.
|
// Neutral/enemy units are blockers. Allied units that are moving are not blockers.
|
||||||
if (canIgnoreMovingAllies && self.Owner.Stances[a.Owner] == Stance.Ally && IsMovingInMyDirection(self, a))
|
if (canIgnoreMovingAllies && self.Owner.Stances[a.Owner] == Stance.Ally && IsMovingInMyDirection(self, a))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Non-sharable unit can enter a cell with shareable units only if it can crush all of them.
|
// Non-sharable unit can enter a cell with shareable units only if it can crush all of them.
|
||||||
if (needsCellExclusively)
|
if (needsCellExclusively)
|
||||||
return true;
|
return true;
|
||||||
@@ -252,7 +252,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
const int AverageTicksBeforePathing = 5;
|
const int AverageTicksBeforePathing = 5;
|
||||||
const int SpreadTicksBeforePathing = 5;
|
const int SpreadTicksBeforePathing = 5;
|
||||||
internal int TicksBeforePathing = 0;
|
internal int TicksBeforePathing = 0;
|
||||||
|
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
public readonly MobileInfo Info;
|
public readonly MobileInfo Info;
|
||||||
public bool IsMoving { get; set; }
|
public bool IsMoving { get; set; }
|
||||||
|
|||||||
@@ -36,13 +36,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public class MissionObjectivesInfo : ITraitInfo
|
public class MissionObjectivesInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Set this to true if multiple cooperative players have a distinct set of " +
|
[Desc("Set this to true if multiple cooperative players have a distinct set of " +
|
||||||
"objectives that each of them has to complete to win the game. This is mainly " +
|
"objectives that each of them has to complete to win the game. This is mainly " +
|
||||||
"useful for multiplayer coop missions. Do not use this for skirmish team games.")]
|
"useful for multiplayer coop missions. Do not use this for skirmish team games.")]
|
||||||
public readonly bool Cooperative = false;
|
public readonly bool Cooperative = false;
|
||||||
|
|
||||||
[Desc("If set to true, this setting causes the game to end immediately once the first " +
|
[Desc("If set to true, this setting causes the game to end immediately once the first " +
|
||||||
"player (or team of cooperative players) fails or completes his objectives. If " +
|
"player (or team of cooperative players) fails or completes his objectives. If " +
|
||||||
"set to false, players that fail their objectives will stick around and become observers.")]
|
"set to false, players that fail their objectives will stick around and become observers.")]
|
||||||
public readonly bool EarlyGameOver = false;
|
public readonly bool EarlyGameOver = false;
|
||||||
|
|
||||||
[Desc("Delay between the game over condition being met, and the game actually ending, in milliseconds.")]
|
[Desc("Delay between the game over condition being met, and the game actually ending, in milliseconds.")]
|
||||||
@@ -245,8 +245,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Provides game mode progress information for players.",
|
[Desc("Provides game mode progress information for players.",
|
||||||
"Goes on WorldActor - observers don't have a player it can live on.",
|
"Goes on WorldActor - observers don't have a player it can live on.",
|
||||||
"Current options for PanelName are 'SKIRMISH_STATS' and 'MISSION_OBJECTIVES'.")]
|
"Current options for PanelName are 'SKIRMISH_STATS' and 'MISSION_OBJECTIVES'.")]
|
||||||
public class ObjectivesPanelInfo : ITraitInfo
|
public class ObjectivesPanelInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public string PanelName = null;
|
public string PanelName = null;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public double MapControl;
|
public double MapControl;
|
||||||
public int OrderCount;
|
public int OrderCount;
|
||||||
|
|
||||||
public int EarnedThisMinute
|
public int EarnedThisMinute
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
|
|
||||||
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
|
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
|
||||||
|
|
||||||
Update(init.Self.Owner, race);
|
Update(init.Self.Owner, race);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
PlayerPower = self.Owner.PlayerActor.Trait<PowerManager>();
|
PlayerPower = self.Owner.PlayerActor.Trait<PowerManager>();
|
||||||
powerModifiers = Exts.Lazy(() => self.TraitsImplementing<IPowerModifier>().ToArray());
|
powerModifiers = Exts.Lazy(() => self.TraitsImplementing<IPowerModifier>().ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpgradeEnabled(Actor self) { PlayerPower.UpdateActor(self); }
|
protected override void UpgradeEnabled(Actor self) { PlayerPower.UpdateActor(self); }
|
||||||
protected override void UpgradeDisabled(Actor self) { PlayerPower.UpdateActor(self); }
|
protected override void UpgradeDisabled(Actor self) { PlayerPower.UpdateActor(self); }
|
||||||
public void AddedToWorld(Actor self) { PlayerPower.UpdateActor(self); }
|
public void AddedToWorld(Actor self) { PlayerPower.UpdateActor(self); }
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var t = init.Actor.Traits.WithInterface<TurretedInfo>()
|
var t = init.Actor.Traits.WithInterface<TurretedInfo>()
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
// Show the correct turret facing
|
// Show the correct turret facing
|
||||||
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
||||||
anim.PlayRepeating("idle");
|
anim.PlayRepeating("idle");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
[Desc("Custom palette name")]
|
[Desc("Custom palette name")]
|
||||||
public readonly string Palette = "effect";
|
public readonly string Palette = "effect";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithBuildingExplosion(this); }
|
public object Create(ActorInitializer init) { return new WithBuildingExplosion(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
renderSimple = self.Trait<RenderSimple>();
|
renderSimple = self.Trait<RenderSimple>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BuildingPlaced(Actor self)
|
public void BuildingPlaced(Actor self)
|
||||||
{
|
{
|
||||||
renderSimple.PlayCustomAnim(self, info.Sequence);
|
renderSimple.PlayCustomAnim(self, info.Sequence);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var building = self.Trait<Building>();
|
var building = self.Trait<Building>();
|
||||||
if (!building.SkipMakeAnimation)
|
if (!building.SkipMakeAnimation)
|
||||||
{
|
{
|
||||||
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
|
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
|
||||||
{
|
{
|
||||||
building.NotifyBuildingComplete(self);
|
building.NotifyBuildingComplete(self);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,9 +38,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
anim = new Animation(self.World, rs.GetImage(self));
|
anim = new Animation(self.World, rs.GetImage(self));
|
||||||
anim.PlayFetchIndex(info.Sequence,
|
anim.PlayFetchIndex(info.Sequence,
|
||||||
() => playerResources.ResourceCapacity != 0
|
() =>
|
||||||
? ((10 * anim.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity)
|
playerResources.ResourceCapacity != 0 ?
|
||||||
: 0);
|
((10 * anim.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity) :
|
||||||
|
0);
|
||||||
|
|
||||||
rs.Add("resources_{0}".F(info.Sequence), new AnimationWithOffset(
|
rs.Add("resources_{0}".F(info.Sequence), new AnimationWithOffset(
|
||||||
anim, null, () => !buildComplete, 1024));
|
anim, null, () => !buildComplete, 1024));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
if (health.HP >= Info.HealIfBelow * health.MaxHP)
|
if (health.HP >= Info.HealIfBelow * health.MaxHP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (damageTicks > 0)
|
if (damageTicks > 0)
|
||||||
{
|
{
|
||||||
--damageTicks;
|
--damageTicks;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public void AppliedDamage(Actor self, Actor damaged, AttackInfo e)
|
public void AppliedDamage(Actor self, Actor damaged, AttackInfo e)
|
||||||
{
|
{
|
||||||
// Don't notify suicides
|
// Don't notify suicides
|
||||||
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
|
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
|
||||||
{
|
{
|
||||||
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
|
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
|
||||||
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
[Desc("Death notification voice.")]
|
[Desc("Death notification voice.")]
|
||||||
public readonly string DeathSound = "Die";
|
public readonly string DeathSound = "Die";
|
||||||
|
|
||||||
[Desc("Multiply volume with this factor.")]
|
[Desc("Multiply volume with this factor.")]
|
||||||
public readonly float VolumeMultiplier = 1f;
|
public readonly float VolumeMultiplier = 1f;
|
||||||
|
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// Select only the tiles that are within range from the requested SubCell
|
// Select only the tiles that are within range from the requested SubCell
|
||||||
// This assumes that the SubCell does not change during the path traversal
|
// This assumes that the SubCell does not change during the path traversal
|
||||||
var tilesInRange = world.Map.FindTilesInCircle(targetCell, range.Range / 1024 + 1)
|
var tilesInRange = world.Map.FindTilesInCircle(targetCell, range.Range / 1024 + 1)
|
||||||
.Where(t => (world.Map.CenterOfCell(t) - target).LengthSquared <= rangeSquared
|
.Where(t => (world.Map.CenterOfCell(t) - target).LengthSquared <= rangeSquared &&
|
||||||
&& mi.CanEnterCell(self.World, self, t));
|
mi.CanEnterCell(self.World, self, t));
|
||||||
|
|
||||||
// See if there is any cell within range that does not involve a cross-domain request
|
// See if there is any cell within range that does not involve a cross-domain request
|
||||||
// Really, we only need to check the circle perimeter, but it's not clear that would be a performance win
|
// Really, we only need to check the circle perimeter, but it's not clear that would be a performance win
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly string FogPalette = "fog";
|
public readonly string FogPalette = "fog";
|
||||||
|
|
||||||
[Desc("Bitfield of shroud directions for each frame. Lower four bits are",
|
[Desc("Bitfield of shroud directions for each frame. Lower four bits are",
|
||||||
"corners clockwise from TL; upper four are edges clockwise from top")]
|
"corners clockwise from TL; upper four are edges clockwise from top")]
|
||||||
public readonly int[] Index = new[] { 12, 9, 8, 3, 1, 6, 4, 2, 13, 11, 7, 14 };
|
public readonly int[] Index = new[] { 12, 9, 8, 3, 1, 6, 4, 2, 13, 11, 7, 14 };
|
||||||
|
|
||||||
[Desc("Use the upper four bits when calculating frame")]
|
[Desc("Use the upper four bits when calculating frame")]
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see COPYING.
|
* see COPYING.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
|
|
||||||
if (o != 255 && overlayResourceMapping.ContainsKey(redAlertOverlayNames[o]))
|
if (o != 255 && overlayResourceMapping.ContainsKey(redAlertOverlayNames[o]))
|
||||||
res = overlayResourceMapping[redAlertOverlayNames[o]];
|
res = overlayResourceMapping[redAlertOverlayNames[o]];
|
||||||
|
|
||||||
var cell = new CPos(i, j);
|
var cell = new CPos(i, j);
|
||||||
map.MapResources.Value[cell] = new ResourceTile(res.First, res.Second);
|
map.MapResources.Value[cell] = new ResourceTile(res.First, res.Second);
|
||||||
|
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
|
|
||||||
var powerFields = new List<MiniYamlNode> { new MiniYamlNode("Amount", power.Value) };
|
var powerFields = new List<MiniYamlNode> { new MiniYamlNode("Amount", power.Value) };
|
||||||
actorTraits.Add(new MiniYamlNode("Power", new MiniYaml("", powerFields)));
|
actorTraits.Add(new MiniYamlNode("Power", new MiniYaml("", powerFields)));
|
||||||
|
|
||||||
if (FieldLoader.GetValue<int>("Power", power.Value.Value) > 0)
|
if (FieldLoader.GetValue<int>("Power", power.Value.Value) > 0)
|
||||||
actorTraits.Add(new MiniYamlNode("ScaleWithHealth", ""));
|
actorTraits.Add(new MiniYamlNode("ScaleWithHealth", ""));
|
||||||
}
|
}
|
||||||
@@ -528,7 +528,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
if (engineVersion < 20140913)
|
if (engineVersion < 20140913)
|
||||||
{
|
{
|
||||||
var spawnsCorpseRemoval = node.Value.Nodes.FirstOrDefault(n => n.Key == "SpawnsCorpse");
|
var spawnsCorpseRemoval = node.Value.Nodes.FirstOrDefault(n => n.Key == "SpawnsCorpse");
|
||||||
|
|
||||||
if (depth == 0 && node.Value.Nodes.Any(n => n.Key.StartsWith("RenderInfantry")) && spawnsCorpseRemoval == null)
|
if (depth == 0 && node.Value.Nodes.Any(n => n.Key.StartsWith("RenderInfantry")) && spawnsCorpseRemoval == null)
|
||||||
node.Value.Nodes.Add(new MiniYamlNode("WithDeathAnimation", new MiniYaml("")));
|
node.Value.Nodes.Add(new MiniYamlNode("WithDeathAnimation", new MiniYaml("")));
|
||||||
|
|
||||||
@@ -732,13 +732,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
ConvertAngle(ref node.Value.Value);
|
ConvertAngle(ref node.Value.Value);
|
||||||
break;
|
break;
|
||||||
case "Speed":
|
case "Speed":
|
||||||
{
|
{
|
||||||
if (parent.Value.Value == "Missile")
|
if (parent.Value.Value == "Missile")
|
||||||
ConvertPxToRange(ref node.Value.Value, 1, 5);
|
ConvertPxToRange(ref node.Value.Value, 1, 5);
|
||||||
if (parent.Value.Value == "Bullet")
|
if (parent.Value.Value == "Bullet")
|
||||||
ConvertPxToRange(ref node.Value.Value, 2, 5);
|
ConvertPxToRange(ref node.Value.Value, 2, 5);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -171,25 +171,25 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
switch (mi.Event)
|
switch (mi.Event)
|
||||||
{
|
{
|
||||||
case MouseInputEvent.Up:
|
case MouseInputEvent.Up:
|
||||||
isMoving = false;
|
isMoving = false;
|
||||||
YieldMouseFocus(mi);
|
YieldMouseFocus(mi);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MouseInputEvent.Down:
|
case MouseInputEvent.Down:
|
||||||
isMoving = true;
|
isMoving = true;
|
||||||
SetValueFromPx(mi.Location - RenderOrigin);
|
|
||||||
OnChange();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MouseInputEvent.Move:
|
|
||||||
if (isMoving)
|
|
||||||
{
|
|
||||||
SetValueFromPx(mi.Location - RenderOrigin);
|
SetValueFromPx(mi.Location - RenderOrigin);
|
||||||
OnChange();
|
OnChange();
|
||||||
}
|
break;
|
||||||
|
|
||||||
break;
|
case MouseInputEvent.Move:
|
||||||
|
if (isMoving)
|
||||||
|
{
|
||||||
|
SetValueFromPx(mi.Location - RenderOrigin);
|
||||||
|
OnChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
var playerWidget = panel.GetOrNull<VqaPlayerWidget>("PLAYER");
|
var playerWidget = panel.GetOrNull<VqaPlayerWidget>("PLAYER");
|
||||||
if (playerWidget != null)
|
if (playerWidget != null)
|
||||||
playerWidget.IsVisible = () => isVideoLoaded;
|
playerWidget.IsVisible = () => isVideoLoaded;
|
||||||
|
|
||||||
var paletteDropDown = panel.GetOrNull<DropDownButtonWidget>("PALETTE_SELECTOR");
|
var paletteDropDown = panel.GetOrNull<DropDownButtonWidget>("PALETTE_SELECTOR");
|
||||||
@@ -118,22 +118,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
frameSlider = panel.Get<SliderWidget>("FRAME_SLIDER");
|
frameSlider = panel.Get<SliderWidget>("FRAME_SLIDER");
|
||||||
if (frameSlider != null)
|
if (frameSlider != null)
|
||||||
{
|
{
|
||||||
frameSlider.OnChange += x =>
|
frameSlider.OnChange += x =>
|
||||||
{
|
{
|
||||||
if (!isVideoLoaded)
|
if (!isVideoLoaded)
|
||||||
currentFrame = (int)Math.Round(x);
|
currentFrame = (int)Math.Round(x);
|
||||||
};
|
};
|
||||||
|
|
||||||
frameSlider.GetValue = () => isVideoLoaded ? player.Video.CurrentFrame : currentFrame;
|
frameSlider.GetValue = () => isVideoLoaded ? player.Video.CurrentFrame : currentFrame;
|
||||||
frameSlider.IsDisabled = () => isVideoLoaded;
|
frameSlider.IsDisabled = () => isVideoLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
var frameText = panel.GetOrNull<LabelWidget>("FRAME_COUNT");
|
var frameText = panel.GetOrNull<LabelWidget>("FRAME_COUNT");
|
||||||
if (frameText != null)
|
if (frameText != null)
|
||||||
{
|
{
|
||||||
frameText.GetText = () =>
|
frameText.GetText = () =>
|
||||||
isVideoLoaded ?
|
isVideoLoaded ?
|
||||||
"{0} / {1}".F(player.Video.CurrentFrame + 1, player.Video.Frames) :
|
"{0} / {1}".F(player.Video.CurrentFrame + 1, player.Video.Frames) :
|
||||||
"{0} / {1}".F(currentFrame + 1, currentSprites.Length);
|
"{0} / {1}".F(currentFrame + 1, currentSprites.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
nextButton.OnClick = () =>
|
nextButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
if (!isVideoLoaded)
|
if (!isVideoLoaded)
|
||||||
nextButton.OnClick = SelectNextFrame;
|
nextButton.OnClick = SelectNextFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -211,12 +211,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var closeButton = panel.GetOrNull<ButtonWidget>("CLOSE_BUTTON");
|
var closeButton = panel.GetOrNull<ButtonWidget>("CLOSE_BUTTON");
|
||||||
if (closeButton != null)
|
if (closeButton != null)
|
||||||
closeButton.OnClick = () =>
|
closeButton.OnClick = () =>
|
||||||
{
|
{
|
||||||
if (isVideoLoaded)
|
if (isVideoLoaded)
|
||||||
player.Stop();
|
player.Stop();
|
||||||
Ui.CloseWindow();
|
Ui.CloseWindow();
|
||||||
onExit();
|
onExit();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
player = null;
|
player = null;
|
||||||
isVideoLoaded = false;
|
isVideoLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(filename))
|
if (string.IsNullOrEmpty(filename))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -325,8 +325,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Func<IFolder, ScrollItemWidget, ScrollItemWidget> setupItem = (source, itemTemplate) =>
|
Func<IFolder, ScrollItemWidget, ScrollItemWidget> setupItem = (source, itemTemplate) =>
|
||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||||
() => assetSource == source,
|
() => assetSource == source,
|
||||||
() => { assetSource = source; PopulateAssetList(); });
|
() => { assetSource = source; PopulateAssetList(); });
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => source != null ? Platform.UnresolvePath(source.Name) : "All Packages";
|
item.Get<LabelWidget>("LABEL").GetText = () => source != null ? Platform.UnresolvePath(source.Name) : "All Packages";
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
@@ -359,7 +359,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShowPaletteDropdown(DropDownButtonWidget dropdown, World world)
|
bool ShowPaletteDropdown(DropDownButtonWidget dropdown, World world)
|
||||||
{
|
{
|
||||||
Func<PaletteFromFile, ScrollItemWidget, ScrollItemWidget> setupItem = (palette, itemTemplate) =>
|
Func<PaletteFromFile, ScrollItemWidget, ScrollItemWidget> setupItem = (palette, itemTemplate) =>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public DisconnectWatcherLogic(Widget widget, OrderManager orderManager)
|
public DisconnectWatcherLogic(Widget widget, OrderManager orderManager)
|
||||||
{
|
{
|
||||||
var disconnected = false;
|
var disconnected = false;
|
||||||
widget.Get<LogicTickerWidget>("DISCONNECT_WATCHER").OnTick = () =>
|
widget.Get<LogicTickerWidget>("DISCONNECT_WATCHER").OnTick = () =>
|
||||||
{
|
{
|
||||||
if (disconnected || orderManager.Connection.ConnectionState != ConnectionState.NotConnected)
|
if (disconnected || orderManager.Connection.ConnectionState != ConnectionState.NotConnected)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var textBox = key.Get<HotkeyEntryWidget>("HOTKEY");
|
var textBox = key.Get<HotkeyEntryWidget>("HOTKEY");
|
||||||
textBox.Key = (Hotkey)field.GetValue(ks);
|
textBox.Key = (Hotkey)field.GetValue(ks);
|
||||||
textBox.OnLoseFocus = () => field.SetValue(ks, textBox.Key);
|
textBox.OnLoseFocus = () => field.SetValue(ks, textBox.Key);
|
||||||
parent.AddChild(key);
|
parent.AddChild(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,8 +536,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||||
() => s.MouseScroll == options[o],
|
() => s.MouseScroll == options[o],
|
||||||
() => s.MouseScroll = options[o]);
|
() => s.MouseScroll = options[o]);
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var stride = radarSheet.Size.Width;
|
var stride = radarSheet.Size.Width;
|
||||||
var dx = actorSprite.Bounds.Left - world.Map.Bounds.Left;
|
var dx = actorSprite.Bounds.Left - world.Map.Bounds.Left;
|
||||||
var dy = actorSprite.Bounds.Top - world.Map.Bounds.Top;
|
var dy = actorSprite.Bounds.Top - world.Map.Bounds.Top;
|
||||||
|
|
||||||
Array.Clear(radarData, 4 * (actorSprite.Bounds.Top * stride + actorSprite.Bounds.Left), 4 * actorSprite.Bounds.Height * stride);
|
Array.Clear(radarData, 4 * (actorSprite.Bounds.Top * stride + actorSprite.Bounds.Left), 4 * actorSprite.Bounds.Height * stride);
|
||||||
|
|
||||||
unsafe
|
unsafe
|
||||||
|
|||||||
@@ -96,8 +96,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Game.Renderer.LineRenderer.FillRect(new Rectangle(b.X, (int)float2.Lerp(b.Bottom, b.Top, providedFrac),
|
Game.Renderer.LineRenderer.FillRect(new Rectangle(
|
||||||
b.Width, (int)(providedFrac * b.Height)), color);
|
b.X, (int)float2.Lerp(b.Bottom, b.Top, providedFrac),
|
||||||
|
b.Width, (int)(providedFrac * b.Height)), color);
|
||||||
|
|
||||||
var x = (b.Left + b.Right - indicator.Size.X) / 2;
|
var x = (b.Left + b.Right - indicator.Size.X) / 2;
|
||||||
var y = float2.Lerp(b.Bottom, b.Top, usedFrac) - indicator.Size.Y / 2;
|
var y = float2.Lerp(b.Bottom, b.Top, usedFrac) - indicator.Size.Y / 2;
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.D2k.Activities
|
|||||||
{
|
{
|
||||||
state = State.MoveToCarryable;
|
state = State.MoveToCarryable;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We got cancelled
|
// We got cancelled
|
||||||
@@ -177,7 +177,7 @@ namespace OpenRA.Mods.D2k.Activities
|
|||||||
c.Dropped();
|
c.Dropped();
|
||||||
|
|
||||||
state = State.Done;
|
state = State.Done;
|
||||||
return Util.SequenceActivities(new Wait(10), this);
|
return Util.SequenceActivities(new Wait(10), this);
|
||||||
|
|
||||||
case State.Done:
|
case State.Done:
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
public readonly long Offset = 0;
|
public readonly long Offset = 0;
|
||||||
public readonly bool AllowModifiers = true;
|
public readonly bool AllowModifiers = true;
|
||||||
public readonly bool InvertColor = false;
|
public readonly bool InvertColor = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new PaletteFromR8(this); }
|
public object Create(ActorInitializer init) { return new PaletteFromR8(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
wormsPresent++;
|
wormsPresent++;
|
||||||
|
|
||||||
return spawnPoint.CenterPosition;
|
return spawnPoint.CenterPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user