Sword trail parameters describe variables that can be used to change the way sword trails are calculated and drawn. Similar data structures exist for drawing beamsword trails, though the keyframe data is handled a bit differently in order to animate the length of the trail vertices.
For normal player sword trails, a silly ctr-based structure exists in both the draw/keyframe update functions and is responsible for designating where in the player entity default sword trail article data has been loaded. The list is keyed to the internal character index,
but only for the range that includes sword users.
The non-sword users included in this list will causes erroneous/inappropriate use of the C4 event to potentially read arbitrary data in place of a real structure; which may end up crashing if forced. With some small steps however, this routine can be exploited to read data from wherever; thereby allowing (in theory) for every character to have a “normal” sword trail so long it can be reliably pointed to during the course of each update.
The following absurd ctr-based pointer structure could feasibly be exploited to give a wide selection of characters default handles for these fake “normal” sword trail parameters; though without a bit of function surgery, this would exclude the 6 characters at the beginning of the internal character roster, as well as all boss/wireframe characters.
(if anyone’s interested, I have details on some tested methods of getting around this)
The point of this mess is to produce a pointer to a
formatted character-specific data structure that can be
handled by a single routine. This messy control structure exists in both the sword trail keyframe update and draw functions, where the resulting routine handles the keyframe/draw according to the provided parameters.
I’ve been calling this common data structure “
Sword Trail Parameters” and they are comprised of 2 tables used separately for each routine.
The game uses the pointer at
internal player data offset 0x2D4 to access these character-specific parameters for sword users after a player has been properly instantiated. My understanding is that Dantarion’s notes describe these as “
Article Floating Points.”
---
Inside of a player entity, vanilla sword trail parameters can be accessed like so:
Marth/Roy = internal player data offset
0x2D4 -> 0x78
Link/YLink = internal player data offset
0x2D4 -> 0x64
As proven effective by codes like
costume dependent marth sword trail colors, the functionally equivalent internal player data offsets seem to be:
0x2498 = Marth/Roy sword trail data
0x2484 = Link/Ylink sword trail data
-- These can be accessed via Achilles’s
custom character data modification subaction event.
The data is formatted like so:
-- For draw update --
0x00 - float - Trail End Taper Coefficient 1 (assumed to be % of player 0x20F8)
0x04 - float - Trail End Taper Coefficient 2 (assumed to be % of player 0x20FC)
0x08 - AOB[2] - Starting Alpha, Ending Alpha (opacity of trail from newest to oldest keyframe)
0x0A - AOB[3] - R1, G1, B1 (color channels for gradient color in vertex 1)
0x0E - AOB[3] - R2, G2, B2 (color channels for gradient color in vertex 2)
(bytes missing from this specification appear to be unparsed)
-- For keyframe update, non-beamsword only--
0x14 - word - Player Bone attachment (boneID)
0x18 - float - pole vertex 1 (used for 0x20F8 assignment in non-beamsword trails)
0x1C - float - pole vertex 2 (used for 0x20FC)