|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0003066||FSSCP||sound||public||2014-06-19 16:24||2014-09-19 17:19|
|Target Version||Fixed in Version|
|Summary||0003066: Triggered animation sounds don't appear to work|
|Description||The $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 Reproduce||http://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.
|Tags||No tags attached.|
|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.|
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():
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.
|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|