mirror of
https://github.com/brues-code/TwitchEmotes.git
synced 2026-10-19 20:10:50 +00:00
Slow catJAM to its source speed, emit integer texcoords
The source emote is 158 frames at 25fps, a 6.32s loop; this sheet holds 60 of those frames but kept a framerate of 15, running the loop in 4.0s. A fractional rate would have matched it exactly, but the engine splits the |T payload on ':' and atoi's each field, so a coordinate carrying a decimal point truncates and crops the wrong rect - the emote renders as the whole sheet squeezed into its box. The animator now formats the payload with %d so the frame math can never leak a float into it, and the rate stays a whole number: 10fps, a 6.0s loop.
This commit is contained in:
@@ -40,11 +40,14 @@ local function CropToCurrentFrame(tex, animdata)
|
||||
top / animdata.imageHeight, bottom / animdata.imageHeight)
|
||||
end
|
||||
|
||||
-- The engine splits the payload on ':' and atoi's each field, so a coordinate
|
||||
-- carrying a decimal point silently truncates and crops the wrong rect (a
|
||||
-- fractional framerate is enough to leak one in). Format them as integers.
|
||||
local function BuildFrameString(imagepath, animdata, framenum, w, h)
|
||||
local left, right, top, bottom = GetFrameRect(animdata, framenum)
|
||||
return "|T" .. imagepath .. ":" .. w .. ":" .. h .. ":0:0:" ..
|
||||
animdata.imageWidth .. ":" .. animdata.imageHeight .. ":" ..
|
||||
left .. ":" .. right .. ":" .. top .. ":" .. bottom .. "|t"
|
||||
return ("|T%s:%d:%d:0:0:%d:%d:%d:%d:%d:%d|t"):format(imagepath, w, h,
|
||||
animdata.imageWidth, animdata.imageHeight,
|
||||
left, right, top, bottom)
|
||||
end
|
||||
|
||||
-- escape the pattern-magic chars that can appear in an emote escape (paths use
|
||||
|
||||
Reference in New Issue
Block a user