mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-16 18:00:48 +00:00
Utilizing ClassicAPI 1.6.0
commit d63057474083aa67fda2aa28ee6301334ffc4fdf Author: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon Jul 6 00:59:17 2026 -0500 Use C_Map.GetMapOverlays instead of hardcoded pfMapOverlayData ClassicAPI's C_Map.GetMapOverlays reads WorldMapOverlay.dbc directly and returns the full overlay list for a zone (explored + unexplored) — the data vanilla's GetMapOverlayInfo withholds. mapreveal now iterates it straight (named fields: textureName/texturePath/width/height/offsets), dropping unpack_hash and the pfMapOverlayData tables entirely. Also fixes the explored-check: it compared the full texture path against GetMapOverlayInfo's bare-name keys, so the magnifying glass never suppressed on explored overlays. Now matches on the bare name. Removes ~870 lines of hand-measured overlay data (base + Turtle). commit ad12c8209a80cd1211fe08e83f7013d24b5efd2d Author: Brues <5278969+brues-code@users.noreply.github.com> Date: Sun Jul 5 23:45:09 2026 -0500 utilize HookScript from ClassicAPI
This commit is contained in:
+33
-70
@@ -30,25 +30,6 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
pfUI.mapreveal:UpdateConfig()
|
||||
end)
|
||||
|
||||
local function unpack_hash(prefix, hash)
|
||||
local _, stored_prefix, textureName, textureWidth, textureHeight, offsetX, offsetY, mapPointX, mapPointY, name
|
||||
_, _, stored_prefix, textureName, textureWidth, textureHeight, offsetX, offsetY = string.find(hash, "^([|]?)([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)")
|
||||
if (not textureName or not offsetY) then
|
||||
return
|
||||
end
|
||||
if (offsetY) then
|
||||
_, _, mapPointX, mapPointY = string.find(hash,"^[|]?[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:([^:]+):([^:]+)")
|
||||
end
|
||||
if (not mapPointY) then
|
||||
mapPointX = 0 mapPointY = 0
|
||||
end
|
||||
if (stored_prefix ~= "|") then
|
||||
name = textureName
|
||||
textureName = string.format("%s%s",prefix,textureName)
|
||||
end
|
||||
return textureName, textureWidth + 0, textureHeight + 0, offsetX + 0, offsetY + 0, mapPointX + 0, mapPointY + 0, name
|
||||
end
|
||||
|
||||
local explores = {}
|
||||
local explorecaches = {}
|
||||
local alreadyknown = {} -- per-zone accumulator: { [zone] = { [texName] = true } }
|
||||
@@ -88,13 +69,6 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- overlay data with lazy init
|
||||
local overlayData = setmetatable(pfMapOverlayData, {__index = function(t,k)
|
||||
local v = {}
|
||||
rawset(t,k,v)
|
||||
return v
|
||||
end})
|
||||
|
||||
local function pfWorldMapFrame_Update()
|
||||
-- clear stale caches
|
||||
for k in pairs(explorecaches) do explorecaches[k] = nil end
|
||||
@@ -108,7 +82,6 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
local mapFileName = GetMapInfo()
|
||||
if not mapFileName then mapFileName = "World" end
|
||||
|
||||
local prefix = string.format("Interface\\WorldMap\\%s\\", mapFileName)
|
||||
local numOverlays = GetNumMapOverlays()
|
||||
|
||||
-- accumulate explored overlays per zone (never clear, only add)
|
||||
@@ -123,12 +96,18 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
-- hide explore icons
|
||||
for _, frame in pairs(explores) do frame:Hide() end
|
||||
|
||||
local zoneData = overlayData[mapFileName]
|
||||
-- ClassicAPI: full overlay list for the viewed zone (explored + unexplored),
|
||||
-- read straight from WorldMapOverlay.dbc. Replaces the hand-measured pfMapOverlayData.
|
||||
local zoneData = C_Map.GetMapOverlays() or {}
|
||||
local textureCount = 0
|
||||
|
||||
for i, hash in ipairs(zoneData) do
|
||||
local textureName, textureWidth, textureHeight, offsetX, offsetY, mapPointX, mapPointY, name = unpack_hash(prefix, hash)
|
||||
if not textureName then break end
|
||||
for i, overlay in ipairs(zoneData) do
|
||||
local name = overlay.textureName -- bare, e.g. "DRYGULCHRAVINE"
|
||||
local textureName = overlay.texturePath -- full engine path (for SetTexture)
|
||||
local textureWidth = overlay.textureWidth
|
||||
local textureHeight = overlay.textureHeight
|
||||
local offsetX = overlay.offsetX
|
||||
local offsetY = overlay.offsetY
|
||||
|
||||
-- explore magnifying glass icon
|
||||
explores[i] = explores[i] or CreateFrame("Frame", nil, WorldMapDetailFrame)
|
||||
@@ -146,6 +125,8 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
explore.tex:SetTexCoord(.08, .92, .08, .92)
|
||||
explore.tex:SetAllPoints()
|
||||
|
||||
-- `alreadyknown` stores the FULL paths GetMapOverlayInfo returns,
|
||||
-- so compare with the full path, not the bare name.
|
||||
if C.appearance.worldmap.mapexploration == "1" and not zoneKnown[string.upper(textureName)] then
|
||||
explore.tex:SetTexture("Interface\\WorldMap\\WorldMap-MagnifyingGlass")
|
||||
explore:Show()
|
||||
@@ -155,49 +136,31 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
|
||||
-- render overlay texture tiles on BORDER draw layer
|
||||
-- Blizzard's explored overlays on ARTWORK draw on top of BORDER
|
||||
--
|
||||
-- overlay.tiles is pre-resolved by ClassicAPI: per-tile file /
|
||||
-- draw size / texcoords / canvas position, with Octo's data
|
||||
-- quirks (sliver columns the DBC rect rounds away, foreign tiles
|
||||
-- appended to the number sequence, upscaled re-exports) already
|
||||
-- disambiguated from the actual BLP dimensions. No 256px grid
|
||||
-- math here — deriving the grid from textureWidth/Height is
|
||||
-- exactly what shears quirky overlays (e.g. Icepoint's Kaneq'nuun).
|
||||
if C.appearance.worldmap.mapreveal == "1" then
|
||||
local numH = math.ceil(textureWidth / 256)
|
||||
local numV = math.ceil(textureHeight / 256)
|
||||
local texPixW, texFileW, texPixH, texFileH
|
||||
for _, tile in ipairs(overlay.tiles) do
|
||||
textureCount = textureCount + 1
|
||||
local tex = pfGetOverlay(textureCount)
|
||||
|
||||
for j = 1, numV do
|
||||
if j < numV then
|
||||
texPixH = 256
|
||||
texFileH = 256
|
||||
else
|
||||
texPixH = mod(textureHeight, 256)
|
||||
if texPixH == 0 then texPixH = 256 end
|
||||
texFileH = 16
|
||||
while texFileH < texPixH do texFileH = texFileH * 2 end
|
||||
end
|
||||
tex:SetWidth(tile.width)
|
||||
tex:SetHeight(tile.height)
|
||||
tex:SetTexCoord(0, tile.texCoordX, 0, tile.texCoordY)
|
||||
tex:ClearAllPoints()
|
||||
tex:SetPoint("TOPLEFT", "WorldMapDetailFrame", "TOPLEFT", tile.offsetX, -tile.offsetY)
|
||||
tex:SetTexture(tile.file)
|
||||
|
||||
for k = 1, numH do
|
||||
textureCount = textureCount + 1
|
||||
local tex = pfGetOverlay(textureCount)
|
||||
explorecaches[name] = explorecaches[name] or {}
|
||||
explorecaches[name][tex] = true
|
||||
|
||||
if k < numH then
|
||||
texPixW = 256
|
||||
texFileW = 256
|
||||
else
|
||||
texPixW = mod(textureWidth, 256)
|
||||
if texPixW == 0 then texPixW = 256 end
|
||||
texFileW = 16
|
||||
while texFileW < texPixW do texFileW = texFileW * 2 end
|
||||
end
|
||||
|
||||
tex:SetWidth(texPixW)
|
||||
tex:SetHeight(texPixH)
|
||||
tex:SetTexCoord(0, texPixW/texFileW, 0, texPixH/texFileH)
|
||||
tex:ClearAllPoints()
|
||||
tex:SetPoint("TOPLEFT", "WorldMapDetailFrame", "TOPLEFT", offsetX + 256*(k-1), -(offsetY + 256*(j-1)))
|
||||
tex:SetTexture(string.format("%s%s", textureName, ((j-1)*numH + k)))
|
||||
|
||||
explorecaches[name] = explorecaches[name] or {}
|
||||
explorecaches[name][tex] = true
|
||||
|
||||
tex:SetVertexColor(r,g,b,a)
|
||||
tex:Show()
|
||||
end
|
||||
tex:SetVertexColor(r,g,b,a)
|
||||
tex:Show()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user