Revision: 1626
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1626&view=rev
Author: rorthomas
Date: 2011-02-01 00:35:57 +0000 (Tue, 01 Feb 2011)
Log Message:
-----------
fixed several std::<> erase bugs throughout the code
cleaned up configurator, sumed up particle settings
enabled dashboard all the time
added rtshader option in configurator (under advanced) (experimental, crashes
cache sometimes)
fixed no-sound problem after cache run: it removed all default sounds as well
...
improved scopelog a bit, so it logs to old and new log file at the same time
Modified Paths:
--------------
trunk/source/configurator/configurator.cpp
trunk/source/main/Beam.cpp
trunk/source/main/BeamFactory.cpp
trunk/source/main/CacheSystem.cpp
trunk/source/main/DustManager.cpp
trunk/source/main/InputEngine.cpp
trunk/source/main/MapControl.cpp
trunk/source/main/NetworkStreamManager.cpp
trunk/source/main/RigsOfRods.cpp
trunk/source/main/RoRFrameListener.cpp
trunk/source/main/ScopeLog.cpp
trunk/source/main/ScopeLog.h
trunk/source/main/SoundScriptManager.cpp
trunk/source/main/SoundScriptManager.h
trunk/source/main/luasystem.cpp
Modified: trunk/source/configurator/configurator.cpp
===================================================================
--- trunk/source/configurator/configurator.cpp 2011-01-31 20:57:43 UTC (rev
1625)
+++ trunk/source/configurator/configurator.cpp 2011-02-01 00:35:57 UTC (rev
1626)
@@ -284,15 +284,13 @@
wxSlider *sightrange;
wxSlider *simpleSlider;
wxSlider *simpleSlider2;
- wxCheckBox *smoke;
wxCheckBox *replaymode;
wxCheckBox *dtm;
wxCheckBox *dcm;
- wxCheckBox *dust;
- wxCheckBox *spray;
- wxCheckBox *cpart;
+ wxCheckBox *particles;
wxCheckBox *heathaze;
wxCheckBox *hydrax;
+ wxCheckBox *rtshader;
wxCheckBox *dismap;
wxCheckBox *leds;
wxCheckBox *enablexfire;
@@ -300,7 +298,6 @@
wxCheckBox *autodl;
wxCheckBox *posstor;
wxCheckBox *extcam;
- wxCheckBox *dashboard;
wxCheckBox *mirror;
wxCheckBox *envmap;
wxCheckBox *sunburn;
@@ -1767,8 +1764,6 @@
waves=new wxCheckBox(graphicsPanel, -1, _("Enable waves"),
wxPoint(x_row1, y+3));
waves->SetToolTip(_("Enabling waves adds a lot of fun in boats, but can
have a big performance impact on some specific hardwares."));
- spray=new wxCheckBox(graphicsPanel, -1, _("Water spray"),
wxPoint(x_row2, y+3));
- spray->SetToolTip(_("No effect unless you mess with water, looks pretty
good also."));
y+=25;
dText = new wxStaticText(graphicsPanel, -1, _("Vegetation:"),
wxPoint(10, y+3));
@@ -1781,22 +1776,15 @@
y+=25;
dText = new wxStaticText(graphicsPanel, -1, _("Particle systems:"),
wxPoint(10, y));
- dust=new wxCheckBox(graphicsPanel, -1, _("Dust"), wxPoint(x_row1, y));
- dust->SetToolTip(_("This may hurt framerate a bit on old systems, but
it looks pretty good."));
+ particles=new wxCheckBox(graphicsPanel, -1, _("Enable Particle
Systems"), wxPoint(x_row1, y));
+ particles->SetToolTip(_("This may hurt framerate a bit on old systems,
but it looks pretty good."));
heathaze=new wxCheckBox(graphicsPanel, -1, _("HeatHaze"),
wxPoint(x_row2, y));
heathaze->SetToolTip(_("Heat Haze from engines, major slowdown. (only
activate with recent hardware)"));
- y+=15;
- smoke=new wxCheckBox(graphicsPanel, -1, _("Engine smoke"),
wxPoint(x_row1, y));
- smoke->SetToolTip(_("Not much impact on speed."));
- cpart=new wxCheckBox(graphicsPanel, -1, _("Custom Particles"),
wxPoint(x_row2, y));
- cpart->SetToolTip(_("Particles like water cannons or plain trails. Can
be over-used in Multiplayer."));
y+=25;
dText = new wxStaticText(graphicsPanel, -1, _("Cockpit options:"),
wxPoint(10, y));
mirror=new wxCheckBox(graphicsPanel, -1, _("Mirrors"), wxPoint(x_row1,
y));
mirror->SetToolTip(_("Shows the rear view mirrors in 1st person view.
May cause compatibility problems for very old video cards."));
- dashboard=new wxCheckBox(graphicsPanel, -1, _("Dashboard"),
wxPoint(x_row2, y));
- dashboard->SetToolTip(_("Shows the dynamic dashboard in 1st person
view. May cause compatibility problems for very old video cards."));
y+=25;
dText = new wxStaticText(graphicsPanel, -1, _("Visual effects:"),
wxPoint(10, y));
@@ -1824,8 +1812,8 @@
screenShotFormat->SetToolTip(_("In what Format should screenshots be
saved?"));
//sounds panel
- dText = new wxStaticText(soundsPanel, -1, _("Sound source:"),
wxPoint(20,28));
- sound=new wxChoice(soundsPanel, -1, wxPoint(150, 25), wxSize(-1, -1),
0);
+ dText = new wxStaticText(soundsPanel, -1, _("Sound source:"),
wxPoint(5,28));
+ sound=new wxChoice(soundsPanel, -1, wxPoint(100, 25), wxSize(350, -1),
0);
sound->Append(conv("No sound"));
sound->Append(conv("Default"));
sound->SetToolTip(_("Select the appropriate sound source.\nLeaving to
Default should work most of the time."));
@@ -2012,7 +2000,10 @@
y+=15;
hydrax=new wxCheckBox(advancedPanel, -1, _("Hydrax Water System"),
wxPoint(320, y));
hydrax->SetToolTip(_("Enables the new water rendering system.
EXPERIMENTAL. Overrides any water settings."));
- y+=30;
+ y+=15;
+ rtshader=new wxCheckBox(advancedPanel, -1, _("RT Shader System"),
wxPoint(320, y));
+ rtshader->SetToolTip(_("Enables the Runtime Shader generation System.
EXPERIMENTAL"));
+ y+=15;
dtm=new wxCheckBox(advancedPanel, -1, _("Debug Truck Mass"),
wxPoint(320, y));
dtm->SetToolTip(_("Prints all node masses to the RoR.log. Only use for
truck debugging!"));
y+=15;
@@ -2436,17 +2427,13 @@
screenShotFormat->SetSelection(0);
gearBoxMode->SetSelection(0);
- smoke->SetValue(true);
replaymode->SetValue(false);
dtm->SetValue(false);
dcm->SetValue(false);
//wxCheckBox *dust;
- dust->SetValue(false);
- //wxCheckBox *spray;
- spray->SetValue(false);
- cpart->SetValue(true);
heathaze->SetValue(false);
hydrax->SetValue(false);
+ rtshader->SetValue(false);
dismap->SetValue(false);
if(leds) leds->SetValue(false);
if(enablexfire) enablexfire->SetValue(true);
@@ -2454,8 +2441,6 @@
posstor->SetValue(true);
beamdebug->SetValue(false);
extcam->SetValue(false);
- //wxCheckBox *dashboard;
- dashboard->SetValue(true);
//wxCheckBox *mirror;
mirror->SetValue(false);
envmap->SetValue(false);
@@ -2507,15 +2492,13 @@
settings["Water effects"] = conv(water->GetStringSelection());
settings["Waves"] = (waves->GetValue()) ? "Yes" : "No";
- settings["Engine smoke"] = (smoke->GetValue()) ? "Yes" : "No";
settings["Replay mode"] = (replaymode->GetValue()) ? "Yes" : "No";
settings["Debug Truck Mass"] = (dtm->GetValue()) ? "Yes" : "No";
settings["Debug Collisions"] = (dcm->GetValue()) ? "Yes" : "No";
- settings["Dust"] = (dust->GetValue()) ? "Yes" : "No";
- settings["Spray"] = (spray->GetValue()) ? "Yes" : "No";
- settings["Custom Particles"] = (cpart->GetValue()) ? "Yes" : "No";
+ settings["Particles"] = (particles->GetValue()) ? "Yes" : "No";
settings["HeatHaze"] = (heathaze->GetValue()) ? "Yes" : "No";
settings["Hydrax"] = (hydrax->GetValue()) ? "Yes" : "No";
+ settings["Use RTShader System"] = (rtshader->GetValue()) ? "Yes" : "No";
settings["disableOverViewMap"] = (dismap->GetValue()) ? "Yes" : "No";
if(leds) { settings["Logitech LEDs"] = (leds->GetValue()) ? "Yes" :
"No"; };
settings["DebugBeams"] = (beamdebug->GetValue()) ? "Yes" : "No";
@@ -2524,7 +2507,6 @@
settings["Position Storage"] = (posstor->GetValue()) ? "Yes" : "No";
settings["GearboxMode"]= conv(gearBoxMode->GetStringSelection());
settings["External Camera Mode"] = (extcam->GetValue()) ? "Static" :
"Pitching";
- settings["Dashboard"] = (dashboard->GetValue()) ? "Yes" : "No";
settings["Mirrors"] = (mirror->GetValue()) ? "Yes" : "No";
settings["Envmap"] = (envmap->GetValue()) ? "Yes" : "No";
settings["Sunburn"] = (sunburn->GetValue()) ? "Yes" : "No";
@@ -2600,16 +2582,14 @@
st = settings["Shadow optimizations"]; if (st.length()>0)
shadowOptimizations->SetValue(st=="Yes");
st = settings["Water effects"]; if (st.length()>0)
water->SetStringSelection(conv(st));
st = settings["Waves"]; if (st.length()>0) waves->SetValue(st=="Yes");
- st = settings["Engine smoke"]; if (st.length()>0)
smoke->SetValue(st=="Yes");
st = settings["Replay mode"]; if (st.length()>0)
replaymode->SetValue(st=="Yes");
st = settings["Debug Truck Mass"]; if (st.length()>0)
dtm->SetValue(st=="Yes");
st = settings["Debug Collisions"]; if (st.length()>0)
dcm->SetValue(st=="Yes");
st = settings["GearboxMode"]; if (st.length()>0)
gearBoxMode->SetStringSelection(conv(st));
- st = settings["Dust"]; if (st.length()>0) dust->SetValue(st=="Yes");
- st = settings["Spray"]; if (st.length()>0) spray->SetValue(st=="Yes");
- st = settings["Custom Particles"]; if (st.length()>0)
cpart->SetValue(st=="Yes");
+ st = settings["Particles"]; if (st.length()>0)
particles->SetValue(st=="Yes");
st = settings["HeatHaze"]; if (st.length()>0)
heathaze->SetValue(st=="Yes");
st = settings["Hydrax"]; if (st.length()>0) hydrax->SetValue(st=="Yes");
+ st = settings["Use RTShader System"]; if (st.length()>0)
rtshader->SetValue(st=="Yes");
st = settings["disableOverViewMap"]; if (st.length()>0)
dismap->SetValue(st=="Yes");
if(leds) { st = settings["Logitech LEDs"]; if (st.length()>0)
leds->SetValue(st=="Yes"); };
st = settings["External Camera Mode"]; if (st.length()>0)
extcam->SetValue(st=="Static");
@@ -2617,7 +2597,6 @@
st = settings["Position Storage"]; if (st.length()>0)
posstor->SetValue(st=="Yes");
st = settings["DebugBeams"]; if (st.length()>0)
beamdebug->SetValue(st=="Yes");
if(enablexfire) { st = settings["XFire"]; if (st.length()>0)
enablexfire->SetValue(st=="Yes"); };
- st = settings["Dashboard"]; if (st.length()>0)
dashboard->SetValue(st=="Yes");
st = settings["Mirrors"]; if (st.length()>0)
mirror->SetValue(st=="Yes");
st = settings["Creak Sound"]; if (st.length()>0)
creaksound->SetValue(st=="No");
st = settings["Envmap"]; if (st.length()>0) envmap->SetValue(st=="Yes");
@@ -3639,6 +3618,7 @@
// these are graphics simple settings
// 0 (high perf) - 2 (high quality)
heathaze->SetValue(false);
+ rtshader->SetValue(false);
switch(val)
{
case 0:
@@ -3654,13 +3634,9 @@
enableFog->SetValue(true);
sightrange->SetValue(20);
screenShotFormat->SetSelection(0);
- smoke->SetValue(false);
- dust->SetValue(false);
- spray->SetValue(false);
- cpart->SetValue(false);
+ particles->SetValue(false);
hydrax->SetValue(false);
dismap->SetValue(false);
- dashboard->SetValue(false);
mirror->SetValue(false);
envmap->SetValue(false);
sunburn->SetValue(false);
@@ -3681,13 +3657,9 @@
enableFog->SetValue(true);
sightrange->SetValue(60);
screenShotFormat->SetSelection(1);
- smoke->SetValue(true);
- dust->SetValue(true);
- spray->SetValue(true);
- cpart->SetValue(true);
+ particles->SetValue(true);
hydrax->SetValue(false);
dismap->SetValue(false);
- dashboard->SetValue(true);
mirror->SetValue(true);
envmap->SetValue(true);
sunburn->SetValue(false);
@@ -3708,13 +3680,9 @@
enableFog->SetValue(false);
sightrange->SetValue(130);
screenShotFormat->SetSelection(1);
- smoke->SetValue(true);
- dust->SetValue(true);
- spray->SetValue(true);
- cpart->SetValue(true);
+ particles->SetValue(true);
hydrax->SetValue(false);
dismap->SetValue(false);
- dashboard->SetValue(true);
mirror->SetValue(true);
envmap->SetValue(true);
sunburn->SetValue(false);
Modified: trunk/source/main/Beam.cpp
===================================================================
--- trunk/source/main/Beam.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/Beam.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -631,7 +631,7 @@
splashp = DustManager::getSingleton().getDustPool("splash");
ripplep = DustManager::getSingleton().getDustPool("ripple");
- disable_smoke=(SETTINGS.getSetting("Engine smoke")=="No");
+ disable_smoke=(SETTINGS.getSetting("Particles")!="Yes");
heathaze=(SETTINGS.getSetting("HeatHaze")=="Yes");
if(heathaze && disable_smoke)
//no heathaze without smoke!
@@ -642,7 +642,7 @@
enable_wheel2=(SETTINGS.getSetting("Enhanced wheels")=="Yes");
if (networked || networking) enable_wheel2=false;
- cparticle_enabled=(SETTINGS.getSetting("Custom Particles")=="Yes");
+ cparticle_enabled=(SETTINGS.getSetting("Particles")=="Yes");
if(strnlen(fname,200) > 0)
if(loadTruck(fname, manager, parent, px, py, pz, rot, spawnbox))
return;
Modified: trunk/source/main/BeamFactory.cpp
===================================================================
--- trunk/source/main/BeamFactory.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/BeamFactory.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -65,7 +65,7 @@
delete it2->second;
it2->second = 0;
- it1->second.erase(it2);
+ it2 = it1->second.erase(it2);
UNLOCKSTREAMS();
return 0;
}
Modified: trunk/source/main/CacheSystem.cpp
===================================================================
--- trunk/source/main/CacheSystem.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/CacheSystem.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -28,6 +28,7 @@
#include "rormemory.h"
#include "SoundScriptManager.h"
#include "BeamData.h" // for authorinfo_t
+#include "ScopeLog.h"
#ifdef USE_MYGUI
#include "LoadingWindow.h"
@@ -139,7 +140,7 @@
{
#ifdef USE_OPENAL
SoundScriptManager *ssm =
SoundScriptManager::getSingleton();
- if(ssm) ssm->clearTemplates();
+ if(ssm) ssm->clearNonBaseTemplates();
#endif //OPENAL
// we cannot fix this problem below Ogre
version 1.7
//ParticleSystemManager::getSingleton().removeTemplatesByResourceGroup(*it);
@@ -2663,6 +2664,7 @@
return true;
if(t.type == "FileSystem" || t.type == "Zip")
{
+ //ScopeLog log("cache_"+t.fname);
try
{
rgcountera++;
@@ -2731,7 +2733,7 @@
#ifdef USE_OPENAL
SoundScriptManager *ssm =
SoundScriptManager::getSingleton();
- if(ssm) ssm->clearTemplates();
+ if(ssm) ssm->clearNonBaseTemplates();
#endif //OPENAL
//ParticleSystemManager::getSingleton().removeTemplatesByResourceGroup(rgname);
ResourceGroupManager::getSingleton().clearResourceGroup(rgname);
@@ -2758,6 +2760,15 @@
void CacheSystem::loadSingleZip(String zippath, int cfactor, bool unload, bool
ownGroup)
{
+
+ /*
+ // good for debugging:
+ String outfn;
+ String outpath;
+ StringUtil::splitFilename(zippath, outfn, outpath);
+ ScopeLog log("cache_loadzip_"+outfn);
+ */
+
String realzipPath = getRealPath(zippath);
char hash[255];
memset(hash, 0, 255);
@@ -2801,7 +2812,7 @@
LogManager::getSingleton().logMessage("Unloading " +
realzipPath);
#ifdef USE_OPENAL
SoundScriptManager *ssm =
SoundScriptManager::getSingleton();
- if(ssm) ssm->clearTemplates();
+ if(ssm) ssm->clearNonBaseTemplates();
#endif //OPENAL
//ParticleSystemManager::getSingleton().removeTemplatesByResourceGroup(rgname);
rgm.removeResourceLocation(realzipPath, rgname);
Modified: trunk/source/main/DustManager.cpp
===================================================================
--- trunk/source/main/DustManager.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/DustManager.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -43,17 +43,14 @@
DustManager::DustManager(Ogre::SceneManager *mSceneMgr) :
mSceneMgr(mSceneMgr), mEnabled(false)
{
- mEnabled = (SETTINGS.getSetting("Dust") == "Yes");
+ mEnabled = (SETTINGS.getSetting("Particles") == "Yes");
- if (SETTINGS.getSetting("Dust")=="Yes")
+ if (mEnabled)
{
dustpools["dust"] = new DustPool((char *)"tracks/Dust", 20,
mSceneMgr->getRootSceneNode(), mSceneMgr, w);
dustpools["clump"] = new DustPool((char *)"tracks/Clump", 20,
mSceneMgr->getRootSceneNode(), mSceneMgr, w);
dustpools["sparks"] = new DustPool((char *)"tracks/Sparks", 10,
mSceneMgr->getRootSceneNode(), mSceneMgr, w);
- }
- if (SETTINGS.getSetting("Spray")=="Yes")
- {
dustpools["drip"] = new DustPool((char *)"tracks/Drip", 50,
mSceneMgr->getRootSceneNode(), mSceneMgr, w);
dustpools["splash"] = new DustPool((char *)"tracks/Splash", 20,
mSceneMgr->getRootSceneNode(), mSceneMgr, w);
dustpools["ripple"] = new DustPool((char *)"tracks/Ripple", 20,
mSceneMgr->getRootSceneNode(), mSceneMgr, w);
Modified: trunk/source/main/InputEngine.cpp
===================================================================
--- trunk/source/main/InputEngine.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/InputEngine.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -2100,7 +2100,7 @@
{
if(b->suid == suid)
{
- a->second.erase(b);
+ b = a->second.erase(b);
return true;
}
}
Modified: trunk/source/main/MapControl.cpp
===================================================================
--- trunk/source/main/MapControl.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/MapControl.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -100,7 +100,7 @@
{
// found it, erase!
delete *it;
- mMapEntities.erase(it);
+ it = mMapEntities.erase(it);
return;
}
}
Modified: trunk/source/main/NetworkStreamManager.cpp
===================================================================
--- trunk/source/main/NetworkStreamManager.cpp 2011-01-31 20:57:43 UTC (rev
1625)
+++ trunk/source/main/NetworkStreamManager.cpp 2011-02-01 00:35:57 UTC (rev
1626)
@@ -113,7 +113,7 @@
{
if(it->first == sourceid && (int)it2->first == streamid)
{
- streams[it->first].erase(it2);
+ it2 = streams[it->first].erase(it2);
// iterator gets invalid!
deleted=true;
break;
Modified: trunk/source/main/RigsOfRods.cpp
===================================================================
--- trunk/source/main/RigsOfRods.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/RigsOfRods.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -21,6 +21,7 @@
#include "OgreLineStreamOverlayElement.h"
#include "language.h"
#include "errorutils.h"
+#include "SoundScriptManager.h"
#include <OgreHeaderPrefix.h>
@@ -200,6 +201,10 @@
loadMainResource("icons");
// optional ones
+
+ // sound iss a bit special as we mark the base sounds so we dont clear
them accidentially later on
+ SoundScriptManager *ssm = SoundScriptManager::getSingleton();
+ if(ssm) ssm->setLoadingBaseSounds(true);
if (SETTINGS.getSetting("3D Sound renderer") != "No sound")
loadMainResource("sounds");
@@ -304,7 +309,8 @@
vp->setBackgroundColour(ColourValue(0,0,0));
// create RTShader System (after creating the viewport)
- initRTShaderSystem();
+ if (SETTINGS.getSetting("Use RTShader System")=="Yes")
+ initRTShaderSystem();
// Set default mipmap level (NB some APIs ignore this)
TextureManager::getSingleton().setDefaultNumMipmaps(5);
@@ -342,6 +348,8 @@
LogManager::getSingleton().logMessage("catched error while
initializing Resource groups: " + e.getFullDescription());
}
+ if(ssm) ssm->setLoadingBaseSounds(false);
+
//rgm.initialiseResourceGroup(ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
#ifndef NOLANG
Modified: trunk/source/main/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/RoRFrameListener.cpp 2011-01-31 20:57:43 UTC (rev
1625)
+++ trunk/source/main/RoRFrameListener.cpp 2011-02-01 00:35:57 UTC (rev
1626)
@@ -2007,10 +2007,12 @@
{
char mat[255]="";
sscanf(ptline, "generateMaterialShaders %s", mat);
+ if (SETTINGS.getSetting("Use RTShader System")=="Yes")
+ {
+
Ogre::RTShader::ShaderGenerator::getSingleton().createShaderBasedTechnique(String(mat),
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
+
Ogre::RTShader::ShaderGenerator::getSingleton().invalidateMaterial(RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
String(mat));
+ }
-
Ogre::RTShader::ShaderGenerator::getSingleton().createShaderBasedTechnique(String(mat),
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
-
Ogre::RTShader::ShaderGenerator::getSingleton().invalidateMaterial(RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
String(mat));
-
continue;
}
if (!strncmp("playanimation", ptline, 13))
@@ -5583,19 +5585,12 @@
BeamFactory::getSingleton().mmirror0 = mirror;
//dashboard
- if(SETTINGS.getSetting("Dashboard")=="Yes")
+ // always enabled
{
dashboard = new Dashboard(mSceneMgr,mWindow);
}
- else
- {
- //we must do something to fix the texture mapping
- MaterialPtr mat =
MaterialManager::getSingleton().getByName("renderdash");
-
mat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("virtualdashboard.dds");
- }
-
//setup heightfinder
float wheight=0.0;
if (w) wheight=w->getHeight()-30.0;
@@ -8137,6 +8132,7 @@
bool RoRFrameListener::RTSSgenerateShadersForMaterial(Ogre::String
curMaterialName, Ogre::String normalTextureName)
{
+ if (SETTINGS.getSetting("Use RTShader System")!="Yes") return false;
bool success;
// Create the shader based technique of this material.
@@ -8218,6 +8214,7 @@
void RoRFrameListener::RTSSgenerateShaders(Entity* entity, Ogre::String
normalTextureName)
{
+ if (SETTINGS.getSetting("Use RTShader System")!="Yes") return;
for (unsigned int i=0; i < entity->getNumSubEntities(); ++i)
{
SubEntity* curSubEntity = entity->getSubEntity(i);
Modified: trunk/source/main/ScopeLog.cpp
===================================================================
--- trunk/source/main/ScopeLog.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/ScopeLog.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -1,3 +1,23 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005,2006,2007,2008,2009 Pierre-Michel Ricordel
+Copyright 2007,2008,2009 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
+*/
+
#include "ScopeLog.h"
#include "Ogre.h"
#include "Settings.h"
@@ -10,26 +30,41 @@
ScopeLog::ScopeLog(String name) : orgLog(0), logFileName()
{
- if(SETTINGS.getSetting("Custom Logs") != "Yes") return;
+ // get original log file
orgLog = LogManager::getSingleton().getDefaultLog();
- logFileName = SETTINGS.getSetting("Log Path") +
SETTINGS.getSetting("dirsep") + name + ".log";
- LogManager::getSingleton().createLog(logFileName, true);
+ // determine a filename
+ logFileName = SETTINGS.getSetting("Log Path") +
SETTINGS.getSetting("dirsep") + "_" + name + ".log";
+
+ // create a new log file
+ ourLog = LogManager::getSingleton().createLog(logFileName); // do not
replace the default
+ ourLog->setLogDetail(orgLog->getLogDetail());
+
+ // add self as listener
+ orgLog->addListener(this);
}
ScopeLog::~ScopeLog()
{
- if(orgLog)
+ // remove self as listener
+ orgLog->removeListener(this);
+
+ // destroy our log
+ LogManager::getSingleton().destroyLog(ourLog);
+
+ // if the new log file is empty, remove it.
+ if(getFileSize(logFileName) == 0)
{
- LogManager::getSingleton().setDefaultLog(orgLog);
- if(getFileSize(logFileName) == 0)
- {
- // if the file is empty, remove it.
- remove(logFileName.c_str());
- }
+ remove(logFileName.c_str());
}
}
+void ScopeLog::messageLogged(const String &message, LogMessageLevel lml, bool
maskDebug, const String &logName)
+{
+ // passtrough to our log
+ ourLog->logMessage(message, lml, maskDebug);
+}
+
int ScopeLog::getFileSize(String filename)
{
FILE *f = fopen(filename.c_str(), "rb");
Modified: trunk/source/main/ScopeLog.h
===================================================================
--- trunk/source/main/ScopeLog.h 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/ScopeLog.h 2011-02-01 00:35:57 UTC (rev 1626)
@@ -1,18 +1,42 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005,2006,2007,2008,2009 Pierre-Michel Ricordel
+Copyright 2007,2008,2009 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
+*/
+
#ifndef SCOPELOG_H
#define SCOPELOG_H
-#include "OgrePrerequisites.h"
+#include <OgrePrerequisites.h>
+#include <OgreLog.h>
/**
* @brief: this class will change the default log with the scope of its
creation.
* Upon scope leaving, the previous default Log is restored.
*/
-class ScopeLog
+class ScopeLog : Ogre::LogListener
{
protected:
Ogre::Log *orgLog;
+ Ogre::Log *ourLog;
Ogre::String logFileName;
int getFileSize(Ogre::String filename);
+ void messageLogged(const Ogre::String &message, Ogre::LogMessageLevel
lml, bool maskDebug, const Ogre::String &logName);
+
public:
ScopeLog(Ogre::String filename);
~ScopeLog();
Modified: trunk/source/main/SoundScriptManager.cpp
===================================================================
--- trunk/source/main/SoundScriptManager.cpp 2011-01-31 20:57:43 UTC (rev
1625)
+++ trunk/source/main/SoundScriptManager.cpp 2011-02-01 00:35:57 UTC (rev
1626)
@@ -37,6 +37,7 @@
singleton=this;
instance_counter=0;
maxDistance=500.0;
+ loadingBase=false;
rolloffFactor=1.0;
referenceDistance=7.5;
for (int i=0; i<SS_MAX_TRIG; i++) free_trigs[i]=0;
@@ -156,7 +157,7 @@
return NULL;
}
- SoundScriptTemplate *ssi = new SoundScriptTemplate(name, groupname,
filename);
+ SoundScriptTemplate *ssi = new SoundScriptTemplate(name, groupname,
filename, loadingBase);
templates[name] = ssi;
return ssi;
}
@@ -164,16 +165,26 @@
void SoundScriptManager::unloadResourceGroup(String groupname)
{
//first, search if there is a template name collision
- for(std::map<Ogre::String, SoundScriptTemplate*>::iterator it =
templates.begin(); it!=templates.end();)
+ for(std::map<Ogre::String, SoundScriptTemplate*>::iterator it =
templates.begin(); it!=templates.end();it++)
if (it->second->groupname == groupname)
- templates.erase(it++);
- else
- ++it;
+ it = templates.erase(it);
}
-void SoundScriptManager::clearTemplates()
+void SoundScriptManager::clearNonBaseTemplates()
{
- templates.clear();
+ int counter = 0;
+ for(std::map<Ogre::String, SoundScriptTemplate*>::iterator it =
templates.begin(); it!=templates.end();it++)
+ {
+ if (it->second && !it->second->baseTemplate)
+ {
+ delete(it->second);
+ it->second=0;
+ it = templates.erase(it);
+ counter++;
+ }
+ }
+ if(counter>0)
+ LogManager::getSingleton().logMessage("SoundScriptManager:
removed " + StringConverter::toString(counter) + " non-base templates");
}
SoundScriptInstance* SoundScriptManager::createInstance(Ogre::String
templatename, int truck, Ogre::SceneNode *toAttach)
@@ -293,7 +304,7 @@
//=====================================================================
-SoundScriptTemplate::SoundScriptTemplate(String name, String groupname, String
filename)
+SoundScriptTemplate::SoundScriptTemplate(String name, String groupname, String
filename, bool _baseTemplate)
{
this->name=name;
this->groupname=groupname;
@@ -313,6 +324,7 @@
gain_multiplier=1;
gain_square=0;
gain_offset=0;
+ baseTemplate = _baseTemplate;
}
SoundScriptTemplate::~SoundScriptTemplate()
Modified: trunk/source/main/SoundScriptManager.h
===================================================================
--- trunk/source/main/SoundScriptManager.h 2011-01-31 20:57:43 UTC (rev
1625)
+++ trunk/source/main/SoundScriptManager.h 2011-02-01 00:35:57 UTC (rev
1626)
@@ -121,7 +121,7 @@
class SoundScriptTemplate : public MemoryAllocatedObject
{
public:
- SoundScriptTemplate(String name, String groupname, String filename);
+ SoundScriptTemplate(String name, String groupname, String filename,
bool baseTemplate);
bool setParameter(StringVector vec);
~SoundScriptTemplate();
@@ -149,6 +149,7 @@
int free_sound;
float sound_pitches[MAX_SOUNDS_PER_SCRIPT];
String sound_names[MAX_SOUNDS_PER_SCRIPT];
+ bool baseTemplate;
};
class SoundScriptInstance : public MemoryAllocatedObject
@@ -188,7 +189,7 @@
SoundScriptInstance* createInstance(String templatename, int truck,
SceneNode *toAttach);
void unloadResourceGroup(String groupname);
- void clearTemplates();
+ void clearNonBaseTemplates();
//values update
void trigOnce(int truck, int trig);
@@ -200,6 +201,7 @@
void soundEnable(bool state);
void setCamera(Vector3 position, Vector3 direction, Vector3 up, Vector3
velocity);
+ void setLoadingBaseSounds(bool v) { loadingBase = v; };
float maxDistance;
float rolloffFactor;
@@ -207,6 +209,7 @@
private:
StringVector mScriptPatterns;
int instance_counter;
+ bool loadingBase;
std::map <Ogre::String, SoundScriptTemplate*> templates;
Modified: trunk/source/main/luasystem.cpp
===================================================================
--- trunk/source/main/luasystem.cpp 2011-01-31 20:57:43 UTC (rev 1625)
+++ trunk/source/main/luasystem.cpp 2011-02-01 00:35:57 UTC (rev 1626)
@@ -291,7 +291,7 @@
if(!strncmp(c->c_str(), luafunction, 255))
{
Ogre::LogManager::getSingleton().logMessage("LUA unregistering callback:
"+String(type)+" to "+String(luafunction));
- framestepCallbacks.erase(c);
+ c = framestepCallbacks.erase(c);
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel