Author: boucman
Date: Fri Nov 2 00:09:38 2007
New Revision: 21398
URL: http://svn.gna.org/viewcvs/wesnoth?rev=21398&view=rev
Log:
add a specific animation when selecting a unit
Modified:
trunk/changelog
trunk/src/mouse_events.cpp
trunk/src/unit_animation.cpp
trunk/src/unit_display.cpp
trunk/src/unit_display.hpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=21398&r1=21397&r2=21398&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Fri Nov 2 00:09:38 2007
@@ -58,6 +58,8 @@
* Animation engine allow multiple type of frames (a la "missile frames")
for all types of anims, you can have multiple such anims using different
frame names
+ * a new type of animation is triggered when a unit is selected. (WML
+ support to come shortly)
* miscellaneous and bug fixes:
* added a new log domain 'mp_server'
* added a new log level 'debug'
Modified: trunk/src/mouse_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=21398&r1=21397&r2=21398&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Fri Nov 2 00:09:38 2007
@@ -29,6 +29,7 @@
#include "unit_abilities.hpp"
#include "wassert.hpp"
#include "wml_separators.hpp"
+#include "unit_display.hpp"
#include "sdl_utils.hpp"
#include <cstdlib>
@@ -1219,6 +1220,7 @@
paths::route route = get_route(u,
go_to, current_team());
gui_->set_route(&route);
}
+ unit_display::unit_selected(u->first);
sound::play_sound("select-unit.wav");
game_events::fire("select",hex);
} else {
Modified: trunk/src/unit_animation.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_animation.cpp?rev=21398&r1=21397&r2=21398&view=diff
==============================================================================
--- trunk/src/unit_animation.cpp (original)
+++ trunk/src/unit_animation.cpp Fri Nov 2 00:09:38 2007
@@ -284,6 +284,7 @@
for(anim_itor = parsed_animations.begin(); anim_itor !=
parsed_animations.end(); ++anim_itor) {
animations.push_back(unit_animation(**anim_itor));
}
+
animations.push_back(unit_animation(0,unit_frame(image::locator(cfg["image"]),100,"","",display::rgb(255,255,255),"1"),"selected",unit_animation::DEFAULT_ANIM));
expanded_cfg = unit_animation::prepare_animation(cfg,"leading_anim");
Modified: trunk/src/unit_display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_display.cpp?rev=21398&r1=21397&r2=21398&view=diff
==============================================================================
--- trunk/src/unit_display.cpp (original)
+++ trunk/src/unit_display.cpp Fri Nov 2 00:09:38 2007
@@ -417,4 +417,29 @@
disp->update_display();
events::pump();
}
+
+
+void unit_selected(gamemap::location& loc)
+{
+ game_display* disp = game_display::get_singleton();
+ if(!disp || disp->video().update_locked() ||disp->fogged(loc)) return;
+ unit_map::iterator u = disp->get_units().find(loc);
+ if(u == disp->get_units().end()) return;
+
+ u->second.set_hidden(true);
+ disp->scroll_to_tile(loc,game_display::ONSCREEN);
+ disp->draw();
+
u->second.start_animation(*disp,loc,u->second.choose_animation(*disp,loc,"selected"),true);
+ u->second.set_hidden(false);
+ while(!u->second.get_animation()->animation_finished()) {
+
+ disp->invalidate(loc);
+ disp->draw();
+ events::pump();
+ disp->delay(10);
+ }
+ u->second.set_standing(*disp,loc);
+ if (loc==disp->mouseover_hex()) disp->invalidate_unit();
+}
+
} // end unit_display namespace
Modified: trunk/src/unit_display.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_display.hpp?rev=21398&r1=21397&r2=21398&view=diff
==============================================================================
--- trunk/src/unit_display.hpp (original)
+++ trunk/src/unit_display.hpp Fri Nov 2 00:09:38 2007
@@ -48,6 +48,7 @@
const attack_type& attack, const attack_type*
secondary_attack,
int swing,std::string hit_text);
void unit_recruited(gamemap::location& loc);
+void unit_selected(gamemap::location& loc);
//! Set healer_loc to an invalid location if there are no healers.
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits