add a generic filter for all idle anims,

...to easily tweak the trigger conditions. This makes sure there are
no idle anims when poisoned
This commit is contained in:
Jérémy Rosen 2007-01-02 12:28:41 +00:00
parent a394195977
commit f01b6f24c4
27 changed files with 51 additions and 4 deletions

View file

@ -108,6 +108,7 @@ Detailed changelog and internal changes:
* healthy (+3HP, +4 rest healing), fearless (ignore unfavorable ToD)
* new units
* added the Armageddon Drake (not used in any mainline eras)
* added a generic macro to have a standard filter for all idle anim
* user interface
* use "Save Replay" instead of "Save Game" when asking to save a replay (bug #7256)
* fix enemy Gold show twice in debug mode in status table (bug #6895)

View file

@ -99,6 +99,7 @@ Special Notes:"+{SPECIAL_NOTES_BERSERK}
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -96,6 +96,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -120,6 +120,7 @@ Special Notes:"+{SPECIAL_NOTES_STEADFAST}
[/attack]
{DEFENSE_ANIM "units/dwarves/guard-defend.png" "units/dwarves/guard.png" {SOUND_LIST:DWARF_HIT} }
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -80,6 +80,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -98,6 +98,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -68,6 +68,7 @@ Special Notes:"+{SPECIAL_NOTES_BERSERK}
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -237,6 +237,7 @@
{DEFENSE_ANIM_RANGE "units/elves-wood/archer+female-bow-defend.png" "units/elves-wood/archer+female-bow.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged}
[/female]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -148,6 +148,7 @@ Special Notes:"+{SPECIAL_NOTES_POISON}
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -276,6 +276,7 @@ Some speculate that the existence of these creatures is the beginning of a failu
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=150

View file

@ -79,6 +79,7 @@ Wolves, likely, could never support the weight of a man in plate, but a goblin i
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -144,6 +144,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -169,6 +169,7 @@ Special Notes:"+{SPECIAL_NOTES_SKIRMISHER}
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -258,6 +258,7 @@ Special Notes:"+{SPECIAL_NOTES_FIRSTSTRIKE}
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -107,6 +107,7 @@ Special Notes:"+{SPECIAL_NOTES_LEADERSHIP}
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -118,6 +118,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=1000

View file

@ -111,6 +111,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -65,6 +65,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -138,6 +138,7 @@
[/attack]
[/female]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -154,6 +154,7 @@
[/attack]
[/female]
[idle_anim]
{STANDARD_IDLE_FILTER}
start_time=0
[frame]
duration=100

View file

@ -102,6 +102,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -85,6 +85,7 @@
[/attack]
[/female]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -65,6 +65,7 @@
[/attack]
{DEFENSE_ANIM "units/ogres/ogre-defend.png" "units/ogres/ogre.png" ogre-hit.wav }
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -292,6 +292,7 @@
[/animation]
[/attack]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -177,6 +177,7 @@ Special Notes:"+{SPECIAL_NOTES_SUBMERGE}
[/frame]
[/death]
[idle_anim]
{STANDARD_IDLE_FILTER}
[frame]
begin=0
end=100

View file

@ -343,3 +343,21 @@
image_diagonal="projectiles/fireball-nw-2.png"
[/missile_frame]
#enddef
#this macro is called on top of every idle animation, to provide a standard set of
#conditions to play the idle animation
#define STANDARD_IDLE_FILTER
#poisoned units hould have no idle animation
[unit_filter]
[not]
[wml_filter]
[status]
poisoned="yes"
[/status]
[/wml_filter]
[/not]
[/unit_filter]
#enddef

View file

@ -1665,7 +1665,8 @@ void unit::set_standing(const display &disp,const gamemap::location& loc, bool w
anim_ = new standing_animation(stand_animation(disp,loc));
anim_->start_animation(anim_->get_begin_time(),true,disp.turbo_speed());
frame_begin_time = anim_->get_begin_time() -1;
next_idling= SDL_GetTicks() +30000 +rand()%10000;
next_idling= SDL_GetTicks() +10000;
//next_idling= SDL_GetTicks() +10000 +rand()%10000;
}
void unit::set_defending(const display &disp,const gamemap::location& loc, int damage,const attack_type* attack,const attack_type* secondary_attack,int swing_num)
{
@ -1864,13 +1865,16 @@ void unit::set_walking(const display &disp,const gamemap::location& loc)
void unit::set_idling(const display &disp,const gamemap::location& loc)
{
const idle_animation * tmp = idling_animation(disp,loc);
if(!tmp) {
set_standing(disp,loc);
return;
}
state_ = STATE_IDLING;
draw_bars_ = true;
delete anim_;
const idle_animation * tmp = idling_animation(disp,loc);
if(!tmp) {set_standing(disp,loc) ; return; }
anim_ = new idle_animation(*tmp);
anim_->start_animation(anim_->get_begin_time(), false, disp.turbo_speed());
frame_begin_time = anim_->get_begin_time() -1;
@ -3083,7 +3087,7 @@ const idle_animation* unit::idling_animation(const display& disp, const gamemap:
{
//select one of the matching animations at random
std::vector<const idle_animation*> options;
int max_val = -1;
int max_val = 0;
for(std::vector<idle_animation>::const_iterator i = idle_animations_.begin(); i != idle_animations_.end(); ++i) {
int matching = i->matches(disp,loc,this);
if(matching == max_val) {