mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 16:30:15 +00:00
Fix vanilla M2 walk animation timestamp normalization
Vanilla M2 tracks store absolute timestamps in the flat array (e.g. 1000-2000ms) but the renderer plays animTime from 0 to duration. Normalize timestamps to 0-relative after slicing per-sequence ranges so findKeyframeIndex matches correctly.
This commit is contained in:
parent
22728b461f
commit
811a2a97a8
1 changed files with 9 additions and 1 deletions
|
|
@ -520,9 +520,17 @@ void parseAnimTrackVanilla(const std::vector<uint8_t>& data,
|
|||
if (start >= end || start >= disk.nTimestamps) continue;
|
||||
end = std::min(end, disk.nTimestamps);
|
||||
|
||||
// Copy timestamps for this sequence
|
||||
// Copy timestamps for this sequence, normalized to start at 0
|
||||
// (vanilla stores absolute timestamps in the flat array, but the
|
||||
// renderer expects 0-relative times matching sequence duration)
|
||||
track.sequences[i].timestamps.assign(
|
||||
allTimestamps.begin() + start, allTimestamps.begin() + end);
|
||||
if (!track.sequences[i].timestamps.empty()) {
|
||||
uint32_t firstTime = track.sequences[i].timestamps[0];
|
||||
for (auto& ts : track.sequences[i].timestamps) {
|
||||
ts -= firstTime;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy key values for this sequence
|
||||
if (start >= disk.nKeys) continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue