Skip to content

Commit

Permalink
Fix bug #21316: make subframes within standing animations cycle by de…
Browse files Browse the repository at this point in the history
…fault
  • Loading branch information
Coffee-- committed Apr 21, 2014
1 parent 7267cd9 commit 376accf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -68,6 +68,7 @@ Version 1.11.12+dev:
* Fix GUI2 borders around selected elements
* Fix bug #21931: controllers bugged in (basic campaign) when networked
* Fix bug #21883: make sure movement animations don't cycle with fog on
* Fix bug #21316: make subframes within standing animations cycle by default
* WML engine:
* [get_global_variable] now works properly when side != current_side.
* Fix bug #20871: Attack related events are now mpsave.
Expand Down
19 changes: 18 additions & 1 deletion src/unit_animation.cpp
Expand Up @@ -633,6 +633,15 @@ void unit_animation::add_anims( std::vector<unit_animation> & animations, const
config anim = ab.merge();
anim["apply_to"] = "standing";
anim["cycles"] = "true";
// add cycles to all frames within a standing animation block
BOOST_FOREACH(config::all_children_iterator ci, ab.children)
{
std::string sub_frame_name = ci->key;
size_t pos = sub_frame_name.find("_frame");
if (pos != std::string::npos) {
anim[sub_frame_name.substr(0,pos)+"_cycles"] = "true";
}
}
if (anim["layer"].empty()) anim["layer"] = default_layer;
if (anim["offscreen"].empty()) anim["offscreen"] = false;
animations.push_back(unit_animation(anim));
Expand All @@ -642,7 +651,15 @@ void unit_animation::add_anims( std::vector<unit_animation> & animations, const
{
config anim = ab.merge();
anim["apply_to"] = "default";
anim["cycles"] = "false";
anim["cycles"] = "true";
BOOST_FOREACH(config::all_children_iterator ci, ab.children)
{
std::string sub_frame_name = ci->key;
size_t pos = sub_frame_name.find("_frame");
if (pos != std::string::npos) {
anim[sub_frame_name.substr(0,pos)+"_cycles"] = "true";
}
}
if (anim["layer"].empty()) anim["layer"] = default_layer;
if (anim["offscreen"].empty()) anim["offscreen"] = false;
animations.push_back(unit_animation(anim));
Expand Down

0 comments on commit 376accf

Please sign in to comment.