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:
parent
a394195977
commit
f01b6f24c4
27 changed files with 51 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -99,6 +99,7 @@ Special Notes:"+{SPECIAL_NOTES_BERSERK}
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -68,6 +68,7 @@ Special Notes:"+{SPECIAL_NOTES_BERSERK}
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -148,6 +148,7 @@ Special Notes:"+{SPECIAL_NOTES_POISON}
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -144,6 +144,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -169,6 +169,7 @@ Special Notes:"+{SPECIAL_NOTES_SKIRMISHER}
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -258,6 +258,7 @@ Special Notes:"+{SPECIAL_NOTES_FIRSTSTRIKE}
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -107,6 +107,7 @@ Special Notes:"+{SPECIAL_NOTES_LEADERSHIP}
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=1000
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -138,6 +138,7 @@
|
|||
[/attack]
|
||||
[/female]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -154,6 +154,7 @@
|
|||
[/attack]
|
||||
[/female]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
start_time=0
|
||||
[frame]
|
||||
duration=100
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
[/attack]
|
||||
[/female]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -292,6 +292,7 @@
|
|||
[/animation]
|
||||
[/attack]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -177,6 +177,7 @@ Special Notes:"+{SPECIAL_NOTES_SUBMERGE}
|
|||
[/frame]
|
||||
[/death]
|
||||
[idle_anim]
|
||||
{STANDARD_IDLE_FILTER}
|
||||
[frame]
|
||||
begin=0
|
||||
end=100
|
||||
|
|
|
@ -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
|
||||
|
|
12
src/unit.cpp
12
src/unit.cpp
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue