Fix palette issues with Oil Derricks and walls (fixes #501).
This commit is contained in:
40
OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs
Normal file
40
OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2010 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 LICENSE.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Cnc
|
||||||
|
{
|
||||||
|
class CncWaterPaletteRotationInfo : TraitInfo<CncWaterPaletteRotation> {}
|
||||||
|
|
||||||
|
class CncWaterPaletteRotation : ITick, IPaletteModifier
|
||||||
|
{
|
||||||
|
|
||||||
|
float t = 0;
|
||||||
|
public void Tick(Actor self)
|
||||||
|
{
|
||||||
|
t += .25f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AdjustPalette(Dictionary<string,Palette> palettes)
|
||||||
|
{
|
||||||
|
// Only modify the terrain palette
|
||||||
|
var pal = palettes["terrain"];
|
||||||
|
|
||||||
|
var copy = (uint[])pal.Values.Clone();
|
||||||
|
var rotate = (int)t % 7;
|
||||||
|
for (int i = 0; i < 7; i++)
|
||||||
|
pal.SetColor(0x20 + (rotate + i) % 7, copy[0x20 + i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,6 +67,7 @@
|
|||||||
<Compile Include="WithFire.cs" />
|
<Compile Include="WithFire.cs" />
|
||||||
<Compile Include="Activities\HarvesterDockSequence.cs" />
|
<Compile Include="Activities\HarvesterDockSequence.cs" />
|
||||||
<Compile Include="TiberiumRefinery.cs" />
|
<Compile Include="TiberiumRefinery.cs" />
|
||||||
|
<Compile Include="CncWaterPaletteRotation.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -15,20 +15,9 @@ using OpenRA.FileFormats;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class WaterPaletteRotationInfo : ITraitInfo
|
class WaterPaletteRotationInfo : TraitInfo<WaterPaletteRotation> {}
|
||||||
{
|
|
||||||
public readonly bool CncMode = false;
|
|
||||||
public object Create(ActorInitializer init) { return new WaterPaletteRotation(CncMode); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class WaterPaletteRotation : ITick, IPaletteModifier
|
class WaterPaletteRotation : ITick, IPaletteModifier
|
||||||
{
|
{
|
||||||
bool cncmode = false;
|
|
||||||
public WaterPaletteRotation(bool cncmode)
|
|
||||||
{
|
|
||||||
this.cncmode = cncmode;
|
|
||||||
}
|
|
||||||
|
|
||||||
float t = 0;
|
float t = 0;
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
@@ -46,12 +35,7 @@ namespace OpenRA.Mods.RA
|
|||||||
var copy = (uint[])pal.Value.Values.Clone();
|
var copy = (uint[])pal.Value.Values.Clone();
|
||||||
var rotate = (int)t % 7;
|
var rotate = (int)t % 7;
|
||||||
for (int i = 0; i < 7; i++)
|
for (int i = 0; i < 7; i++)
|
||||||
{
|
pal.Value.SetColor(0x60 + (rotate + i) % 7, copy[0x60 + i]);
|
||||||
if (cncmode)
|
|
||||||
pal.Value.SetColor(0x20 + (rotate + i) % 7, copy[0x20 + i]);
|
|
||||||
else
|
|
||||||
pal.Value.SetColor(0x60 + (rotate + i) % 7, copy[0x60 + i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
Priority: 1
|
Priority: 1
|
||||||
RenderBuildingWall:
|
RenderBuildingWall:
|
||||||
HasMakeAnimation: false
|
HasMakeAnimation: false
|
||||||
Palette: terrain
|
Palette: staticterrain
|
||||||
GivesExperience:
|
GivesExperience:
|
||||||
EditorAppearance:
|
EditorAppearance:
|
||||||
RelativeToTopLeft: yes
|
RelativeToTopLeft: yes
|
||||||
@@ -267,7 +267,7 @@
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Tree
|
Name: Tree
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
Palette: terrain
|
Palette: staticterrain
|
||||||
Building:
|
Building:
|
||||||
Footprint: __ x_
|
Footprint: __ x_
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
@@ -281,7 +281,7 @@
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Rock
|
Name: Rock
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
Palette: terrain
|
Palette: staticterrain
|
||||||
Building:
|
Building:
|
||||||
Footprint: __ x_
|
Footprint: __ x_
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
|
|||||||
@@ -49,14 +49,15 @@ World:
|
|||||||
ObserverWidget: OBSERVER_ROOT
|
ObserverWidget: OBSERVER_ROOT
|
||||||
ScreenShaker:
|
ScreenShaker:
|
||||||
NukePaletteEffect:
|
NukePaletteEffect:
|
||||||
WaterPaletteRotation:
|
CncWaterPaletteRotation:
|
||||||
CncMode: true
|
|
||||||
BuildingInfluence:
|
BuildingInfluence:
|
||||||
UnitInfluence:
|
UnitInfluence:
|
||||||
BridgeLayer:
|
BridgeLayer:
|
||||||
Bridges: bridge1, bridge2, bridge3, bridge4
|
Bridges: bridge1, bridge2, bridge3, bridge4
|
||||||
PaletteFromCurrentTileset:
|
PaletteFromCurrentTileset@terrain:
|
||||||
Name: terrain
|
Name: terrain
|
||||||
|
PaletteFromCurrentTileset@static:
|
||||||
|
Name: staticterrain
|
||||||
PaletteFromFile@chrome:
|
PaletteFromFile@chrome:
|
||||||
Name: chrome
|
Name: chrome
|
||||||
Filename: temperat.pal
|
Filename: temperat.pal
|
||||||
@@ -97,7 +98,7 @@ World:
|
|||||||
ResourceLayer:
|
ResourceLayer:
|
||||||
ResourceType@green-tib:
|
ResourceType@green-tib:
|
||||||
ResourceType: 1
|
ResourceType: 1
|
||||||
Palette: terrain
|
Palette: staticterrain
|
||||||
TerrainType: Tiberium
|
TerrainType: Tiberium
|
||||||
SpriteNames: ti1,ti2,ti3,ti4,ti5,ti6,ti7,ti8,ti9,ti10,ti11,ti12
|
SpriteNames: ti1,ti2,ti3,ti4,ti5,ti6,ti7,ti8,ti9,ti10,ti11,ti12
|
||||||
ValuePerUnit: 30
|
ValuePerUnit: 30
|
||||||
@@ -107,7 +108,7 @@ World:
|
|||||||
AllowUnderActors: false
|
AllowUnderActors: false
|
||||||
ResourceType@blue-tib:
|
ResourceType@blue-tib:
|
||||||
ResourceType: 2
|
ResourceType: 2
|
||||||
Palette: terrain
|
Palette: staticterrain
|
||||||
TerrainType: BlueTiberium
|
TerrainType: BlueTiberium
|
||||||
SpriteNames: bti1,bti2,bti3,bti4,bti5,bti6,bti7,bti8,bti9,bti10,bti11,bti12
|
SpriteNames: bti1,bti2,bti3,bti4,bti5,bti6,bti7,bti8,bti9,bti10,bti11,bti12
|
||||||
ValuePerUnit: 60
|
ValuePerUnit: 60
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
V19:
|
V19:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^CivBuilding
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
|
Palette: staticterrain
|
||||||
CashTrickler:
|
CashTrickler:
|
||||||
Building:
|
Building:
|
||||||
Footprint: x
|
Footprint: x
|
||||||
@@ -19,6 +20,7 @@ V19.Husk:
|
|||||||
-DeadBuildingState:
|
-DeadBuildingState:
|
||||||
-Health:
|
-Health:
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
|
Palette: staticterrain
|
||||||
WithFire:
|
WithFire:
|
||||||
Building:
|
Building:
|
||||||
Footprint: x
|
Footprint: x
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SPLIT2:
|
SPLIT2:
|
||||||
Inherits: ^Tree
|
Inherits: ^Tree
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
Palette: terrain
|
Palette: staticterrain
|
||||||
SeedsResource:
|
SeedsResource:
|
||||||
ResourceType:Tiberium
|
ResourceType:Tiberium
|
||||||
Tooltip:
|
Tooltip:
|
||||||
@@ -13,7 +13,7 @@ SPLIT2:
|
|||||||
SPLIT3:
|
SPLIT3:
|
||||||
Inherits: ^Tree
|
Inherits: ^Tree
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
Palette: terrain
|
Palette: staticterrain
|
||||||
SeedsResource:
|
SeedsResource:
|
||||||
ResourceType:Tiberium
|
ResourceType:Tiberium
|
||||||
Tooltip:
|
Tooltip:
|
||||||
|
|||||||
Reference in New Issue
Block a user