- rollback last commit
This commit is contained in:
parent
7349a1f126
commit
37c2ace11a
|
@ -1340,12 +1340,11 @@ 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));
|
||||||
Vec3d factionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
ups->setFactionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
||||||
ups->setFactionColor(factionColor);
|
|
||||||
unitParticleSystems.push_back(ups);
|
unitParticleSystems.push_back(ups);
|
||||||
renderer->manageParticleSystem(ups);
|
renderer->manageParticleSystem(ups);
|
||||||
|
|
||||||
|
@ -1458,9 +1457,9 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
//ps->setPos(vec);
|
//ps->setPos(vec);
|
||||||
|
|
||||||
Vec3f vec2 = Vec3f(size * 2.f, height * 2.f, height * 2.f);
|
Vec3f vec2 = Vec3f(size * 2.f, height * 2.f, height * 2.f);
|
||||||
ps->setPath(Vec3d(vec), Vec3d(vec2));
|
ps->setPath(vec, vec2);
|
||||||
}
|
}
|
||||||
ps->setFactionColor(Vec3d(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0)));
|
ps->setFactionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
||||||
|
|
||||||
projectileParticleSystems.push_back(ps);
|
projectileParticleSystems.push_back(ps);
|
||||||
|
|
||||||
|
@ -1569,7 +1568,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||||
//Vec3f vec2 = Vec3f(size * 2.f, height * 2.f, height * 2.f); // <------- removed relative projectile
|
//Vec3f vec2 = Vec3f(size * 2.f, height * 2.f, height * 2.f); // <------- removed relative projectile
|
||||||
//ps->setPath(vec, vec2); // <------- removed relative projectile
|
//ps->setPath(vec, vec2); // <------- removed relative projectile
|
||||||
}
|
}
|
||||||
ps->setFactionColor(Vec3d(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0)));
|
ps->setFactionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
||||||
|
|
||||||
splashParticleSystems.push_back(ps);
|
splashParticleSystems.push_back(ps);
|
||||||
|
|
||||||
|
|
|
@ -1416,14 +1416,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);
|
||||||
}
|
}
|
||||||
|
@ -2141,9 +2141,9 @@ 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;
|
float angle=rotation+180;
|
||||||
|
|
||||||
|
|
||||||
//#ifdef USE_STREFLOP
|
//#ifdef USE_STREFLOP
|
||||||
|
@ -2158,7 +2158,7 @@ void Game::update() {
|
||||||
|
|
||||||
c.y=c.y+currentCameraFollowUnit->getType()->getHeight()/2.f+2.0f;
|
c.y=c.y+currentCameraFollowUnit->getType()->getHeight()/2.f+2.0f;
|
||||||
|
|
||||||
getGameCameraPtr()->setPos(Vec3f(c));
|
getGameCameraPtr()->setPos(c);
|
||||||
|
|
||||||
rotation=(540-rotation)%360;
|
rotation=(540-rotation)%360;
|
||||||
getGameCameraPtr()->rotateToVH(18.0f,rotation);
|
getGameCameraPtr()->rotateToVH(18.0f,rotation);
|
||||||
|
@ -2198,7 +2198,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);
|
||||||
|
@ -4448,7 +4448,7 @@ void Game::startCameraFollowUnit() {
|
||||||
if(currentUnit != NULL) {
|
if(currentUnit != NULL) {
|
||||||
currentCameraFollowUnit = currentUnit;
|
currentCameraFollowUnit = currentUnit;
|
||||||
getGameCameraPtr()->setState(GameCamera::sUnit);
|
getGameCameraPtr()->setState(GameCamera::sUnit);
|
||||||
getGameCameraPtr()->setPos(Vec3f(currentCameraFollowUnit->getCurrVector()));
|
getGameCameraPtr()->setPos(currentCameraFollowUnit->getCurrVector());
|
||||||
|
|
||||||
int rotation=currentCameraFollowUnit->getRotation();
|
int rotation=currentCameraFollowUnit->getRotation();
|
||||||
getGameCameraPtr()->stop();
|
getGameCameraPtr()->stop();
|
||||||
|
|
|
@ -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,16), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("modelCycle",floatToStr(modelCycle,16), 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,16), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("size",floatToStr(size,16), mapTagReplacements);
|
||||||
// float sizeNoEnergy;
|
// float sizeNoEnergy;
|
||||||
particleSystemTypeNode->addAttribute("sizeNoEnergy",doubleToStr(sizeNoEnergy,16), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,16), mapTagReplacements);
|
||||||
// float speed;
|
// float speed;
|
||||||
particleSystemTypeNode->addAttribute("speed",doubleToStr(speed,16), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("speed",floatToStr(speed,16), mapTagReplacements);
|
||||||
// float gravity;
|
// float gravity;
|
||||||
particleSystemTypeNode->addAttribute("gravity",doubleToStr(gravity,16), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("gravity",floatToStr(gravity,16), mapTagReplacements);
|
||||||
// float emissionRate;
|
// float emissionRate;
|
||||||
particleSystemTypeNode->addAttribute("emissionRate",doubleToStr(emissionRate,16), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("emissionRate",floatToStr(emissionRate,16), mapTagReplacements);
|
||||||
// int energyMax;
|
// int energyMax;
|
||||||
particleSystemTypeNode->addAttribute("energyMax",intToStr(energyMax), mapTagReplacements);
|
particleSystemTypeNode->addAttribute("energyMax",intToStr(energyMax), mapTagReplacements);
|
||||||
// int energyVar;
|
// int energyVar;
|
||||||
|
@ -408,18 +408,18 @@ void ParticleSystemTypeProjectile::load(const XmlNode* particleFileNode, const s
|
||||||
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList,parentLoader, techtreePath);
|
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList,parentLoader, techtreePath);
|
||||||
|
|
||||||
//trajectory values
|
//trajectory values
|
||||||
const XmlNode *trajectoryNode= particleSystemNode->getChild("trajectory");
|
const XmlNode *tajectoryNode= particleSystemNode->getChild("trajectory");
|
||||||
trajectory= trajectoryNode->getAttribute("type")->getRestrictedValue();
|
trajectory= tajectoryNode->getAttribute("type")->getRestrictedValue();
|
||||||
|
|
||||||
//trajectory speed
|
//trajectory speed
|
||||||
const XmlNode *trajectorySpeedNode= trajectoryNode->getChild("speed");
|
const XmlNode *tajectorySpeedNode= tajectoryNode->getChild("speed");
|
||||||
trajectorySpeed= trajectorySpeedNode->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"){
|
||||||
//trajectory scale
|
//trajectory scale
|
||||||
const XmlNode *trajectoryScaleNode= trajectoryNode->getChild("scale");
|
const XmlNode *tajectoryScaleNode= tajectoryNode->getChild("scale");
|
||||||
trajectoryScale= trajectoryScaleNode->getAttribute("value")->getFloatValue();
|
trajectoryScale= tajectoryScaleNode->getAttribute("value")->getFloatValue();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
trajectoryScale= 1.0f;
|
trajectoryScale= 1.0f;
|
||||||
|
@ -427,8 +427,8 @@ void ParticleSystemTypeProjectile::load(const XmlNode* particleFileNode, const s
|
||||||
|
|
||||||
if(trajectory=="spiral"){
|
if(trajectory=="spiral"){
|
||||||
//trajectory frequency
|
//trajectory frequency
|
||||||
const XmlNode *trajectoryFrequencyNode= trajectoryNode->getChild("frequency");
|
const XmlNode *tajectoryFrequencyNode= tajectoryNode->getChild("frequency");
|
||||||
trajectoryFrequency= trajectoryFrequencyNode->getAttribute("value")->getFloatValue();
|
trajectoryFrequency= tajectoryFrequencyNode->getAttribute("value")->getFloatValue();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
trajectoryFrequency= 1.0f;
|
trajectoryFrequency= 1.0f;
|
||||||
|
@ -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,16), mapTagReplacements);
|
particleSystemTypeProjectileNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed,16), mapTagReplacements);
|
||||||
// float trajectoryScale;
|
// float trajectoryScale;
|
||||||
particleSystemTypeProjectileNode->addAttribute("trajectoryScale",doubleToStr(trajectoryScale,16), mapTagReplacements);
|
particleSystemTypeProjectileNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale,16), mapTagReplacements);
|
||||||
// float trajectoryFrequency;
|
// float trajectoryFrequency;
|
||||||
particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",doubleToStr(trajectoryFrequency,16), mapTagReplacements);
|
particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency,16), 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,16), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), mapTagReplacements);
|
||||||
// float verticalSpreadA;
|
// float verticalSpreadA;
|
||||||
particleSystemTypeSplashNode->addAttribute("verticalSpreadA",doubleToStr(verticalSpreadA,16), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA,16), mapTagReplacements);
|
||||||
// float verticalSpreadB;
|
// float verticalSpreadB;
|
||||||
particleSystemTypeSplashNode->addAttribute("verticalSpreadB",doubleToStr(verticalSpreadB,16), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB,16), mapTagReplacements);
|
||||||
// float horizontalSpreadA;
|
// float horizontalSpreadA;
|
||||||
particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",doubleToStr(horizontalSpreadA,16), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA,16), mapTagReplacements);
|
||||||
// float horizontalSpreadB;
|
// float horizontalSpreadB;
|
||||||
particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",doubleToStr(horizontalSpreadB,16), mapTagReplacements);
|
particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB,16), 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;
|
||||||
Vec4d color;
|
Vec4f color;
|
||||||
Vec4d colorNoEnergy;
|
Vec4f colorNoEnergy;
|
||||||
double size;
|
float size;
|
||||||
double sizeNoEnergy;
|
float sizeNoEnergy;
|
||||||
double speed;
|
float speed;
|
||||||
double gravity;
|
float gravity;
|
||||||
double emissionRate;
|
float 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,11 +1054,11 @@ 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());
|
||||||
|
|
||||||
Vec4f pos= Vec4f(unit->getCurrVector().x,unit->getCurrVector().y,unit->getCurrVector().z,0);
|
Vec4f pos= Vec4f(unit->getCurrVector());
|
||||||
pos.y+=4.f;
|
pos.y+=4.f;
|
||||||
|
|
||||||
GLenum lightEnum= GL_LIGHT0 + lightCount;
|
GLenum lightEnum= GL_LIGHT0 + lightCount;
|
||||||
|
@ -4636,7 +4636,7 @@ void Renderer::renderObjects(const int renderFps) {
|
||||||
|
|
||||||
Model *objModel= o->getModelPtr();
|
Model *objModel= o->getModelPtr();
|
||||||
//objModel->updateInterpolationData(o->getAnimProgress(), true);
|
//objModel->updateInterpolationData(o->getAnimProgress(), true);
|
||||||
const Vec3f &v= Vec3f(o->getConstPos());
|
const Vec3f &v= o->getConstPos();
|
||||||
|
|
||||||
if(modelRenderStarted == false) {
|
if(modelRenderStarted == false) {
|
||||||
modelRenderStarted = true;
|
modelRenderStarted = true;
|
||||||
|
@ -4878,7 +4878,7 @@ void Renderer::renderTeamColorCircle(){
|
||||||
for(int visibleUnitIndex = 0;
|
for(int visibleUnitIndex = 0;
|
||||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||||
Vec3f currVec= Vec3f(unit->getCurrVectorFlat());
|
Vec3f currVec= unit->getCurrVectorFlat();
|
||||||
Vec3f color=unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0);
|
Vec3f color=unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0);
|
||||||
glColor4f(color.x, color.y, color.z, 0.7f);
|
glColor4f(color.x, color.y, color.z, 0.7f);
|
||||||
renderSelectionCircle(currVec, unit->getType()->getSize(), 0.8f, 0.05f);
|
renderSelectionCircle(currVec, unit->getType()->getSize(), 0.8f, 0.05f);
|
||||||
|
@ -4933,7 +4933,7 @@ void Renderer::renderSpecialHighlightUnits(std::map<int,HighlightSpecialUnitInfo
|
||||||
|
|
||||||
glColor4f(color.x, color.y, color.z, alpha);
|
glColor4f(color.x, color.y, color.z, alpha);
|
||||||
|
|
||||||
Vec3f currVec= Vec3f(unit->getCurrVectorFlat());
|
Vec3f currVec= unit->getCurrVectorFlat();
|
||||||
renderSelectionCircle(currVec, unit->getType()->getSize(), radius, thickness);
|
renderSelectionCircle(currVec, unit->getType()->getSize(), radius, thickness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4957,7 +4957,7 @@ void Renderer::renderTeamColorPlane(){
|
||||||
for(int visibleUnitIndex = 0;
|
for(int visibleUnitIndex = 0;
|
||||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){
|
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){
|
||||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||||
Vec3f currVec= Vec3f(unit->getCurrVectorFlat());
|
Vec3f currVec= unit->getCurrVectorFlat();
|
||||||
renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(),
|
renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(),
|
||||||
unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0),texture);
|
unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0),texture);
|
||||||
}
|
}
|
||||||
|
@ -5074,7 +5074,7 @@ void Renderer::renderUnits(const int renderFps) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
//translate
|
//translate
|
||||||
Vec3f currVec= Vec3f(unit->getCurrVectorFlat());
|
Vec3f currVec= unit->getCurrVectorFlat();
|
||||||
glTranslatef(currVec.x, currVec.y, currVec.z);
|
glTranslatef(currVec.x, currVec.y, currVec.z);
|
||||||
|
|
||||||
//rotate
|
//rotate
|
||||||
|
@ -5245,7 +5245,7 @@ void Renderer::renderMorphEffects(){
|
||||||
initialized=true;
|
initialized=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f currVec= Vec3f(unit->getCurrVectorFlat());
|
Vec3f currVec= unit->getCurrVectorFlat();
|
||||||
currVec=Vec3f(currVec.x,currVec.y+0.3f,currVec.z);
|
currVec=Vec3f(currVec.x,currVec.y+0.3f,currVec.z);
|
||||||
if(mType->getField() == fAir && unit->getType()->getField()== fLand) {
|
if(mType->getField() == fAir && unit->getType()->getField()== fLand) {
|
||||||
currVec=Vec3f(currVec.x,currVec.y+game->getWorld()->getTileset()->getAirHeight(),currVec.z);
|
currVec=Vec3f(currVec.x,currVec.y+game->getWorld()->getTileset()->getAirHeight(),currVec.z);
|
||||||
|
@ -5299,7 +5299,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
const Unit *unit= selection->getUnit(i);
|
const Unit *unit= selection->getUnit(i);
|
||||||
if(unit != NULL) {
|
if(unit != NULL) {
|
||||||
//translate
|
//translate
|
||||||
Vec3f currVec= Vec3f(unit->getCurrVectorFlat());
|
Vec3f currVec= unit->getCurrVectorFlat();
|
||||||
currVec.y+= 0.3f;
|
currVec.y+= 0.3f;
|
||||||
|
|
||||||
//selection circle
|
//selection circle
|
||||||
|
@ -5335,7 +5335,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
if(i == 0) {
|
if(i == 0) {
|
||||||
lastPosValue = curPosValue;
|
lastPosValue = curPosValue;
|
||||||
}
|
}
|
||||||
Vec3f currVec2 = Vec3f(unit->getVectorFlat(lastPosValue,curPosValue));
|
Vec3f currVec2 = unit->getVectorFlat(lastPosValue,curPosValue);
|
||||||
currVec2.y+= 0.3f;
|
currVec2.y+= 0.3f;
|
||||||
renderSelectionCircle(currVec2, 1, selectionCircleRadius);
|
renderSelectionCircle(currVec2, 1, selectionCircleRadius);
|
||||||
//renderSelectionCircle(currVec2, unit->getType()->getSize(), selectionCircleRadius);
|
//renderSelectionCircle(currVec2, unit->getType()->getSize(), selectionCircleRadius);
|
||||||
|
@ -5367,7 +5367,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
int findUnitId = effect.currentAttackBoostUnits[i];
|
int findUnitId = effect.currentAttackBoostUnits[i];
|
||||||
Unit *affectedUnit = game->getWorld()->findUnitById(findUnitId);
|
Unit *affectedUnit = game->getWorld()->findUnitById(findUnitId);
|
||||||
if(affectedUnit != NULL) {
|
if(affectedUnit != NULL) {
|
||||||
Vec3f currVecBoost = Vec3f(affectedUnit->getCurrVectorFlat());
|
Vec3f currVecBoost = affectedUnit->getCurrVectorFlat();
|
||||||
currVecBoost.y += 0.3f;
|
currVecBoost.y += 0.3f;
|
||||||
|
|
||||||
renderSelectionCircle(currVecBoost, affectedUnit->getType()->getSize(), 1.f);
|
renderSelectionCircle(currVecBoost, affectedUnit->getType()->getSize(), 1.f);
|
||||||
|
@ -5383,7 +5383,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
int defaultValue= r->getType()->getDefResPerPatch();
|
int defaultValue= r->getType()->getDefResPerPatch();
|
||||||
float colorValue=static_cast<float>(r->getAmount())/static_cast<float>(defaultValue);
|
float colorValue=static_cast<float>(r->getAmount())/static_cast<float>(defaultValue);
|
||||||
glColor4f(0.1f, 0.1f , colorValue, 0.4f);
|
glColor4f(0.1f, 0.1f , colorValue, 0.4f);
|
||||||
renderSelectionCircle(Vec3f(selectedResourceObject->getPos()),2, selectionCircleRadius);
|
renderSelectionCircle(selectedResourceObject->getPos(),2, selectionCircleRadius);
|
||||||
}
|
}
|
||||||
//target arrow
|
//target arrow
|
||||||
if(selection->getCount() == 1) {
|
if(selection->getCount() == 1) {
|
||||||
|
@ -5413,7 +5413,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
Vec3f arrowTarget;
|
Vec3f arrowTarget;
|
||||||
Command *c= unit->getCurrCommand();
|
Command *c= unit->getCurrCommand();
|
||||||
if(c->getUnit() != NULL) {
|
if(c->getUnit() != NULL) {
|
||||||
arrowTarget= Vec3f(c->getUnit()->getCurrVectorFlat());
|
arrowTarget= c->getUnit()->getCurrVectorFlat();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Vec2i pos= c->getPos();
|
Vec2i pos= c->getPos();
|
||||||
|
@ -5422,7 +5422,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderArrow(Vec3f(unit->getCurrVectorFlat()), arrowTarget, arrowColor, 0.3f);
|
renderArrow(unit->getCurrVectorFlat(), arrowTarget, arrowColor, 0.3f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5432,7 +5432,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
map->clampPos(pos);
|
map->clampPos(pos);
|
||||||
|
|
||||||
Vec3f arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
Vec3f arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
||||||
renderArrow(Vec3f(unit->getCurrVectorFlat()), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.3f);
|
renderArrow(unit->getCurrVectorFlat(), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.3f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5450,7 +5450,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
glColor4f(1.f, 0.f, 0.f, highlight);
|
glColor4f(1.f, 0.f, 0.f, highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f v= Vec3f(unit->getCurrVectorFlat());
|
Vec3f v= unit->getCurrVectorFlat();
|
||||||
v.y+= 0.3f;
|
v.y+= 0.3f;
|
||||||
renderSelectionCircle(v, unit->getType()->getSize(), 0.5f+0.4f*highlight );
|
renderSelectionCircle(v, unit->getType()->getSize(), 0.5f+0.4f*highlight );
|
||||||
}
|
}
|
||||||
|
@ -5481,7 +5481,7 @@ void Renderer::renderSelectionEffects() {
|
||||||
if(object->isHighlighted()) {
|
if(object->isHighlighted()) {
|
||||||
float highlight= object->getHightlight();
|
float highlight= object->getHightlight();
|
||||||
glColor4f(0.1f, 0.1f , 1.0f, highlight);
|
glColor4f(0.1f, 0.1f , 1.0f, highlight);
|
||||||
Vec3f v= Vec3f(object->getPos());
|
Vec3f v= object->getPos();
|
||||||
v.y+= 0.3f;
|
v.y+= 0.3f;
|
||||||
renderSelectionCircle(v, 2, 0.4f+0.4f*highlight );
|
renderSelectionCircle(v, 2, 0.4f+0.4f*highlight );
|
||||||
}
|
}
|
||||||
|
@ -6714,7 +6714,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) {
|
||||||
|
@ -7486,7 +7486,7 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
//translate
|
//translate
|
||||||
Vec3f currVec= Vec3f(unit->getCurrVectorFlat());
|
Vec3f currVec= unit->getCurrVectorFlat();
|
||||||
glTranslatef(currVec.x, currVec.y, currVec.z);
|
glTranslatef(currVec.x, currVec.y, currVec.z);
|
||||||
|
|
||||||
//rotate
|
//rotate
|
||||||
|
@ -7589,7 +7589,7 @@ vector<Object *> Renderer::renderObjectsFast(bool renderingShadows, bool resour
|
||||||
//objModel->updateInterpolationData(o->getAnimProgress(), true);
|
//objModel->updateInterpolationData(o->getAnimProgress(), true);
|
||||||
|
|
||||||
//}
|
//}
|
||||||
const Vec3f &v= Vec3f(o->getConstPos());
|
const Vec3f &v= o->getConstPos();
|
||||||
|
|
||||||
if(colorPickingSelection == false) {
|
if(colorPickingSelection == false) {
|
||||||
glPushName(OBJECT_SELECT_OFFSET+visibleIndex);
|
glPushName(OBJECT_SELECT_OFFSET+visibleIndex);
|
||||||
|
|
|
@ -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,16), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("angle",floatToStr(angle,16), mapTagReplacements);
|
||||||
// float radius;
|
// float radius;
|
||||||
unitParticleSystemTypeNode->addAttribute("radius",doubleToStr(radius,16), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("radius",floatToStr(radius,16), mapTagReplacements);
|
||||||
// float minRadius;
|
// float minRadius;
|
||||||
unitParticleSystemTypeNode->addAttribute("minRadius",doubleToStr(minRadius,16), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("minRadius",floatToStr(minRadius,16), mapTagReplacements);
|
||||||
// float emissionRateFade;
|
// float emissionRateFade;
|
||||||
unitParticleSystemTypeNode->addAttribute("emissionRateFade",doubleToStr(emissionRateFade,16), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), 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,16), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("startTime",floatToStr(startTime,16), mapTagReplacements);
|
||||||
// float endTime;
|
// float endTime;
|
||||||
unitParticleSystemTypeNode->addAttribute("endTime",doubleToStr(endTime,16), mapTagReplacements);
|
unitParticleSystemTypeNode->addAttribute("endTime",floatToStr(endTime,16), 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); }
|
||||||
|
|
|
@ -305,7 +305,7 @@ void Gui::mouseUpLeftGraphics(int x, int y) {
|
||||||
if(selection.isCommandable() && random.randRange(0, 1)==0){
|
if(selection.isCommandable() && random.randRange(0, 1)==0){
|
||||||
SoundRenderer::getInstance().playFx(
|
SoundRenderer::getInstance().playFx(
|
||||||
selection.getFrontUnit()->getType()->getSelectionSound(),
|
selection.getFrontUnit()->getType()->getSelectionSound(),
|
||||||
Vec3f(selection.getFrontUnit()->getCurrVector()),
|
selection.getFrontUnit()->getCurrVector(),
|
||||||
gameCamera->getPos());
|
gameCamera->getPos());
|
||||||
}
|
}
|
||||||
selectionQuad.disable();
|
selectionQuad.disable();
|
||||||
|
@ -477,7 +477,7 @@ void Gui::giveDefaultOrders(int x, int y,const Unit *targetUnit, bool paintMouse
|
||||||
if(random.randRange(0, 1)==0){
|
if(random.randRange(0, 1)==0){
|
||||||
SoundRenderer::getInstance().playFx(
|
SoundRenderer::getInstance().playFx(
|
||||||
selection.getFrontUnit()->getType()->getCommandSound(),
|
selection.getFrontUnit()->getType()->getCommandSound(),
|
||||||
Vec3f(selection.getFrontUnit()->getCurrVector()),
|
selection.getFrontUnit()->getCurrVector(),
|
||||||
gameCamera->getPos());
|
gameCamera->getPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ void Gui::giveTwoClickOrders(int x, int y , bool prepared) {
|
||||||
if(random.randRange(0, 1) == 0) {
|
if(random.randRange(0, 1) == 0) {
|
||||||
SoundRenderer::getInstance().playFx(
|
SoundRenderer::getInstance().playFx(
|
||||||
selection.getFrontUnit()->getType()->getCommandSound(),
|
selection.getFrontUnit()->getType()->getCommandSound(),
|
||||||
Vec3f(selection.getFrontUnit()->getCurrVector()),
|
selection.getFrontUnit()->getCurrVector(),
|
||||||
gameCamera->getPos());
|
gameCamera->getPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
Vec3f refPos= Vec3f(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,8 +160,8 @@ 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(Vec4d(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);
|
||||||
|
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -111,7 +111,7 @@ void Object::initParticlesFromTypes(const ModelParticleSystemTypes *particleType
|
||||||
(*it)->setValues(ups);
|
(*it)->setValues(ups);
|
||||||
ups->setPos(this->pos);
|
ups->setPos(this->pos);
|
||||||
ups->setRotation(this->rotation);
|
ups->setRotation(this->rotation);
|
||||||
ups->setFactionColor(Vec3d(0, 0, 0));
|
ups->setFactionColor(Vec3f(0, 0, 0));
|
||||||
ups->setVisible(false);
|
ups->setVisible(false);
|
||||||
this->unitParticleSystems.push_back(ups);
|
this->unitParticleSystems.push_back(ups);
|
||||||
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
||||||
|
@ -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);
|
||||||
|
|
||||||
// printf("A [%f] B [%f] C [%f] D [%f] E [%f] F [%f]\n",
|
// printf("A [%f] B [%f] C [%f] D [%f] E [%f] F [%f]\n",
|
||||||
// ((float)objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor),
|
// ((float)objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor),
|
||||||
|
@ -265,7 +265,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,16), mapTagReplacements);
|
objectNode->addAttribute("rotation",floatToStr(rotation,16), mapTagReplacements);
|
||||||
// int variation;
|
// int variation;
|
||||||
objectNode->addAttribute("variation",intToStr(variation), mapTagReplacements);
|
objectNode->addAttribute("variation",intToStr(variation), mapTagReplacements);
|
||||||
// int lastRenderFrame;
|
// int lastRenderFrame;
|
||||||
|
@ -297,7 +297,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;
|
||||||
double 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,21 +80,21 @@ 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;
|
||||||
bool isAnimated() const {return animated;}
|
bool isAnimated() const {return animated;}
|
||||||
|
|
||||||
double getHightlight() const {return highlight;}
|
float getHightlight() const {return highlight;}
|
||||||
bool isHighlighted() const {return highlight>0.f;}
|
bool isHighlighted() const {return highlight>0.f;}
|
||||||
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;
|
||||||
|
@ -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 {
|
||||||
|
@ -754,7 +754,7 @@ void Unit::calculateXZRotation(){
|
||||||
//if(currSkill->getClass()==scMove)
|
//if(currSkill->getClass()==scMove)
|
||||||
if(lastPos != pos){ // targetPosCalc ( maybe also sometimes needed if no move ? terrain flatting... )
|
if(lastPos != pos){ // targetPosCalc ( maybe also sometimes needed if no move ? terrain flatting... )
|
||||||
SurfaceCell* sc= map->getSurfaceCell(Map::toSurfCoords(pos));
|
SurfaceCell* sc= map->getSurfaceCell(Map::toSurfCoords(pos));
|
||||||
const Vec3d normal= Vec3d(sc->getNormal());
|
const Vec3f normal= sc->getNormal();
|
||||||
|
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
targetRotationZ= radToDeg(streflop::atan2(static_cast<streflop::Simple>(abs(normal.x)), static_cast<streflop::Simple>(abs(normal.y))));
|
targetRotationZ= radToDeg(streflop::atan2(static_cast<streflop::Simple>(abs(normal.x)), static_cast<streflop::Simple>(abs(normal.y))));
|
||||||
|
@ -1124,7 +1124,7 @@ void Unit::setCurrSkill(const SkillType *currSkill) {
|
||||||
(*it)->setValues(ups);
|
(*it)->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
ups->setFactionColor(Vec3d(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)));
|
ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
unitParticleSystems.push_back(ups);
|
unitParticleSystems.push_back(ups);
|
||||||
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
||||||
|
@ -1267,7 +1267,7 @@ 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
|
||||||
|
@ -1411,17 +1411,17 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getCurrVectorFlat() + Vec3d(0.f, truncateDecimal<double>(type->getHeight()/2.f), 0.f);
|
return getCurrVectorFlat() + Vec3f(0.f, truncateDecimal<float>(type->getHeight()/2.f), 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d Unit::getCurrVectorFlat() const{
|
Vec3f Unit::getCurrVectorFlat() const{
|
||||||
return getVectorFlat(lastPos, pos);
|
return getVectorFlat(lastPos, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1431,8 +1431,8 @@ double Unit::getProgressAsFloat() const {
|
||||||
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);
|
double y1= computeHeight(lastPosValue);
|
||||||
double y2= computeHeight(curPosValue);
|
double y2= computeHeight(curPosValue);
|
||||||
|
@ -2145,9 +2145,9 @@ void Unit::updateAttackBoostProgress(const Game* game) {
|
||||||
if (getFaction()->getTexture()) {
|
if (getFaction()->getTexture()) {
|
||||||
currentAttackBoostOriginatorEffect.
|
currentAttackBoostOriginatorEffect.
|
||||||
currentAppliedEffect->ups->setFactionColor(
|
currentAppliedEffect->ups->setFactionColor(
|
||||||
Vec3d(getFaction()->getTexture()->
|
getFaction()->getTexture()->
|
||||||
getPixmapConst()->getPixel3f(
|
getPixmapConst()->getPixel3f(
|
||||||
0, 0)));
|
0, 0));
|
||||||
}
|
}
|
||||||
Renderer::getInstance().manageParticleSystem(
|
Renderer::getInstance().manageParticleSystem(
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,
|
||||||
|
@ -2252,8 +2252,8 @@ void Unit::updateAttackBoostProgress(const Game* game) {
|
||||||
getCurrVector());
|
getCurrVector());
|
||||||
if (getFaction()->getTexture()) {
|
if (getFaction()->getTexture()) {
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setFactionColor(
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setFactionColor(
|
||||||
Vec3d(getFaction()->getTexture()->getPixmapConst()->getPixel3f(
|
getFaction()->getTexture()->getPixmapConst()->getPixel3f(
|
||||||
0, 0)));
|
0, 0));
|
||||||
}
|
}
|
||||||
Renderer::getInstance().manageParticleSystem(
|
Renderer::getInstance().manageParticleSystem(
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,
|
currentAttackBoostOriginatorEffect.currentAppliedEffect->ups,
|
||||||
|
@ -2503,7 +2503,7 @@ void Unit::updateTimedParticles() {
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
ups->setFactionColor(Vec3d(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)));
|
ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
unitParticleSystems.push_back(ups);
|
unitParticleSystems.push_back(ups);
|
||||||
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
Renderer::getInstance().manageParticleSystem(ups, rsGame);
|
||||||
|
@ -2640,7 +2640,7 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||||
effect->upst->setValues(effect->ups);
|
effect->upst->setValues(effect->ups);
|
||||||
effect->ups->setPos(getCurrVector());
|
effect->ups->setPos(getCurrVector());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
effect->ups->setFactionColor(Vec3d(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)));
|
effect->ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
Renderer::getInstance().manageParticleSystem(effect->ups, rsGame);
|
Renderer::getInstance().manageParticleSystem(effect->ups, rsGame);
|
||||||
}
|
}
|
||||||
|
@ -3376,7 +3376,7 @@ 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
|
||||||
|
@ -3767,7 +3767,7 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
ups->setFactionColor(Vec3d(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)));
|
ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
damageParticleSystems.push_back(ups);
|
damageParticleSystems.push_back(ups);
|
||||||
damageParticleSystemsInUse[i] = ups;
|
damageParticleSystemsInUse[i] = ups;
|
||||||
|
@ -3792,7 +3792,7 @@ void Unit::startDamageParticles() {
|
||||||
pst->setValues(ups);
|
pst->setValues(ups);
|
||||||
ups->setPos(getCurrVector());
|
ups->setPos(getCurrVector());
|
||||||
if(getFaction()->getTexture()) {
|
if(getFaction()->getTexture()) {
|
||||||
ups->setFactionColor(Vec3d(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)));
|
ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
damageParticleSystems.push_back(ups);
|
damageParticleSystems.push_back(ups);
|
||||||
damageParticleSystemsInUse[i] = ups;
|
damageParticleSystemsInUse[i] = ups;
|
||||||
|
@ -3819,12 +3819,12 @@ void Unit::startDamageParticles() {
|
||||||
// smoke
|
// smoke
|
||||||
UnitParticleSystem *ups= new UnitParticleSystem(400);
|
UnitParticleSystem *ups= new UnitParticleSystem(400);
|
||||||
ups->setParticleOwner(this);
|
ups->setParticleOwner(this);
|
||||||
ups->setColorNoEnergy(Vec4d(0.0f, 0.0f, 0.0f, 0.13f));
|
ups->setColorNoEnergy(Vec4f(0.0f, 0.0f, 0.0f, 0.13f));
|
||||||
ups->setColor(Vec4d(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());
|
||||||
|
@ -3845,7 +3845,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__);
|
||||||
}
|
}
|
||||||
|
@ -4687,7 +4687,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());
|
||||||
//
|
//
|
||||||
|
@ -4905,7 +4905,28 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
||||||
//ups->setTexture(CoreData::getInstance().getFireTexture());
|
//ups->setTexture(CoreData::getInstance().getFireTexture());
|
||||||
result->smokeParticleSystems.push_back(ups);
|
result->smokeParticleSystems.push_back(ups);
|
||||||
|
|
||||||
|
// UnitParticleSystem *ups= new UnitParticleSystem(400);
|
||||||
|
// ups->setColorNoEnergy(Vec4f(0.0f, 0.0f, 0.0f, 0.13f));
|
||||||
|
// ups->setColor(Vec4f(0.115f, 0.115f, 0.115f, 0.22f));
|
||||||
|
// ups->setPos(result->getCurrVector());
|
||||||
|
// ups->setBlendMode(ups->strToBlendMode("black"));
|
||||||
|
// ups->setOffset(Vec3f(0,2,0));
|
||||||
|
// ups->setDirection(Vec3f(0,1,-0.2f));
|
||||||
|
// ups->setRadius(result->type->getSize()/3.f);
|
||||||
|
// ups->setShape(Shared::Graphics::UnitParticleSystem::sLinear);
|
||||||
|
// ups->setTexture(CoreData::getInstance().getFireTexture());
|
||||||
|
// const Game *game = Renderer::getInstance().getGame();
|
||||||
|
// ups->setSpeed(2.0f / game->getWorld()->getUpdateFps(result->getFactionIndex()));
|
||||||
|
// ups->setGravity(0.0004f);
|
||||||
|
// ups->setEmissionRate(1);
|
||||||
|
// ups->setMaxParticleEnergy(150);
|
||||||
|
// ups->setSizeNoEnergy(result->type->getSize()*0.6f);
|
||||||
|
// ups->setParticleSize(result->type->getSize()*0.8f);
|
||||||
|
// result->smokeParticleSystems.push_back(ups);
|
||||||
|
|
||||||
|
//Renderer::getInstance().manageParticleSystem(result->fire, rsGame);
|
||||||
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
||||||
|
|
||||||
//printf("Loading smoke particles:\n[%s]\n",ups->toString().c_str());
|
//printf("Loading smoke particles:\n[%s]\n",ups->toString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ 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
|
double lastRotation; //in degrees
|
||||||
|
@ -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;}
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -140,7 +140,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(destUnitMightApply == true) {
|
if(destUnitMightApply == true) {
|
||||||
double distance = source->getCenteredPos().dist(dest->getCenteredPos());
|
float distance = source->getCenteredPos().dist(dest->getCenteredPos());
|
||||||
if(distance <= radius) {
|
if(distance <= radius) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,7 @@ const AnimationAttributes SkillType::getAnimationAttribute(int index) const {
|
||||||
return animationAttributes[index];
|
return animationAttributes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
Model *SkillType::getAnimation(double animProgress, const Unit *unit,
|
Model *SkillType::getAnimation(float animProgress, const Unit *unit,
|
||||||
int *lastAnimationIndex, int *animationRandomCycleCount) const {
|
int *lastAnimationIndex, int *animationRandomCycleCount) const {
|
||||||
int modelIndex = 0;
|
int modelIndex = 0;
|
||||||
//printf("Count [%d] animProgress = [%f] for skill [%s] animationRandomCycleCount = %d\n",animations.size(),animProgress,name.c_str(),*animationRandomCycleCount);
|
//printf("Count [%d] animProgress = [%f] for skill [%s] animationRandomCycleCount = %d\n",animations.size(),animProgress,name.c_str(),*animationRandomCycleCount);
|
||||||
|
@ -665,7 +665,7 @@ void SkillType::saveGame(XmlNode *rootNode) {
|
||||||
//
|
//
|
||||||
// SoundContainer sounds;
|
// SoundContainer sounds;
|
||||||
// float soundStartTime;
|
// float soundStartTime;
|
||||||
skillTypeNode->addAttribute("soundStartTime",doubleToStr(soundStartTime,16), mapTagReplacements);
|
skillTypeNode->addAttribute("soundStartTime",floatToStr(soundStartTime,16), 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,16), mapTagReplacements);
|
attackSkillTypeNode->addAttribute("attackStartTime",floatToStr(attackStartTime,16), 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,16), mapTagReplacements);
|
fogSkillTypeNode->addAttribute("duration",floatToStr(durationTime,16), 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;
|
||||||
|
|
||||||
|
@ -175,9 +175,9 @@ public:
|
||||||
int getHpCost() const {return hpCost;}
|
int getHpCost() const {return hpCost;}
|
||||||
int getSpeed() const {return speed;}
|
int getSpeed() const {return speed;}
|
||||||
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(float 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,
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -1641,8 +1641,8 @@ 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,
|
||||||
Vec2i(i,j));
|
j));
|
||||||
getSurfaceCell(i, j)->setObject(o);
|
getSurfaceCell(i, j)->setObject(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ void TimeFlow::update() {
|
||||||
}
|
}
|
||||||
UnitParticleSystem::isNight=false;
|
UnitParticleSystem::isNight=false;
|
||||||
}
|
}
|
||||||
UnitParticleSystem::lightColor = Vec3d(computeLightColor());
|
UnitParticleSystem::lightColor=computeLightColor();
|
||||||
|
|
||||||
if((lastTime<dawn && time>=dawn) || firstTime){
|
if((lastTime<dawn && time>=dawn) || firstTime){
|
||||||
|
|
||||||
|
|
|
@ -119,11 +119,11 @@ 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)) {
|
||||||
soundRenderer.playFx(currSkill->getSound(), Vec3f(unit->getCurrVector()), gameCamera->getPos());
|
soundRenderer.playFx(currSkill->getSound(), unit->getCurrVector(), gameCamera->getPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ bool UnitUpdater::updateUnit(Unit *unit) {
|
||||||
if(Config::getInstance().getBool("DisableWaterSounds","false") == false) {
|
if(Config::getInstance().getBool("DisableWaterSounds","false") == false) {
|
||||||
soundRenderer.playFx(
|
soundRenderer.playFx(
|
||||||
CoreData::getInstance().getWaterSound(),
|
CoreData::getInstance().getWaterSound(),
|
||||||
Vec3f(unit->getCurrVector()),
|
unit->getCurrVector(),
|
||||||
gameCamera->getPos()
|
gameCamera->getPos()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -930,7 +930,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
|
||||||
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
|
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
|
||||||
SoundRenderer::getInstance().playFx(
|
SoundRenderer::getInstance().playFx(
|
||||||
bct->getStartSound(),
|
bct->getStartSound(),
|
||||||
Vec3f(unit->getCurrVector()),
|
unit->getCurrVector(),
|
||||||
gameCamera->getPos());
|
gameCamera->getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
|
||||||
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
|
(game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) {
|
||||||
SoundRenderer::getInstance().playFx(
|
SoundRenderer::getInstance().playFx(
|
||||||
bct->getBuiltSound(),
|
bct->getBuiltSound(),
|
||||||
Vec3f(unit->getCurrVector()),
|
unit->getCurrVector(),
|
||||||
gameCamera->getPos());
|
gameCamera->getPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2295,8 +2295,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()));
|
||||||
|
@ -2313,7 +2313,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
||||||
psProj->setObserver(new ParticleDamager(unit, this, gameCamera));
|
psProj->setObserver(new ParticleDamager(unit, this, gameCamera));
|
||||||
psProj->setVisible(visible);
|
psProj->setVisible(visible);
|
||||||
if(unit->getFaction()->getTexture()) {
|
if(unit->getFaction()->getTexture()) {
|
||||||
psProj->setFactionColor(Vec3d(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)));
|
psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
renderer.manageParticleSystem(psProj, rsGame);
|
renderer.manageParticleSystem(psProj, rsGame);
|
||||||
unit->addAttackParticleSystem(psProj);
|
unit->addAttackParticleSystem(psProj);
|
||||||
|
@ -2328,7 +2328,7 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
||||||
psSplash->setPos(endPos);
|
psSplash->setPos(endPos);
|
||||||
psSplash->setVisible(visible);
|
psSplash->setVisible(visible);
|
||||||
if(unit->getFaction()->getTexture()) {
|
if(unit->getFaction()->getTexture()) {
|
||||||
psSplash->setFactionColor(Vec3d(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)));
|
psSplash->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0));
|
||||||
}
|
}
|
||||||
renderer.manageParticleSystem(psSplash, rsGame);
|
renderer.manageParticleSystem(psSplash, rsGame);
|
||||||
if(pstProj!=NULL){
|
if(pstProj!=NULL){
|
||||||
|
@ -2489,7 +2489,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,
|
||||||
|
@ -2501,9 +2501,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);
|
||||||
|
@ -2594,7 +2594,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;
|
||||||
|
@ -2683,7 +2683,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,
|
||||||
|
@ -2695,9 +2695,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);
|
||||||
|
@ -2743,7 +2743,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;
|
||||||
|
@ -2751,9 +2751,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);
|
||||||
|
@ -2865,7 +2865,7 @@ void ParticleDamager::update(ParticleSystem *particleSystem) {
|
||||||
//play sound
|
//play sound
|
||||||
StaticSound *projSound= ast->getProjSound();
|
StaticSound *projSound= ast->getProjSound();
|
||||||
if(particleSystem->getVisible() && projSound != NULL) {
|
if(particleSystem->getVisible() && projSound != NULL) {
|
||||||
SoundRenderer::getInstance().playFx(projSound, Vec3f(attacker->getCurrVector()), gameCamera->getPos());
|
SoundRenderer::getInstance().playFx(projSound, attacker->getCurrVector(), gameCamera->getPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
particleSystem->setObserver(NULL);
|
particleSystem->setObserver(NULL);
|
||||||
|
|
|
@ -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,11 +45,11 @@ 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;
|
||||||
Vec4d color;
|
Vec4f color;
|
||||||
double size;
|
double size;
|
||||||
int energy;
|
int energy;
|
||||||
|
|
||||||
|
@ -59,14 +59,11 @@ public:
|
||||||
energy = 0;
|
energy = 0;
|
||||||
}
|
}
|
||||||
//get
|
//get
|
||||||
Vec3d getPos() const {return pos;}
|
Vec3f getPos() const {return pos;}
|
||||||
Vec3f getPosAsFloat() const {return Vec3f(pos.x,pos.y,pos.z);}
|
Vec3f getLastPos() const {return lastPos;}
|
||||||
Vec3d getLastPos() const {return lastPos;}
|
Vec3f getSpeed() const {return speed;}
|
||||||
Vec3f getLastPosAsFloat() const {return Vec3f(lastPos.x,lastPos.y,lastPos.z);}
|
Vec3f getAccel() const {return accel;}
|
||||||
Vec3d getSpeed() const {return speed;}
|
Vec4f getColor() const {return color;}
|
||||||
Vec3d getAccel() const {return accel;}
|
|
||||||
Vec4d getColor() const {return color;}
|
|
||||||
Vec4f getColorAsFloat() const {return Vec4f(color.x,color.y,color.z,color.w);}
|
|
||||||
double getSize() const {return size;}
|
double getSize() const {return size;}
|
||||||
int getEnergy() const {return energy;}
|
int getEnergy() const {return energy;}
|
||||||
|
|
||||||
|
@ -88,7 +85,6 @@ public:
|
||||||
|
|
||||||
class ParticleOwner {
|
class ParticleOwner {
|
||||||
public:
|
public:
|
||||||
virtual ~ParticleOwner() {};
|
|
||||||
virtual void end(ParticleSystem *particleSystem)= 0;
|
virtual void end(ParticleSystem *particleSystem)= 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,6 +93,7 @@ public:
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
class ParticleSystem {
|
class ParticleSystem {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
|
@ -138,16 +135,16 @@ protected:
|
||||||
int textureFileLoadDeferredComponents;
|
int textureFileLoadDeferredComponents;
|
||||||
|
|
||||||
Texture *texture;
|
Texture *texture;
|
||||||
Vec3d pos;
|
Vec3f pos;
|
||||||
Vec4d color;
|
Vec4f color;
|
||||||
Vec4d colorNoEnergy;
|
Vec4f colorNoEnergy;
|
||||||
double emissionRate;
|
double emissionRate;
|
||||||
double emissionState;
|
double emissionState;
|
||||||
int maxParticleEnergy;
|
int maxParticleEnergy;
|
||||||
int varParticleEnergy;
|
int varParticleEnergy;
|
||||||
double particleSize;
|
double particleSize;
|
||||||
double speed;
|
double speed;
|
||||||
Vec3d factionColor;
|
Vec3f factionColor;
|
||||||
bool teamcolorNoEnergy;
|
bool teamcolorNoEnergy;
|
||||||
bool teamcolorEnergy;
|
bool teamcolorEnergy;
|
||||||
int alternations;
|
int alternations;
|
||||||
|
@ -169,8 +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;}
|
||||||
Vec3f getPosAsFloat() const {return Vec3f(pos.x,pos.y,pos.z);}
|
|
||||||
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;}
|
||||||
|
@ -185,9 +181,9 @@ 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(Vec4d color);
|
void setColor(Vec4f color);
|
||||||
void setColorNoEnergy(Vec4d color);
|
void setColorNoEnergy(Vec4f color);
|
||||||
void setEmissionRate(double emissionRate);
|
void setEmissionRate(double emissionRate);
|
||||||
void setMaxParticleEnergy(int maxParticleEnergy);
|
void setMaxParticleEnergy(int maxParticleEnergy);
|
||||||
void setVarParticleEnergy(int varParticleEnergy);
|
void setVarParticleEnergy(int varParticleEnergy);
|
||||||
|
@ -201,7 +197,7 @@ public:
|
||||||
void setTeamcolorEnergy(bool teamcolorEnergy) {this->teamcolorEnergy= teamcolorEnergy;}
|
void setTeamcolorEnergy(bool teamcolorEnergy) {this->teamcolorEnergy= teamcolorEnergy;}
|
||||||
void setAlternations(int alternations) {this->alternations= alternations;}
|
void setAlternations(int alternations) {this->alternations= alternations;}
|
||||||
void setParticleSystemStartDelay(int delay) {this->particleSystemStartDelay= delay;}
|
void setParticleSystemStartDelay(int delay) {this->particleSystemStartDelay= delay;}
|
||||||
virtual void setFactionColor(Vec3d factionColor);
|
virtual void setFactionColor(Vec3f factionColor);
|
||||||
|
|
||||||
static BlendMode strToBlendMode(const string &str);
|
static BlendMode strToBlendMode(const string &str);
|
||||||
//misc
|
//misc
|
||||||
|
@ -241,7 +237,7 @@ protected:
|
||||||
class FireParticleSystem: public ParticleSystem{
|
class FireParticleSystem: public ParticleSystem{
|
||||||
private:
|
private:
|
||||||
double radius;
|
double radius;
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FireParticleSystem(int particleCount= 2000);
|
FireParticleSystem(int particleCount= 2000);
|
||||||
|
@ -284,8 +280,8 @@ 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
|
double getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
||||||
|
@ -293,8 +289,7 @@ public:
|
||||||
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;}
|
||||||
Vec3f getDirectionAsFloat() const {return Vec3f(direction.x, direction.y, direction.z);}
|
|
||||||
void setModelCycle(double modelCycle) {this->modelCycle= modelCycle;}
|
void setModelCycle(double modelCycle) {this->modelCycle= modelCycle;}
|
||||||
|
|
||||||
virtual void saveGame(XmlNode *rootNode);
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
|
@ -312,8 +307,8 @@ protected:
|
||||||
string modelFileLoadDeferred;
|
string modelFileLoadDeferred;
|
||||||
Model *model;
|
Model *model;
|
||||||
double modelCycle;
|
double modelCycle;
|
||||||
Vec3d offset;
|
Vec3f offset;
|
||||||
Vec3d direction;
|
Vec3f direction;
|
||||||
double tween;
|
double tween;
|
||||||
|
|
||||||
GameParticleSystem(int particleCount);
|
GameParticleSystem(int particleCount);
|
||||||
|
@ -328,14 +323,14 @@ protected:
|
||||||
class UnitParticleSystem: public GameParticleSystem{
|
class UnitParticleSystem: public GameParticleSystem{
|
||||||
public:
|
public:
|
||||||
static bool isNight;
|
static bool isNight;
|
||||||
static Vec3d lightColor;
|
static Vec3f lightColor;
|
||||||
private:
|
private:
|
||||||
double radius;
|
double radius;
|
||||||
double minRadius;
|
double minRadius;
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
Vec3d cRotation;
|
Vec3f cRotation;
|
||||||
Vec3d fixedAddition;
|
Vec3f fixedAddition;
|
||||||
Vec3d oldPosition;
|
Vec3f oldPosition;
|
||||||
bool energyUp;
|
bool energyUp;
|
||||||
double startTime;
|
double startTime;
|
||||||
double endTime;
|
double endTime;
|
||||||
|
@ -390,7 +385,7 @@ public:
|
||||||
|
|
||||||
void setWind(double windAngle, double windSpeed);
|
void setWind(double windAngle, double windSpeed);
|
||||||
|
|
||||||
void setDirection(Vec3d direction) {this->direction= direction;}
|
void setDirection(Vec3f direction) {this->direction= direction;}
|
||||||
void setSizeNoEnergy(double sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
void setSizeNoEnergy(double sizeNoEnergy) {this->sizeNoEnergy= sizeNoEnergy;}
|
||||||
void setGravity(double gravity) {this->gravity= gravity;}
|
void setGravity(double gravity) {this->gravity= gravity;}
|
||||||
void setRotation(double rotation);
|
void setRotation(double rotation);
|
||||||
|
@ -409,7 +404,7 @@ public:
|
||||||
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);
|
||||||
|
|
||||||
|
@ -427,7 +422,7 @@ public:
|
||||||
|
|
||||||
class RainParticleSystem: public ParticleSystem{
|
class RainParticleSystem: public ParticleSystem{
|
||||||
private:
|
private:
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
double radius;
|
double radius;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -454,7 +449,7 @@ public:
|
||||||
|
|
||||||
class SnowParticleSystem: public ParticleSystem{
|
class SnowParticleSystem: public ParticleSystem{
|
||||||
private:
|
private:
|
||||||
Vec3d windSpeed;
|
Vec3f windSpeed;
|
||||||
double radius;
|
double radius;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -519,14 +514,14 @@ 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;
|
double trajectorySpeed;
|
||||||
|
@ -555,7 +550,7 @@ public:
|
||||||
void setTrajectoryScale(double trajectoryScale) {this->trajectoryScale= trajectoryScale;}
|
void setTrajectoryScale(double trajectoryScale) {this->trajectoryScale= trajectoryScale;}
|
||||||
void setTrajectoryFrequency(double trajectoryFrequency) {this->trajectoryFrequency= trajectoryFrequency;}
|
void setTrajectoryFrequency(double 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);
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@ void ParticleRendererGl::renderSystem(ParticleSystem *ps){
|
||||||
for(int i=0; i<ps->getAliveParticleCount(); ++i){
|
for(int i=0; i<ps->getAliveParticleCount(); ++i){
|
||||||
const Particle *particle= ps->getParticle(i);
|
const Particle *particle= ps->getParticle(i);
|
||||||
float size= particle->getSize()/2.0f;
|
float size= particle->getSize()/2.0f;
|
||||||
Vec3f pos= particle->getPosAsFloat();
|
Vec3f pos= particle->getPos();
|
||||||
Vec4f color= particle->getColorAsFloat();
|
Vec4f color= particle->getColor();
|
||||||
|
|
||||||
vertexBuffer[bufferIndex] = pos - (rightVector - upVector) * size;
|
vertexBuffer[bufferIndex] = pos - (rightVector - upVector) * size;
|
||||||
vertexBuffer[bufferIndex+1] = pos - (rightVector + upVector) * size;
|
vertexBuffer[bufferIndex+1] = pos - (rightVector + upVector) * size;
|
||||||
|
@ -157,10 +157,10 @@ void ParticleRendererGl::renderSystemLine(ParticleSystem *ps){
|
||||||
|
|
||||||
for(int i=0; i<ps->getAliveParticleCount(); ++i){
|
for(int i=0; i<ps->getAliveParticleCount(); ++i){
|
||||||
particle= ps->getParticle(i);
|
particle= ps->getParticle(i);
|
||||||
Vec4f color= particle->getColorAsFloat();
|
Vec4f color= particle->getColor();
|
||||||
|
|
||||||
vertexBuffer[bufferIndex] = particle->getPosAsFloat();
|
vertexBuffer[bufferIndex] = particle->getPos();
|
||||||
vertexBuffer[bufferIndex+1] = particle->getLastPosAsFloat();
|
vertexBuffer[bufferIndex+1] = particle->getLastPos();
|
||||||
|
|
||||||
colorBuffer[bufferIndex]= color;
|
colorBuffer[bufferIndex]= color;
|
||||||
colorBuffer[bufferIndex+1]= color;
|
colorBuffer[bufferIndex+1]= color;
|
||||||
|
@ -201,10 +201,10 @@ void ParticleRendererGl::renderSystemLineAlpha(ParticleSystem *ps){
|
||||||
|
|
||||||
for(int i=0; i<ps->getAliveParticleCount(); ++i){
|
for(int i=0; i<ps->getAliveParticleCount(); ++i){
|
||||||
particle= ps->getParticle(i);
|
particle= ps->getParticle(i);
|
||||||
Vec4f color= particle->getColorAsFloat();
|
Vec4f color= particle->getColor();
|
||||||
|
|
||||||
vertexBuffer[bufferIndex] = particle->getPosAsFloat();
|
vertexBuffer[bufferIndex] = particle->getPos();
|
||||||
vertexBuffer[bufferIndex+1] = particle->getLastPosAsFloat();
|
vertexBuffer[bufferIndex+1] = particle->getLastPos();
|
||||||
|
|
||||||
colorBuffer[bufferIndex]= color;
|
colorBuffer[bufferIndex]= color;
|
||||||
colorBuffer[bufferIndex+1]= color;
|
colorBuffer[bufferIndex+1]= color;
|
||||||
|
@ -236,11 +236,11 @@ void ParticleRendererGl::renderModel(GameParticleSystem *ps, ModelRenderer *mr){
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
//translate
|
//translate
|
||||||
Vec3f pos= ps->getPosAsFloat();
|
Vec3f pos= ps->getPos();
|
||||||
glTranslatef(pos.x, pos.y, pos.z);
|
glTranslatef(pos.x, pos.y, pos.z);
|
||||||
|
|
||||||
//rotate
|
//rotate
|
||||||
Vec3f direction= ps->getDirectionAsFloat();
|
Vec3f direction= ps->getDirection();
|
||||||
Vec3f flatDirection= Vec3f(direction.x, 0.f, direction.z);
|
Vec3f flatDirection= Vec3f(direction.x, 0.f, direction.z);
|
||||||
Vec3f rotVector= Vec3f(0.f, 1.f, 0.f).cross(flatDirection);
|
Vec3f rotVector= Vec3f(0.f, 1.f, 0.f).cross(flatDirection);
|
||||||
|
|
||||||
|
|
|
@ -65,15 +65,15 @@ void Particle::loadGame(const XmlNode *rootNode) {
|
||||||
|
|
||||||
//particleNode = aiNode->getAttribute("startLoc")->getIntValue();
|
//particleNode = aiNode->getAttribute("startLoc")->getIntValue();
|
||||||
// Vec3f pos;
|
// Vec3f pos;
|
||||||
pos = Vec3d::strToVec3(particleNode->getAttribute("pos")->getValue());
|
pos = Vec3f::strToVec3(particleNode->getAttribute("pos")->getValue());
|
||||||
// Vec3f lastPos;
|
// Vec3f lastPos;
|
||||||
lastPos = Vec3d::strToVec3(particleNode->getAttribute("lastPos")->getValue());
|
lastPos = Vec3f::strToVec3(particleNode->getAttribute("lastPos")->getValue());
|
||||||
// Vec3f speed;
|
// Vec3f speed;
|
||||||
speed = Vec3d::strToVec3(particleNode->getAttribute("speed")->getValue());
|
speed = Vec3f::strToVec3(particleNode->getAttribute("speed")->getValue());
|
||||||
// Vec3f accel;
|
// Vec3f accel;
|
||||||
accel = Vec3d::strToVec3(particleNode->getAttribute("accel")->getValue());
|
accel = Vec3f::strToVec3(particleNode->getAttribute("accel")->getValue());
|
||||||
// Vec4f color;
|
// Vec4f color;
|
||||||
color = Vec4d::strToVec4(particleNode->getAttribute("color")->getValue());
|
color = Vec4f::strToVec4(particleNode->getAttribute("color")->getValue());
|
||||||
// float size;
|
// float size;
|
||||||
size = particleNode->getAttribute("size")->getFloatValue();
|
size = particleNode->getAttribute("size")->getFloatValue();
|
||||||
// int energy;
|
// int energy;
|
||||||
|
@ -112,9 +112,9 @@ ParticleSystem::ParticleSystem(int particleCount) {
|
||||||
//this->particleCount= particles.size();
|
//this->particleCount= particles.size();
|
||||||
maxParticleEnergy= 250;
|
maxParticleEnergy= 250;
|
||||||
varParticleEnergy= 50;
|
varParticleEnergy= 50;
|
||||||
pos= Vec3d(0.0f);
|
pos= Vec3f(0.0f);
|
||||||
color= Vec4d(1.0f);
|
color= Vec4f(1.0f);
|
||||||
colorNoEnergy= Vec4d(0.0f);
|
colorNoEnergy= Vec4f(0.0f);
|
||||||
emissionRate= 15.0f;
|
emissionRate= 15.0f;
|
||||||
emissionState= 1.0f; // initialized with 1 because we must have at least one particle in the beginning!
|
emissionState= 1.0f; // initialized with 1 because we must have at least one particle in the beginning!
|
||||||
speed= 1.0f;
|
speed= 1.0f;
|
||||||
|
@ -251,17 +251,17 @@ void ParticleSystem::setTexture(Texture *texture){
|
||||||
this->texture= texture;
|
this->texture= texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setPos(Vec3d pos){
|
void ParticleSystem::setPos(Vec3f pos){
|
||||||
this->pos= pos;
|
this->pos= pos;
|
||||||
for(int i=getChildCount()-1; i>=0; i--)
|
for(int i=getChildCount()-1; i>=0; i--)
|
||||||
getChild(i)->setPos(pos);
|
getChild(i)->setPos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setColor(Vec4d color){
|
void ParticleSystem::setColor(Vec4f color){
|
||||||
this->color= color;
|
this->color= color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setColorNoEnergy(Vec4d colorNoEnergy){
|
void ParticleSystem::setColorNoEnergy(Vec4f colorNoEnergy){
|
||||||
this->colorNoEnergy= colorNoEnergy;
|
this->colorNoEnergy= colorNoEnergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,11 +485,11 @@ void ParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vec3f pos;
|
// Vec3f pos;
|
||||||
pos = Vec3d::strToVec3(particleSystemNode->getAttribute("pos")->getValue());
|
pos = Vec3f::strToVec3(particleSystemNode->getAttribute("pos")->getValue());
|
||||||
// Vec4f color;
|
// Vec4f color;
|
||||||
color = Vec4d::strToVec4(particleSystemNode->getAttribute("color")->getValue());
|
color = Vec4f::strToVec4(particleSystemNode->getAttribute("color")->getValue());
|
||||||
// Vec4f colorNoEnergy;
|
// Vec4f colorNoEnergy;
|
||||||
colorNoEnergy = Vec4d::strToVec4(particleSystemNode->getAttribute("colorNoEnergy")->getValue());
|
colorNoEnergy = Vec4f::strToVec4(particleSystemNode->getAttribute("colorNoEnergy")->getValue());
|
||||||
// float emissionRate;
|
// float emissionRate;
|
||||||
emissionRate = particleSystemNode->getAttribute("emissionRate")->getFloatValue();
|
emissionRate = particleSystemNode->getAttribute("emissionRate")->getFloatValue();
|
||||||
// float emissionState;
|
// float emissionState;
|
||||||
|
@ -503,7 +503,7 @@ void ParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
// float speed;
|
// float speed;
|
||||||
speed = particleSystemNode->getAttribute("speed")->getFloatValue();
|
speed = particleSystemNode->getAttribute("speed")->getFloatValue();
|
||||||
// Vec3f factionColor;
|
// Vec3f factionColor;
|
||||||
factionColor = Vec3d::strToVec3(particleSystemNode->getAttribute("factionColor")->getValue());
|
factionColor = Vec3f::strToVec3(particleSystemNode->getAttribute("factionColor")->getValue());
|
||||||
// bool teamcolorNoEnergy;
|
// bool teamcolorNoEnergy;
|
||||||
teamcolorNoEnergy = particleSystemNode->getAttribute("teamcolorNoEnergy")->getIntValue() != 0;
|
teamcolorNoEnergy = particleSystemNode->getAttribute("teamcolorNoEnergy")->getIntValue() != 0;
|
||||||
// bool teamcolorEnergy;
|
// bool teamcolorEnergy;
|
||||||
|
@ -601,9 +601,9 @@ Particle * ParticleSystem::createParticle(){
|
||||||
void ParticleSystem::initParticle(Particle *p, int particleIndex){
|
void ParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
p->pos= pos;
|
p->pos= pos;
|
||||||
p->lastPos= p->pos;
|
p->lastPos= p->pos;
|
||||||
p->speed= Vec3d(0.0f);
|
p->speed= Vec3f(0.0f);
|
||||||
p->accel= Vec3d(0.0f);
|
p->accel= Vec3f(0.0f);
|
||||||
p->color= Vec4d(1.0f, 1.0f, 1.0f, 1.0);
|
p->color= Vec4f(1.0f, 1.0f, 1.0f, 1.0);
|
||||||
p->size= particleSize;
|
p->size= particleSize;
|
||||||
p->energy= maxParticleEnergy + random.randRange(-varParticleEnergy, varParticleEnergy);
|
p->energy= maxParticleEnergy + random.randRange(-varParticleEnergy, varParticleEnergy);
|
||||||
}
|
}
|
||||||
|
@ -623,15 +623,15 @@ void ParticleSystem::killParticle(Particle *p){
|
||||||
aliveParticleCount--;
|
aliveParticleCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setFactionColor(Vec3d factionColor){
|
void ParticleSystem::setFactionColor(Vec3f factionColor){
|
||||||
this->factionColor= factionColor;
|
this->factionColor= factionColor;
|
||||||
Vec3d tmpCol;
|
Vec3f tmpCol;
|
||||||
|
|
||||||
if(teamcolorEnergy){
|
if(teamcolorEnergy){
|
||||||
this->color= Vec4d(factionColor.x, factionColor.y, factionColor.z, this->color.w);
|
this->color= Vec4f(factionColor.x, factionColor.y, factionColor.z, this->color.w);
|
||||||
}
|
}
|
||||||
if(teamcolorNoEnergy){
|
if(teamcolorNoEnergy){
|
||||||
this->colorNoEnergy= Vec4d(factionColor.x, factionColor.y, factionColor.z, this->colorNoEnergy.w);
|
this->colorNoEnergy= Vec4f(factionColor.x, factionColor.y, factionColor.z, this->colorNoEnergy.w);
|
||||||
}
|
}
|
||||||
for(int i=getChildCount()-1; i>=0; i--)
|
for(int i=getChildCount()-1; i>=0; i--)
|
||||||
getChild(i)->setFactionColor(factionColor);
|
getChild(i)->setFactionColor(factionColor);
|
||||||
|
@ -647,10 +647,10 @@ FireParticleSystem::FireParticleSystem(int particleCount) :
|
||||||
|
|
||||||
radius= 0.5f;
|
radius= 0.5f;
|
||||||
speed= 0.01f;
|
speed= 0.01f;
|
||||||
windSpeed= Vec3d(0.0f);
|
windSpeed= Vec3f(0.0f);
|
||||||
|
|
||||||
setParticleSize(0.6f);
|
setParticleSize(0.6f);
|
||||||
setColorNoEnergy(Vec4d(1.0f, 0.5f, 0.0f, 1.0f));
|
setColorNoEnergy(Vec4f(1.0f, 0.5f, 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FireParticleSystem::initParticle(Particle *p, int particleIndex){
|
void FireParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
|
@ -676,10 +676,10 @@ void FireParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
p->color= colorNoEnergy * 0.5f + colorNoEnergy * 0.5f * radRatio;
|
p->color= colorNoEnergy * 0.5f + colorNoEnergy * 0.5f * radRatio;
|
||||||
p->energy= static_cast<int> (maxParticleEnergy * radRatio)
|
p->energy= static_cast<int> (maxParticleEnergy * radRatio)
|
||||||
+ random.randRange(-varParticleEnergy, varParticleEnergy);
|
+ random.randRange(-varParticleEnergy, varParticleEnergy);
|
||||||
p->pos= Vec3d(pos.x + x, pos.y + random.randRange(-radius / 2, radius / 2), pos.z + y);
|
p->pos= Vec3f(pos.x + x, pos.y + random.randRange(-radius / 2, radius / 2), pos.z + y);
|
||||||
p->lastPos= pos;
|
p->lastPos= pos;
|
||||||
p->size= particleSize;
|
p->size= particleSize;
|
||||||
p->speed= Vec3d(0, speed + speed * random.randRange(-0.5f, 0.5f), 0) + windSpeed;
|
p->speed= Vec3f(0, speed + speed * random.randRange(-0.5f, 0.5f), 0) + windSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FireParticleSystem::updateParticle(Particle *p){
|
void FireParticleSystem::updateParticle(Particle *p){
|
||||||
|
@ -744,7 +744,7 @@ void FireParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
// float radius;
|
// float radius;
|
||||||
radius = fireParticleSystemNode->getAttribute("radius")->getFloatValue();
|
radius = fireParticleSystemNode->getAttribute("radius")->getFloatValue();
|
||||||
// Vec3f windSpeed;
|
// Vec3f windSpeed;
|
||||||
windSpeed = Vec3d::strToVec3(fireParticleSystemNode->getAttribute("windSpeed")->getValue());
|
windSpeed = Vec3f::strToVec3(fireParticleSystemNode->getAttribute("windSpeed")->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
Checksum FireParticleSystem::getCRC() {
|
Checksum FireParticleSystem::getCRC() {
|
||||||
|
@ -810,18 +810,18 @@ void GameParticleSystem::removeChild(UnitParticleSystem* child){
|
||||||
children.erase(it);
|
children.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameParticleSystem::setPos(Vec3d pos){
|
void GameParticleSystem::setPos(Vec3f pos){
|
||||||
this->pos= pos;
|
this->pos= pos;
|
||||||
positionChildren();
|
positionChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameParticleSystem::positionChildren() {
|
void GameParticleSystem::positionChildren() {
|
||||||
Vec3d child_pos = pos - offset;
|
Vec3f child_pos = pos - offset;
|
||||||
for(int i=getChildCount()-1; i>=0; i--)
|
for(int i=getChildCount()-1; i>=0; i--)
|
||||||
getChild(i)->setPos(child_pos);
|
getChild(i)->setPos(child_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameParticleSystem::setOffset(Vec3d offset){
|
void GameParticleSystem::setOffset(Vec3f offset){
|
||||||
this->offset= offset;
|
this->offset= offset;
|
||||||
positionChildren();
|
positionChildren();
|
||||||
}
|
}
|
||||||
|
@ -952,9 +952,9 @@ void GameParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
//gameParticleSystemNode->addAttribute("modelCycle",floatToStr(modelCycle), mapTagReplacements);
|
//gameParticleSystemNode->addAttribute("modelCycle",floatToStr(modelCycle), mapTagReplacements);
|
||||||
modelCycle = gameParticleSystemNode->getAttribute("modelCycle")->getFloatValue();
|
modelCycle = gameParticleSystemNode->getAttribute("modelCycle")->getFloatValue();
|
||||||
// Vec3f offset;
|
// Vec3f offset;
|
||||||
offset = Vec3d::strToVec3(gameParticleSystemNode->getAttribute("offset")->getValue());
|
offset = Vec3f::strToVec3(gameParticleSystemNode->getAttribute("offset")->getValue());
|
||||||
// Vec3f direction;
|
// Vec3f direction;
|
||||||
direction = Vec3d::strToVec3(gameParticleSystemNode->getAttribute("direction")->getValue());
|
direction = Vec3f::strToVec3(gameParticleSystemNode->getAttribute("direction")->getValue());
|
||||||
// float tween;
|
// float tween;
|
||||||
tween = gameParticleSystemNode->getAttribute("tween")->getFloatValue();
|
tween = gameParticleSystemNode->getAttribute("tween")->getFloatValue();
|
||||||
}
|
}
|
||||||
|
@ -986,17 +986,17 @@ string GameParticleSystem::toString() const {
|
||||||
// UnitParticleSystem
|
// UnitParticleSystem
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
bool UnitParticleSystem::isNight= false;
|
bool UnitParticleSystem::isNight= false;
|
||||||
Vec3d UnitParticleSystem::lightColor=Vec3d(1.0f,1.0f,1.0f);
|
Vec3f UnitParticleSystem::lightColor=Vec3f(1.0f,1.0f,1.0f);
|
||||||
|
|
||||||
UnitParticleSystem::UnitParticleSystem(int particleCount) :
|
UnitParticleSystem::UnitParticleSystem(int particleCount) :
|
||||||
GameParticleSystem(particleCount), parent(NULL) {
|
GameParticleSystem(particleCount), parent(NULL) {
|
||||||
radius= 0.5f;
|
radius= 0.5f;
|
||||||
speed= 0.01f;
|
speed= 0.01f;
|
||||||
windSpeed= Vec3d(0.0f);
|
windSpeed= Vec3f(0.0f);
|
||||||
minRadius = 0.0;
|
minRadius = 0.0;
|
||||||
|
|
||||||
setParticleSize(0.6f);
|
setParticleSize(0.6f);
|
||||||
setColorNoEnergy(Vec4d(1.0f, 0.5f, 0.0f, 1.0f));
|
setColorNoEnergy(Vec4f(1.0f, 0.5f, 0.0f, 1.0f));
|
||||||
sizeNoEnergy=1.0f;
|
sizeNoEnergy=1.0f;
|
||||||
|
|
||||||
primitive= pQuad;
|
primitive= pQuad;
|
||||||
|
@ -1014,8 +1014,8 @@ UnitParticleSystem::UnitParticleSystem(int particleCount) :
|
||||||
isVisibleAtDay= true;
|
isVisibleAtDay= true;
|
||||||
isDaylightAffected= false;
|
isDaylightAffected= false;
|
||||||
|
|
||||||
cRotation= Vec3d(1.0f, 1.0f, 1.0f);
|
cRotation= Vec3f(1.0f, 1.0f, 1.0f);
|
||||||
fixedAddition= Vec3d(0.0f, 0.0f, 0.0f);
|
fixedAddition= Vec3f(0.0f, 0.0f, 0.0f);
|
||||||
//prepare system for given staticParticleCount
|
//prepare system for given staticParticleCount
|
||||||
if(staticParticleCount > 0){
|
if(staticParticleCount > 0){
|
||||||
emissionState= (double) staticParticleCount;
|
emissionState= (double) staticParticleCount;
|
||||||
|
@ -1108,7 +1108,7 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
p->lastPos= pos;
|
p->lastPos= pos;
|
||||||
oldPosition= pos;
|
oldPosition= pos;
|
||||||
p->size= particleSize;
|
p->size= particleSize;
|
||||||
p->accel= Vec3d(0.0f, -gravity, 0.0f);
|
p->accel= Vec3f(0.0f, -gravity, 0.0f);
|
||||||
|
|
||||||
// work out where we start for our shape (set speed and pos)
|
// work out where we start for our shape (set speed and pos)
|
||||||
switch(shape){
|
switch(shape){
|
||||||
|
@ -1116,9 +1116,9 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
angle = (double)random.randRange(0,360);
|
angle = (double)random.randRange(0,360);
|
||||||
// fall through
|
// fall through
|
||||||
case sConical:{
|
case sConical:{
|
||||||
Vec2d horiz = Vec2d(1,0).rotate(ang);
|
Vec2f horiz = Vec2f(1,0).rotate(ang);
|
||||||
Vec2d vert = Vec2d(1,0).rotate(degToRad(angle));
|
Vec2f vert = Vec2f(1,0).rotate(degToRad(angle));
|
||||||
Vec3d start = Vec3d(horiz.x*vert.y,vert.x,horiz.y).getNormalized(); // close enough
|
Vec3f start = Vec3f(horiz.x*vert.y,vert.x,horiz.y).getNormalized(); // close enough
|
||||||
p->speed = start * speed;
|
p->speed = start * speed;
|
||||||
start = start * random.randRange(minRadius,radius);
|
start = start * random.randRange(minRadius,radius);
|
||||||
p->pos = pos + offset + start;
|
p->pos = pos + offset + start;
|
||||||
|
@ -1133,25 +1133,25 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
#endif
|
#endif
|
||||||
const double rad= degToRad(rotation);
|
const double rad= degToRad(rotation);
|
||||||
if(!relative){
|
if(!relative){
|
||||||
p->pos= Vec3d(pos.x + x + offset.x, pos.y + random.randRange(-radius / 2, radius / 2) + offset.y, pos.z + y
|
p->pos= Vec3f(pos.x + x + offset.x, pos.y + random.randRange(-radius / 2, radius / 2) + offset.y, pos.z + y
|
||||||
+ offset.z);
|
+ offset.z);
|
||||||
}
|
}
|
||||||
else{// rotate it according to rotation
|
else{// rotate it according to rotation
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
p->pos= Vec3d(pos.x+x+offset.z*streflop::sinf(static_cast<streflop::Simple>(rad))+offset.x*streflop::cosf(static_cast<streflop::Simple>(rad)), pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*streflop::cosf(static_cast<streflop::Simple>(rad))-offset.x*streflop::sinf(static_cast<streflop::Simple>(rad))));
|
p->pos= Vec3f(pos.x+x+offset.z*streflop::sinf(static_cast<streflop::Simple>(rad))+offset.x*streflop::cosf(static_cast<streflop::Simple>(rad)), pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*streflop::cosf(static_cast<streflop::Simple>(rad))-offset.x*streflop::sinf(static_cast<streflop::Simple>(rad))));
|
||||||
#else
|
#else
|
||||||
p->pos= Vec3d(pos.x + x + offset.z * sinf(rad) + offset.x * cosf(rad), pos.y + random.randRange(-radius / 2,
|
p->pos= Vec3f(pos.x + x + offset.z * sinf(rad) + offset.x * cosf(rad), pos.y + random.randRange(-radius / 2,
|
||||||
radius / 2) + offset.y, pos.z + y + (offset.z * cosf(rad) - offset.x * sinf(rad)));
|
radius / 2) + offset.y, pos.z + y + (offset.z * cosf(rad) - offset.x * sinf(rad)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
p->speed= Vec3d(direction.x + direction.x * random.randRange(-0.5f, 0.5f), direction.y + direction.y
|
p->speed= Vec3f(direction.x + direction.x * random.randRange(-0.5f, 0.5f), direction.y + direction.y
|
||||||
* random.randRange(-0.5f, 0.5f), direction.z + direction.z * random.randRange(-0.5f, 0.5f));
|
* random.randRange(-0.5f, 0.5f), direction.z + direction.z * random.randRange(-0.5f, 0.5f));
|
||||||
p->speed= p->speed * speed;
|
p->speed= p->speed * speed;
|
||||||
if(relative && relativeDirection){
|
if(relative && relativeDirection){
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
p->speed=Vec3d(p->speed.z*streflop::sinf(static_cast<streflop::Simple>(rad))+p->speed.x*streflop::cosf(static_cast<streflop::Simple>(rad)),p->speed.y,(p->speed.z*streflop::cosf(static_cast<streflop::Simple>(rad))-p->speed.x*streflop::sinf(static_cast<streflop::Simple>(rad))));
|
p->speed=Vec3f(p->speed.z*streflop::sinf(static_cast<streflop::Simple>(rad))+p->speed.x*streflop::cosf(static_cast<streflop::Simple>(rad)),p->speed.y,(p->speed.z*streflop::cosf(static_cast<streflop::Simple>(rad))-p->speed.x*streflop::sinf(static_cast<streflop::Simple>(rad))));
|
||||||
#else
|
#else
|
||||||
p->speed= Vec3d(p->speed.z * sinf(rad) + p->speed.x * cosf(rad), p->speed.y, (p->speed.z * cosf(rad)
|
p->speed= Vec3f(p->speed.z * sinf(rad) + p->speed.x * cosf(rad), p->speed.y, (p->speed.z * cosf(rad)
|
||||||
- p->speed.x * sinf(rad)));
|
- p->speed.x * sinf(rad)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1175,7 @@ void UnitParticleSystem::update(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fixed){
|
if(fixed){
|
||||||
fixedAddition= Vec3d(pos.x - oldPosition.x, pos.y - oldPosition.y, pos.z - oldPosition.z);
|
fixedAddition= Vec3f(pos.x - oldPosition.x, pos.y - oldPosition.y, pos.z - oldPosition.z);
|
||||||
oldPosition= pos;
|
oldPosition= pos;
|
||||||
}
|
}
|
||||||
ParticleSystem::update();
|
ParticleSystem::update();
|
||||||
|
@ -1323,13 +1323,13 @@ void UnitParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
// float minRadius;
|
// float minRadius;
|
||||||
minRadius = unitParticleSystemNode->getAttribute("minRadius")->getFloatValue();
|
minRadius = unitParticleSystemNode->getAttribute("minRadius")->getFloatValue();
|
||||||
// Vec3f windSpeed;
|
// Vec3f windSpeed;
|
||||||
windSpeed = Vec3d::strToVec3(unitParticleSystemNode->getAttribute("windSpeed")->getValue());
|
windSpeed = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("windSpeed")->getValue());
|
||||||
// Vec3f cRotation;
|
// Vec3f cRotation;
|
||||||
windSpeed = Vec3d::strToVec3(unitParticleSystemNode->getAttribute("cRotation")->getValue());
|
windSpeed = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("cRotation")->getValue());
|
||||||
// Vec3f fixedAddition;
|
// Vec3f fixedAddition;
|
||||||
fixedAddition = Vec3d::strToVec3(unitParticleSystemNode->getAttribute("fixedAddition")->getValue());
|
fixedAddition = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("fixedAddition")->getValue());
|
||||||
// Vec3f oldPosition;
|
// Vec3f oldPosition;
|
||||||
oldPosition = Vec3d::strToVec3(unitParticleSystemNode->getAttribute("oldPosition")->getValue());
|
oldPosition = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("oldPosition")->getValue());
|
||||||
// bool energyUp;
|
// bool energyUp;
|
||||||
energyUp = unitParticleSystemNode->getAttribute("energyUp")->getIntValue() != 0;
|
energyUp = unitParticleSystemNode->getAttribute("energyUp")->getIntValue() != 0;
|
||||||
// float startTime;
|
// float startTime;
|
||||||
|
@ -1434,7 +1434,7 @@ RainParticleSystem::RainParticleSystem(int particleCount) :
|
||||||
|
|
||||||
setEmissionRate(25.0f);
|
setEmissionRate(25.0f);
|
||||||
setParticleSize(3.0f);
|
setParticleSize(3.0f);
|
||||||
setColor(Vec4d(0.5f, 0.5f, 0.5f, 0.3f));
|
setColor(Vec4f(0.5f, 0.5f, 0.5f, 0.3f));
|
||||||
setSpeed(0.2f);
|
setSpeed(0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1450,9 +1450,9 @@ void RainParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
|
|
||||||
p->color= color;
|
p->color= color;
|
||||||
p->energy= 10000;
|
p->energy= 10000;
|
||||||
p->pos= Vec3d(pos.x + x, pos.y, pos.z + y);
|
p->pos= Vec3f(pos.x + x, pos.y, pos.z + y);
|
||||||
p->lastPos= p->pos;
|
p->lastPos= p->pos;
|
||||||
p->speed= Vec3d(random.randRange(-speed / 10, speed / 10), -speed, random.randRange(-speed / 10, speed / 10))
|
p->speed= Vec3f(random.randRange(-speed / 10, speed / 10), -speed, random.randRange(-speed / 10, speed / 10))
|
||||||
+ windSpeed;
|
+ windSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1504,7 +1504,7 @@ SnowParticleSystem::SnowParticleSystem(int particleCount) :
|
||||||
|
|
||||||
setEmissionRate(2.0f);
|
setEmissionRate(2.0f);
|
||||||
setParticleSize(0.2f);
|
setParticleSize(0.2f);
|
||||||
setColor(Vec4d(0.8f, 0.8f, 0.8f, 0.8f));
|
setColor(Vec4f(0.8f, 0.8f, 0.8f, 0.8f));
|
||||||
setSpeed(0.05f);
|
setSpeed(0.05f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1517,9 +1517,9 @@ void SnowParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
|
|
||||||
p->color= color;
|
p->color= color;
|
||||||
p->energy= 10000;
|
p->energy= 10000;
|
||||||
p->pos= Vec3d(pos.x + x, pos.y, pos.z + y);
|
p->pos= Vec3f(pos.x + x, pos.y, pos.z + y);
|
||||||
p->lastPos= p->pos;
|
p->lastPos= p->pos;
|
||||||
p->speed= Vec3d(0.0f, -speed, 0.0f) + windSpeed;
|
p->speed= Vec3f(0.0f, -speed, 0.0f) + windSpeed;
|
||||||
p->speed.x+= random.randRange(-0.005f, 0.005f);
|
p->speed.x+= random.randRange(-0.005f, 0.005f);
|
||||||
p->speed.y+= random.randRange(-0.005f, 0.005f);
|
p->speed.y+= random.randRange(-0.005f, 0.005f);
|
||||||
}
|
}
|
||||||
|
@ -1617,7 +1617,7 @@ string AttackParticleSystem::toString() const {
|
||||||
ProjectileParticleSystem::ProjectileParticleSystem(int particleCount) :
|
ProjectileParticleSystem::ProjectileParticleSystem(int particleCount) :
|
||||||
AttackParticleSystem(particleCount){
|
AttackParticleSystem(particleCount){
|
||||||
setEmissionRate(20.0f);
|
setEmissionRate(20.0f);
|
||||||
setColor(Vec4d(1.0f, 0.3f, 0.0f, 0.5f));
|
setColor(Vec4f(1.0f, 0.3f, 0.0f, 0.5f));
|
||||||
setMaxParticleEnergy(100);
|
setMaxParticleEnergy(100);
|
||||||
setVarParticleEnergy(50);
|
setVarParticleEnergy(50);
|
||||||
setParticleSize(0.4f);
|
setParticleSize(0.4f);
|
||||||
|
@ -1658,12 +1658,12 @@ void ProjectileParticleSystem::update(){
|
||||||
flatPos.y = truncateDecimal<double>(flatPos.y);
|
flatPos.y = truncateDecimal<double>(flatPos.y);
|
||||||
flatPos.z = truncateDecimal<double>(flatPos.z);
|
flatPos.z = truncateDecimal<double>(flatPos.z);
|
||||||
|
|
||||||
Vec3d targetVector = endPos - startPos;
|
Vec3f targetVector = endPos - startPos;
|
||||||
targetVector.x = truncateDecimal<double>(targetVector.x);
|
targetVector.x = truncateDecimal<double>(targetVector.x);
|
||||||
targetVector.y = truncateDecimal<double>(targetVector.y);
|
targetVector.y = truncateDecimal<double>(targetVector.y);
|
||||||
targetVector.z = truncateDecimal<double>(targetVector.z);
|
targetVector.z = truncateDecimal<double>(targetVector.z);
|
||||||
|
|
||||||
Vec3d currentVector = flatPos - startPos;
|
Vec3f currentVector = flatPos - startPos;
|
||||||
currentVector.x = truncateDecimal<double>(currentVector.x);
|
currentVector.x = truncateDecimal<double>(currentVector.x);
|
||||||
currentVector.y = truncateDecimal<double>(currentVector.y);
|
currentVector.y = truncateDecimal<double>(currentVector.y);
|
||||||
currentVector.z = truncateDecimal<double>(currentVector.z);
|
currentVector.z = truncateDecimal<double>(currentVector.z);
|
||||||
|
@ -1775,9 +1775,9 @@ void ProjectileParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
|
|
||||||
p->pos= pos + (lastPos - pos) * t;
|
p->pos= pos + (lastPos - pos) * t;
|
||||||
p->lastPos= lastPos;
|
p->lastPos= lastPos;
|
||||||
p->speed= Vec3d(random.randRange(-0.1f, 0.1f), random.randRange(-0.1f, 0.1f), random.randRange(-0.1f, 0.1f))
|
p->speed= Vec3f(random.randRange(-0.1f, 0.1f), random.randRange(-0.1f, 0.1f), random.randRange(-0.1f, 0.1f))
|
||||||
* speed;
|
* speed;
|
||||||
p->accel= Vec3d(0.0f, -gravity, 0.0f);
|
p->accel= Vec3f(0.0f, -gravity, 0.0f);
|
||||||
|
|
||||||
updateParticle(p);
|
updateParticle(p);
|
||||||
}
|
}
|
||||||
|
@ -1794,12 +1794,12 @@ void ProjectileParticleSystem::updateParticle(Particle *p){
|
||||||
p->energy--;
|
p->energy--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectileParticleSystem::setPath(Vec3d startPos, Vec3d endPos){
|
void ProjectileParticleSystem::setPath(Vec3f startPos, Vec3f endPos){
|
||||||
|
|
||||||
//compute axis
|
//compute axis
|
||||||
zVector= endPos - startPos;
|
zVector= endPos - startPos;
|
||||||
zVector.normalize();
|
zVector.normalize();
|
||||||
yVector= Vec3d(0.0f, 1.0f, 0.0f);
|
yVector= Vec3f(0.0f, 1.0f, 0.0f);
|
||||||
xVector= zVector.cross(yVector);
|
xVector= zVector.cross(yVector);
|
||||||
|
|
||||||
//apply offset
|
//apply offset
|
||||||
|
@ -1814,7 +1814,7 @@ void ProjectileParticleSystem::setPath(Vec3d startPos, Vec3d endPos){
|
||||||
//recompute axis
|
//recompute axis
|
||||||
zVector= endPos - startPos;
|
zVector= endPos - startPos;
|
||||||
zVector.normalize();
|
zVector.normalize();
|
||||||
yVector= Vec3d(0.0f, 1.0f, 0.0f);
|
yVector= Vec3f(0.0f, 1.0f, 0.0f);
|
||||||
xVector= zVector.cross(yVector);
|
xVector= zVector.cross(yVector);
|
||||||
|
|
||||||
// set members
|
// set members
|
||||||
|
@ -1894,20 +1894,20 @@ void ProjectileParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
nextParticleSystem->loadGame(splashParticleSystemNode);
|
nextParticleSystem->loadGame(splashParticleSystemNode);
|
||||||
}
|
}
|
||||||
// Vec3f lastPos;
|
// Vec3f lastPos;
|
||||||
lastPos = Vec3d::strToVec3(projectileParticleSystemNode->getAttribute("lastPos")->getValue());
|
lastPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("lastPos")->getValue());
|
||||||
// Vec3f startPos;
|
// Vec3f startPos;
|
||||||
startPos = Vec3d::strToVec3(projectileParticleSystemNode->getAttribute("startPos")->getValue());
|
startPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("startPos")->getValue());
|
||||||
// Vec3f endPos;
|
// Vec3f endPos;
|
||||||
endPos = Vec3d::strToVec3(projectileParticleSystemNode->getAttribute("endPos")->getValue());
|
endPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("endPos")->getValue());
|
||||||
// Vec3f flatPos;
|
// Vec3f flatPos;
|
||||||
flatPos = Vec3d::strToVec3(projectileParticleSystemNode->getAttribute("flatPos")->getValue());
|
flatPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("flatPos")->getValue());
|
||||||
//
|
//
|
||||||
// Vec3f xVector;
|
// Vec3f xVector;
|
||||||
xVector = Vec3d::strToVec3(projectileParticleSystemNode->getAttribute("xVector")->getValue());
|
xVector = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("xVector")->getValue());
|
||||||
// Vec3f yVector;
|
// Vec3f yVector;
|
||||||
yVector = Vec3d::strToVec3(projectileParticleSystemNode->getAttribute("yVector")->getValue());
|
yVector = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("yVector")->getValue());
|
||||||
// Vec3f zVector;
|
// Vec3f zVector;
|
||||||
zVector = Vec3d::strToVec3(projectileParticleSystemNode->getAttribute("zVector")->getValue());
|
zVector = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("zVector")->getValue());
|
||||||
// Trajectory trajectory;
|
// Trajectory trajectory;
|
||||||
trajectory = static_cast<Trajectory>(projectileParticleSystemNode->getAttribute("trajectory")->getIntValue());
|
trajectory = static_cast<Trajectory>(projectileParticleSystemNode->getAttribute("trajectory")->getIntValue());
|
||||||
// float trajectorySpeed;
|
// float trajectorySpeed;
|
||||||
|
@ -1958,7 +1958,7 @@ string ProjectileParticleSystem::toString() const {
|
||||||
|
|
||||||
SplashParticleSystem::SplashParticleSystem(int particleCount) :
|
SplashParticleSystem::SplashParticleSystem(int particleCount) :
|
||||||
AttackParticleSystem(particleCount){
|
AttackParticleSystem(particleCount){
|
||||||
setColor(Vec4d(1.0f, 0.3f, 0.0f, 0.8f));
|
setColor(Vec4f(1.0f, 0.3f, 0.0f, 0.8f));
|
||||||
setMaxParticleEnergy(100);
|
setMaxParticleEnergy(100);
|
||||||
setVarParticleEnergy(50);
|
setVarParticleEnergy(50);
|
||||||
setParticleSize(1.0f);
|
setParticleSize(1.0f);
|
||||||
|
@ -2008,13 +2008,13 @@ void SplashParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||||
p->size= particleSize;
|
p->size= particleSize;
|
||||||
p->color= color;
|
p->color= color;
|
||||||
|
|
||||||
p->speed= Vec3d(horizontalSpreadA * random.randRange(-1.0f, 1.0f) + horizontalSpreadB, verticalSpreadA
|
p->speed= Vec3f(horizontalSpreadA * random.randRange(-1.0f, 1.0f) + horizontalSpreadB, verticalSpreadA
|
||||||
* random.randRange(-1.0f, 1.0f) + verticalSpreadB, horizontalSpreadA * random.randRange(-1.0f, 1.0f)
|
* random.randRange(-1.0f, 1.0f) + verticalSpreadB, horizontalSpreadA * random.randRange(-1.0f, 1.0f)
|
||||||
+ horizontalSpreadB);
|
+ horizontalSpreadB);
|
||||||
p->speed.normalize();
|
p->speed.normalize();
|
||||||
p->speed= p->speed * speed;
|
p->speed= p->speed * speed;
|
||||||
|
|
||||||
p->accel= Vec3d(0.0f, -gravity, 0.0f);
|
p->accel= Vec3f(0.0f, -gravity, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashParticleSystem::updateParticle(Particle *p){
|
void SplashParticleSystem::updateParticle(Particle *p){
|
||||||
|
|
Loading…
Reference in New Issue