int Active::get_animation(int value) { value = std::min(value, animations->count - 1); if (has_animation(value)) return value; value = std::max(0, value); for (int i = 0; i < 3; i++) { int alias = animation_alias[i + value * 3]; if (alias == -1 || !has_animation(alias)) break; return alias; } for (value = 0; value < animations->count; value++) { if (has_animation(value)) break; } return value; }
/** * \brief Returns an animation. * \param animation_name Name of the animation to get. * \return The specified animation. */ SpriteAnimation& SpriteAnimationSet::get_animation( const std::string& animation_name) { Debug::check_assertion(has_animation(animation_name), std::string("No animation '") + animation_name + "' in animation set '" + id + "'" ); return animations.find(animation_name)->second; }
void Active::destroy() { if (flags & FADEOUT) return; bool has_anim = has_animation(DISAPPEARING); if (!has_anim && fade_duration == 0.0f) { FrameObject::destroy(); return; } clear_movements(); if (has_anim) { if (forced_animation != DISAPPEARING) { restore_animation(); force_animation(DISAPPEARING); } if (loop_count == -1) loop_count = 1; } else { fade_time = fade_duration; } flags |= FADEOUT | DISABLE_COL; }
aiNodeAnim const & node_animation_t::ai_animation() const { if (!has_animation()) throw std::runtime_error("no animation data for node"); return *animation_; }