Fix background positions with no desk inheriting the previous position's desk (#598)
* kill bglayer if file not exist * kill ALL layers if file not found
This commit is contained in:
		
							parent
							
								
									15c2aa32e6
								
							
						
					
					
						commit
						b2a4a41fd7
					
				@ -145,7 +145,8 @@ void BackgroundLayer::load_image(QString p_filename)
 | 
				
			|||||||
#ifdef DEBUG_MOVIE
 | 
					#ifdef DEBUG_MOVIE
 | 
				
			||||||
  qDebug() << "[BackgroundLayer] BG loaded: " << p_filename;
 | 
					  qDebug() << "[BackgroundLayer] BG loaded: " << p_filename;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  start_playback(ao_app->get_image_suffix(ao_app->get_background_path(p_filename)));
 | 
					  QString final_path = ao_app->get_image_suffix(ao_app->get_background_path(p_filename));
 | 
				
			||||||
 | 
					  start_playback(final_path);
 | 
				
			||||||
  play();
 | 
					  play();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -179,15 +180,16 @@ void CharLayer::load_image(QString p_filename, QString p_charname,
 | 
				
			|||||||
  last_emote = current_emote;
 | 
					  last_emote = current_emote;
 | 
				
			||||||
  last_prefix = prefix;
 | 
					  last_prefix = prefix;
 | 
				
			||||||
  is_preanim = p_is_preanim;
 | 
					  is_preanim = p_is_preanim;
 | 
				
			||||||
  if ((p_filename.left(3) == "(a)") || (p_filename.left(3) == "(b)")) {
 | 
					  if ((p_filename.left(3) == "(a)") || (p_filename.left(3) == "(b)")) { // if we are playing an idle or talking animation
 | 
				
			||||||
    prefix = p_filename.left(3);
 | 
					    prefix = p_filename.left(3); // separate the prefix from the emote name
 | 
				
			||||||
    current_emote = p_filename.mid(3, -1);
 | 
					    current_emote = p_filename.mid(3, -1);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else if ((duration > 0) || (p_filename.left(3) == "(c)")) {
 | 
					  else if ((duration > 0) || (p_filename.left(3) == "(c)")) { // else if we are playing a preanim or postanim
 | 
				
			||||||
    if (p_filename.left(3) == "(c)") {
 | 
					    if (p_filename.left(3) == "(c)") { // if we are playing a postanim
 | 
				
			||||||
      prefix = "(c)";
 | 
					      prefix = "(c)"; // separate the prefix from the emote name
 | 
				
			||||||
      current_emote = p_filename.mid(3, -1);
 | 
					      current_emote = p_filename.mid(3, -1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    // pre/postanim specific flags
 | 
				
			||||||
    is_preanim = true;
 | 
					    is_preanim = true;
 | 
				
			||||||
    play_once = true;
 | 
					    play_once = true;
 | 
				
			||||||
    preanim_timer->start(duration);
 | 
					    preanim_timer->start(duration);
 | 
				
			||||||
@ -197,7 +199,7 @@ void CharLayer::load_image(QString p_filename, QString p_charname,
 | 
				
			|||||||
           << current_emote << " from character: " << p_charname
 | 
					           << current_emote << " from character: " << p_charname
 | 
				
			||||||
           << " continuous: " << continuous;
 | 
					           << " continuous: " << continuous;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  QVector<VPath> pathlist {
 | 
					  QVector<VPath> pathlist { // cursed character path resolution vector
 | 
				
			||||||
      ao_app->get_character_path(
 | 
					      ao_app->get_character_path(
 | 
				
			||||||
          p_charname, prefix + current_emote), // Default path
 | 
					          p_charname, prefix + current_emote), // Default path
 | 
				
			||||||
      ao_app->get_character_path(
 | 
					      ao_app->get_character_path(
 | 
				
			||||||
@ -232,7 +234,7 @@ void EffectLayer::load_image(QString p_filename, bool p_looping)
 | 
				
			|||||||
    play_once = true;
 | 
					    play_once = true;
 | 
				
			||||||
  continuous = false;
 | 
					  continuous = false;
 | 
				
			||||||
  force_continuous = true;
 | 
					  force_continuous = true;
 | 
				
			||||||
  start_playback(p_filename); // handled in its own file before we see it
 | 
					  start_playback(p_filename); // path resolution is handled by the caller for EffectLayer objects
 | 
				
			||||||
  play();
 | 
					  play();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -269,6 +271,10 @@ void CharLayer::start_playback(QString p_image)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void AOLayer::start_playback(QString p_image)
 | 
					void AOLayer::start_playback(QString p_image)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  if (p_image == "") {// image wasn't found by the path resolution function
 | 
				
			||||||
 | 
					    this->kill();
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  QMutexLocker locker(&mutex);
 | 
					  QMutexLocker locker(&mutex);
 | 
				
			||||||
  if (frame_loader.isRunning())
 | 
					  if (frame_loader.isRunning())
 | 
				
			||||||
    exit_loop = true; // tell the loader to stop, we have a new image to load
 | 
					    exit_loop = true; // tell the loader to stop, we have a new image to load
 | 
				
			||||||
@ -315,8 +321,8 @@ void AOLayer::start_playback(QString p_image)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  frame_loader = QtConcurrent::run(this, &AOLayer::populate_vectors);
 | 
					  frame_loader = QtConcurrent::run(this, &AOLayer::populate_vectors);
 | 
				
			||||||
  last_path = p_image;
 | 
					  last_path = p_image;
 | 
				
			||||||
  while (movie_frames.size() <= frame)
 | 
					  while (movie_frames.size() <= frame) // if we haven't loaded the frame we need yet
 | 
				
			||||||
    frameAdded.wait(&mutex);
 | 
					    frameAdded.wait(&mutex); // wait for the frame loader to add another frame, then check again
 | 
				
			||||||
  this->set_frame(movie_frames[frame]);
 | 
					  this->set_frame(movie_frames[frame]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (max_frames <= 1) {
 | 
					  if (max_frames <= 1) {
 | 
				
			||||||
@ -534,7 +540,7 @@ void AOLayer::movie_ticker()
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  mutex.lock();
 | 
					  mutex.lock();
 | 
				
			||||||
  while (frame >= movie_frames.size() && frame < max_frames) { // oops! our frame isn't ready yet
 | 
					  while (frame >= movie_frames.size() && frame < max_frames) { // oops! our frame isn't ready yet
 | 
				
			||||||
      frameAdded.wait(&mutex);
 | 
					      frameAdded.wait(&mutex); // wait for a new frame to be added, then check again
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  mutex.unlock();
 | 
					  mutex.unlock();
 | 
				
			||||||
#ifdef DEBUG_MOVIE
 | 
					#ifdef DEBUG_MOVIE
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user