Author: alink
Date: Sat Nov  3 18:54:59 2007
New Revision: 21468

URL: http://svn.gna.org/viewcvs/wesnoth?rev=21468&view=rev
Log:
Make select anim works exactly like idle anim (in background of inputs)
This fix a severe UI blocking if you move a unit playing its select anim
It will be easy to adapt when fire&forget anims will be ready
Also start to play the unit-select sound before starting the select anim

Modified:
    trunk/src/mouse_events.cpp
    trunk/src/unit.cpp
    trunk/src/unit.hpp

Modified: trunk/src/mouse_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=21468&r1=21467&r2=21468&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Sat Nov  3 18:54:59 2007
@@ -1220,8 +1220,8 @@
                                        paths::route route = get_route(u, 
go_to, current_team());
                                        gui_->set_route(&route);
                                }
-                               unit_display::unit_selected(u->first);
                                sound::play_UI_sound("select-unit.wav");
+                               u->second.set_selecting(*gui_, u->first);
                                game_events::fire("select",hex);
                        } else {
                                unit_movement_resetter move_reset(u->second);

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=21468&r1=21467&r2=21468&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sat Nov  3 18:54:59 2007
@@ -1609,6 +1609,12 @@
 {
        state_ = STATE_IDLING;
        start_animation(disp,loc,choose_animation(disp,loc,"idling"),true);
+}
+
+void unit::set_selecting(const game_display &disp,const gamemap::location& loc)
+{
+       state_ = STATE_SELECTING;
+       start_animation(disp,loc,choose_animation(disp,loc,"selected"),true);
 }
 
 void unit::start_animation(const game_display &disp, const gamemap::location 
&loc,const unit_animation * animation,bool with_bars,bool cycles)

Modified: trunk/src/unit.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=21468&r1=21467&r2=21468&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Sat Nov  3 18:54:59 2007
@@ -124,7 +124,7 @@
        void new_level();
        //! Called on every draw
        void refresh(const game_display& disp,const gamemap::location& loc) {
-               if (state_ == STATE_IDLING && anim_ && 
anim_->animation_would_finish()) {
+               if ((state_ == STATE_IDLING || state_ == STATE_SELECTING) && 
anim_ && anim_->animation_would_finish()) {
                        set_standing(disp, loc);
                        return;
                }
@@ -190,6 +190,7 @@
        void set_victorious(const game_display &disp,const gamemap::location& 
loc,const attack_type* attack,const attack_type* secondary_attack);
        void set_poisoned(const game_display& disp,const gamemap::location& 
loc,int damage);
        void set_idling(const game_display& disp,const gamemap::location& loc);
+       void set_selecting(const game_display& disp,const gamemap::location& 
loc);
        void restart_animation(const game_display& disp,int start_time, bool 
cycles = false);
        const unit_animation* get_animation() const {  return anim_;};
        void set_offset(double offset){offset_ = offset;}
@@ -248,7 +249,7 @@
                                STATE_LEVELIN, STATE_LEVELOUT,
                                STATE_DYING, STATE_EXTRA, STATE_TELEPORT,
                                STATE_RECRUITED, STATE_HEALED, STATE_POISONED,
-                               STATE_IDLEIN, STATE_IDLING, STATE_VICTORIOUS};
+                               STATE_IDLING, STATE_SELECTING, 
STATE_VICTORIOUS};
        void start_animation(const game_display &disp, const gamemap::location 
&loc,const unit_animation* animation, bool with_bars,bool cycles=false);
 
        //! The name of the file to game_display (used in menus).


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to