- attempt to fix additional oos issues

This commit is contained in:
Mark Vejvoda 2013-09-28 03:10:37 +00:00
parent 4a8f88e864
commit 91b7803270
4 changed files with 33 additions and 22 deletions

View File

@ -57,16 +57,16 @@ protected:
string type; string type;
Texture2D *texture; Texture2D *texture;
Model *model; Model *model;
float modelCycle; double modelCycle;
string primitive; string primitive;
Vec3d offset; Vec3d offset;
Vec4f color; Vec4f color;
Vec4f colorNoEnergy; Vec4f colorNoEnergy;
float size; double size;
float sizeNoEnergy; double sizeNoEnergy;
float speed; double speed;
float gravity; double gravity;
float emissionRate; double emissionRate;
int energyMax; int energyMax;
int energyVar; int energyVar;
string mode; string mode;
@ -123,9 +123,9 @@ protected:
class ParticleSystemTypeProjectile: public ParticleSystemType{ class ParticleSystemTypeProjectile: public ParticleSystemType{
private: private:
string trajectory; string trajectory;
float trajectorySpeed; double trajectorySpeed;
float trajectoryScale; double trajectoryScale;
float trajectoryFrequency; double trajectoryFrequency;
public: public:
ParticleSystemTypeProjectile(); ParticleSystemTypeProjectile();
@ -153,11 +153,11 @@ public:
virtual void saveGame(XmlNode *rootNode); virtual void saveGame(XmlNode *rootNode);
private: private:
float emissionRateFade; double emissionRateFade;
float verticalSpreadA; double verticalSpreadA;
float verticalSpreadB; double verticalSpreadB;
float horizontalSpreadA; double horizontalSpreadA;
float horizontalSpreadB; double horizontalSpreadB;
}; };
}}//end namespace }}//end namespace

View File

@ -1267,12 +1267,14 @@ void Unit::setTargetPos(const Vec2i &targetPos) {
Vec2i relPos= targetPos - pos; Vec2i relPos= targetPos - pos;
//map->clampPos(relPos); //map->clampPos(relPos);
Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y); Vec2d relPosf= Vec2d((double)relPos.x, (double)relPos.y);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
targetRotation= radToDeg(streflop::atan2(static_cast<streflop::Simple>(relPosf.x), static_cast<streflop::Simple>(relPosf.y))); targetRotation= radToDeg(streflop::atan2(static_cast<streflop::Simple>(relPosf.x), static_cast<streflop::Simple>(relPosf.y)));
#else #else
targetRotation= radToDeg(atan2(relPosf.x, relPosf.y)); targetRotation= radToDeg(atan2(relPosf.x, relPosf.y));
#endif #endif
targetRotation = truncateDecimal<double>(targetRotation,16);
targetRef= NULL; targetRef= NULL;
this->targetPos= targetPos; this->targetPos= targetPos;
@ -1439,15 +1441,21 @@ Vec3d Unit::getVectorFlat(const Vec2i &lastPosValue, const Vec2i &curPosValue) c
double y2= computeHeight(curPosValue); double y2= computeHeight(curPosValue);
if(currSkill->getClass() == scMove) { if(currSkill->getClass() == scMove) {
v.x= lastPosValue.x + getProgressAsFloat() * (curPosValue.x - lastPosValue.x); double progressAsDouble = getProgressAsFloat();
v.z= lastPosValue.y + getProgressAsFloat() * (curPosValue.y - lastPosValue.y);
v.y= y1 + getProgressAsFloat() * (y2-y1); v.x= lastPosValue.x + progressAsDouble * (curPosValue.x - lastPosValue.x);
v.z= lastPosValue.y + progressAsDouble * (curPosValue.y - lastPosValue.y);
v.y= y1 + progressAsDouble * (y2-y1);
} }
else { else {
v.x= static_cast<double>(curPosValue.x); v.x= static_cast<double>(curPosValue.x);
v.z= static_cast<double>(curPosValue.y); v.z= static_cast<double>(curPosValue.y);
v.y= y2; v.y= y2;
} }
v.x = truncateDecimal<double>(v.x,16);
v.y = truncateDecimal<double>(v.y,16);
v.z = truncateDecimal<double>(v.z,16);
v.x += type->getSize() / 2.f - 0.5f; v.x += type->getSize() / 2.f - 0.5f;
v.z += type->getSize() / 2.f - 0.5f; v.z += type->getSize() / 2.f - 0.5f;
@ -3349,9 +3357,11 @@ double Unit::computeHeight(const Vec2i &pos) const {
} }
double height= map->getCell(pos)->getHeight(); double height= map->getCell(pos)->getHeight();
height = truncateDecimal<double>(height,16);
if(currField == fAir) { if(currField == fAir) {
const double airHeight=game->getWorld()->getTileset()->getAirHeight(); const double airHeight=game->getWorld()->getTileset()->getAirHeight();
height += airHeight; height += airHeight;
height = truncateDecimal<double>(height,16); height = truncateDecimal<double>(height,16);
@ -3381,12 +3391,13 @@ void Unit::updateTarget(){
//update target pos //update target pos
targetPos= target->getCellPos(); targetPos= target->getCellPos();
Vec2i relPos= targetPos - pos; Vec2i relPos= targetPos - pos;
Vec2d relPosf= Vec2d((float)relPos.x, (float)relPos.y); Vec2d relPosf= Vec2d((double)relPos.x, (double)relPos.y);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
targetRotation= radToDeg(streflop::atan2(static_cast<streflop::Simple>(relPosf.x), static_cast<streflop::Simple>(relPosf.y))); targetRotation= radToDeg(streflop::atan2(static_cast<streflop::Simple>(relPosf.x), static_cast<streflop::Simple>(relPosf.y)));
#else #else
targetRotation= radToDeg(atan2(relPosf.x, relPosf.y)); targetRotation= radToDeg(atan2(relPosf.x, relPosf.y));
#endif #endif
targetRotation = truncateDecimal<double>(targetRotation,16);
//update target vec //update target vec
targetVec= target->getCurrVector(); targetVec= target->getCurrVector();

View File

@ -119,7 +119,7 @@ bool UnitUpdater::updateUnit(Unit *unit) {
//play skill sound //play skill sound
const SkillType *currSkill= unit->getCurrSkill(); const SkillType *currSkill= unit->getCurrSkill();
if(currSkill->getSound() != NULL) { if(currSkill->getSound() != NULL) {
float soundStartTime= currSkill->getSoundStartTime(); double soundStartTime= currSkill->getSoundStartTime();
if(soundStartTime >= unit->getLastAnimProgressAsFloat() && soundStartTime < unit->getAnimProgressAsFloat()) { if(soundStartTime >= unit->getLastAnimProgressAsFloat() && soundStartTime < unit->getAnimProgressAsFloat()) {
if(map->getSurfaceCell(Map::toSurfCoords(unit->getPos()))->isVisible(world->getThisTeamIndex()) || if(map->getSurfaceCell(Map::toSurfCoords(unit->getPos()))->isVisible(world->getThisTeamIndex()) ||
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) { (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
@ -2817,7 +2817,7 @@ void UnitUpdater::saveGame(XmlNode *rootNode) {
// RandomGen random; // RandomGen random;
//unitupdaterNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements); //unitupdaterNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements);
// float attackWarnRange; // float attackWarnRange;
unitupdaterNode->addAttribute("attackWarnRange",floatToStr(attackWarnRange,16), mapTagReplacements); unitupdaterNode->addAttribute("attackWarnRange",doubleToStr(attackWarnRange,16), mapTagReplacements);
// AttackWarnings attackWarnings; // AttackWarnings attackWarnings;
// //
// Mutex mutexUnitRangeCellsLookupItemCache; // Mutex mutexUnitRangeCellsLookupItemCache;

View File

@ -81,7 +81,7 @@ private:
Game *game; Game *game;
//RandomGen random; //RandomGen random;
Mutex mutexAttackWarnings; Mutex mutexAttackWarnings;
float attackWarnRange; double attackWarnRange;
AttackWarnings attackWarnings; AttackWarnings attackWarnings;
Mutex mutexUnitRangeCellsLookupItemCache; Mutex mutexUnitRangeCellsLookupItemCache;