Revision: 2698
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2698&view=rev
Author:   rorthomas
Date:     2012-05-26 04:37:52 +0000 (Sat, 26 May 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gameplay/RoRFrameListener.h
    trunk/source/main/gameplay/SceneMouse.cpp

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-26 04:30:36 UTC 
(rev 2697)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-26 04:37:52 UTC 
(rev 2698)
@@ -42,7 +42,6 @@
 #include "DashBoardManager.h"
 #include "DepthOfFieldEffect.h"
 #include "DustManager.h"
-#include "editor.h"
 #include "envmap.h"
 #include "errorutils.h"
 #include "ExtinguishableFireAffector.h"
@@ -96,6 +95,8 @@
 #include "MapEntity.h"
 #endif //USE_MYGUI
 
+#include "IHeightFinder.h"
+
 #include "ResourceBuffer.h"
 
 #ifdef USE_PAGED
@@ -111,10 +112,6 @@
 #include "mplatform_fd.h"
 #endif //USE_MPLATFORM
 
-#ifdef HAS_EDITOR
-#include "truckeditor.h"
-#endif //HAS_EDITOR
-
 #ifdef FEAT_TIMING
 #include "BeamStats.h"
 #endif //FEAT_TIMING
@@ -143,35 +140,17 @@
 using namespace Forests;
 #endif //USE_PAGED
 
-float RoRFrameListener::gravity = DEFAULT_GRAVITY;
-
-/// This class just pretends to provide procedural page content to avoid page 
loading
-class DummyPageProvider : public PageProvider
-{
-public:
-       bool prepareProceduralPage(Page* page, PagedWorldSection* section) { 
return true; }
-       bool loadProceduralPage(Page* page, PagedWorldSection* section) { 
return true; }
-       bool unloadProceduralPage(Page* page, PagedWorldSection* section) { 
return true; }
-       bool unprepareProceduralPage(Page* page, PagedWorldSection* section) { 
return true; }
-};
-DummyPageProvider mDummyPageProvider;
-
 Material *terrainmaterial = 0;
 
 char terrainoriginalmaterial[100];
 bool shutdownall=false;
 
-// static height finder
-HeightFinder *RoRFrameListener::hfinder = 0;
-// static elf singleton
-RoRFrameListener *RoRFrameListener::eflsingleton = 0;
-
 //workaround for pagedgeometry
 inline float getTerrainHeight(Ogre::Real x, Ogre::Real z, void *unused=0)
 {
-       if (!RoRFrameListener::hfinder)
+       if (!gEnv->heightFinder)
                return 1;
-       return RoRFrameListener::hfinder->getHeightAt(x, z);
+       return gEnv->heightFinder->getHeightAt(x, z);
 }
 
 void RoRFrameListener::startTimer()
@@ -297,23 +276,6 @@
                //TRUCK
                if (!curr_truck->engine) return;
 
-               //special case for the editor
-               if (curr_truck->editorId>=0 && editor)
-               {
-                       ow->editor_pos->setCaption("Position: X=" +
-                               
TOSTRING(curr_truck->nodes[curr_truck->editorId].AbsPosition.x)+
-                               "  
Y="+TOSTRING(curr_truck->nodes[curr_truck->editorId].AbsPosition.y)+
-                               "  
Z="+TOSTRING(curr_truck->nodes[curr_truck->editorId].AbsPosition.z)
-                               );
-                       ow->editor_angles->setCaption("Angles: 0.0 " +
-                               TOSTRING(editor->pturn)+
-                               "  "+TOSTRING(editor->ppitch)
-                               );
-                       char type[256];
-                       sprintf(type, "Object: %s", editor->curtype);
-                       ow->editor_object->setCaption(type);
-               }
-
                // gears
                int truck_getgear = curr_truck->engine->getGear();
                if (truck_getgear>0)
@@ -734,8 +696,6 @@
        dashboard(0),
        debugCollisions(false),
        dof(0),
-       editor(0),
-       editorfd(0),
        envmap(0),
        flaresMode(3), // on by default
        forcefeedback(0),
@@ -856,9 +816,6 @@
        ScriptEngine::getSingleton().scriptLog->logMessage("ScriptEngine 
running");
 #endif
 
-#ifdef HAS_EDITOR
-       trucked = 0;
-#endif
 
        gameStartTime = getTimeStamp();
 
@@ -1672,30 +1629,6 @@
 
                                if (curr_truck->driveable==TRUCK)
                                {
-                                       //road construction stuff
-                                       if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_SELECTROAD, 0.5f) && 
curr_truck->editorId>=0 && !curr_truck->replaymode)
-                                       {
-                                               if (road)
-                                                       
road->reset(curr_truck->nodes[curr_truck->editorId].AbsPosition);
-                                               else
-                                                       road=new 
Road(mSceneMgr, curr_truck->nodes[curr_truck->editorId].AbsPosition);
-                                       }
-
-                                       //editor stuff
-                                       if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_TOGGLEOBJECT) && 
curr_truck->editorId>=0 && !curr_truck->replaymode)
-                                       {
-                                               if (editor)
-                                                       editor->toggleType();
-                                               else
-                                                       editor=new 
Editor(mSceneMgr, this);
-                                       }
-
-                                       //this should not be there
-                                       if (editor && curr_truck->editorId>=0)
-                                       {
-                                               
editor->setPos(curr_truck->nodes[curr_truck->editorId].AbsPosition);
-                                       }
-
                                        if (!curr_truck->replaymode)
                                        {
                                                if 
(INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_LEFT_MIRROR_LEFT))
@@ -1710,86 +1643,6 @@
                                                if 
(INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_RIGHT_MIRROR_RIGHT))
                                                        
curr_truck->rightMirrorAngle+=0.001;
 
-                                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_ROTATELEFT, 0.1f))
-                                               {
-                                                       float value = 0.5;
-                                                       if 
(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT)) value = 4;
-                                                       if (road) 
{road->dturn(+value);}
-                                                       else if (editor) 
{editor->dturn(+1);}
-                                               }
-
-                                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_ROTATERIGHT, 0.1f))
-                                               {
-                                                       float value = 0.5;
-                                                       if 
(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || 
INPUTENGINE.isKeyDown(OIS::KC_RSHIFT)) value = 4;
-                                                       if (road) 
{road->dturn(-value);}
-                                                       else if (editor) 
{editor->dturn(-1);}
-                                               }
-
-                                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_PITCHBACKWARD, 0.1f))
-                                               {
-                                                       float value = 0.5;
-                                                       if 
(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || INPUTENGINE.isKeyDown(OIS::KC_RSHIFT))
-                                                               value = 4;
-                                                       if (road) 
{road->dpitch(-value);}
-                                                       else if (editor) 
{editor->dpitch(-1);}
-                                               }
-
-                                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_PITCHFOREWARD, 0.1f))
-                                               {
-                                                       float value = 0.5;
-                                                       if 
(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || INPUTENGINE.isKeyDown(OIS::KC_RSHIFT))
-                                                       value = 4;
-                                                       if (road) {road-> 
dpitch(value);}
-                                                       else if (editor) 
{editor->dpitch(1);}
-                                               }
-
-                                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_TOGGLEROADTYPE, 0.5f))
-                                               {
-                                                       if (road)
-                                                               
road->toggleType();
-                                               }
-
-                                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TERRAINEDITOR_BUILT, 0.5f))
-                                               {
-                                                       if (road)
-                                                       {
-                                                               if (!editorfd)
-                                                               {
-                                                                       String 
editorfn = SSETTING("Log Path", "") + "editor_out.txt";
-                                                                       
editorfd = fopen(editorfn.c_str(), "a");
-                                                                       
fprintf(editorfd, " ==== new session\n");
-                                                               }
-                                                               road->append();
-                                                               
fprintf(editorfd, "%f, %f, %f, %f, %f, %f, %s\n", road->rpos.x, road->rpos.y, 
road->rpos.z, road->rrot.x, road->rrot.y, road->rrot.z, road->curtype);
-                                                               
LOG(TOSTRING(road->rpos.x)+", "+
-                                                                       
TOSTRING(road->rpos.y)+", "+
-                                                                       
TOSTRING(road->rpos.z)+", "+
-                                                                       
TOSTRING(road->rrot.x)+", "+
-                                                                       
TOSTRING(road->rrot.y)+", "+
-                                                                       
TOSTRING(road->rrot.z)+", "+road->curtype);
-
-                                                               
loadObject(road->curtype, road->rpos.x, road->rpos.y, road->rpos.z, 
road->rrot.x, road->rrot.y, road->rrot.z, 0, "generic");
-                                                       }
-
-                                                       if (editor)
-                                                       {
-                                                               if (!editorfd)
-                                                               {
-                                                                       String 
editorfn = SSETTING("Log Path", "") + "editor_out.txt";
-                                                                       
editorfd = fopen(editorfn.c_str(), "a");
-                                                                       
fprintf(editorfd, " ==== new session\n");
-                                                               }
-                                                               
fprintf(editorfd, "%f, %f, %f, %f, %f, %f, %s\n", editor->ppos.x, 
editor->ppos.y, editor->ppos.z, 0.0, editor->pturn, editor->ppitch, 
editor->curtype);
-                                                               
LOG(TOSTRING(editor->ppos.x)+", "+
-                                                                       
TOSTRING(editor->ppos.y)+", "+
-                                                                       
TOSTRING(editor->ppos.z)+", "+
-                                                                       
TOSTRING(0)+", "+
-                                                                       
TOSTRING(editor->pturn)+", "+
-                                                                       
TOSTRING(editor->ppitch)+", "+editor->curtype);
-                                                               
loadObject(editor->curtype, editor->ppos.x, editor->ppos.y, editor->ppos.z, 0, 
editor->pturn, editor->ppitch, 0, "generic", false);
-                                                       }
-                                               }
                                        } // end of (!curr_truck->replaymode) 
block
 
                                        if (!curr_truck->replaymode)
@@ -2899,11 +2752,8 @@
        //update window
        if (!mWindow->isAutoUpdated())
        {
-#ifdef HAS_EDITOR
-               if ((trucked && trucked->dirty)||dirty) 
{trucked->dirty=false;mWindow->update();}
-#else
-               if (dirty) {mWindow->update();}
-#endif
+               if (dirty)
+                       mWindow->update();
                else
                        sleepMilliSeconds(10);
        }
@@ -2931,7 +2781,6 @@
 #endif //OIS_G27
 
        LOG(" ** Shutdown final");
-       if (editorfd) fclose(editorfd);
        if (w) w->prepareShutdown();
        if (dashboard) dashboard->prepareShutdown();
        if (envmap) envmap->prepareShutdown();
@@ -3215,7 +3064,6 @@
                        //person->setVisible(true);
                }
                if (ow) ow->showDashboardOverlays(false, currentTruck);
-               if (ow) ow->showEditorOverlay(false);
 #ifdef USE_OPENAL
                SoundScriptManager::getSingleton().trigStop(previousTruck, 
SS_TRIG_AIR);
                SoundScriptManager::getSingleton().trigStop(previousTruck, 
SS_TRIG_PUMP);
@@ -3242,7 +3090,6 @@
                if (ow &&!hidegui)
                {
                        ow->showDashboardOverlays(true, currentTruck);
-                       ow->showEditorOverlay(currentTruck->editorId>=0);
                }
 
                currentTruck->activate();
@@ -3670,7 +3517,6 @@
        if (visible)
        {
                if (ow) ow->showDashboardOverlays(false, curr_truck);
-               if (ow) ow->showEditorOverlay(false);
                if (ow) ow->truckhud->show(false);
                //if (bigMap) bigMap->setVisibility(false);
 #ifdef USE_MYGUI

Modified: trunk/source/main/gameplay/RoRFrameListener.h
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.h       2012-05-26 04:30:36 UTC 
(rev 2697)
+++ trunk/source/main/gameplay/RoRFrameListener.h       2012-05-26 04:37:52 UTC 
(rev 2698)
@@ -102,10 +102,6 @@
        Forests::TreeLoader2D *treeLoader;
 #endif //USE_PAGED
 
-#ifdef HAS_EDITOR
-       TruckEditor *trucked;
-#endif //HAS_EDITOR
-
 #ifdef USE_MPLATFORM
        MPlatform_Base *mplatform;
 #endif //USE_MPLATFORM
@@ -117,8 +113,6 @@
        AppState *parentState;
        Dashboard *dashboard;
        DOFManager *dof;
-       Editor *editor;
-       FILE *editorfd;
        ForceFeedback *forcefeedback;
        HeatHaze *heathaze;
        MapControl *surveyMap;

Modified: trunk/source/main/gameplay/SceneMouse.cpp
===================================================================
--- trunk/source/main/gameplay/SceneMouse.cpp   2012-05-26 04:30:36 UTC (rev 
2697)
+++ trunk/source/main/gameplay/SceneMouse.cpp   2012-05-26 04:37:52 UTC (rev 
2698)
@@ -214,8 +214,7 @@
 
 Ray SceneMouse::getMouseRay()
 {
-       Camera *cam = RoRFrameListener::eflsingleton->getCamera();
-       Viewport *vp = cam->getViewport();
+       Viewport *vp = gEnv->ogreCamera->getViewport();
 
-       return cam->getCameraToViewportRay((float)lastMouseX / 
(float)vp->getActualWidth(), (float)lastMouseY / (float)vp->getActualHeight());
+       return gEnv->ogreCamera->getCameraToViewportRay((float)lastMouseX / 
(float)vp->getActualWidth(), (float)lastMouseY / (float)vp->getActualHeight());
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to