- attempt to see if this makes stability better
This commit is contained in:
parent
ee6eadb0d8
commit
dc503d6340
|
@ -1340,7 +1340,7 @@ void MainWindow::loadParticle(string path) {
|
||||||
(*it)->setValues(ups);
|
(*it)->setValues(ups);
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
//getCurrVectorFlat() + Vec3f(0.f, type->getHeight()/2.f, 0.f);
|
//getCurrVectorFlat() + Vec3f(0.f, type->getHeight()/2.f, 0.f);
|
||||||
Vec3d vec = Vec3d(0.f, height / 2.f, 0.f);
|
Vec3f vec = Vec3f(0.f, height / 2.f, 0.f);
|
||||||
ups->setPos(vec);
|
ups->setPos(vec);
|
||||||
}
|
}
|
||||||
//ups->setFactionColor(getFaction()->getTexture()->getPixmap()->getPixel3f(0,0));
|
//ups->setFactionColor(getFaction()->getTexture()->getPixmap()->getPixel3f(0,0));
|
||||||
|
@ -1453,10 +1453,10 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
ProjectileParticleSystem *ps = (*it)->create(NULL);
|
ProjectileParticleSystem *ps = (*it)->create(NULL);
|
||||||
|
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
Vec3d vec = Vec3d(0.f, height / 2.f, 0.f);
|
Vec3f vec = Vec3f(0.f, height / 2.f, 0.f);
|
||||||
//ps->setPos(vec);
|
//ps->setPos(vec);
|
||||||
|
|
||||||
Vec3d vec2 = Vec3d(size * 2.f, height * 2.f, height * 2.f);
|
Vec3f vec2 = Vec3f(size * 2.f, height * 2.f, height * 2.f);
|
||||||
ps->setPath(vec, vec2);
|
ps->setPath(vec, vec2);
|
||||||
}
|
}
|
||||||
ps->setFactionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
ps->setFactionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
||||||
|
|
|
@ -1639,7 +1639,7 @@ void PathFinder::saveGame(XmlNode *rootNode) {
|
||||||
nodePoolNode->addAttribute("next",intToStr(nextIdx), mapTagReplacements);
|
nodePoolNode->addAttribute("next",intToStr(nextIdx), mapTagReplacements);
|
||||||
int prevIdx = findNodeIndex(curNode->prev, factionState.nodePool);
|
int prevIdx = findNodeIndex(curNode->prev, factionState.nodePool);
|
||||||
nodePoolNode->addAttribute("prev",intToStr(prevIdx), mapTagReplacements);
|
nodePoolNode->addAttribute("prev",intToStr(prevIdx), mapTagReplacements);
|
||||||
nodePoolNode->addAttribute("heuristic",doubleToStr(curNode->heuristic,10), mapTagReplacements);
|
nodePoolNode->addAttribute("heuristic",doubleToStr(curNode->heuristic,6), mapTagReplacements);
|
||||||
nodePoolNode->addAttribute("exploredCell",intToStr(curNode->exploredCell), mapTagReplacements);
|
nodePoolNode->addAttribute("exploredCell",intToStr(curNode->exploredCell), mapTagReplacements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1418,14 +1418,14 @@ void Game::init(bool initForPreviewOnly) {
|
||||||
logger.add(Lang::getInstance().get("LogScreenGameLoadingCreatingRainParticles","",true), true);
|
logger.add(Lang::getInstance().get("LogScreenGameLoadingCreatingRainParticles","",true), true);
|
||||||
weatherParticleSystem= new RainParticleSystem();
|
weatherParticleSystem= new RainParticleSystem();
|
||||||
weatherParticleSystem->setSpeed(12.f / GameConstants::updateFps);
|
weatherParticleSystem->setSpeed(12.f / GameConstants::updateFps);
|
||||||
weatherParticleSystem->setPos(Vec3d(gameCamera.getPos()));
|
weatherParticleSystem->setPos(gameCamera.getPos());
|
||||||
renderer.manageParticleSystem(weatherParticleSystem, rsGame);
|
renderer.manageParticleSystem(weatherParticleSystem, rsGame);
|
||||||
}
|
}
|
||||||
else if(world.getTileset()->getWeather() == wSnowy) {
|
else if(world.getTileset()->getWeather() == wSnowy) {
|
||||||
logger.add(Lang::getInstance().get("LogScreenGameLoadingCreatingSnowParticles","",true), true);
|
logger.add(Lang::getInstance().get("LogScreenGameLoadingCreatingSnowParticles","",true), true);
|
||||||
weatherParticleSystem= new SnowParticleSystem(1200);
|
weatherParticleSystem= new SnowParticleSystem(1200);
|
||||||
weatherParticleSystem->setSpeed(1.5f / GameConstants::updateFps);
|
weatherParticleSystem->setSpeed(1.5f / GameConstants::updateFps);
|
||||||
weatherParticleSystem->setPos(Vec3d(gameCamera.getPos()));
|
weatherParticleSystem->setPos(gameCamera.getPos());
|
||||||
weatherParticleSystem->setTexture(coreData.getSnowTexture());
|
weatherParticleSystem->setTexture(coreData.getSnowTexture());
|
||||||
renderer.manageParticleSystem(weatherParticleSystem, rsGame);
|
renderer.manageParticleSystem(weatherParticleSystem, rsGame);
|
||||||
}
|
}
|
||||||
|
@ -2143,7 +2143,7 @@ void Game::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentCameraFollowUnit!=NULL){
|
if(currentCameraFollowUnit!=NULL){
|
||||||
Vec3d c=currentCameraFollowUnit->getCurrVector();
|
Vec3f c=currentCameraFollowUnit->getCurrVector();
|
||||||
int rotation=currentCameraFollowUnit->getRotation();
|
int rotation=currentCameraFollowUnit->getRotation();
|
||||||
double angle=rotation+180;
|
double angle=rotation+180;
|
||||||
|
|
||||||
|
@ -2192,7 +2192,7 @@ void Game::update() {
|
||||||
|
|
||||||
//Particle systems
|
//Particle systems
|
||||||
if(weatherParticleSystem != NULL) {
|
if(weatherParticleSystem != NULL) {
|
||||||
weatherParticleSystem->setPos(Vec3d(gameCamera.getPos()));
|
weatherParticleSystem->setPos(gameCamera.getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld [weather particle updating i = %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),i);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld [weather particle updating i = %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),i);
|
||||||
|
@ -6242,7 +6242,7 @@ string Game::saveGame(string name, string path) {
|
||||||
//bool showFullConsole;
|
//bool showFullConsole;
|
||||||
//bool mouseMoved;
|
//bool mouseMoved;
|
||||||
//float scrollSpeed;
|
//float scrollSpeed;
|
||||||
gameNode->addAttribute("scrollSpeed",floatToStr(scrollSpeed,10), mapTagReplacements);
|
gameNode->addAttribute("scrollSpeed",floatToStr(scrollSpeed,6), mapTagReplacements);
|
||||||
//bool camLeftButtonDown;
|
//bool camLeftButtonDown;
|
||||||
//bool camRightButtonDown;
|
//bool camRightButtonDown;
|
||||||
//bool camUpButtonDown;
|
//bool camUpButtonDown;
|
||||||
|
@ -6336,8 +6336,8 @@ string Game::saveGame(string name, string path) {
|
||||||
HighlightSpecialUnitInfo &info = iterMap->second;
|
HighlightSpecialUnitInfo &info = iterMap->second;
|
||||||
XmlNode *infoNode = unitHighlightListNode->addChild("info");
|
XmlNode *infoNode = unitHighlightListNode->addChild("info");
|
||||||
infoNode->addAttribute("unitid",intToStr(iterMap->first), mapTagReplacements);
|
infoNode->addAttribute("unitid",intToStr(iterMap->first), mapTagReplacements);
|
||||||
infoNode->addAttribute("radius",floatToStr(info.radius,10), mapTagReplacements);
|
infoNode->addAttribute("radius",floatToStr(info.radius,6), mapTagReplacements);
|
||||||
infoNode->addAttribute("thickness",floatToStr(info.thickness,10), mapTagReplacements);
|
infoNode->addAttribute("thickness",floatToStr(info.thickness,6), mapTagReplacements);
|
||||||
infoNode->addAttribute("color",info.color.getString(), mapTagReplacements);
|
infoNode->addAttribute("color",info.color.getString(), mapTagReplacements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -466,18 +466,18 @@ void GameCamera::saveGame(XmlNode *rootNode) {
|
||||||
gamecameraNode->addAttribute("destPos",destPos.getString(), mapTagReplacements);
|
gamecameraNode->addAttribute("destPos",destPos.getString(), mapTagReplacements);
|
||||||
//
|
//
|
||||||
// float hAng; //YZ plane positive -Z axis
|
// float hAng; //YZ plane positive -Z axis
|
||||||
gamecameraNode->addAttribute("hAng",floatToStr(hAng,10), mapTagReplacements);
|
gamecameraNode->addAttribute("hAng",floatToStr(hAng,6), mapTagReplacements);
|
||||||
// float vAng; //XZ plane positive +Z axis
|
// float vAng; //XZ plane positive +Z axis
|
||||||
gamecameraNode->addAttribute("vAng",floatToStr(vAng,10), mapTagReplacements);
|
gamecameraNode->addAttribute("vAng",floatToStr(vAng,6), mapTagReplacements);
|
||||||
// float lastHAng;
|
// float lastHAng;
|
||||||
gamecameraNode->addAttribute("lastHAng",floatToStr(lastHAng,10), mapTagReplacements);
|
gamecameraNode->addAttribute("lastHAng",floatToStr(lastHAng,6), mapTagReplacements);
|
||||||
|
|
||||||
// float lastVAng;
|
// float lastVAng;
|
||||||
gamecameraNode->addAttribute("lastVAng",floatToStr(lastVAng,10), mapTagReplacements);
|
gamecameraNode->addAttribute("lastVAng",floatToStr(lastVAng,6), mapTagReplacements);
|
||||||
// Vec2f destAng;
|
// Vec2f destAng;
|
||||||
gamecameraNode->addAttribute("destAng",destAng.getString(), mapTagReplacements);
|
gamecameraNode->addAttribute("destAng",destAng.getString(), mapTagReplacements);
|
||||||
// float rotate;
|
// float rotate;
|
||||||
gamecameraNode->addAttribute("rotate",floatToStr(rotate,10), mapTagReplacements);
|
gamecameraNode->addAttribute("rotate",floatToStr(rotate,6), mapTagReplacements);
|
||||||
// Vec3f move;
|
// Vec3f move;
|
||||||
gamecameraNode->addAttribute("move",move.getString(), mapTagReplacements);
|
gamecameraNode->addAttribute("move",move.getString(), mapTagReplacements);
|
||||||
// State state;
|
// State state;
|
||||||
|
@ -488,24 +488,24 @@ void GameCamera::saveGame(XmlNode *rootNode) {
|
||||||
gamecameraNode->addAttribute("limitY",intToStr(limitY), mapTagReplacements);
|
gamecameraNode->addAttribute("limitY",intToStr(limitY), mapTagReplacements);
|
||||||
// //config
|
// //config
|
||||||
// float speed;
|
// float speed;
|
||||||
gamecameraNode->addAttribute("speed",floatToStr(speed,10), mapTagReplacements);
|
gamecameraNode->addAttribute("speed",floatToStr(speed,6), mapTagReplacements);
|
||||||
// bool clampBounds;
|
// bool clampBounds;
|
||||||
gamecameraNode->addAttribute("clampBounds",intToStr(clampBounds), mapTagReplacements);
|
gamecameraNode->addAttribute("clampBounds",intToStr(clampBounds), mapTagReplacements);
|
||||||
// //float maxRenderDistance;
|
// //float maxRenderDistance;
|
||||||
// float maxHeight;
|
// float maxHeight;
|
||||||
gamecameraNode->addAttribute("maxHeight",floatToStr(maxHeight,10), mapTagReplacements);
|
gamecameraNode->addAttribute("maxHeight",floatToStr(maxHeight,6), mapTagReplacements);
|
||||||
// float minHeight;
|
// float minHeight;
|
||||||
gamecameraNode->addAttribute("minHeight",floatToStr(minHeight,10), mapTagReplacements);
|
gamecameraNode->addAttribute("minHeight",floatToStr(minHeight,6), mapTagReplacements);
|
||||||
// //float maxCameraDist;
|
// //float maxCameraDist;
|
||||||
// //float minCameraDist;
|
// //float minCameraDist;
|
||||||
// float minVAng;
|
// float minVAng;
|
||||||
gamecameraNode->addAttribute("minVAng",floatToStr(minVAng,10), mapTagReplacements);
|
gamecameraNode->addAttribute("minVAng",floatToStr(minVAng,6), mapTagReplacements);
|
||||||
// float maxVAng;
|
// float maxVAng;
|
||||||
gamecameraNode->addAttribute("maxVAng",floatToStr(maxVAng,10), mapTagReplacements);
|
gamecameraNode->addAttribute("maxVAng",floatToStr(maxVAng,6), mapTagReplacements);
|
||||||
// float fov;
|
// float fov;
|
||||||
gamecameraNode->addAttribute("fov",floatToStr(fov,10), mapTagReplacements);
|
gamecameraNode->addAttribute("fov",floatToStr(fov,6), mapTagReplacements);
|
||||||
// float calculatedDefault;
|
// float calculatedDefault;
|
||||||
gamecameraNode->addAttribute("calculatedDefault",floatToStr(calculatedDefault,10), mapTagReplacements);
|
gamecameraNode->addAttribute("calculatedDefault",floatToStr(calculatedDefault,6), mapTagReplacements);
|
||||||
// std::map<float, std::map<float, std::map<Vec3f, Quad2i> > > cacheVisibleQuad;
|
// std::map<float, std::map<float, std::map<Vec3f, Quad2i> > > cacheVisibleQuad;
|
||||||
// int MaxVisibleQuadItemCache;
|
// int MaxVisibleQuadItemCache;
|
||||||
gamecameraNode->addAttribute("MaxVisibleQuadItemCache",intToStr(MaxVisibleQuadItemCache), mapTagReplacements);
|
gamecameraNode->addAttribute("MaxVisibleQuadItemCache",intToStr(MaxVisibleQuadItemCache), mapTagReplacements);
|
||||||
|
|
|
@ -179,7 +179,7 @@ void Stats::saveGame(XmlNode *rootNode) {
|
||||||
// ControlType control;
|
// ControlType control;
|
||||||
statsNodePlayer->addAttribute("control",intToStr(stat.control), mapTagReplacements);
|
statsNodePlayer->addAttribute("control",intToStr(stat.control), mapTagReplacements);
|
||||||
// float resourceMultiplier;
|
// float resourceMultiplier;
|
||||||
statsNodePlayer->addAttribute("resourceMultiplier",floatToStr(stat.resourceMultiplier,10), mapTagReplacements);
|
statsNodePlayer->addAttribute("resourceMultiplier",floatToStr(stat.resourceMultiplier,6), mapTagReplacements);
|
||||||
// string factionTypeName;
|
// string factionTypeName;
|
||||||
statsNodePlayer->addAttribute("factionTypeName",stat.factionTypeName, mapTagReplacements);
|
statsNodePlayer->addAttribute("factionTypeName",stat.factionTypeName, mapTagReplacements);
|
||||||
// FactionPersonalityType personalityType;
|
// FactionPersonalityType personalityType;
|
||||||
|
@ -211,7 +211,7 @@ void Stats::saveGame(XmlNode *rootNode) {
|
||||||
statsNode->addAttribute("thisFactionIndex",intToStr(thisFactionIndex), mapTagReplacements);
|
statsNode->addAttribute("thisFactionIndex",intToStr(thisFactionIndex), mapTagReplacements);
|
||||||
//
|
//
|
||||||
// float worldTimeElapsed;
|
// float worldTimeElapsed;
|
||||||
statsNode->addAttribute("worldTimeElapsed",floatToStr(worldTimeElapsed,10), mapTagReplacements);
|
statsNode->addAttribute("worldTimeElapsed",floatToStr(worldTimeElapsed,6), mapTagReplacements);
|
||||||
// int framesPlayed;
|
// int framesPlayed;
|
||||||
statsNode->addAttribute("framesPlayed",intToStr(framesPlayed), mapTagReplacements);
|
statsNode->addAttribute("framesPlayed",intToStr(framesPlayed), mapTagReplacements);
|
||||||
// int framesToCalculatePlaytime;
|
// int framesToCalculatePlaytime;
|
||||||
|
|
|
@ -327,7 +327,7 @@ void ParticleSystemType::saveGame(XmlNode *rootNode) {
|
||||||
// Texture2D *texture;
|
// Texture2D *texture;
|
||||||
// Model *model;
|
// Model *model;
|
||||||
// float modelCycle;
|
// float modelCycle;
|
||||||
particleSystemTypeNode->addAttribute("modelCycle",doubleToStr(modelCycle,10), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("modelCycle",floatToStr(modelCycle,6), mapTagReplacements);
|
||||||
// string primitive;
|
// string primitive;
|
||||||
particleSystemTypeNode->addAttribute("primitive",primitive, mapTagReplacements);
|
particleSystemTypeNode->addAttribute("primitive",primitive, mapTagReplacements);
|
||||||
// Vec3f offset;
|
// Vec3f offset;
|
||||||
|
@ -337,15 +337,15 @@ void ParticleSystemType::saveGame(XmlNode *rootNode) {
|
||||||
// Vec4f colorNoEnergy;
|
// Vec4f colorNoEnergy;
|
||||||
particleSystemTypeNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements);
|
||||||
// float size;
|
// float size;
|
||||||
particleSystemTypeNode->addAttribute("size",doubleToStr(size,10), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("size",floatToStr(size,6), mapTagReplacements);
|
||||||
// float sizeNoEnergy;
|
// float sizeNoEnergy;
|
||||||
particleSystemTypeNode->addAttribute("sizeNoEnergy",doubleToStr(sizeNoEnergy,10), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,6), mapTagReplacements);
|
||||||
// float speed;
|
// float speed;
|
||||||
particleSystemTypeNode->addAttribute("speed",doubleToStr(speed,10), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("speed",floatToStr(speed,6), mapTagReplacements);
|
||||||
// float gravity;
|
// float gravity;
|
||||||
particleSystemTypeNode->addAttribute("gravity",doubleToStr(gravity,10), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("gravity",floatToStr(gravity,6), mapTagReplacements);
|
||||||
// float emissionRate;
|
// float emissionRate;
|
||||||
particleSystemTypeNode->addAttribute("emissionRate",doubleToStr(emissionRate,10), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("emissionRate",floatToStr(emissionRate,6), mapTagReplacements);
|
||||||
// int energyMax;
|
// int energyMax;
|
||||||
particleSystemTypeNode->addAttribute("energyMax",intToStr(energyMax), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("energyMax",intToStr(energyMax), mapTagReplacements);
|
||||||
// int energyVar;
|
// int energyVar;
|
||||||
|
@ -413,7 +413,7 @@ void ParticleSystemTypeProjectile::load(const XmlNode* particleFileNode, const s
|
||||||
|
|
||||||
//trajectory speed
|
//trajectory speed
|
||||||
const XmlNode *tajectorySpeedNode= tajectoryNode->getChild("speed");
|
const XmlNode *tajectorySpeedNode= tajectoryNode->getChild("speed");
|
||||||
trajectorySpeed= tajectorySpeedNode->getAttribute("value")->getFloatValue() / (double)GameConstants::updateFps;
|
trajectorySpeed= tajectorySpeedNode->getAttribute("value")->getFloatValue() / (float)GameConstants::updateFps;
|
||||||
//printf("[%s] trajectorySpeed = %f\n",path.c_str(),trajectorySpeed);
|
//printf("[%s] trajectorySpeed = %f\n",path.c_str(),trajectorySpeed);
|
||||||
|
|
||||||
if(trajectory=="parabolic" || trajectory=="spiral"){
|
if(trajectory=="parabolic" || trajectory=="spiral"){
|
||||||
|
@ -466,11 +466,11 @@ void ParticleSystemTypeProjectile::saveGame(XmlNode *rootNode) {
|
||||||
// string trajectory;
|
// string trajectory;
|
||||||
particleSystemTypeProjectileNode->addAttribute("trajectory",trajectory, mapTagReplacements);
|
particleSystemTypeProjectileNode->addAttribute("trajectory",trajectory, mapTagReplacements);
|
||||||
// float trajectorySpeed;
|
// float trajectorySpeed;
|
||||||
particleSystemTypeProjectileNode->addAttribute("trajectorySpeed",doubleToStr(trajectorySpeed,10), mapTagReplacements);
|
particleSystemTypeProjectileNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed,6), mapTagReplacements);
|
||||||
// float trajectoryScale;
|
// float trajectoryScale;
|
||||||
particleSystemTypeProjectileNode->addAttribute("trajectoryScale",doubleToStr(trajectoryScale,10), mapTagReplacements);
|
particleSystemTypeProjectileNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale,6), mapTagReplacements);
|
||||||
// float trajectoryFrequency;
|
// float trajectoryFrequency;
|
||||||
particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",doubleToStr(trajectoryFrequency,10), mapTagReplacements);
|
particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency,6), mapTagReplacements);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
@ -549,15 +549,15 @@ void ParticleSystemTypeSplash::saveGame(XmlNode *rootNode) {
|
||||||
XmlNode *particleSystemTypeSplashNode = rootNode->addChild("ParticleSystemTypeSplash");
|
XmlNode *particleSystemTypeSplashNode = rootNode->addChild("ParticleSystemTypeSplash");
|
||||||
|
|
||||||
// float emissionRateFade;
|
// float emissionRateFade;
|
||||||
particleSystemTypeSplashNode->addAttribute("emissionRateFade",doubleToStr(emissionRateFade,10), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,6), mapTagReplacements);
|
||||||
// float verticalSpreadA;
|
// float verticalSpreadA;
|
||||||
particleSystemTypeSplashNode->addAttribute("verticalSpreadA",doubleToStr(verticalSpreadA,10), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA,6), mapTagReplacements);
|
||||||
// float verticalSpreadB;
|
// float verticalSpreadB;
|
||||||
particleSystemTypeSplashNode->addAttribute("verticalSpreadB",doubleToStr(verticalSpreadB,10), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB,6), mapTagReplacements);
|
||||||
// float horizontalSpreadA;
|
// float horizontalSpreadA;
|
||||||
particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",doubleToStr(horizontalSpreadA,10), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA,6), mapTagReplacements);
|
||||||
// float horizontalSpreadB;
|
// float horizontalSpreadB;
|
||||||
particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",doubleToStr(horizontalSpreadB,10), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB,6), mapTagReplacements);
|
||||||
}
|
}
|
||||||
|
|
||||||
}}//end mamespace
|
}}//end mamespace
|
||||||
|
|
|
@ -57,16 +57,16 @@ protected:
|
||||||
string type;
|
string type;
|
||||||
Texture2D *texture;
|
Texture2D *texture;
|
||||||
Model *model;
|
Model *model;
|
||||||
double modelCycle;
|
float modelCycle;
|
||||||
string primitive;
|
string primitive;
|
||||||
Vec3d offset;
|
Vec3f offset;
|
||||||
Vec4f color;
|
Vec4f color;
|
||||||
Vec4f colorNoEnergy;
|
Vec4f colorNoEnergy;
|
||||||
double size;
|
int size;
|
||||||
double sizeNoEnergy;
|
int sizeNoEnergy;
|
||||||
double speed;
|
float speed;
|
||||||
double gravity;
|
float gravity;
|
||||||
double emissionRate;
|
int 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;
|
||||||
double trajectorySpeed;
|
float trajectorySpeed;
|
||||||
double trajectoryScale;
|
float trajectoryScale;
|
||||||
double trajectoryFrequency;
|
float trajectoryFrequency;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParticleSystemTypeProjectile();
|
ParticleSystemTypeProjectile();
|
||||||
|
@ -153,11 +153,11 @@ public:
|
||||||
virtual void saveGame(XmlNode *rootNode);
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double emissionRateFade;
|
float emissionRateFade;
|
||||||
double verticalSpreadA;
|
float verticalSpreadA;
|
||||||
double verticalSpreadB;
|
float verticalSpreadB;
|
||||||
double horizontalSpreadA;
|
float horizontalSpreadA;
|
||||||
double horizontalSpreadB;
|
float horizontalSpreadB;
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ void Renderer::setupLighting() {
|
||||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||||
|
|
||||||
if(world->toRenderUnit(unit) &&
|
if(world->toRenderUnit(unit) &&
|
||||||
unit->getCurrVector().dist(Vec3d(gameCamera->getPos())) < maxLightDist &&
|
unit->getCurrVector().dist(gameCamera->getPos()) < maxLightDist &&
|
||||||
unit->getType()->getLight() && unit->isOperative()) {
|
unit->getType()->getLight() && unit->isOperative()) {
|
||||||
//printf("$$$ Show light for faction: %s # %d / %d for Unit [%d - %s]\n",world->getFaction(i)->getType()->getName().c_str(),lightCount,maxLights,unit->getId(),unit->getFullName().c_str());
|
//printf("$$$ Show light for faction: %s # %d / %d for Unit [%d - %s]\n",world->getFaction(i)->getType()->getName().c_str(),lightCount,maxLights,unit->getId(),unit->getFullName().c_str());
|
||||||
|
|
||||||
|
@ -6662,7 +6662,7 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units,
|
||||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||||
if(unit != NULL && unit->isAlive()) {
|
if(unit != NULL && unit->isAlive()) {
|
||||||
Vec3d unitPos = unit->getCurrVector();
|
Vec3f unitPos = unit->getCurrVector();
|
||||||
bool insideQuad = CubeInFrustum(quadSelectionCacheItem.frustumData,
|
bool insideQuad = CubeInFrustum(quadSelectionCacheItem.frustumData,
|
||||||
unitPos.x, unitPos.y, unitPos.z, unit->getType()->getSize());
|
unitPos.x, unitPos.y, unitPos.z, unit->getType()->getSize());
|
||||||
if(insideQuad == true) {
|
if(insideQuad == true) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
||||||
// delay
|
// delay
|
||||||
if(particleSystemNode->hasChild("delay")) {
|
if(particleSystemNode->hasChild("delay")) {
|
||||||
const XmlNode* delayNode = particleSystemNode->getChild("delay");
|
const XmlNode* delayNode = particleSystemNode->getChild("delay");
|
||||||
const double delay_secs = delayNode->getAttribute("value")->getFloatValue();
|
const float delay_secs = delayNode->getAttribute("value")->getFloatValue();
|
||||||
if(delay_secs < 0)
|
if(delay_secs < 0)
|
||||||
throw megaglest_runtime_error("particle effect delay cannot be negative");
|
throw megaglest_runtime_error("particle effect delay cannot be negative");
|
||||||
delay = (int)delay_secs * GameConstants::updateFps;
|
delay = (int)delay_secs * GameConstants::updateFps;
|
||||||
|
@ -183,7 +183,7 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
||||||
// lifetime
|
// lifetime
|
||||||
if(particleSystemNode->hasChild("lifetime")) {
|
if(particleSystemNode->hasChild("lifetime")) {
|
||||||
const XmlNode* lifetimeNode = particleSystemNode->getChild("lifetime");
|
const XmlNode* lifetimeNode = particleSystemNode->getChild("lifetime");
|
||||||
const double lifetime_secs = lifetimeNode->getAttribute("value")->getFloatValue();
|
const float lifetime_secs = lifetimeNode->getAttribute("value")->getFloatValue();
|
||||||
if(lifetime_secs < 0 && lifetime_secs != -1)
|
if(lifetime_secs < 0 && lifetime_secs != -1)
|
||||||
throw megaglest_runtime_error("particle effect lifetime cannot be negative (-1 means inherited from parent particle)");
|
throw megaglest_runtime_error("particle effect lifetime cannot be negative (-1 means inherited from parent particle)");
|
||||||
lifetime = (int)lifetime_secs * GameConstants::updateFps;
|
lifetime = (int)lifetime_secs * GameConstants::updateFps;
|
||||||
|
@ -300,13 +300,13 @@ void UnitParticleSystemType::saveGame(XmlNode *rootNode) {
|
||||||
// UnitParticleSystem::Shape shape;
|
// UnitParticleSystem::Shape shape;
|
||||||
unitParticleSystemTypeNode->addAttribute("shape",intToStr(shape), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("shape",intToStr(shape), mapTagReplacements);
|
||||||
// float angle;
|
// float angle;
|
||||||
unitParticleSystemTypeNode->addAttribute("angle",doubleToStr(angle,10), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("angle",floatToStr(angle,6), mapTagReplacements);
|
||||||
// float radius;
|
// float radius;
|
||||||
unitParticleSystemTypeNode->addAttribute("radius",doubleToStr(radius,10), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("radius",floatToStr(radius,6), mapTagReplacements);
|
||||||
// float minRadius;
|
// float minRadius;
|
||||||
unitParticleSystemTypeNode->addAttribute("minRadius",doubleToStr(minRadius,10), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("minRadius",floatToStr(minRadius,6), mapTagReplacements);
|
||||||
// float emissionRateFade;
|
// float emissionRateFade;
|
||||||
unitParticleSystemTypeNode->addAttribute("emissionRateFade",doubleToStr(emissionRateFade,10), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,6), mapTagReplacements);
|
||||||
// Vec3f direction;
|
// Vec3f direction;
|
||||||
unitParticleSystemTypeNode->addAttribute("direction",direction.getString(), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("direction",direction.getString(), mapTagReplacements);
|
||||||
// bool relative;
|
// bool relative;
|
||||||
|
@ -330,9 +330,9 @@ void UnitParticleSystemType::saveGame(XmlNode *rootNode) {
|
||||||
// int lifetime;
|
// int lifetime;
|
||||||
unitParticleSystemTypeNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements);
|
||||||
// float startTime;
|
// float startTime;
|
||||||
unitParticleSystemTypeNode->addAttribute("startTime",doubleToStr(startTime,10), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("startTime",floatToStr(startTime,6), mapTagReplacements);
|
||||||
// float endTime;
|
// float endTime;
|
||||||
unitParticleSystemTypeNode->addAttribute("endTime",doubleToStr(endTime,10), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("endTime",floatToStr(endTime,6), mapTagReplacements);
|
||||||
}
|
}
|
||||||
|
|
||||||
}}//end mamespace
|
}}//end mamespace
|
||||||
|
|
|
@ -52,11 +52,11 @@ using Shared::Xml::XmlNode;
|
||||||
class UnitParticleSystemType: public ParticleSystemType {
|
class UnitParticleSystemType: public ParticleSystemType {
|
||||||
protected:
|
protected:
|
||||||
UnitParticleSystem::Shape shape;
|
UnitParticleSystem::Shape shape;
|
||||||
double angle;
|
float angle;
|
||||||
double radius;
|
float radius;
|
||||||
double minRadius;
|
float minRadius;
|
||||||
double emissionRateFade;
|
float emissionRateFade;
|
||||||
Vec3d direction;
|
Vec3f direction;
|
||||||
bool relative;
|
bool relative;
|
||||||
bool relativeDirection;
|
bool relativeDirection;
|
||||||
bool fixed;
|
bool fixed;
|
||||||
|
@ -67,8 +67,8 @@ protected:
|
||||||
bool radiusBasedStartenergy;
|
bool radiusBasedStartenergy;
|
||||||
int delay;
|
int delay;
|
||||||
int lifetime;
|
int lifetime;
|
||||||
double startTime;
|
float startTime;
|
||||||
double endTime;
|
float endTime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnitParticleSystemType();
|
UnitParticleSystemType();
|
||||||
|
@ -81,10 +81,10 @@ public:
|
||||||
std::map<string,vector<pair<string, string> > > &loadedFileList,string parentLoader,
|
std::map<string,vector<pair<string, string> > > &loadedFileList,string parentLoader,
|
||||||
string techtreePath);
|
string techtreePath);
|
||||||
|
|
||||||
void setStartTime(double startTime) { this->startTime = startTime; }
|
void setStartTime(float startTime) { this->startTime = startTime; }
|
||||||
double getStartTime() const { return this->startTime; }
|
float getStartTime() const { return this->startTime; }
|
||||||
void setEndTime(double endTime) { this->endTime = endTime; }
|
void setEndTime(float endTime) { this->endTime = endTime; }
|
||||||
double getEndTime() const { return this->endTime; }
|
float getEndTime() const { return this->endTime; }
|
||||||
|
|
||||||
const void setValues (UnitParticleSystem *uts);
|
const void setValues (UnitParticleSystem *uts);
|
||||||
bool hasTexture() const { return(texture != NULL); }
|
bool hasTexture() const { return(texture != NULL); }
|
||||||
|
|
|
@ -540,7 +540,7 @@ void Gui::giveTwoClickOrders(int x, int y , bool prepared) {
|
||||||
|
|
||||||
void Gui::centerCameraOnSelection() {
|
void Gui::centerCameraOnSelection() {
|
||||||
if(selection.isEmpty() == false) {
|
if(selection.isEmpty() == false) {
|
||||||
Vec3d refPos= selection.getRefPos();
|
Vec3f refPos= selection.getRefPos();
|
||||||
gameCamera->centerXZ(refPos.x, refPos.z);
|
gameCamera->centerXZ(refPos.x, refPos.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ bool Selection::isMeetable() const{
|
||||||
selectedUnits.front()->getType()->getMeetingPoint();
|
selectedUnits.front()->getType()->getMeetingPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d Selection::getRefPos() const{
|
Vec3f Selection::getRefPos() const{
|
||||||
return getFrontUnit()->getCurrVector();
|
return getFrontUnit()->getCurrVector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
const Unit *getUnit(int i) const {return selectedUnits[i];}
|
const Unit *getUnit(int i) const {return selectedUnits[i];}
|
||||||
Unit *getUnitPtr(int i) {return selectedUnits[i];}
|
Unit *getUnitPtr(int i) {return selectedUnits[i];}
|
||||||
const Unit *getFrontUnit() const {return selectedUnits.front();}
|
const Unit *getFrontUnit() const {return selectedUnits.front();}
|
||||||
Vec3d getRefPos() const;
|
Vec3f getRefPos() const;
|
||||||
bool hasUnit(const Unit* unit) const;
|
bool hasUnit(const Unit* unit) const;
|
||||||
|
|
||||||
void assignGroup(int groupIndex,const UnitContainer *pUnits=NULL);
|
void assignGroup(int groupIndex,const UnitContainer *pUnits=NULL);
|
||||||
|
|
|
@ -160,7 +160,7 @@ void MenuBackground::createRainParticleSystem() {
|
||||||
rps->setSpeed(12.f/GameConstants::updateFps);
|
rps->setSpeed(12.f/GameConstants::updateFps);
|
||||||
rps->setEmissionRate(25);
|
rps->setEmissionRate(25);
|
||||||
rps->setWind(-90.f, 4.f/GameConstants::updateFps);
|
rps->setWind(-90.f, 4.f/GameConstants::updateFps);
|
||||||
rps->setPos(Vec3d(0.f, 25.f, 0.f));
|
rps->setPos(Vec3f(0.f, 25.f, 0.f));
|
||||||
rps->setColor(Vec4f(1.f, 1.f, 1.f, 0.2f));
|
rps->setColor(Vec4f(1.f, 1.f, 1.f, 0.2f));
|
||||||
rps->setRadius(30.f);
|
rps->setRadius(30.f);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ ObjectStateInterface *Object::stateCallback=NULL;
|
||||||
// class Object
|
// class Object
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
Object::Object(ObjectType *objectType, const Vec3d &pos, const Vec2i &mapPos) : BaseColorPickEntity() {
|
Object::Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos) : BaseColorPickEntity() {
|
||||||
RandomGen random;
|
RandomGen random;
|
||||||
|
|
||||||
random.init(static_cast<int>(pos.x * pos.z));
|
random.init(static_cast<int>(pos.x * pos.z));
|
||||||
|
@ -44,7 +44,7 @@ Object::Object(ObjectType *objectType, const Vec3d &pos, const Vec2i &mapPos) :
|
||||||
highlight= 0.f;
|
highlight= 0.f;
|
||||||
animated= false;
|
animated= false;
|
||||||
this->mapPos = mapPos;
|
this->mapPos = mapPos;
|
||||||
this->pos= pos + Vec3d(random.randRange(-0.6f, 0.6f), 0.0f, random.randRange(-0.6f, 0.6f));
|
this->pos= pos + Vec3f(random.randRange(-0.6f, 0.6f), 0.0f, random.randRange(-0.6f, 0.6f));
|
||||||
rotation= random.randRange(0.f, 360.f);
|
rotation= random.randRange(0.f, 360.f);
|
||||||
if(objectType!=NULL){
|
if(objectType!=NULL){
|
||||||
variation = random.randRange(0, objectType->getModelCount()-1);
|
variation = random.randRange(0, objectType->getModelCount()-1);
|
||||||
|
@ -126,7 +126,7 @@ void Object::end(ParticleSystem *particleSystem) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::setHeight(double height) {
|
void Object::setHeight(float height) {
|
||||||
pos.y = height;
|
pos.y = height;
|
||||||
|
|
||||||
for(UnitParticleSystems::iterator it= unitParticleSystems.begin(); it != unitParticleSystems.end(); ++it) {
|
for(UnitParticleSystems::iterator it= unitParticleSystems.begin(); it != unitParticleSystems.end(); ++it) {
|
||||||
|
@ -153,17 +153,17 @@ void Object::update() {
|
||||||
// printf("#1 Object updating [%s] Speed [%d] animProgress [%f]\n",this->objectType->getTilesetModelType(variation)->getModel()->getFileName().c_str(),objectType->getTilesetModelType(variation)->getAnimSpeed(),animProgress);
|
// printf("#1 Object updating [%s] Speed [%d] animProgress [%f]\n",this->objectType->getTilesetModelType(variation)->getModel()->getFileName().c_str(),objectType->getTilesetModelType(variation)->getAnimSpeed(),animProgress);
|
||||||
|
|
||||||
if(objectType != NULL && objectType->getTilesetModelType(variation) != NULL) {
|
if(objectType != NULL && objectType->getTilesetModelType(variation) != NULL) {
|
||||||
double heightFactor = 1.f;
|
float heightFactor = 1.f;
|
||||||
const double speedDivider= 100.f;
|
const float speedDivider= 100.f;
|
||||||
double speedDenominator = (speedDivider * GameConstants::updateFps);
|
float speedDenominator = (speedDivider * GameConstants::updateFps);
|
||||||
|
|
||||||
// smooth TwoFrameanimations
|
// smooth TwoFrameanimations
|
||||||
double f=1.0f;
|
float f=1.0f;
|
||||||
if(objectType->getTilesetModelType(variation)->getSmoothTwoFrameAnim()==true){
|
if(objectType->getTilesetModelType(variation)->getSmoothTwoFrameAnim()==true){
|
||||||
f=abs(std::sin(animProgress*2*3.16))+0.4f;
|
f=abs(std::sin(animProgress*2*3.16))+0.4f;
|
||||||
}
|
}
|
||||||
|
|
||||||
double newAnimProgress = animProgress + f*(((double)objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor) / speedDenominator);
|
float newAnimProgress = animProgress + f*(((float)objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor) / speedDenominator);
|
||||||
|
|
||||||
animProgress = newAnimProgress;
|
animProgress = newAnimProgress;
|
||||||
if(animProgress > 1.f) {
|
if(animProgress > 1.f) {
|
||||||
|
@ -256,7 +256,7 @@ void Object::saveGame(XmlNode *rootNode) {
|
||||||
// Vec3f pos;
|
// Vec3f pos;
|
||||||
objectNode->addAttribute("pos",pos.getString(), mapTagReplacements);
|
objectNode->addAttribute("pos",pos.getString(), mapTagReplacements);
|
||||||
// float rotation;
|
// float rotation;
|
||||||
objectNode->addAttribute("rotation",doubleToStr(rotation,10), mapTagReplacements);
|
objectNode->addAttribute("rotation",floatToStr(rotation,6), mapTagReplacements);
|
||||||
// int variation;
|
// int variation;
|
||||||
objectNode->addAttribute("variation",intToStr(variation), mapTagReplacements);
|
objectNode->addAttribute("variation",intToStr(variation), mapTagReplacements);
|
||||||
// int lastRenderFrame;
|
// int lastRenderFrame;
|
||||||
|
@ -288,7 +288,7 @@ void Object::loadGame(const XmlNode *rootNode,const TechTree *techTree) {
|
||||||
resource->loadGame(objectNode,0,techTree);
|
resource->loadGame(objectNode,0,techTree);
|
||||||
}
|
}
|
||||||
// Vec3f pos;
|
// Vec3f pos;
|
||||||
pos = Vec3d::strToVec3(objectNode->getAttribute("pos")->getValue());
|
pos = Vec3f::strToVec3(objectNode->getAttribute("pos")->getValue());
|
||||||
// float rotation;
|
// float rotation;
|
||||||
rotation = objectNode->getAttribute("rotation")->getFloatValue();
|
rotation = objectNode->getAttribute("rotation")->getFloatValue();
|
||||||
// int variation;
|
// int variation;
|
||||||
|
|
|
@ -57,20 +57,20 @@ private:
|
||||||
ObjectType *objectType;
|
ObjectType *objectType;
|
||||||
vector<UnitParticleSystem*> unitParticleSystems;
|
vector<UnitParticleSystem*> unitParticleSystems;
|
||||||
Resource *resource;
|
Resource *resource;
|
||||||
Vec3d pos;
|
Vec3f pos;
|
||||||
double rotation;
|
float rotation;
|
||||||
int variation;
|
int variation;
|
||||||
int lastRenderFrame;
|
int lastRenderFrame;
|
||||||
Vec2i mapPos;
|
Vec2i mapPos;
|
||||||
bool visible;
|
bool visible;
|
||||||
bool animated;
|
bool animated;
|
||||||
double animProgress;
|
float animProgress;
|
||||||
float highlight;
|
float highlight;
|
||||||
|
|
||||||
static ObjectStateInterface *stateCallback;
|
static ObjectStateInterface *stateCallback;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Object(ObjectType *objectType, const Vec3d &pos, const Vec2i &mapPos);
|
Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos);
|
||||||
virtual ~Object();
|
virtual ~Object();
|
||||||
|
|
||||||
void end(); //to kill particles
|
void end(); //to kill particles
|
||||||
|
@ -80,10 +80,10 @@ public:
|
||||||
|
|
||||||
const ObjectType *getType() const {return objectType;}
|
const ObjectType *getType() const {return objectType;}
|
||||||
Resource *getResource() const {return resource;}
|
Resource *getResource() const {return resource;}
|
||||||
Vec3d getPos() const {return pos;}
|
Vec3f getPos() const {return pos;}
|
||||||
bool isVisible() const {return visible;}
|
bool isVisible() const {return visible;}
|
||||||
const Vec3d & getConstPos() const {return pos;}
|
const Vec3f & getConstPos() const {return pos;}
|
||||||
double getRotation() const {return rotation;}
|
float getRotation() const {return rotation;}
|
||||||
const Model *getModel() const;
|
const Model *getModel() const;
|
||||||
Model *getModelPtr() const;
|
Model *getModelPtr() const;
|
||||||
bool getWalkable() const;
|
bool getWalkable() const;
|
||||||
|
@ -94,7 +94,7 @@ public:
|
||||||
void resetHighlight();
|
void resetHighlight();
|
||||||
|
|
||||||
void setResource(const ResourceType *resourceType, const Vec2i &pos);
|
void setResource(const ResourceType *resourceType, const Vec2i &pos);
|
||||||
void setHeight(double height);
|
void setHeight(float height);
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
|
|
||||||
int getLastRenderFrame() const { return lastRenderFrame; }
|
int getLastRenderFrame() const { return lastRenderFrame; }
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
|
|
||||||
void updateHighlight();
|
void updateHighlight();
|
||||||
void update();
|
void update();
|
||||||
double getAnimProgress() const { return animProgress;}
|
float getAnimProgress() const { return animProgress;}
|
||||||
|
|
||||||
virtual string getUniquePickName() const;
|
virtual string getUniquePickName() const;
|
||||||
void saveGame(XmlNode *rootNode);
|
void saveGame(XmlNode *rootNode);
|
||||||
|
|
|
@ -453,7 +453,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos,
|
||||||
this->map= map;
|
this->map= map;
|
||||||
this->targetRef = NULL;
|
this->targetRef = NULL;
|
||||||
this->targetField = fLand;
|
this->targetField = fLand;
|
||||||
this->targetVec = Vec3d(0.0);
|
this->targetVec = Vec3f(0.0);
|
||||||
this->targetPos = Vec2i(0);
|
this->targetPos = Vec2i(0);
|
||||||
this->lastRenderFrame = 0;
|
this->lastRenderFrame = 0;
|
||||||
this->visible = true;
|
this->visible = true;
|
||||||
|
@ -496,9 +496,9 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos,
|
||||||
alive= true;
|
alive= true;
|
||||||
|
|
||||||
if (type->hasSkillClass(scBeBuilt) == false) {
|
if (type->hasSkillClass(scBeBuilt) == false) {
|
||||||
double rot= 0.f;
|
float rot= 0.f;
|
||||||
random.init(id);
|
random.init(id);
|
||||||
rot+= random.randRange(-5, 5,intToStr(__LINE__));
|
rot += random.randRange(-5, 5,intToStr(__LINE__));
|
||||||
rotation= rot;
|
rotation= rot;
|
||||||
lastRotation= rot;
|
lastRotation= rot;
|
||||||
targetRotation= rot;
|
targetRotation= rot;
|
||||||
|
@ -700,7 +700,7 @@ Vec2i Unit::getCenteredPos() const {
|
||||||
return pos + Vec2i(type->getSize()/2, type->getSize()/2);
|
return pos + Vec2i(type->getSize()/2, type->getSize()/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2d Unit::getFloatCenteredPos() const {
|
Vec2f Unit::getFloatCenteredPos() const {
|
||||||
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||||
MutexSafeWrapper safeMutex(mutexCommands,mutexOwnerId);
|
MutexSafeWrapper safeMutex(mutexCommands,mutexOwnerId);
|
||||||
|
|
||||||
|
@ -710,7 +710,7 @@ Vec2d Unit::getFloatCenteredPos() const {
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Vec2d(pos.x-0.5f+type->getSize()/2.f, pos.y-0.5f+type->getSize()/2.f);
|
return Vec2f(pos.x-0.5f+type->getSize()/2.f, pos.y-0.5f+type->getSize()/2.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i Unit::getCellPos() const {
|
Vec2i Unit::getCellPos() const {
|
||||||
|
@ -815,11 +815,11 @@ void Unit::calculateXZRotation(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double Unit::getRotationZ() const{
|
float Unit::getRotationZ() const{
|
||||||
return rotationZ;
|
return rotationZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Unit::getRotationX() const{
|
float Unit::getRotationX() const{
|
||||||
return rotationX;
|
return rotationX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1267,13 +1267,13 @@ void Unit::setTargetPos(const Vec2i &targetPos) {
|
||||||
Vec2i relPos= targetPos - pos;
|
Vec2i relPos= targetPos - pos;
|
||||||
//map->clampPos(relPos);
|
//map->clampPos(relPos);
|
||||||
|
|
||||||
Vec2d relPosf= Vec2d((double)relPos.x, (double)relPos.y);
|
Vec2f relPosf= Vec2f((float)relPos.x, (float)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,10);
|
targetRotation = truncateDecimal<float>(targetRotation,6);
|
||||||
|
|
||||||
targetRef= NULL;
|
targetRef= NULL;
|
||||||
|
|
||||||
|
@ -1409,60 +1409,48 @@ bool Unit::checkModelStateInfoForNewHpValue() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d Unit::getCurrVector() const{
|
Vec3f Unit::getCurrVector() const{
|
||||||
if(type == NULL) {
|
if(type == NULL) {
|
||||||
char szBuf[8096]="";
|
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());
|
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);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d result = getCurrVectorFlat() + Vec3d(0.f, type->getHeight() /2.f, 0.f);
|
Vec3f result = getCurrVectorFlat() + Vec3f(0.f, type->getHeight() / 2.f, 0.f);
|
||||||
result.x = truncateDecimal<double>(result.x,10);
|
|
||||||
result.y = truncateDecimal<double>(result.y,10);
|
|
||||||
result.z = truncateDecimal<double>(result.z,10);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d Unit::getCurrVectorFlat() const{
|
Vec3f Unit::getCurrVectorFlat() const{
|
||||||
return getVectorFlat(lastPos, pos);
|
return getVectorFlat(lastPos, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Unit::getProgressAsFloat() const {
|
double Unit::getProgressAsFloat() const {
|
||||||
double result = (static_cast<double>(progress) / static_cast<double>(PROGRESS_SPEED_MULTIPLIER));
|
double result = (static_cast<double>(progress) / static_cast<double>(PROGRESS_SPEED_MULTIPLIER));
|
||||||
result = truncateDecimal<double>(result,10);
|
result = truncateDecimal<double>(result,6);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d Unit::getVectorFlat(const Vec2i &lastPosValue, const Vec2i &curPosValue) const {
|
Vec3f Unit::getVectorFlat(const Vec2i &lastPosValue, const Vec2i &curPosValue) const {
|
||||||
Vec3d v;
|
Vec3f v;
|
||||||
|
|
||||||
double y1= computeHeight(lastPosValue);
|
float y1= computeHeight(lastPosValue);
|
||||||
double y2= computeHeight(curPosValue);
|
float y2= computeHeight(curPosValue);
|
||||||
|
|
||||||
if(currSkill->getClass() == scMove) {
|
if(currSkill->getClass() == scMove) {
|
||||||
double progressAsDouble = getProgressAsFloat();
|
float progressAsFloat = getProgressAsFloat();
|
||||||
|
|
||||||
v.x= lastPosValue.x + progressAsDouble * (curPosValue.x - lastPosValue.x);
|
v.x = lastPosValue.x + progressAsFloat * (curPosValue.x - lastPosValue.x);
|
||||||
v.z= lastPosValue.y + progressAsDouble * (curPosValue.y - lastPosValue.y);
|
v.z = lastPosValue.y + progressAsFloat * (curPosValue.y - lastPosValue.y);
|
||||||
v.y= y1 + progressAsDouble * (y2-y1);
|
v.y = y1 + progressAsFloat * (y2-y1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
v.x= static_cast<double>(curPosValue.x);
|
v.x = static_cast<float>(curPosValue.x);
|
||||||
v.z= static_cast<double>(curPosValue.y);
|
v.z = static_cast<float>(curPosValue.y);
|
||||||
v.y= y2;
|
v.y = y2;
|
||||||
}
|
}
|
||||||
v.x = truncateDecimal<double>(v.x,10);
|
|
||||||
v.y = truncateDecimal<double>(v.y,10);
|
|
||||||
v.z = truncateDecimal<double>(v.z,10);
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
v.x = truncateDecimal<double>(v.x,10);
|
|
||||||
v.y = truncateDecimal<double>(v.y,10);
|
|
||||||
v.z = truncateDecimal<double>(v.z,10);
|
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2402,8 +2390,8 @@ bool Unit::update() {
|
||||||
rotation= lastRotation + (targetRotation - lastRotation) *
|
rotation= lastRotation + (targetRotation - lastRotation) *
|
||||||
getProgressAsFloat() * rotFactor;
|
getProgressAsFloat() * rotFactor;
|
||||||
else {
|
else {
|
||||||
double rotationTerm = targetRotation > lastRotation ? -360.f: +360.f;
|
float rotationTerm = targetRotation > lastRotation ? -360.f: +360.f;
|
||||||
rotation = lastRotation + (targetRotation - lastRotation + rotationTerm) *
|
rotation = lastRotation + (targetRotation - lastRotation + rotationTerm) *
|
||||||
getProgressAsFloat() * rotFactor;
|
getProgressAsFloat() * rotFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2508,7 +2496,7 @@ void Unit::updateTimedParticles() {
|
||||||
for(int i = queuedUnitParticleSystemTypes.size() - 1; i >= 0; i--) {
|
for(int i = queuedUnitParticleSystemTypes.size() - 1; i >= 0; i--) {
|
||||||
UnitParticleSystemType *pst = queuedUnitParticleSystemTypes[i];
|
UnitParticleSystemType *pst = queuedUnitParticleSystemTypes[i];
|
||||||
if(pst != NULL) {
|
if(pst != NULL) {
|
||||||
if(truncateDecimal<double>(pst->getStartTime(),10) <= truncateDecimal<double>(getAnimProgressAsFloat(),10)) {
|
if(truncateDecimal<float>(pst->getStartTime(),6) <= truncateDecimal<float>(getAnimProgressAsFloat(),6)) {
|
||||||
|
|
||||||
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
UnitParticleSystem *ups = new UnitParticleSystem(200);
|
||||||
ups->setParticleOwner(this);
|
ups->setParticleOwner(this);
|
||||||
|
@ -2535,13 +2523,13 @@ void Unit::updateTimedParticles() {
|
||||||
UnitParticleSystem *ps = unitParticleSystems[i];
|
UnitParticleSystem *ps = unitParticleSystems[i];
|
||||||
if(ps != NULL) {
|
if(ps != NULL) {
|
||||||
if(Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
if(Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
||||||
double pst = ps->getStartTime();
|
float pst = ps->getStartTime();
|
||||||
double pet = ps->getEndTime();
|
float pet = ps->getEndTime();
|
||||||
double particleStartTime = truncateDecimal<double>(pst,10);
|
float particleStartTime = truncateDecimal<float>(pst,6);
|
||||||
double particleEndTime = truncateDecimal<double>(pet,10);
|
float particleEndTime = truncateDecimal<float>(pet,6);
|
||||||
|
|
||||||
if(particleStartTime != 0.0 || particleEndTime != 1.0) {
|
if(particleStartTime != 0.0 || particleEndTime != 1.0) {
|
||||||
double animProgressTime = truncateDecimal<double>(getAnimProgressAsFloat(),10);
|
float animProgressTime = truncateDecimal<float>(getAnimProgressAsFloat(),6);
|
||||||
if(animProgressTime >= 0.99 || animProgressTime >= particleEndTime) {
|
if(animProgressTime >= 0.99 || animProgressTime >= particleEndTime) {
|
||||||
|
|
||||||
ps->fade();
|
ps->fade();
|
||||||
|
@ -3343,7 +3331,7 @@ bool Unit::morph(const MorphCommandType *mct) {
|
||||||
|
|
||||||
// ==================== PRIVATE ====================
|
// ==================== PRIVATE ====================
|
||||||
|
|
||||||
double Unit::computeHeight(const Vec2i &pos) const {
|
float Unit::computeHeight(const Vec2i &pos) const {
|
||||||
//printf("CRASHING FOR UNIT: %d alive = %d\n",this->getId(),this->isAlive());
|
//printf("CRASHING FOR UNIT: %d alive = %d\n",this->getId(),this->isAlive());
|
||||||
//printf("[%s]\n",this->getType()->getName().c_str());
|
//printf("[%s]\n",this->getType()->getName().c_str());
|
||||||
if(map->isInside(pos) == false || map->isInsideSurface(map->toSurfCoords(pos)) == false) {
|
if(map->isInside(pos) == false || map->isInsideSurface(map->toSurfCoords(pos)) == false) {
|
||||||
|
@ -3352,26 +3340,25 @@ double Unit::computeHeight(const Vec2i &pos) const {
|
||||||
throw megaglest_runtime_error("#7 Invalid path position = " + pos.getString());
|
throw megaglest_runtime_error("#7 Invalid path position = " + pos.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
double height= map->getCell(pos)->getHeight();
|
float height= map->getCell(pos)->getHeight();
|
||||||
height = truncateDecimal<double>(height,10);
|
|
||||||
|
|
||||||
if(currField == fAir) {
|
if(currField == fAir) {
|
||||||
const double airHeight=game->getWorld()->getTileset()->getAirHeight();
|
const float airHeight=game->getWorld()->getTileset()->getAirHeight();
|
||||||
|
|
||||||
height += airHeight;
|
height += airHeight;
|
||||||
height = truncateDecimal<double>(height,10);
|
height = truncateDecimal<float>(height,6);
|
||||||
|
|
||||||
Unit *unit = map->getCell(pos)->getUnit(fLand);
|
Unit *unit = map->getCell(pos)->getUnit(fLand);
|
||||||
if(unit != NULL && unit->getType()->getHeight() > airHeight) {
|
if(unit != NULL && unit->getType()->getHeight() > airHeight) {
|
||||||
height += (std::min((double)unit->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
height += (std::min((float)unit->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
||||||
height = truncateDecimal<double>(height,10);
|
height = truncateDecimal<float>(height,6);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SurfaceCell *sc = map->getSurfaceCell(map->toSurfCoords(pos));
|
SurfaceCell *sc = map->getSurfaceCell(map->toSurfCoords(pos));
|
||||||
if(sc != NULL && sc->getObject() != NULL && sc->getObject()->getType() != NULL) {
|
if(sc != NULL && sc->getObject() != NULL && sc->getObject()->getType() != NULL) {
|
||||||
if(sc->getObject()->getType()->getHeight() > airHeight) {
|
if(sc->getObject()->getType()->getHeight() > airHeight) {
|
||||||
height += (std::min((double)sc->getObject()->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
height += (std::min((float)sc->getObject()->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight);
|
||||||
height = truncateDecimal<double>(height,10);
|
height = truncateDecimal<float>(height,6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3387,20 +3374,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((double)relPos.x, (double)relPos.y);
|
Vec2f relPosf= Vec2f((float)relPos.x, (float)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,10);
|
|
||||||
//update target vec
|
|
||||||
targetVec= target->getCurrVector();
|
targetVec= target->getCurrVector();
|
||||||
|
|
||||||
//if(getFrameCount() % 40 == 0) {
|
|
||||||
//logSynchData(string(__FILE__) + string("::") + string(__FUNCTION__) + string(" Line: ") + intToStr(__LINE__));
|
|
||||||
//logSynchData();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3835,8 +3815,8 @@ void Unit::startDamageParticles() {
|
||||||
ups->setColor(Vec4f(0.115f, 0.115f, 0.115f, 0.22f));
|
ups->setColor(Vec4f(0.115f, 0.115f, 0.115f, 0.22f));
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
ups->setBlendMode(ups->strToBlendMode("black"));
|
ups->setBlendMode(ups->strToBlendMode("black"));
|
||||||
ups->setOffset(Vec3d(0,2,0));
|
ups->setOffset(Vec3f(0,2,0));
|
||||||
ups->setDirection(Vec3d(0,1,-0.2f));
|
ups->setDirection(Vec3f(0,1,-0.2f));
|
||||||
ups->setRadius(type->getSize()/3.f);
|
ups->setRadius(type->getSize()/3.f);
|
||||||
ups->setShape(Shared::Graphics::UnitParticleSystem::sLinear);
|
ups->setShape(Shared::Graphics::UnitParticleSystem::sLinear);
|
||||||
ups->setTexture(CoreData::getInstance().getFireTexture());
|
ups->setTexture(CoreData::getInstance().getFireTexture());
|
||||||
|
@ -3857,7 +3837,7 @@ void Unit::startDamageParticles() {
|
||||||
checkCustomizedParticleTriggers(false);
|
checkCustomizedParticleTriggers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::setTargetVec(const Vec3d &targetVec) {
|
void Unit::setTargetVec(const Vec3f &targetVec) {
|
||||||
this->targetVec= targetVec;
|
this->targetVec= targetVec;
|
||||||
logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||||
}
|
}
|
||||||
|
@ -4173,7 +4153,7 @@ std::string Unit::toString(bool crcMode) const {
|
||||||
if(crcMode == false) {
|
if(crcMode == false) {
|
||||||
result += " lastAnimProgress = " + intToStr(this->lastAnimProgress);
|
result += " lastAnimProgress = " + intToStr(this->lastAnimProgress);
|
||||||
result += " animProgress = " + intToStr(this->animProgress);
|
result += " animProgress = " + intToStr(this->animProgress);
|
||||||
result += " highlight = " + doubleToStr(this->highlight,10);
|
result += " highlight = " + floatToStr(this->highlight,6);
|
||||||
}
|
}
|
||||||
result += " progress2 = " + intToStr(this->progress2);
|
result += " progress2 = " + intToStr(this->progress2);
|
||||||
result += " kills = " + intToStr(this->kills);
|
result += " kills = " + intToStr(this->kills);
|
||||||
|
@ -4202,9 +4182,9 @@ std::string Unit::toString(bool crcMode) const {
|
||||||
result += "\n";
|
result += "\n";
|
||||||
|
|
||||||
if(crcMode == false) {
|
if(crcMode == false) {
|
||||||
result += " lastRotation = " + doubleToStr(this->lastRotation,10);
|
result += " lastRotation = " + floatToStr(this->lastRotation,6);
|
||||||
result += " targetRotation = " + doubleToStr(this->targetRotation,10);
|
result += " targetRotation = " + floatToStr(this->targetRotation,6);
|
||||||
result += " rotation = " + doubleToStr(this->rotation,10);
|
result += " rotation = " + floatToStr(this->rotation,6);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loadType != NULL) {
|
if(loadType != NULL) {
|
||||||
|
@ -4312,7 +4292,7 @@ void Unit::saveGame(XmlNode *rootNode) {
|
||||||
// float animProgress; //between 0 and 1
|
// float animProgress; //between 0 and 1
|
||||||
unitNode->addAttribute("animProgress",intToStr(animProgress), mapTagReplacements);
|
unitNode->addAttribute("animProgress",intToStr(animProgress), mapTagReplacements);
|
||||||
// float highlight;
|
// float highlight;
|
||||||
unitNode->addAttribute("highlight",doubleToStr(highlight,10), mapTagReplacements);
|
unitNode->addAttribute("highlight",floatToStr(highlight,6), mapTagReplacements);
|
||||||
// int progress2;
|
// int progress2;
|
||||||
unitNode->addAttribute("progress2",intToStr(progress2), mapTagReplacements);
|
unitNode->addAttribute("progress2",intToStr(progress2), mapTagReplacements);
|
||||||
// int kills;
|
// int kills;
|
||||||
|
@ -4342,19 +4322,19 @@ void Unit::saveGame(XmlNode *rootNode) {
|
||||||
unitNode->addAttribute("meetingPos",meetingPos.getString(), mapTagReplacements);
|
unitNode->addAttribute("meetingPos",meetingPos.getString(), mapTagReplacements);
|
||||||
//
|
//
|
||||||
// float lastRotation; //in degrees
|
// float lastRotation; //in degrees
|
||||||
unitNode->addAttribute("lastRotation",doubleToStr(lastRotation,10), mapTagReplacements);
|
unitNode->addAttribute("lastRotation",floatToStr(lastRotation,6), mapTagReplacements);
|
||||||
// float targetRotation;
|
// float targetRotation;
|
||||||
unitNode->addAttribute("targetRotation",doubleToStr(targetRotation,10), mapTagReplacements);
|
unitNode->addAttribute("targetRotation",floatToStr(targetRotation,6), mapTagReplacements);
|
||||||
// float rotation;
|
// float rotation;
|
||||||
unitNode->addAttribute("rotation",doubleToStr(rotation,10), mapTagReplacements);
|
unitNode->addAttribute("rotation",floatToStr(rotation,6), mapTagReplacements);
|
||||||
// float targetRotationZ;
|
// float targetRotationZ;
|
||||||
unitNode->addAttribute("targetRotationZ",doubleToStr(targetRotationZ,10), mapTagReplacements);
|
unitNode->addAttribute("targetRotationZ",floatToStr(targetRotationZ,6), mapTagReplacements);
|
||||||
// float targetRotationX;
|
// float targetRotationX;
|
||||||
unitNode->addAttribute("targetRotationX",doubleToStr(targetRotationX,10), mapTagReplacements);
|
unitNode->addAttribute("targetRotationX",floatToStr(targetRotationX,6), mapTagReplacements);
|
||||||
// float rotationZ;
|
// float rotationZ;
|
||||||
unitNode->addAttribute("rotationZ",doubleToStr(rotationZ,10), mapTagReplacements);
|
unitNode->addAttribute("rotationZ",floatToStr(rotationZ,6), mapTagReplacements);
|
||||||
// float rotationX;
|
// float rotationX;
|
||||||
unitNode->addAttribute("rotationX",doubleToStr(rotationX,10), mapTagReplacements);
|
unitNode->addAttribute("rotationX",floatToStr(rotationX,6), mapTagReplacements);
|
||||||
// const UnitType *type;
|
// const UnitType *type;
|
||||||
unitNode->addAttribute("type",type->getName(false), mapTagReplacements);
|
unitNode->addAttribute("type",type->getName(false), mapTagReplacements);
|
||||||
|
|
||||||
|
@ -4699,7 +4679,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
||||||
// Vec2i targetPos; //absolute target pos
|
// Vec2i targetPos; //absolute target pos
|
||||||
result->targetPos = Vec2i::strToVec2(unitNode->getAttribute("targetPos")->getValue());
|
result->targetPos = Vec2i::strToVec2(unitNode->getAttribute("targetPos")->getValue());
|
||||||
// Vec3f targetVec;
|
// Vec3f targetVec;
|
||||||
result->targetVec = Vec3d::strToVec3(unitNode->getAttribute("targetVec")->getValue());
|
result->targetVec = Vec3f::strToVec3(unitNode->getAttribute("targetVec")->getValue());
|
||||||
// Vec2i meetingPos;
|
// Vec2i meetingPos;
|
||||||
result->meetingPos = Vec2i::strToVec2(unitNode->getAttribute("meetingPos")->getValue());
|
result->meetingPos = Vec2i::strToVec2(unitNode->getAttribute("meetingPos")->getValue());
|
||||||
//
|
//
|
||||||
|
|
|
@ -353,7 +353,7 @@ private:
|
||||||
int64 progress; //between 0 and 1
|
int64 progress; //between 0 and 1
|
||||||
int64 lastAnimProgress; //between 0 and 1
|
int64 lastAnimProgress; //between 0 and 1
|
||||||
int64 animProgress; //between 0 and 1
|
int64 animProgress; //between 0 and 1
|
||||||
double highlight;
|
float highlight;
|
||||||
int32 progress2;
|
int32 progress2;
|
||||||
int32 kills;
|
int32 kills;
|
||||||
int32 enemyKills;
|
int32 enemyKills;
|
||||||
|
@ -368,16 +368,16 @@ private:
|
||||||
Vec2i pos;
|
Vec2i pos;
|
||||||
Vec2i lastPos;
|
Vec2i lastPos;
|
||||||
Vec2i targetPos; //absolute target pos
|
Vec2i targetPos; //absolute target pos
|
||||||
Vec3d targetVec;
|
Vec3f targetVec;
|
||||||
Vec2i meetingPos;
|
Vec2i meetingPos;
|
||||||
|
|
||||||
double lastRotation; //in degrees
|
float lastRotation; //in degrees
|
||||||
double targetRotation;
|
float targetRotation;
|
||||||
double rotation;
|
float rotation;
|
||||||
double targetRotationZ;
|
float targetRotationZ;
|
||||||
double targetRotationX;
|
float targetRotationX;
|
||||||
double rotationZ;
|
float rotationZ;
|
||||||
double rotationX;
|
float rotationX;
|
||||||
|
|
||||||
const UnitType *preMorph_type;
|
const UnitType *preMorph_type;
|
||||||
const UnitType *type;
|
const UnitType *type;
|
||||||
|
@ -520,7 +520,7 @@ public:
|
||||||
inline double getLastAnimProgressAsFloat() const {return static_cast<double>(lastAnimProgress) / 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 double getAnimProgressAsFloat() const {return static_cast<double>(animProgress) / ANIMATION_SPEED_MULTIPLIER;}
|
||||||
|
|
||||||
inline double getHightlight() const {return highlight;}
|
inline float getHightlight() const {return highlight;}
|
||||||
inline int getProgress2() const {return progress2;}
|
inline int getProgress2() const {return progress2;}
|
||||||
inline int getFactionIndex() const {
|
inline int getFactionIndex() const {
|
||||||
return faction->getIndex();
|
return faction->getIndex();
|
||||||
|
@ -536,7 +536,7 @@ public:
|
||||||
double getEpRatio() const;
|
double getEpRatio() const;
|
||||||
inline bool getToBeUndertaken() const {return toBeUndertaken;}
|
inline bool getToBeUndertaken() const {return toBeUndertaken;}
|
||||||
inline Vec2i getTargetPos() const {return targetPos;}
|
inline Vec2i getTargetPos() const {return targetPos;}
|
||||||
inline Vec3d getTargetVec() const {return targetVec;}
|
inline Vec3f getTargetVec() const {return targetVec;}
|
||||||
inline Field getTargetField() const {return targetField;}
|
inline Field getTargetField() const {return targetField;}
|
||||||
inline Vec2i getMeetingPos() const {return meetingPos;}
|
inline Vec2i getMeetingPos() const {return meetingPos;}
|
||||||
inline Faction *getFaction() const {return faction;}
|
inline Faction *getFaction() const {return faction;}
|
||||||
|
@ -546,9 +546,9 @@ public:
|
||||||
|
|
||||||
inline const SkillType *getCurrSkill() const {return currSkill;}
|
inline const SkillType *getCurrSkill() const {return currSkill;}
|
||||||
inline const TotalUpgrade *getTotalUpgrade() const {return &totalUpgrade;}
|
inline const TotalUpgrade *getTotalUpgrade() const {return &totalUpgrade;}
|
||||||
inline double getRotation() const {return rotation;}
|
inline float getRotation() const {return rotation;}
|
||||||
double getRotationX() const;
|
float getRotationX() const;
|
||||||
double getRotationZ() const;
|
float getRotationZ() const;
|
||||||
ParticleSystem *getFire() const;
|
ParticleSystem *getFire() const;
|
||||||
inline int getKills() const {return kills;}
|
inline int getKills() const {return kills;}
|
||||||
inline int getEnemyKills() const {return enemyKills;}
|
inline int getEnemyKills() const {return enemyKills;}
|
||||||
|
@ -574,7 +574,7 @@ public:
|
||||||
Vec2i getPosWithCellMapSet() const;
|
Vec2i getPosWithCellMapSet() const;
|
||||||
inline Vec2i getLastPos() const {return lastPos;}
|
inline Vec2i getLastPos() const {return lastPos;}
|
||||||
Vec2i getCenteredPos() const;
|
Vec2i getCenteredPos() const;
|
||||||
Vec2d getFloatCenteredPos() const;
|
Vec2f getFloatCenteredPos() const;
|
||||||
Vec2i getCellPos() const;
|
Vec2i getCellPos() const;
|
||||||
|
|
||||||
//is
|
//is
|
||||||
|
@ -613,7 +613,7 @@ public:
|
||||||
void refreshPos();
|
void refreshPos();
|
||||||
void setTargetPos(const Vec2i &targetPos);
|
void setTargetPos(const Vec2i &targetPos);
|
||||||
void setTarget(const Unit *unit);
|
void setTarget(const Unit *unit);
|
||||||
void setTargetVec(const Vec3d &targetVec);
|
void setTargetVec(const Vec3f &targetVec);
|
||||||
void setMeetingPos(const Vec2i &meetingPos);
|
void setMeetingPos(const Vec2i &meetingPos);
|
||||||
void setVisible(const bool visible);
|
void setVisible(const bool visible);
|
||||||
inline bool getVisible() const { return visible; }
|
inline bool getVisible() const { return visible; }
|
||||||
|
@ -621,9 +621,9 @@ public:
|
||||||
//render related
|
//render related
|
||||||
const Model *getCurrentModel();
|
const Model *getCurrentModel();
|
||||||
Model *getCurrentModelPtr();
|
Model *getCurrentModelPtr();
|
||||||
Vec3d getCurrVector() const;
|
Vec3f getCurrVector() const;
|
||||||
Vec3d getCurrVectorFlat() const;
|
Vec3f getCurrVectorFlat() const;
|
||||||
Vec3d getVectorFlat(const Vec2i &lastPosValue, const Vec2i &curPosValue) const;
|
Vec3f getVectorFlat(const Vec2i &lastPosValue, const Vec2i &curPosValue) const;
|
||||||
|
|
||||||
//command related
|
//command related
|
||||||
bool anyCommand(bool validateCommandtype=false) const;
|
bool anyCommand(bool validateCommandtype=false) const;
|
||||||
|
@ -794,7 +794,7 @@ private:
|
||||||
void addNetworkCRCDecHp(string info) { }
|
void addNetworkCRCDecHp(string info) { }
|
||||||
string getNetworkCRCDecHpList() const;
|
string getNetworkCRCDecHpList() const;
|
||||||
|
|
||||||
double computeHeight(const Vec2i &pos) const;
|
float computeHeight(const Vec2i &pos) const;
|
||||||
void calculateXZRotation();
|
void calculateXZRotation();
|
||||||
void updateTarget();
|
void updateTarget();
|
||||||
void clearCommands();
|
void clearCommands();
|
||||||
|
|
|
@ -665,7 +665,7 @@ void SkillType::saveGame(XmlNode *rootNode) {
|
||||||
//
|
//
|
||||||
// SoundContainer sounds;
|
// SoundContainer sounds;
|
||||||
// float soundStartTime;
|
// float soundStartTime;
|
||||||
skillTypeNode->addAttribute("soundStartTime",doubleToStr(soundStartTime,10), mapTagReplacements);
|
skillTypeNode->addAttribute("soundStartTime",floatToStr(soundStartTime,6), mapTagReplacements);
|
||||||
// RandomGen random;
|
// RandomGen random;
|
||||||
skillTypeNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements);
|
skillTypeNode->addAttribute("random",intToStr(random.getLastNumber()), mapTagReplacements);
|
||||||
// AttackBoost attackBoost;
|
// AttackBoost attackBoost;
|
||||||
|
@ -897,7 +897,7 @@ void AttackSkillType::saveGame(XmlNode *rootNode) {
|
||||||
attackFieldsNode->addAttribute("value",intToStr(attackFields[i]), mapTagReplacements);
|
attackFieldsNode->addAttribute("value",intToStr(attackFields[i]), mapTagReplacements);
|
||||||
}
|
}
|
||||||
// float attackStartTime;
|
// float attackStartTime;
|
||||||
attackSkillTypeNode->addAttribute("attackStartTime",doubleToStr(attackStartTime,10), mapTagReplacements);
|
attackSkillTypeNode->addAttribute("attackStartTime",floatToStr(attackStartTime,6), mapTagReplacements);
|
||||||
// string spawnUnit;
|
// string spawnUnit;
|
||||||
attackSkillTypeNode->addAttribute("spawnUnit",spawnUnit, mapTagReplacements);
|
attackSkillTypeNode->addAttribute("spawnUnit",spawnUnit, mapTagReplacements);
|
||||||
// int spawnUnitcount;
|
// int spawnUnitcount;
|
||||||
|
@ -1220,7 +1220,7 @@ void FogOfWarSkillType::saveGame(XmlNode *rootNode) {
|
||||||
|
|
||||||
fogSkillTypeNode->addAttribute("enable-fog",intToStr(fowEnable), mapTagReplacements);
|
fogSkillTypeNode->addAttribute("enable-fog",intToStr(fowEnable), mapTagReplacements);
|
||||||
fogSkillTypeNode->addAttribute("apply-team",intToStr(applyToTeam), mapTagReplacements);
|
fogSkillTypeNode->addAttribute("apply-team",intToStr(applyToTeam), mapTagReplacements);
|
||||||
fogSkillTypeNode->addAttribute("duration",doubleToStr(durationTime,10), mapTagReplacements);
|
fogSkillTypeNode->addAttribute("duration",floatToStr(durationTime,6), mapTagReplacements);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
|
@ -137,7 +137,7 @@ protected:
|
||||||
vector<AnimationAttributes> animationAttributes;
|
vector<AnimationAttributes> animationAttributes;
|
||||||
|
|
||||||
SoundContainer sounds;
|
SoundContainer sounds;
|
||||||
double soundStartTime;
|
float soundStartTime;
|
||||||
RandomGen random;
|
RandomGen random;
|
||||||
AttackBoost attackBoost;
|
AttackBoost attackBoost;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ public:
|
||||||
int getAnimSpeed() const {return animSpeed;}
|
int getAnimSpeed() const {return animSpeed;}
|
||||||
Model *getAnimation(double animProgress=0, const Unit *unit=NULL, int *lastAnimationIndex=NULL, int *animationRandomCycleCount=NULL) const;
|
Model *getAnimation(double animProgress=0, const Unit *unit=NULL, int *lastAnimationIndex=NULL, int *animationRandomCycleCount=NULL) const;
|
||||||
StaticSound *getSound() const {return sounds.getRandSound();}
|
StaticSound *getSound() const {return sounds.getRandSound();}
|
||||||
double getSoundStartTime() const {return soundStartTime;}
|
float getSoundStartTime() const {return soundStartTime;}
|
||||||
|
|
||||||
bool isAttackBoostEnabled() const { return attackBoost.enabled; }
|
bool isAttackBoostEnabled() const { return attackBoost.enabled; }
|
||||||
const AttackBoost * getAttackBoost() const { return &attackBoost; }
|
const AttackBoost * getAttackBoost() const { return &attackBoost; }
|
||||||
|
@ -226,7 +226,7 @@ private:
|
||||||
int attackRange;
|
int attackRange;
|
||||||
const AttackType *attackType;
|
const AttackType *attackType;
|
||||||
bool attackFields[fieldCount];
|
bool attackFields[fieldCount];
|
||||||
double attackStartTime;
|
float attackStartTime;
|
||||||
|
|
||||||
string spawnUnit;
|
string spawnUnit;
|
||||||
int spawnUnitcount;
|
int spawnUnitcount;
|
||||||
|
@ -253,7 +253,7 @@ public:
|
||||||
inline int getAttackRange() const {return attackRange;}
|
inline int getAttackRange() const {return attackRange;}
|
||||||
inline const AttackType *getAttackType() const {return attackType;}
|
inline const AttackType *getAttackType() const {return attackType;}
|
||||||
inline bool getAttackField(Field field) const {return attackFields[field];}
|
inline bool getAttackField(Field field) const {return attackFields[field];}
|
||||||
inline double getAttackStartTime() const {return attackStartTime;}
|
inline float getAttackStartTime() const {return attackStartTime;}
|
||||||
inline string getSpawnUnit() const {return spawnUnit;}
|
inline string getSpawnUnit() const {return spawnUnit;}
|
||||||
inline int getSpawnUnitCount() const {return spawnUnitcount;}
|
inline int getSpawnUnitCount() const {return spawnUnitcount;}
|
||||||
|
|
||||||
|
@ -419,13 +419,13 @@ class FogOfWarSkillType: public SkillType {
|
||||||
private:
|
private:
|
||||||
bool fowEnable;
|
bool fowEnable;
|
||||||
bool applyToTeam;
|
bool applyToTeam;
|
||||||
double durationTime;
|
float durationTime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FogOfWarSkillType();
|
FogOfWarSkillType();
|
||||||
bool getFowEnable() const {return fowEnable;}
|
bool getFowEnable() const {return fowEnable;}
|
||||||
bool getApplyToTeam() const {return applyToTeam;}
|
bool getApplyToTeam() const {return applyToTeam;}
|
||||||
double getDurationTime() const {return durationTime;}
|
float getDurationTime() const {return durationTime;}
|
||||||
|
|
||||||
virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
|
virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
|
||||||
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ std::string UnitType::toString() const {
|
||||||
result += " sight = " + intToStr(sight);
|
result += " sight = " + intToStr(sight);
|
||||||
result += " size = " + intToStr(size);
|
result += " size = " + intToStr(size);
|
||||||
result += " height = " + intToStr(height);
|
result += " height = " + intToStr(height);
|
||||||
result += " rotatedBuildPos = " + doubleToStr(rotatedBuildPos,10);
|
result += " rotatedBuildPos = " + floatToStr(rotatedBuildPos,6);
|
||||||
result += " rotationAllowed = " + intToStr(rotationAllowed);
|
result += " rotationAllowed = " + intToStr(rotationAllowed);
|
||||||
|
|
||||||
if(cellMap != NULL) {
|
if(cellMap != NULL) {
|
||||||
|
|
|
@ -123,7 +123,7 @@ private:
|
||||||
int sight;
|
int sight;
|
||||||
int size; //size in cells
|
int size; //size in cells
|
||||||
int height;
|
int height;
|
||||||
double rotatedBuildPos;
|
float rotatedBuildPos;
|
||||||
bool rotationAllowed;
|
bool rotationAllowed;
|
||||||
|
|
||||||
//cellmap
|
//cellmap
|
||||||
|
@ -249,8 +249,8 @@ public:
|
||||||
const CommandType* findCommandTypeById(int id) const;
|
const CommandType* findCommandTypeById(int id) const;
|
||||||
string getCommandTypeListDesc() const;
|
string getCommandTypeListDesc() const;
|
||||||
|
|
||||||
inline double getRotatedBuildPos() { return rotatedBuildPos; }
|
inline float getRotatedBuildPos() { return rotatedBuildPos; }
|
||||||
inline void setRotatedBuildPos(double value) { rotatedBuildPos = value; }
|
inline void setRotatedBuildPos(float value) { rotatedBuildPos = value; }
|
||||||
|
|
||||||
//other
|
//other
|
||||||
virtual string getReqDesc(bool translatedValue) const;
|
virtual string getReqDesc(bool translatedValue) const;
|
||||||
|
|
|
@ -93,7 +93,7 @@ void Cell::saveGame(XmlNode *rootNode, int index) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
// float height;
|
// float height;
|
||||||
cellNode->addAttribute("height",doubleToStr(getHeight(),10), mapTagReplacements);
|
cellNode->addAttribute("height",floatToStr(getHeight(),6), mapTagReplacements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,10 +374,10 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) {
|
||||||
heightFactor= header.heightFactor;
|
heightFactor= header.heightFactor;
|
||||||
if(heightFactor>100){
|
if(heightFactor>100){
|
||||||
heightFactor=heightFactor/100;
|
heightFactor=heightFactor/100;
|
||||||
heightFactor = truncateDecimal<double>(heightFactor,10);
|
heightFactor = truncateDecimal<float>(heightFactor,6);
|
||||||
}
|
}
|
||||||
waterLevel= static_cast<double>((header.waterLevel-0.01f)/heightFactor);
|
waterLevel= static_cast<float>((header.waterLevel-0.01f)/heightFactor);
|
||||||
waterLevel = truncateDecimal<double>(waterLevel,10);
|
waterLevel = truncateDecimal<float>(waterLevel,6);
|
||||||
title= header.title;
|
title= header.title;
|
||||||
maxPlayers= header.maxFactions;
|
maxPlayers= header.maxFactions;
|
||||||
|
|
||||||
|
@ -395,8 +395,8 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) {
|
||||||
else if(header.version==2){
|
else if(header.version==2){
|
||||||
//desc = header.version2.short_desc;
|
//desc = header.version2.short_desc;
|
||||||
if(header.version2.cliffLevel > 0 && header.version2.cliffLevel < 5000){
|
if(header.version2.cliffLevel > 0 && header.version2.cliffLevel < 5000){
|
||||||
cliffLevel=static_cast<double>((header.version2.cliffLevel-0.01f)/(heightFactor),10);
|
cliffLevel=static_cast<float>((header.version2.cliffLevel-0.01f)/(heightFactor),6);
|
||||||
cliffLevel = truncateDecimal<double>(cliffLevel,10);
|
cliffLevel = truncateDecimal<float>(cliffLevel,6);
|
||||||
}
|
}
|
||||||
if(header.version2.cameraHeight > 0 && header.version2.cameraHeight < 5000) {
|
if(header.version2.cameraHeight > 0 && header.version2.cameraHeight < 5000) {
|
||||||
cameraHeight = header.version2.cameraHeight;
|
cameraHeight = header.version2.cameraHeight;
|
||||||
|
@ -481,7 +481,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) {
|
||||||
sc->setObject(NULL);
|
sc->setObject(NULL);
|
||||||
}
|
}
|
||||||
else if(objNumber <= Tileset::objCount) {
|
else if(objNumber <= Tileset::objCount) {
|
||||||
Object *o= new Object(tileset->getObjectType(objNumber-1), Vec3d(sc->getVertex()),Vec2i(i, j));
|
Object *o= new Object(tileset->getObjectType(objNumber-1), sc->getVertex(),Vec2i(i, j));
|
||||||
sc->setObject(o);
|
sc->setObject(o);
|
||||||
for(int k = 0; k < techTree->getResourceTypeCount(); ++k) {
|
for(int k = 0; k < techTree->getResourceTypeCount(); ++k) {
|
||||||
const ResourceType *rt= techTree->getResourceType(k);
|
const ResourceType *rt= techTree->getResourceType(k);
|
||||||
|
@ -492,7 +492,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) {
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const ResourceType *rt= techTree->getTechResourceType(objNumber - Tileset::objCount) ;
|
const ResourceType *rt= techTree->getTechResourceType(objNumber - Tileset::objCount) ;
|
||||||
Object *o= new Object(NULL, Vec3d(sc->getVertex()),Vec2i(i, j));
|
Object *o= new Object(NULL, sc->getVertex(),Vec2i(i, j));
|
||||||
o->setResource(rt, Vec2i(i, j));
|
o->setResource(rt, Vec2i(i, j));
|
||||||
sc->setObject(o);
|
sc->setObject(o);
|
||||||
}
|
}
|
||||||
|
@ -1532,7 +1532,7 @@ void Map::prepareTerrain(const Unit *unit) {
|
||||||
// ==================== compute ====================
|
// ==================== compute ====================
|
||||||
|
|
||||||
void Map::flatternTerrain(const Unit *unit){
|
void Map::flatternTerrain(const Unit *unit){
|
||||||
double refHeight= getSurfaceCell(toSurfCoords(unit->getCenteredPos()))->getHeight();
|
float refHeight= getSurfaceCell(toSurfCoords(unit->getCenteredPos()))->getHeight();
|
||||||
for(int i=-1; i<=unit->getType()->getSize(); ++i){
|
for(int i=-1; i<=unit->getType()->getSize(); ++i){
|
||||||
for(int j=-1; j<=unit->getType()->getSize(); ++j){
|
for(int j=-1; j<=unit->getType()->getSize(); ++j){
|
||||||
Vec2i pos= unit->getPosNotThreadSafe()+Vec2i(i, j);
|
Vec2i pos= unit->getPosNotThreadSafe()+Vec2i(i, j);
|
||||||
|
@ -1641,7 +1641,7 @@ void Map::smoothSurface(Tileset *tileset) {
|
||||||
}
|
}
|
||||||
if (formerObject == NULL) {
|
if (formerObject == NULL) {
|
||||||
Object *o = new Object(tileset->getObjectType(9),
|
Object *o = new Object(tileset->getObjectType(9),
|
||||||
Vec3d(getSurfaceCell(i, j)->getVertex()),
|
getSurfaceCell(i, j)->getVertex(),
|
||||||
Vec2i(i,j));
|
Vec2i(i,j));
|
||||||
getSurfaceCell(i, j)->setObject(o);
|
getSurfaceCell(i, j)->setObject(o);
|
||||||
}
|
}
|
||||||
|
@ -1733,11 +1733,11 @@ void Map::saveGame(XmlNode *rootNode) const {
|
||||||
// string title;
|
// string title;
|
||||||
mapNode->addAttribute("title",title, mapTagReplacements);
|
mapNode->addAttribute("title",title, mapTagReplacements);
|
||||||
// float waterLevel;
|
// float waterLevel;
|
||||||
mapNode->addAttribute("waterLevel",doubleToStr(waterLevel,10), mapTagReplacements);
|
mapNode->addAttribute("waterLevel",floatToStr(waterLevel,6), mapTagReplacements);
|
||||||
// float heightFactor;
|
// float heightFactor;
|
||||||
mapNode->addAttribute("heightFactor",doubleToStr(heightFactor,10), mapTagReplacements);
|
mapNode->addAttribute("heightFactor",floatToStr(heightFactor,6), mapTagReplacements);
|
||||||
// float cliffLevel;
|
// float cliffLevel;
|
||||||
mapNode->addAttribute("cliffLevel",doubleToStr(cliffLevel,10), mapTagReplacements);
|
mapNode->addAttribute("cliffLevel",floatToStr(cliffLevel,6), mapTagReplacements);
|
||||||
// int cameraHeight;
|
// int cameraHeight;
|
||||||
mapNode->addAttribute("cameraHeight",intToStr(cameraHeight), mapTagReplacements);
|
mapNode->addAttribute("cameraHeight",intToStr(cameraHeight), mapTagReplacements);
|
||||||
// int w;
|
// int w;
|
||||||
|
@ -1817,7 +1817,7 @@ void Map::saveGame(XmlNode *rootNode) const {
|
||||||
// Checksum checksumValue;
|
// Checksum checksumValue;
|
||||||
// mapNode->addAttribute("checksumValue",intToStr(checksumValue.getSum()), mapTagReplacements);
|
// mapNode->addAttribute("checksumValue",intToStr(checksumValue.getSum()), mapTagReplacements);
|
||||||
// float maxMapHeight;
|
// float maxMapHeight;
|
||||||
mapNode->addAttribute("maxMapHeight",doubleToStr(maxMapHeight,10), mapTagReplacements);
|
mapNode->addAttribute("maxMapHeight",floatToStr(maxMapHeight,6), mapTagReplacements);
|
||||||
// string mapFile;
|
// string mapFile;
|
||||||
mapNode->addAttribute("mapFile",mapFile, mapTagReplacements);
|
mapNode->addAttribute("mapFile",mapFile, mapTagReplacements);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Cell {
|
||||||
private:
|
private:
|
||||||
Unit *units[fieldCount]; //units on this cell
|
Unit *units[fieldCount]; //units on this cell
|
||||||
Unit *unitsWithEmptyCellMap[fieldCount]; //units with an empty cellmap on this cell
|
Unit *unitsWithEmptyCellMap[fieldCount]; //units with an empty cellmap on this cell
|
||||||
double height;
|
float height;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Cell(Cell&);
|
Cell(Cell&);
|
||||||
|
@ -70,11 +70,11 @@ public:
|
||||||
//get
|
//get
|
||||||
inline Unit *getUnit(int field) const { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} return units[field];}
|
inline Unit *getUnit(int field) const { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} return units[field];}
|
||||||
inline Unit *getUnitWithEmptyCellMap(int field) const { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} return unitsWithEmptyCellMap[field];}
|
inline Unit *getUnitWithEmptyCellMap(int field) const { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} return unitsWithEmptyCellMap[field];}
|
||||||
inline double getHeight() const {return truncateDecimal<double>(height,10);}
|
inline float getHeight() const {return truncateDecimal<float>(height,6);}
|
||||||
|
|
||||||
inline void setUnit(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} units[field]= unit;}
|
inline void setUnit(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} units[field]= unit;}
|
||||||
inline void setUnitWithEmptyCellMap(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} unitsWithEmptyCellMap[field]= unit;}
|
inline void setUnitWithEmptyCellMap(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} unitsWithEmptyCellMap[field]= unit;}
|
||||||
inline void setHeight(double height) {this->height = truncateDecimal<double>(height,10);}
|
inline void setHeight(float height) {this->height = truncateDecimal<float>(height,6);}
|
||||||
|
|
||||||
inline bool isFree(Field field) const {
|
inline bool isFree(Field field) const {
|
||||||
Unit *unit = getUnit(field);
|
Unit *unit = getUnit(field);
|
||||||
|
@ -213,9 +213,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string title;
|
string title;
|
||||||
double waterLevel;
|
float waterLevel;
|
||||||
double heightFactor;
|
float heightFactor;
|
||||||
double cliffLevel;
|
float cliffLevel;
|
||||||
int cameraHeight;
|
int cameraHeight;
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
|
@ -228,7 +228,7 @@ private:
|
||||||
SurfaceCell *surfaceCells;
|
SurfaceCell *surfaceCells;
|
||||||
Vec2i *startLocations;
|
Vec2i *startLocations;
|
||||||
Checksum checksumValue;
|
Checksum checksumValue;
|
||||||
double maxMapHeight;
|
float maxMapHeight;
|
||||||
string mapFile;
|
string mapFile;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -296,11 +296,11 @@ public:
|
||||||
inline int getSurfaceW() const {return surfaceW;}
|
inline int getSurfaceW() const {return surfaceW;}
|
||||||
inline int getSurfaceH() const {return surfaceH;}
|
inline int getSurfaceH() const {return surfaceH;}
|
||||||
inline int getMaxPlayers() const {return maxPlayers;}
|
inline int getMaxPlayers() const {return maxPlayers;}
|
||||||
inline double getHeightFactor() const {return truncateDecimal<double>(heightFactor,10);}
|
inline float getHeightFactor() const {return truncateDecimal<float>(heightFactor,6);}
|
||||||
inline double getWaterLevel() const {return truncateDecimal<double>(waterLevel,10);}
|
inline float getWaterLevel() const {return truncateDecimal<float>(waterLevel,6);}
|
||||||
inline double getCliffLevel() const {return truncateDecimal<double>(cliffLevel,10);}
|
inline float getCliffLevel() const {return truncateDecimal<float>(cliffLevel,6);}
|
||||||
inline int getCameraHeight() const {return cameraHeight;}
|
inline int getCameraHeight() const {return cameraHeight;}
|
||||||
inline double getMaxMapHeight() const {return truncateDecimal<double>(maxMapHeight,10);}
|
inline float getMaxMapHeight() const {return truncateDecimal<float>(maxMapHeight,6);}
|
||||||
Vec2i getStartLocation(int locationIndex) const;
|
Vec2i getStartLocation(int locationIndex) const;
|
||||||
inline bool getSubmerged(const SurfaceCell *sc) const {return sc->getHeight()<waterLevel;}
|
inline bool getSubmerged(const SurfaceCell *sc) const {return sc->getHeight()<waterLevel;}
|
||||||
inline bool getSubmerged(const Cell *c) const {return c->getHeight()<waterLevel;}
|
inline bool getSubmerged(const Cell *c) const {return c->getHeight()<waterLevel;}
|
||||||
|
|
|
@ -29,8 +29,8 @@ using namespace Shared::Graphics;
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
const double Tileset::standardAirHeight= 5.0f;
|
const float Tileset::standardAirHeight= 5.0f;
|
||||||
const double Tileset::standardShadowIntensity= 0.2f;
|
const float Tileset::standardShadowIntensity= 0.2f;
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class AmbientSounds
|
// class AmbientSounds
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -433,15 +433,15 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
||||||
|
|
||||||
//weather
|
//weather
|
||||||
const XmlNode *weatherNode= parametersNode->getChild("weather");
|
const XmlNode *weatherNode= parametersNode->getChild("weather");
|
||||||
double sunnyProb= weatherNode->getAttribute("sun")->getFloatValue(0.f, 1.f);
|
float sunnyProb= weatherNode->getAttribute("sun")->getFloatValue(0.f, 1.f);
|
||||||
double rainyProb= weatherNode->getAttribute("rain")->getFloatValue(0.f, 1.f) + sunnyProb;
|
float 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__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
double rnd= streflop::fabs(static_cast<streflop::Simple>(random.randRange(-1.f, 1.f)));
|
float rnd= streflop::fabs(static_cast<streflop::Simple>(random.randRange(-1.f, 1.f)));
|
||||||
#else
|
#else
|
||||||
double rnd= fabs(random.randRange(-1.f, 1.f));
|
float rnd= fabs(random.randRange(-1.f, 1.f));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
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
|
//center textures
|
||||||
if(leftUp == rightUp && leftUp == leftDown && leftUp == rightDown) {
|
if(leftUp == rightUp && leftUp == leftDown && leftUp == rightDown) {
|
||||||
//texture variation according to probability
|
//texture variation according to probability
|
||||||
double r= random.randRange(0.f, 1.f);
|
float r= random.randRange(0.f, 1.f);
|
||||||
const Pixmap2D *pixmap = NULL;
|
const Pixmap2D *pixmap = NULL;
|
||||||
|
|
||||||
if(surfProbs[leftUp][0] < 0) {
|
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));
|
pixmap = getSurfPixmap(leftUp, (mapY % parts) * parts + (mapX % parts));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
double max= 0.f;
|
float max= 0.f;
|
||||||
int var= 0;
|
int var= 0;
|
||||||
for(int i=0; i < surfProbs[leftUp].size(); ++i) {
|
for(int i=0; i < surfProbs[leftUp].size(); ++i) {
|
||||||
max += surfProbs[leftUp][i];
|
max += surfProbs[leftUp][i];
|
||||||
|
|
|
@ -120,8 +120,8 @@ public:
|
||||||
static const int surfCount= 6;
|
static const int surfCount= 6;
|
||||||
static const int objCount= 10;
|
static const int objCount= 10;
|
||||||
static const int transitionVars= 2; //number or different transition textures
|
static const int transitionVars= 2; //number or different transition textures
|
||||||
static const double standardAirHeight;
|
static const float standardAirHeight;
|
||||||
static const double standardShadowIntensity;
|
static const float standardShadowIntensity;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef vector<float> SurfProbs;
|
typedef vector<float> SurfProbs;
|
||||||
|
@ -142,13 +142,13 @@ private:
|
||||||
bool waterEffects;
|
bool waterEffects;
|
||||||
bool fog;
|
bool fog;
|
||||||
int fogMode;
|
int fogMode;
|
||||||
double fogDensity;
|
float fogDensity;
|
||||||
Vec3f fogColor;
|
Vec3f fogColor;
|
||||||
Vec3f sunLightColor;
|
Vec3f sunLightColor;
|
||||||
Vec3f moonLightColor;
|
Vec3f moonLightColor;
|
||||||
double shadowIntensity;
|
float shadowIntensity;
|
||||||
Weather weather;
|
Weather weather;
|
||||||
double airHeight;
|
float airHeight;
|
||||||
|
|
||||||
AmbientSounds ambientSounds;
|
AmbientSounds ambientSounds;
|
||||||
Checksum checksumValue;
|
Checksum checksumValue;
|
||||||
|
@ -178,7 +178,7 @@ public:
|
||||||
Checksum * getChecksumValue() { return &checksumValue; }
|
Checksum * getChecksumValue() { return &checksumValue; }
|
||||||
|
|
||||||
//get
|
//get
|
||||||
double getAirHeight()const {return airHeight;}
|
float getAirHeight()const {return airHeight;}
|
||||||
const SurfaceAtlas *getSurfaceAtlas() const {return &surfaceAtlas;}
|
const SurfaceAtlas *getSurfaceAtlas() const {return &surfaceAtlas;}
|
||||||
ObjectType *getObjectType(int i) {return &objectTypes[i];}
|
ObjectType *getObjectType(int i) {return &objectTypes[i];}
|
||||||
float getSurfProb(int surf, int var) const {return surfProbs[surf][var];}
|
float getSurfProb(int surf, int var) const {return surfProbs[surf][var];}
|
||||||
|
@ -186,11 +186,11 @@ public:
|
||||||
bool getWaterEffects() const {return waterEffects;}
|
bool getWaterEffects() const {return waterEffects;}
|
||||||
bool getFog() const {return fog;}
|
bool getFog() const {return fog;}
|
||||||
int getFogMode() const {return fogMode;}
|
int getFogMode() const {return fogMode;}
|
||||||
double getFogDensity() const {return fogDensity;}
|
float getFogDensity() const {return fogDensity;}
|
||||||
const Vec3f &getFogColor() const {return fogColor;}
|
const Vec3f &getFogColor() const {return fogColor;}
|
||||||
const Vec3f &getSunLightColor() const {return sunLightColor;}
|
const Vec3f &getSunLightColor() const {return sunLightColor;}
|
||||||
const Vec3f &getMoonLightColor() const {return moonLightColor;}
|
const Vec3f &getMoonLightColor() const {return moonLightColor;}
|
||||||
double getShadowIntense()const {return shadowIntensity;}
|
float getShadowIntense()const {return shadowIntensity;}
|
||||||
Weather getWeather() const {return weather;}
|
Weather getWeather() const {return weather;}
|
||||||
void setWeather(Weather value) { weather = value; }
|
void setWeather(Weather value) { weather = value; }
|
||||||
|
|
||||||
|
|
|
@ -160,12 +160,12 @@ void TimeFlow::saveGame(XmlNode *rootNode) {
|
||||||
// bool firstTime;
|
// bool firstTime;
|
||||||
// Tileset *tileset;
|
// Tileset *tileset;
|
||||||
// float time;
|
// float time;
|
||||||
timeflowNode->addAttribute("time",floatToStr(time,10), mapTagReplacements);
|
timeflowNode->addAttribute("time",floatToStr(time,6), mapTagReplacements);
|
||||||
// float lastTime;
|
// float lastTime;
|
||||||
timeflowNode->addAttribute("lastTime",floatToStr(lastTime,10), mapTagReplacements);
|
timeflowNode->addAttribute("lastTime",floatToStr(lastTime,6), mapTagReplacements);
|
||||||
// float timeInc;
|
// float timeInc;
|
||||||
//printf("#2 timeInc = %f\n",timeInc);
|
//printf("#2 timeInc = %f\n",timeInc);
|
||||||
timeflowNode->addAttribute("timeInc",floatToStr(timeInc,10), mapTagReplacements);
|
timeflowNode->addAttribute("timeInc",floatToStr(timeInc,6), mapTagReplacements);
|
||||||
//printf("#3 timeInc = %f\n",timeInc);
|
//printf("#3 timeInc = %f\n",timeInc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
double soundStartTime= currSkill->getSoundStartTime();
|
float 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)) {
|
||||||
|
@ -138,9 +138,9 @@ bool UnitUpdater::updateUnit(Unit *unit) {
|
||||||
if(unit->getCurrSkill()->getClass() == scAttack) {
|
if(unit->getCurrSkill()->getClass() == scAttack) {
|
||||||
const AttackSkillType *ast= static_cast<const AttackSkillType*>(unit->getCurrSkill());
|
const AttackSkillType *ast= static_cast<const AttackSkillType*>(unit->getCurrSkill());
|
||||||
|
|
||||||
double attackStartTime = truncateDecimal<double>(ast->getAttackStartTime(),10);
|
float attackStartTime = truncateDecimal<float>(ast->getAttackStartTime(),6);
|
||||||
double lastAnimProgress = truncateDecimal<double>(unit->getLastAnimProgressAsFloat(),10);
|
float lastAnimProgress = truncateDecimal<float>(unit->getLastAnimProgressAsFloat(),6);
|
||||||
double animProgress = truncateDecimal<double>(unit->getAnimProgressAsFloat(),10);
|
float animProgress = truncateDecimal<float>(unit->getAnimProgressAsFloat(),6);
|
||||||
bool startAttackParticleSystemNow = (attackStartTime >= lastAnimProgress && attackStartTime < animProgress);
|
bool startAttackParticleSystemNow = (attackStartTime >= lastAnimProgress && attackStartTime < animProgress);
|
||||||
|
|
||||||
char szBuf[8096]="";
|
char szBuf[8096]="";
|
||||||
|
@ -2211,7 +2211,7 @@ void UnitUpdater::hit(Unit *attacker, const AttackSkillType* ast, const Vec2i &t
|
||||||
scriptManager->onUnitAttacking(attacker);
|
scriptManager->onUnitAttacking(attacker);
|
||||||
|
|
||||||
double distance = pci.getPos().dist(targetPos);
|
double distance = pci.getPos().dist(targetPos);
|
||||||
distance = truncateDecimal<double>(distance,10);
|
distance = truncateDecimal<double>(distance,6);
|
||||||
damage(attacker, ast, attacked, distance);
|
damage(attacker, ast, attacked, distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2241,7 +2241,7 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
|
||||||
int var = ast->getAttackVar();
|
int var = ast->getAttackVar();
|
||||||
int armor = attacked->getType()->getTotalArmor(attacked->getTotalUpgrade());
|
int armor = attacked->getType()->getTotalArmor(attacked->getTotalUpgrade());
|
||||||
double damageMultiplier = world->getTechTree()->getDamageMultiplier(ast->getAttackType(), attacked->getType()->getArmorType());
|
double damageMultiplier = world->getTechTree()->getDamageMultiplier(ast->getAttackType(), attacked->getType()->getArmorType());
|
||||||
damageMultiplier = truncateDecimal<double>(damageMultiplier,10);
|
damageMultiplier = truncateDecimal<double>(damageMultiplier,6);
|
||||||
|
|
||||||
//compute damage
|
//compute damage
|
||||||
//damage += random.randRange(-var, var);
|
//damage += random.randRange(-var, var);
|
||||||
|
@ -2249,7 +2249,7 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
|
||||||
damage /= distance+1;
|
damage /= distance+1;
|
||||||
damage -= armor;
|
damage -= armor;
|
||||||
damage *= damageMultiplier;
|
damage *= damageMultiplier;
|
||||||
damage = truncateDecimal<double>(damage,10);
|
damage = truncateDecimal<double>(damage,6);
|
||||||
|
|
||||||
if(damage < 1) {
|
if(damage < 1) {
|
||||||
damage= 1;
|
damage= 1;
|
||||||
|
@ -2296,8 +2296,8 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
||||||
ParticleSystemTypeProjectile *pstProj= ast->getProjParticleType();
|
ParticleSystemTypeProjectile *pstProj= ast->getProjParticleType();
|
||||||
ParticleSystemTypeSplash *pstSplash= ast->getSplashParticleType();
|
ParticleSystemTypeSplash *pstSplash= ast->getSplashParticleType();
|
||||||
|
|
||||||
Vec3d startPos= unit->getCurrVector();
|
Vec3f startPos= unit->getCurrVector();
|
||||||
Vec3d endPos= unit->getTargetVec();
|
Vec3f endPos= unit->getTargetVec();
|
||||||
|
|
||||||
//make particle system
|
//make particle system
|
||||||
const SurfaceCell *sc= map->getSurfaceCell(Map::toSurfCoords(unit->getPos()));
|
const SurfaceCell *sc= map->getSurfaceCell(Map::toSurfCoords(unit->getPos()));
|
||||||
|
@ -2490,7 +2490,7 @@ bool UnitUpdater::unitOnRange(Unit *unit, int range, Unit **rangedPtr,
|
||||||
//aux vars
|
//aux vars
|
||||||
int size = unit->getType()->getSize();
|
int size = unit->getType()->getSize();
|
||||||
Vec2i center = unit->getPos();
|
Vec2i center = unit->getPos();
|
||||||
Vec2d floatCenter = unit->getFloatCenteredPos();
|
Vec2f floatCenter = unit->getFloatCenteredPos();
|
||||||
|
|
||||||
//bool foundInCache = true;
|
//bool foundInCache = true;
|
||||||
if(findCachedCellsEnemies(center,range,size,enemies,ast,
|
if(findCachedCellsEnemies(center,range,size,enemies,ast,
|
||||||
|
@ -2502,9 +2502,9 @@ bool UnitUpdater::unitOnRange(Unit *unit, int range, Unit **rangedPtr,
|
||||||
for(int j = center.y - range; j < center.y + range + size; ++j) {
|
for(int j = center.y - range; j < center.y + range + size; ++j) {
|
||||||
//cells inside map and in range
|
//cells inside map and in range
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2d((double)i, (double)j)))) <= (range+1)){
|
if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2f((float)i, (float)j)))) <= (range+1)){
|
||||||
#else
|
#else
|
||||||
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2d((double)i, (double)j))) <= (range+1)){
|
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){
|
||||||
#endif
|
#endif
|
||||||
Cell *cell = map->getCell(i,j);
|
Cell *cell = map->getCell(i,j);
|
||||||
findEnemiesForCell(ast,cell,unit,commandTarget,enemies);
|
findEnemiesForCell(ast,cell,unit,commandTarget,enemies);
|
||||||
|
@ -2595,7 +2595,7 @@ bool UnitUpdater::unitOnRange(Unit *unit, int range, Unit **rangedPtr,
|
||||||
|
|
||||||
if(evalMode == false && onlyEnemyUnits == false &&
|
if(evalMode == false && onlyEnemyUnits == false &&
|
||||||
enemyUnit->getTeam() != world->getThisTeamIndex()) {
|
enemyUnit->getTeam() != world->getThisTeamIndex()) {
|
||||||
Vec2d enemyFloatCenter = enemyUnit->getFloatCenteredPos();
|
Vec2f enemyFloatCenter = enemyUnit->getFloatCenteredPos();
|
||||||
// find nearest Attack and cleanup old dates
|
// find nearest Attack and cleanup old dates
|
||||||
AttackWarningData *nearest = NULL;
|
AttackWarningData *nearest = NULL;
|
||||||
double currentDistance = 0.f;
|
double currentDistance = 0.f;
|
||||||
|
@ -2684,7 +2684,7 @@ vector<Unit*> UnitUpdater::enemyUnitsOnRange(const Unit *unit,const AttackSkillT
|
||||||
//aux vars
|
//aux vars
|
||||||
int size = unit->getType()->getSize();
|
int size = unit->getType()->getSize();
|
||||||
Vec2i center = unit->getPosNotThreadSafe();
|
Vec2i center = unit->getPosNotThreadSafe();
|
||||||
Vec2d floatCenter = unit->getFloatCenteredPos();
|
Vec2f floatCenter = unit->getFloatCenteredPos();
|
||||||
|
|
||||||
//bool foundInCache = true;
|
//bool foundInCache = true;
|
||||||
if(findCachedCellsEnemies(center,range,size,enemies,ast,
|
if(findCachedCellsEnemies(center,range,size,enemies,ast,
|
||||||
|
@ -2696,9 +2696,9 @@ vector<Unit*> UnitUpdater::enemyUnitsOnRange(const Unit *unit,const AttackSkillT
|
||||||
for(int j = center.y - range; j < center.y + range + size; ++j) {
|
for(int j = center.y - range; j < center.y + range + size; ++j) {
|
||||||
//cells inside map and in range
|
//cells inside map and in range
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2d((double)i, (double)j)))) <= (range+1)){
|
if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2f((float)i, (float)j)))) <= (range+1)){
|
||||||
#else
|
#else
|
||||||
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2d((double)i, (double)j))) <= (range+1)){
|
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){
|
||||||
#endif
|
#endif
|
||||||
Cell *cell = map->getCell(i,j);
|
Cell *cell = map->getCell(i,j);
|
||||||
findEnemiesForCell(ast,cell,unit,commandTarget,enemies);
|
findEnemiesForCell(ast,cell,unit,commandTarget,enemies);
|
||||||
|
@ -2744,7 +2744,7 @@ vector<Unit*> UnitUpdater::findUnitsInRange(const Unit *unit, int radius) {
|
||||||
//aux vars
|
//aux vars
|
||||||
int size = unit->getType()->getSize();
|
int size = unit->getType()->getSize();
|
||||||
Vec2i center = unit->getPosNotThreadSafe();
|
Vec2i center = unit->getPosNotThreadSafe();
|
||||||
Vec2d floatCenter = unit->getFloatCenteredPos();
|
Vec2f floatCenter = unit->getFloatCenteredPos();
|
||||||
|
|
||||||
//nearby cells
|
//nearby cells
|
||||||
//UnitRangeCellsLookupItem cacheItem;
|
//UnitRangeCellsLookupItem cacheItem;
|
||||||
|
@ -2752,9 +2752,9 @@ vector<Unit*> UnitUpdater::findUnitsInRange(const Unit *unit, int radius) {
|
||||||
for(int j = center.y - range; j < center.y + range + size; ++j) {
|
for(int j = center.y - range; j < center.y + range + size; ++j) {
|
||||||
//cells inside map and in range
|
//cells inside map and in range
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2d((double)i, (double)j)))) <= (range+1)){
|
if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2f((float)i, (float)j)))) <= (range+1)){
|
||||||
#else
|
#else
|
||||||
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2d((double)i, (double)j))) <= (range+1)){
|
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){
|
||||||
#endif
|
#endif
|
||||||
Cell *cell = map->getCell(i,j);
|
Cell *cell = map->getCell(i,j);
|
||||||
findUnitsForCell(cell,unit,units);
|
findUnitsForCell(cell,unit,units);
|
||||||
|
@ -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",doubleToStr(attackWarnRange,10), mapTagReplacements);
|
unitupdaterNode->addAttribute("attackWarnRange",floatToStr(attackWarnRange,6), mapTagReplacements);
|
||||||
// AttackWarnings attackWarnings;
|
// AttackWarnings attackWarnings;
|
||||||
//
|
//
|
||||||
// Mutex mutexUnitRangeCellsLookupItemCache;
|
// Mutex mutexUnitRangeCellsLookupItemCache;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
class AttackWarningData {
|
class AttackWarningData {
|
||||||
public:
|
public:
|
||||||
Vec2d attackPosition;
|
Vec2f attackPosition;
|
||||||
int lastFrameCount;
|
int lastFrameCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ private:
|
||||||
Game *game;
|
Game *game;
|
||||||
//RandomGen random;
|
//RandomGen random;
|
||||||
Mutex mutexAttackWarnings;
|
Mutex mutexAttackWarnings;
|
||||||
double attackWarnRange;
|
float attackWarnRange;
|
||||||
AttackWarnings attackWarnings;
|
AttackWarnings attackWarnings;
|
||||||
|
|
||||||
Mutex mutexUnitRangeCellsLookupItemCache;
|
Mutex mutexUnitRangeCellsLookupItemCache;
|
||||||
|
|
|
@ -45,12 +45,12 @@ class Model;
|
||||||
class Particle {
|
class Particle {
|
||||||
public:
|
public:
|
||||||
//attributes
|
//attributes
|
||||||
Vec3d pos;
|
Vec3f pos;
|
||||||
Vec3d lastPos;
|
Vec3f lastPos;
|
||||||
Vec3d speed;
|
Vec3f speed;
|
||||||
Vec3d accel;
|
Vec3f accel;
|
||||||
Vec4f color;
|
Vec4f color;
|
||||||
double size;
|
float size;
|
||||||
int energy;
|
int energy;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -59,12 +59,12 @@ public:
|
||||||
energy = 0;
|
energy = 0;
|
||||||
}
|
}
|
||||||
//get
|
//get
|
||||||
Vec3d getPos() const {return pos;}
|
Vec3f getPos() const {return pos;}
|
||||||
Vec3d getLastPos() const {return lastPos;}
|
Vec3f getLastPos() const {return lastPos;}
|
||||||
Vec3d getSpeed() const {return speed;}
|
Vec3f getSpeed() const {return speed;}
|
||||||
Vec3d getAccel() const {return accel;}
|
Vec3f getAccel() const {return accel;}
|
||||||
Vec4f getColor() const {return color;}
|
Vec4f getColor() const {return color;}
|
||||||
double getSize() const {return size;}
|
float getSize() const {return size;}
|
||||||
int getEnergy() const {return energy;}
|
int getEnergy() const {return energy;}
|
||||||
|
|
||||||
void saveGame(XmlNode *rootNode);
|
void saveGame(XmlNode *rootNode);
|
||||||
|
@ -135,15 +135,15 @@ protected:
|
||||||
int textureFileLoadDeferredComponents;
|
int textureFileLoadDeferredComponents;
|
||||||
|
|
||||||
Texture *texture;
|
Texture *texture;
|
||||||
Vec3d pos;
|
Vec3f pos;
|
||||||
Vec4f color;
|
Vec4f color;
|
||||||
Vec4f colorNoEnergy;
|
Vec4f colorNoEnergy;
|
||||||
double emissionRate;
|
float emissionRate;
|
||||||
double emissionState;
|
float emissionState;
|
||||||
int maxParticleEnergy;
|
int maxParticleEnergy;
|
||||||
int varParticleEnergy;
|
int varParticleEnergy;
|
||||||
double particleSize;
|
float particleSize;
|
||||||
double speed;
|
float speed;
|
||||||
Vec3f factionColor;
|
Vec3f factionColor;
|
||||||
bool teamcolorNoEnergy;
|
bool teamcolorNoEnergy;
|
||||||
bool teamcolorEnergy;
|
bool teamcolorEnergy;
|
||||||
|
@ -166,7 +166,7 @@ public:
|
||||||
State getState() const {return state;}
|
State getState() const {return state;}
|
||||||
BlendMode getBlendMode() const {return blendMode;}
|
BlendMode getBlendMode() const {return blendMode;}
|
||||||
Texture *getTexture() const {return texture;}
|
Texture *getTexture() const {return texture;}
|
||||||
Vec3d getPos() const {return pos;}
|
Vec3f getPos() const {return pos;}
|
||||||
Particle *getParticle(int i) {return &particles[i];}
|
Particle *getParticle(int i) {return &particles[i];}
|
||||||
const Particle *getParticle(int i) const {return &particles[i];}
|
const Particle *getParticle(int i) const {return &particles[i];}
|
||||||
int getAliveParticleCount() const {return aliveParticleCount;}
|
int getAliveParticleCount() const {return aliveParticleCount;}
|
||||||
|
@ -181,14 +181,14 @@ public:
|
||||||
//set
|
//set
|
||||||
virtual void setState(State state);
|
virtual void setState(State state);
|
||||||
void setTexture(Texture *texture);
|
void setTexture(Texture *texture);
|
||||||
virtual void setPos(Vec3d pos);
|
virtual void setPos(Vec3f pos);
|
||||||
void setColor(Vec4f color);
|
void setColor(Vec4f color);
|
||||||
void setColorNoEnergy(Vec4f color);
|
void setColorNoEnergy(Vec4f color);
|
||||||
void setEmissionRate(double emissionRate);
|
void setEmissionRate(float emissionRate);
|
||||||
void setMaxParticleEnergy(int maxParticleEnergy);
|
void setMaxParticleEnergy(int maxParticleEnergy);
|
||||||
void setVarParticleEnergy(int varParticleEnergy);
|
void setVarParticleEnergy(int varParticleEnergy);
|
||||||
void setParticleSize(double particleSize);
|
void setParticleSize(float particleSize);
|
||||||
void setSpeed(double speed);
|
void setSpeed(float speed);
|
||||||
virtual void setActive(bool active);
|
virtual void setActive(bool active);
|
||||||
void setObserver(ParticleObserver *particleObserver);
|
void setObserver(ParticleObserver *particleObserver);
|
||||||
virtual void setVisible(bool visible);
|
virtual void setVisible(bool visible);
|
||||||
|
@ -236,8 +236,8 @@ protected:
|
||||||
|
|
||||||
class FireParticleSystem: public ParticleSystem{
|
class FireParticleSystem: public ParticleSystem{
|
||||||
private:
|
private:
|
||||||
double radius;
|
float radius;
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FireParticleSystem(int particleCount= 2000);
|
FireParticleSystem(int particleCount= 2000);
|
||||||
|
@ -249,8 +249,8 @@ public:
|
||||||
virtual void updateParticle(Particle *p);
|
virtual void updateParticle(Particle *p);
|
||||||
|
|
||||||
//set params
|
//set params
|
||||||
void setRadius(double radius);
|
void setRadius(float radius);
|
||||||
void setWind(double windAngle, double windSpeed);
|
void setWind(float windAngle, float windSpeed);
|
||||||
|
|
||||||
virtual void saveGame(XmlNode *rootNode);
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
virtual void loadGame(const XmlNode *rootNode);
|
virtual void loadGame(const XmlNode *rootNode);
|
||||||
|
@ -280,17 +280,17 @@ public:
|
||||||
ParticleSystem* getChild(int i);
|
ParticleSystem* getChild(int i);
|
||||||
void addChild(UnitParticleSystem* child);
|
void addChild(UnitParticleSystem* child);
|
||||||
void removeChild(UnitParticleSystem* child);
|
void removeChild(UnitParticleSystem* child);
|
||||||
void setPos(Vec3d pos);
|
void setPos(Vec3f pos);
|
||||||
void setOffset(Vec3d offset);
|
void setOffset(Vec3f offset);
|
||||||
void setModel(Model *model) {this->model= model;}
|
void setModel(Model *model) {this->model= model;}
|
||||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||||
double getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
float getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
||||||
Model *getModel() const {return model;}
|
Model *getModel() const {return model;}
|
||||||
virtual string getModelFileLoadDeferred();
|
virtual string getModelFileLoadDeferred();
|
||||||
|
|
||||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||||
Vec3d getDirection() const {return direction;}
|
Vec3f getDirection() const {return direction;}
|
||||||
void setModelCycle(double modelCycle) {this->modelCycle= modelCycle;}
|
void setModelCycle(float modelCycle) {this->modelCycle= modelCycle;}
|
||||||
|
|
||||||
virtual void saveGame(XmlNode *rootNode);
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
virtual void loadGame(const XmlNode *rootNode);
|
virtual void loadGame(const XmlNode *rootNode);
|
||||||
|
@ -306,14 +306,14 @@ protected:
|
||||||
|
|
||||||
string modelFileLoadDeferred;
|
string modelFileLoadDeferred;
|
||||||
Model *model;
|
Model *model;
|
||||||
double modelCycle;
|
float modelCycle;
|
||||||
Vec3d offset;
|
Vec3f offset;
|
||||||
Vec3d direction;
|
Vec3f direction;
|
||||||
double tween;
|
float tween;
|
||||||
|
|
||||||
GameParticleSystem(int particleCount);
|
GameParticleSystem(int particleCount);
|
||||||
void positionChildren();
|
void positionChildren();
|
||||||
void setTween(double relative,double absolute);
|
void setTween(float relative,float absolute);
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -325,15 +325,15 @@ public:
|
||||||
static bool isNight;
|
static bool isNight;
|
||||||
static Vec3f lightColor;
|
static Vec3f lightColor;
|
||||||
private:
|
private:
|
||||||
double radius;
|
float radius;
|
||||||
double minRadius;
|
float minRadius;
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
Vec3d cRotation;
|
Vec3f cRotation;
|
||||||
Vec3d fixedAddition;
|
Vec3f fixedAddition;
|
||||||
Vec3d oldPosition;
|
Vec3f oldPosition;
|
||||||
bool energyUp;
|
bool energyUp;
|
||||||
double startTime;
|
float startTime;
|
||||||
double endTime;
|
float endTime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Shape{
|
enum Shape{
|
||||||
|
@ -345,10 +345,10 @@ public:
|
||||||
bool relativeDirection;
|
bool relativeDirection;
|
||||||
bool fixed;
|
bool fixed;
|
||||||
Shape shape;
|
Shape shape;
|
||||||
double angle;
|
float angle;
|
||||||
double sizeNoEnergy;
|
float sizeNoEnergy;
|
||||||
double gravity;
|
float gravity;
|
||||||
double rotation;
|
float rotation;
|
||||||
bool isVisibleAtNight;
|
bool isVisibleAtNight;
|
||||||
bool isVisibleAtDay;
|
bool isVisibleAtDay;
|
||||||
bool isDaylightAffected;
|
bool isDaylightAffected;
|
||||||
|
@ -356,7 +356,7 @@ public:
|
||||||
int staticParticleCount;
|
int staticParticleCount;
|
||||||
int delay;
|
int delay;
|
||||||
int lifetime;
|
int lifetime;
|
||||||
double emissionRateFade;
|
float emissionRateFade;
|
||||||
GameParticleSystem* parent;
|
GameParticleSystem* parent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -373,22 +373,22 @@ public:
|
||||||
virtual void fade();
|
virtual void fade();
|
||||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||||
|
|
||||||
virtual void setStartTime(double startTime) { this->startTime = startTime; }
|
virtual void setStartTime(float startTime) { this->startTime = startTime; }
|
||||||
virtual double getStartTime() const { return this->startTime; }
|
virtual float getStartTime() const { return this->startTime; }
|
||||||
virtual void setEndTime(double endTime) { this->endTime = endTime; }
|
virtual void setEndTime(float endTime) { this->endTime = endTime; }
|
||||||
virtual double getEndTime() const { return this->endTime; }
|
virtual float getEndTime() const { return this->endTime; }
|
||||||
|
|
||||||
//set params
|
//set params
|
||||||
void setRadius(double radius) {this->radius= radius;}
|
void setRadius(float radius) {this->radius= radius;}
|
||||||
void setMinRadius(double minRadius) {this->minRadius= minRadius;}
|
void setMinRadius(float minRadius) {this->minRadius= minRadius;}
|
||||||
void setEmissionRateFade(double emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
void setEmissionRateFade(float emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
||||||
|
|
||||||
void setWind(double windAngle, double windSpeed);
|
void setWind(float windAngle, float windSpeed);
|
||||||
|
|
||||||
void setDirection(Vec3d direction) {this->direction= direction;}
|
void setDirection(Vec3f direction) {this->direction= direction;}
|
||||||
void setSizeNoEnergy(double sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
void setSizeNoEnergy(float sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||||
void setGravity(double gravity) {this->gravity= gravity;}
|
void setGravity(float gravity) {this->gravity= gravity;}
|
||||||
void setRotation(double rotation);
|
void setRotation(float rotation);
|
||||||
void setRelative(bool relative) {this->relative= relative;}
|
void setRelative(bool relative) {this->relative= relative;}
|
||||||
void setRelativeDirection(bool relativeDirection) {this->relativeDirection= relativeDirection;}
|
void setRelativeDirection(bool relativeDirection) {this->relativeDirection= relativeDirection;}
|
||||||
void setFixed(bool fixed) {this->fixed= fixed;}
|
void setFixed(bool fixed) {this->fixed= fixed;}
|
||||||
|
@ -399,12 +399,12 @@ public:
|
||||||
void setIsVisibleAtDay(bool value) {this->isVisibleAtDay= value;}
|
void setIsVisibleAtDay(bool value) {this->isVisibleAtDay= value;}
|
||||||
void setRadiusBasedStartenergy(bool value) {this->radiusBasedStartenergy= value;}
|
void setRadiusBasedStartenergy(bool value) {this->radiusBasedStartenergy= value;}
|
||||||
void setShape(Shape shape) {this->shape= shape;}
|
void setShape(Shape shape) {this->shape= shape;}
|
||||||
void setAngle(double angle) {this->angle= angle;}
|
void setAngle(float angle) {this->angle= angle;}
|
||||||
void setDelay(int delay) {this->delay= delay;}
|
void setDelay(int delay) {this->delay= delay;}
|
||||||
void setLifetime(int lifetime) {this->lifetime= lifetime;}
|
void setLifetime(int lifetime) {this->lifetime= lifetime;}
|
||||||
void setParent(GameParticleSystem* parent) {this->parent= parent;}
|
void setParent(GameParticleSystem* parent) {this->parent= parent;}
|
||||||
GameParticleSystem* getParent() const {return parent;}
|
GameParticleSystem* getParent() const {return parent;}
|
||||||
void setParentDirection(Vec3d parentDirection);
|
void setParentDirection(Vec3f parentDirection);
|
||||||
|
|
||||||
static Shape strToShape(const string& str);
|
static Shape strToShape(const string& str);
|
||||||
|
|
||||||
|
@ -422,8 +422,8 @@ public:
|
||||||
|
|
||||||
class RainParticleSystem: public ParticleSystem{
|
class RainParticleSystem: public ParticleSystem{
|
||||||
private:
|
private:
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
double radius;
|
float radius;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RainParticleSystem(int particleCount= 4000);
|
RainParticleSystem(int particleCount= 4000);
|
||||||
|
@ -435,8 +435,8 @@ public:
|
||||||
virtual void initParticle(Particle *p, int particleIndex);
|
virtual void initParticle(Particle *p, int particleIndex);
|
||||||
virtual bool deathTest(Particle *p);
|
virtual bool deathTest(Particle *p);
|
||||||
|
|
||||||
void setRadius(double radius);
|
void setRadius(float radius);
|
||||||
void setWind(double windAngle, double windSpeed);
|
void setWind(float windAngle, float windSpeed);
|
||||||
|
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
|
|
||||||
|
@ -449,8 +449,8 @@ public:
|
||||||
|
|
||||||
class SnowParticleSystem: public ParticleSystem{
|
class SnowParticleSystem: public ParticleSystem{
|
||||||
private:
|
private:
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
double radius;
|
float radius;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SnowParticleSystem(int particleCount= 4000);
|
SnowParticleSystem(int particleCount= 4000);
|
||||||
|
@ -460,8 +460,8 @@ public:
|
||||||
virtual void initParticle(Particle *p, int particleIndex);
|
virtual void initParticle(Particle *p, int particleIndex);
|
||||||
virtual bool deathTest(Particle *p);
|
virtual bool deathTest(Particle *p);
|
||||||
|
|
||||||
void setRadius(double radius);
|
void setRadius(float radius);
|
||||||
void setWind(double windAngle, double windSpeed);
|
void setWind(float windAngle, float windSpeed);
|
||||||
|
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
|
|
||||||
|
@ -477,15 +477,15 @@ public:
|
||||||
class AttackParticleSystem: public GameParticleSystem {
|
class AttackParticleSystem: public GameParticleSystem {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double sizeNoEnergy;
|
float sizeNoEnergy;
|
||||||
double gravity;
|
float gravity;
|
||||||
public:
|
public:
|
||||||
AttackParticleSystem(int particleCount);
|
AttackParticleSystem(int particleCount);
|
||||||
|
|
||||||
virtual ParticleSystemType getParticleSystemType() const { return pst_ProjectileParticleSystem;}
|
virtual ParticleSystemType getParticleSystemType() const { return pst_ProjectileParticleSystem;}
|
||||||
|
|
||||||
void setSizeNoEnergy(double sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
void setSizeNoEnergy(float sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||||
void setGravity(double gravity) {this->gravity= gravity;}
|
void setGravity(float gravity) {this->gravity= gravity;}
|
||||||
|
|
||||||
virtual void initParticleSystem() {} // opportunity to do any initialization when the system has been created and all settings set
|
virtual void initParticleSystem() {} // opportunity to do any initialization when the system has been created and all settings set
|
||||||
|
|
||||||
|
@ -514,23 +514,23 @@ public:
|
||||||
private:
|
private:
|
||||||
SplashParticleSystem *nextParticleSystem;
|
SplashParticleSystem *nextParticleSystem;
|
||||||
|
|
||||||
Vec3d lastPos;
|
Vec3f lastPos;
|
||||||
Vec3d startPos;
|
Vec3f startPos;
|
||||||
Vec3d endPos;
|
Vec3f endPos;
|
||||||
Vec3d flatPos;
|
Vec3f flatPos;
|
||||||
|
|
||||||
Vec3d xVector;
|
Vec3f xVector;
|
||||||
Vec3d yVector;
|
Vec3f yVector;
|
||||||
Vec3d zVector;
|
Vec3f zVector;
|
||||||
|
|
||||||
Trajectory trajectory;
|
Trajectory trajectory;
|
||||||
double trajectorySpeed;
|
float trajectorySpeed;
|
||||||
|
|
||||||
//parabolic
|
//parabolic
|
||||||
double trajectoryScale;
|
float trajectoryScale;
|
||||||
double trajectoryFrequency;
|
float trajectoryFrequency;
|
||||||
|
|
||||||
double arriveDestinationDistance;
|
float arriveDestinationDistance;
|
||||||
void rotateChildren();
|
void rotateChildren();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -546,11 +546,11 @@ public:
|
||||||
virtual void updateParticle(Particle *p);
|
virtual void updateParticle(Particle *p);
|
||||||
|
|
||||||
void setTrajectory(Trajectory trajectory) {this->trajectory= trajectory;}
|
void setTrajectory(Trajectory trajectory) {this->trajectory= trajectory;}
|
||||||
void setTrajectorySpeed(double trajectorySpeed) {this->trajectorySpeed= trajectorySpeed;}
|
void setTrajectorySpeed(float trajectorySpeed) {this->trajectorySpeed= trajectorySpeed;}
|
||||||
void setTrajectoryScale(double trajectoryScale) {this->trajectoryScale= trajectoryScale;}
|
void setTrajectoryScale(float trajectoryScale) {this->trajectoryScale= trajectoryScale;}
|
||||||
void setTrajectoryFrequency(double trajectoryFrequency) {this->trajectoryFrequency= trajectoryFrequency;}
|
void setTrajectoryFrequency(float trajectoryFrequency) {this->trajectoryFrequency= trajectoryFrequency;}
|
||||||
|
|
||||||
void setPath(Vec3d startPos, Vec3d endPos);
|
void setPath(Vec3f startPos, Vec3f endPos);
|
||||||
|
|
||||||
static Trajectory strToTrajectory(const string &str);
|
static Trajectory strToTrajectory(const string &str);
|
||||||
|
|
||||||
|
@ -573,13 +573,13 @@ public:
|
||||||
private:
|
private:
|
||||||
ProjectileParticleSystem *prevParticleSystem;
|
ProjectileParticleSystem *prevParticleSystem;
|
||||||
|
|
||||||
double emissionRateFade;
|
float emissionRateFade;
|
||||||
double verticalSpreadA;
|
float verticalSpreadA;
|
||||||
double verticalSpreadB;
|
float verticalSpreadB;
|
||||||
double horizontalSpreadA;
|
float horizontalSpreadA;
|
||||||
double horizontalSpreadB;
|
float horizontalSpreadB;
|
||||||
|
|
||||||
double startEmissionRate;
|
float startEmissionRate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SplashParticleSystem(int particleCount= 1000);
|
SplashParticleSystem(int particleCount= 1000);
|
||||||
|
@ -591,11 +591,11 @@ public:
|
||||||
|
|
||||||
virtual void initParticleSystem();
|
virtual void initParticleSystem();
|
||||||
|
|
||||||
void setEmissionRateFade(double emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
void setEmissionRateFade(float emissionRateFade) {this->emissionRateFade= emissionRateFade;}
|
||||||
void setVerticalSpreadA(double verticalSpreadA) {this->verticalSpreadA= verticalSpreadA;}
|
void setVerticalSpreadA(float verticalSpreadA) {this->verticalSpreadA= verticalSpreadA;}
|
||||||
void setVerticalSpreadB(double verticalSpreadB) {this->verticalSpreadB= verticalSpreadB;}
|
void setVerticalSpreadB(float verticalSpreadB) {this->verticalSpreadB= verticalSpreadB;}
|
||||||
void setHorizontalSpreadA(double horizontalSpreadA) {this->horizontalSpreadA= horizontalSpreadA;}
|
void setHorizontalSpreadA(float horizontalSpreadA) {this->horizontalSpreadA= horizontalSpreadA;}
|
||||||
void setHorizontalSpreadB(double horizontalSpreadB) {this->horizontalSpreadB= horizontalSpreadB;}
|
void setHorizontalSpreadB(float horizontalSpreadB) {this->horizontalSpreadB= horizontalSpreadB;}
|
||||||
|
|
||||||
virtual void saveGame(XmlNode *rootNode);
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
virtual void loadGame(const XmlNode *rootNode);
|
virtual void loadGame(const XmlNode *rootNode);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -519,7 +519,7 @@ void Properties::setBool(const string &key, bool value){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Properties::setFloat(const string &key, float value){
|
void Properties::setFloat(const string &key, float value){
|
||||||
setString(key, floatToStr(value,10));
|
setString(key, floatToStr(value,6));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Properties::setString(const string &key, const string &value){
|
void Properties::setString(const string &key, const string &value){
|
||||||
|
|
|
@ -81,7 +81,7 @@ int RandomGen::randRange(int min, int max,string lastCaller) {
|
||||||
|
|
||||||
int diff= max-min;
|
int diff= max-min;
|
||||||
double numerator = static_cast<double>(diff + 1) * static_cast<double>(RandomGen::rand(lastCaller));
|
double numerator = static_cast<double>(diff + 1) * static_cast<double>(RandomGen::rand(lastCaller));
|
||||||
int res= min + static_cast<int>(truncateDecimal<double>(numerator / static_cast<double>(m),10));
|
int res= min + static_cast<int>(truncateDecimal<double>(numerator / static_cast<double>(m),6));
|
||||||
if(res < min || res > max) {
|
if(res < min || res > max) {
|
||||||
char szBuf[8096]="";
|
char szBuf[8096]="";
|
||||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] res < min || res > max, min = %d, max = %d, res = %d",__FILE__,__FUNCTION__,__LINE__,min,max,res);
|
snprintf(szBuf,8096,"In [%s::%s Line: %d] res < min || res > max, min = %d, max = %d, res = %d",__FILE__,__FUNCTION__,__LINE__,min,max,res);
|
||||||
|
@ -102,7 +102,7 @@ double RandomGen::randRange(double min, double max,string lastCaller) {
|
||||||
|
|
||||||
double rand01 = static_cast<double>(RandomGen::rand(lastCaller)) / (m-1);
|
double rand01 = static_cast<double>(RandomGen::rand(lastCaller)) / (m-1);
|
||||||
double res= min + (max - min) * rand01;
|
double res= min + (max - min) * rand01;
|
||||||
res = truncateDecimal<double>(res,10);
|
res = truncateDecimal<double>(res,6);
|
||||||
|
|
||||||
if(res < min || res > max) {
|
if(res < min || res > max) {
|
||||||
char szBuf[8096]="";
|
char szBuf[8096]="";
|
||||||
|
|
Loading…
Reference in New Issue