#include <animation.hpp>
Classes | |
class | particle |
Public Types | |
enum | variation_type { MATCH_FAIL = -10 , DEFAULT_ANIM = -9 } |
Public Member Functions | |
unit_animation ()=delete | |
unit_animation (const config &cfg, const std::string &frame_string="") | |
int | matches (const map_location &loc, const map_location &second_loc, unit_const_ptr my_unit, const std::string &event="", const int value=0, strike_result::type hit=strike_result::type::invalid, const_attack_ptr attack=nullptr, const_attack_ptr second_attack=nullptr, int value2=0) const |
const unit_frame & | get_last_frame () const |
void | add_frame (const std::chrono::milliseconds &duration, const unit_frame &value, bool force_change=false) |
std::vector< std::string > | get_flags () const |
bool | need_update () const |
bool | need_minimal_update () const |
bool | animation_finished () const |
bool | animation_finished_potential () const |
void | update_last_draw_time () |
std::chrono::milliseconds | get_begin_time () const |
std::chrono::milliseconds | get_end_time () const |
auto | time_to_tick (const std::chrono::milliseconds &animation_time) const |
auto | get_animation_time () const |
void | set_max_animation_time (const std::chrono::milliseconds &time) |
auto | get_animation_time_potential () const |
void | start_animation (const std::chrono::milliseconds &start_time, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const std::string &text="", const color_t text_color={0, 0, 0}, const bool accelerate=true) |
void | update_parameters (const map_location &src, const map_location &dst) |
void | pause_animation () |
void | restart_animation () |
auto | get_current_frame_begin_time () const |
void | redraw (frame_parameters &value, halo::manager &halo_man) |
void | clear_haloes () |
bool | invalidate (frame_parameters &value) |
std::string | debug () const |
Static Public Member Functions | |
static void | fill_initial_animations (std::vector< unit_animation > &animations, const config &cfg) |
static void | add_anims (std::vector< unit_animation > &animations, const config &cfg) |
Protected Member Functions | |
frame_parameters | get_current_params (const frame_parameters &default_val=frame_parameters()) const |
Private Member Functions | |
unit_animation (const std::chrono::milliseconds &start_time, const unit_frame &frame, const std::string &event="", const int variation=DEFAULT_ANIM, const frame_builder &builder=frame_builder()) | |
Private Attributes | |
t_translation::ter_list | terrain_types_ |
std::vector< config > | unit_filter_ |
std::vector< config > | secondary_unit_filter_ |
std::vector< map_location::direction > | directions_ |
int | frequency_ |
int | base_score_ |
std::vector< std::string > | event_ |
std::vector< int > | value_ |
std::vector< config > | primary_attack_filter_ |
std::vector< config > | secondary_attack_filter_ |
std::vector< strike_result::type > | hits_ |
std::vector< int > | value2_ |
std::map< std::string, particle > | sub_anims_ |
particle | unit_anim_ |
map_location | src_ |
map_location | dst_ |
bool | invalidated_ |
bool | play_offscreen_ |
std::set< map_location > | overlaped_hex_ |
Friends | |
class | unit |
class | unit_drawer |
std::ostream & | operator<< (std::ostream &outstream, const unit_animation &u_animation) |
Definition at line 26 of file animation.hpp.
Enumerator | |
---|---|
MATCH_FAIL | |
DEFAULT_ANIM |
Definition at line 32 of file animation.hpp.
|
delete |
Referenced by fill_initial_animations().
|
explicit |
Definition at line 278 of file animation.cpp.
References config::all_children_view(), config::child_range(), d, directions_, event_, h, hits_, map_location::parse_direction(), play_offscreen_, primary_attack_filter_, secondary_attack_filter_, secondary_unit_filter_, utils::split(), sub_anims_, unit_filter_, value2_, and value_.
|
explicitprivate |
Definition at line 253 of file animation.cpp.
References add_frame(), unit_frame::does_not_change(), and unit_frame::duration().
|
static |
Definition at line 628 of file animation.cpp.
References config::add_child(), config::add_child_at(), add_simple_anim(), config::child_range(), config::empty(), get_abs_frame_layer(), image::locator::get_filename(), get_heal_sound(), image::locator::get_modifications(), game_config::sounds::status::poisoned, prepare_animation(), gui2::dialogs::sound(), utils::split(), unit_default, unit_missile_default, and unit_move_default.
Referenced by unit_animation_component::apply_new_animation_effect(), and fill_initial_animations().
|
inline |
Definition at line 46 of file animation.hpp.
References animated< T >::add_frame(), and unit_anim_.
Referenced by unit_animation().
bool unit_animation::animation_finished | ( | ) | const |
Definition at line 984 of file animation.cpp.
References animated< T >::animation_finished(), sub_anims_, and unit_anim_.
bool unit_animation::animation_finished_potential | ( | ) | const |
Definition at line 994 of file animation.cpp.
References animated< T >::animation_finished_potential(), sub_anims_, and unit_anim_.
void unit_animation::clear_haloes | ( | ) |
Definition at line 1097 of file animation.cpp.
References unit_animation::particle::clear_halo(), sub_anims_, and unit_anim_.
std::string unit_animation::debug | ( | ) | const |
Definition at line 1150 of file animation.cpp.
|
static |
Definition at line 484 of file animation.cpp.
References add_anims(), unit_animation::particle::CYCLE, DEFAULT_ANIM, get_abs_frame_layer(), get_heal_sound(), unit_animation::particle::NO_CYCLE, game_config::sounds::status::poisoned, gui2::dialogs::sound(), unit_animation(), unit_move_default, and unit_animation::particle::UNSET.
Referenced by unit_type::animations().
|
inline |
Definition at line 69 of file animation.hpp.
References animated< T >::get_animation_time(), and unit_anim_.
Referenced by unit_animation::particle::get_overlaped_hex(), unit_animation::particle::redraw(), and unit_animator::wait_until().
|
inline |
Definition at line 79 of file animation.hpp.
References animated< T >::get_animation_time_potential(), and unit_anim_.
std::chrono::milliseconds unit_animation::get_begin_time | ( | ) | const |
Definition at line 1023 of file animation.cpp.
References animated< T >::get_begin_time(), sub_anims_, and unit_anim_.
Referenced by unit_animator::add_animation(), unit_animation::particle::get_overlaped_hex(), unit_animation::particle::redraw(), and unit_animation::particle::start_animation().
|
inline |
Definition at line 94 of file animation.hpp.
References animated< T >::get_current_frame_begin_time(), and unit_anim_.
Referenced by unit_animation::particle::need_minimal_update(), and unit_animation::particle::redraw().
|
inlineprotected |
Definition at line 109 of file animation.hpp.
References unit_animation::particle::parameters(), and unit_anim_.
std::chrono::milliseconds unit_animation::get_end_time | ( | ) | const |
Definition at line 1013 of file animation.cpp.
References animated< T >::get_end_time(), sub_anims_, and unit_anim_.
|
inline |
Definition at line 51 of file animation.hpp.
References event_.
|
inline |
Definition at line 41 of file animation.hpp.
References animated< T >::get_last_frame(), and unit_anim_.
bool unit_animation::invalidate | ( | frame_parameters & | value | ) |
Definition at line 1106 of file animation.cpp.
References dst_, unit_animation::particle::get_overlaped_hex(), display::get_singleton(), display::invalidate(), invalidated_, need_minimal_update(), need_update(), overlaped_hex_, frame_parameters::primary_frame, display::propagate_invalidation(), src_, sub_anims_, display::tile_nearly_on_screen(), and unit_anim_.
int unit_animation::matches | ( | const map_location & | loc, |
const map_location & | second_loc, | ||
unit_const_ptr | my_unit, | ||
const std::string & | event = "" , |
||
const int | value = 0 , |
||
strike_result::type | hit = strike_result::type::invalid , |
||
const_attack_ptr | attack = nullptr , |
||
const_attack_ptr | second_attack = nullptr , |
||
int | value2 = 0 |
||
) | const |
Definition at line 377 of file animation.cpp.
References base_score_, c, display::context(), randomness::rng::default_instance(), directions_, event_, f, unit_map::find(), frequency_, display::get_singleton(), gamemap_base::get_terrain(), hits_, display_context::map(), MATCH_FAIL, primary_attack_filter_, secondary_attack_filter_, secondary_unit_filter_, t_translation::terrain_matches(), terrain_types_, unit_filter_, display_context::units(), value2_, and value_.
bool unit_animation::need_minimal_update | ( | ) | const |
Definition at line 969 of file animation.cpp.
References unit_animation::particle::need_minimal_update(), play_offscreen_, sub_anims_, and unit_anim_.
Referenced by invalidate().
bool unit_animation::need_update | ( | ) | const |
Definition at line 959 of file animation.cpp.
References unit_animation::particle::need_update(), sub_anims_, and unit_anim_.
Referenced by invalidate(), and unit_animation::particle::need_update().
void unit_animation::pause_animation | ( | ) |
Definition at line 1065 of file animation.cpp.
References animated< T >::pause_animation(), sub_anims_, and unit_anim_.
void unit_animation::redraw | ( | frame_parameters & | value, |
halo::manager & | halo_man | ||
) |
Definition at line 1083 of file animation.cpp.
References dst_, invalidated_, overlaped_hex_, frame_parameters::primary_frame, unit_animation::particle::redraw(), src_, sub_anims_, and unit_anim_.
void unit_animation::restart_animation | ( | ) |
Definition at line 1074 of file animation.cpp.
References animated< T >::restart_animation(), sub_anims_, and unit_anim_.
|
inline |
Definition at line 74 of file animation.hpp.
References animated< T >::set_max_animation_time(), and unit_anim_.
void unit_animation::start_animation | ( | const std::chrono::milliseconds & | start_time, |
const map_location & | src = map_location::null_location() , |
||
const map_location & | dst = map_location::null_location() , |
||
const std::string & | text = "" , |
||
const color_t | text_color = {0,0,0} , |
||
const bool | accelerate = true |
||
) |
Definition at line 1033 of file animation.cpp.
References unit_animation::particle::accelerate, animated< T >::add_frame(), dst, dst_, src, src_, unit_animation::particle::start_animation(), sub_anims_, and unit_anim_.
|
inline |
Definition at line 64 of file animation.hpp.
References animated< T >::time_to_tick(), and unit_anim_.
void unit_animation::update_last_draw_time | ( | ) |
Definition at line 1004 of file animation.cpp.
References unit_animation::particle::accelerate, display::get_singleton(), sub_anims_, display::turbo_speed(), unit_anim_, and animated< T >::update_last_draw_time().
void unit_animation::update_parameters | ( | const map_location & | src, |
const map_location & | dst | ||
) |
|
friend |
Definition at line 1157 of file animation.cpp.
|
friend |
Definition at line 104 of file animation.hpp.
|
friend |
Definition at line 105 of file animation.hpp.
|
private |
Definition at line 170 of file animation.hpp.
Referenced by matches().
|
private |
Definition at line 168 of file animation.hpp.
Referenced by matches(), and unit_animation().
|
private |
Definition at line 181 of file animation.hpp.
Referenced by invalidate(), redraw(), start_animation(), and update_parameters().
|
private |
Definition at line 171 of file animation.hpp.
Referenced by get_flags(), matches(), and unit_animation().
|
private |
Definition at line 169 of file animation.hpp.
Referenced by matches().
|
private |
Definition at line 175 of file animation.hpp.
Referenced by matches(), and unit_animation().
|
private |
Definition at line 183 of file animation.hpp.
Referenced by invalidate(), and redraw().
|
private |
Definition at line 185 of file animation.hpp.
Referenced by invalidate(), and redraw().
|
private |
Definition at line 184 of file animation.hpp.
Referenced by need_minimal_update(), and unit_animation().
|
private |
Definition at line 173 of file animation.hpp.
Referenced by matches(), and unit_animation().
|
private |
Definition at line 174 of file animation.hpp.
Referenced by matches(), and unit_animation().
|
private |
Definition at line 167 of file animation.hpp.
Referenced by matches(), and unit_animation().
|
private |
Definition at line 180 of file animation.hpp.
Referenced by invalidate(), redraw(), start_animation(), and update_parameters().
|
private |
Definition at line 177 of file animation.hpp.
Referenced by animation_finished(), animation_finished_potential(), clear_haloes(), get_begin_time(), get_end_time(), invalidate(), need_minimal_update(), need_update(), pause_animation(), redraw(), restart_animation(), start_animation(), unit_animation(), and update_last_draw_time().
|
private |
Definition at line 165 of file animation.hpp.
Referenced by matches().
|
private |
Definition at line 178 of file animation.hpp.
Referenced by add_frame(), animation_finished(), animation_finished_potential(), clear_haloes(), get_animation_time(), get_animation_time_potential(), get_begin_time(), get_current_frame_begin_time(), get_current_params(), get_end_time(), get_last_frame(), invalidate(), need_minimal_update(), need_update(), pause_animation(), redraw(), restart_animation(), set_max_animation_time(), start_animation(), time_to_tick(), and update_last_draw_time().
|
private |
Definition at line 166 of file animation.hpp.
Referenced by matches(), and unit_animation().
|
private |
Definition at line 176 of file animation.hpp.
Referenced by matches(), and unit_animation().
|
private |
Definition at line 172 of file animation.hpp.
Referenced by matches(), and unit_animation().