"anim-hp-bound" is now called "anim-progress-bound" and available for produce/morph/upgrade skills too! Deprecated "anim-hp-bound" will be dropped VERY soon!
This commit is contained in:
parent
9a6aca1bdc
commit
c21f07ec7d
|
@ -3068,7 +3068,7 @@ void Renderer::renderUnits(const int renderFps) {
|
||||||
|
|
||||||
//render
|
//render
|
||||||
Model *model= unit->getCurrentModelPtr();
|
Model *model= unit->getCurrentModelPtr();
|
||||||
model->updateInterpolationData(unit->getAnimProgress(), unit->isAlive() && !unit->isBeingBuiltWithAnimHpBound());
|
model->updateInterpolationData(unit->getAnimProgress(), unit->isAlive() && !unit->isAnimProgressBound());
|
||||||
|
|
||||||
modelRenderer->render(model);
|
modelRenderer->render(model);
|
||||||
triangleCount+= model->getTriangleCount();
|
triangleCount+= model->getTriangleCount();
|
||||||
|
@ -4733,7 +4733,7 @@ void Renderer::renderUnitsFast(bool renderingShadows) {
|
||||||
|
|
||||||
//render
|
//render
|
||||||
Model *model= unit->getCurrentModelPtr();
|
Model *model= unit->getCurrentModelPtr();
|
||||||
model->updateInterpolationVertices(unit->getAnimProgress(), unit->isAlive() && !unit->isBeingBuiltWithAnimHpBound());
|
model->updateInterpolationVertices(unit->getAnimProgress(), unit->isAlive() && !unit->isAnimProgressBound());
|
||||||
modelRenderer->render(model);
|
modelRenderer->render(model);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
@ -487,6 +487,17 @@ int Unit::getProductionPercent() const{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Unit::getProgressRatio() const{
|
||||||
|
if(anyCommand()){
|
||||||
|
const ProducibleType *produced= commands.front()->getCommandType()->getProduced();
|
||||||
|
if(produced!=NULL){
|
||||||
|
float help=progress2;
|
||||||
|
return clamp(help/produced->getProductionTime(), 0.f, 1.f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
float Unit::getHpRatio() const {
|
float Unit::getHpRatio() const {
|
||||||
if(type == NULL) {
|
if(type == NULL) {
|
||||||
char szBuf[4096]="";
|
char szBuf[4096]="";
|
||||||
|
@ -550,7 +561,7 @@ bool Unit::isOperative() const{
|
||||||
return isAlive() && isBuilt();
|
return isAlive() && isBuilt();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::isBeingBuiltWithAnimHpBound() const{
|
bool Unit::isAnimProgressBound() const{
|
||||||
if(currSkill == NULL) {
|
if(currSkill == NULL) {
|
||||||
char szBuf[4096]="";
|
char szBuf[4096]="";
|
||||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||||
|
@ -559,9 +570,27 @@ bool Unit::isBeingBuiltWithAnimHpBound() const{
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if(currSkill->getClass() == scBeBuilt) {
|
if(currSkill->getClass() == scBeBuilt) {
|
||||||
const BeBuiltSkillType *bbst = dynamic_cast<const BeBuiltSkillType*>(currSkill);
|
const BeBuiltSkillType *skill = dynamic_cast<const BeBuiltSkillType*>(currSkill);
|
||||||
if(bbst != NULL) {
|
if(skill != NULL) {
|
||||||
result = bbst->getAnimHpBound();
|
result = skill->getAnimProgressBound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(currSkill->getClass() == scProduce) {
|
||||||
|
const ProduceSkillType *skill = dynamic_cast<const ProduceSkillType*>(currSkill);
|
||||||
|
if(skill != NULL) {
|
||||||
|
result = skill->getAnimProgressBound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(currSkill->getClass() == scUpgrade) {
|
||||||
|
const UpgradeSkillType *skill = dynamic_cast<const UpgradeSkillType*>(currSkill);
|
||||||
|
if(skill != NULL) {
|
||||||
|
result = skill->getAnimProgressBound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(currSkill->getClass() == scMorph) {
|
||||||
|
const MorphSkillType *skill = dynamic_cast<const MorphSkillType*>(currSkill);
|
||||||
|
if(skill != NULL) {
|
||||||
|
result = skill->getAnimProgressBound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1336,8 +1365,11 @@ bool Unit::update() {
|
||||||
float speedDenominator = (speedDivider * game->getWorld()->getUpdateFps(this->getFactionIndex()));
|
float speedDenominator = (speedDivider * game->getWorld()->getUpdateFps(this->getFactionIndex()));
|
||||||
progress += (speed * diagonalFactor * heightFactor) / speedDenominator;
|
progress += (speed * diagonalFactor * heightFactor) / speedDenominator;
|
||||||
|
|
||||||
if(isBeingBuiltWithAnimHpBound() == true) {
|
if(isAnimProgressBound() == true) {
|
||||||
animProgress=this->getHpRatio();
|
if(currSkill->getClass() == scBeBuilt) animProgress = this->getHpRatio();
|
||||||
|
if(currSkill->getClass() == scProduce) animProgress = this->getProgressRatio();
|
||||||
|
if(currSkill->getClass() == scUpgrade) animProgress = this->getProgressRatio();
|
||||||
|
if(currSkill->getClass() == scMorph) animProgress = this->getProgressRatio();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
|
animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
|
||||||
|
|
|
@ -404,6 +404,7 @@ public:
|
||||||
int getHp() const {return hp;}
|
int getHp() const {return hp;}
|
||||||
int getEp() const {return ep;}
|
int getEp() const {return ep;}
|
||||||
int getProductionPercent() const;
|
int getProductionPercent() const;
|
||||||
|
float getProgressRatio() const;
|
||||||
float getHpRatio() const;
|
float getHpRatio() const;
|
||||||
float getEpRatio() const;
|
float getEpRatio() const;
|
||||||
bool getToBeUndertaken() const {return toBeUndertaken;}
|
bool getToBeUndertaken() const {return toBeUndertaken;}
|
||||||
|
@ -443,7 +444,7 @@ public:
|
||||||
bool isOperative() const;
|
bool isOperative() const;
|
||||||
bool isBeingBuilt() const;
|
bool isBeingBuilt() const;
|
||||||
bool isBuilt() const;
|
bool isBuilt() const;
|
||||||
bool isBeingBuiltWithAnimHpBound() const;
|
bool isAnimProgressBound() const;
|
||||||
bool isPutrefacting() const;
|
bool isPutrefacting() const;
|
||||||
bool isAlly(const Unit *unit) const;
|
bool isAlly(const Unit *unit) const;
|
||||||
bool isDamaged() const;
|
bool isDamaged() const;
|
||||||
|
|
|
@ -588,6 +588,20 @@ ProduceSkillType::ProduceSkillType(){
|
||||||
skillClass= scProduce;
|
skillClass= scProduce;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProduceSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
string parentLoader) {
|
||||||
|
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
||||||
|
|
||||||
|
if(sn->hasChild("anim-progress-bound")){
|
||||||
|
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
animProgressBound=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string ProduceSkillType::toString() const{
|
string ProduceSkillType::toString() const{
|
||||||
return Lang::getInstance().get("Produce");
|
return Lang::getInstance().get("Produce");
|
||||||
}
|
}
|
||||||
|
@ -606,6 +620,19 @@ UpgradeSkillType::UpgradeSkillType(){
|
||||||
skillClass= scUpgrade;
|
skillClass= scUpgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpgradeSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
string parentLoader) {
|
||||||
|
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
||||||
|
|
||||||
|
if(sn->hasChild("anim-progress-bound")){
|
||||||
|
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
animProgressBound=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string UpgradeSkillType::toString() const{
|
string UpgradeSkillType::toString() const{
|
||||||
return Lang::getInstance().get("Upgrade");
|
return Lang::getInstance().get("Upgrade");
|
||||||
}
|
}
|
||||||
|
@ -629,11 +656,14 @@ void BeBuiltSkillType::load(const XmlNode *sn, const string &dir, const TechTree
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
||||||
|
|
||||||
if(sn->hasChild("anim-hp-bound")){
|
if(sn->hasChild("anim-progress-bound")){
|
||||||
animHpBound= sn->getChild("anim-hp-bound")->getAttribute("value")->getBoolValue();
|
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
|
||||||
|
}
|
||||||
|
else if(sn->hasChild("anim-hp-bound")){ // deprecated!!!! remove it when you see it after 15th July 2011
|
||||||
|
animProgressBound= sn->getChild("anim-hp-bound")->getAttribute("value")->getBoolValue();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
animHpBound=false;
|
animProgressBound=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,6 +680,19 @@ MorphSkillType::MorphSkillType(){
|
||||||
skillClass= scMorph;
|
skillClass= scMorph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MorphSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
string parentLoader) {
|
||||||
|
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
||||||
|
|
||||||
|
if(sn->hasChild("anim-progress-bound")){
|
||||||
|
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
animProgressBound=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string MorphSkillType::toString() const{
|
string MorphSkillType::toString() const{
|
||||||
return "Morph";
|
return "Morph";
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,8 +278,15 @@ public:
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
||||||
class ProduceSkillType: public SkillType{
|
class ProduceSkillType: public SkillType{
|
||||||
|
private:
|
||||||
|
bool animProgressBound;
|
||||||
public:
|
public:
|
||||||
ProduceSkillType();
|
ProduceSkillType();
|
||||||
|
bool getAnimProgressBound() const {return animProgressBound;}
|
||||||
|
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
string parentLoader);
|
||||||
|
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
|
|
||||||
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
@ -290,8 +297,15 @@ public:
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
||||||
class UpgradeSkillType: public SkillType{
|
class UpgradeSkillType: public SkillType{
|
||||||
|
private:
|
||||||
|
bool animProgressBound;
|
||||||
public:
|
public:
|
||||||
UpgradeSkillType();
|
UpgradeSkillType();
|
||||||
|
bool getAnimProgressBound() const {return animProgressBound;}
|
||||||
|
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
string parentLoader);
|
||||||
|
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
|
|
||||||
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
@ -304,11 +318,11 @@ public:
|
||||||
|
|
||||||
class BeBuiltSkillType: public SkillType{
|
class BeBuiltSkillType: public SkillType{
|
||||||
private:
|
private:
|
||||||
bool animHpBound;
|
bool animProgressBound;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BeBuiltSkillType();
|
BeBuiltSkillType();
|
||||||
bool getAnimHpBound() const {return animHpBound;}
|
bool getAnimProgressBound() const {return animProgressBound;}
|
||||||
|
|
||||||
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
@ -321,10 +335,18 @@ public:
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
||||||
class MorphSkillType: public SkillType{
|
class MorphSkillType: public SkillType{
|
||||||
|
private:
|
||||||
|
bool animProgressBound;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MorphSkillType();
|
MorphSkillType();
|
||||||
virtual string toString() const;
|
bool getAnimProgressBound() const {return animProgressBound;}
|
||||||
|
|
||||||
|
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
string parentLoader);
|
||||||
|
|
||||||
|
virtual string toString() const;
|
||||||
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue