mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 07:31:21 +02:00
- added some particles to load game logic
This commit is contained in:
@@ -960,12 +960,17 @@ void Game::init(bool initForPreviewOnly) {
|
|||||||
else if(world.getTileset()->getWeather() == wRainy) {
|
else if(world.getTileset()->getWeather() == wRainy) {
|
||||||
world.getTileset()->setWeather(wSunny);
|
world.getTileset()->setWeather(wSunny);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderer.manageDeferredParticleSystems();
|
||||||
}
|
}
|
||||||
|
|
||||||
//init renderer state
|
//init renderer state
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Initializing renderer\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Initializing renderer\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
logger.add(Lang::getInstance().get("LogScreenGameLoadingInitRenderer","",true), true);
|
logger.add(Lang::getInstance().get("LogScreenGameLoadingInitRenderer","",true), true);
|
||||||
|
|
||||||
|
//printf("Before renderer.initGame\n");
|
||||||
renderer.initGame(this,this->getGameCameraPtr());
|
renderer.initGame(this,this->getGameCameraPtr());
|
||||||
|
//printf("After renderer.initGame\n");
|
||||||
|
|
||||||
for(int i=0; i < world.getFactionCount(); ++i) {
|
for(int i=0; i < world.getFactionCount(); ++i) {
|
||||||
Faction *faction= world.getFaction(i);
|
Faction *faction= world.getFaction(i);
|
||||||
|
@@ -459,6 +459,50 @@ void Renderer::initGame(const Game *game, GameCamera *gameCamera) {
|
|||||||
init3dList();
|
init3dList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::manageDeferredParticleSystems() {
|
||||||
|
//std::vector<std::pair<ParticleSystem *, ResourceScope> > deferredParticleSystems
|
||||||
|
//printf("Before deferredParticleSystems.size() = %d\n",deferredParticleSystems.size());
|
||||||
|
for(unsigned int i = 0; i < deferredParticleSystems.size(); ++i) {
|
||||||
|
std::pair<ParticleSystem *, ResourceScope> &deferredParticleSystem = deferredParticleSystems[i];
|
||||||
|
ParticleSystem *ps = deferredParticleSystem.first;
|
||||||
|
ResourceScope rs = deferredParticleSystem.second;
|
||||||
|
if(ps->getTextureFileLoadDeferred() != "" && ps->getTexture() == NULL) {
|
||||||
|
Texture2D *texture= newTexture2D(rsGame);
|
||||||
|
if(texture) {
|
||||||
|
// if(textureNode->getAttribute("luminance")->getBoolValue()){
|
||||||
|
// texture->setFormat(Texture::fAlpha);
|
||||||
|
// texture->getPixmap()->init(1);
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
texture->getPixmap()->init(4);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// string currentPath = dir;
|
||||||
|
// endPathWithSlash(currentPath);
|
||||||
|
if(texture) {
|
||||||
|
texture->load(ps->getTextureFileLoadDeferred());
|
||||||
|
ps->setTexture(texture);
|
||||||
|
}
|
||||||
|
// loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(parentLoader,textureNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
}
|
||||||
|
if(dynamic_cast<GameParticleSystem *>(ps) != NULL) {
|
||||||
|
GameParticleSystem *gps = dynamic_cast<GameParticleSystem *>(ps);
|
||||||
|
if(gps->getModelFileLoadDeferred() != "" && gps->getModel() == NULL) {
|
||||||
|
Model *model= newModel(rsGame);
|
||||||
|
if(model) {
|
||||||
|
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||||
|
model->load(gps->getModelFileLoadDeferred(), false, &loadedFileList, NULL);
|
||||||
|
gps->setModel(model);
|
||||||
|
}
|
||||||
|
//loadedFileList[path].push_back(make_pair(parentLoader,modelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manageParticleSystem(deferredParticleSystem.first, deferredParticleSystem.second);
|
||||||
|
}
|
||||||
|
deferredParticleSystems.clear();
|
||||||
|
//printf("After deferredParticleSystems.size() = %d\n",deferredParticleSystems.size());
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::initMenu(const MainMenu *mm) {
|
void Renderer::initMenu(const MainMenu *mm) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
@@ -783,6 +827,10 @@ void Renderer::resetFontManager(ResourceScope rs) {
|
|||||||
fontManager[rsGlobal]->init();
|
fontManager[rsGlobal]->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::addToDeferredParticleSystemList(std::pair<ParticleSystem *, ResourceScope> deferredParticleSystem) {
|
||||||
|
deferredParticleSystems.push_back(deferredParticleSystem);
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::manageParticleSystem(ParticleSystem *particleSystem, ResourceScope rs){
|
void Renderer::manageParticleSystem(ParticleSystem *particleSystem, ResourceScope rs){
|
||||||
particleManager[rs]->manage(particleSystem);
|
particleManager[rs]->manage(particleSystem);
|
||||||
}
|
}
|
||||||
|
@@ -299,6 +299,8 @@ private:
|
|||||||
float smoothedRenderFps;
|
float smoothedRenderFps;
|
||||||
bool shadowsOffDueToMinRender;
|
bool shadowsOffDueToMinRender;
|
||||||
|
|
||||||
|
std::vector<std::pair<ParticleSystem *, ResourceScope> > deferredParticleSystems;
|
||||||
|
|
||||||
SimpleTaskThread *saveScreenShotThread;
|
SimpleTaskThread *saveScreenShotThread;
|
||||||
Mutex saveScreenShotThreadAccessor;
|
Mutex saveScreenShotThreadAccessor;
|
||||||
std::list<std::pair<string,Pixmap2D *> > saveScreenQueue;
|
std::list<std::pair<string,Pixmap2D *> > saveScreenQueue;
|
||||||
@@ -387,6 +389,9 @@ public:
|
|||||||
static bool isEnded();
|
static bool isEnded();
|
||||||
//bool isMasterserverMode() const { return masterserverMode; }
|
//bool isMasterserverMode() const { return masterserverMode; }
|
||||||
|
|
||||||
|
void addToDeferredParticleSystemList(std::pair<ParticleSystem *, ResourceScope> deferredParticleSystem);
|
||||||
|
void manageDeferredParticleSystems();
|
||||||
|
|
||||||
void reinitAll();
|
void reinitAll();
|
||||||
|
|
||||||
//init
|
//init
|
||||||
|
@@ -3551,51 +3551,70 @@ void Unit::saveGame(XmlNode *rootNode) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
// vector<UnitParticleSystem*> unitParticleSystems;
|
// vector<UnitParticleSystem*> unitParticleSystems;
|
||||||
for(unsigned int i = 0; i < unitParticleSystems.size(); ++i) {
|
if(unitParticleSystems.size() > 0) {
|
||||||
UnitParticleSystem *ups= unitParticleSystems[i];
|
XmlNode *unitParticleSystemsNode = rootNode->addChild("unitParticleSystems");
|
||||||
if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
|
|
||||||
ups->saveGame(unitNode);
|
for(unsigned int i = 0; i < unitParticleSystems.size(); ++i) {
|
||||||
|
UnitParticleSystem *ups= unitParticleSystems[i];
|
||||||
|
if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
|
||||||
|
ups->saveGame(unitParticleSystemsNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// vector<UnitParticleSystemType*> queuedUnitParticleSystemTypes;
|
// vector<UnitParticleSystemType*> queuedUnitParticleSystemTypes;
|
||||||
for(unsigned int i = 0; i < queuedUnitParticleSystemTypes.size(); ++i) {
|
if(queuedUnitParticleSystemTypes.size() > 0) {
|
||||||
UnitParticleSystemType *upst= queuedUnitParticleSystemTypes[i];
|
XmlNode *queuedUnitParticleSystemTypesNode = rootNode->addChild("queuedUnitParticleSystemTypes");
|
||||||
if(upst != NULL) {
|
for(unsigned int i = 0; i < queuedUnitParticleSystemTypes.size(); ++i) {
|
||||||
upst->saveGame(unitNode);
|
UnitParticleSystemType *upst= queuedUnitParticleSystemTypes[i];
|
||||||
|
if(upst != NULL) {
|
||||||
|
upst->saveGame(queuedUnitParticleSystemTypesNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnitParticleSystems damageParticleSystems;
|
// UnitParticleSystems damageParticleSystems;
|
||||||
for(unsigned int i = 0; i < damageParticleSystems.size(); ++i) {
|
if(damageParticleSystems.size() > 0) {
|
||||||
UnitParticleSystem *ups= damageParticleSystems[i];
|
XmlNode *damageParticleSystemsNode = rootNode->addChild("damageParticleSystems");
|
||||||
if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
|
for(unsigned int i = 0; i < damageParticleSystems.size(); ++i) {
|
||||||
ups->saveGame(unitNode);
|
UnitParticleSystem *ups= damageParticleSystems[i];
|
||||||
|
if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
|
||||||
|
ups->saveGame(damageParticleSystemsNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::map<int, UnitParticleSystem *> damageParticleSystemsInUse;
|
// std::map<int, UnitParticleSystem *> damageParticleSystemsInUse;
|
||||||
for(std::map<int, UnitParticleSystem *>::const_iterator iterMap = damageParticleSystemsInUse.begin();
|
if(damageParticleSystemsInUse.size() > 0) {
|
||||||
iterMap != damageParticleSystemsInUse.end(); ++iterMap) {
|
XmlNode *damageParticleSystemsInUseNode = rootNode->addChild("damageParticleSystemsInUse");
|
||||||
if(iterMap->second != NULL && Renderer::getInstance().validateParticleSystemStillExists(iterMap->second,rsGame) == true) {
|
|
||||||
XmlNode *damageParticleSystemsInUseNode = unitNode->addChild("damageParticleSystemsInUse");
|
|
||||||
|
|
||||||
damageParticleSystemsInUseNode->addAttribute("key",intToStr(iterMap->first), mapTagReplacements);
|
for(std::map<int, UnitParticleSystem *>::const_iterator iterMap = damageParticleSystemsInUse.begin();
|
||||||
iterMap->second->saveGame(damageParticleSystemsInUseNode);
|
iterMap != damageParticleSystemsInUse.end(); ++iterMap) {
|
||||||
|
if(iterMap->second != NULL && Renderer::getInstance().validateParticleSystemStillExists(iterMap->second,rsGame) == true) {
|
||||||
|
XmlNode *damageParticleSystemsInUseNode2 = damageParticleSystemsInUseNode->addChild("damageParticleSystemsInUse");
|
||||||
|
|
||||||
|
damageParticleSystemsInUseNode2->addAttribute("key",intToStr(iterMap->first), mapTagReplacements);
|
||||||
|
iterMap->second->saveGame(damageParticleSystemsInUseNode2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vector<ParticleSystem*> fireParticleSystems;
|
// vector<ParticleSystem*> fireParticleSystems;
|
||||||
for(unsigned int i = 0; i < fireParticleSystems.size(); ++i) {
|
if(fireParticleSystems.size() > 0) {
|
||||||
ParticleSystem *ps= fireParticleSystems[i];
|
XmlNode *fireParticleSystemsNode = rootNode->addChild("fireParticleSystems");
|
||||||
if(ps != NULL && Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
for(unsigned int i = 0; i < fireParticleSystems.size(); ++i) {
|
||||||
ps->saveGame(unitNode);
|
ParticleSystem *ps= fireParticleSystems[i];
|
||||||
|
if(ps != NULL && Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
||||||
|
ps->saveGame(fireParticleSystemsNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vector<UnitParticleSystem*> smokeParticleSystems;
|
// vector<UnitParticleSystem*> smokeParticleSystems;
|
||||||
for(unsigned int i = 0; i < smokeParticleSystems.size(); ++i) {
|
if(smokeParticleSystems.size() > 0) {
|
||||||
UnitParticleSystem *ups= smokeParticleSystems[i];
|
XmlNode *smokeParticleSystemsNode = rootNode->addChild("smokeParticleSystems");
|
||||||
if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
|
for(unsigned int i = 0; i < smokeParticleSystems.size(); ++i) {
|
||||||
ups->saveGame(unitNode);
|
UnitParticleSystem *ups= smokeParticleSystems[i];
|
||||||
|
if(ups != NULL && Renderer::getInstance().validateParticleSystemStillExists(ups,rsGame) == true) {
|
||||||
|
ups->saveGame(smokeParticleSystemsNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3815,6 +3834,16 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||||||
// if(fire != NULL) {
|
// if(fire != NULL) {
|
||||||
// fire->saveGame(unitNode);
|
// fire->saveGame(unitNode);
|
||||||
// }
|
// }
|
||||||
|
if(unitNode->hasChild("FireParticleSystem") == true) {
|
||||||
|
XmlNode *fireNode = unitNode->getChild("FireParticleSystem");
|
||||||
|
result->fire = new FireParticleSystem();
|
||||||
|
result->fire->loadGame(fireNode);
|
||||||
|
result->fireParticleSystems.push_back(result->fire);
|
||||||
|
|
||||||
|
//Renderer::getInstance().manageParticleSystem(result->fire, rsGame);
|
||||||
|
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(result->fire, rsGame));
|
||||||
|
}
|
||||||
|
|
||||||
// TotalUpgrade totalUpgrade;
|
// TotalUpgrade totalUpgrade;
|
||||||
result->totalUpgrade.loadGame(unitNode);
|
result->totalUpgrade.loadGame(unitNode);
|
||||||
// Map *map;
|
// Map *map;
|
||||||
@@ -3847,6 +3876,20 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||||||
// UnitParticleSystem *ups= unitParticleSystems[i];
|
// UnitParticleSystem *ups= unitParticleSystems[i];
|
||||||
// ups->saveGame(unitNode);
|
// ups->saveGame(unitNode);
|
||||||
// }
|
// }
|
||||||
|
if(unitNode->hasChild("unitParticleSystems") == true) {
|
||||||
|
XmlNode *unitParticleSystemsNode = unitNode->getChild("unitParticleSystems");
|
||||||
|
vector<XmlNode *> unitParticleSystemNodeList = unitParticleSystemsNode->getChildList("UnitParticleSystem");
|
||||||
|
for(unsigned int i = 0; i < unitParticleSystemNodeList.size(); ++i) {
|
||||||
|
XmlNode *node = unitParticleSystemNodeList[i];
|
||||||
|
|
||||||
|
UnitParticleSystem *ups = new UnitParticleSystem();
|
||||||
|
ups->loadGame(node);
|
||||||
|
result->unitParticleSystems.push_back(ups);
|
||||||
|
|
||||||
|
//Renderer::getInstance().manageParticleSystem(result->fire, rsGame);
|
||||||
|
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// vector<UnitParticleSystemType*> queuedUnitParticleSystemTypes;
|
// vector<UnitParticleSystemType*> queuedUnitParticleSystemTypes;
|
||||||
// for(unsigned int i = 0; i < queuedUnitParticleSystemTypes.size(); ++i) {
|
// for(unsigned int i = 0; i < queuedUnitParticleSystemTypes.size(); ++i) {
|
||||||
@@ -3859,6 +3902,21 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||||||
// UnitParticleSystem *ups= damageParticleSystems[i];
|
// UnitParticleSystem *ups= damageParticleSystems[i];
|
||||||
// ups->saveGame(unitNode);
|
// ups->saveGame(unitNode);
|
||||||
// }
|
// }
|
||||||
|
if(unitNode->hasChild("damageParticleSystems") == true) {
|
||||||
|
XmlNode *damageParticleSystemsNode = unitNode->getChild("damageParticleSystems");
|
||||||
|
vector<XmlNode *> unitParticleSystemNodeList = damageParticleSystemsNode->getChildList("UnitParticleSystem");
|
||||||
|
for(unsigned int i = 0; i < unitParticleSystemNodeList.size(); ++i) {
|
||||||
|
XmlNode *node = unitParticleSystemNodeList[i];
|
||||||
|
|
||||||
|
UnitParticleSystem *ups = new UnitParticleSystem();
|
||||||
|
ups->loadGame(node);
|
||||||
|
result->damageParticleSystems.push_back(ups);
|
||||||
|
result->damageParticleSystemsInUse[i]=ups;
|
||||||
|
|
||||||
|
//Renderer::getInstance().manageParticleSystem(result->fire, rsGame);
|
||||||
|
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// std::map<int, UnitParticleSystem *> damageParticleSystemsInUse;
|
// std::map<int, UnitParticleSystem *> damageParticleSystemsInUse;
|
||||||
// for(std::map<int, UnitParticleSystem *>::const_iterator iterMap = damageParticleSystemsInUse.begin();
|
// for(std::map<int, UnitParticleSystem *>::const_iterator iterMap = damageParticleSystemsInUse.begin();
|
||||||
@@ -3868,17 +3926,65 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||||||
// damageParticleSystemsInUseNode->addAttribute("key",intToStr(iterMap->first), mapTagReplacements);
|
// damageParticleSystemsInUseNode->addAttribute("key",intToStr(iterMap->first), mapTagReplacements);
|
||||||
// iterMap->second->saveGame(damageParticleSystemsInUseNode);
|
// iterMap->second->saveGame(damageParticleSystemsInUseNode);
|
||||||
// }
|
// }
|
||||||
|
// if(unitNode->hasChild("damageParticleSystemsInUse") == true) {
|
||||||
|
// XmlNode *damageParticleSystemsInUseNode = unitNode->getChild("damageParticleSystemsInUse");
|
||||||
|
// vector<XmlNode *> damageParticleSystemsInUseNode2 = damageParticleSystemsInUseNode->getChildList("damageParticleSystemsInUse");
|
||||||
|
// for(unsigned int i = 0; i < damageParticleSystemsInUseNode2.size(); ++i) {
|
||||||
|
// XmlNode *d2Node = damageParticleSystemsInUseNode2[i];
|
||||||
|
//
|
||||||
|
// vector<XmlNode *> unitParticleSystemNodeList = damageParticleSystemsInUseNode->getChildList("UnitParticleSystem");
|
||||||
|
// for(unsigned int i = 0; i < unitParticleSystemNodeList.size(); ++i) {
|
||||||
|
// XmlNode *node = unitParticleSystemNodeList[i];
|
||||||
|
//
|
||||||
|
// UnitParticleSystem *ups = new UnitParticleSystem();
|
||||||
|
// ups->loadGame(node);
|
||||||
|
// result->unitParticleSystems.push_back(ups);
|
||||||
|
//
|
||||||
|
// //Renderer::getInstance().manageParticleSystem(result->fire, rsGame);
|
||||||
|
// Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
// vector<ParticleSystem*> fireParticleSystems;
|
// vector<ParticleSystem*> fireParticleSystems;
|
||||||
// for(unsigned int i = 0; i < fireParticleSystems.size(); ++i) {
|
// for(unsigned int i = 0; i < fireParticleSystems.size(); ++i) {
|
||||||
// ParticleSystem *ps= fireParticleSystems[i];
|
// ParticleSystem *ps= fireParticleSystems[i];
|
||||||
// ps->saveGame(unitNode);
|
// ps->saveGame(unitNode);
|
||||||
// }
|
// }
|
||||||
|
if(unitNode->hasChild("fireParticleSystems") == true) {
|
||||||
|
XmlNode *fireParticleSystemsNode = unitNode->getChild("fireParticleSystems");
|
||||||
|
vector<XmlNode *> unitParticleSystemNodeList = fireParticleSystemsNode->getChildList("FireParticleSystem");
|
||||||
|
for(unsigned int i = 0; i < unitParticleSystemNodeList.size(); ++i) {
|
||||||
|
XmlNode *node = unitParticleSystemNodeList[i];
|
||||||
|
|
||||||
|
FireParticleSystem *ups = new FireParticleSystem();
|
||||||
|
ups->loadGame(node);
|
||||||
|
result->fireParticleSystems.push_back(ups);
|
||||||
|
|
||||||
|
//Renderer::getInstance().manageParticleSystem(result->fire, rsGame);
|
||||||
|
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// vector<UnitParticleSystem*> smokeParticleSystems;
|
// vector<UnitParticleSystem*> smokeParticleSystems;
|
||||||
// for(unsigned int i = 0; i < smokeParticleSystems.size(); ++i) {
|
// for(unsigned int i = 0; i < smokeParticleSystems.size(); ++i) {
|
||||||
// UnitParticleSystem *ups= smokeParticleSystems[i];
|
// UnitParticleSystem *ups= smokeParticleSystems[i];
|
||||||
// ups->saveGame(unitNode);
|
// ups->saveGame(unitNode);
|
||||||
// }
|
// }
|
||||||
|
if(unitNode->hasChild("smokeParticleSystems") == true) {
|
||||||
|
XmlNode *smokeParticleSystemsNode = unitNode->getChild("smokeParticleSystems");
|
||||||
|
vector<XmlNode *> unitParticleSystemNodeList = smokeParticleSystemsNode->getChildList("UnitParticleSystem");
|
||||||
|
for(unsigned int i = 0; i < unitParticleSystemNodeList.size(); ++i) {
|
||||||
|
XmlNode *node = unitParticleSystemNodeList[i];
|
||||||
|
|
||||||
|
UnitParticleSystem *ups = new UnitParticleSystem();
|
||||||
|
ups->loadGame(node);
|
||||||
|
result->smokeParticleSystems.push_back(ups);
|
||||||
|
|
||||||
|
//Renderer::getInstance().manageParticleSystem(result->fire, rsGame);
|
||||||
|
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CardinalDir modelFacing;
|
// CardinalDir modelFacing;
|
||||||
// unitNode->addAttribute("modelFacing",intToStr(modelFacing), mapTagReplacements);
|
// unitNode->addAttribute("modelFacing",intToStr(modelFacing), mapTagReplacements);
|
||||||
|
@@ -124,7 +124,7 @@ protected:
|
|||||||
int aliveParticleCount;
|
int aliveParticleCount;
|
||||||
int particleCount;
|
int particleCount;
|
||||||
|
|
||||||
|
string textureFileLoadDeferred;
|
||||||
Texture *texture;
|
Texture *texture;
|
||||||
Vec3f pos;
|
Vec3f pos;
|
||||||
Vec4f color;
|
Vec4f color;
|
||||||
@@ -163,6 +163,7 @@ public:
|
|||||||
bool getActive() const {return active;}
|
bool getActive() const {return active;}
|
||||||
virtual bool getVisible() const {return visible;}
|
virtual bool getVisible() const {return visible;}
|
||||||
|
|
||||||
|
virtual string getTextureFileLoadDeferred();
|
||||||
//set
|
//set
|
||||||
virtual void setState(State state);
|
virtual void setState(State state);
|
||||||
void setTexture(Texture *texture);
|
void setTexture(Texture *texture);
|
||||||
@@ -259,6 +260,8 @@ public:
|
|||||||
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
virtual void render(ParticleRenderer *pr, ModelRenderer *mr);
|
||||||
float getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
float getTween() { return tween; } // 0.0 -> 1.0 for animation of model
|
||||||
Model *getModel() const {return model;}
|
Model *getModel() const {return model;}
|
||||||
|
virtual string getModelFileLoadDeferred();
|
||||||
|
|
||||||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||||
Vec3f getDirection() const {return direction;}
|
Vec3f getDirection() const {return direction;}
|
||||||
void setModelCycle(float modelCycle) {this->modelCycle= modelCycle;}
|
void setModelCycle(float modelCycle) {this->modelCycle= modelCycle;}
|
||||||
@@ -270,6 +273,8 @@ protected:
|
|||||||
typedef std::vector<UnitParticleSystem*> Children;
|
typedef std::vector<UnitParticleSystem*> Children;
|
||||||
Children children;
|
Children children;
|
||||||
Primitive primitive;
|
Primitive primitive;
|
||||||
|
|
||||||
|
string modelFileLoadDeferred;
|
||||||
Model *model;
|
Model *model;
|
||||||
float modelCycle;
|
float modelCycle;
|
||||||
Vec3f offset;
|
Vec3f offset;
|
||||||
@@ -375,7 +380,6 @@ public:
|
|||||||
|
|
||||||
virtual void saveGame(XmlNode *rootNode);
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
virtual void loadGame(const XmlNode *rootNode);
|
virtual void loadGame(const XmlNode *rootNode);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -428,7 +432,7 @@ public:
|
|||||||
/// Base class for Projectiles and Splashes
|
/// Base class for Projectiles and Splashes
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
class AttackParticleSystem: public GameParticleSystem{
|
class AttackParticleSystem: public GameParticleSystem {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float sizeNoEnergy;
|
float sizeNoEnergy;
|
||||||
@@ -442,6 +446,9 @@ public:
|
|||||||
void setGravity(float gravity) {this->gravity= gravity;}
|
void setGravity(float gravity) {this->gravity= gravity;}
|
||||||
|
|
||||||
virtual void initParticleSystem() {} // opportunity to do any initialization when the system has been created and all settings set
|
virtual void initParticleSystem() {} // opportunity to do any initialization when the system has been created and all settings set
|
||||||
|
|
||||||
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
|
virtual void loadGame(const XmlNode *rootNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -499,6 +506,9 @@ public:
|
|||||||
void setPath(Vec3f startPos, Vec3f endPos);
|
void setPath(Vec3f startPos, Vec3f endPos);
|
||||||
|
|
||||||
static Trajectory strToTrajectory(const string &str);
|
static Trajectory strToTrajectory(const string &str);
|
||||||
|
|
||||||
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
|
virtual void loadGame(const XmlNode *rootNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -535,6 +545,9 @@ public:
|
|||||||
void setVerticalSpreadB(float verticalSpreadB) {this->verticalSpreadB= verticalSpreadB;}
|
void setVerticalSpreadB(float verticalSpreadB) {this->verticalSpreadB= verticalSpreadB;}
|
||||||
void setHorizontalSpreadA(float horizontalSpreadA) {this->horizontalSpreadA= horizontalSpreadA;}
|
void setHorizontalSpreadA(float horizontalSpreadA) {this->horizontalSpreadA= horizontalSpreadA;}
|
||||||
void setHorizontalSpreadB(float horizontalSpreadB) {this->horizontalSpreadB= horizontalSpreadB;}
|
void setHorizontalSpreadB(float horizontalSpreadB) {this->horizontalSpreadB= horizontalSpreadB;}
|
||||||
|
|
||||||
|
virtual void saveGame(XmlNode *rootNode);
|
||||||
|
virtual void loadGame(const XmlNode *rootNode);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -282,6 +282,9 @@ void ParticleSystem::saveGame(XmlNode *rootNode) {
|
|||||||
particleSystemNode->addAttribute("particleCount",intToStr(particleCount), mapTagReplacements);
|
particleSystemNode->addAttribute("particleCount",intToStr(particleCount), mapTagReplacements);
|
||||||
//
|
//
|
||||||
// Texture *texture;
|
// Texture *texture;
|
||||||
|
if(texture != NULL) {
|
||||||
|
particleSystemNode->addAttribute("texture",texture->getPath(), mapTagReplacements);
|
||||||
|
}
|
||||||
// Vec3f pos;
|
// Vec3f pos;
|
||||||
particleSystemNode->addAttribute("pos",pos.getString(), mapTagReplacements);
|
particleSystemNode->addAttribute("pos",pos.getString(), mapTagReplacements);
|
||||||
// Vec4f color;
|
// Vec4f color;
|
||||||
@@ -316,6 +319,10 @@ void ParticleSystem::saveGame(XmlNode *rootNode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string ParticleSystem::getTextureFileLoadDeferred() {
|
||||||
|
return textureFileLoadDeferred;
|
||||||
|
}
|
||||||
|
|
||||||
void ParticleSystem::loadGame(const XmlNode *rootNode) {
|
void ParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
const XmlNode *particleSystemNode = rootNode->getChild("ParticleSystem");
|
const XmlNode *particleSystemNode = rootNode->getChild("ParticleSystem");
|
||||||
|
|
||||||
@@ -350,6 +357,10 @@ void ParticleSystem::loadGame(const XmlNode *rootNode) {
|
|||||||
particleCount = particleSystemNode->getAttribute("particleCount")->getIntValue();
|
particleCount = particleSystemNode->getAttribute("particleCount")->getIntValue();
|
||||||
//
|
//
|
||||||
// Texture *texture;
|
// Texture *texture;
|
||||||
|
if(particleSystemNode->hasAttribute("texture") == true) {
|
||||||
|
textureFileLoadDeferred = particleSystemNode->getAttribute("texture")->getValue();
|
||||||
|
}
|
||||||
|
|
||||||
// Vec3f pos;
|
// Vec3f pos;
|
||||||
pos = Vec3f::strToVec3(particleSystemNode->getAttribute("pos")->getValue());
|
pos = Vec3f::strToVec3(particleSystemNode->getAttribute("pos")->getValue());
|
||||||
// Vec4f color;
|
// Vec4f color;
|
||||||
@@ -719,6 +730,10 @@ void GameParticleSystem::setTween(float relative,float absolute) {
|
|||||||
(*it)->setTween(relative,absolute);
|
(*it)->setTween(relative,absolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string GameParticleSystem::getModelFileLoadDeferred() {
|
||||||
|
return modelFileLoadDeferred;
|
||||||
|
}
|
||||||
|
|
||||||
void GameParticleSystem::saveGame(XmlNode *rootNode) {
|
void GameParticleSystem::saveGame(XmlNode *rootNode) {
|
||||||
std::map<string,string> mapTagReplacements;
|
std::map<string,string> mapTagReplacements;
|
||||||
XmlNode *gameParticleSystemNode = rootNode->addChild("GameParticleSystem");
|
XmlNode *gameParticleSystemNode = rootNode->addChild("GameParticleSystem");
|
||||||
@@ -751,8 +766,6 @@ void GameParticleSystem::loadGame(const XmlNode *rootNode) {
|
|||||||
|
|
||||||
ParticleSystem::loadGame(gameParticleSystemNode);
|
ParticleSystem::loadGame(gameParticleSystemNode);
|
||||||
|
|
||||||
//radius = fireParticleSystemNode->getAttribute("radius")->getFloatValue();
|
|
||||||
|
|
||||||
// Children children;
|
// Children children;
|
||||||
// for(unsigned int i = 0; i < children.size(); ++i) {
|
// for(unsigned int i = 0; i < children.size(); ++i) {
|
||||||
// children[i]->saveGame(gameParticleSystemNode);
|
// children[i]->saveGame(gameParticleSystemNode);
|
||||||
@@ -764,7 +777,8 @@ void GameParticleSystem::loadGame(const XmlNode *rootNode) {
|
|||||||
UnitParticleSystem *ups = new UnitParticleSystem();
|
UnitParticleSystem *ups = new UnitParticleSystem();
|
||||||
ups->loadGame(node);
|
ups->loadGame(node);
|
||||||
|
|
||||||
children.push_back(ups);
|
//children.push_back(ups);
|
||||||
|
addChild(ups);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Primitive primitive;
|
// Primitive primitive;
|
||||||
@@ -773,6 +787,10 @@ void GameParticleSystem::loadGame(const XmlNode *rootNode) {
|
|||||||
//if(model != NULL) {
|
//if(model != NULL) {
|
||||||
// gameParticleSystemNode->addAttribute("model",model->getFileName(), mapTagReplacements);
|
// gameParticleSystemNode->addAttribute("model",model->getFileName(), mapTagReplacements);
|
||||||
//}
|
//}
|
||||||
|
if(gameParticleSystemNode->hasAttribute("model") == true) {
|
||||||
|
modelFileLoadDeferred = gameParticleSystemNode->getAttribute("model")->getValue();
|
||||||
|
}
|
||||||
|
|
||||||
// float modelCycle;
|
// float modelCycle;
|
||||||
//gameParticleSystemNode->addAttribute("modelCycle",floatToStr(modelCycle), mapTagReplacements);
|
//gameParticleSystemNode->addAttribute("modelCycle",floatToStr(modelCycle), mapTagReplacements);
|
||||||
modelCycle = gameParticleSystemNode->getAttribute("modelCycle")->getFloatValue();
|
modelCycle = gameParticleSystemNode->getAttribute("modelCycle")->getFloatValue();
|
||||||
@@ -790,9 +808,8 @@ void GameParticleSystem::loadGame(const XmlNode *rootNode) {
|
|||||||
bool UnitParticleSystem::isNight= false;
|
bool UnitParticleSystem::isNight= false;
|
||||||
Vec3f UnitParticleSystem::lightColor=Vec3f(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),
|
GameParticleSystem(particleCount), parent(NULL) {
|
||||||
parent(NULL){
|
|
||||||
radius= 0.5f;
|
radius= 0.5f;
|
||||||
speed= 0.01f;
|
speed= 0.01f;
|
||||||
windSpeed= Vec3f(0.0f);
|
windSpeed= Vec3f(0.0f);
|
||||||
@@ -1052,40 +1069,129 @@ void UnitParticleSystem::saveGame(XmlNode *rootNode) {
|
|||||||
|
|
||||||
GameParticleSystem::saveGame(unitParticleSystemNode);
|
GameParticleSystem::saveGame(unitParticleSystemNode);
|
||||||
|
|
||||||
//unitParticleSystemNode->addAttribute("radius",floatToStr(radius), mapTagReplacements);
|
|
||||||
|
|
||||||
// float radius;
|
// float radius;
|
||||||
|
unitParticleSystemNode->addAttribute("radius",floatToStr(radius), mapTagReplacements);
|
||||||
// float minRadius;
|
// float minRadius;
|
||||||
|
unitParticleSystemNode->addAttribute("minRadius",floatToStr(minRadius), mapTagReplacements);
|
||||||
// Vec3f windSpeed;
|
// Vec3f windSpeed;
|
||||||
|
unitParticleSystemNode->addAttribute("windSpeed",windSpeed.getString(), mapTagReplacements);
|
||||||
// Vec3f cRotation;
|
// Vec3f cRotation;
|
||||||
|
unitParticleSystemNode->addAttribute("cRotation",cRotation.getString(), mapTagReplacements);
|
||||||
// Vec3f fixedAddition;
|
// Vec3f fixedAddition;
|
||||||
|
unitParticleSystemNode->addAttribute("fixedAddition",fixedAddition.getString(), mapTagReplacements);
|
||||||
// Vec3f oldPosition;
|
// Vec3f oldPosition;
|
||||||
|
unitParticleSystemNode->addAttribute("oldPosition",oldPosition.getString(), mapTagReplacements);
|
||||||
// bool energyUp;
|
// bool energyUp;
|
||||||
|
unitParticleSystemNode->addAttribute("energyUp",intToStr(energyUp), mapTagReplacements);
|
||||||
// float startTime;
|
// float startTime;
|
||||||
|
unitParticleSystemNode->addAttribute("startTime",floatToStr(startTime), mapTagReplacements);
|
||||||
// float endTime;
|
// float endTime;
|
||||||
|
unitParticleSystemNode->addAttribute("endTime",floatToStr(endTime), mapTagReplacements);
|
||||||
// bool relative;
|
// bool relative;
|
||||||
|
unitParticleSystemNode->addAttribute("relative",intToStr(relative), mapTagReplacements);
|
||||||
// bool relativeDirection;
|
// bool relativeDirection;
|
||||||
|
unitParticleSystemNode->addAttribute("relativeDirection",intToStr(relativeDirection), mapTagReplacements);
|
||||||
// bool fixed;
|
// bool fixed;
|
||||||
|
unitParticleSystemNode->addAttribute("fixed",intToStr(fixed), mapTagReplacements);
|
||||||
// Shape shape;
|
// Shape shape;
|
||||||
|
unitParticleSystemNode->addAttribute("shape",intToStr(shape), mapTagReplacements);
|
||||||
// float angle;
|
// float angle;
|
||||||
|
unitParticleSystemNode->addAttribute("angle",floatToStr(angle), mapTagReplacements);
|
||||||
// float sizeNoEnergy;
|
// float sizeNoEnergy;
|
||||||
|
unitParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy), mapTagReplacements);
|
||||||
// float gravity;
|
// float gravity;
|
||||||
|
unitParticleSystemNode->addAttribute("gravity",floatToStr(gravity), mapTagReplacements);
|
||||||
// float rotation;
|
// float rotation;
|
||||||
|
unitParticleSystemNode->addAttribute("rotation",floatToStr(rotation), mapTagReplacements);
|
||||||
// bool isVisibleAtNight;
|
// bool isVisibleAtNight;
|
||||||
|
unitParticleSystemNode->addAttribute("isVisibleAtNight",intToStr(isVisibleAtNight), mapTagReplacements);
|
||||||
// bool isVisibleAtDay;
|
// bool isVisibleAtDay;
|
||||||
|
unitParticleSystemNode->addAttribute("isVisibleAtDay",intToStr(isVisibleAtDay), mapTagReplacements);
|
||||||
// bool isDaylightAffected;
|
// bool isDaylightAffected;
|
||||||
|
unitParticleSystemNode->addAttribute("isDaylightAffected",intToStr(isDaylightAffected), mapTagReplacements);
|
||||||
// bool radiusBasedStartenergy;
|
// bool radiusBasedStartenergy;
|
||||||
|
unitParticleSystemNode->addAttribute("radiusBasedStartenergy",intToStr(radiusBasedStartenergy), mapTagReplacements);
|
||||||
// int staticParticleCount;
|
// int staticParticleCount;
|
||||||
|
unitParticleSystemNode->addAttribute("staticParticleCount",intToStr(staticParticleCount), mapTagReplacements);
|
||||||
// int delay;
|
// int delay;
|
||||||
|
unitParticleSystemNode->addAttribute("delay",intToStr(delay), mapTagReplacements);
|
||||||
// int lifetime;
|
// int lifetime;
|
||||||
|
unitParticleSystemNode->addAttribute("lifetime",intToStr(lifetime), mapTagReplacements);
|
||||||
// float emissionRateFade;
|
// float emissionRateFade;
|
||||||
|
unitParticleSystemNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade), mapTagReplacements);
|
||||||
// GameParticleSystem* parent;
|
// GameParticleSystem* parent;
|
||||||
|
//if(parent != NULL) {
|
||||||
|
// parent->saveGame(unitParticleSystemNode);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitParticleSystem::loadGame(const XmlNode *rootNode) {
|
void UnitParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
const XmlNode *unitParticleSystemNode = rootNode;
|
const XmlNode *unitParticleSystemNode = rootNode;
|
||||||
|
|
||||||
GameParticleSystem::loadGame(unitParticleSystemNode);
|
GameParticleSystem::loadGame(unitParticleSystemNode);
|
||||||
|
|
||||||
|
// float radius;
|
||||||
|
radius = unitParticleSystemNode->getAttribute("radius")->getFloatValue();
|
||||||
|
// float minRadius;
|
||||||
|
minRadius = unitParticleSystemNode->getAttribute("minRadius")->getFloatValue();
|
||||||
|
// Vec3f windSpeed;
|
||||||
|
windSpeed = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("windSpeed")->getValue());
|
||||||
|
// Vec3f cRotation;
|
||||||
|
windSpeed = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("cRotation")->getValue());
|
||||||
|
// Vec3f fixedAddition;
|
||||||
|
fixedAddition = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("fixedAddition")->getValue());
|
||||||
|
// Vec3f oldPosition;
|
||||||
|
oldPosition = Vec3f::strToVec3(unitParticleSystemNode->getAttribute("oldPosition")->getValue());
|
||||||
|
// bool energyUp;
|
||||||
|
energyUp = unitParticleSystemNode->getAttribute("energyUp")->getIntValue();
|
||||||
|
// float startTime;
|
||||||
|
startTime = unitParticleSystemNode->getAttribute("startTime")->getFloatValue();
|
||||||
|
// float endTime;
|
||||||
|
endTime = unitParticleSystemNode->getAttribute("endTime")->getFloatValue();
|
||||||
|
// bool relative;
|
||||||
|
relative = unitParticleSystemNode->getAttribute("relative")->getIntValue();
|
||||||
|
// bool relativeDirection;
|
||||||
|
relativeDirection = unitParticleSystemNode->getAttribute("relativeDirection")->getIntValue();
|
||||||
|
// bool fixed;
|
||||||
|
fixed = unitParticleSystemNode->getAttribute("fixed")->getIntValue();
|
||||||
|
// Shape shape;
|
||||||
|
shape = static_cast<Shape>(unitParticleSystemNode->getAttribute("shape")->getIntValue());
|
||||||
|
// float angle;
|
||||||
|
angle = unitParticleSystemNode->getAttribute("angle")->getFloatValue();
|
||||||
|
// float sizeNoEnergy;
|
||||||
|
sizeNoEnergy = unitParticleSystemNode->getAttribute("sizeNoEnergy")->getFloatValue();
|
||||||
|
// float gravity;
|
||||||
|
gravity = unitParticleSystemNode->getAttribute("gravity")->getFloatValue();
|
||||||
|
// float rotation;
|
||||||
|
rotation = unitParticleSystemNode->getAttribute("rotation")->getFloatValue();
|
||||||
|
// bool isVisibleAtNight;
|
||||||
|
isVisibleAtNight = unitParticleSystemNode->getAttribute("isVisibleAtNight")->getIntValue();
|
||||||
|
// bool isVisibleAtDay;
|
||||||
|
isVisibleAtDay = unitParticleSystemNode->getAttribute("isVisibleAtDay")->getIntValue();
|
||||||
|
// bool isDaylightAffected;
|
||||||
|
isDaylightAffected = unitParticleSystemNode->getAttribute("isDaylightAffected")->getIntValue();
|
||||||
|
// bool radiusBasedStartenergy;
|
||||||
|
radiusBasedStartenergy = unitParticleSystemNode->getAttribute("radiusBasedStartenergy")->getIntValue();
|
||||||
|
// int staticParticleCount;
|
||||||
|
staticParticleCount = unitParticleSystemNode->getAttribute("staticParticleCount")->getIntValue();
|
||||||
|
// int delay;
|
||||||
|
delay = unitParticleSystemNode->getAttribute("delay")->getIntValue();
|
||||||
|
// int lifetime;
|
||||||
|
lifetime = unitParticleSystemNode->getAttribute("lifetime")->getIntValue();
|
||||||
|
// float emissionRateFade;
|
||||||
|
emissionRateFade = unitParticleSystemNode->getAttribute("emissionRateFade")->getFloatValue();
|
||||||
|
// GameParticleSystem* parent;
|
||||||
|
//if(parent != NULL) {
|
||||||
|
// parent->saveGame(unitParticleSystemNode);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//if(unitParticleSystemNode->hasChild("GameParticleSystem") == true) {
|
||||||
|
// void GameParticleSystem::saveGame(XmlNode *rootNode)
|
||||||
|
// std::map<string,string> mapTagReplacements;
|
||||||
|
// XmlNode *gameParticleSystemNode = rootNode->addChild("GameParticleSystem");
|
||||||
|
XmlNode *gameParticleSystemNode = unitParticleSystemNode->getChild("GameParticleSystem");
|
||||||
|
//!!!
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1204,6 +1310,29 @@ AttackParticleSystem::AttackParticleSystem(int particleCount) :
|
|||||||
gravity= 0.0f;
|
gravity= 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AttackParticleSystem::saveGame(XmlNode *rootNode) {
|
||||||
|
std::map<string,string> mapTagReplacements;
|
||||||
|
XmlNode *attackParticleSystemNode = rootNode->addChild("AttackParticleSystem");
|
||||||
|
|
||||||
|
GameParticleSystem::saveGame(attackParticleSystemNode);
|
||||||
|
|
||||||
|
// float sizeNoEnergy;
|
||||||
|
attackParticleSystemNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy), mapTagReplacements);
|
||||||
|
// float gravity;
|
||||||
|
attackParticleSystemNode->addAttribute("gravity",floatToStr(gravity), mapTagReplacements);
|
||||||
|
|
||||||
|
}
|
||||||
|
void AttackParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
|
const XmlNode *attackParticleSystemNode = rootNode;
|
||||||
|
|
||||||
|
GameParticleSystem::loadGame(attackParticleSystemNode);
|
||||||
|
|
||||||
|
// float sizeNoEnergy;
|
||||||
|
sizeNoEnergy = attackParticleSystemNode->getAttribute("sizeNoEnergy")->getFloatValue();
|
||||||
|
// float gravity;
|
||||||
|
gravity = attackParticleSystemNode->getAttribute("gravity")->getFloatValue();
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// ProjectileParticleSystem
|
// ProjectileParticleSystem
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1400,6 +1529,82 @@ ProjectileParticleSystem::Trajectory ProjectileParticleSystem::strToTrajectory(c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectileParticleSystem::saveGame(XmlNode *rootNode) {
|
||||||
|
std::map<string,string> mapTagReplacements;
|
||||||
|
XmlNode *projectileParticleSystemNode = rootNode->addChild("ProjectileParticleSystem");
|
||||||
|
|
||||||
|
AttackParticleSystem::saveGame(projectileParticleSystemNode);
|
||||||
|
|
||||||
|
// SplashParticleSystem *nextParticleSystem;
|
||||||
|
if(nextParticleSystem != NULL) {
|
||||||
|
nextParticleSystem->saveGame(projectileParticleSystemNode);
|
||||||
|
}
|
||||||
|
// Vec3f lastPos;
|
||||||
|
projectileParticleSystemNode->addAttribute("lastPos",lastPos.getString(), mapTagReplacements);
|
||||||
|
// Vec3f startPos;
|
||||||
|
projectileParticleSystemNode->addAttribute("startPos",startPos.getString(), mapTagReplacements);
|
||||||
|
// Vec3f endPos;
|
||||||
|
projectileParticleSystemNode->addAttribute("endPos",endPos.getString(), mapTagReplacements);
|
||||||
|
// Vec3f flatPos;
|
||||||
|
projectileParticleSystemNode->addAttribute("flatPos",flatPos.getString(), mapTagReplacements);
|
||||||
|
//
|
||||||
|
// Vec3f xVector;
|
||||||
|
projectileParticleSystemNode->addAttribute("xVector",xVector.getString(), mapTagReplacements);
|
||||||
|
// Vec3f yVector;
|
||||||
|
projectileParticleSystemNode->addAttribute("yVector",yVector.getString(), mapTagReplacements);
|
||||||
|
// Vec3f zVector;
|
||||||
|
projectileParticleSystemNode->addAttribute("zVector",zVector.getString(), mapTagReplacements);
|
||||||
|
// Trajectory trajectory;
|
||||||
|
projectileParticleSystemNode->addAttribute("trajectory",intToStr(trajectory), mapTagReplacements);
|
||||||
|
// float trajectorySpeed;
|
||||||
|
projectileParticleSystemNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed), mapTagReplacements);
|
||||||
|
// //parabolic
|
||||||
|
// float trajectoryScale;
|
||||||
|
projectileParticleSystemNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale), mapTagReplacements);
|
||||||
|
// float trajectoryFrequency;
|
||||||
|
projectileParticleSystemNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency), mapTagReplacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectileParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
|
const XmlNode *projectileParticleSystemNode = rootNode;
|
||||||
|
|
||||||
|
AttackParticleSystem::loadGame(projectileParticleSystemNode);
|
||||||
|
|
||||||
|
// SplashParticleSystem *nextParticleSystem;
|
||||||
|
// if(nextParticleSystem != NULL) {
|
||||||
|
// nextParticleSystem->saveGame(projectileParticleSystemNode);
|
||||||
|
// }
|
||||||
|
if(projectileParticleSystemNode->hasChild("SplashParticleSystem") == true) {
|
||||||
|
XmlNode *splashParticleSystemNode = projectileParticleSystemNode->getChild("SplashParticleSystem");
|
||||||
|
nextParticleSystem = new SplashParticleSystem();
|
||||||
|
nextParticleSystem->loadGame(splashParticleSystemNode);
|
||||||
|
}
|
||||||
|
// Vec3f lastPos;
|
||||||
|
lastPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("lastPos")->getValue());
|
||||||
|
// Vec3f startPos;
|
||||||
|
startPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("startPos")->getValue());
|
||||||
|
// Vec3f endPos;
|
||||||
|
endPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("endPos")->getValue());
|
||||||
|
// Vec3f flatPos;
|
||||||
|
flatPos = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("flatPos")->getValue());
|
||||||
|
//
|
||||||
|
// Vec3f xVector;
|
||||||
|
xVector = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("xVector")->getValue());
|
||||||
|
// Vec3f yVector;
|
||||||
|
yVector = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("yVector")->getValue());
|
||||||
|
// Vec3f zVector;
|
||||||
|
zVector = Vec3f::strToVec3(projectileParticleSystemNode->getAttribute("zVector")->getValue());
|
||||||
|
// Trajectory trajectory;
|
||||||
|
trajectory = static_cast<Trajectory>(projectileParticleSystemNode->getAttribute("trajectory")->getIntValue());
|
||||||
|
// float trajectorySpeed;
|
||||||
|
trajectorySpeed = projectileParticleSystemNode->getAttribute("trajectorySpeed")->getFloatValue();
|
||||||
|
// //parabolic
|
||||||
|
// float trajectoryScale;
|
||||||
|
trajectoryScale = projectileParticleSystemNode->getAttribute("trajectoryScale")->getFloatValue();
|
||||||
|
// float trajectoryFrequency;
|
||||||
|
trajectoryFrequency = projectileParticleSystemNode->getAttribute("trajectoryFrequency")->getFloatValue();
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// SplashParticleSystem
|
// SplashParticleSystem
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1473,6 +1678,61 @@ void SplashParticleSystem::updateParticle(Particle *p){
|
|||||||
p->size= particleSize * energyRatio + sizeNoEnergy * (1.0f - energyRatio);
|
p->size= particleSize * energyRatio + sizeNoEnergy * (1.0f - energyRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplashParticleSystem::saveGame(XmlNode *rootNode) {
|
||||||
|
std::map<string,string> mapTagReplacements;
|
||||||
|
XmlNode *splashParticleSystemNode = rootNode->addChild("SplashParticleSystem");
|
||||||
|
|
||||||
|
AttackParticleSystem::saveGame(splashParticleSystemNode);
|
||||||
|
|
||||||
|
// ProjectileParticleSystem *prevParticleSystem;
|
||||||
|
if(prevParticleSystem != NULL) {
|
||||||
|
prevParticleSystem->saveGame(splashParticleSystemNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// float emissionRateFade;
|
||||||
|
splashParticleSystemNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade), mapTagReplacements);
|
||||||
|
// float verticalSpreadA;
|
||||||
|
splashParticleSystemNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA), mapTagReplacements);
|
||||||
|
// float verticalSpreadB;
|
||||||
|
splashParticleSystemNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB), mapTagReplacements);
|
||||||
|
// float horizontalSpreadA;
|
||||||
|
splashParticleSystemNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA), mapTagReplacements);
|
||||||
|
// float horizontalSpreadB;
|
||||||
|
splashParticleSystemNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB), mapTagReplacements);
|
||||||
|
//
|
||||||
|
// float startEmissionRate;
|
||||||
|
splashParticleSystemNode->addAttribute("startEmissionRate",floatToStr(startEmissionRate), mapTagReplacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SplashParticleSystem::loadGame(const XmlNode *rootNode) {
|
||||||
|
const XmlNode *splashParticleSystemNode = rootNode;
|
||||||
|
|
||||||
|
AttackParticleSystem::loadGame(splashParticleSystemNode);
|
||||||
|
|
||||||
|
// ProjectileParticleSystem *prevParticleSystem;
|
||||||
|
// if(nextParticleSystem != NULL) {
|
||||||
|
// nextParticleSystem->saveGame(projectileParticleSystemNode);
|
||||||
|
// }
|
||||||
|
if(splashParticleSystemNode->hasChild("ProjectileParticleSystem") == true) {
|
||||||
|
XmlNode *projectileParticleSystemNode = splashParticleSystemNode->getChild("ProjectileParticleSystem");
|
||||||
|
prevParticleSystem = new ProjectileParticleSystem();
|
||||||
|
prevParticleSystem->loadGame(projectileParticleSystemNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// float emissionRateFade;
|
||||||
|
emissionRateFade = splashParticleSystemNode->getAttribute("emissionRateFade")->getFloatValue();
|
||||||
|
// float verticalSpreadA;
|
||||||
|
verticalSpreadA = splashParticleSystemNode->getAttribute("verticalSpreadA")->getFloatValue();
|
||||||
|
// float verticalSpreadB;
|
||||||
|
verticalSpreadB = splashParticleSystemNode->getAttribute("verticalSpreadB")->getFloatValue();
|
||||||
|
// float horizontalSpreadA;
|
||||||
|
horizontalSpreadA = splashParticleSystemNode->getAttribute("horizontalSpreadA")->getFloatValue();
|
||||||
|
// float horizontalSpreadB;
|
||||||
|
horizontalSpreadB = splashParticleSystemNode->getAttribute("horizontalSpreadB")->getFloatValue();
|
||||||
|
// float startEmissionRate;
|
||||||
|
startEmissionRate = splashParticleSystemNode->getAttribute("startEmissionRate")->getFloatValue();
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// ParticleManager
|
// ParticleManager
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
Reference in New Issue
Block a user