diff --git a/C7/Game.cs b/C7/Game.cs index cea85ae4..163e6307 100644 --- a/C7/Game.cs +++ b/C7/Game.cs @@ -60,7 +60,7 @@ public class GotoInfo { private Vector2 OldPosition; Stopwatch loadTimer = new Stopwatch(); - GlobalSingleton Global; + public GlobalSingleton Global { get; private set; } [Export] private PopupOverlay popupOverlay; diff --git a/C7/Lua/texture_configs/civ3/resources.lua b/C7/Lua/texture_configs/civ3/resources.lua index d8e2392e..3b86935a 100644 --- a/C7/Lua/texture_configs/civ3/resources.lua +++ b/C7/Lua/texture_configs/civ3/resources.lua @@ -25,6 +25,27 @@ function resources.large:map_object_to_sprite(resource) } end +resources.shadows = { + extra_data = { + path = "Art/resources_shadows.pcx", + }, +} + +function resources.shadows:map_object_to_sprite(resource) + if resource:GetType().Name ~= "Resource" then + error "Expected a Resource object" + end + + local icon = resource.Icon + local row = math.floor(icon / 6) + local col = icon % 6 + + return { + path = self.extra_data.path, + crop_region = { col * RESOURCE_SIZE, row * RESOURCE_SIZE, RESOURCE_SIZE, RESOURCE_SIZE }, + } +end + resources.small = { extra_data = { path = "Art/city screen/luxuryicons_small.pcx", diff --git a/C7/Map/ResourceLayer.cs b/C7/Map/ResourceLayer.cs index b25ade08..a9d87547 100644 --- a/C7/Map/ResourceLayer.cs +++ b/C7/Map/ResourceLayer.cs @@ -19,8 +19,12 @@ public override void drawObject(LooseView looseView, GameData gameData, Tile til return; } - var texture = TextureLoader.Load("resources.large", resource, useCache: true); + if (!looseView.mapView.game.Global.ModernGraphicsActive) { + ImageTexture shadows = TextureLoader.Load("resources.shadows", resource, useCache: true); + looseView.DrawTexture(shadows, tileCenter - 0.5f * shadows.GetSize()); + } + ImageTexture texture = TextureLoader.Load("resources.large", resource, useCache: true); looseView.DrawTexture(texture, tileCenter - 0.5f * texture.GetSize()); } diff --git a/C7/Textures/PCXToGodot.cs b/C7/Textures/PCXToGodot.cs index 34dfdd10..ad178941 100644 --- a/C7/Textures/PCXToGodot.cs +++ b/C7/Textures/PCXToGodot.cs @@ -215,7 +215,9 @@ private static int[] loadPalette(byte[,] palette, ColorOptions colorOptions) { if (colorOptions.shadows) { for (int i = 240; i < 256; i++) { - ColorData[i] = ((MAX_COLOR - i) * 16) << ALPHA_BITSHIFT; + if (!colorOptions.transparentColorIndexes.Contains(i)) { + ColorData[i] = ((MAX_COLOR - i) * 16) << ALPHA_BITSHIFT; + } } }