- change a bunch of floats to double and remove path from particle texture
This commit is contained in:
parent
11471243ea
commit
525e0da652
|
@ -388,7 +388,7 @@ void UnitAttackBoostEffectOriginator::saveGame(XmlNode *rootNode) {
|
|||
// class Unit
|
||||
// =====================================================
|
||||
|
||||
const float Unit::ANIMATION_SPEED_MULTIPLIER = 100000.f;
|
||||
const double Unit::ANIMATION_SPEED_MULTIPLIER = 100000.f;
|
||||
//const float Unit::PROGRESS_SPEED_MULTIPLIER = 100000.f;
|
||||
const int64 Unit::PROGRESS_SPEED_MULTIPLIER = 100000;
|
||||
|
||||
|
@ -496,7 +496,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos,
|
|||
alive= true;
|
||||
|
||||
if (type->hasSkillClass(scBeBuilt) == false) {
|
||||
float rot= 0.f;
|
||||
double rot= 0.f;
|
||||
random.init(id);
|
||||
rot+= random.randRange(-5, 5,intToStr(__LINE__));
|
||||
rotation= rot;
|
||||
|
@ -726,15 +726,15 @@ Vec2i Unit::getCellPos() const {
|
|||
|
||||
//find nearest pos to center that is free
|
||||
Vec2i centeredPos= getCenteredPos();
|
||||
float nearestDist= -1.f;
|
||||
double nearestDist= -1.f;
|
||||
Vec2i nearestPos= pos;
|
||||
|
||||
for(int i=0; i<type->getSize(); ++i){
|
||||
for(int j=0; j<type->getSize(); ++j){
|
||||
if(type->getCellMapCell(i, j, modelFacing)){
|
||||
Vec2i currPos= pos + Vec2i(i, j);
|
||||
float dist= currPos.dist(centeredPos);
|
||||
if(nearestDist==-1.f || dist<nearestDist){
|
||||
double dist= currPos.dist(centeredPos);
|
||||
if(nearestDist == -1.f || dist < nearestDist) {
|
||||
nearestDist= dist;
|
||||
nearestPos= currPos;
|
||||
}
|
||||
|
@ -815,11 +815,11 @@ void Unit::calculateXZRotation(){
|
|||
}
|
||||
}
|
||||
|
||||
float Unit::getRotationZ() const{
|
||||
double Unit::getRotationZ() const{
|
||||
return rotationZ;
|
||||
}
|
||||
|
||||
float Unit::getRotationX() const{
|
||||
double Unit::getRotationX() const{
|
||||
return rotationX;
|
||||
}
|
||||
|
||||
|
@ -836,7 +836,7 @@ int Unit::getProductionPercent() const{
|
|||
return -1;
|
||||
}
|
||||
|
||||
float Unit::getProgressRatio() const{
|
||||
double Unit::getProgressRatio() const{
|
||||
if(anyCommand()){
|
||||
const ProducibleType *produced= commands.front()->getCommandType()->getProduced();
|
||||
if(produced != NULL){
|
||||
|
@ -844,28 +844,28 @@ float Unit::getProgressRatio() const{
|
|||
return 0.f;
|
||||
}
|
||||
|
||||
float help = progress2;
|
||||
double help = progress2;
|
||||
return clamp(help / produced->getProductionTime(), 0.f, 1.f);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
float Unit::getHpRatio() const {
|
||||
double Unit::getHpRatio() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
float maxHpAllowed = type->getTotalMaxHp(&totalUpgrade);
|
||||
double maxHpAllowed = type->getTotalMaxHp(&totalUpgrade);
|
||||
if(maxHpAllowed == 0.f) {
|
||||
return 0.f;
|
||||
}
|
||||
return clamp(static_cast<float>(hp) / maxHpAllowed, 0.f, 1.f);
|
||||
return clamp(static_cast<double>(hp) / maxHpAllowed, 0.f, 1.f);
|
||||
}
|
||||
|
||||
float Unit::getEpRatio() const {
|
||||
double Unit::getEpRatio() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
|
@ -876,11 +876,11 @@ float Unit::getEpRatio() const {
|
|||
return 0.f;
|
||||
}
|
||||
else {
|
||||
float maxEpAllowed = type->getTotalMaxEp(&totalUpgrade);
|
||||
double maxEpAllowed = type->getTotalMaxEp(&totalUpgrade);
|
||||
if(maxEpAllowed == 0.f) {
|
||||
return 0.f;
|
||||
}
|
||||
return clamp(static_cast<float>(ep) / maxEpAllowed, 0.f, 1.f);
|
||||
return clamp(static_cast<double>(ep) / maxEpAllowed, 0.f, 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ FowAlphaCellsLookupItem Unit::getFogOfWarRadius(bool useCache) const {
|
|||
Vec2i surfPos= Map::toSurfCoords(sightpos);
|
||||
|
||||
//compute max alpha
|
||||
float maxAlpha= 0.0f;
|
||||
double maxAlpha= 0.0f;
|
||||
if(surfPos.x > 1 && surfPos.y > 1 && surfPos.x < map->getSurfaceW() -2 && surfPos.y < map->getSurfaceH() -2) {
|
||||
maxAlpha= 1.f;
|
||||
}
|
||||
|
@ -1234,8 +1234,8 @@ FowAlphaCellsLookupItem Unit::getFogOfWarRadius(bool useCache) const {
|
|||
}
|
||||
|
||||
//compute alpha
|
||||
float alpha = maxAlpha;
|
||||
float dist = this->getPosNotThreadSafe().dist(sightpos);
|
||||
double alpha = maxAlpha;
|
||||
double dist = this->getPosNotThreadSafe().dist(sightpos);
|
||||
if(dist > sightRange) {
|
||||
alpha= clamp(1.f-(dist - sightRange) / (World::indirectSightRange), 0.f, maxAlpha);
|
||||
}
|
||||
|
@ -1425,30 +1425,30 @@ Vec3f Unit::getCurrVectorFlat() const{
|
|||
return getVectorFlat(lastPos, pos);
|
||||
}
|
||||
|
||||
float Unit::getProgressAsFloat() const {
|
||||
float result = (static_cast<float>(progress) / static_cast<float>(PROGRESS_SPEED_MULTIPLIER));
|
||||
result = truncateDecimal<float>(result);
|
||||
double Unit::getProgressAsFloat() const {
|
||||
double result = (static_cast<double>(progress) / static_cast<double>(PROGRESS_SPEED_MULTIPLIER));
|
||||
result = truncateDecimal<double>(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Vec3f Unit::getVectorFlat(const Vec2i &lastPosValue, const Vec2i &curPosValue) const {
|
||||
Vec3f v;
|
||||
|
||||
float y1= computeHeight(lastPosValue);
|
||||
float y2= computeHeight(curPosValue);
|
||||
double y1= computeHeight(lastPosValue);
|
||||
double y2= computeHeight(curPosValue);
|
||||
|
||||
if(currSkill->getClass() == scMove) {
|
||||
v.x= truncateDecimal<float>(lastPosValue.x + getProgressAsFloat() * (curPosValue.x - lastPosValue.x));
|
||||
v.z= truncateDecimal<float>(lastPosValue.y + getProgressAsFloat() * (curPosValue.y - lastPosValue.y));
|
||||
v.y= truncateDecimal<float>(y1 + getProgressAsFloat() * (y2-y1));
|
||||
v.x= truncateDecimal<double>(lastPosValue.x + getProgressAsFloat() * (curPosValue.x - lastPosValue.x));
|
||||
v.z= truncateDecimal<double>(lastPosValue.y + getProgressAsFloat() * (curPosValue.y - lastPosValue.y));
|
||||
v.y= truncateDecimal<double>(y1 + getProgressAsFloat() * (y2-y1));
|
||||
}
|
||||
else {
|
||||
v.x= static_cast<float>(curPosValue.x);
|
||||
v.z= static_cast<float>(curPosValue.y);
|
||||
v.x= static_cast<double>(curPosValue.x);
|
||||
v.z= static_cast<double>(curPosValue.y);
|
||||
v.y= y2;
|
||||
}
|
||||
v.x += truncateDecimal<float>(type->getSize() / 2.f - 0.5f);
|
||||
v.z += truncateDecimal<float>(type->getSize() / 2.f - 0.5f);
|
||||
v.x += truncateDecimal<double>(type->getSize() / 2.f - 0.5f);
|
||||
v.z += truncateDecimal<double>(type->getSize() / 2.f - 0.5f);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
@ -2022,8 +2022,8 @@ int64 Unit::getHeightFactor(int64 speedMultiplier) {
|
|||
throw megaglest_runtime_error("targetCell == NULL");
|
||||
}
|
||||
|
||||
int64 heightDiff= ((truncateDecimal<float>(unitCell->getHeight(),2) * speedMultiplier) -
|
||||
(truncateDecimal<float>(targetCell->getHeight(),2) * speedMultiplier));
|
||||
int64 heightDiff= ((truncateDecimal<double>(unitCell->getHeight(),2) * speedMultiplier) -
|
||||
(truncateDecimal<double>(targetCell->getHeight(),2) * speedMultiplier));
|
||||
//heightFactor= clamp(speedMultiplier + heightDiff / (5.f * speedMultiplier), 0.2f * speedMultiplier, 5.f * speedMultiplier);
|
||||
heightFactor= clamp(speedMultiplier + heightDiff / (5 * speedMultiplier), (2 * (speedMultiplier / 10)), 5 * speedMultiplier);
|
||||
}
|
||||
|
@ -2327,7 +2327,7 @@ bool Unit::update() {
|
|||
//printf("Test progress = %d for unit [%d - %s]\n",progress,id,getType()->getName().c_str());
|
||||
|
||||
if(isAnimProgressBound() == true) {
|
||||
float targetProgress=0;
|
||||
double targetProgress=0;
|
||||
if(currSkill->getClass() == scBeBuilt) {
|
||||
targetProgress = this->getHpRatio();
|
||||
}
|
||||
|
@ -2341,10 +2341,10 @@ bool Unit::update() {
|
|||
targetProgress = this->getProgressRatio();
|
||||
}
|
||||
|
||||
float targetProgressIntValue = targetProgress * ANIMATION_SPEED_MULTIPLIER;
|
||||
double targetProgressIntValue = targetProgress * ANIMATION_SPEED_MULTIPLIER;
|
||||
if(this->animProgress < targetProgressIntValue) {
|
||||
float diff = targetProgressIntValue - this->animProgress;
|
||||
float progressIncrease = static_cast<float>(this->animProgress) + diff / static_cast<float>(GameConstants::updateFps);
|
||||
double diff = targetProgressIntValue - this->animProgress;
|
||||
double progressIncrease = static_cast<double>(this->animProgress) + diff / static_cast<double>(GameConstants::updateFps);
|
||||
// Ensure we increment at least a value of 1 of the action will be stuck infinitely
|
||||
if(diff > 0.f && GameConstants::updateFps > 0 && progressIncrease == 0.f) {
|
||||
progressIncrease = 1.f;
|
||||
|
@ -2389,7 +2389,7 @@ bool Unit::update() {
|
|||
rotation= lastRotation + (targetRotation - lastRotation) *
|
||||
getProgressAsFloat() * rotFactor;
|
||||
else {
|
||||
float rotationTerm = targetRotation > lastRotation ? -360.f: +360.f;
|
||||
double rotationTerm = targetRotation > lastRotation ? -360.f: +360.f;
|
||||
rotation = lastRotation + (targetRotation - lastRotation + rotationTerm) *
|
||||
getProgressAsFloat() * rotFactor;
|
||||
}
|
||||
|
@ -2523,8 +2523,8 @@ void Unit::updateTimedParticles() {
|
|||
UnitParticleSystem *ps = unitParticleSystems[i];
|
||||
if(ps != NULL) {
|
||||
if(Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
||||
float pst = ps->getStartTime();
|
||||
float pet = ps->getEndTime();
|
||||
double pst = ps->getStartTime();
|
||||
double pet = ps->getEndTime();
|
||||
double particleStartTime = truncateDecimal<double>(pst);
|
||||
double particleEndTime = truncateDecimal<double>(pet);
|
||||
|
||||
|
@ -3334,7 +3334,7 @@ bool Unit::morph(const MorphCommandType *mct) {
|
|||
|
||||
// ==================== PRIVATE ====================
|
||||
|
||||
float Unit::computeHeight(const Vec2i &pos) const {
|
||||
double Unit::computeHeight(const Vec2i &pos) const {
|
||||
//printf("CRASHING FOR UNIT: %d alive = %d\n",this->getId(),this->isAlive());
|
||||
//printf("[%s]\n",this->getType()->getName().c_str());
|
||||
if(map->isInside(pos) == false || map->isInsideSurface(map->toSurfCoords(pos)) == false) {
|
||||
|
@ -3343,24 +3343,24 @@ float Unit::computeHeight(const Vec2i &pos) const {
|
|||
throw megaglest_runtime_error("#7 Invalid path position = " + pos.getString());
|
||||
}
|
||||
|
||||
float height= map->getCell(pos)->getHeight();
|
||||
double height= map->getCell(pos)->getHeight();
|
||||
|
||||
if(currField == fAir) {
|
||||
const float airHeight=game->getWorld()->getTileset()->getAirHeight();
|
||||
const double airHeight=game->getWorld()->getTileset()->getAirHeight();
|
||||
height += airHeight;
|
||||
height = truncateDecimal<float>(height);
|
||||
height = truncateDecimal<double>(height);
|
||||
|
||||
Unit *unit = map->getCell(pos)->getUnit(fLand);
|
||||
if(unit != NULL && unit->getType()->getHeight() > airHeight) {
|
||||
height += (std::min((float)unit->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
||||
height = truncateDecimal<float>(height);
|
||||
height += (std::min((double)unit->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
||||
height = truncateDecimal<double>(height);
|
||||
}
|
||||
else {
|
||||
SurfaceCell *sc = map->getSurfaceCell(map->toSurfCoords(pos));
|
||||
if(sc != NULL && sc->getObject() != NULL && sc->getObject()->getType() != NULL) {
|
||||
if(sc->getObject()->getType()->getHeight() > airHeight) {
|
||||
height += (std::min((float)sc->getObject()->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
||||
height = truncateDecimal<float>(height);
|
||||
height += (std::min((double)sc->getObject()->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
||||
height = truncateDecimal<double>(height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4158,10 +4158,10 @@ std::string Unit::toString(bool crcMode) const {
|
|||
result += "\n";
|
||||
result += "networkCRCLogInfo = " + networkCRCLogInfo;
|
||||
result += "\n";
|
||||
if(crcMode == false) {
|
||||
result += " lastAnimProgress = " + intToStr(this->lastAnimProgress);
|
||||
result += " animProgress = " + intToStr(this->animProgress);
|
||||
if(crcMode == false) {
|
||||
result += " highlight = " + floatToStr(this->highlight,16);
|
||||
result += " highlight = " + doubleToStr(this->highlight,16);
|
||||
}
|
||||
result += " progress2 = " + intToStr(this->progress2);
|
||||
result += " kills = " + intToStr(this->kills);
|
||||
|
@ -4190,9 +4190,9 @@ std::string Unit::toString(bool crcMode) const {
|
|||
result += "\n";
|
||||
|
||||
if(crcMode == false) {
|
||||
result += " lastRotation = " + floatToStr(this->lastRotation,16);
|
||||
result += " targetRotation = " + floatToStr(this->targetRotation,16);
|
||||
result += " rotation = " + floatToStr(this->rotation,16);
|
||||
result += " lastRotation = " + doubleToStr(this->lastRotation,16);
|
||||
result += " targetRotation = " + doubleToStr(this->targetRotation,16);
|
||||
result += " rotation = " + doubleToStr(this->rotation,16);
|
||||
}
|
||||
|
||||
if(loadType != NULL) {
|
||||
|
@ -4300,7 +4300,7 @@ void Unit::saveGame(XmlNode *rootNode) {
|
|||
// float animProgress; //between 0 and 1
|
||||
unitNode->addAttribute("animProgress",intToStr(animProgress), mapTagReplacements);
|
||||
// float highlight;
|
||||
unitNode->addAttribute("highlight",floatToStr(highlight,16), mapTagReplacements);
|
||||
unitNode->addAttribute("highlight",doubleToStr(highlight,16), mapTagReplacements);
|
||||
// int progress2;
|
||||
unitNode->addAttribute("progress2",intToStr(progress2), mapTagReplacements);
|
||||
// int kills;
|
||||
|
@ -4330,19 +4330,19 @@ void Unit::saveGame(XmlNode *rootNode) {
|
|||
unitNode->addAttribute("meetingPos",meetingPos.getString(), mapTagReplacements);
|
||||
//
|
||||
// float lastRotation; //in degrees
|
||||
unitNode->addAttribute("lastRotation",floatToStr(lastRotation,16), mapTagReplacements);
|
||||
unitNode->addAttribute("lastRotation",doubleToStr(lastRotation,16), mapTagReplacements);
|
||||
// float targetRotation;
|
||||
unitNode->addAttribute("targetRotation",floatToStr(targetRotation,16), mapTagReplacements);
|
||||
unitNode->addAttribute("targetRotation",doubleToStr(targetRotation,16), mapTagReplacements);
|
||||
// float rotation;
|
||||
unitNode->addAttribute("rotation",floatToStr(rotation,16), mapTagReplacements);
|
||||
unitNode->addAttribute("rotation",doubleToStr(rotation,16), mapTagReplacements);
|
||||
// float targetRotationZ;
|
||||
unitNode->addAttribute("targetRotationZ",floatToStr(targetRotationZ,16), mapTagReplacements);
|
||||
unitNode->addAttribute("targetRotationZ",doubleToStr(targetRotationZ,16), mapTagReplacements);
|
||||
// float targetRotationX;
|
||||
unitNode->addAttribute("targetRotationX",floatToStr(targetRotationX,16), mapTagReplacements);
|
||||
unitNode->addAttribute("targetRotationX",doubleToStr(targetRotationX,16), mapTagReplacements);
|
||||
// float rotationZ;
|
||||
unitNode->addAttribute("rotationZ",floatToStr(rotationZ,16), mapTagReplacements);
|
||||
unitNode->addAttribute("rotationZ",doubleToStr(rotationZ,16), mapTagReplacements);
|
||||
// float rotationX;
|
||||
unitNode->addAttribute("rotationX",floatToStr(rotationX,16), mapTagReplacements);
|
||||
unitNode->addAttribute("rotationX",doubleToStr(rotationX,16), mapTagReplacements);
|
||||
// const UnitType *type;
|
||||
unitNode->addAttribute("type",type->getName(false), mapTagReplacements);
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ private:
|
|||
static std::map<Unit *,bool> mapMemoryList;
|
||||
#endif
|
||||
|
||||
static const float ANIMATION_SPEED_MULTIPLIER;
|
||||
static const double ANIMATION_SPEED_MULTIPLIER;
|
||||
static const int64 PROGRESS_SPEED_MULTIPLIER;
|
||||
|
||||
public:
|
||||
|
@ -353,7 +353,7 @@ private:
|
|||
int64 progress; //between 0 and 1
|
||||
int64 lastAnimProgress; //between 0 and 1
|
||||
int64 animProgress; //between 0 and 1
|
||||
float highlight;
|
||||
double highlight;
|
||||
int32 progress2;
|
||||
int32 kills;
|
||||
int32 enemyKills;
|
||||
|
@ -371,13 +371,13 @@ private:
|
|||
Vec3f targetVec;
|
||||
Vec2i meetingPos;
|
||||
|
||||
float lastRotation; //in degrees
|
||||
float targetRotation;
|
||||
float rotation;
|
||||
float targetRotationZ;
|
||||
float targetRotationX;
|
||||
float rotationZ;
|
||||
float rotationX;
|
||||
double lastRotation; //in degrees
|
||||
double targetRotation;
|
||||
double rotation;
|
||||
double targetRotationZ;
|
||||
double targetRotationX;
|
||||
double rotationZ;
|
||||
double rotationX;
|
||||
|
||||
const UnitType *preMorph_type;
|
||||
const UnitType *type;
|
||||
|
@ -517,10 +517,10 @@ public:
|
|||
|
||||
//inline int getLastAnimProgress() const {return lastAnimProgress;}
|
||||
//inline int getAnimProgress() const {return animProgress;}
|
||||
inline float getLastAnimProgressAsFloat() const {return static_cast<float>(lastAnimProgress) / ANIMATION_SPEED_MULTIPLIER;}
|
||||
inline float getAnimProgressAsFloat() const {return static_cast<float>(animProgress) / ANIMATION_SPEED_MULTIPLIER;}
|
||||
inline double getLastAnimProgressAsFloat() const {return static_cast<double>(lastAnimProgress) / ANIMATION_SPEED_MULTIPLIER;}
|
||||
inline double getAnimProgressAsFloat() const {return static_cast<double>(animProgress) / ANIMATION_SPEED_MULTIPLIER;}
|
||||
|
||||
inline float getHightlight() const {return highlight;}
|
||||
inline double getHightlight() const {return highlight;}
|
||||
inline int getProgress2() const {return progress2;}
|
||||
inline int getFactionIndex() const {
|
||||
return faction->getIndex();
|
||||
|
@ -531,9 +531,9 @@ public:
|
|||
inline int getHp() const {return hp;}
|
||||
inline int getEp() const {return ep;}
|
||||
int getProductionPercent() const;
|
||||
float getProgressRatio() const;
|
||||
float getHpRatio() const;
|
||||
float getEpRatio() const;
|
||||
double getProgressRatio() const;
|
||||
double getHpRatio() const;
|
||||
double getEpRatio() const;
|
||||
inline bool getToBeUndertaken() const {return toBeUndertaken;}
|
||||
inline Vec2i getTargetPos() const {return targetPos;}
|
||||
inline Vec3f getTargetVec() const {return targetVec;}
|
||||
|
@ -546,9 +546,9 @@ public:
|
|||
|
||||
inline const SkillType *getCurrSkill() const {return currSkill;}
|
||||
inline const TotalUpgrade *getTotalUpgrade() const {return &totalUpgrade;}
|
||||
inline float getRotation() const {return rotation;}
|
||||
float getRotationX() const;
|
||||
float getRotationZ() const;
|
||||
inline double getRotation() const {return rotation;}
|
||||
double getRotationX() const;
|
||||
double getRotationZ() const;
|
||||
ParticleSystem *getFire() const;
|
||||
inline int getKills() const {return kills;}
|
||||
inline int getEnemyKills() const {return enemyKills;}
|
||||
|
@ -742,7 +742,7 @@ public:
|
|||
|
||||
std::string toString(bool crcMode=false) const;
|
||||
bool needToUpdate();
|
||||
float getProgressAsFloat() const;
|
||||
double getProgressAsFloat() const;
|
||||
int64 getUpdateProgress();
|
||||
int64 getDiagonalFactor();
|
||||
int64 getHeightFactor(int64 speedMultiplier=PROGRESS_SPEED_MULTIPLIER);
|
||||
|
@ -794,7 +794,7 @@ private:
|
|||
void addNetworkCRCDecHp(string info) { }
|
||||
string getNetworkCRCDecHpList() const;
|
||||
|
||||
float computeHeight(const Vec2i &pos) const;
|
||||
double computeHeight(const Vec2i &pos) const;
|
||||
void calculateXZRotation();
|
||||
void updateTarget();
|
||||
void clearCommands();
|
||||
|
|
|
@ -29,8 +29,8 @@ using namespace Shared::Graphics;
|
|||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
const float Tileset::standardAirHeight= 5.0f;
|
||||
const float Tileset::standardShadowIntensity= 0.2f;
|
||||
const double Tileset::standardAirHeight= 5.0f;
|
||||
const double Tileset::standardShadowIntensity= 0.2f;
|
||||
// =====================================================
|
||||
// class AmbientSounds
|
||||
// =====================================================
|
||||
|
@ -433,15 +433,15 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||
|
||||
//weather
|
||||
const XmlNode *weatherNode= parametersNode->getChild("weather");
|
||||
float sunnyProb= weatherNode->getAttribute("sun")->getFloatValue(0.f, 1.f);
|
||||
float rainyProb= weatherNode->getAttribute("rain")->getFloatValue(0.f, 1.f) + sunnyProb;
|
||||
double sunnyProb= weatherNode->getAttribute("sun")->getFloatValue(0.f, 1.f);
|
||||
double rainyProb= weatherNode->getAttribute("rain")->getFloatValue(0.f, 1.f) + sunnyProb;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
#ifdef USE_STREFLOP
|
||||
float rnd= streflop::fabs(static_cast<streflop::Simple>(random.randRange(-1.f, 1.f)));
|
||||
double rnd= streflop::fabs(static_cast<streflop::Simple>(random.randRange(-1.f, 1.f)));
|
||||
#else
|
||||
float rnd= fabs(random.randRange(-1.f, 1.f));
|
||||
double rnd= fabs(random.randRange(-1.f, 1.f));
|
||||
#endif
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -505,7 +505,7 @@ void Tileset::addSurfTex(int leftUp, int rightUp, int leftDown, int rightDown, V
|
|||
//center textures
|
||||
if(leftUp == rightUp && leftUp == leftDown && leftUp == rightDown) {
|
||||
//texture variation according to probability
|
||||
float r= random.randRange(0.f, 1.f);
|
||||
double r= random.randRange(0.f, 1.f);
|
||||
const Pixmap2D *pixmap = NULL;
|
||||
|
||||
if(surfProbs[leftUp][0] < 0) {
|
||||
|
@ -514,7 +514,7 @@ void Tileset::addSurfTex(int leftUp, int rightUp, int leftDown, int rightDown, V
|
|||
pixmap = getSurfPixmap(leftUp, (mapY % parts) * parts + (mapX % parts));
|
||||
}
|
||||
else {
|
||||
float max= 0.f;
|
||||
double max= 0.f;
|
||||
int var= 0;
|
||||
for(int i=0; i < surfProbs[leftUp].size(); ++i) {
|
||||
max += surfProbs[leftUp][i];
|
||||
|
|
|
@ -120,8 +120,8 @@ public:
|
|||
static const int surfCount= 6;
|
||||
static const int objCount= 10;
|
||||
static const int transitionVars= 2; //number or different transition textures
|
||||
static const float standardAirHeight;
|
||||
static const float standardShadowIntensity;
|
||||
static const double standardAirHeight;
|
||||
static const double standardShadowIntensity;
|
||||
|
||||
public:
|
||||
typedef vector<float> SurfProbs;
|
||||
|
@ -142,13 +142,13 @@ private:
|
|||
bool waterEffects;
|
||||
bool fog;
|
||||
int fogMode;
|
||||
float fogDensity;
|
||||
double fogDensity;
|
||||
Vec3f fogColor;
|
||||
Vec3f sunLightColor;
|
||||
Vec3f moonLightColor;
|
||||
float shadowIntensity;
|
||||
double shadowIntensity;
|
||||
Weather weather;
|
||||
float airHeight;
|
||||
double airHeight;
|
||||
|
||||
AmbientSounds ambientSounds;
|
||||
Checksum checksumValue;
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
Checksum * getChecksumValue() { return &checksumValue; }
|
||||
|
||||
//get
|
||||
float getAirHeight()const {return airHeight;}
|
||||
double getAirHeight()const {return airHeight;}
|
||||
const SurfaceAtlas *getSurfaceAtlas() const {return &surfaceAtlas;}
|
||||
ObjectType *getObjectType(int i) {return &objectTypes[i];}
|
||||
float getSurfProb(int surf, int var) const {return surfProbs[surf][var];}
|
||||
|
@ -186,11 +186,11 @@ public:
|
|||
bool getWaterEffects() const {return waterEffects;}
|
||||
bool getFog() const {return fog;}
|
||||
int getFogMode() const {return fogMode;}
|
||||
float getFogDensity() const {return fogDensity;}
|
||||
double getFogDensity() const {return fogDensity;}
|
||||
const Vec3f &getFogColor() const {return fogColor;}
|
||||
const Vec3f &getSunLightColor() const {return sunLightColor;}
|
||||
const Vec3f &getMoonLightColor() const {return moonLightColor;}
|
||||
float getShadowIntense()const {return shadowIntensity;}
|
||||
double getShadowIntense()const {return shadowIntensity;}
|
||||
Weather getWeather() const {return weather;}
|
||||
void setWeather(Weather value) { weather = value; }
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
Vec3f speed;
|
||||
Vec3f accel;
|
||||
Vec4f color;
|
||||
float size;
|
||||
double size;
|
||||
int energy;
|
||||
|
||||
public:
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
Vec3f getSpeed() const {return speed;}
|
||||
Vec3f getAccel() const {return accel;}
|
||||
Vec4f getColor() const {return color;}
|
||||
float getSize() const {return size;}
|
||||
double getSize() const {return size;}
|
||||
int getEnergy() const {return energy;}
|
||||
|
||||
void saveGame(XmlNode *rootNode);
|
||||
|
@ -138,12 +138,12 @@ protected:
|
|||
Vec3f pos;
|
||||
Vec4f color;
|
||||
Vec4f colorNoEnergy;
|
||||
float emissionRate;
|
||||
float emissionState;
|
||||
double emissionRate;
|
||||
double emissionState;
|
||||
int maxParticleEnergy;
|
||||
int varParticleEnergy;
|
||||
float particleSize;
|
||||
float speed;
|
||||
double particleSize;
|
||||
double speed;
|
||||
Vec3f factionColor;
|
||||
bool teamcolorNoEnergy;
|
||||
bool teamcolorEnergy;
|
||||
|
@ -184,11 +184,11 @@ public:
|
|||
virtual void setPos(Vec3f pos);
|
||||
void setColor(Vec4f color);
|
||||
void setColorNoEnergy(Vec4f color);
|
||||
void setEmissionRate(float emissionRate);
|
||||
void setEmissionRate(double emissionRate);
|
||||
void setMaxParticleEnergy(int maxParticleEnergy);
|
||||
void setVarParticleEnergy(int varParticleEnergy);
|
||||
void setParticleSize(float particleSize);
|
||||
void setSpeed(float speed);
|
||||
void setParticleSize(double particleSize);
|
||||
void setSpeed(double speed);
|
||||
virtual void setActive(bool active);
|
||||
void setObserver(ParticleObserver *particleObserver);
|
||||
virtual void setVisible(bool visible);
|
||||
|
@ -236,7 +236,7 @@ protected:
|
|||
|
||||
class FireParticleSystem: public ParticleSystem{
|
||||
private:
|
||||
float radius;
|
||||
double radius;
|
||||
Vec3f windSpeed;
|
||||
|
||||
public:
|
||||
|
@ -249,8 +249,8 @@ public:
|
|||
virtual void updateParticle(Particle *p);
|
||||
|
||||
//set params
|
||||
void setRadius(float radius);
|
||||
void setWind(float windAngle, float windSpeed);
|
||||
void setRadius(double radius);
|
||||
void setWind(double windAngle, double windSpeed);
|
||||
|
||||
virtual void saveGame(XmlNode *rootNode);
|
||||
virtual void loadGame(const XmlNode *rootNode);
|
||||
|
@ -284,13 +284,13 @@ public:
|
|||
void setOffset(Vec3f offset);
|
||||
void setModel(Model *model) {this->model= model;}
|
||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||
float getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
||||
double getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
||||
Model *getModel() const {return model;}
|
||||
virtual string getModelFileLoadDeferred();
|
||||
|
||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||
Vec3f getDirection() const {return direction;}
|
||||
void setModelCycle(float modelCycle) {this->modelCycle= modelCycle;}
|
||||
void setModelCycle(double modelCycle) {this->modelCycle= modelCycle;}
|
||||
|
||||
virtual void saveGame(XmlNode *rootNode);
|
||||
virtual void loadGame(const XmlNode *rootNode);
|
||||
|
@ -306,14 +306,14 @@ protected:
|
|||
|
||||
string modelFileLoadDeferred;
|
||||
Model *model;
|
||||
float modelCycle;
|
||||
double modelCycle;
|
||||
Vec3f offset;
|
||||
Vec3f direction;
|
||||
float tween;
|
||||
double tween;
|
||||
|
||||
GameParticleSystem(int particleCount);
|
||||
void positionChildren();
|
||||
void setTween(float relative,float absolute);
|
||||
void setTween(double relative,double absolute);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
|
@ -325,15 +325,15 @@ public:
|
|||
static bool isNight;
|
||||
static Vec3f lightColor;
|
||||
private:
|
||||
float radius;
|
||||
float minRadius;
|
||||
double radius;
|
||||
double minRadius;
|
||||
Vec3f windSpeed;
|
||||
Vec3f cRotation;
|
||||
Vec3f fixedAddition;
|
||||
Vec3f oldPosition;
|
||||
bool energyUp;
|
||||
float startTime;
|
||||
float endTime;
|
||||
double startTime;
|
||||
double endTime;
|
||||
|
||||
public:
|
||||
enum Shape{
|
||||
|
@ -345,10 +345,10 @@ public:
|
|||
bool relativeDirection;
|
||||
bool fixed;
|
||||
Shape shape;
|
||||
float angle;
|
||||
float sizeNoEnergy;
|
||||
float gravity;
|
||||
float rotation;
|
||||
double angle;
|
||||
double sizeNoEnergy;
|
||||
double gravity;
|
||||
double rotation;
|
||||
bool isVisibleAtNight;
|
||||
bool isVisibleAtDay;
|
||||
bool isDaylightAffected;
|
||||
|
@ -356,7 +356,7 @@ public:
|
|||
int staticParticleCount;
|
||||
int delay;
|
||||
int lifetime;
|
||||
float emissionRateFade;
|
||||
double emissionRateFade;
|
||||
GameParticleSystem* parent;
|
||||
|
||||
public:
|
||||
|
@ -373,22 +373,22 @@ public:
|
|||
virtual void fade();
|
||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||
|
||||
virtual void setStartTime(float startTime) { this->startTime = startTime; }
|
||||
virtual float getStartTime() const { return this->startTime; }
|
||||
virtual void setEndTime(float endTime) { this->endTime = endTime; }
|
||||
virtual float getEndTime() const { return this->endTime; }
|
||||
virtual void setStartTime(double startTime) { this->startTime = startTime; }
|
||||
virtual double getStartTime() const { return this->startTime; }
|
||||
virtual void setEndTime(double endTime) { this->endTime = endTime; }
|
||||
virtual double getEndTime() const { return this->endTime; }
|
||||
|
||||
//set params
|
||||
void setRadius(float radius) {this->radius= radius;}
|
||||
void setMinRadius(float minRadius) {this->minRadius= minRadius;}
|
||||
void setEmissionRateFade(float emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
||||
void setRadius(double radius) {this->radius= radius;}
|
||||
void setMinRadius(double minRadius) {this->minRadius= minRadius;}
|
||||
void setEmissionRateFade(double emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
||||
|
||||
void setWind(float windAngle, float windSpeed);
|
||||
void setWind(double windAngle, double windSpeed);
|
||||
|
||||
void setDirection(Vec3f direction) {this->direction= direction;}
|
||||
void setSizeNoEnergy(float sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||
void setGravity(float gravity) {this->gravity= gravity;}
|
||||
void setRotation(float rotation);
|
||||
void setSizeNoEnergy(double sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||
void setGravity(double gravity) {this->gravity= gravity;}
|
||||
void setRotation(double rotation);
|
||||
void setRelative(bool relative) {this->relative= relative;}
|
||||
void setRelativeDirection(bool relativeDirection) {this->relativeDirection= relativeDirection;}
|
||||
void setFixed(bool fixed) {this->fixed= fixed;}
|
||||
|
@ -399,7 +399,7 @@ public:
|
|||
void setIsVisibleAtDay(bool value) {this->isVisibleAtDay= value;}
|
||||
void setRadiusBasedStartenergy(bool value) {this->radiusBasedStartenergy= value;}
|
||||
void setShape(Shape shape) {this->shape= shape;}
|
||||
void setAngle(float angle) {this->angle= angle;}
|
||||
void setAngle(double angle) {this->angle= angle;}
|
||||
void setDelay(int delay) {this->delay= delay;}
|
||||
void setLifetime(int lifetime) {this->lifetime= lifetime;}
|
||||
void setParent(GameParticleSystem* parent) {this->parent= parent;}
|
||||
|
@ -423,7 +423,7 @@ public:
|
|||
class RainParticleSystem: public ParticleSystem{
|
||||
private:
|
||||
Vec3f windSpeed;
|
||||
float radius;
|
||||
double radius;
|
||||
|
||||
public:
|
||||
RainParticleSystem(int particleCount= 4000);
|
||||
|
@ -435,8 +435,8 @@ public:
|
|||
virtual void initParticle(Particle *p, int particleIndex);
|
||||
virtual bool deathTest(Particle *p);
|
||||
|
||||
void setRadius(float radius);
|
||||
void setWind(float windAngle, float windSpeed);
|
||||
void setRadius(double radius);
|
||||
void setWind(double windAngle, double windSpeed);
|
||||
|
||||
virtual string toString() const;
|
||||
|
||||
|
@ -450,7 +450,7 @@ public:
|
|||
class SnowParticleSystem: public ParticleSystem{
|
||||
private:
|
||||
Vec3f windSpeed;
|
||||
float radius;
|
||||
double radius;
|
||||
|
||||
public:
|
||||
SnowParticleSystem(int particleCount= 4000);
|
||||
|
@ -460,8 +460,8 @@ public:
|
|||
virtual void initParticle(Particle *p, int particleIndex);
|
||||
virtual bool deathTest(Particle *p);
|
||||
|
||||
void setRadius(float radius);
|
||||
void setWind(float windAngle, float windSpeed);
|
||||
void setRadius(double radius);
|
||||
void setWind(double windAngle, double windSpeed);
|
||||
|
||||
virtual string toString() const;
|
||||
|
||||
|
@ -477,15 +477,15 @@ public:
|
|||
class AttackParticleSystem: public GameParticleSystem {
|
||||
|
||||
protected:
|
||||
float sizeNoEnergy;
|
||||
float gravity;
|
||||
double sizeNoEnergy;
|
||||
double gravity;
|
||||
public:
|
||||
AttackParticleSystem(int particleCount);
|
||||
|
||||
virtual ParticleSystemType getParticleSystemType() const { return pst_ProjectileParticleSystem;}
|
||||
|
||||
void setSizeNoEnergy(float sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||
void setGravity(float gravity) {this->gravity= gravity;}
|
||||
void setSizeNoEnergy(double sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||
void setGravity(double gravity) {this->gravity= gravity;}
|
||||
|
||||
virtual void initParticleSystem() {} // opportunity to do any initialization when the system has been created and all settings set
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
void init(int seed);
|
||||
|
||||
int randRange(int min, int max,std::string lastCaller="");
|
||||
float randRange(float min, float max,std::string lastCaller="");
|
||||
double randRange(double min, double max,std::string lastCaller="");
|
||||
|
||||
int getLastNumber() const { return lastNumber; }
|
||||
void setLastNumber(int value) { lastNumber = value; }
|
||||
|
|
|
@ -55,7 +55,7 @@ void Particle::saveGame(XmlNode *rootNode) {
|
|||
// Vec4f color;
|
||||
particleNode->addAttribute("color",color.getString(), mapTagReplacements);
|
||||
// float size;
|
||||
particleNode->addAttribute("size",floatToStr(size,16), mapTagReplacements);
|
||||
particleNode->addAttribute("size",doubleToStr(size,16), mapTagReplacements);
|
||||
// int energy;
|
||||
particleNode->addAttribute("energy",intToStr(energy), mapTagReplacements);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ void ParticleSystem::update(){
|
|||
Particle *p= createParticle();
|
||||
initParticle(p, i);
|
||||
}
|
||||
emissionState= emissionState - (float) emissionIntValue;
|
||||
emissionState = emissionState - (double) emissionIntValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ void ParticleSystem::setColorNoEnergy(Vec4f colorNoEnergy){
|
|||
this->colorNoEnergy= colorNoEnergy;
|
||||
}
|
||||
|
||||
void ParticleSystem::setEmissionRate(float emissionRate){
|
||||
void ParticleSystem::setEmissionRate(double emissionRate){
|
||||
this->emissionRate= emissionRate;
|
||||
}
|
||||
|
||||
|
@ -277,11 +277,11 @@ void ParticleSystem::setVarParticleEnergy(int varParticleEnergy){
|
|||
this->varParticleEnergy= varParticleEnergy;
|
||||
}
|
||||
|
||||
void ParticleSystem::setParticleSize(float particleSize){
|
||||
void ParticleSystem::setParticleSize(double particleSize){
|
||||
this->particleSize= particleSize;
|
||||
}
|
||||
|
||||
void ParticleSystem::setSpeed(float speed){
|
||||
void ParticleSystem::setSpeed(double speed){
|
||||
this->speed= speed;
|
||||
}
|
||||
|
||||
|
@ -329,17 +329,17 @@ string ParticleSystem::toString() const {
|
|||
result += "\ntextureFileLoadDeferredComponents = " + intToStr(textureFileLoadDeferredComponents);
|
||||
|
||||
if(texture != NULL) {
|
||||
result += "\ntexture = " + texture->getPath();
|
||||
result += "\ntexture = " + extractFileFromDirectoryPath(texture->getPath());
|
||||
}
|
||||
result += "\npos = " + pos.getString();
|
||||
result += "\ncolor = " + color.getString();
|
||||
result += "\ncolorNoEnergy = " + colorNoEnergy.getString();
|
||||
result += "\nemissionRate = " + floatToStr(emissionRate,16);
|
||||
result += "\nemissionState = " + floatToStr(emissionState,16);
|
||||
result += "\nemissionRate = " + doubleToStr(emissionRate,16);
|
||||
result += "\nemissionState = " + doubleToStr(emissionState,16);
|
||||
result += "\nmaxParticleEnergy = " + intToStr(maxParticleEnergy);
|
||||
result += "\nvarParticleEnergy = " + intToStr(varParticleEnergy);
|
||||
result += "\nparticleSize = " + floatToStr(particleSize,16);
|
||||
result += "\nspeed = " + floatToStr(speed,16);
|
||||
result += "\nparticleSize = " + doubleToStr(particleSize,16);
|
||||
result += "\nspeed = " + doubleToStr(speed,16);
|
||||
result += "\nfactionColor = " + factionColor.getString();
|
||||
result += "\nteamcolorNoEnergy = " + intToStr(teamcolorNoEnergy);
|
||||
result += "\nteamcolorEnergy = " + intToStr(teamcolorEnergy);
|
||||
|
@ -392,17 +392,17 @@ void ParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
// Vec4f colorNoEnergy;
|
||||
particleSystemNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements);
|
||||
// float emissionRate;
|
||||
particleSystemNode->addAttribute("emissionRate",floatToStr(emissionRate,16), mapTagReplacements);
|
||||
particleSystemNode->addAttribute("emissionRate",doubleToStr(emissionRate,16), mapTagReplacements);
|
||||
// float emissionState;
|
||||
particleSystemNode->addAttribute("emissionState",floatToStr(emissionState,16), mapTagReplacements);
|
||||
particleSystemNode->addAttribute("emissionState",doubleToStr(emissionState,16), mapTagReplacements);
|
||||
// int maxParticleEnergy;
|
||||
particleSystemNode->addAttribute("maxParticleEnergy",intToStr(maxParticleEnergy), mapTagReplacements);
|
||||
// int varParticleEnergy;
|
||||
particleSystemNode->addAttribute("varParticleEnergy",intToStr(varParticleEnergy), mapTagReplacements);
|
||||
// float particleSize;
|
||||
particleSystemNode->addAttribute("particleSize",floatToStr(particleSize,16), mapTagReplacements);
|
||||
particleSystemNode->addAttribute("particleSize",doubleToStr(particleSize,16), mapTagReplacements);
|
||||
// float speed;
|
||||
particleSystemNode->addAttribute("speed",floatToStr(speed,16), mapTagReplacements);
|
||||
particleSystemNode->addAttribute("speed",doubleToStr(speed,16), mapTagReplacements);
|
||||
// Vec3f factionColor;
|
||||
particleSystemNode->addAttribute("factionColor",factionColor.getString(), mapTagReplacements);
|
||||
// bool teamcolorNoEnergy;
|
||||
|
@ -656,21 +656,21 @@ FireParticleSystem::FireParticleSystem(int particleCount) :
|
|||
void FireParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
ParticleSystem::initParticle(p, particleIndex);
|
||||
|
||||
float ang= random.randRange(-2.0f * pi, 2.0f * pi);
|
||||
double ang= random.randRange(-2.0f * pi, 2.0f * pi);
|
||||
#ifdef USE_STREFLOP
|
||||
float mod= streflop::fabsf(static_cast<streflop::Simple>(random.randRange(-radius, radius)));
|
||||
double mod= streflop::fabsf(static_cast<streflop::Simple>(random.randRange(-radius, radius)));
|
||||
|
||||
float x= streflop::sinf(static_cast<streflop::Simple>(ang))*mod;
|
||||
float y= streflop::cosf(static_cast<streflop::Simple>(ang))*mod;
|
||||
double x= streflop::sinf(static_cast<streflop::Simple>(ang))*mod;
|
||||
double y= streflop::cosf(static_cast<streflop::Simple>(ang))*mod;
|
||||
|
||||
float radRatio= streflop::sqrtf(static_cast<streflop::Simple>(mod/radius));
|
||||
double radRatio= streflop::sqrtf(static_cast<streflop::Simple>(mod/radius));
|
||||
#else
|
||||
float mod= fabsf(random.randRange(-radius, radius));
|
||||
double mod= fabsf(random.randRange(-radius, radius));
|
||||
|
||||
float x= sinf(ang) * mod;
|
||||
float y= cosf(ang) * mod;
|
||||
double x= sinf(ang) * mod;
|
||||
double y= cosf(ang) * mod;
|
||||
|
||||
float radRatio= sqrtf((mod / radius));
|
||||
double radRatio= sqrtf((mod / radius));
|
||||
#endif
|
||||
|
||||
p->color= colorNoEnergy * 0.5f + colorNoEnergy * 0.5f * radRatio;
|
||||
|
@ -702,18 +702,18 @@ string FireParticleSystem::toString() const {
|
|||
string result = ParticleSystem::toString();
|
||||
|
||||
result += "\nFireParticleSystem ";
|
||||
result += "\nradius = " + floatToStr(radius);
|
||||
result += "\nradius = " + doubleToStr(radius);
|
||||
result += "\nwindSpeed = " + windSpeed.getString();
|
||||
|
||||
return result;
|
||||
}
|
||||
// ================= SET PARAMS ====================
|
||||
|
||||
void FireParticleSystem::setRadius(float radius){
|
||||
void FireParticleSystem::setRadius(double radius){
|
||||
this->radius= radius;
|
||||
}
|
||||
|
||||
void FireParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
void FireParticleSystem::setWind(double windAngle, double windSpeed) {
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
|
@ -732,7 +732,7 @@ void FireParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
ParticleSystem::saveGame(fireParticleSystemNode);
|
||||
|
||||
// float radius;
|
||||
fireParticleSystemNode->addAttribute("radius",floatToStr(radius,16), mapTagReplacements);
|
||||
fireParticleSystemNode->addAttribute("radius",doubleToStr(radius,16), mapTagReplacements);
|
||||
// Vec3f windSpeed;
|
||||
fireParticleSystemNode->addAttribute("windSpeed",windSpeed.getString(), mapTagReplacements);
|
||||
}
|
||||
|
@ -845,7 +845,7 @@ void GameParticleSystem::render(ParticleRenderer *pr, ModelRenderer *mr){
|
|||
}
|
||||
}
|
||||
|
||||
void GameParticleSystem::setTween(float relative,float absolute) {
|
||||
void GameParticleSystem::setTween(double relative,double absolute) {
|
||||
if(model) {
|
||||
// animation?
|
||||
//printf("#1 Particle model meshcount [%d] modelCycle = %f, relative = %f, absolute = %f\n",model->getMeshCount(),modelCycle,relative,absolute);
|
||||
|
@ -870,7 +870,7 @@ void GameParticleSystem::setTween(float relative,float absolute) {
|
|||
}
|
||||
}
|
||||
|
||||
truncateDecimal<float>(tween);
|
||||
tween = truncateDecimal<double>(tween);
|
||||
if(tween < 0.0f || tween > 1.0f) {
|
||||
//printf("In [%s::%s Line: %d] WARNING setting tween to [%f] clamping tween, modelCycle [%f] absolute [%f] relative [%f]\n",__FILE__,__FUNCTION__,__LINE__,tween,modelCycle,absolute,relative);
|
||||
//assert(tween >= 0.0f && tween <= 1.0f);
|
||||
|
@ -908,13 +908,13 @@ void GameParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
gameParticleSystemNode->addAttribute("model",model->getFileName(), mapTagReplacements);
|
||||
}
|
||||
// float modelCycle;
|
||||
gameParticleSystemNode->addAttribute("modelCycle",floatToStr(modelCycle,16), mapTagReplacements);
|
||||
gameParticleSystemNode->addAttribute("modelCycle",doubleToStr(modelCycle,16), mapTagReplacements);
|
||||
// Vec3f offset;
|
||||
gameParticleSystemNode->addAttribute("offset",offset.getString(), mapTagReplacements);
|
||||
// Vec3f direction;
|
||||
gameParticleSystemNode->addAttribute("direction",direction.getString(), mapTagReplacements);
|
||||
// float tween;
|
||||
gameParticleSystemNode->addAttribute("tween",floatToStr(tween,16), mapTagReplacements);
|
||||
gameParticleSystemNode->addAttribute("tween",doubleToStr(tween,16), mapTagReplacements);
|
||||
}
|
||||
void GameParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||
const XmlNode *gameParticleSystemNode = rootNode->getChild("GameParticleSystem");
|
||||
|
@ -974,10 +974,10 @@ string GameParticleSystem::toString() const {
|
|||
|
||||
//string modelFileLoadDeferred;
|
||||
//Model *model;
|
||||
result += "\nmodelCycle = " + floatToStr(modelCycle);
|
||||
result += "\nmodelCycle = " + doubleToStr(modelCycle);
|
||||
result += "\noffset = " + offset.getString();
|
||||
result += "\ndirection = " + direction.getString();
|
||||
result += "\ntween = " + floatToStr(tween);
|
||||
result += "\ntween = " + doubleToStr(tween);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1018,7 +1018,7 @@ UnitParticleSystem::UnitParticleSystem(int particleCount) :
|
|||
fixedAddition= Vec3f(0.0f, 0.0f, 0.0f);
|
||||
//prepare system for given staticParticleCount
|
||||
if(staticParticleCount > 0){
|
||||
emissionState= (float) staticParticleCount;
|
||||
emissionState= (double) staticParticleCount;
|
||||
}
|
||||
energyUp= false;
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ void UnitParticleSystem::render(ParticleRenderer *pr, ModelRenderer *mr) {
|
|||
GameParticleSystem::render(pr,mr);
|
||||
}
|
||||
|
||||
void UnitParticleSystem::setRotation(float rotation){
|
||||
void UnitParticleSystem::setRotation(double rotation){
|
||||
this->rotation= rotation;
|
||||
for(Children::iterator it= children.begin(); it != children.end(); ++it)
|
||||
(*it)->setRotation(rotation);
|
||||
|
@ -1082,13 +1082,13 @@ UnitParticleSystem::Shape UnitParticleSystem::strToShape(const string& str){
|
|||
void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
ParticleSystem::initParticle(p, particleIndex);
|
||||
|
||||
const float ang= random.randRange(-2.0f * pi, 2.0f * pi);
|
||||
const double ang= random.randRange(-2.0f * pi, 2.0f * pi);
|
||||
#ifdef USE_STREFLOP
|
||||
const float mod= streflop::fabsf(static_cast<streflop::Simple>(random.randRange(-radius, radius)));
|
||||
const float radRatio= streflop::sqrtf(static_cast<streflop::Simple>(mod/radius));
|
||||
const double mod= streflop::fabsf(static_cast<streflop::Simple>(random.randRange(-radius, radius)));
|
||||
const double radRatio= streflop::sqrtf(static_cast<streflop::Simple>(mod/radius));
|
||||
#else
|
||||
const float mod= fabsf(random.randRange(-radius, radius));
|
||||
const float radRatio= sqrtf(mod / radius);
|
||||
const double mod= fabsf(random.randRange(-radius, radius));
|
||||
const double radRatio= sqrtf(mod / radius);
|
||||
#endif
|
||||
p->color= color;
|
||||
if(isDaylightAffected==true)
|
||||
|
@ -1113,7 +1113,7 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
|||
// work out where we start for our shape (set speed and pos)
|
||||
switch(shape){
|
||||
case sSpherical:
|
||||
angle = (float)random.randRange(0,360);
|
||||
angle = (double)random.randRange(0,360);
|
||||
// fall through
|
||||
case sConical:{
|
||||
Vec2f horiz = Vec2f(1,0).rotate(ang);
|
||||
|
@ -1125,13 +1125,13 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
|||
} break;
|
||||
case sLinear:{
|
||||
#ifdef USE_STREFLOP
|
||||
float x= streflop::sinf(static_cast<streflop::Simple>(ang))*mod;
|
||||
float y= streflop::cosf(static_cast<streflop::Simple>(ang))*mod;
|
||||
double x= streflop::sinf(static_cast<streflop::Simple>(ang))*mod;
|
||||
double y= streflop::cosf(static_cast<streflop::Simple>(ang))*mod;
|
||||
#else
|
||||
float x= sinf(ang) * mod;
|
||||
float y= cosf(ang) * mod;
|
||||
double x= sinf(ang) * mod;
|
||||
double y= cosf(ang) * mod;
|
||||
#endif
|
||||
const float rad= degToRad(rotation);
|
||||
const double rad= degToRad(rotation);
|
||||
if(!relative){
|
||||
p->pos= Vec3f(pos.x + x + offset.x, pos.y + random.randRange(-radius / 2, radius / 2) + offset.y, pos.z + y
|
||||
+ offset.z);
|
||||
|
@ -1182,10 +1182,10 @@ void UnitParticleSystem::update(){
|
|||
}
|
||||
|
||||
void UnitParticleSystem::updateParticle(Particle *p){
|
||||
float energyRatio;
|
||||
double energyRatio;
|
||||
if(alternations > 0){
|
||||
int interval= (maxParticleEnergy / alternations);
|
||||
float moduloValue= (float)((int)(static_cast<float> (p->energy)) % interval);
|
||||
double moduloValue= (double)((int)(static_cast<double> (p->energy)) % interval);
|
||||
|
||||
if(moduloValue < interval / 2){
|
||||
energyRatio= (interval - moduloValue) / interval;
|
||||
|
@ -1196,7 +1196,7 @@ void UnitParticleSystem::updateParticle(Particle *p){
|
|||
energyRatio= clamp(energyRatio, 0.f, 1.f);
|
||||
}
|
||||
else{
|
||||
energyRatio= clamp(static_cast<float> (p->energy) / maxParticleEnergy, 0.f, 1.f);
|
||||
energyRatio= clamp(static_cast<double> (p->energy) / maxParticleEnergy, 0.f, 1.f);
|
||||
}
|
||||
|
||||
p->lastPos+= p->speed;
|
||||
|
@ -1238,7 +1238,7 @@ void UnitParticleSystem::updateParticle(Particle *p){
|
|||
|
||||
// ================= SET PARAMS ====================
|
||||
|
||||
void UnitParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
void UnitParticleSystem::setWind(double windAngle, double windSpeed){
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
|
@ -1257,9 +1257,9 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
GameParticleSystem::saveGame(unitParticleSystemNode);
|
||||
|
||||
// float radius;
|
||||
unitParticleSystemNode->addAttribute("radius",floatToStr(radius,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("radius",doubleToStr(radius,16), mapTagReplacements);
|
||||
// float minRadius;
|
||||
unitParticleSystemNode->addAttribute("minRadius",floatToStr(minRadius,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("minRadius",doubleToStr(minRadius,16), mapTagReplacements);
|
||||
// Vec3f windSpeed;
|
||||
unitParticleSystemNode->addAttribute("windSpeed",windSpeed.getString(), mapTagReplacements);
|
||||
// Vec3f cRotation;
|
||||
|
@ -1271,9 +1271,9 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
// bool energyUp;
|
||||
unitParticleSystemNode->addAttribute("energyUp",intToStr(energyUp), mapTagReplacements);
|
||||
// float startTime;
|
||||
unitParticleSystemNode->addAttribute("startTime",floatToStr(startTime,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("startTime",doubleToStr(startTime,16), mapTagReplacements);
|
||||
// float endTime;
|
||||
unitParticleSystemNode->addAttribute("endTime",floatToStr(endTime,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("endTime",doubleToStr(endTime,16), mapTagReplacements);
|
||||
// bool relative;
|
||||
unitParticleSystemNode->addAttribute("relative",intToStr(relative), mapTagReplacements);
|
||||
// bool relativeDirection;
|
||||
|
@ -1283,13 +1283,13 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
// Shape shape;
|
||||
unitParticleSystemNode->addAttribute("shape",intToStr(shape), mapTagReplacements);
|
||||
// float angle;
|
||||
unitParticleSystemNode->addAttribute("angle",floatToStr(angle,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("angle",doubleToStr(angle,16), mapTagReplacements);
|
||||
// float sizeNoEnergy;
|
||||
unitParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("sizeNoEnergy",doubleToStr(sizeNoEnergy,16), mapTagReplacements);
|
||||
// float gravity;
|
||||
unitParticleSystemNode->addAttribute("gravity",floatToStr(gravity,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("gravity",doubleToStr(gravity,16), mapTagReplacements);
|
||||
// float rotation;
|
||||
unitParticleSystemNode->addAttribute("rotation",floatToStr(rotation,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("rotation",doubleToStr(rotation,16), mapTagReplacements);
|
||||
// bool isVisibleAtNight;
|
||||
unitParticleSystemNode->addAttribute("isVisibleAtNight",intToStr(isVisibleAtNight), mapTagReplacements);
|
||||
// bool isVisibleAtDay;
|
||||
|
@ -1305,7 +1305,7 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
// int lifetime;
|
||||
unitParticleSystemNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements);
|
||||
// float emissionRateFade;
|
||||
unitParticleSystemNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), mapTagReplacements);
|
||||
unitParticleSystemNode->addAttribute("emissionRateFade",doubleToStr(emissionRateFade,16), mapTagReplacements);
|
||||
// GameParticleSystem* parent;
|
||||
//if(parent != NULL) {
|
||||
// parent->saveGame(unitParticleSystemNode);
|
||||
|
@ -1393,24 +1393,24 @@ string UnitParticleSystem::toString() const {
|
|||
string result = ParticleSystem::toString();
|
||||
|
||||
result += "\nUnitParticleSystem ";
|
||||
result += "\nradius = " + floatToStr(radius);
|
||||
result += "\nminRadius = " + floatToStr(minRadius);
|
||||
result += "\nradius = " + doubleToStr(radius);
|
||||
result += "\nminRadius = " + doubleToStr(minRadius);
|
||||
result += "\nwindSpeed = " + windSpeed.getString();
|
||||
result += "\ncRotation = " + cRotation.getString();
|
||||
result += "\nfixedAddition = " + fixedAddition.getString();
|
||||
result += "\noldPosition = " + oldPosition.getString();
|
||||
result += "\nenergyUp = " + intToStr(energyUp);
|
||||
result += "\nstartTime = " + floatToStr(startTime);
|
||||
result += "\nendTime = " + floatToStr(endTime);
|
||||
result += "\nstartTime = " + doubleToStr(startTime);
|
||||
result += "\nendTime = " + doubleToStr(endTime);
|
||||
result += "\nrelative = " + intToStr(relative);
|
||||
result += "\nrelativeDirection = " + intToStr(relativeDirection);
|
||||
result += "\nfixed = " + intToStr(fixed);
|
||||
result += "\nshape = " + intToStr(shape);
|
||||
|
||||
result += "\nangle = " + floatToStr(angle);
|
||||
result += "\nsizeNoEnergy = " + floatToStr(sizeNoEnergy);
|
||||
result += "\ngravity = " + floatToStr(gravity);
|
||||
result += "\nrotation = " + floatToStr(rotation);
|
||||
result += "\nangle = " + doubleToStr(angle);
|
||||
result += "\nsizeNoEnergy = " + doubleToStr(sizeNoEnergy);
|
||||
result += "\ngravity = " + doubleToStr(gravity);
|
||||
result += "\nrotation = " + doubleToStr(rotation);
|
||||
result += "\nisVisibleAtNight = " + intToStr(isVisibleAtNight);
|
||||
result += "\nisVisibleAtDay = " + intToStr(isVisibleAtDay);
|
||||
result += "\nisDaylightAffected = " + intToStr(isDaylightAffected);
|
||||
|
@ -1418,7 +1418,7 @@ string UnitParticleSystem::toString() const {
|
|||
result += "\nstaticParticleCount = " + intToStr(staticParticleCount);
|
||||
result += "\ndelay = " + intToStr(delay);
|
||||
result += "\nlifetime = " + intToStr(lifetime);
|
||||
result += "\nemissionRateFade = " + floatToStr(emissionRateFade);
|
||||
result += "\nemissionRateFade = " + doubleToStr(emissionRateFade);
|
||||
//GameParticleSystem* parent;
|
||||
|
||||
return result;
|
||||
|
@ -1445,8 +1445,8 @@ void RainParticleSystem::render(ParticleRenderer *pr, ModelRenderer *mr){
|
|||
void RainParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
ParticleSystem::initParticle(p, particleIndex);
|
||||
|
||||
float x= random.randRange(-radius, radius);
|
||||
float y= random.randRange(-radius, radius);
|
||||
double x= random.randRange(-radius, radius);
|
||||
double y= random.randRange(-radius, radius);
|
||||
|
||||
p->color= color;
|
||||
p->energy= 10000;
|
||||
|
@ -1460,12 +1460,12 @@ bool RainParticleSystem::deathTest(Particle *p){
|
|||
return p->pos.y < 0;
|
||||
}
|
||||
|
||||
void RainParticleSystem::setRadius(float radius){
|
||||
void RainParticleSystem::setRadius(double radius) {
|
||||
this->radius= radius;
|
||||
|
||||
}
|
||||
|
||||
void RainParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
void RainParticleSystem::setWind(double windAngle, double windSpeed){
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
|
@ -1488,7 +1488,7 @@ string RainParticleSystem::toString() const {
|
|||
|
||||
result += "\nRainParticleSystem ";
|
||||
result += "\nwindSpeed = " + windSpeed.getString();
|
||||
result += "\nradius = " + floatToStr(radius);
|
||||
result += "\nradius = " + doubleToStr(radius);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1512,8 +1512,8 @@ void SnowParticleSystem::initParticle(Particle *p, int particleIndex){
|
|||
|
||||
ParticleSystem::initParticle(p, particleIndex);
|
||||
|
||||
float x= random.randRange(-radius, radius);
|
||||
float y= random.randRange(-radius, radius);
|
||||
double x= random.randRange(-radius, radius);
|
||||
double y= random.randRange(-radius, radius);
|
||||
|
||||
p->color= color;
|
||||
p->energy= 10000;
|
||||
|
@ -1528,11 +1528,11 @@ bool SnowParticleSystem::deathTest(Particle *p){
|
|||
return p->pos.y < 0;
|
||||
}
|
||||
|
||||
void SnowParticleSystem::setRadius(float radius){
|
||||
void SnowParticleSystem::setRadius(double radius){
|
||||
this->radius= radius;
|
||||
}
|
||||
|
||||
void SnowParticleSystem::setWind(float windAngle, float windSpeed){
|
||||
void SnowParticleSystem::setWind(double windAngle, double windSpeed){
|
||||
#ifdef USE_STREFLOP
|
||||
this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
|
||||
this->windSpeed.y= 0.0f;
|
||||
|
@ -1555,7 +1555,7 @@ string SnowParticleSystem::toString() const {
|
|||
|
||||
result += "\nSnowParticleSystem ";
|
||||
result += "\nwindSpeed = " + windSpeed.getString();
|
||||
result += "\nradius = " + floatToStr(radius);
|
||||
result += "\nradius = " + doubleToStr(radius);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1578,9 +1578,9 @@ void AttackParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
GameParticleSystem::saveGame(attackParticleSystemNode);
|
||||
|
||||
// float sizeNoEnergy;
|
||||
attackParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,16), mapTagReplacements);
|
||||
attackParticleSystemNode->addAttribute("sizeNoEnergy",doubleToStr(sizeNoEnergy,16), mapTagReplacements);
|
||||
// float gravity;
|
||||
attackParticleSystemNode->addAttribute("gravity",floatToStr(gravity,16), mapTagReplacements);
|
||||
attackParticleSystemNode->addAttribute("gravity",doubleToStr(gravity,16), mapTagReplacements);
|
||||
|
||||
}
|
||||
void AttackParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||
|
@ -1604,8 +1604,8 @@ string AttackParticleSystem::toString() const {
|
|||
string result = ParticleSystem::toString();
|
||||
|
||||
result += "\nAttackParticleSystem ";
|
||||
result += "\nsizeNoEnergy = " + floatToStr(sizeNoEnergy);
|
||||
result += "\ngravity = " + floatToStr(gravity);
|
||||
result += "\nsizeNoEnergy = " + doubleToStr(sizeNoEnergy);
|
||||
result += "\ngravity = " + doubleToStr(gravity);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1681,7 +1681,7 @@ void ProjectileParticleSystem::update(){
|
|||
//#endif
|
||||
|
||||
//printf("#a currentVector.length() = %f, targetVector.length() = %f, relative = %f, absolute = %f, trajectorySpeed = %f\n",currentVector.length(),targetVector.length(),relative,absolute,trajectorySpeed);
|
||||
float absolute = relative;
|
||||
double absolute = relative;
|
||||
|
||||
setTween(relative,absolute);
|
||||
|
||||
|
@ -1870,12 +1870,12 @@ void ProjectileParticleSystem::saveGame(XmlNode *rootNode) {
|
|||
// Trajectory trajectory;
|
||||
projectileParticleSystemNode->addAttribute("trajectory",intToStr(trajectory), mapTagReplacements);
|
||||
// float trajectorySpeed;
|
||||
projectileParticleSystemNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed,16), mapTagReplacements);
|
||||
projectileParticleSystemNode->addAttribute("trajectorySpeed",doubleToStr(trajectorySpeed,16), mapTagReplacements);
|
||||
// //parabolic
|
||||
// float trajectoryScale;
|
||||
projectileParticleSystemNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale,16), mapTagReplacements);
|
||||
projectileParticleSystemNode->addAttribute("trajectoryScale",doubleToStr(trajectoryScale,16), mapTagReplacements);
|
||||
// float trajectoryFrequency;
|
||||
projectileParticleSystemNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency,16), mapTagReplacements);
|
||||
projectileParticleSystemNode->addAttribute("trajectoryFrequency",doubleToStr(trajectoryFrequency,16), mapTagReplacements);
|
||||
}
|
||||
|
||||
void ProjectileParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||
|
@ -2018,7 +2018,7 @@ void SplashParticleSystem::initParticle(Particle *p, int particleIndex){
|
|||
}
|
||||
|
||||
void SplashParticleSystem::updateParticle(Particle *p){
|
||||
float energyRatio= clamp(static_cast<float> (p->energy) / maxParticleEnergy, 0.f, 1.f);
|
||||
double energyRatio= clamp(static_cast<double> (p->energy) / maxParticleEnergy, 0.f, 1.f);
|
||||
|
||||
p->lastPos= p->pos;
|
||||
p->pos= p->pos + p->speed;
|
||||
|
|
|
@ -101,7 +101,7 @@ int RandomGen::randRange(int min, int max,string lastCaller) {
|
|||
return res;
|
||||
}
|
||||
|
||||
float RandomGen::randRange(float min, float max,string lastCaller) {
|
||||
double RandomGen::randRange(double min, double max,string lastCaller) {
|
||||
//assert(min<=max);
|
||||
if(min > max) {
|
||||
char szBuf[8096]="";
|
||||
|
@ -112,9 +112,9 @@ float RandomGen::randRange(float min, float max,string lastCaller) {
|
|||
//#ifdef USE_STREFLOP
|
||||
// float res = streflop::Random<true, false, float>(min, max, randomState); // streflop
|
||||
//#else
|
||||
float rand01= static_cast<float>(RandomGen::rand(lastCaller))/(m-1);
|
||||
float res= min+(max-min)*rand01;
|
||||
res = truncateDecimal<float>(res);
|
||||
double rand01= static_cast<double>(RandomGen::rand(lastCaller))/(m-1);
|
||||
double res= min+(max-min)*rand01;
|
||||
res = truncateDecimal<double>(res);
|
||||
//#endif
|
||||
|
||||
//assert(res>=min && res<=max);
|
||||
|
|
Loading…
Reference in New Issue