mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 07:31:21 +02:00
- bugfixes to g3dviewer when loading a unit with particles from commandline (fixes recursive call crash), and added verbose commandline switch for g3dviewer
This commit is contained in:
@@ -105,6 +105,7 @@ const wxChar *GAME_ARGS[] = {
|
||||
wxT("--rotate-x-value"),
|
||||
wxT("--rotate-y-value"),
|
||||
wxT("--screenshot-format"),
|
||||
wxT("--verbose"),
|
||||
};
|
||||
|
||||
enum GAME_ARG_TYPE {
|
||||
@@ -121,6 +122,7 @@ enum GAME_ARG_TYPE {
|
||||
GAME_ARG_ROTATE_X_VALUE,
|
||||
GAME_ARG_ROTATE_Y_VALUE,
|
||||
GAME_ARG_SCREENSHOT_FORMAT,
|
||||
GAME_ARG_VERBOSE,
|
||||
};
|
||||
|
||||
bool hasCommandArgument(int argc, wxChar** argv,const string argName,
|
||||
@@ -1273,15 +1275,19 @@ void MainWindow::loadParticle(string path) {
|
||||
//int height = -1;
|
||||
|
||||
if(fileExists(unitXML) == true) {
|
||||
|
||||
int size = 0;
|
||||
int height= 0;
|
||||
{
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(unitXML,Properties::getTagReplacementValues());
|
||||
const XmlNode *unitNode= xmlTree.getRootNode();
|
||||
const XmlNode *parametersNode= unitNode->getChild("parameters");
|
||||
//size
|
||||
int size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
||||
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
||||
//height
|
||||
int height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||
|
||||
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||
}
|
||||
|
||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||
|
||||
@@ -1326,6 +1332,8 @@ void MainWindow::loadParticle(string path) {
|
||||
}
|
||||
|
||||
void MainWindow::loadProjectileParticle(string path) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleProjectilePathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleProjectilePathList.size());
|
||||
|
||||
if(timer) timer->Stop();
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->end();
|
||||
@@ -1345,7 +1353,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||
|
||||
try {
|
||||
if(this->particleProjectilePathList.empty() == false) {
|
||||
printf("this->particleProjectilePathList.size() = %lu\n",this->particleProjectilePathList.size());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("this->particleProjectilePathList.size() = %lu\n",this->particleProjectilePathList.size());
|
||||
|
||||
string titlestring=winHeader;
|
||||
for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) {
|
||||
@@ -1366,6 +1374,8 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||
int height = -1;
|
||||
|
||||
if(fileExists(unitXML) == true) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,unitXML.c_str(),idx);
|
||||
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(unitXML,Properties::getTagReplacementValues());
|
||||
const XmlNode *unitNode= xmlTree.getRootNode();
|
||||
@@ -1378,18 +1388,21 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||
|
||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||
|
||||
string particleFile = dir + folderDelimiter + particlePath;
|
||||
{
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(particleFile,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
||||
projectileParticleSystemType->load(NULL, dir, //### we don't know if there are overrides in the unit XML
|
||||
dir + folderDelimiter + particlePath,renderer, loadedFileList,
|
||||
particleFile,renderer, loadedFileList,
|
||||
"g3dviewer","");
|
||||
|
||||
// std::cout << "Values loaded, about to read..." << std::endl;
|
||||
@@ -1415,6 +1428,8 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||
ps->setVisible(true);
|
||||
renderer->manageParticleSystem(ps);
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loaded [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||
}
|
||||
SetTitle(ToUnicode(titlestring));
|
||||
|
||||
@@ -1431,9 +1446,12 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||
wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest projectile particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal();
|
||||
}
|
||||
if(timer) timer->Start(100);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str());
|
||||
}
|
||||
|
||||
void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSplash::load (and own list...)
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleSplashPathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size());
|
||||
|
||||
if(timer) timer->Stop();
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->end();
|
||||
@@ -1484,11 +1502,12 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||
|
||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
{
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
}
|
||||
|
||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||
ParticleSystemTypeSplash *splashParticleSystemType= new ParticleSystemTypeSplash();
|
||||
@@ -1534,6 +1553,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||
wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest projectile particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal();
|
||||
}
|
||||
if(timer) timer->Start(100);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s] particleSplashPathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size());
|
||||
}
|
||||
|
||||
void MainWindow::onMenuModeNormals(wxCommandEvent &event){
|
||||
@@ -2008,6 +2028,10 @@ bool App::OnInit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_VERBOSE])) == true) {
|
||||
SystemFlags::VERBOSE_MODE_ENABLED = true;
|
||||
}
|
||||
|
||||
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_AUTO_SCREENSHOT])) == true) {
|
||||
autoScreenShotAndExit = true;
|
||||
|
||||
|
Reference in New Issue
Block a user