mirror of
https://github.com/glest/glest-source.git
synced 2025-08-29 19:00:07 +02:00
-- attempt to fix another oos issue detected
This commit is contained in:
@@ -1478,6 +1478,10 @@ Vec3f Unit::getCurrVector() const{
|
||||
}
|
||||
|
||||
Vec3f result = getCurrVectorFlat() + Vec3f(0.f, type->getHeight() / 2.f, 0.f);
|
||||
result.x = truncateDecimal<float>(result.x,6);
|
||||
result.y = truncateDecimal<float>(result.y,6);
|
||||
result.z = truncateDecimal<float>(result.z,6);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1503,15 +1507,26 @@ Vec3f Unit::getVectorFlat(const Vec2i &lastPosValue, const Vec2i &curPosValue) c
|
||||
v.x = lastPosValue.x + progressAsFloat * (curPosValue.x - lastPosValue.x);
|
||||
v.z = lastPosValue.y + progressAsFloat * (curPosValue.y - lastPosValue.y);
|
||||
v.y = y1 + progressAsFloat * (y2-y1);
|
||||
|
||||
v.x = truncateDecimal<float>(v.x,6);
|
||||
v.y = truncateDecimal<float>(v.y,6);
|
||||
v.z = truncateDecimal<float>(v.z,6);
|
||||
}
|
||||
else {
|
||||
v.x = static_cast<float>(curPosValue.x);
|
||||
v.z = static_cast<float>(curPosValue.y);
|
||||
v.y = y2;
|
||||
|
||||
v.x = truncateDecimal<float>(v.x,6);
|
||||
v.y = truncateDecimal<float>(v.y,6);
|
||||
v.z = truncateDecimal<float>(v.z,6);
|
||||
}
|
||||
v.x += type->getSize() / 2.f - 0.5f;
|
||||
v.z += type->getSize() / 2.f - 0.5f;
|
||||
|
||||
v.x = truncateDecimal<float>(v.x,6);
|
||||
v.z = truncateDecimal<float>(v.z,6);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -3405,7 +3420,8 @@ float Unit::computeHeight(const Vec2i &pos) const {
|
||||
float height= map->getCell(pos)->getHeight();
|
||||
|
||||
if(currField == fAir) {
|
||||
const float airHeight=game->getWorld()->getTileset()->getAirHeight();
|
||||
float airHeight = game->getWorld()->getTileset()->getAirHeight();
|
||||
airHeight = truncateDecimal<float>(airHeight,6);
|
||||
|
||||
height += airHeight;
|
||||
height = truncateDecimal<float>(height,6);
|
||||
@@ -4311,6 +4327,8 @@ std::string Unit::toString(bool crcMode) const {
|
||||
}
|
||||
result += "pathFindRefreshCellCount = " + intToStr(pathFindRefreshCellCount) + "\n";
|
||||
|
||||
result += "currentPathFinderDesiredFinalPos = " + currentPathFinderDesiredFinalPos.getString() + "\n";
|
||||
|
||||
result += "lastStuckFrame = " + uIntToStr(lastStuckFrame) + "\n";
|
||||
result += "lastStuckPos = " + lastStuckPos.getString() + "\n";
|
||||
|
||||
@@ -5292,7 +5310,7 @@ Checksum Unit::getCRC() {
|
||||
//CauseOfDeathType causeOfDeath;
|
||||
|
||||
//uint32 pathfindFailedConsecutiveFrameCount;
|
||||
//Vec2i currentPathFinderDesiredFinalPos;
|
||||
crcForUnit.addString(this->currentPathFinderDesiredFinalPos.getString());
|
||||
|
||||
crcForUnit.addInt(random.getLastNumber());
|
||||
if(this->random.getLastCaller() != "") {
|
||||
|
@@ -1788,9 +1788,17 @@ void ProjectileParticleSystem::update(){
|
||||
pos= flatPos;
|
||||
#ifdef USE_STREFLOP
|
||||
pos+= xVector * streflop::cos(static_cast<streflop::Simple>(relative * trajectoryFrequency * targetVector.length())) * trajectoryScale;
|
||||
pos.x = truncateDecimal<float>(pos.x,6);
|
||||
pos.y = truncateDecimal<float>(pos.y,6);
|
||||
pos.z = truncateDecimal<float>(pos.z,6);
|
||||
|
||||
pos+= yVector * streflop::sin(static_cast<streflop::Simple>(relative * trajectoryFrequency * targetVector.length())) * trajectoryScale;
|
||||
#else
|
||||
pos+= xVector * cos(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
|
||||
pos.x = truncateDecimal<float>(pos.x,6);
|
||||
pos.y = truncateDecimal<float>(pos.y,6);
|
||||
pos.z = truncateDecimal<float>(pos.z,6);
|
||||
|
||||
pos+= yVector * sin(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
|
||||
#endif
|
||||
pos.x = truncateDecimal<float>(pos.x,6);
|
||||
@@ -1804,7 +1812,11 @@ void ProjectileParticleSystem::update(){
|
||||
break;
|
||||
}
|
||||
|
||||
direction= pos - lastPos;
|
||||
direction= (pos - lastPos);
|
||||
direction.x = truncateDecimal<float>(direction.x,6);
|
||||
direction.y = truncateDecimal<float>(direction.y,6);
|
||||
direction.z = truncateDecimal<float>(direction.z,6);
|
||||
|
||||
direction.normalize();
|
||||
direction.x = truncateDecimal<float>(direction.x,6);
|
||||
direction.y = truncateDecimal<float>(direction.y,6);
|
||||
@@ -1908,6 +1920,13 @@ void ProjectileParticleSystem::updateParticle(Particle *p){
|
||||
}
|
||||
|
||||
void ProjectileParticleSystem::setPath(Vec3f startPos, Vec3f endPos) {
|
||||
startPos.x = truncateDecimal<float>(startPos.x,6);
|
||||
startPos.y = truncateDecimal<float>(startPos.y,6);
|
||||
startPos.z = truncateDecimal<float>(startPos.z,6);
|
||||
|
||||
endPos.x = truncateDecimal<float>(endPos.x,6);
|
||||
endPos.y = truncateDecimal<float>(endPos.y,6);
|
||||
endPos.z = truncateDecimal<float>(endPos.z,6);
|
||||
|
||||
//compute axis
|
||||
zVector= endPos - startPos;
|
||||
@@ -2172,7 +2191,15 @@ void SplashParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
p->speed= Vec3f(horizontalSpreadA * random.randRange(-1.0f, 1.0f) + horizontalSpreadB, verticalSpreadA
|
||||
* random.randRange(-1.0f, 1.0f) + verticalSpreadB, horizontalSpreadA * random.randRange(-1.0f, 1.0f)
|
||||
+ horizontalSpreadB);
|
||||
p->speed.x = truncateDecimal<float>(p->speed.x,6);
|
||||
p->speed.y = truncateDecimal<float>(p->speed.y,6);
|
||||
p->speed.z = truncateDecimal<float>(p->speed.z,6);
|
||||
|
||||
p->speed.normalize();
|
||||
p->speed.x = truncateDecimal<float>(p->speed.x,6);
|
||||
p->speed.y = truncateDecimal<float>(p->speed.y,6);
|
||||
p->speed.z = truncateDecimal<float>(p->speed.z,6);
|
||||
|
||||
p->speed= p->speed * speed;
|
||||
p->speed.x = truncateDecimal<float>(p->speed.x,6);
|
||||
p->speed.y = truncateDecimal<float>(p->speed.y,6);
|
||||
|
Reference in New Issue
Block a user