@@ -736,6 +736,7 @@ void main_hall_do(float frametime)
736736 Main_hall_misc_anim.at (idx).direction |= GENERIC_ANIM_DIRECTION_NOLOOP;
737737 }
738738
739+ // TODO: generic_anim_skip_to(cur_frame, anim_time);
739740 Main_hall_misc_anim.at (idx).current_frame = cur_frame;
740741 Main_hall_misc_anim.at (idx).anim_time = anim_time;
741742
@@ -764,6 +765,7 @@ void main_hall_do(float frametime)
764765 Main_hall_door_anim.at (idx).direction = GENERIC_ANIM_DIRECTION_BACKWARDS | GENERIC_ANIM_DIRECTION_NOLOOP;
765766 }
766767
768+ // TODO: generic_anim_skip_to(cur_frame, anim_time);
767769 Main_hall_door_anim.at (idx).current_frame = cur_frame;
768770 Main_hall_door_anim.at (idx).anim_time = anim_time;
769771
@@ -1251,8 +1253,7 @@ void main_hall_render_misc_anims(float frametime, bool over_doors)
12511253 // if the timestamp is not -1 and has popped, play the anim and make the timestamp -1
12521254 } else if (timestamp_elapsed (Main_hall->misc_anim_delay .at (idx).at (0 ))) {
12531255 Main_hall->misc_anim_paused .at (idx) = false ;
1254- Main_hall_misc_anim.at (idx).current_frame = 0 ;
1255- Main_hall_misc_anim.at (idx).anim_time = 0.0 ;
1256+ generic_anim_reset (&Main_hall_misc_anim.at (idx));
12561257
12571258 // kill the timestamp
12581259 Main_hall->misc_anim_delay .at (idx).at (0 ) = -1 ;
@@ -1417,12 +1418,14 @@ void main_hall_mouse_release_region(int region)
14171418 sound_pair->second = snd_play (sound_pair->first , Main_hall->door_sound_pan .at (region));
14181419 }
14191420
1420- // TODO: track current frame
1421- snd_set_pos (sound_pair->second ,
1422- (float ) ((Main_hall_door_anim.at (region).keyframe ) ? Main_hall_door_anim.at (region).keyframe :
1423- Main_hall_door_anim.at (region).num_frames - Main_hall_door_anim.at (region).current_frame )
1424- / (float ) Main_hall_door_anim.at (region).num_frames ,
1425- 1 );
1421+ // start the sound playing at the right spot relative to the completion of the animation
1422+ if ( Main_hall_door_anim.at (region).current_frame != -1 ) {
1423+ snd_set_pos (sound_pair->second ,
1424+ (float ) ((Main_hall_door_anim.at (region).keyframe ) ? Main_hall_door_anim.at (region).keyframe :
1425+ Main_hall_door_anim.at (region).num_frames - Main_hall_door_anim.at (region).current_frame )
1426+ / (float ) Main_hall_door_anim.at (region).num_frames ,
1427+ 1 );
1428+ }
14261429 }
14271430}
14281431
0 commit comments