2022-08-09 17:48 EDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003066FSSCPsoundpublic2022-06-10 20:46
Assigned To 
Product Version 
Target VersionFixed in Version22.0.0 
Summary0003066: Triggered animation sounds don't appear to work
DescriptionThe $Sound: fields don't appear to be working correctly for triggered animations. See below for a test mod. Happens even if the sound references are retail indexes.
Steps To Reproducehttp://www.mediafire.com/download/oy65aa918ibnndw/CainTest10.rar

Play test mod, Press 1 to make the Cain move its arms and fire. Sounds should play when its arms begin and finish moving.
TagsNo tags attached.
Attached Files




m_m (developer)

This is weird, apparently playing sounds was never actually implemented and I have no idea where to actually implement it as the animation code is terribly complicated.


MageKing17 (developer)

I was taking another look at this today, and I thought I'd write down my findings so somebody else doesn't have to re-...research the wheel.

When animation.cpp was moved to modelanim.cpp, the following (commented out) lines were present in triggered_rotation::start():

vec3d sp;
vm_vec_add2(&sp, &Objects[obj_num].pos);
if(q->start_sound != -1)current_snd = snd_play_3d(&Snds[q->start_sound], &sp, &View_position, q->snd_rad) ;

(r3045, lines 207-210 if you want to look at the original.)
This code can't be used as the basis of a proper implementation of animation sounds for two reasons: one, snd_pnt does not exist. Two, obj_num is never set to anything but a default value of -1 (making one wonder why it's present at all).

Assuming someone can figure out the problem of figuring out the worldspace coordinates the sound should be coming from, the next hurdle is figuring out when the sounds should play. triggered_rotation::start() is a good place to fire off start_sound and begin playing loop_sound, and model_anim_submodel_trigger_rotate() would be a good place to update the position of loop_sound. It's also where animations appear to end (lines 499-502), although it doesn't seem like that is sufficient in and of itself... then again, it may be due to the counter-intuitive way in which triggered_rotation objects get reused. It's also worth noting that "instant" animations skip triggered_rotation::start(), so playing start_sound should also probably happen around lines 584-589.

Personally, I think triggered_rotation needs a couple of extra methods (like, say, ::end() and perhaps ::update()); triggered_rotation::end() could incorporate lines 500-501 as well as playing end_sound and stopping loop_sound, while triggered_rotation::update() could be limited to updating the 3D position of the loop_sound, or perhaps take the bulk of of the triggered_rotation-based logic in model_anim_submodel_trigger_rotate().

In hindsight, modelanim.cpp probably needs significant refactoring to fix this issue properly.


z64555 (developer)

Mostly resolved, probably by https://github.com/scp-fs2open/fs2open.github.com/pull/3793

-Issue History
Date Modified Username Field Change
2014-06-19 16:24 Axem New Issue
2014-06-20 04:37 m_m Assigned To => m_m
2014-06-20 04:37 m_m Status new => assigned
2014-06-20 05:07 m_m Note Added: 0015897
2014-09-19 17:19 MageKing17 Note Added: 0016286
2022-06-10 13:12 z64555 Assigned To m_m =>
2022-06-10 13:12 z64555 Status assigned => closed
2022-06-10 13:12 z64555 Resolution open => fixed
2022-06-10 13:12 z64555 Fixed in Version => 22.0.0
2022-06-10 13:12 z64555 Note Added: 0017116
2022-06-10 20:46 Goober5000 Status closed => resolved
+Issue History