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

View File

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

View File

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

View File

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