View Issue Details

IDProjectCategoryView StatusLast Update
0003066FSSCPsoundpublic2022-06-11 00:46
ReporterAxem Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Fixed 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.

Activities

m_m

2014-06-20 09:07

developer   ~0015897

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

2014-09-19 21:19

developer   ~0016286

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_rotate(&sp,&snd_pnt,&Objects[obj_num].orient);
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

2022-06-10 17:12

developer   ~0017116

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

Issue History

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