Author: boucman
Date: Thu Mar 20 21:37:38 2008
New Revision: 24910
URL: http://svn.gna.org/viewcvs/wesnoth?rev=24910&view=rev
Log:
new animation parameter: submerge. Not really usefull, but needed for future
refactoring
Modified:
trunk/changelog
trunk/src/unit.cpp
trunk/src/unit_animation.cpp
trunk/src/unit_frame.cpp
trunk/src/unit_frame.hpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=24910&r1=24909&r2=24910&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Thu Mar 20 21:37:38 2008
@@ -94,6 +94,7 @@
* clean up gcc 4.3 warnings so the game now builds on fedora rawhide
with warnings treated as errors. A few of bugs were found in the
process as well.
+ * new progressive parameter for animations : submerge
Version 1.4:
* language and i18n:
Modified: trunk/src/unit.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=24910&r1=24909&r2=24910&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Thu Mar 20 21:37:38 2008
@@ -1672,7 +1672,6 @@
const t_translation::t_terrain terrain = map.get_terrain(loc);
const terrain_type& terrain_info = map.get_terrain_info(terrain);
- const double submerge = is_flying() ? 0.0 :
terrain_info.unit_submerge();
int height_adjust = static_cast<int>(terrain_info.unit_height_adjust()
* disp.get_zoom_factor());
if (is_flying() && height_adjust < 0) {
height_adjust = 0;
@@ -1684,6 +1683,8 @@
}
anim_->update_last_draw_time();
const frame_parameters params = anim_->get_current_params();
+ double submerge = params.submerge;
+ if(!submerge) submerge= is_flying() ? 0.0 :
terrain_info.unit_submerge();
if(frame_begin_time_ != anim_->get_current_frame_begin_time()) {
frame_begin_time_ = anim_->get_current_frame_begin_time();
Modified: trunk/src/unit_animation.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_animation.cpp?rev=24910&r1=24909&r2=24910&view=diff
==============================================================================
--- trunk/src/unit_animation.cpp (original)
+++ trunk/src/unit_animation.cpp Thu Mar 20 21:37:38 2008
@@ -731,6 +731,7 @@
{
halo::remove(halo_id_);
halo_id_ = halo::NO_HALO;
+ parameters_.duration(get_animation_duration());
animated<unit_frame>::start_animation(start_time,cycles);
last_frame_begin_time_ = get_begin_time() -1;
if(src != gamemap::location::null_location || dst !=
gamemap::location::null_location) {
Modified: trunk/src/unit_frame.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_frame.cpp?rev=24910&r1=24909&r2=24910&view=diff
==============================================================================
--- trunk/src/unit_frame.cpp (original)
+++ trunk/src/unit_frame.cpp Thu Mar 20 21:37:38 2008
@@ -183,6 +183,7 @@
}
highlight(cfg[frame_string+"alpha"]);
offset(cfg[frame_string+"offset"]);
+ submerge(cfg[frame_string+"submerge"]);
}
@@ -202,6 +203,7 @@
result.blend_ratio =
blend_ratio_.get_current_element(current_time,default_val.blend_ratio);
result.highlight_ratio =
highlight_ratio_.get_current_element(current_time,default_val.highlight_ratio);
result.offset =
offset_.get_current_element(current_time,default_val.offset);
+ result.submerge =
submerge_.get_current_element(current_time,default_val.submerge);
return result;
}
frame_builder & frame_builder::image(const image::locator image )
@@ -235,13 +237,18 @@
frame_builder & frame_builder::duration(const int duration)
{
duration_= duration;
+ recalculate_duration();
+ return *this;
+}
+void frame_builder::recalculate_duration()
+{
halo_ = progressive_string(halo_.get_original(),duration_);
halo_x_ = progressive_int(halo_x_.get_original(),duration_);
halo_y_ = progressive_int(halo_y_.get_original(),duration_);
blend_ratio_=progressive_double(blend_ratio_.get_original(),duration_);
highlight_ratio_=progressive_double(highlight_ratio_.get_original(),duration_);
offset_=progressive_double(offset_.get_original(),duration_);
- return *this;
+ submerge_=progressive_double(submerge_.get_original(),duration_);
}
frame_builder & frame_builder::blend(const std::string& blend_ratio,const
Uint32 blend_color)
{
@@ -257,6 +264,11 @@
frame_builder & frame_builder::offset(const std::string& offset)
{
offset_=progressive_double(offset,duration_);
+ return *this;
+}
+frame_builder & frame_builder::submerge(const std::string& submerge)
+{
+ submerge_=progressive_double(submerge,duration_);
return *this;
}
bool frame_builder::does_not_change() const
@@ -266,7 +278,8 @@
halo_y_.does_not_change() &&
blend_ratio_.does_not_change() &&
highlight_ratio_.does_not_change() &&
- offset_.does_not_change();
+ offset_.does_not_change() &&
+ submerge_.does_not_change();
}
bool frame_builder::need_update() const
{
@@ -275,7 +288,8 @@
!halo_y_.does_not_change() ||
!blend_ratio_.does_not_change() ||
!highlight_ratio_.does_not_change() ||
- !offset_.does_not_change() ) {
+ !offset_.does_not_change() ||
+ !submerge_.does_not_change() ) {
return true;
}
return false;
@@ -326,7 +340,7 @@
bool facing_west = direction == gamemap::location::NORTH_WEST
|| direction == gamemap::location::SOUTH_WEST;
bool facing_north = direction == gamemap::location::NORTH_WEST
|| direction == gamemap::location::NORTH || direction ==
gamemap::location::NORTH_EAST;
game_display::get_singleton()->render_unit_image(x- image->w/2,
y - image->h/2, false, gamemap::get_drawing_order(src), image, facing_west,
false,
- ftofxp(current_data.highlight_ratio),
current_data.blend_with, current_data.blend_ratio,0,!facing_north);
+ ftofxp(current_data.highlight_ratio),
current_data.blend_with,
current_data.blend_ratio,current_data.submerge,!facing_north);
}
halo::remove(*halo_id);
*halo_id = halo::NO_HALO;
Modified: trunk/src/unit_frame.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_frame.hpp?rev=24910&r1=24909&r2=24910&view=diff
==============================================================================
--- trunk/src/unit_frame.hpp (original)
+++ trunk/src/unit_frame.hpp Thu Mar 20 21:37:38 2008
@@ -78,7 +78,8 @@
blend_with(0),
blend_ratio(0.0),
highlight_ratio(1.0),
- offset(0)
+ offset(0),
+ submerge(0.0)
{};
image::locator image;
@@ -94,6 +95,7 @@
double blend_ratio;
double highlight_ratio;
double offset;
+ double submerge;
} ;
//! keep most parameters in a separate class to simplify handling of large
number of parameters
class frame_builder {
@@ -112,7 +114,8 @@
blend_with_(0),
blend_ratio_(""),
highlight_ratio_(""),
- offset_("")
+ offset_(""),
+ submerge_("")
{};
frame_builder(const config& cfg,const std::string &frame_string
= "");
//! allow easy chained modifications will raised assert if used
after initialization
@@ -125,10 +128,12 @@
frame_builder & blend(const std::string& blend_ratio,const
Uint32 blend_color);
frame_builder & highlight(const std::string& highlight);
frame_builder & offset(const std::string& offset);
+ frame_builder & submerge(const std::string& submerge);
//! getters for the different parameters
const frame_parameters parameters(int current_time, const
frame_parameters & default_val = frame_parameters()) const;
int duration() const{ return duration_;};
+ void recalculate_duration();
bool does_not_change() const;
bool need_update() const;
private:
@@ -145,6 +150,7 @@
progressive_double blend_ratio_;
progressive_double highlight_ratio_;
progressive_double offset_;
+ progressive_double submerge_;
};
//! Describe a unit's animation sequence.
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits