2021-04-17 08:25 EDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002542FSSCPmath-relatedpublic2019-12-14 13:01
Assigned ToGoober5000 
Product Version 
Target VersionFixed in Version 
Summary0002542: model_anim_get_time_type doesn't return correct value for triggered animations
DescriptionAfter triggering an animation, calls to ship:getAnimationDoneTime("scripted", 0) consistently return a garbage value as long as the animation plays.

I've tracked it down to model/modelanim.cpp:model_anim_get_time_type line 655 (note that line 650 is probably similarly affected, but the code just never goes there in my testcase), where a_time is consistently getting the value -2147483648 as long as the animation is playing.

I don't know if there's a problem with the math on that line, or whether the necessary animation data is not getting set for triggered animations somewhere else.

Unfortunately I have no portable complete testcase to provide. Below is a test script which displays timing information for a triggered animation on the player's ship; if you fly a ship with a triggered animation, you should see getAnimationDoneTime() returning a bogus value while the animation plays and the correct value (current time + the animation length) otherwise.

I haven't ruled out the possibility that this affects other animations than triggered ones, since model_anim_get_time_type the function is called from other places as well.
Additional Information;Note that this requires r7990, which fixes getAnimationDoneTime
;into returning the time in seconds as it should.

;You might also notice that when the animation is not playing,
;the value returned by getAnimationDoneTime progressively shrinks
;as the mission proceeds. This seems to be an unrelated issue.

#Conditional Hooks


$On Frame: [

    if hv.Player ~= nil and hv.Player:isValid() then
        gr.setColor(255, 255, 255)
        gr.drawString("Animation time remaining: " .. tostring(hv.Player:getAnimationDoneTime("scripted", 0) - mn.getMissionTime()), 300, 500)
        gr.drawString(" getAnimationDoneTime: " .. tostring(hv.Player:getAnimationDoneTime("scripted", 0)))
        gr.drawString(" getMissionTime: " .. tostring(mn.getMissionTime()))


TagsNo tags attached.
Attached Files




zookeeper (developer)

The patch posted at http://www.hard-light.net/forums/index.php?topic=79068.0 partially fixes the issue. If that is verified as working as advertised and gets committed, this report should probably be closed, as the remaining issues are a bit different.


Goober5000 (administrator)

See PR 2195:


Goober5000 (administrator)

The PR has been merged.

-Issue History
Date Modified Username Field Change
2011-11-14 05:35 zookeeper New Issue
2011-11-20 03:15 zookeeper Note Added: 0012983
2012-02-09 02:02 Goober5000 Assigned To => Goober5000
2012-02-09 02:02 Goober5000 Status new => assigned
2019-12-14 02:13 Goober5000 Note Added: 0016943
2019-12-14 13:01 Goober5000 Status assigned => resolved
2019-12-14 13:01 Goober5000 Resolution open => fixed
2019-12-14 13:01 Goober5000 Note Added: 0016944
+Issue History