Fix TurtleWoW baked NPC atlases (append .blp) plus in-progress GFX work: moonlight, torch depth, water/scene-depth, skybox
This commit is contained in:
@@ -286,14 +286,75 @@ __benilla_game_hour = 0
|
||||
__benilla_game_minute = 0
|
||||
function GetGameTime() return __benilla_game_hour, __benilla_game_minute end
|
||||
|
||||
-- ── NOT here: wipe / tostringall / strsplit / strjoin / strconcat / strtrim ────────────────────
|
||||
-- Six 2.0+ names benilla used to define. 1.12 has none of them (absent from
|
||||
-- `reference/1.12-globals.tsv`, from the stock chain, and from every registrar table), and the
|
||||
-- reason they were kept — that the vanilla addon ecosystem assumes them — did not survive being
|
||||
-- checked: the corpus callers are multi-client addons whose vanilla paths raise on a real 1.12
|
||||
-- client too, or that define the name themselves under their own namespace.
|
||||
-- An addon reaching for one of these is reaching for a later client's API, and it should find
|
||||
-- what it would find there: nothing.
|
||||
-- ── Beyond 1.12: wipe / strsplit / strjoin / trim ─────────────────────────────────────────────
|
||||
-- Four names 1.12 does NOT have: absent from `reference/1.12-globals.tsv`, absent from the stock
|
||||
-- chain (no stock `Interface\FrameXML` file calls any of them — `UIParent.lua`, `ChatFrame.lua`,
|
||||
-- `MainMenuBar.lua` and `FriendsFrame.lua` read clean), and absent from every registrar table. They
|
||||
-- are here anyway because a MODIFIED 1.12 UI ships them: TurtleWoW's `patch-4.mpq` replaces
|
||||
-- `UIParent.lua` with a longer 2.0-era file whose `UIFrameFade_CreateInfo` calls `wipe(frame.fadeInfo)`
|
||||
-- at line 1420, and replaces `FriendsFrame.lua` with one whose guild-roster filter calls
|
||||
-- `trim(strlower(GuildFrameSearchBox:GetText()))` at line 490. Each raises
|
||||
-- `attempt to call global '<name>' (a nil value)` and takes the whole UI down with it. The exception
|
||||
-- list in `tests/reference_surface.rs` carries the same reason.
|
||||
--
|
||||
-- `trim` is not Blizzard's name at all — 1.12 has no `strtrim` either. It is TurtleWoW's own, for
|
||||
-- `strtrim` semantics: every caller defines it identically as `gsub(str, "^%s*(.-)%s*$", "%1")`
|
||||
-- (aux-addon's `util.lua`, ShaguDPS's `parser.lua`), which is the shape transcribed here.
|
||||
--
|
||||
-- This is a deviation from the reference, kept because 1.12's own UI cannot load without it. The
|
||||
-- shapes are 2.0's, not 1.12's, and each is scoped to what the reference-corpus callers use:
|
||||
-- `wipe` is single-argument (no corpus caller passes a key), and `strsplit` splits on PLAIN text.
|
||||
do
|
||||
local _find, _sub, _insert, _concat = string.find, string.sub, table.insert, table.concat
|
||||
local _gsub = string.gsub
|
||||
|
||||
function wipe(t)
|
||||
for k in pairs(t) do t[k] = nil end
|
||||
end
|
||||
|
||||
function strsplit(delimiter, subject)
|
||||
-- 5.0's `find` answers an empty plain pattern as `(from, from - 1)`, a zero-width match that
|
||||
-- never advances `from`; looping on it fills the table until it overflows. There is nothing
|
||||
-- to split on, so the subject comes back whole — the one shape a plain find cannot produce.
|
||||
if delimiter == "" then return subject end
|
||||
local result = {}
|
||||
local from = 1
|
||||
local dfrom, dto = _find(subject, delimiter, from, true)
|
||||
while dfrom do
|
||||
_insert(result, _sub(subject, from, dfrom - 1))
|
||||
from = dto + 1
|
||||
dfrom, dto = _find(subject, delimiter, from, true)
|
||||
end
|
||||
_insert(result, _sub(subject, from))
|
||||
return unpack(result)
|
||||
end
|
||||
|
||||
-- `...` reads as an EXPRESSION nowhere in 5.0 (`lua50` deletes that `simpleexp` arm), so
|
||||
-- `strjoin` takes its arguments out of `arg`, which holds the VARARGS alone — 5.0's rule, and
|
||||
-- `function(a, ...)` called with three answers `arg.n == 2`. The named `delimiter` is not in it.
|
||||
function strjoin(delimiter, ...)
|
||||
local out = {}
|
||||
local n = arg.n
|
||||
for i = 1, n do
|
||||
out[i] = arg[i]
|
||||
end
|
||||
return _concat(out, delimiter)
|
||||
end
|
||||
|
||||
-- `(.-)` is lazy, so the trailing `%s*` consumes to the LAST space and the leading one to the
|
||||
-- first: both ends go, interior spacing stays. Only `%s` counts as space, as in every caller.
|
||||
function trim(str)
|
||||
local trimmed = _gsub(str, "^%s*(.-)%s*$", "%1")
|
||||
return trimmed
|
||||
end
|
||||
end
|
||||
|
||||
-- ── NOT here: tostringall / strconcat / strtrim ────────────────────────────────────────────────
|
||||
-- Three more 2.0+ names benilla used to define, kept out for the reason the four above were:
|
||||
-- 1.12 has none of them, and no modified-1.12 UI ships a caller that needs them. The corpus
|
||||
-- callers are multi-client addons whose vanilla paths raise on a real 1.12 client too, or that
|
||||
-- define the name themselves under their own namespace. An addon reaching for one of these is
|
||||
-- reaching for a later client's API, and it should find what it would find there: nothing.
|
||||
|
||||
-- ── Blizzard's positional string.format (%N$) ──────────────────────────────────────────────────
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user