Author: alink
Date: Sat Nov 3 17:45:29 2007
New Revision: 21465
URL: http://svn.gna.org/viewcvs/wesnoth?rev=21465&view=rev
Log:
- udpdate the anim before rendering it (but continue to avoid skipping frames)
This fix a off-by-one frame bug in few cases where the update is not automatic
(e.g. last frame of idle anim was sometimes missed)
- now a starting anim is considered as a change and so in need_update state
- fix some inconsitencies with the use of update_last_draw_time()
Modified:
trunk/src/animated.hpp
trunk/src/animated.i
trunk/src/halo.cpp
trunk/src/unit.cpp
Modified: trunk/src/animated.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/animated.hpp?rev=21465&r1=21464&r2=21465&view=diff
==============================================================================
--- trunk/src/animated.hpp (original)
+++ trunk/src/animated.hpp Sat Nov 3 17:45:29 2007
@@ -104,6 +104,7 @@
bool does_not_change_; // Optimization for 1-frame permanent animations
bool started_;
+ bool need_first_update_;
std::vector<frame> frames_;
// These are only valid when anim is started
Modified: trunk/src/animated.i
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/animated.i?rev=21465&r1=21464&r2=21465&view=diff
==============================================================================
--- trunk/src/animated.i (original)
+++ trunk/src/animated.i Sat Nov 3 17:45:29 2007
@@ -47,6 +47,7 @@
starting_frame_time_(start_time),
does_not_change_(true),
started_(false),
+ need_first_update_(false),
start_tick_(0),
cycles_(false),
acceleration_(1),
@@ -61,6 +62,7 @@
starting_frame_time_(start_time),
does_not_change_(true),
started_(false),
+ need_first_update_(false),
start_tick_(0),
cycles_(false),
acceleration_(1),
@@ -102,7 +104,8 @@
acceleration_ = acceleration;
if(acceleration_ <=0) acceleration_ = 1;
current_frame_key_= 0;
- update_last_draw_time();
+ need_first_update_ = !frames_.empty();
+ //update_last_draw_time();
// need to force last frame key in the case of starting anim...
last_frame_key_ = -1;
}
@@ -113,6 +116,10 @@
{
last_update_tick_ = current_ticks;
last_frame_key_ = current_frame_key_;
+ if (need_first_update_) {
+ need_first_update_ = false;
+ return;
+ }
if(does_not_change_)
return;
@@ -141,6 +148,9 @@
template<typename T, typename T_void_value>
bool animated<T,T_void_value>::need_update() const
{
+ if(need_first_update_) {
+ return true;
+ }
if(does_not_change_) {
return false;
}
Modified: trunk/src/halo.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/halo.cpp?rev=21465&r1=21464&r2=21465&view=diff
==============================================================================
--- trunk/src/halo.cpp (original)
+++ trunk/src/halo.cpp Sat Nov 3 17:45:29 2007
@@ -107,9 +107,6 @@
images_.start_animation(0,infinite);
- if(!images_.animation_finished()) {
- images_.update_last_draw_time();
- }
}
void effect::set_location(int x, int y)
Modified: trunk/src/unit.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=21465&r1=21464&r2=21465&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sat Nov 3 17:45:29 2007
@@ -1681,6 +1681,7 @@
if(!anim_) {
set_standing(disp,loc);
}
+ anim_->update_last_draw_time();
if(frame_begin_time_ != anim_->get_current_frame_begin_time()) {
frame_begin_time_ = anim_->get_current_frame_begin_time();
@@ -1877,7 +1878,6 @@
anim_->redraw();
refreshing_ = false;
- anim_->update_last_draw_time();
}
void unit::clear_haloes()
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits