explosions are more or less correct now

This commit is contained in:
Chris Forbes
2009-10-29 22:04:04 +13:00
parent 9d543db7fc
commit 066ce1a203
8 changed files with 47 additions and 25 deletions

View File

@@ -60,8 +60,14 @@ namespace OpenRa.Game
if (t > TotalTime()) /* remove finished bullets */
{
Game.world.AddFrameEndTask(w => w.Remove(this));
Game.world.AddFrameEndTask(w => w.Add(new Explosion(Dest)));
Game.world.AddFrameEndTask(w =>
{
w.Remove(this);
w.Add(new Explosion(Dest, Warhead.Explosion));
if (Warhead.ImpactSound != null)
Game.PlaySound(Warhead.ImpactSound + ".aud", false);
});
var maxSpread = GetMaximumSpread();
var hitActors = Game.FindUnitsInCircle(Dest, GetMaximumSpread());

View File

@@ -13,13 +13,15 @@ namespace OpenRa.Game
Animation anim;
int2 pos;
public Explosion(int2 pixelPos)
public Explosion(int2 pixelPos, int style)
{
this.pos = pixelPos;
anim = new Animation("veh-hit3");
anim.PlayThen("idle", () => Game.world.AddFrameEndTask(w => w.Remove(this)));
Game.PlaySound("kaboom25.aud", false);
anim = new Animation("explosion");
if (style != 0)
anim.PlayThen(style.ToString(), () => Game.world.AddFrameEndTask(w => w.Remove(this)));
else
Game.world.AddFrameEndTask(w => w.Remove(this));
}
public void Tick() { anim.Tick(); }

View File

@@ -16,6 +16,8 @@ namespace OpenRa.Game.GameRules
public readonly bool Ore = false;
public readonly int Explosion = 0;
public readonly int InfDeath = 0;
public readonly string ImpactSound = null;
public readonly string WaterImpactSound = null;
public float EffectivenessAgainst(ArmorType at) { return Verses[ (int)at ]; }
}

View File

@@ -13,7 +13,7 @@ namespace OpenRa.Game.Graphics
public Animation( string name )
{
this.name = name.ToLowerInvariant();
Play( "idle" );
// Play( "idle" );
}
public Sprite Image

View File

@@ -37,6 +37,7 @@ namespace OpenRa.Game.Traits
public override void Tick(Actor self)
{
base.Tick(self);
if (doneBuilding)
roof.Tick();
var b = self.Bounds;

View File

@@ -18,6 +18,8 @@ namespace SequenceEditor
public static Dictionary<string, Sequence> Sequences = new Dictionary<string, Sequence>();
public static Bitmap[] LoadAndResolve( string shp )
{
try
{
var reader = new ShpReader(FileSystem.OpenWithExts(shp, ".shp", ".tem", ".sno", ".int"));
return reader.Select(ih =>
@@ -29,6 +31,11 @@ namespace SequenceEditor
return bmp;
}).ToArray();
}
catch
{
return new Bitmap[] { };
}
}
public static void Save()
{
@@ -80,10 +87,6 @@ namespace SequenceEditor
if (UnitName == null)
return;
Shps[UnitName] = LoadAndResolve(UnitName);
/* todo: load supplemental SHPs */
var xpath = string.Format("//unit[@name=\"{0}\"]/sequence", UnitName);
foreach (XmlElement e in Doc.SelectNodes(xpath))
{

View File

@@ -393,9 +393,6 @@
<unit name="120mm">
<sequence name="idle" start="0" length="1" />
</unit>
<unit name="veh-hit3">
<sequence name="idle" start="0" length="*" />
</unit>
<unit name="e3">
<sequence name="stand" start="0" length="8" />
<sequence name="stand2" start="8" length="8" />
@@ -460,4 +457,12 @@
<sequence name="die4" start="217" length="12" />
<sequence name="die5" start="229" length="18" />
</unit>
<unit name="explosion">
<sequence name="1" start="0" length="4" src="piff" />
<sequence name="2" start="0" length="8" src="piffpiff" />
<sequence name="3" start="0" length="14" src="napalm2" />
<sequence name="4" start="0" length="14" src="veh-hit3" />
<sequence name="5" start="0" length="22" src="veh-hit2" />
<sequence name="6" start="0" length="27" src="atomsfx" />
</unit>
</sequences>

View File

@@ -465,3 +465,6 @@ HollowPoint
Super
Organic
Nuke
[HE]
ImpactSound=kaboom25