Skip to content

Commit c1e40f0

Browse files
Merge branch 'fix/aolayer-crap' into 2.9.1-ea
2 parents 60dae51 + 8d9331a commit c1e40f0

5 files changed

Lines changed: 31 additions & 48 deletions

File tree

include/aoapplication.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,6 @@ class AOApplication : public QApplication {
378378
// Returns the preanim duration of p_char's p_emote
379379
int get_preanim_duration(QString p_char, QString p_emote);
380380

381-
// Same as above, but only returns if it has a % in front(refer to Preanims
382-
// section in the manual)
383-
int get_ao2_preanim_duration(QString p_char, QString p_emote);
384-
385381
// Not in use
386382
int get_text_delay(QString p_char, QString p_emote);
387383

include/aolayer.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ class AOLayer : public QLabel {
104104

105105
QElapsedTimer actual_time;
106106

107-
// Usually used to turn seconds into milliseconds such as for [Time] tag in
108-
// char.ini (which is no longer used)
109-
const int tick_ms = 60;
110-
111107
// These are the X and Y values before they are fixed based on the sprite's
112108
// width.
113109
int x = 0;

src/aolayer.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

151152
void 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

216218
void 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

224227
void EffectLayer::load_image(QString p_filename, bool p_looping)
@@ -230,13 +233,16 @@ 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

235239
void InterfaceLayer::load_image(QString p_filename, QString p_miscname)
236240
{
241+
last_path = "";
237242
stretch = true;
238243
QString final_image = ao_app->get_image(p_filename, ao_app->current_theme, ao_app->get_subtheme(), ao_app->default_theme, p_miscname);
239244
start_playback(final_image);
245+
play();
240246
}
241247

242248
void StickerLayer::load_image(QString p_charname)
@@ -247,6 +253,7 @@ void StickerLayer::load_image(QString p_charname)
247253
transform_mode = ao_app->get_misc_scaling(p_miscname);
248254
QString final_image = ao_app->get_image("sticker/" + p_charname, ao_app->current_theme, ao_app->get_subtheme(), ao_app->default_theme, p_miscname);
249255
start_playback(final_image);
256+
play();
250257
}
251258

252259
void CharLayer::start_playback(QString p_image)
@@ -257,6 +264,7 @@ void CharLayer::start_playback(QString p_image)
257264
load_network_effects();
258265
else // Use default ini FX
259266
load_effects();
267+
play();
260268
}
261269

262270
void AOLayer::start_playback(QString p_image)
@@ -275,7 +283,7 @@ void AOLayer::start_playback(QString p_image)
275283
actual_time.restart();
276284
#endif
277285
this->clear();
278-
freeze();
286+
this->freeze();
279287
movie_frames.clear();
280288
movie_delays.clear();
281289
QString scaling_override =
@@ -329,14 +337,12 @@ void AOLayer::start_playback(QString p_image)
329337
}
330338
else if (max_frames <= 1) {
331339
duration = static_duration;
332-
play_once = false;
333340
#ifdef DEBUG_MOVIE
334341
qDebug() << "max_frames is <= 1, using static duration";
335342
#endif
336343
}
337344
if (duration > 0 && cull_image == true)
338345
shfx_timer->start(duration);
339-
play();
340346
#ifdef DEBUG_MOVIE
341347
qDebug() << max_frames << "Setting image to " << image_path
342348
<< "Time taken to process image:" << actual_time.elapsed();
@@ -347,15 +353,25 @@ void AOLayer::start_playback(QString p_image)
347353

348354
void CharLayer::play()
349355
{
356+
if (max_frames <= 1) {
357+
if (play_once) {
358+
preanim_timer->start(qMax(0, duration));
359+
}
360+
return;
361+
}
350362
play_frame_effect(frame);
351363
AOLayer::play();
352364
}
353365

354366
void AOLayer::play()
355367
{
356368
if (max_frames <= 1) {
357-
if (play_once)
358-
ticker->start(tick_ms);
369+
if (play_once) {
370+
if (duration > 0)
371+
ticker->start(duration);
372+
else
373+
preanim_done();
374+
}
359375
else
360376
this->freeze();
361377
}

src/courtroom.cpp

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,17 +3220,10 @@ void Courtroom::play_preanim(bool immediate)
32203220
QString f_preanim = m_chatmessage[PRE_EMOTE];
32213221
// all time values in char.inis are multiplied by a constant(time_mod) to get
32223222
// the actual time
3223-
int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim);
3223+
int preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim);
32243224
int stay_time = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
32253225
int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * time_mod;
32263226

3227-
int preanim_duration;
3228-
3229-
if (ao2_duration < 0)
3230-
preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim);
3231-
else
3232-
preanim_duration = ao2_duration;
3233-
32343227
sfx_delay_timer->start(sfx_delay);
32353228
QString anim_to_find =
32363229
ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim));
@@ -3243,15 +3236,6 @@ void Courtroom::play_preanim(bool immediate)
32433236
qDebug() << "W: could not find " + anim_to_find;
32443237
return;
32453238
}
3246-
else {
3247-
QImageReader s_reader(anim_to_find);
3248-
int image_count = s_reader.imageCount();
3249-
if (image_count <= 1) {
3250-
preanim_done();
3251-
qDebug() << "W: tried to play static preanim " + anim_to_find;
3252-
return;
3253-
}
3254-
}
32553239
ui_vp_player_char->set_static_duration(preanim_duration);
32563240
ui_vp_player_char->set_play_once(true);
32573241
ui_vp_player_char->load_image(f_preanim, f_char, preanim_duration, true);
@@ -3273,16 +3257,15 @@ void Courtroom::play_preanim(bool immediate)
32733257
break;
32743258
}
32753259

3276-
if (immediate)
3260+
if (immediate) {
32773261
anim_state = 4;
3278-
else
3279-
anim_state = 1;
3280-
3281-
if (stay_time >= 0)
3282-
text_delay_timer->start(stay_time);
3283-
3284-
if (immediate)
32853262
handle_ic_speaking();
3263+
}
3264+
else {
3265+
anim_state = 1;
3266+
if (stay_time >= 0)
3267+
text_delay_timer->start(stay_time);
3268+
}
32863269
}
32873270

32883271
void Courtroom::preanim_done()
@@ -3314,6 +3297,7 @@ void Courtroom::preanim_done()
33143297

33153298
void Courtroom::start_chat_ticking()
33163299
{
3300+
text_delay_timer->stop();
33173301
// we need to ensure that the text isn't already ticking because this function
33183302
// can be called by two logic paths
33193303
if (text_state != 0)

src/text_file_functions.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,6 @@ int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
672672
return f_result.toInt();
673673
}
674674

675-
int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
676-
{
677-
QString f_result = read_char_ini(p_char, "%" + p_emote, "Time");
678-
679-
if (f_result == "")
680-
return -1;
681-
return f_result.toInt();
682-
}
683-
684675
int AOApplication::get_emote_number(QString p_char)
685676
{
686677
QString f_result = read_char_ini(p_char, "number", "Emotions");

0 commit comments

Comments
 (0)