@@ -20,19 +20,21 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class DebugMuzzlePositionsInfo : ITraitInfo
|
||||
public class CombatDebugOverlayInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new DebugFiringOffsets(init.self); }
|
||||
public object Create(ActorInitializer init) { return new CombatDebugOverlay(init.self); }
|
||||
}
|
||||
|
||||
public class DebugFiringOffsets : IPostRender
|
||||
public class CombatDebugOverlay : IPostRender
|
||||
{
|
||||
Lazy<IEnumerable<Armament>> armaments;
|
||||
Lazy<Health> health;
|
||||
DeveloperMode devMode;
|
||||
|
||||
public DebugFiringOffsets(Actor self)
|
||||
public CombatDebugOverlay(Actor self)
|
||||
{
|
||||
armaments = Lazy.New(() => self.TraitsImplementing<Armament>());
|
||||
health = Lazy.New(() => self.TraitOrDefault<Health>());
|
||||
|
||||
var localPlayer = self.World.LocalPlayer;
|
||||
devMode = localPlayer != null ? localPlayer.PlayerActor.Trait<DeveloperMode>() : null;
|
||||
@@ -43,6 +45,9 @@ namespace OpenRA.Mods.RA
|
||||
if (devMode == null || !devMode.ShowMuzzles)
|
||||
return;
|
||||
|
||||
if (health.Value != null)
|
||||
wr.DrawRangeCircle(Color.Red, wr.ScreenPxPosition(self.CenterPosition), health.Value.Info.Radius / Game.CellSize);
|
||||
|
||||
var wlr = Game.Renderer.WorldLineRenderer;
|
||||
var c = Color.White;
|
||||
|
||||
@@ -50,7 +55,7 @@ namespace OpenRA.Mods.RA
|
||||
foreach (var b in a.Barrels)
|
||||
{
|
||||
var muzzle = self.CenterPosition + a.MuzzleOffset(self, b);
|
||||
var dirOffset = new WVec(0,-224,0).Rotate(a.MuzzleOrientation(self, b));
|
||||
var dirOffset = new WVec(0, -224, 0).Rotate(a.MuzzleOrientation(self, b));
|
||||
|
||||
var sm = wr.ScreenPosition(muzzle);
|
||||
var sd = wr.ScreenPosition(muzzle + dirOffset);
|
||||
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
}
|
||||
}
|
||||
|
||||
var dbg = world.WorldActor.TraitOrDefault<DebugOverlay>();
|
||||
var dbg = world.WorldActor.TraitOrDefault<PathfinderDebugOverlay>();
|
||||
if (dbg != null)
|
||||
{
|
||||
dbg.AddLayer(search.considered.Select(p => new Pair<CPos, int>(p, search.cellInfo[p.X, p.Y].MinCost)), search.maxCost, search.owner);
|
||||
@@ -199,7 +199,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
}
|
||||
}
|
||||
|
||||
var dbg = world.WorldActor.TraitOrDefault<DebugOverlay>();
|
||||
var dbg = world.WorldActor.TraitOrDefault<PathfinderDebugOverlay>();
|
||||
if (dbg != null)
|
||||
{
|
||||
dbg.AddLayer(fromSrc.considered.Select(p => new Pair<CPos, int>(p, fromSrc.cellInfo[p.X, p.Y].MinCost)), fromSrc.maxCost, fromSrc.owner);
|
||||
|
||||
@@ -414,7 +414,6 @@
|
||||
<Compile Include="Widgets\SupportPowerBinWidget.cs" />
|
||||
<Compile Include="Widgets\WorldCommandWidget.cs" />
|
||||
<Compile Include="World\ChooseBuildTabOnSelect.cs" />
|
||||
<Compile Include="World\DebugOverlay.cs" />
|
||||
<Compile Include="World\ResourceClaim.cs" />
|
||||
<Compile Include="World\ResourceClaimLayer.cs" />
|
||||
<Compile Include="World\PlayMusicOnMapLoad.cs" />
|
||||
@@ -429,7 +428,6 @@
|
||||
<Compile Include="Widgets\ColorPreviewManagerWidget.cs" />
|
||||
<Compile Include="Infiltrates.cs" />
|
||||
<Compile Include="Armament.cs" />
|
||||
<Compile Include="DebugMuzzlePositions.cs" />
|
||||
<Compile Include="Buildings\BaseProvider.cs" />
|
||||
<Compile Include="Widgets\Logic\ObserverShroudSelectorLogic.cs" />
|
||||
<Compile Include="RepairsBridges.cs" />
|
||||
@@ -471,6 +469,8 @@
|
||||
<Compile Include="AI\States\ProtectionStates.cs" />
|
||||
<Compile Include="AI\States\AirStates.cs" />
|
||||
<Compile Include="Widgets\Logic\InstallLogic.cs" />
|
||||
<Compile Include="CombatDebugOverlay.cs" />
|
||||
<Compile Include="World\PathfinderDebugOverlay.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
noexplorationButton.OnClick = () =>
|
||||
world.IssueOrder(new Order("DevResetExploration", world.LocalPlayer.PlayerActor, false));
|
||||
|
||||
var dbgOverlay = world.WorldActor.TraitOrDefault<DebugOverlay>();
|
||||
var dbgOverlay = world.WorldActor.TraitOrDefault<PathfinderDebugOverlay>();
|
||||
var showAstarCostCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_ASTAR");
|
||||
if (showAstarCostCheckbox != null)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
using System;
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* 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
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@@ -9,11 +19,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class DebugOverlayInfo : Traits.TraitInfo<DebugOverlay>
|
||||
{
|
||||
}
|
||||
|
||||
class DebugOverlay : IRenderOverlay, IWorldLoaded
|
||||
class PathfinderDebugOverlayInfo : Traits.TraitInfo<PathfinderDebugOverlay> { }
|
||||
class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded
|
||||
{
|
||||
Dictionary<Player, int[,]> layers;
|
||||
int refreshTick;
|
||||
@@ -22,11 +29,12 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public void WorldLoaded(World w, WorldRenderer wr)
|
||||
{
|
||||
this.world = w;
|
||||
this.refreshTick = 0;
|
||||
this.layers = new Dictionary<Player, int[,]>(8);
|
||||
world = w;
|
||||
refreshTick = 0;
|
||||
layers = new Dictionary<Player, int[,]>(8);
|
||||
|
||||
// Enabled via Cheats menu
|
||||
this.Visible = false;
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public void AddLayer(IEnumerable<Pair<CPos, int>> cellWeights, int maxWeight, Player pl)
|
||||
@@ -41,7 +49,7 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
|
||||
foreach (var p in cellWeights)
|
||||
layer[p.First.X, p.First.Y] = Math.Min(128, (layer[p.First.X, p.First.Y]) + ((maxWeight - p.Second) * 64 / maxWeight));
|
||||
layer[p.First.X, p.First.Y] = Math.Min(128, layer[p.First.X, p.First.Y] + (maxWeight - p.Second) * 64 / maxWeight);
|
||||
}
|
||||
|
||||
public void Render(WorldRenderer wr)
|
||||
@@ -64,16 +72,17 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
for (var i = viewBounds.Left; i <= viewBounds.Right; ++i)
|
||||
{
|
||||
if (layer [i, j] <= 0)
|
||||
if (layer[i, j] <= 0)
|
||||
continue;
|
||||
|
||||
var w = Math.Max(0, Math.Min(layer [i, j], 128));
|
||||
var w = Math.Max(0, Math.Min(layer[i, j], 128));
|
||||
if (doDim)
|
||||
layer [i, j] = layer [i, j] * 5 / 6;
|
||||
layer[i, j] = layer[i, j] * 5 / 6;
|
||||
|
||||
// TODO: This doesn't make sense for isometric terrain
|
||||
var tl = wr.ScreenPxPosition(new CPos(i, j).CenterPosition) - new int2(Game.CellSize, Game.CellSize);
|
||||
qr.FillRect(new RectangleF(tl.X, tl.Y, Game.CellSize, Game.CellSize), Color.FromArgb(w, c));
|
||||
var tl = wr.ScreenPxPosition(new CPos(i, j).TopLeft);
|
||||
var br = wr.ScreenPxPosition(new CPos(i, j).BottomRight);
|
||||
qr.FillRect(RectangleF.FromLTRB(tl.X, tl.Y, br.X, br.Y), Color.FromArgb(w, c));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ Container@CHEATS_PANEL:
|
||||
Y:235
|
||||
Height:20
|
||||
Width:200
|
||||
Text:Show Muzzle Positions
|
||||
Text:Show Combat Geometry
|
||||
Checkbox@SHOW_GEOMETRY:
|
||||
X:290
|
||||
Y:265
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
ActorLostNotification:
|
||||
AttackMove:
|
||||
WithSmoke:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -75,7 +75,7 @@
|
||||
Explodes:
|
||||
Weapon: UnitExplodeSmall
|
||||
EmptyWeapon: UnitExplodeSmall
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -110,7 +110,7 @@
|
||||
Explodes:
|
||||
Weapon: HeliExplode
|
||||
EmptyWeapon: HeliExplode
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
BodyOrientation:
|
||||
UpdatesPlayerStatistics:
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
Probability: 2
|
||||
CrushableInfantry:
|
||||
WarnProbability: 60
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -261,7 +261,7 @@
|
||||
GivesExperience:
|
||||
DrawLineToTarget:
|
||||
ActorLostNotification:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
BodyOrientation:
|
||||
|
||||
^Ship:
|
||||
@@ -281,7 +281,7 @@
|
||||
DrawLineToTarget:
|
||||
ActorLostNotification:
|
||||
AttackMove:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -329,7 +329,7 @@
|
||||
ShakeOnDeath:
|
||||
Sellable:
|
||||
LegacyCapturable:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guardable:
|
||||
Range: 3
|
||||
BodyOrientation:
|
||||
|
||||
@@ -311,7 +311,7 @@ World:
|
||||
Type:Crater
|
||||
Types:cr1,cr2,cr3,cr4,cr5,cr6
|
||||
Depths:5,5,5,5,5,5
|
||||
DebugOverlay:
|
||||
PathfinderDebugOverlay:
|
||||
SpawnMapActors:
|
||||
MPStartLocations:
|
||||
CreateMPPlayers:
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
GivesBounty:
|
||||
Repairable:
|
||||
RepairBuildings: repaira,repairo,repairh
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
RenderUnit:
|
||||
@@ -67,7 +67,7 @@
|
||||
GivesBounty:
|
||||
Repairable:
|
||||
RepairBuildings: repaira,repairo,repairh
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
RenderUnit:
|
||||
@@ -162,7 +162,7 @@
|
||||
RepairableNear:
|
||||
Buildings: barra, barro
|
||||
CloseEnough: 1
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -185,7 +185,7 @@
|
||||
ProximityCaptor:
|
||||
Types:Plane
|
||||
GivesBounty:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
BodyOrientation:
|
||||
UpdatesPlayerStatistics:
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
Types:Building
|
||||
Sellable:
|
||||
GivesBounty:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guardable:
|
||||
Range: 3
|
||||
BodyOrientation:
|
||||
|
||||
@@ -441,6 +441,7 @@ World:
|
||||
Name: Ordos
|
||||
Race: ordos
|
||||
DomainIndex:
|
||||
PathfinderDebugOverlay:
|
||||
ResourceLayer:
|
||||
ResourceClaimLayer:
|
||||
ResourceType@Spice:
|
||||
|
||||
@@ -86,7 +86,7 @@ Background@CHEATS_PANEL:
|
||||
Y:350
|
||||
Height:20
|
||||
Width:200
|
||||
Text:Show Muzzle Positions
|
||||
Text:Show Combat Geometry
|
||||
Checkbox@SHOW_GEOMETRY:
|
||||
X:30
|
||||
Y:380
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
String:Vehicle
|
||||
WithSmoke:
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -78,7 +78,7 @@
|
||||
String:Vehicle
|
||||
WithSmoke:
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -132,7 +132,7 @@
|
||||
CrushableInfantry:
|
||||
CrushSound: squishy2.aud
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -170,7 +170,7 @@
|
||||
String:Ship
|
||||
WithSmoke:
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -201,7 +201,7 @@
|
||||
GpsDot:
|
||||
String:Plane
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
BodyOrientation:
|
||||
|
||||
^Helicopter:
|
||||
@@ -245,7 +245,7 @@
|
||||
AcceptsSupplies:
|
||||
GivesBounty:
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guardable:
|
||||
Range: 3
|
||||
BodyOrientation:
|
||||
|
||||
@@ -645,7 +645,7 @@ World:
|
||||
Type:Crater
|
||||
Types:cr1,cr2,cr3,cr4,cr5,cr6
|
||||
Depths:5,5,5,5,5,5
|
||||
DebugOverlay:
|
||||
PathfinderDebugOverlay:
|
||||
SpawnMapActors:
|
||||
CreateMPPlayers:
|
||||
MPStartUnits@mcvonly:
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
AcceptsSupplies:
|
||||
GivesBounty:
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guardable:
|
||||
Range: 3
|
||||
BodyOrientation:
|
||||
@@ -77,7 +77,7 @@
|
||||
CrushableInfantry:
|
||||
CrushSound: squish6.aud
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -142,7 +142,7 @@
|
||||
GivesBounty:
|
||||
# WithSmoke:
|
||||
UpdatesPlayerStatistics:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
@@ -197,5 +197,5 @@
|
||||
GivesExperience:
|
||||
DrawLineToTarget:
|
||||
ActorLostNotification:
|
||||
DebugMuzzlePositions:
|
||||
CombatDebugOverlay:
|
||||
BodyOrientation:
|
||||
@@ -116,7 +116,7 @@ World:
|
||||
Race: nod
|
||||
ResourceLayer:
|
||||
ResourceClaimLayer:
|
||||
DebugOverlay:
|
||||
PathfinderDebugOverlay:
|
||||
SpawnMapActors:
|
||||
CreateMPPlayers:
|
||||
MPStartUnits:
|
||||
|
||||
Reference in New Issue
Block a user