34 names.push_back(
"animation");
35 names.push_back(
"attack_anim");
36 names.push_back(
"death");
37 names.push_back(
"defend");
38 names.push_back(
"extra_anim");
39 names.push_back(
"healed_anim");
40 names.push_back(
"healing_anim");
41 names.push_back(
"idle_anim");
42 names.push_back(
"leading_anim");
43 names.push_back(
"resistance_anim");
44 names.push_back(
"levelin_anim");
45 names.push_back(
"levelout_anim");
46 names.push_back(
"movement_anim");
47 names.push_back(
"poison_anim");
48 names.push_back(
"recruit_anim");
49 names.push_back(
"recruiting_anim");
50 names.push_back(
"standing_anim");
51 names.push_back(
"teleport_anim");
52 names.push_back(
"pre_movement_anim");
53 names.push_back(
"post_movement_anim");
54 names.push_back(
"draw_weapon_anim");
55 names.push_back(
"sheath_weapon_anim");
56 names.push_back(
"victory_anim");
57 names.push_back(
"_transparent");
66 return anim_tags.names;
78 std::vector<config::all_children_iterator>
children;
97 itors(cfg.all_children_range()), branches(1), parent(nullptr)
99 branches.back().attributes.merge_attributes(cfg);
102 itors(cfg.all_children_range()), branches(p->branches), parent(p)
108 bool previously_hits_set =
false;
109 bool previously_direction_set =
false;
110 bool previously_terrain_set =
false;
111 bool previously_value_set =
false;
112 bool previously_value_2nd_set =
false;
119 bi != branches.end(); ++bi)
121 std::string s_branch_hits = (*bi).attributes[
"hits"];
122 std::string s_branch_direction = (*bi).attributes[
"direction"];
123 std::string s_branch_terrain = (*bi).attributes[
"terrain_types"];
124 std::string s_branch_value = (*bi).attributes[
"value"];
125 std::string s_branch_value_2nd = (*bi).attributes[
"value_second"];
126 if (s_branch_hits !=
"" && s_branch_hits == s_cfg_hits) {
127 previously_hits_set =
true;
129 if (s_branch_direction !=
"" && s_branch_direction == s_cfg_direction) {
130 previously_direction_set =
true;
132 if (s_branch_terrain !=
"" && s_branch_terrain == s_cfg_terrain) {
133 previously_terrain_set =
true;
135 if (s_branch_value !=
"" && s_branch_value == s_cfg_value) {
136 previously_value_set =
true;
138 if (s_branch_value_2nd !=
"" && s_branch_value_2nd == s_cfg_value_2nd) {
139 previously_value_2nd_set =
true;
145 bi != branches.end(); )
147 std::string s_branch_hits = (*bi).attributes[
"hits"];
148 std::string s_branch_direction = (*bi).attributes[
"direction"];
149 std::string s_branch_terrain = (*bi).attributes[
"terrain_types"];
150 std::string s_branch_value = (*bi).attributes[
"value"];
151 std::string s_branch_value_2nd = (*bi).attributes[
"value_second"];
152 bool hits_match = (previously_hits_set && s_branch_hits != s_cfg_hits);
153 bool direction_match = (previously_direction_set && s_branch_direction != s_cfg_direction);
154 bool terrain_match = (previously_terrain_set && s_branch_terrain != s_cfg_terrain);
155 bool value_match = (previously_value_set && s_branch_value != s_cfg_value);
156 bool value_2nd_match = (previously_value_2nd_set && s_branch_value_2nd != s_cfg_value_2nd);
157 if ( (!previously_hits_set || hits_match) &&
158 (!previously_direction_set || direction_match) &&
159 (!previously_terrain_set || terrain_match) &&
160 (!previously_value_set || value_match) &&
161 (!previously_value_2nd_set || value_2nd_match) &&
162 (hits_match || direction_match || terrain_match || value_match || value_2nd_match) )
164 branches.erase(bi++);
167 (*bi).attributes.merge_attributes(cfg);
176 std::string s_branch_hits = (*bi).attributes[
"hits"];
177 std::string s_branch_direction = (*bi).attributes[
"direction"];
178 std::string s_branch_terrain = (*bi).attributes[
"terrain_types"];
179 std::string s_branch_value = (*bi).attributes[
"value"];
180 std::string s_branch_value_2nd = (*bi).attributes[
"value_second"];
181 bool hits_match = (previously_hits_set && s_branch_hits == s_cfg_hits);
182 bool direction_match = (previously_direction_set && s_branch_direction == s_cfg_direction);
183 bool terrain_match = (previously_terrain_set && s_branch_terrain == s_cfg_terrain);
184 bool value_match = (previously_value_set && s_branch_value == s_cfg_value);
185 bool value_2nd_match = (previously_value_2nd_set && s_branch_value_2nd == s_cfg_value_2nd);
186 if ( (!previously_hits_set || hits_match) &&
187 (!previously_direction_set || direction_match) &&
188 (!previously_terrain_set || terrain_match) &&
189 (!previously_value_set || value_match) &&
190 (!previously_value_2nd_set || value_2nd_match) &&
191 (hits_match || direction_match || terrain_match || value_match || value_2nd_match) )
207 std::list<animation_cursor> anim_cursors;
209 while (!anim_cursors.empty())
218 anim_cursors.pop_back();
221 if (ac.
itors.first->key !=
"if") {
236 }
while (ac.
itors.first != ac.
itors.second && ac.
itors.first->key ==
"else");
253 assert(anim_cursors.size() == 1);
255 expanded_anims.splice(expanded_anims.end(),
256 ac.branches, ac.branches.begin(), ac.branches.end());
265 return expanded_animations;
272 secondary_unit_filter_(),
275 base_score_(variation),
278 primary_attack_filter_(),
279 secondary_attack_filter_(),
283 unit_anim_(start_time,builder),
287 play_offscreen_(true),
296 secondary_unit_filter_(),
298 frequency_(cfg[
"frequency"]),
299 base_score_(cfg[
"base_score"]),
302 primary_attack_filter_(),
303 secondary_attack_filter_(),
307 unit_anim_(cfg,frame_string),
311 play_offscreen_(true),
317 if (fr.key == frame_string)
continue;
318 if (fr.key.find(
"_frame", fr.key.size() - 6) == std::string::npos)
continue;
324 const std::vector<std::string>& my_directions =
utils::split(cfg[
"direction"]);
325 for(std::vector<std::string>::const_iterator
i = my_directions.begin();
i != my_directions.end(); ++
i) {
343 std::vector<std::string> value_str =
utils::split(cfg[
"value"]);
345 for(value=value_str.begin() ; value != value_str.end() ; ++
value) {
346 value_.push_back(atoi(value->c_str()));
349 std::vector<std::string> hits_str =
utils::split(cfg[
"hits"]);
351 for(hit=hits_str.begin() ; hit != hits_str.end() ; ++hit) {
352 if(*hit ==
"yes" || *hit ==
"hit") {
355 if(*hit ==
"no" || *hit ==
"miss") {
358 if(*hit ==
"yes" || *hit ==
"kill" ) {
362 std::vector<std::string> value2_str =
utils::split(cfg[
"value_second"]);
364 for(value2=value2_str.begin() ; value2 != value2_str.end() ; ++value2) {
365 value2_.push_back(atoi(value2->c_str()));
380 if(!event.empty()&&!
event_.empty()) {
395 if(
value_.empty() == false ) {
410 std::vector<config>::const_iterator myitor;
433 if(
hits_.empty() == false ) {
440 if(
value2_.empty() == false ) {
451 std::vector<config>::const_iterator myitor;
472 std::vector<unit_animation> animation_base;
473 std::vector<unit_animation>::const_iterator
itor;
475 for(itor = animations.begin(); itor != animations.end() ; ++
itor) {
476 if (
std::find(itor->event_.begin(),itor->event_.end(),
std::string(
"default"))!= itor->event_.end()) {
477 animation_base.push_back(*itor);
479 animation_base.back().event_.clear();
484 if( animation_base.empty() )
489 blend(
"0.0~0.3:100,0.3~0.0:200",
display::rgb(255,255,255)),
"_disabled_selected_",0));
490 for(itor = animation_base.begin() ; itor != animation_base.end() ; ++
itor ) {
496 animations.push_back(*itor);
498 animations.back().play_offscreen_ =
false;
500 animations.push_back(*itor);
502 animations.back().unit_anim_.override(0,animations.back().unit_anim_.get_animation_duration(),
particule::UNSET,
"0.9",
"",0,
"",
"",
"~GS()");
504 animations.push_back(*itor);
505 animations.back().event_ =
utils::split(
"disabled_ghosted");
506 animations.back().unit_anim_.override(0,1,
particule::UNSET,
"0.4",
"",0,
"",
"",
"~GS()");
508 animations.push_back(*itor);
512 animations.push_back(*itor);
516 animations.push_back(*itor);
520 animations.push_back(*itor);
524 animations.push_back(*itor);
525 animations.back().event_ =
utils::split(
"pre_movement");
528 animations.push_back(*itor);
529 animations.back().event_ =
utils::split(
"post_movement");
532 animations.push_back(*itor);
536 animations.push_back(*itor);
538 animations.back().unit_anim_.override(0,animations.back().unit_anim_.get_animation_duration(),
particule::NO_CYCLE,
"",
"0.0,0.5:75,0.0:75,0.5:75,0.0",
game_display::rgb(255,0,0));
539 animations.back().hits_.push_back(
HIT);
540 animations.back().hits_.push_back(
KILL);
542 animations.push_back(*itor);
545 animations.push_back(*itor);
548 animations.back().primary_attack_filter_.push_back(
config());
549 animations.back().primary_attack_filter_.back()[
"range"] =
"melee";
551 animations.push_back(*itor);
554 animations.back().primary_attack_filter_.push_back(
config());
555 animations.back().primary_attack_filter_.back()[
"range"] =
"ranged";
557 animations.push_back(*itor);
560 animations.back().sub_anims_[
"_death_sound"] =
particule();
561 animations.back().sub_anims_[
"_death_sound"].add_frame(1,
frame_builder().
sound(cfg[
"die_sound"]),
true);
563 animations.push_back(*itor);
565 animations.back().unit_anim_.override(0,animations.back().unit_anim_.get_animation_duration(),
particule::CYCLE);
567 animations.push_back(*itor);
569 animations.back().event_ =
utils::split(
"pre_teleport");
571 animations.push_back(*itor);
573 animations.back().event_ =
utils::split(
"post_teleport");
575 animations.push_back(*itor);
578 animations.push_back(*itor);
580 animations.back().unit_anim_.override(0,300,
particule::NO_CYCLE,
"",
"0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30",
display::rgb(255,255,255));
582 if (cfg[
"healed_sound"].empty()) {
583 healed_sound =
"heal.wav";
585 healed_sound = cfg[
"healed_sound"].str();
587 animations.back().sub_anims_[
"_healed_sound"].add_frame(1,
frame_builder().
sound(healed_sound),
true);
589 animations.push_back(*itor);
591 animations.back().unit_anim_.override(0,300,
particule::NO_CYCLE,
"",
"0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30",
display::rgb(0,255,0));
592 animations.back().sub_anims_[
"_poison_sound"] =
particule();
600 const config &cfg,
char const *tag_name,
char const *apply_to,
602 bool offscreen =
true)
607 anim[
"apply_to"] = apply_to;
610 if (v.
empty()) v =
false;
639 anim[
"apply_to"] =
"standing";
640 anim[
"cycles"] =
"true";
645 size_t pos = sub_frame_name.find(
"_frame");
646 if (pos != std::string::npos) {
647 anim[sub_frame_name.substr(0,pos)+
"_cycles"] =
"true";
650 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
651 if (anim[
"offscreen"].empty()) anim[
"offscreen"] =
false;
658 anim[
"apply_to"] =
"default";
659 anim[
"cycles"] =
"true";
663 size_t pos = sub_frame_name.find(
"_frame");
664 if (pos != std::string::npos) {
665 anim[sub_frame_name.substr(0,pos)+
"_cycles"] =
"true";
668 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
669 if (anim[
"offscreen"].empty()) anim[
"offscreen"] =
false;
675 anim[
"apply_to"] =
"healing";
676 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
677 anim[
"value"] = anim[
"damage"];
684 anim[
"apply_to"] =
"healed";
685 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
686 anim[
"value"] = anim[
"healing"];
688 animations.back().sub_anims_[
"_healed_sound"] =
particule();
690 if (cfg[
"healed_sound"].empty()) {
691 healed_sound =
"heal.wav";
693 healed_sound = cfg[
"healed_sound"].str();
695 animations.back().sub_anims_[
"_healed_sound"].add_frame(1,
frame_builder().
sound(healed_sound),
true);
701 anim[
"apply_to"] =
"poisoned";
702 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
703 anim[
"value"] = anim[
"damage"];
705 animations.back().sub_anims_[
"_poison_sound"] =
particule();
714 if (anim[
"offset"].empty()) {
715 anim[
"offset"] =
"0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,";
717 anim[
"apply_to"] =
"movement";
718 if (anim[
"layer"].empty()) anim[
"layer"] = move_layer;
727 anim[
"apply_to"] =
"defend";
728 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
729 if (!anim[
"damage"].empty() && anim[
"value"].empty()) {
730 anim[
"value"] = anim[
"damage"];
732 if (anim[
"hits"].empty())
734 anim[
"hits"] =
false;
736 animations.back().base_score_--;
739 animations.back().base_score_--;
740 image::locator image_loc = animations.back().get_last_frame().end_parameters().image;
754 image::locator image_loc = animations.back().get_last_frame().end_parameters().image;
771 anim[
"apply_to"] =
"attack";
772 if (anim[
"layer"].empty()) anim[
"layer"] = move_layer;
774 if (anim[
"offset"].empty() && missile_fs.first == missile_fs.second) {
775 anim[
"offset"] =
"0~0.6,0.6~0";
777 if (missile_fs.first != missile_fs.second) {
778 if (anim[
"missile_offset"].empty()) anim[
"missile_offset"] =
"0~0.8";
779 if (anim[
"missile_layer"].empty()) anim[
"missile_layer"] = missile_layer;
792 anim[
"apply_to"] =
"death";
793 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
795 image::locator image_loc = animations.back().get_last_frame().end_parameters().image;
800 .highlight(
"1~0:600"));
801 if(!cfg[
"die_sound"].empty()) {
802 animations.back().sub_anims_[
"_death_sound"] =
particule();
803 animations.back().sub_anims_[
"_death_sound"].add_frame(1,
frame_builder().
sound(cfg[
"die_sound"]),
true);
812 anim[
"apply_to"] = anim[
"flag"];
813 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
820 if (anim[
"layer"].empty()) anim[
"layer"] = default_layer;
821 anim[
"apply_to"] =
"pre_teleport";
823 animations.back().unit_anim_.set_end_time(0);
824 anim[
"apply_to"] =
"post_teleport";
826 animations.back().unit_anim_.remove_frames_until(0);
843 if(cycles ==
CYCLE) {
864 if(parameters_.need_update())
return true;
882 last_frame_begin_time_(0),
887 if(cfg[frame_string+
"start_time"].empty() &&range.first != range.second) {
888 for (
const config &frame : range) {
895 for (
const config &frame : range)
900 cycles_ = cfg[frame_string+
"cycles"].to_bool(
false);
910 std::map<std::string,particule>::const_iterator anim_itor =
sub_anims_.begin();
911 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
912 if(anim_itor->second.need_update())
return true;
923 std::map<std::string,particule>::const_iterator anim_itor =
sub_anims_.begin();
924 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
925 if(anim_itor->second.need_minimal_update())
return true;
933 std::map<std::string,particule>::const_iterator anim_itor =
sub_anims_.begin();
934 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
935 if(!anim_itor->second.animation_finished())
return false;
943 std::map<std::string,particule>::const_iterator anim_itor =
sub_anims_.begin();
944 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
945 if(!anim_itor->second.animation_finished_potential())
return false;
955 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
956 anim_itor->second.update_last_draw_time(acceleration);
963 std::map<std::string,particule>::const_iterator anim_itor =
sub_anims_.begin();
964 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
965 result= std::max<int>(
result,anim_itor->second.get_end_time());
973 std::map<std::string,particule>::const_iterator anim_itor =
sub_anims_.begin();
974 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
975 result= std::min<int>(
result,anim_itor->second.get_begin_time());
984 ,
const Uint32 text_color
985 ,
const bool accelerate)
998 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
999 anim_itor->second.accelerate = accelerate;
1000 anim_itor->second.start_animation(start_time);
1014 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
1015 anim_itor->second.pause_animation();
1023 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
1024 anim_itor->second.restart_animation();
1036 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
1037 anim_itor->second.redraw( value,
src_,
dst_, halo_man);
1045 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
1046 anim_itor->second.clear_halo();
1055 if(complete_redraw) {
1060 for( ; anim_itor !=
sub_anims_.end() ; ++anim_itor) {
1061 std::set<map_location> tmp = anim_itor->second.get_overlaped_hex(value,
src_,
dst_);
1071 if(complete_redraw) {
1093 std::ostringstream outstream;
1095 return outstream.str();
1103 if (i>0) std::cout <<
','; i++;
1108 std::cout <<
"\tstart_time=" << u_animation.
get_begin_time() <<
'\n';
1110 if (u_animation.
hits_.size() > 0) {
1111 std::cout <<
"\thits=";
1114 if (i>0) std::cout <<
','; i++;
1125 std::cout <<
"\tdirections=";
1128 if (i>0) std::cout <<
','; i++;
1129 switch (direction) {
1143 std::cout <<
"\tterrain=";
1145 if (i>0) std::cout <<
','; i++;
1153 std::cout <<
"[filter]\n";
1155 std::cout << cfg.
debug();
1158 std::cout <<
"[/filter]\n";
1161 std::cout <<
"[filter_second]\n";
1163 std::cout << cfg.
debug();
1166 std::cout <<
"[/filter_second]\n";
1169 std::cout <<
"[filter_attack]\n";
1171 std::cout << cfg.
debug();
1173 std::cout <<
"[/filter_attack]\n";
1176 std::cout <<
"[filter_second_attack]\n";
1178 std::cout << cfg.
debug();
1180 std::cout <<
"[/filter_second_attack]\n";
1184 std::cout <<
"\t[frame]\n";
1186 std::cout <<
"\t\t" << frame_string <<
"\n";
1188 std::cout <<
"\t[/frame]\n";
1191 for (std::pair<std::string, unit_animation::particule>
p : u_animation.
sub_anims_) {
1192 for (
size_t i=0; i<p.second.get_frames_count(); i++) {
1194 size_t pos = sub_frame_name.find(
"_frame");
1195 if (pos != std::string::npos) sub_frame_name = sub_frame_name.substr(0,pos);
1196 std::cout <<
"\t" << sub_frame_name <<
"_start_time=" << p.second.get_begin_time() <<
'\n';
1197 std::cout <<
"\t[" << p.first <<
"]\n";
1198 for (
const std::string frame_string : p.second.get_frame(i).debug_strings()) {
1199 std::cout <<
"\t\t" << frame_string <<
'\n';
1201 std::cout <<
"\t[/" << p.first <<
"]\n";
1208 if (i>0) std::cout <<
','; i++;
1218 const unit_frame& current_frame= get_current_frame();
1225 if (animation_time > get_current_frame_end_time()) in_scope_of_frame =
false;
1234 current_frame.
redraw(get_current_frame_time(),
true,in_scope_of_frame,src,dst,halo_id_,halo_man,default_val,value);
1236 current_frame.
redraw(get_current_frame_time(),
false,in_scope_of_frame,src,dst,halo_id_,halo_man,default_val,value);
1245 const unit_frame& current_frame= get_current_frame();
1247 return current_frame.
get_overlaped_hex(get_current_frame_time(),src,dst,default_val,value);
1259 parameters_.override(get_animation_duration());
1273 ,
const Uint32 text_color
1279 if(!animated_unit)
return;
1291 animated_units_.push_back(tmp);
1299 ,
const Uint32 text_color)
1301 if(!animated_unit)
return;
1312 animated_units_.push_back(tmp);
1322 ,
const Uint32 text_color
1328 if(!animated_unit)
return;
1340 animated_units_.push_back(tmp);
1342 add_animation(animated_unit,event,src,dst,value,with_bars,text,text_color,hit_type,attack,second_attack,value2);
1348 int begin_time = INT_MAX;
1350 for(anim = animated_units_.begin(); anim != animated_units_.end();++anim) {
1351 if(anim->my_unit->anim_comp().get_animation()) {
1352 if(anim->animation) {
1353 begin_time = std::min<int>(begin_time,anim->animation->get_begin_time());
1355 begin_time = std::min<int>(begin_time,anim->my_unit->anim_comp().get_animation()->get_begin_time());
1359 for(anim = animated_units_.begin(); anim != animated_units_.end();++anim) {
1360 if(anim->animation) {
1361 anim->my_unit->anim_comp().start_animation(begin_time, anim->animation,
1362 anim->with_bars, anim->text, anim->text_color);
1363 anim->animation =
nullptr;
1365 anim->my_unit->anim_comp().get_animation()->update_parameters(anim->src,anim->src.get_direction(anim->my_unit->facing()));
1373 bool finished =
true;
1374 for(std::vector<anim_elem>::const_iterator anim = animated_units_.begin(); anim != animated_units_.end();++anim) {
1375 finished &= anim->my_unit->anim_comp().get_animation()->animation_finished_potential();
1385 int end_tick = animated_units_[0].my_unit->anim_comp().get_animation()->time_to_tick(animation_time);
1386 while (SDL_GetTicks() < static_cast<unsigned int>(end_tick)
1387 - std::min<int>(static_cast<unsigned int>(20/speed),20)) {
1393 end_tick = animated_units_[0].my_unit->anim_comp().get_animation()->time_to_tick(animation_time);
1395 CVideo::delay(std::max<int>(0,end_tick - SDL_GetTicks() +5));
1403 bool finished =
false;
1410 for(std::vector<anim_elem>::const_iterator anim = animated_units_.begin(); anim != animated_units_.end();++anim) {
1411 finished &= anim->my_unit->anim_comp().get_animation()->animation_finished_potential();
1417 return animated_units_[0].my_unit->anim_comp().get_animation()->get_animation_time() ;
1421 return animated_units_[0].my_unit->anim_comp().get_animation()->get_animation_time_potential() ;
1426 int end_time = INT_MIN;
1427 for(std::vector<anim_elem>::const_iterator anim = animated_units_.begin(); anim != animated_units_.end();++anim) {
1428 if(anim->my_unit->anim_comp().get_animation()) {
1429 end_time = std::max<int>(end_time,anim->my_unit->anim_comp().get_animation()->get_end_time());
1438 if(anim->my_unit->anim_comp().get_animation()) {
1439 anim->my_unit->anim_comp().get_animation()->pause_animation();
1447 if(anim->my_unit->anim_comp().get_animation()) {
1448 anim->my_unit->anim_comp().get_animation()->restart_animation();
1456 anim->my_unit->anim_comp().set_standing();
play_controller * controller
boost::intrusive_ptr< const unit > unit_const_ptr
child_itors child_range(const std::string &key)
Describe a unit's animation sequence.
static DIRECTION parse_direction(const std::string &str)
static display * get_singleton()
Returns the display object if a display object exists.
animation_cursor * parent
particule(int start_time=0, const frame_builder &builder=frame_builder())
void wait_until(int animation_time) const
bool matches_filter(const config &filter) const
Returns whether or not *this matches the given filter.
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
std::vector< hit_type > hits_
void set_end_time(int ending_time)
t_list read_list(const std::string &str, const t_layer filler)
Reads a list of terrains from a string, when reading the.
keep most parameters in a separate class to simplify handling of large number of parameters handling ...
int get_animation_time_potential() const
void override(int start_time, int duration, const cycle_state cycles, const std::string &highlight="", const std::string &blend_ratio="", Uint32 blend_color=0, const std::string &offset="", const std::string &layer="", const std::string &modifiers="")
std::string debug() const
std::vector< map_location::DIRECTION > directions_
animation_cursor(const config &cfg)
config::all_children_itors itors
static void add_anims(std::vector< unit_animation > &animations, const config &cfg)
std::vector< config > secondary_attack_filter_
static void prepare_single_animation(const config &anim_cfg, animation_branches &expanded_anims)
void start_animation(int start_time)
int get_begin_time() const
GLenum GLsizei GLenum GLenum const GLvoid * image
void add_frame(int duration, const unit_frame &value, bool force_change=false)
const unit_animation * animation
int get_animation_time() const
std::vector< int > value_
void add_frame(int duration, const unit_frame &value, bool force_change=false)
Adds a frame to an animation.
std::vector< std::string > debug_strings() const
bool tile_nearly_on_screen(const map_location &loc) const
Checks if location loc or one of the adjacent tiles is visible on screen.
void play_slice(bool is_delay_enabled=true)
bool animation_finished_potential() const
Audio output for sound and music.
std::string debug() const
All parameters from a frame at a given instant.
size_t get_frames_count() const
bool empty() const
Tests for an attribute that either was never set or was set to "".
std::pair< const_child_iterator, const_child_iterator > const_child_itors
Variant for storing WML attributes.
int get_begin_time() const
tdrawing_layer
The layers to render something on.
bool does_not_change() const
std::set< map_location > get_overlaped_hex(const int frame_time, const map_location &src, const map_location &dst, const frame_parameters &animation_val, const frame_parameters &engine_val) const
const unit_frame & get_last_frame() const
static void add_simple_anim(std::vector< unit_animation > &animations, const config &cfg, char const *tag_name, char const *apply_to, display::tdrawing_layer layer=display::LAYER_UNIT_DEFAULT, bool offscreen=true)
void update_last_draw_time(double acceleration=0)
unit_animation * get_animation() const
Get a pointer to the current animation.
unit_animation()
Shouldn't be used so only declared.
GLenum GLenum GLuint GLint GLint layer
static const std::vector< std::string > & all_tag_names()
void replace_anim_if_invalid(const unit *animated_unit, const std::string &event, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const int value=0, bool with_bars=false, const std::string &text="", const Uint32 text_color=0, const unit_animation::hit_type hit_type=unit_animation::INVALID, const attack_type *attack=nullptr, const attack_type *second_attack=nullptr, int value2=0)
GLsizei const GLfloat * value
all_children_itors all_children_range() const
In-order iteration over all children.
std::set< map_location > overlaped_hex_
int get_current_frame_begin_time() const
std::pair< all_children_iterator, all_children_iterator > all_children_itors
config & add_child(const std::string &key)
std::vector< config::all_children_iterator > children
default layer for missile frames
default layer for drawing moving units
int get_animation_duration() const
std::vector< config > secondary_unit_filter_
std::vector< std::string > event_
const T & get_frame(size_t n) const
unit_animation_component & anim_comp() const
static const ::config * terrain
The terrain used to create the cache.
GLuint const GLuint * names
GLuint GLuint GLsizei count
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
const unit_map & get_units() const
int matches(const display &disp, const map_location &loc, const map_location &second_loc, const unit *my_unit, const std::string &event="", const int value=0, hit_type hit=INVALID, const attack_type *attack=nullptr, const attack_type *second_attack=nullptr, int value2=0) const
Encapsulates the map of the game.
const std::string & get_filename() const
double turbo_speed() const
Reserve layers to be selected for WML.
const std::string & get_modifications() const
default layer for drawing units
void new_animation_frame()
animation_branches branches
std::map< std::string, tfilter >::iterator itor
map_location::DIRECTION facing() const
static Uint32 rgb(Uint8 red, Uint8 green, Uint8 blue)
friend std::ostream & operator<<(std::ostream &outstream, const unit_animation &u_animation)
std::list< animation_branch > animation_branches
std::vector< std::string > names
std::set< map_location > get_overlaped_hex(const frame_parameters &value, const map_location &src, const map_location &dst)
bool terrain_matches(const t_terrain &src, const t_terrain &dest)
Tests whether a specific terrain matches an expression, for matching rules see above.
std::vector< int > value2_
DIRECTION
Valid directions which can be moved in our hexagonal world.
bool does_not_change() const
static void fill_initial_animations(std::vector< unit_animation > &animations, const config &cfg)
bool animation_finished() const
Returns true if the current animation was finished.
void add_animation(const unit *animated_unit, const unit_animation *animation, const map_location &src=map_location::null_location(), bool with_bars=false, const std::string &text="", const Uint32 text_color=0)
std::vector< config > unit_filter_
t_translation::t_terrain get_terrain(const map_location &loc) const
Looks up terrain at a particular location.
std::vector< config > primary_attack_filter_
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
std::map< std::string, particule > sub_anims_
void set_begin_time(int new_begin_time)
void update_parameters(const map_location &src, const map_location &dst)
void override(int duration, const std::string &highlight="", const std::string &blend_ratio="", Uint32 blend_color=0, const std::string &offset="", const std::string &layer="", const std::string &modifiers="")
allow easy chained modifications will raised assert if used after initialization
const gamemap & get_map() const
const unit_animation * choose_animation(const display &disp, const map_location &loc, const std::string &event, const map_location &second_loc=map_location::null_location(), const int damage=0, const unit_animation::hit_type hit_type=unit_animation::INVALID, const attack_type *attack=nullptr, const attack_type *second_attack=nullptr, int swing_num=0)
Chooses an appropriate animation from the list of known animations.
bool find(E event, F functor)
Tests whether an event handler is available.
A variable-expanding proxy for the config class.
static animation_branches prepare_animation(const config &cfg, const std::string &animation_tag)
frame_parsed_parameters parameters_
static void delay(unsigned int milliseconds)
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
void redraw(frame_parameters &value, halo::manager &halo_man)
void update_last_draw_time()
unit_iterator find(size_t id)
void redraw(const frame_parameters &value, const map_location &src, const map_location &dst, halo::manager &halo_man)
int get_animation_time() const
A config object defines a single node in a WML file, with access to child nodes.
t_translation::t_list terrain_types_
bool animation_finished_potential() const
bool animation_finished() const
animation_cursor(const config &cfg, animation_cursor *p)
GLsizei const GLcharARB ** string
bool need_minimal_update() const
void redraw(const int frame_time, bool on_start_time, bool in_scope_of_frame, const map_location &src, const map_location &dst, halo::handle &halo_id, halo::manager &halo_man, const frame_parameters &animation_val, const frame_parameters &engine_val) const
config & add_child_at(const std::string &key, const config &val, unsigned index)
void wait_for_end() const
void start_animation(int start_time, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const std::string &text="", const Uint32 text_color=0, const bool accelerate=true)
bool need_minimal_update() const
bool propagate_invalidation(const std::set< map_location > &locs)
If this set is partially invalidated, invalidate all its hexes.
bool invalidate(frame_parameters &value)
static game_display * get_singleton()
boost::shared_ptr< halo_record > handle
void start_animation(int start_time, bool cycles=false)
Starts an animation cycle.