From ac53b894211d3caa8c3294c456c33f406f86df89 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 14 Nov 2023 22:25:22 +0000 Subject: [PATCH] Remove D2kFogPalette. --- OpenRA.Mods.D2k/Traits/World/D2kFogPalette.cs | 57 ------------------- mods/d2k/bits/fog.pal | 1 + mods/d2k/rules/palettes.yaml | 5 +- 3 files changed, 4 insertions(+), 59 deletions(-) delete mode 100644 OpenRA.Mods.D2k/Traits/World/D2kFogPalette.cs create mode 100644 mods/d2k/bits/fog.pal diff --git a/OpenRA.Mods.D2k/Traits/World/D2kFogPalette.cs b/OpenRA.Mods.D2k/Traits/World/D2kFogPalette.cs deleted file mode 100644 index f0f5591f07..0000000000 --- a/OpenRA.Mods.D2k/Traits/World/D2kFogPalette.cs +++ /dev/null @@ -1,57 +0,0 @@ -#region Copyright & License Information -/* - * Copyright (c) The OpenRA Developers and Contributors - * 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, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System.Collections.Generic; -using OpenRA.Graphics; -using OpenRA.Mods.Common.Traits; -using OpenRA.Traits; - -namespace OpenRA.Mods.D2k.Traits -{ - [TraitLocation(SystemActors.World | SystemActors.EditorWorld)] - sealed class D2kFogPaletteInfo : TraitInfo - { - [PaletteDefinition] - [FieldLoader.Require] - [Desc("Internal palette name")] - public readonly string Name = null; - - [PaletteReference] - [FieldLoader.Require] - [Desc("The name of the shroud palette to base off.")] - public readonly string BasePalette = null; - - [Desc("Allow palette modifiers to change the palette.")] - public readonly bool AllowModifiers = true; - - public override object Create(ActorInitializer init) { return new D2kFogPalette(this); } - } - - sealed class D2kFogPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes - { - readonly D2kFogPaletteInfo info; - public D2kFogPalette(D2kFogPaletteInfo info) { this.info = info; } - - public void LoadPalettes(WorldRenderer wr) - { - var basePalette = wr.Palette(info.BasePalette).Palette; - - // Bit twiddling is equivalent to unpacking RGB channels, dividing them by 2, subtracting from 255, then repacking - var fog = new uint[Palette.Size]; - for (var i = 0; i < Palette.Size; i++) - fog[i] = ~((basePalette[i] >> 1) & 0x007F7F7F); - - wr.AddPalette(info.Name, new ImmutablePalette(fog), info.AllowModifiers); - } - - public IEnumerable PaletteNames { get { yield return info.Name; } } - } -} diff --git a/mods/d2k/bits/fog.pal b/mods/d2k/bits/fog.pal new file mode 100644 index 0000000000..463d1206f4 --- /dev/null +++ b/mods/d2k/bits/fog.pal @@ -0,0 +1 @@ +??????>>>===<<<;;;:::999888777666555333222111000///...---,,,+++***)))((('''&&&%%%$$$###"""!!! ? ;! ?! ?$#?'&?*)?,,?//?21?54?774 %7 '; )? +?#-?&/?)1?,3$ $( (, ,0 /4 37 7; ;? ?? ??"??#??%??&??(??)??+??,??.??0??1??3??4??6??7? $ ( , 0 4 7 ; ?##?&&?))?,,?//?11?44?77? (4 )7 *; ,?#.?&0?)2?,4? $$ (( ,, /0 34 77 ;; ?? ??"??#??%??&??(??)??+??,??.??0??1??3??4??6??7?? $! (# ,$ 0% 4& 7( ;) ?*#?,&?/)?1,?3/?51?74?97?: $ ( , 0 4 7 ; ? #?#&?&)?),?,/?/1?24?47?7$" %# '$ (% )& +' ,( -( /) 1+ 3, 4-!4."5.$5/%60&60(71)72*83+83,94-94.:5/:61;62;74<85<86<97=:8>;:????????????????????????::':6':1':,':'':',:'1:'69':4':.':)':'*:'0:'5:'::':4':/':)*:'/:'5:'::' 7??'.5?3)><6)3)>??& ?'?????7??7???????????5$4=%4??+7??7??7)5>(!,05?3)=$4 *5??+>??>??=?+121332:32?32?>5???=%4??? \ No newline at end of file diff --git a/mods/d2k/rules/palettes.yaml b/mods/d2k/rules/palettes.yaml index 12782ee8b0..b66768b299 100644 --- a/mods/d2k/rules/palettes.yaml +++ b/mods/d2k/rules/palettes.yaml @@ -35,9 +35,10 @@ Name: smoke3 Filename: DATA.R8 Frame: 3747 - D2kFogPalette@fog: + PaletteFromFile@fog: Name: fog - BasePalette: shroud + Filename: fog.pal + AllowModifiers: false PlayerColorPalette: BasePalette: d2k RemapIndex: 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240