use pre-multiplied alpha for cloak effects

This commit is contained in:
Matthias Mailänder
2015-08-08 19:02:03 +02:00
parent 4bc8a60fb9
commit 4b1bedd7dd
11 changed files with 32 additions and 18 deletions

View File

@@ -34,7 +34,9 @@ namespace OpenRA.Mods.Common.Traits
public readonly string CloakSound = null; public readonly string CloakSound = null;
public readonly string UncloakSound = null; public readonly string UncloakSound = null;
[PaletteReference] public readonly string Palette = "cloak";
public readonly string Palette = "cloak";
public readonly bool IsPlayerPalette = false;
public readonly HashSet<string> CloakTypes = new HashSet<string> { "Cloak" }; public readonly HashSet<string> CloakTypes = new HashSet<string> { "Cloak" };
@@ -112,10 +114,11 @@ namespace OpenRA.Mods.Common.Traits
if (Cloaked && IsVisible(self, self.World.RenderPlayer)) if (Cloaked && IsVisible(self, self.World.RenderPlayer))
{ {
if (string.IsNullOrEmpty(Info.Palette)) var palette = string.IsNullOrEmpty(Info.Palette) ? null : Info.IsPlayerPalette ? wr.Palette(Info.Palette + self.Owner.InternalName) : wr.Palette(Info.Palette);
if (palette == null)
return r; return r;
else else
return r.Select(a => a.WithPalette(wr.Palette(Info.Palette))); return r.Select(a => a.WithPalette(palette));
} }
else else
return SpriteRenderable.None; return SpriteRenderable.None;

View File

@@ -135,6 +135,7 @@ fremen:
CloakDelay: 250 CloakDelay: 250
CloakSound: STEALTH1.WAV CloakSound: STEALTH1.WAV
UncloakSound: STEALTH2.WAV UncloakSound: STEALTH2.WAV
IsPlayerPalette: true
-MustBeDestroyed: -MustBeDestroyed:
Voiced: Voiced:
VoiceSet: FremenVoice VoiceSet: FremenVoice

View File

@@ -26,12 +26,6 @@
G: 0 G: 0
B: 0 B: 0
A: 140 A: 140
PaletteFromRGBA@cloak:
Name: cloak
R: 0
G: 0
B: 0
A: 140
PaletteFromRGBA@highlight: PaletteFromRGBA@highlight:
Name: highlight Name: highlight
R: 255 R: 255
@@ -87,4 +81,8 @@
Premultiply: false Premultiply: false
PlayerHighlightPalette: PlayerHighlightPalette:
FlashPaletteEffect: FlashPaletteEffect:
PaletteFromPlayerPaletteWithAlpha@cloak:
BaseName: cloak
BasePalette: player
Alpha: 0.55

View File

@@ -357,6 +357,7 @@ stealthraider:
CloakDelay: 90 CloakDelay: 90
CloakSound: STEALTH1.WAV CloakSound: STEALTH1.WAV
UncloakSound: STEALTH2.WAV UncloakSound: STEALTH2.WAV
IsPlayerPalette: true
AutoTarget: AutoTarget:
InitialStance: HoldFire InitialStance: HoldFire
-MustBeDestroyed: -MustBeDestroyed:

View File

@@ -524,7 +524,8 @@ SNIPER:
CloakDelay: 120 CloakDelay: 120
CloakSound: CloakSound:
UncloakSound: UncloakSound:
UncloakOnMove: yes UncloakOnMove: true
IsPlayerPalette: true
DetectCloaked: DetectCloaked:
Range: 6 Range: 6
-MustBeDestroyed: -MustBeDestroyed:

View File

@@ -26,8 +26,8 @@
G: 0 G: 0
B: 0 B: 0
A: 140 A: 140
PaletteFromRGBA@cloak: PaletteFromRGBA@submerged:
Name: cloak Name: submerged
R: 0 R: 0
G: 0 G: 0
B: 0 B: 0
@@ -65,6 +65,10 @@
PlayerColorPalette: PlayerColorPalette:
BasePalette: player BasePalette: player
RemapIndex: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 RemapIndex: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
PaletteFromPlayerPaletteWithAlpha@cloak:
BaseName: cloak
BasePalette: player
Alpha: 0.55
PlayerHighlightPalette: PlayerHighlightPalette:
MenuPaletteEffect: MenuPaletteEffect:
RotationPaletteEffect@defaultwater: RotationPaletteEffect@defaultwater:

View File

@@ -34,6 +34,7 @@ SS:
CloakSound: subshow1.aud CloakSound: subshow1.aud
UncloakSound: subshow1.aud UncloakSound: subshow1.aud
WhileCloakedUpgrades: underwater WhileCloakedUpgrades: underwater
Palette: submerged
Armament: Armament:
Weapon: TorpTube Weapon: TorpTube
LocalOffset: 0,-171,0, 0,171,0 LocalOffset: 0,-171,0, 0,171,0
@@ -88,6 +89,7 @@ MSUB:
CloakSound: subshow1.aud CloakSound: subshow1.aud
UncloakSound: subshow1.aud UncloakSound: subshow1.aud
WhileCloakedUpgrades: underwater WhileCloakedUpgrades: underwater
Palette: submerged
Armament: Armament:
Weapon: SubMissile Weapon: SubMissile
LocalOffset: 0,-171,0, 0,171,0 LocalOffset: 0,-171,0, 0,171,0

View File

@@ -561,6 +561,7 @@ HBOX:
Cloak: Cloak:
InitialDelay: 125 InitialDelay: 125
CloakDelay: 60 CloakDelay: 60
IsPlayerPalette: true
Turreted: Turreted:
ROT: 255 ROT: 255
-QuantizeFacingsFromSequence: -QuantizeFacingsFromSequence:

View File

@@ -740,6 +740,7 @@ STNK:
CloakDelay: 250 CloakDelay: 250
CloakSound: appear1.aud CloakSound: appear1.aud
UncloakSound: appear1.aud UncloakSound: appear1.aud
IsPlayerPalette: true
DetectCloaked: DetectCloaked:
Range: 6 Range: 6
-MustBeDestroyed: -MustBeDestroyed:

View File

@@ -103,6 +103,7 @@
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
InitialDelay: 0 InitialDelay: 0
CloakDelay: 90 CloakDelay: 90
IsPlayerPalette: true
^Building: ^Building:
Inherits: ^BasicBuilding Inherits: ^BasicBuilding
@@ -208,6 +209,7 @@
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
InitialDelay: 0 InitialDelay: 0
CloakDelay: 90 CloakDelay: 90
IsPlayerPalette: true
MustBeDestroyed: MustBeDestroyed:
^BuildingPlug: ^BuildingPlug:
@@ -307,6 +309,7 @@
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
InitialDelay: 0 InitialDelay: 0
CloakDelay: 90 CloakDelay: 90
IsPlayerPalette: true
^Soldier: ^Soldier:
Inherits: ^Infantry Inherits: ^Infantry
@@ -406,6 +409,7 @@
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
InitialDelay: 0 InitialDelay: 0
CloakDelay: 90 CloakDelay: 90
IsPlayerPalette: true
MustBeDestroyed: MustBeDestroyed:
RenderSprites: RenderSprites:
ThrowsShrapnel: ThrowsShrapnel:

View File

@@ -63,12 +63,6 @@
G: 0 G: 0
B: 0 B: 0
A: 140 A: 140
PaletteFromRGBA@cloak:
Name: cloak
R: 0
G: 0
B: 0
A: 140
PaletteFromRGBA@highlight: PaletteFromRGBA@highlight:
Name: highlight Name: highlight
R: 255 R: 255
@@ -110,6 +104,10 @@
PlayerColorPalette: PlayerColorPalette:
BasePalette: player BasePalette: player
RemapIndex: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 RemapIndex: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
PaletteFromPlayerPaletteWithAlpha@cloak:
BaseName: cloak
BasePalette: player
Alpha: 0.55
PlayerHighlightPalette: PlayerHighlightPalette:
MenuPaletteEffect: MenuPaletteEffect: