@@ -146,6 +146,7 @@ void BackgroundLayer::load_image(QString p_filename)
146146 qDebug () << " [BackgroundLayer] BG loaded: " << p_filename;
147147#endif
148148 start_playback (ao_app->get_image_suffix (ao_app->get_background_path (p_filename)));
149+ play ();
149150}
150151
151152void CharLayer::load_image (QString p_filename, QString p_charname,
@@ -189,7 +190,7 @@ void CharLayer::load_image(QString p_filename, QString p_charname,
189190 }
190191 is_preanim = true ;
191192 play_once = true ;
192- preanim_timer->start (duration * tick_ms );
193+ preanim_timer->start (duration);
193194 }
194195#ifdef DEBUG_MOVIE
195196 qDebug () << " [CharLayer] anim loaded: prefix " << prefix << " filename "
@@ -211,6 +212,7 @@ void CharLayer::load_image(QString p_filename, QString p_charname,
211212 ao_app->get_theme_path (
212213 " placeholder" , ao_app->default_theme )}; // Default theme placeholder path
213214 start_playback (ao_app->get_image_path (pathlist));
215+ play ();
214216}
215217
216218void SplashLayer::load_image (QString p_filename, QString p_charname,
@@ -219,6 +221,7 @@ void SplashLayer::load_image(QString p_filename, QString p_charname,
219221 transform_mode = ao_app->get_misc_scaling (p_miscname);
220222 QString final_image = ao_app->get_image (p_filename, ao_app->current_theme , ao_app->get_subtheme (), ao_app->default_theme , p_miscname, p_charname, " placeholder" );
221223 start_playback (final_image);
224+ play ();
222225}
223226
224227void EffectLayer::load_image (QString p_filename, bool p_looping)
@@ -230,13 +233,15 @@ void EffectLayer::load_image(QString p_filename, bool p_looping)
230233 continuous = false ;
231234 force_continuous = true ;
232235 start_playback (p_filename); // handled in its own file before we see it
236+ play ();
233237}
234238
235239void InterfaceLayer::load_image (QString p_filename, QString p_miscname)
236240{
237241 stretch = true ;
238242 QString final_image = ao_app->get_image (p_filename, ao_app->current_theme , ao_app->get_subtheme (), ao_app->default_theme , p_miscname);
239243 start_playback (final_image);
244+ play ();
240245}
241246
242247void StickerLayer::load_image (QString p_charname)
@@ -247,6 +252,7 @@ void StickerLayer::load_image(QString p_charname)
247252 transform_mode = ao_app->get_misc_scaling (p_miscname);
248253 QString final_image = ao_app->get_image (" sticker/" + p_charname, ao_app->current_theme , ao_app->get_subtheme (), ao_app->default_theme , p_miscname);
249254 start_playback (final_image);
255+ play ();
250256}
251257
252258void CharLayer::start_playback (QString p_image)
@@ -257,6 +263,7 @@ void CharLayer::start_playback(QString p_image)
257263 load_network_effects ();
258264 else // Use default ini FX
259265 load_effects ();
266+ play ();
260267}
261268
262269void AOLayer::start_playback (QString p_image)
@@ -275,7 +282,7 @@ void AOLayer::start_playback(QString p_image)
275282 actual_time.restart ();
276283#endif
277284 this ->clear ();
278- freeze ();
285+ this -> freeze ();
279286 movie_frames.clear ();
280287 movie_delays.clear ();
281288 QString scaling_override =
@@ -329,14 +336,12 @@ void AOLayer::start_playback(QString p_image)
329336 }
330337 else if (max_frames <= 1 ) {
331338 duration = static_duration;
332- play_once = false ;
333339#ifdef DEBUG_MOVIE
334340 qDebug () << " max_frames is <= 1, using static duration" ;
335341#endif
336342 }
337343 if (duration > 0 && cull_image == true )
338344 shfx_timer->start (duration);
339- play ();
340345#ifdef DEBUG_MOVIE
341346 qDebug () << max_frames << " Setting image to " << image_path
342347 << " Time taken to process image:" << actual_time.elapsed ();
@@ -347,15 +352,25 @@ void AOLayer::start_playback(QString p_image)
347352
348353void CharLayer::play ()
349354{
355+ if (max_frames <= 1 ) {
356+ if (play_once) {
357+ preanim_timer->start (qMax (0 , duration));
358+ }
359+ return ;
360+ }
350361 play_frame_effect (frame);
351362 AOLayer::play ();
352363}
353364
354365void AOLayer::play ()
355366{
356367 if (max_frames <= 1 ) {
357- if (play_once)
358- ticker->start (tick_ms);
368+ if (play_once) {
369+ if (duration > 0 )
370+ ticker->start (duration);
371+ else
372+ preanim_done ();
373+ }
359374 else
360375 this ->freeze ();
361376 }
0 commit comments