Nuke flash (fixes #16)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Aftermath
|
|||||||
chargeTick = 25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime;
|
chargeTick = 25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime;
|
||||||
|
|
||||||
foreach (var a in self.World.Queries.WithTrait<ChronoshiftPaletteEffect>())
|
foreach (var a in self.World.Queries.WithTrait<ChronoshiftPaletteEffect>())
|
||||||
a.Trait.DoChronoshift();
|
a.Trait.Enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA
|
|||||||
const int chronoEffectLength = 20;
|
const int chronoEffectLength = 20;
|
||||||
int remainingFrames;
|
int remainingFrames;
|
||||||
|
|
||||||
public void DoChronoshift()
|
public void Enable()
|
||||||
{
|
{
|
||||||
remainingFrames = chronoEffectLength;
|
remainingFrames = chronoEffectLength;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,9 +183,10 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
Sound.Play("chrono2.aud", self.CenterLocation);
|
Sound.Play("chrono2.aud", self.CenterLocation);
|
||||||
Sound.Play("chrono2.aud", targetActor.CenterLocation);
|
Sound.Play("chrono2.aud", targetActor.CenterLocation);
|
||||||
|
|
||||||
// Trigger screen desaturate effect
|
// Trigger screen desaturate effect
|
||||||
foreach (var a in self.World.Queries.WithTrait<ChronoshiftPaletteEffect>())
|
foreach (var a in self.World.Queries.WithTrait<ChronoshiftPaletteEffect>())
|
||||||
a.Trait.DoChronoshift();
|
a.Trait.Enable();
|
||||||
|
|
||||||
self.traits.Get<RenderBuilding>().PlayCustomAnim(self, "active");
|
self.traits.Get<RenderBuilding>().PlayCustomAnim(self, "active");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,13 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
{
|
{
|
||||||
altitude -= 10;
|
altitude -= 10;
|
||||||
if (altitude <= 0)
|
if (altitude <= 0)
|
||||||
|
{
|
||||||
|
// Trigger screen desaturate effect
|
||||||
|
foreach (var a in Game.world.Queries.WithTrait<NukePaletteEffect>())
|
||||||
|
a.Trait.Enable();
|
||||||
|
|
||||||
Explode(world);
|
Explode(world);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
62
OpenRA.Mods.RA/NukePaletteEffect.cs
Normal file
62
OpenRA.Mods.RA/NukePaletteEffect.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
|
* This file is part of OpenRA.
|
||||||
|
*
|
||||||
|
* OpenRA is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* OpenRA is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class NukePaletteEffectInfo : TraitInfo<NukePaletteEffect> { }
|
||||||
|
|
||||||
|
public class NukePaletteEffect : IPaletteModifier, ITick
|
||||||
|
{
|
||||||
|
const int nukeEffectLength = 20;
|
||||||
|
int remainingFrames;
|
||||||
|
|
||||||
|
public void Enable()
|
||||||
|
{
|
||||||
|
remainingFrames = nukeEffectLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (remainingFrames > 0)
|
||||||
|
remainingFrames--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AdjustPalette(Bitmap b)
|
||||||
|
{
|
||||||
|
if (remainingFrames == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var frac = (float)remainingFrames / nukeEffectLength;
|
||||||
|
|
||||||
|
// TODO: Fix me to only affect "world" palettes
|
||||||
|
for( var y = 0; y < b.Height; y++ )
|
||||||
|
for (var x = 0; x < 256; x++)
|
||||||
|
{
|
||||||
|
var orig = b.GetPixel(x, y);
|
||||||
|
var white = Color.FromArgb(orig.A, 255, 255, 255);
|
||||||
|
b.SetPixel(x, y, OpenRA.Graphics.Util.Lerp(frac, orig, white));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -177,6 +177,7 @@
|
|||||||
<Compile Include="WaterPaletteRotation.cs" />
|
<Compile Include="WaterPaletteRotation.cs" />
|
||||||
<Compile Include="WithMuzzleFlash.cs" />
|
<Compile Include="WithMuzzleFlash.cs" />
|
||||||
<Compile Include="WithShadow.cs" />
|
<Compile Include="WithShadow.cs" />
|
||||||
|
<Compile Include="NukePaletteEffect.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ World:
|
|||||||
ScreenShaker:
|
ScreenShaker:
|
||||||
WaterPaletteRotation:
|
WaterPaletteRotation:
|
||||||
ChronoshiftPaletteEffect:
|
ChronoshiftPaletteEffect:
|
||||||
|
NukePaletteEffect:
|
||||||
LightPaletteRotator:
|
LightPaletteRotator:
|
||||||
BuildingInfluence:
|
BuildingInfluence:
|
||||||
UnitInfluence:
|
UnitInfluence:
|
||||||
|
|||||||
Reference in New Issue
Block a user