Option to switch on/off tileset particles

This commit is contained in:
Titus Tscharntke 2011-03-06 13:11:22 +00:00
parent d75fbe51f6
commit 273ab4c502
5 changed files with 21 additions and 4 deletions

View File

@ -208,7 +208,17 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
checkBoxUnitParticles.registerGraphicComponent(containerName,"checkBoxUnitParticles");
checkBoxUnitParticles.init(currentColumnStart,currentLine);
checkBoxUnitParticles.setValue(config.getBool("UnitParticles"));
checkBoxUnitParticles.setValue(config.getBool("UnitParticles","true"));
currentLine-=30;
//tileset particles
labelTilesetParticles.registerGraphicComponent(containerName,"labelTilesetParticles");
labelTilesetParticles.init(currentLabelStart,currentLine);
labelTilesetParticles.setText(lang.get("ShowTilesetParticles"));
checkBoxTilesetParticles.registerGraphicComponent(containerName,"checkBoxTilesetParticles");
checkBoxTilesetParticles.init(currentColumnStart,currentLine);
checkBoxTilesetParticles.setValue(config.getBool("TilesetParticles","true"));
currentLine-=30;
//unit particles
@ -511,6 +521,7 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
listBoxFilter.mouseClick(x, y);
checkBoxTextures3D.mouseClick(x, y);
checkBoxUnitParticles.mouseClick(x, y);
checkBoxTilesetParticles.mouseClick(x, y);
checkBoxMapPreview.mouseClick(x, y);
listBoxLights.mouseClick(x, y);
listBoxSoundFactory.mouseClick(x, y);
@ -558,6 +569,7 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
listBoxShadows.mouseMove(x, y);
checkBoxTextures3D.mouseMove(x, y);
checkBoxUnitParticles.mouseMove(x, y);
checkBoxTilesetParticles.mouseMove(x, y);
checkBoxMapPreview.mouseMove(x, y);
listBoxLights.mouseMove(x, y);
listBoxScreenModes.mouseMove(x, y);
@ -631,6 +643,7 @@ void MenuStateOptions::render(){
renderer.renderListBox(&listBoxShadows);
renderer.renderCheckBox(&checkBoxTextures3D);
renderer.renderCheckBox(&checkBoxUnitParticles);
renderer.renderCheckBox(&checkBoxTilesetParticles);
renderer.renderCheckBox(&checkBoxMapPreview);
renderer.renderListBox(&listBoxLights);
renderer.renderListBox(&listBoxFilter);
@ -644,6 +657,7 @@ void MenuStateOptions::render(){
renderer.renderLabel(&labelShadows);
renderer.renderLabel(&labelTextures3D);
renderer.renderLabel(&labelUnitParticles);
renderer.renderLabel(&labelTilesetParticles);
renderer.renderLabel(&labelMapPreview);
renderer.renderLabel(&labelLights);
renderer.renderLabel(&labelFilter);
@ -705,6 +719,7 @@ void MenuStateOptions::saveConfig(){
config.setString("Filter", listBoxFilter.getSelectedItem());
config.setBool("Textures3D", checkBoxTextures3D.getValue());
config.setBool("UnitParticles", (checkBoxUnitParticles.getValue()));
config.setBool("TilesetParticles", (checkBoxTilesetParticles.getValue()));
config.setBool("MapPreview", checkBoxMapPreview.getValue());
config.setInt("MaxLights", listBoxLights.getSelectedItemIndex()+1);
config.setString("FactorySound", listBoxSoundFactory.getSelectedItem());

View File

@ -36,6 +36,7 @@ private:
GraphicLabel labelTextures3D;
GraphicLabel labelLights;
GraphicLabel labelUnitParticles;
GraphicLabel labelTilesetParticles;
GraphicLabel labelSoundFactory;
GraphicLabel labelVolumeFx;
GraphicLabel labelVolumeAmbient;
@ -46,6 +47,7 @@ private:
GraphicCheckBox checkBoxTextures3D;
GraphicListBox listBoxLights;
GraphicCheckBox checkBoxUnitParticles;
GraphicCheckBox checkBoxTilesetParticles;
GraphicListBox listBoxSoundFactory;
GraphicListBox listBoxVolumeFx;
GraphicListBox listBoxVolumeAmbient;

View File

@ -69,7 +69,7 @@ void Object::initParticles(){
if(this->objectType==NULL) return;
if(this->objectType->hasParticles()){
ObjectParticleSystemTypes *particleTypes= this->objectType->getObjectParticleSystemTypes(variation);
if(Config::getInstance().getBool("UnitParticles") && (particleTypes->empty() == false)
if(Config::getInstance().getBool("TilesetParticles","true") && (particleTypes->empty() == false)
&& (unitParticleSystems.empty() == true)){
for(ObjectParticleSystemTypes::const_iterator it= particleTypes->begin(); it != particleTypes->end(); ++it){
UnitParticleSystem *ups= new UnitParticleSystem(200);

View File

@ -234,7 +234,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
setModelFacing(placeFacing);
Config &config= Config::getInstance();
showUnitParticles= config.getBool("UnitParticles");
showUnitParticles= config.getBool("UnitParticles","true");
lastPos= pos;
progress= 0;

View File

@ -50,7 +50,7 @@ World::World(){
Config &config= Config::getInstance();
staggeredFactionUpdates = config.getBool("StaggeredFactionUpdates","false");
unitParticlesEnabled=config.getBool("UnitParticles");
unitParticlesEnabled=config.getBool("UnitParticles","true");
ExploredCellsLookupItemCache.clear();
ExploredCellsLookupItemCacheTimer.clear();