move water & light palette manips into ra

This commit is contained in:
Chris Forbes
2010-05-20 18:12:13 +12:00
parent d3332a7454
commit 4585addff2
5 changed files with 8 additions and 7 deletions

View File

@@ -223,7 +223,6 @@
<Compile Include="Traits\Helicopter.cs" />
<Compile Include="Traits\Modifiers\InvisibleToOthers.cs" />
<Compile Include="Traits\ConstructionYard.cs" />
<Compile Include="Traits\World\LightPaletteRotator.cs" />
<Compile Include="Traits\LimitedAmmo.cs" />
<Compile Include="Traits\World\PaletteFromFile.cs" />
<Compile Include="Traits\World\PaletteFromRGBA.cs" />
@@ -266,7 +265,6 @@
<Compile Include="Traits\Unit.cs" />
<Compile Include="Traits\World\SpawnMapActors.cs" />
<Compile Include="Traits\World\UnitInfluence.cs" />
<Compile Include="Traits\World\WaterPaletteRotation.cs" />
<Compile Include="Traits\Modifiers\WithShadow.cs" />
<Compile Include="Network\UnitOrders.cs" />
<Compile Include="Traits\Util.cs" />

View File

@@ -1,45 +0,0 @@
#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;
namespace OpenRA.Traits
{
class LightPaletteRotatorInfo : TraitInfo<LightPaletteRotator> { }
class LightPaletteRotator : ITick, IPaletteModifier
{
float t = 0;
public void Tick(Actor self)
{
t += .5f;
}
public void AdjustPalette(Bitmap b)
{
var rotate = (int)t % 18;
if (rotate > 9)
rotate = 18 - rotate;
using (var bitmapCopy = new Bitmap(b))
for (int j = 0; j < 16; j++)
b.SetPixel(0x67, j, b.GetPixel(230+rotate, j));
}
}
}

View File

@@ -1,44 +0,0 @@
#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;
namespace OpenRA.Traits
{
class WaterPaletteRotationInfo : TraitInfo<WaterPaletteRotation> { }
class WaterPaletteRotation : ITick, IPaletteModifier
{
float t = 0;
public void Tick(Actor self)
{
t += .25f;
}
public void AdjustPalette(Bitmap b)
{
var rotate = (int)t % 7;
using (var bitmapCopy = new Bitmap(b))
for (int j = 0; j < 16; j++)
for (int i = 0; i < 7; i++)
b.SetPixel(0x60 + (rotate + i) % 7, j, bitmapCopy.GetPixel(0x60 + i, j));
}
}
}