@@ -85,7 +85,7 @@ namespace OpenRA
|
||||
{
|
||||
var si = Info.Traits.GetOrDefault<SelectableInfo>();
|
||||
var size = (si != null && si.Bounds != null) ? new int2(si.Bounds[0], si.Bounds[1]) :
|
||||
TraitsImplementing<IAutoSelectionSize>().Select(x => x.SelectionSize(this)).FirstOrDefault();
|
||||
TraitsImplementing<IAutoSelectionSize>().Select(x => x.SelectionSize(this)).FirstOrDefault();
|
||||
|
||||
var offset = -size / 2;
|
||||
if (si != null && si.Bounds != null && si.Bounds.Length > 2)
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenRA.FileSystem
|
||||
|
||||
index = entries.ToDictionaryWithConflictLog(x => x.Hash,
|
||||
"{0} ({1} format, Encrypted: {2}, DataStart: {3})".F(filename, (isCncMix ? "C&C" : "RA/TS/RA2"), isEncrypted, dataStart),
|
||||
null, x => "(offs={0}, len={1})".F(x.Offset, x.Length)
|
||||
null, x => "(offs={0}, len={1})".F(x.Offset, x.Length)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace OpenRA.GameRules
|
||||
|
||||
var cellInfo = world.GetTerrainInfo(cell);
|
||||
if (!ValidTargets.Intersect(cellInfo.TargetTypes).Any()
|
||||
|| InvalidTargets.Intersect(cellInfo.TargetTypes).Any())
|
||||
|| InvalidTargets.Intersect(cellInfo.TargetTypes).Any())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Scripting
|
||||
throw new InvalidOperationException("[LuaGlobal] attribute not found for global table '{0}'".F(type));
|
||||
|
||||
Name = names.First().Name;
|
||||
Bind(new [] { this });
|
||||
Bind(new[] { this });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace OpenRA.Scripting
|
||||
if (ctor == null)
|
||||
throw new InvalidOperationException("{0} must define a constructor that takes a ScriptContext context parameter".F(b.Name));
|
||||
|
||||
var binding = (ScriptGlobal)ctor.Invoke(new [] { this });
|
||||
var binding = (ScriptGlobal)ctor.Invoke(new[] { this });
|
||||
using (var obj = binding.ToLuaValue(this))
|
||||
registerGlobal.Call(binding.Name, obj).Dispose();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA
|
||||
static void EmitSyncOpcodes(Type type, ILGenerator il)
|
||||
{
|
||||
if (hashFunctions.ContainsKey(type))
|
||||
il.EmitCall(OpCodes.Call, hashFunctions[type], null);
|
||||
il.EmitCall(OpCodes.Call, hashFunctions[type], null);
|
||||
else if (type == typeof(bool))
|
||||
{
|
||||
var l = il.DefineLabel();
|
||||
|
||||
@@ -162,8 +162,8 @@ namespace OpenRA.Traits
|
||||
};
|
||||
|
||||
foreach (var s in states)
|
||||
if (state >= s.First && anim.HasSequence(s.Second+baseSequence))
|
||||
return s.Second+baseSequence;
|
||||
if (state >= s.First && anim.HasSequence(s.Second + baseSequence))
|
||||
return s.Second + baseSequence;
|
||||
|
||||
return baseSequence;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace OpenRA.Traits
|
||||
void DrawTags(WorldRenderer wr, Actor self, int2 basePosition)
|
||||
{
|
||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
return;
|
||||
return;
|
||||
|
||||
var tagImages = new Animation(self.World, "pips");
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace OpenRA.Widgets
|
||||
if (ps.HasFlags(PanelSides.Center) && ss[8] != null)
|
||||
FillRectWithSprite(new Rectangle(bounds.Left + marginLeft, bounds.Top + marginTop,
|
||||
bounds.Width - marginWidth, bounds.Height - marginHeight),
|
||||
ss[8]);
|
||||
ss[8]);
|
||||
|
||||
// Left border
|
||||
if (ps.HasFlags(PanelSides.Left) && ss[2] != null)
|
||||
|
||||
@@ -881,7 +881,7 @@ namespace OpenRA.Mods.RA.AI
|
||||
|
||||
// Protected harvesters or building
|
||||
if ((self.HasTrait<Harvester>() || self.HasTrait<Building>()) &&
|
||||
p.Stances[e.Attacker.Owner] == Stance.Enemy)
|
||||
p.Stances[e.Attacker.Owner] == Stance.Enemy)
|
||||
{
|
||||
defenseCenter = e.Attacker.Location;
|
||||
ProtectOwn(e.Attacker);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
return this;
|
||||
|
||||
if (HeliFly.AdjustAltitude(self, helicopter, helicopter.Info.LandAltitude))
|
||||
return this;
|
||||
return this;
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.RA
|
||||
foreach (var a in Armaments.Where(a => a.Info.Name == info.Guns))
|
||||
{
|
||||
if (!target.IsInRange(self.CenterPosition, a.Weapon.Range))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
var t = Target.FromPos(cp - new WVec(0, a.Weapon.Range.Range / 2, cp.Z).Rotate(WRot.FromFacing(f)));
|
||||
inAttackRange = true;
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
// This isn't the bridge you're looking for
|
||||
if (!w.Map.IsInMap(x, y) || w.Map.MapTiles.Value[x, y].Type != tile ||
|
||||
w.Map.MapTiles.Value[x, y].Index != ind)
|
||||
w.Map.MapTiles.Value[x, y].Index != ind)
|
||||
continue;
|
||||
|
||||
subTiles.Add(new CPos(x, y), ind);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
|
||||
// Steal and reset the owners exploration
|
||||
infiltrator.Owner.Shroud.Explore(self.Owner.Shroud);
|
||||
if (!self.Owner.HasFogVisibility())
|
||||
self.Owner.Shroud.ResetExploration();
|
||||
self.Owner.Shroud.ResetExploration();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
public void SetPosition(Actor self, CPos cell)
|
||||
{
|
||||
SetLocation(cell,fromSubCell, cell,fromSubCell);
|
||||
SetLocation(cell, fromSubCell, cell, fromSubCell);
|
||||
SetVisualPosition(self, fromCell.CenterPosition + MobileInfo.SubCellOffsets[fromSubCell]);
|
||||
FinishedMoving(self);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
public void SetPosition(Actor self, WPos pos)
|
||||
{
|
||||
var cell = pos.ToCPos();
|
||||
SetLocation(cell,fromSubCell, cell,fromSubCell);
|
||||
SetLocation(cell, fromSubCell, cell, fromSubCell);
|
||||
SetVisualPosition(self, pos);
|
||||
FinishedMoving(self);
|
||||
}
|
||||
@@ -355,14 +355,14 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
switch( order.OrderString )
|
||||
switch (order.OrderString)
|
||||
{
|
||||
case "Move":
|
||||
case "Scatter":
|
||||
case "Stop":
|
||||
return "Move";
|
||||
default:
|
||||
return null;
|
||||
case "Move":
|
||||
case "Scatter":
|
||||
case "Stop":
|
||||
return "Move";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
return new[]{ fromSubCell, SubCell.TopLeft, SubCell.TopRight, SubCell.Center,
|
||||
SubCell.BottomLeft, SubCell.BottomRight}.First(b =>
|
||||
{
|
||||
var blockingActors = self.World.ActorMap.GetUnitsAt(a,b).Where(c => c != ignoreActor);
|
||||
var blockingActors = self.World.ActorMap.GetUnitsAt(a, b).Where(c => c != ignoreActor);
|
||||
if (blockingActors.Any())
|
||||
{
|
||||
// Non-sharable unit can enter a cell with shareable units only if it can crush all of them
|
||||
@@ -577,5 +577,5 @@ namespace OpenRA.Mods.RA.Move
|
||||
var facing = Util.GetFacing(toPos - fromPos, Facing);
|
||||
return Util.SequenceActivities(new Turn(facing), new Drag(fromPos, toPos, length));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public static bool HasFogVisibility( this Player a )
|
||||
{
|
||||
var gpsWatcher = a.PlayerActor.TraitOrDefault<GpsWatcher>();
|
||||
var gpsWatcher = a.PlayerActor.TraitOrDefault<GpsWatcher>();
|
||||
return gpsWatcher != null && (gpsWatcher.Granted || gpsWatcher.GrantedAllies);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
var position = self.CenterPosition;
|
||||
if (position.Z > 0 && self.GetDamageState() >= info.MinDamage &&
|
||||
!self.World.FogObscures(position.ToCPos()))
|
||||
!self.World.FogObscures(position.ToCPos()))
|
||||
{
|
||||
var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
||||
var pos = position + body.LocalToWorld(offset);
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
panel.Get<LabelWidget>("TIME_LABEL").GetText = () => (currentSong == null) ? "" :
|
||||
"{0:D2}:{1:D2} / {2:D2}:{3:D2}".F((int)Sound.MusicSeekPosition / 60, (int)Sound.MusicSeekPosition % 60,
|
||||
currentSong.Length / 60, currentSong.Length % 60);
|
||||
currentSong.Length / 60, currentSong.Length % 60);
|
||||
|
||||
var musicSlider = panel.Get<SliderWidget>("MUSIC_SLIDER");
|
||||
musicSlider.OnChange += x => Sound.MusicVolume = x;
|
||||
|
||||
@@ -36,43 +36,43 @@ namespace OpenRA.TilesetBuilder
|
||||
return Math.Abs(color.R - curr.R) + Math.Abs(color.G - curr.G) + Math.Abs(color.B - curr.B);
|
||||
}
|
||||
|
||||
public void CreateNewTileset()
|
||||
{
|
||||
this.Show();
|
||||
using (var formNew = new FormNew { })
|
||||
if (DialogResult.OK == formNew.ShowDialog())
|
||||
public void CreateNewTileset()
|
||||
{
|
||||
PaletteFromImage = formNew.PaletteFromImage;
|
||||
PaletteFile = formNew.PaletteFile;
|
||||
ImageFile = formNew.ImageFile;
|
||||
TileSize = formNew.TileSize;
|
||||
|
||||
srcfile = ImageFile;
|
||||
this.size = TileSize;
|
||||
surface1.TileSize = TileSize;
|
||||
|
||||
Bitmap fbitmap = new Bitmap(ImageFile);
|
||||
Bitmap rbitmap = fbitmap.Clone(new Rectangle(0, 0, fbitmap.Width, fbitmap.Height),
|
||||
fbitmap.PixelFormat);
|
||||
|
||||
int[] shadowIndex = { };
|
||||
|
||||
if (!PaletteFromImage)
|
||||
this.Show();
|
||||
using (var formNew = new FormNew { })
|
||||
if (DialogResult.OK == formNew.ShowDialog())
|
||||
{
|
||||
TerrainPalette = Palette.Load(PaletteFile, shadowIndex);
|
||||
rbitmap.Palette = TerrainPalette.AsSystemPalette();
|
||||
}
|
||||
PaletteFromImage = formNew.PaletteFromImage;
|
||||
PaletteFile = formNew.PaletteFile;
|
||||
ImageFile = formNew.ImageFile;
|
||||
TileSize = formNew.TileSize;
|
||||
|
||||
surface1.Image = (Bitmap)rbitmap;
|
||||
surface1.TilesPerRow = surface1.Image.Size.Width / surface1.TileSize;
|
||||
surface1.Image.SetResolution(96, 96); // people keep being noobs about DPI, and GDI+ cares.
|
||||
surface1.TerrainTypes = new int[surface1.Image.Width / size, surface1.Image.Height / size]; /* all passable by default */
|
||||
surface1.Templates = new List<Template>();
|
||||
surface1.Size = surface1.Image.Size;
|
||||
surface1.Enabled = true;
|
||||
Load();
|
||||
srcfile = ImageFile;
|
||||
this.size = TileSize;
|
||||
surface1.TileSize = TileSize;
|
||||
|
||||
Bitmap fbitmap = new Bitmap(ImageFile);
|
||||
Bitmap rbitmap = fbitmap.Clone(new Rectangle(0, 0, fbitmap.Width, fbitmap.Height),
|
||||
fbitmap.PixelFormat);
|
||||
|
||||
int[] shadowIndex = { };
|
||||
|
||||
if (!PaletteFromImage)
|
||||
{
|
||||
TerrainPalette = Palette.Load(PaletteFile, shadowIndex);
|
||||
rbitmap.Palette = TerrainPalette.AsSystemPalette();
|
||||
}
|
||||
|
||||
surface1.Image = (Bitmap)rbitmap;
|
||||
surface1.TilesPerRow = surface1.Image.Size.Width / surface1.TileSize;
|
||||
surface1.Image.SetResolution(96, 96); // people keep being noobs about DPI, and GDI+ cares.
|
||||
surface1.TerrainTypes = new int[surface1.Image.Width / size, surface1.Image.Height / size]; /* all passable by default */
|
||||
surface1.Templates = new List<Template>();
|
||||
surface1.Size = surface1.Image.Size;
|
||||
surface1.Enabled = true;
|
||||
Load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormBuilder(string src, string tsize, bool autoExport, string outputDir)
|
||||
{
|
||||
@@ -426,13 +426,13 @@ namespace OpenRA.TilesetBuilder
|
||||
|
||||
// TemplateID CellID tilenr TemplateW TemplateH XinTilesPNG YinTilesPNG
|
||||
Console.WriteLine("{0} {1} {2} {3} {4} {5} {6}",
|
||||
cur,
|
||||
idx,
|
||||
((t.Key.Y * surface1.TilesPerRow) + t.Key.X),
|
||||
tp.Width,
|
||||
tp.Height,
|
||||
t.Key.X,
|
||||
t.Key.Y);
|
||||
cur,
|
||||
idx,
|
||||
((t.Key.Y * surface1.TilesPerRow) + t.Key.X),
|
||||
tp.Width,
|
||||
tp.Height,
|
||||
t.Key.X,
|
||||
t.Key.Y);
|
||||
}
|
||||
|
||||
cur++;
|
||||
|
||||
Reference in New Issue
Block a user