The Battle for Wesnoth  1.15.2+dev
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
unit_animation Class Reference

#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 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=hit_type::INVALID, const_attack_ptr attack=nullptr, const_attack_ptr second_attack=nullptr, int value2=0) const
 
const unit_frameget_last_frame () const
 
void add_frame (int 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 ()
 
int get_begin_time () const
 
int get_end_time () const
 
int time_to_tick (int animation_time) const
 
int get_animation_time () const
 
void set_max_animation_time (int time)
 
int get_animation_time_potential () 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 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 ()
 
int 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
 

Protected Member Functions

const frame_parameters get_current_params (const frame_parameters &default_val=frame_parameters()) const
 

Private Member Functions

 unit_animation (int 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< configunit_filter_
 
std::vector< configsecondary_unit_filter_
 
std::vector< map_location::DIRECTIONdirections_
 
int frequency_
 
int base_score_
 
std::vector< std::string > event_
 
std::vector< int > value_
 
std::vector< configprimary_attack_filter_
 
std::vector< configsecondary_attack_filter_
 
std::vector< hit_type > hits_
 
std::vector< int > value2_
 
std::map< std::string, particlesub_anims_
 
particle unit_anim_
 
map_location src_
 
map_location dst_
 
bool invalidated_
 
bool play_offscreen_
 
std::set< map_locationoverlaped_hex_
 

Friends

class unit
 
class unit_drawer
 
std::ostream & operator<< (std::ostream &outstream, const unit_animation &u_animation)
 

Detailed Description

Definition at line 28 of file animation.hpp.

Member Enumeration Documentation

◆ variation_type

Enumerator
MATCH_FAIL 
DEFAULT_ANIM 

Definition at line 34 of file animation.hpp.

Constructor & Destructor Documentation

◆ unit_animation() [1/3]

unit_animation::unit_animation ( )
delete

Referenced by get_current_params(), and matches().

◆ unit_animation() [2/3]

unit_animation::unit_animation ( const config cfg,
const std::string &  frame_string = "" 
)
explicit

◆ unit_animation() [3/3]

unit_animation::unit_animation ( int  start_time,
const unit_frame frame,
const std::string &  event = "",
const int  variation = DEFAULT_ANIM,
const frame_builder builder = frame_builder() 
)
explicitprivate

Definition at line 253 of file animation.cpp.

References add_frame(), unit_frame::does_not_change(), and unit_frame::duration().

Member Function Documentation

◆ add_frame()

void unit_animation::add_frame ( int  duration,
const unit_frame value,
bool  force_change = false 
)
inline

Definition at line 53 of file animation.hpp.

References animated< T >::add_frame(), and unit_anim_.

Referenced by unit_animation::particle::override(), and unit_animation().

◆ animation_finished()

bool unit_animation::animation_finished ( ) const

Definition at line 982 of file animation.cpp.

References animated< T >::animation_finished(), sub_anims_, and unit_anim_.

Referenced by get_flags().

◆ animation_finished_potential()

bool unit_animation::animation_finished_potential ( ) const

◆ clear_haloes()

void unit_animation::clear_haloes ( )

◆ debug()

std::string unit_animation::debug ( ) const

Definition at line 1148 of file animation.cpp.

Referenced by get_current_frame_begin_time().

◆ get_animation_time()

int unit_animation::get_animation_time ( ) const
inline

Definition at line 76 of file animation.hpp.

References animated< T >::get_animation_time(), and unit_anim_.

◆ get_animation_time_potential()

int unit_animation::get_animation_time_potential ( ) const
inline

◆ get_begin_time()

int unit_animation::get_begin_time ( ) const

◆ get_current_frame_begin_time()

int unit_animation::get_current_frame_begin_time ( ) const
inline

◆ get_current_params()

const frame_parameters unit_animation::get_current_params ( const frame_parameters default_val = frame_parameters()) const
inlineprotected

◆ get_end_time()

int unit_animation::get_end_time ( ) const

Definition at line 1011 of file animation.cpp.

References animated< T >::get_end_time(), sub_anims_, and unit_anim_.

Referenced by get_flags().

◆ get_flags()

std::vector<std::string> unit_animation::get_flags ( ) const
inline

◆ get_last_frame()

const unit_frame& unit_animation::get_last_frame ( ) const
inline

Definition at line 48 of file animation.hpp.

References animated< T >::get_last_frame(), and unit_anim_.

Referenced by unit_animation::particle::override().

◆ invalidate()

bool unit_animation::invalidate ( frame_parameters value)

◆ matches()

int unit_animation::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 = hit_type::INVALID,
const_attack_ptr  attack = nullptr,
const_attack_ptr  second_attack = nullptr,
int  value2 = 0 
) const

◆ need_minimal_update()

bool unit_animation::need_minimal_update ( ) const

◆ need_update()

bool unit_animation::need_update ( ) const

◆ pause_animation()

void unit_animation::pause_animation ( )

Definition at line 1063 of file animation.cpp.

References animated< T >::pause_animation(), sub_anims_, and unit_anim_.

Referenced by get_animation_time_potential().

◆ redraw()

void unit_animation::redraw ( frame_parameters value,
halo::manager halo_man 
)

◆ restart_animation()

void unit_animation::restart_animation ( )

Definition at line 1072 of file animation.cpp.

References animated< T >::restart_animation(), sub_anims_, and unit_anim_.

Referenced by get_animation_time_potential().

◆ set_max_animation_time()

void unit_animation::set_max_animation_time ( int  time)
inline

Definition at line 81 of file animation.hpp.

References animated< T >::set_max_animation_time(), and unit_anim_.

◆ start_animation()

void unit_animation::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 color_t  text_color = {0,0,0},
const bool  accelerate = true 
)

◆ time_to_tick()

int unit_animation::time_to_tick ( int  animation_time) const
inline

Definition at line 71 of file animation.hpp.

References animated< T >::time_to_tick(), and unit_anim_.

◆ update_last_draw_time()

void unit_animation::update_last_draw_time ( )

◆ update_parameters()

void unit_animation::update_parameters ( const map_location src,
const map_location dst 
)

Definition at line 1057 of file animation.cpp.

References dst_, and src_.

Referenced by get_animation_time_potential().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  outstream,
const unit_animation u_animation 
)
friend

Definition at line 1155 of file animation.cpp.

Referenced by get_current_frame_begin_time().

◆ unit

friend class unit
friend

Definition at line 112 of file animation.hpp.

◆ unit_drawer

friend class unit_drawer
friend

Definition at line 113 of file animation.hpp.

Member Data Documentation

◆ base_score_

int unit_animation::base_score_
private

Definition at line 178 of file animation.hpp.

Referenced by matches().

◆ directions_

std::vector<map_location::DIRECTION> unit_animation::directions_
private

Definition at line 176 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

◆ dst_

map_location unit_animation::dst_
private

Definition at line 189 of file animation.hpp.

Referenced by invalidate(), redraw(), start_animation(), and update_parameters().

◆ event_

std::vector<std::string> unit_animation::event_
private

Definition at line 179 of file animation.hpp.

Referenced by get_flags(), matches(), operator<<(), and unit_animation().

◆ frequency_

int unit_animation::frequency_
private

Definition at line 177 of file animation.hpp.

Referenced by matches(), and operator<<().

◆ hits_

std::vector<hit_type> unit_animation::hits_
private

Definition at line 183 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

◆ invalidated_

bool unit_animation::invalidated_
private

Definition at line 191 of file animation.hpp.

Referenced by invalidate(), and redraw().

◆ overlaped_hex_

std::set<map_location> unit_animation::overlaped_hex_
private

Definition at line 193 of file animation.hpp.

Referenced by invalidate(), and redraw().

◆ play_offscreen_

bool unit_animation::play_offscreen_
private

Definition at line 192 of file animation.hpp.

Referenced by need_minimal_update(), and unit_animation().

◆ primary_attack_filter_

std::vector<config> unit_animation::primary_attack_filter_
private

Definition at line 181 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

◆ secondary_attack_filter_

std::vector<config> unit_animation::secondary_attack_filter_
private

Definition at line 182 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

◆ secondary_unit_filter_

std::vector<config> unit_animation::secondary_unit_filter_
private

Definition at line 175 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

◆ src_

map_location unit_animation::src_
private

Definition at line 188 of file animation.hpp.

Referenced by invalidate(), redraw(), start_animation(), and update_parameters().

◆ sub_anims_

std::map<std::string,particle> unit_animation::sub_anims_
private

◆ terrain_types_

t_translation::ter_list unit_animation::terrain_types_
private

Definition at line 173 of file animation.hpp.

Referenced by matches(), and operator<<().

◆ unit_anim_

particle unit_animation::unit_anim_
private

◆ unit_filter_

std::vector<config> unit_animation::unit_filter_
private

Definition at line 174 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

◆ value2_

std::vector<int> unit_animation::value2_
private

Definition at line 184 of file animation.hpp.

Referenced by matches(), and unit_animation().

◆ value_

std::vector<int> unit_animation::value_
private

Definition at line 180 of file animation.hpp.

Referenced by matches(), and unit_animation().


The documentation for this class was generated from the following files: