30 std::vector<const unit_animation*>
options;
33 int matching =
i->matches(disp,loc,second_loc,&
u_,event,value,hit,attack,second_attack,swing_num);
35 options.push_back(&*
i);
36 }
else if(matching > max_val) {
39 options.push_back(&*
i);
46 return options[rand()%options.size()];
66 anim_->pause_animation();
111 const int real_start_time = start_time == INT_MAX ?
anim_->get_begin_time() : start_time;
113 text, text_color, accelerate);
117 +
static_cast<int>((20000 + rand() % 20000) * disp->
idle_anim_rate());
141 +
static_cast<int>((20000 + rand() % 20000) * disp.
idle_anim_rate());
171 params.
y -= height_adjust;
172 params.
halo_y -= height_adjust;
195 if(effect[
"id"].empty()) {
198 static std::map< std::string, std::vector<unit_animation> > animation_cache;
199 std::vector<unit_animation> &built = animation_cache[effect[
"id"]];
std::string image_mods() const
bool refreshing_
avoid infinite recursion. flag used for drawing / animation
static display * get_singleton()
Returns the display object if a display object exists.
const unit & u_
A reference to the unit that owns this object.
std::string TC_image_mods() const
void set_disabled_ghosted(bool with_bars=true)
Whiteboard related somehow.
static void add_anims(std::vector< unit_animation > &animations, const config &cfg)
void set_selecting()
Sets the animation state to that when the unit is selected.
map_location::DIRECTION facing_
bool tile_nearly_on_screen(const map_location &loc) const
Checks if location loc or one of the adjacent tiles is visible on screen.
bool draw_bars_
bool indicating whether to draw bars with the unit
double get_zoom_factor() const
Returns the current zoom factor.
const std::vector< unit_animation > & animations() const
All parameters from a frame at a given instant.
double idle_anim_rate() const
Definitions for the interface to Wesnoth Markup Language (WML).
void refresh()
Intermittently activates the idling animations in place of the standing animations.
int frame_begin_time_
time for the frame to begin
int unit_height_adjust() const
bool incapacitated() const
void clear_haloes()
Clear the haloes associated to the unit.
unit_animation * get_animation() const
Get a pointer to the current animation.
GLsizei const GLfloat * value
Encapsulates the map of the game.
STATE state_
animation state
int get_current_animation_tick()
bool invalidate(const display &disp)
Invalidates an animation with respect to a display object, preparing it for redraw.
map_display and display: classes which take care of displaying the map and game-data on the screen...
bool show_standing_animations()
static const ::config * terrain
The terrain used to create the cache.
boost::scoped_ptr< unit_animation > anim_
The current animation.
STATE
States for animation.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Encapsulates the map of the game.
const terrain_type & get_terrain_info(const t_translation::t_terrain &terrain) const
void set_idling()
Sets the animation state to idling.
std::string default_anim_image() const
The default image to use for animation frames with no defined image.
void start_animation(int start_time, const unit_animation *animation, bool with_bars, const std::string &text="", Uint32 text_color=0, STATE state=STATE_ANIM)
Begin an animation.
void apply_new_animation_effect(const config &effect)
Adds an animation described by a config.
t_translation::t_terrain get_terrain(const map_location &loc) const
Looks up terrain at a particular location.
std::vector< unit_animation > animations_
List of registered animations for this unit.
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.
map_location get_direction(DIRECTION d, unsigned int n=1u) const
halo::handle unit_halo_
handle to the halo of this unit
void set_standing(bool with_bars=true)
Sets the animation state to standing.
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
void set_ghosted(bool with_bars=true)
Sets the animation state to ghosted.
void reset_after_advance(const unit_type *newtype=nullptr)
Resets the animations list after the unit is advanced.
int next_idling_
time for next idle animation
bool invalidate(frame_parameters &value)
boost::shared_ptr< halo_record > handle