mirror of
https://github.com/glest/glest-source.git
synced 2025-08-28 10:19:55 +02:00
bugfix for animation progress
This commit is contained in:
@@ -2043,13 +2043,28 @@ bool Unit::update() {
|
|||||||
}
|
}
|
||||||
if(getAnimProgressAsFloat() < targetProgress) {
|
if(getAnimProgressAsFloat() < targetProgress) {
|
||||||
float diff = targetProgress - getAnimProgressAsFloat();
|
float diff = targetProgress - getAnimProgressAsFloat();
|
||||||
this->animProgress = this->animProgress + static_cast<int>(diff * 100.f) / (GameConstants::updateFps);
|
int progressIncrease = this->animProgress + static_cast<int>(diff * 100.f) / (GameConstants::updateFps);
|
||||||
|
// Ensure we increment at least a value of 1 of the action will be stuck infinitely
|
||||||
|
if(diff > 0 && GameConstants::updateFps > 0 && progressIncrease == 0) {
|
||||||
|
progressIncrease = 1;
|
||||||
|
}
|
||||||
|
this->animProgress = progressIncrease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int speedDenominator = speedDivider *
|
int speedDenominator = speedDivider *
|
||||||
game->getWorld()->getUpdateFps(this->getFactionIndex());
|
game->getWorld()->getUpdateFps(this->getFactionIndex());
|
||||||
this->animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
|
int progressIncrease = (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
|
||||||
|
// Ensure we increment at least a value of 1 of the action will be stuck infinitely
|
||||||
|
if(currSkill->getAnimSpeed() > 0 && heightFactor > 0 && progressIncrease == 0) {
|
||||||
|
progressIncrease = 1;
|
||||||
|
}
|
||||||
|
this->animProgress += progressIncrease;
|
||||||
|
//this->animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
|
||||||
|
|
||||||
|
//if(currSkill->getClass() == scDie) {
|
||||||
|
// printf("Unit died progress: %d anim: %d\n",progress,this->animProgress);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
//update target
|
//update target
|
||||||
updateTarget();
|
updateTarget();
|
||||||
|
Reference in New Issue
Block a user