Merge pull request #7703 from reaperrr/d2k-trails

Fixed D2k trails and deviator explosion color
This commit is contained in:
Oliver Brakmann
2015-03-27 22:27:20 +01:00
8 changed files with 90 additions and 12 deletions

View File

@@ -39,6 +39,8 @@ namespace OpenRA.Mods.Common.Effects
public readonly int TrailInterval = 2; public readonly int TrailInterval = 2;
[Desc("Delay in ticks until trail animaion is spawned.")] [Desc("Delay in ticks until trail animaion is spawned.")]
public readonly int TrailDelay = 1; public readonly int TrailDelay = 1;
public readonly string TrailPalette = "effect";
public readonly bool TrailUsePlayerPalette = false;
public readonly int ContrailLength = 0; public readonly int ContrailLength = 0;
public readonly Color ContrailColor = Color.White; public readonly Color ContrailColor = Color.White;
public readonly bool ContrailUsePlayerColor = false; public readonly bool ContrailUsePlayerColor = false;
@@ -56,6 +58,7 @@ namespace OpenRA.Mods.Common.Effects
[Sync] readonly WRange speed; [Sync] readonly WRange speed;
ContrailRenderable contrail; ContrailRenderable contrail;
string trailPalette;
[Sync] WPos pos, target; [Sync] WPos pos, target;
[Sync] int length; [Sync] int length;
@@ -105,6 +108,10 @@ namespace OpenRA.Mods.Common.Effects
contrail = new ContrailRenderable(world, color, info.ContrailLength, info.ContrailDelay, 0); contrail = new ContrailRenderable(world, color, info.ContrailLength, info.ContrailDelay, 0);
} }
trailPalette = info.TrailPalette;
if (info.TrailUsePlayerPalette)
trailPalette += args.SourceActor.Owner.InternalName;
smokeTicks = info.TrailDelay; smokeTicks = info.TrailDelay;
} }
@@ -131,7 +138,7 @@ namespace OpenRA.Mods.Common.Effects
if (info.Trail != null && --smokeTicks < 0) if (info.Trail != null && --smokeTicks < 0)
{ {
var delayedPos = WPos.LerpQuadratic(args.Source, target, angle, ticks - info.TrailDelay, length); var delayedPos = WPos.LerpQuadratic(args.Source, target, angle, ticks - info.TrailDelay, length);
world.AddFrameEndTask(w => w.Add(new Smoke(w, delayedPos, info.Trail))); world.AddFrameEndTask(w => w.Add(new Smoke(w, delayedPos, info.Trail, trailPalette)));
smokeTicks = info.TrailInterval; smokeTicks = info.TrailInterval;
} }

View File

@@ -45,6 +45,8 @@ namespace OpenRA.Mods.Common.Effects
public readonly string Trail = null; public readonly string Trail = null;
[Desc("Interval in ticks between each spawned Trail animation.")] [Desc("Interval in ticks between each spawned Trail animation.")]
public readonly int TrailInterval = 2; public readonly int TrailInterval = 2;
public readonly string TrailPalette = "effect";
public readonly bool TrailUsePlayerPalette = false;
public readonly int ContrailLength = 0; public readonly int ContrailLength = 0;
public readonly Color ContrailColor = Color.White; public readonly Color ContrailColor = Color.White;
public readonly bool ContrailUsePlayerColor = false; public readonly bool ContrailUsePlayerColor = false;
@@ -69,6 +71,7 @@ namespace OpenRA.Mods.Common.Effects
int ticksToNextSmoke; int ticksToNextSmoke;
ContrailRenderable contrail; ContrailRenderable contrail;
string trailPalette;
[Sync] WPos pos; [Sync] WPos pos;
[Sync] int facing; [Sync] int facing;
@@ -114,6 +117,10 @@ namespace OpenRA.Mods.Common.Effects
var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor; var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
contrail = new ContrailRenderable(world, color, info.ContrailLength, info.ContrailDelay, 0); contrail = new ContrailRenderable(world, color, info.ContrailLength, info.ContrailDelay, 0);
} }
trailPalette = info.TrailPalette;
if (info.TrailUsePlayerPalette)
trailPalette += args.SourceActor.Owner.InternalName;
} }
bool JammedBy(TraitPair<JamsMissiles> tp) bool JammedBy(TraitPair<JamsMissiles> tp)
@@ -164,7 +171,7 @@ namespace OpenRA.Mods.Common.Effects
if (info.Trail != null && --ticksToNextSmoke < 0) if (info.Trail != null && --ticksToNextSmoke < 0)
{ {
world.AddFrameEndTask(w => w.Add(new Smoke(w, pos - 3 * move / 2, info.Trail))); world.AddFrameEndTask(w => w.Add(new Smoke(w, pos - 3 * move / 2, info.Trail, trailPalette)));
ticksToNextSmoke = info.TrailInterval; ticksToNextSmoke = info.TrailInterval;
} }

View File

@@ -20,12 +20,14 @@ namespace OpenRA.Mods.Common.Effects
readonly WPos pos; readonly WPos pos;
readonly CPos cell; readonly CPos cell;
readonly Animation anim; readonly Animation anim;
readonly string palette;
public Smoke(World world, WPos pos, string trail) public Smoke(World world, WPos pos, string trail, string palette)
{ {
this.world = world; this.world = world;
this.pos = pos; this.pos = pos;
this.cell = world.Map.CellContaining(pos); this.cell = world.Map.CellContaining(pos);
this.palette = palette;
anim = new Animation(world, trail); anim = new Animation(world, trail);
anim.PlayThen("idle", anim.PlayThen("idle",
@@ -39,7 +41,7 @@ namespace OpenRA.Mods.Common.Effects
if (world.FogObscures(cell)) if (world.FogObscures(cell))
return SpriteRenderable.None; return SpriteRenderable.None;
return anim.Render(pos, wr.Palette("effect")); return anim.Render(pos, wr.Palette(palette));
} }
} }
} }

View File

@@ -19,6 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WVec Offset = WVec.Zero; public readonly WVec Offset = WVec.Zero;
public readonly int Interval = 3; public readonly int Interval = 3;
public readonly string Sprite = "smokey"; public readonly string Sprite = "smokey";
public readonly string Palette = "effect";
public readonly DamageState MinDamage = DamageState.Heavy; public readonly DamageState MinDamage = DamageState.Heavy;
public object Create(ActorInitializer init) { return new SmokeTrailWhenDamaged(init.Self, this); } public object Create(ActorInitializer init) { return new SmokeTrailWhenDamaged(init.Self, this); }
@@ -45,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation)); var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
var pos = position + body.LocalToWorld(offset); var pos = position + body.LocalToWorld(offset);
self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, info.Sprite))); self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, info.Sprite, info.Palette)));
} }
ticks = info.Interval; ticks = info.Interval;

View File

@@ -29,6 +29,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sprite sequence name")] [Desc("Sprite sequence name")]
public readonly string SmokeType = "smoke_m"; public readonly string SmokeType = "smoke_m";
public readonly string SmokePalette = "effect";
public readonly string Palette = "terrain"; public readonly string Palette = "terrain";
public object Create(ActorInitializer init) { return new SmudgeLayer(this); } public object Create(ActorInitializer init) { return new SmudgeLayer(this); }
@@ -86,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits
public void AddSmudge(CPos loc) public void AddSmudge(CPos loc)
{ {
if (Game.CosmeticRandom.Next(0, 100) <= Info.SmokePercentage) if (Game.CosmeticRandom.Next(0, 100) <= Info.SmokePercentage)
world.AddFrameEndTask(w => w.Add(new Smoke(w, world.Map.CenterOfCell(loc), Info.SmokeType))); world.AddFrameEndTask(w => w.Add(new Smoke(w, world.Map.CenterOfCell(loc), Info.SmokeType, Info.SmokePalette)));
if (!dirty.ContainsKey(loc) && !tiles.ContainsKey(loc)) if (!dirty.ContainsKey(loc) && !tiles.ContainsKey(loc))
{ {

View File

@@ -25,6 +25,9 @@ namespace OpenRA.Mods.Common.Warheads
[Desc("Palette to use for explosion effect.")] [Desc("Palette to use for explosion effect.")]
public readonly string ExplosionPalette = "effect"; public readonly string ExplosionPalette = "effect";
[Desc("Remap explosion effect to player color, if art supports it.")]
public readonly bool UsePlayerPalette = false;
[Desc("Sound to play on impact.")] [Desc("Sound to play on impact.")]
public readonly string ImpactSound = null; public readonly string ImpactSound = null;
@@ -80,8 +83,12 @@ namespace OpenRA.Mods.Common.Warheads
if ((!world.Map.Contains(targetTile)) || (!isValid)) if ((!world.Map.Contains(targetTile)) || (!isValid))
return; return;
var palette = ExplosionPalette;
if (UsePlayerPalette)
palette += firedBy.Owner.InternalName;
if (Explosion != null) if (Explosion != null)
world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Explosion, ExplosionPalette))); world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Explosion, palette)));
if (ImpactSound != null) if (ImpactSound != null)
Sound.Play(ImpactSound, pos); Sound.Play(ImpactSound, pos);

View File

@@ -64,12 +64,54 @@ explosion:
Start: 3512 Start: 3512
Length: 23 Length: 23
BlendMode: Additive BlendMode: Additive
Tick: 60 Tick: 80
corpse: DATA.R8 corpse: DATA.R8
Start: 430 Start: 430
Length: 12 Length: 12
Tick: 1600 Tick: 1600
large_trail:
idle: DATA.R8
Start: 3873
Length: 4
Tick: 80
BlendMode: Additive
small_trail:
idle: DATA.R8
Start: 3735
Length: 4
Tick: 80
BlendMode: Additive
small_trail2:
idle: DATA.R8
Start: 3540
Length: 4
Tick: 80
BlendMode: Additive
bazooka_trail:
idle: DATA.R8
Start: 3381
Length: 4
Tick: 80
BlendMode: Additive
bazooka_trail2:
idle: DATA.R8
Start: 3544
Length: 4
Tick: 80
BlendMode: Additive
deviator_trail:
idle: DATA.R8
Start: 3535
Length: 5
Tick: 80
BlendMode: Additive
laserfire: laserfire:
idle: DATA.R8 idle: DATA.R8
Start: 3386 Start: 3386

View File

@@ -29,10 +29,11 @@ Bazooka:
Projectile: Missile Projectile: Missile
Speed: 160 Speed: 160
Arm: 2 Arm: 2
ContrailLength: 10
Inaccuracy: 96 Inaccuracy: 96
Image: RPG Image: RPG
RateOfTurn: 5 RateOfTurn: 5
Trail: bazooka_trail
TrailInterval: 1
RangeLimit: 35 RangeLimit: 35
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 96 Spread: 96
@@ -184,6 +185,8 @@ QuadRockets:
Inaccuracy: 96 Inaccuracy: 96
Image: RPG Image: RPG
RateOfTurn: 10 RateOfTurn: 10
Trail: bazooka_trail2
TrailInterval: 1
Speed: 256 Speed: 256
RangeLimit: 40 RangeLimit: 40
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
@@ -243,6 +246,8 @@ TowerMissile:
Inaccuracy: 384 Inaccuracy: 384
Image: MISSILE2 Image: MISSILE2
RateOfTurn: 10 RateOfTurn: 10
Trail: large_trail
TrailInterval: 1
Speed: 256 Speed: 256
RangeLimit: 50 RangeLimit: 50
Angle: 110 Angle: 110
@@ -348,7 +353,8 @@ DevBullet:
Angle: 110 Angle: 110
Image: MISSILE2 Image: MISSILE2
RateOfTurn: 5 RateOfTurn: 5
ContrailLength: 5 Trail: large_trail
TrailInterval: 1
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 384 Spread: 384
Damage: 60 Damage: 60
@@ -378,8 +384,10 @@ NerveGasMissile:
Angle: 110 Angle: 110
Inaccuracy: 1c96 Inaccuracy: 1c96
Image: MISSILE Image: MISSILE
ContrailLength: 15 Trail: deviator_trail
ContrailUsePlayerColor: True TrailPalette: player
TrailUsePlayerPalette: true
TrailInterval: 1
Warhead@1Dam: SpreadDamage Warhead@1Dam: SpreadDamage
Spread: 96 Spread: 96
Damage: 10 Damage: 10
@@ -391,6 +399,8 @@ NerveGasMissile:
SmudgeType: SandCrater, RockCrater SmudgeType: SandCrater, RockCrater
Warhead@3Eff: CreateEffect Warhead@3Eff: CreateEffect
Explosion: deviator Explosion: deviator
ExplosionPalette: player
UsePlayerPalette: true
ImpactSound: EXPLSML2.WAV ImpactSound: EXPLSML2.WAV
Warhead@4OwnerChange: ChangeOwner Warhead@4OwnerChange: ChangeOwner
Range: 1c0 Range: 1c0