Effect trails (tale01; element update and draw object in PDUWP.exe)
Decoded from the element update
alfn_FunctionTALE01 (0x140112560)
and the draw object it creates (0xB0 bytes,
vtable 0x14047a180: init 0x1401a9e10, free
0x1401a9f70, per-frame draw 0x1401a9fa0 =
pdEftTale03, which calls the extend
step 0x1401aa670, the cut-back step 0x1401ab520
and, on its first tick, the start 0x1401aa2e0).
Fields (S = raw_m[2], K =
raw_m[3]):
- Window and weight. The
update runs for start ≤ frame ≤ end. Its weight
w over t = frame − start and L = end − start + 1
uses curve int(
raw_f[8]): 0 → t / L, 1 → t(t + 1) / (L(L + 1)), 2 → t(2L − t + 1) / (L(L + 1)). - Trail frame. Each tick it
builds a local matrix: a turn about local Z by
int(w ×
raw_m[11]) degrees (the 15-bit angle table, 0x140290800), translated by (raw_m[8],raw_m[9],raw_m[10]) turned by it, then multiplied by the element’s world matrix. The result is the newest of S + 1 history matrices. It also re-arms a countdown to S. - Rails. The draw object
holds two vertex buffers of S·K + 1 point pairs
(20-byte vertices: position, BGRA color, two
16-bit normalized UV halves). Ribbon A runs from
local (0, +
raw_m[1], 0) to (0, −raw_m[1], 0), ribbon B from (−raw_m[0], 0, 0) to (+raw_m[0], 0, 0) (game units): two crossed ribbons. The start step sets every point and history matrix to the current frame. - Extend (countdown = S, from the second tick on). The points move back by K (point k takes point k − K). The K head points are D3DX Catmull-Rom (0x14001b560) through (2·C0 − C1, C0, C1, C2) at t = i / K, where Ci is the rail point in history matrix i. That goes from the newest position towards the previous one. Then the history shifts by one.
- Cut back (after the window). The countdown falls by one per tick. While it is between 0 and S, the points still move back by K, but the draw start moves forward by K, so the tail shrinks by one segment per tick and the head stays put. At 0 nothing is drawn and the next start re-initialises.
- Draw. Two triangle strips
(topology 5), (n − 1)·K − start quads each, with
n = ticks recorded (at most S + 1). Culling is
off (restored to counter-clockwise after). The
draw sets its own blend: it calls the blend
setter 0x14028e4e0 with the fixed mode word
0x1101, and that setter always turns blending on
before it sets source (bits 8-11), destination
(12-15) and op (5-7) from the word, so every
trail is drawn one / one, add,
whatever its material’s blend bit and mode say.
The material gives the texture only. The vertex
color is fixed at init to 0xFF808080 (0.5 grey,
opaque). The update writes (1, 1, 1, 1) to the
VS color constant c33: the element’s two
colors are not read. UV: across = 1 / 0
(0x7FFF / 0 in the first half, taken as SNORM),
along = point index / point count, plus the VS
offset c34 = (w ×
raw_m[6], w ×raw_m[7]). - Shaders.
Tale01V: clip = position × cPROJEC (c20..c23), color = vertex color × c33, UV + c34.Tale01P: texture × clamp(color, −1, 1). Alpha-test againstmisc_constant.x; alpha-kill on zero alpha whenalphakill.xis set. - Not used by the draw:
raw_f[6]and w ×raw_f[7]are stored as 15-bit angles (+0xA0 / +0xA4);raw_m[14]×raw_m[15]sizes an allocation at 0x1401cbbc0. None of the four trail functions reads them.