- bugfix for hpanim on bebuilt, to interplotate out the last reset frames
This commit is contained in:
parent
b8766a9388
commit
14c70966b0
|
@ -526,6 +526,9 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
||||||
|
|
||||||
//printf("anim [%f] particleLoopStart [%d]\n",anim,particleLoopStart);
|
//printf("anim [%f] particleLoopStart [%d]\n",anim,particleLoopStart);
|
||||||
|
|
||||||
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
|
|
||||||
renderer->renderTheModel(model, anim);
|
renderer->renderTheModel(model, anim);
|
||||||
|
|
||||||
int updateLoops = particleLoopStart;
|
int updateLoops = particleLoopStart;
|
||||||
|
@ -628,7 +631,7 @@ void MainWindow::onMouseWheelDown(wxMouseEvent &event) {
|
||||||
zoom*= 1.1f;
|
zoom*= 1.1f;
|
||||||
zoom= clamp(zoom, 0.1f, 10.0f);
|
zoom= clamp(zoom, 0.1f, 10.0f);
|
||||||
|
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
|
|
||||||
onPaint(paintEvent);
|
onPaint(paintEvent);
|
||||||
|
@ -645,7 +648,7 @@ void MainWindow::onMouseWheelUp(wxMouseEvent &event) {
|
||||||
zoom*= 0.90909f;
|
zoom*= 0.90909f;
|
||||||
zoom= clamp(zoom, 0.1f, 10.0f);
|
zoom= clamp(zoom, 0.1f, 10.0f);
|
||||||
|
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
|
|
||||||
onPaint(paintEvent);
|
onPaint(paintEvent);
|
||||||
|
@ -667,7 +670,7 @@ void MainWindow::onMouseMove(wxMouseEvent &event){
|
||||||
rotX+= clamp(lastX-x, -10, 10);
|
rotX+= clamp(lastX-x, -10, 10);
|
||||||
rotY+= clamp(lastY-y, -10, 10);
|
rotY+= clamp(lastY-y, -10, 10);
|
||||||
|
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
|
|
||||||
onPaint(paintEvent);
|
onPaint(paintEvent);
|
||||||
|
@ -676,7 +679,7 @@ void MainWindow::onMouseMove(wxMouseEvent &event){
|
||||||
zoom*= 1.0f+(lastX-x+lastY-y)/100.0f;
|
zoom*= 1.0f+(lastX-x+lastY-y)/100.0f;
|
||||||
zoom= clamp(zoom, 0.1f, 10.0f);
|
zoom= clamp(zoom, 0.1f, 10.0f);
|
||||||
|
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
|
|
||||||
onPaint(paintEvent);
|
onPaint(paintEvent);
|
||||||
|
@ -1136,7 +1139,7 @@ void MainWindow::loadModel(string path) {
|
||||||
model= tmpModel;
|
model= tmpModel;
|
||||||
|
|
||||||
statusbarText = getModelInfo();
|
statusbarText = getModelInfo();
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
if(timer) timer->Start(100);
|
if(timer) timer->Start(100);
|
||||||
titlestring = extractFileFromDirectoryPath(modelPath) + " - "+ titlestring;
|
titlestring = extractFileFromDirectoryPath(modelPath) + " - "+ titlestring;
|
||||||
|
@ -1486,7 +1489,7 @@ void MainWindow::onMenuSpeedSlower(wxCommandEvent &event){
|
||||||
speed = 0;
|
speed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
|
@ -1502,7 +1505,7 @@ void MainWindow::onMenuSpeedFaster(wxCommandEvent &event){
|
||||||
speed = 1;
|
speed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0 ) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0 ) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
|
@ -1703,7 +1706,7 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
speed = 1.0;
|
speed = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1712,7 +1715,7 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
if(speed < 0) {
|
if(speed < 0) {
|
||||||
speed = 0;
|
speed = 0;
|
||||||
}
|
}
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " anim value: " + floatToStr(anim) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
}
|
}
|
||||||
else if (e.GetKeyCode() == 'W') {
|
else if (e.GetKeyCode() == 'W') {
|
||||||
|
|
|
@ -3020,7 +3020,7 @@ void Renderer::renderUnits(const int renderFps) {
|
||||||
|
|
||||||
//render
|
//render
|
||||||
Model *model= unit->getCurrentModelPtr();
|
Model *model= unit->getCurrentModelPtr();
|
||||||
model->updateInterpolationData(unit->getAnimProgress(), unit->isAlive());
|
model->updateInterpolationData(unit->getAnimProgress(), unit->isAlive() && !unit->isBeingBuiltWithAnimHpBound());
|
||||||
|
|
||||||
modelRenderer->render(model);
|
modelRenderer->render(model);
|
||||||
triangleCount+= model->getTriangleCount();
|
triangleCount+= model->getTriangleCount();
|
||||||
|
@ -4658,7 +4658,7 @@ void Renderer::renderUnitsFast(bool renderingShadows) {
|
||||||
|
|
||||||
//render
|
//render
|
||||||
Model *model= unit->getCurrentModelPtr();
|
Model *model= unit->getCurrentModelPtr();
|
||||||
model->updateInterpolationVertices(unit->getAnimProgress(), unit->isAlive());
|
model->updateInterpolationVertices(unit->getAnimProgress(), unit->isAlive() && !unit->isBeingBuiltWithAnimHpBound());
|
||||||
modelRenderer->render(model);
|
modelRenderer->render(model);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
@ -528,6 +528,23 @@ bool Unit::isOperative() const{
|
||||||
return isAlive() && isBuilt();
|
return isAlive() && isBuilt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Unit::isBeingBuiltWithAnimHpBound() const{
|
||||||
|
if(currSkill == NULL) {
|
||||||
|
char szBuf[4096]="";
|
||||||
|
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||||
|
throw runtime_error(szBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
if(currSkill->getClass() == scBeBuilt) {
|
||||||
|
const BeBuiltSkillType *bbst = dynamic_cast<const BeBuiltSkillType*>(currSkill);
|
||||||
|
if(bbst != NULL) {
|
||||||
|
result = bbst->getAnimHpBound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool Unit::isBeingBuilt() const{
|
bool Unit::isBeingBuilt() const{
|
||||||
if(currSkill == NULL) {
|
if(currSkill == NULL) {
|
||||||
char szBuf[4096]="";
|
char szBuf[4096]="";
|
||||||
|
@ -1250,7 +1267,7 @@ 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(currSkill->getClass() == scBeBuilt && static_cast<const BeBuiltSkillType*>(currSkill)->getAnimHpBound()==true ){
|
if(isBeingBuiltWithAnimHpBound() == true) {
|
||||||
animProgress=this->getHpRatio();
|
animProgress=this->getHpRatio();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -1811,7 +1828,7 @@ string Unit::getDesc() const {
|
||||||
str += lang.get("MaxUnitCount")+ ": " + intToStr(faction->getCountForMaxUnitCount(type)) + "/" + intToStr(type->getMaxUnitCount());
|
str += lang.get("MaxUnitCount")+ ": " + intToStr(faction->getCountForMaxUnitCount(type)) + "/" + intToStr(type->getMaxUnitCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
str += "\n"+lang.get("Hp")+ ": " + intToStr(hp) + "/" + intToStr(type->getTotalMaxHp(&totalUpgrade));
|
str += "\n"+lang.get("Hp")+ ": " + intToStr(hp) + "/" + intToStr(type->getTotalMaxHp(&totalUpgrade)) + " [" + floatToStr(getHpRatio()) + "] [" + floatToStr(animProgress) + "]";
|
||||||
if(type->getHpRegeneration()!=0){
|
if(type->getHpRegeneration()!=0){
|
||||||
str+= " (" + lang.get("Regeneration") + ": " + intToStr(type->getHpRegeneration()) + ")";
|
str+= " (" + lang.get("Regeneration") + ": " + intToStr(type->getHpRegeneration()) + ")";
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,6 +439,7 @@ public:
|
||||||
bool isOperative() const;
|
bool isOperative() const;
|
||||||
bool isBeingBuilt() const;
|
bool isBeingBuilt() const;
|
||||||
bool isBuilt() const;
|
bool isBuilt() const;
|
||||||
|
bool isBeingBuiltWithAnimHpBound() 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;
|
||||||
|
|
Loading…
Reference in New Issue