Skip to content

Commit

Permalink
Update map drawing to the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Jul 24, 2024
1 parent cfae3e2 commit edc6a8a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions FogClear.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ function FogClear:MapExplorationPin_RefreshOverlays(pin, fullUpdate)
overlay:SetAlpha(1)
end

local mapID = pin:GetMap():GetMapID()
local mapCanvas = pin:GetMap()

local mapID = mapCanvas:GetMapID()
if not mapID then return end
local artID = C_Map.GetMapArtID(mapID)
if not artID or not FogData[artID] then return end
Expand All @@ -110,7 +112,7 @@ function FogClear:MapExplorationPin_RefreshOverlays(pin, fullUpdate)
end
end

pin.layerIndex = pin:GetMap():GetCanvasContainer():GetCurrentLayerIndex()
pin.layerIndex = mapCanvas:GetCanvasContainer():GetCurrentLayerIndex()
local layers = C_Map.GetMapArtLayers(mapID)
local layerInfo = layers and layers[pin.layerIndex]
if not layerInfo then return end
Expand All @@ -119,6 +121,8 @@ function FogClear:MapExplorationPin_RefreshOverlays(pin, fullUpdate)

local r, g, b, a = self:GetOverlayColor()

local drawLayer, subLevel = pin.dataProvider:GetDrawLayer()

for key, files in pairs(data) do
if not exploredTilesKeyed[key] then
local width, height, offsetX, offsetY = mod(floor(key / 2^39), 2^13), mod(floor(key / 2^26), 2^13), mod(floor(key / 2^13), 2^13), mod(key, 2^13)
Expand All @@ -142,6 +146,7 @@ function FogClear:MapExplorationPin_RefreshOverlays(pin, fullUpdate)
end
for k = 1, numTexturesWide do
local texture = pin.overlayTexturePool:Acquire()
mapCanvas:AddMaskableTexture(texture)
if ( k < numTexturesWide ) then
texturePixelWidth = TILE_SIZE_WIDTH
textureFileWidth = TILE_SIZE_WIDTH
Expand All @@ -163,7 +168,7 @@ function FogClear:MapExplorationPin_RefreshOverlays(pin, fullUpdate)

texture:SetVertexColor(r, g, b)
texture:SetAlpha(a)
texture:SetDrawLayer("ARTWORK", -1)
texture:SetDrawLayer(drawLayer, subLevel - 1)
texture:Show()

if fullUpdate then
Expand Down

0 comments on commit edc6a8a

Please sign in to comment.