Revision: 2692
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2692&view=rev
Author: rorthomas
Date: 2012-05-26 04:14:16 +0000 (Sat, 26 May 2012)
Log Message:
-----------
Character compiles again
Modified Paths:
--------------
trunk/source/main/gameplay/Character.cpp
trunk/source/main/gameplay/Character.h
trunk/source/main/gameplay/GEnv.h
trunk/source/main/gameplay/autopilot.cpp
trunk/source/main/gameplay/autopilot.h
trunk/source/main/terrain/TerrainObjectManager.h
Added Paths:
-----------
trunk/source/main/terrain/IHeightFinder.h
Modified: trunk/source/main/gameplay/Character.cpp
===================================================================
--- trunk/source/main/gameplay/Character.cpp 2012-05-26 04:10:42 UTC (rev
2691)
+++ trunk/source/main/gameplay/Character.cpp 2012-05-26 04:14:16 UTC (rev
2692)
@@ -31,36 +31,31 @@
#include "NetworkStreamManager.h"
#include "PlayerColours.h"
#include "utils.h"
+#include "IHeightFinder.h"
using namespace Ogre;
unsigned int Character::characterCounter = 0;
-Character::Character(Camera *cam, Collisions *c, Network *net, MapControl *m,
SceneManager *scm, int source, unsigned int streamid, int colourNumber, bool
remote) :
+Character::Character(int source, unsigned int streamid, int colourNumber, bool
remote) :
beamCoupling(0)
, canJump(false)
, characterRotation(0.0f)
, characterSpeed(2.0f)
, characterVSpeed(0.0f)
- , collisions(c)
, colourNumber(colourNumber)
, last_net_time(0)
, mAnimState(0)
- , mCamera(cam)
, mCharacterNode(0)
, mLastPosition(Vector3::ZERO)
, mMoveableText(0)
- , mSceneMgr(scm)
- , mapControl(m)
- , net(net)
, networkAuthLevel(0)
, networkUsername("")
, physicsEnabled(true)
, remote(remote)
, source(source)
, streamid(streamid)
- , water(w)
{
myNumber = characterCounter++;
myName = "Character" + TOSTRING(myNumber);
@@ -82,9 +77,9 @@
mAnimState = entity->getAllAnimationStates();
#ifdef USE_MYGUI
- if (mapControl)
+ if (gEnv->surveyMap)
{
- mapEntity = mapControl->createNamedMapEntity(myName, "person");
+ mapEntity = gEnv->surveyMap->createNamedMapEntity(myName,
"person");
mapEntity->setState(0);
mapEntity->setVisibility(true);
mapEntity->setPosition(mCharacterNode->getPosition());
@@ -92,7 +87,7 @@
}
#endif // USE_MYGUI
- if (net)
+ if (gEnv->network)
{
sendStreamSetup();
}
@@ -120,9 +115,9 @@
mCharacterNode->detachAllObjects();
}
#ifdef USE_MYGUI
- if (mapControl && mapEntity)
+ if (gEnv->surveyMap && mapEntity)
{
- mapControl->deleteMapEntity(mapEntity);
+ gEnv->surveyMap->deleteMapEntity(mapEntity);
}
#endif // USE_MYGUI
// try to unload some materials
@@ -152,10 +147,10 @@
{
#ifdef USE_SOCKETW
// label above head
- if (!net) return;
+ if (!gEnv->network) return;
if (remote)
{
- client_t *info = net->getClientInfo(this->source);
+ client_t *info = gEnv->network->getClientInfo(this->source);
if (!info) return;
if (tryConvertUTF(info->user.username).empty()) return;
this->colourNumber = info->user.colournum;
@@ -163,7 +158,7 @@
networkAuthLevel = info->user.authstatus;
} else
{
- user_info_t *info = net->getLocalUserData();
+ user_info_t *info = gEnv->network->getLocalUserData();
if (!info) return;
if (String(info->username).empty()) return;
this->colourNumber = info->colournum;
@@ -211,9 +206,9 @@
{
mCharacterNode->setPosition(position);
#ifdef USE_MYGUI
- if (mapControl)
+ if (gEnv->surveyMap)
{
- mapControl->getEntityByName(myName)->setPosition(position);
+ gEnv->surveyMap->getEntityByName(myName)->setPosition(position);
}
#endif // USE_MYGUI
}
@@ -222,9 +217,9 @@
{
mCharacterNode->setVisible(visible);
#ifdef USE_MYGUI
- if (mapControl)
+ if (gEnv->surveyMap)
{
- mapControl->getEntityByName(myName)->setVisibility(visible);
+
gEnv->surveyMap->getEntityByName(myName)->setVisibility(visible);
}
#endif // USE_MYGUI
}
@@ -246,16 +241,6 @@
mCharacterNode->yaw(-characterRotation);
}
-void Character::setCollisions(Collisions *collisions)
-{
- this->collisions = collisions;
-}
-
-void Character::setWater(Water *water)
-{
- this->water = water;
-}
-
void Character::setAnimationMode(String mode, float time)
{
if (!mAnimState)
@@ -303,10 +288,10 @@
Vector3 position2 = position + Vector3(0.0f, 0.075f, 0.0f);
Vector3 position3 = position + Vector3(0.0f, 0.25, 0.0f);
- if (collisions->collisionCorrect(&position))
+ if (gEnv->collisions->collisionCorrect(&position))
{
characterVSpeed = std::max(0.0f, characterVSpeed);
- if (collisions->collisionCorrect(&position2) &&
!collisions->collisionCorrect(&position3))
+ if (gEnv->collisions->collisionCorrect(&position2) &&
!gEnv->collisions->collisionCorrect(&position3))
{
characterVSpeed = 2.0f; // autojump
} else
@@ -323,7 +308,7 @@
for (int i=1; i <= numstep; i++)
{
Vector3 cposition = mLastPosition +
dvec * ((float)i / numstep);
- if
(collisions->collisionCorrect(&cposition))
+ if
(gEnv->collisions->collisionCorrect(&cposition))
{
position = cposition;
characterVSpeed =
std::max(0.0f, characterVSpeed);
@@ -351,9 +336,9 @@
bool isswimming = false;
float wheight = -99999;
- if (water)
+ if (gEnv->water)
{
- wheight = water->getHeightWaves(position);
+ wheight = gEnv->water->getHeightWaves(position);
if (position.y < wheight - 1.8f)
{
position.y = wheight - 1.8f;
@@ -362,7 +347,7 @@
}
// 0.1 due to 'jumping' from waves -> not nice looking
- if (water && (wheight - pheight > 1.8f) && (position.y + 0.1f
<= wheight))
+ if (gEnv->water && (wheight - pheight > 1.8f) && (position.y +
0.1f <= wheight))
{
isswimming = true;
}
@@ -527,7 +512,7 @@
}
#ifdef USE_SOCKETW
- if (net && !remote)
+ if (gEnv->network && !remote)
{
sendStreamData();
}
@@ -537,10 +522,10 @@
void Character::updateMapIcon()
{
#ifdef USE_MYGUI
- if (mapControl)
+ if (gEnv->surveyMap)
{
-
mapControl->getEntityByName(myName)->setPosition(mCharacterNode->getPosition());
-
mapControl->getEntityByName(myName)->setRotation(mCharacterNode->getOrientation());
+
gEnv->surveyMap->getEntityByName(myName)->setPosition(mCharacterNode->getPosition());
+
gEnv->surveyMap->getEntityByName(myName)->setRotation(mCharacterNode->getOrientation());
}
#endif // USE_MYGUI
}
@@ -623,7 +608,7 @@
void Character::updateNetLabelSize()
{
- if (!this || !net || !mMoveableText) return;
+ if (!this || !gEnv->network || !mMoveableText) return;
mMoveableText->setVisible(getVisible());
@@ -653,7 +638,7 @@
{
mMoveableText->setVisible(false);
}
- if (net && !remote)
+ if (gEnv->network && !remote)
{
attach_netdata_t data;
data.command = CHARCMD_ATTACH;
@@ -680,7 +665,7 @@
{
mMoveableText->setVisible(true);
}
- if (net && !remote)
+ if (gEnv->network && !remote)
{
attach_netdata_t data;
data.command = CHARCMD_ATTACH;
Modified: trunk/source/main/gameplay/Character.h
===================================================================
--- trunk/source/main/gameplay/Character.h 2012-05-26 04:10:42 UTC (rev
2691)
+++ trunk/source/main/gameplay/Character.h 2012-05-26 04:14:16 UTC (rev
2692)
@@ -32,7 +32,7 @@
public:
- Character(Ogre::Camera *cam, Collisions *c, Network *net, HeightFinder
*h, Water *w, MapControl *m, Ogre::SceneManager *scm, int source=-1, unsigned
int streamid=0, int colourNumber=0, bool remote=true);
+ Character(int source=-1, unsigned int streamid=0, int colourNumber=0,
bool remote=true);
~Character();
Ogre::Radian getRotation() { return characterRotation; };
@@ -44,14 +44,12 @@
bool isRemote() { return remote; };
void setBeamCoupling(bool enabled, Beam *truck = 0);
- void setCollisions(Collisions *collisions);
void setColour(int color) { this->colourNumber = color; };
void setHFinder(HeightFinder *hFinder);
void setPhysicsEnabled(bool enabled) { physicsEnabled = enabled; };
void setPosition(Ogre::Vector3 position);
void setRotation(Ogre::Radian rotation);
void setVisible(bool visible);
- void setWater(Water *water);
void move(Ogre::Vector3 offset);
@@ -66,12 +64,7 @@
protected:
Beam *beamCoupling;
- Collisions *collisions;
- HeightFinder *hFinder;
- MapControl *mapControl;
MapEntity *mapEntity;
- Network *net;
- Water *water;
bool canJump;
bool physicsEnabled;
Modified: trunk/source/main/gameplay/GEnv.h
===================================================================
--- trunk/source/main/gameplay/GEnv.h 2012-05-26 04:10:42 UTC (rev 2691)
+++ trunk/source/main/gameplay/GEnv.h 2012-05-26 04:14:16 UTC (rev 2692)
@@ -25,6 +25,8 @@
class Collisions;
class IHeightFinder;
class Water;
+class Network;
+class MapControl;
class GlobalEnvironment
{
@@ -40,6 +42,8 @@
, collisions(0)
, heightFinder(0)
, water(0)
+ , network(0)
+ , surveyMap(0)
{
}
Ogre::Root *ogreRoot;
@@ -53,6 +57,8 @@
Collisions *collisions;
IHeightFinder *heightFinder;
Water *water;
+ Network *network;
+ MapControl *surveyMap;
};
#endif // GEnv_H__
Modified: trunk/source/main/gameplay/autopilot.cpp
===================================================================
--- trunk/source/main/gameplay/autopilot.cpp 2012-05-26 04:10:42 UTC (rev
2691)
+++ trunk/source/main/gameplay/autopilot.cpp 2012-05-26 04:14:16 UTC (rev
2692)
@@ -299,7 +299,7 @@
#endif //OPENAL
}
-void Autopilot::getRadioFix(localizer_t *localizers, int free_localizer, float
*vdev, float *hdev)
+void Autopilot::getRadioFix(TerrainObjectManager::localizer_t *localizers, int
free_localizer, float *vdev, float *hdev)
{
if(!ref_l || !ref_r)
return;
Modified: trunk/source/main/gameplay/autopilot.h
===================================================================
--- trunk/source/main/gameplay/autopilot.h 2012-05-26 04:10:42 UTC (rev
2691)
+++ trunk/source/main/gameplay/autopilot.h 2012-05-26 04:14:16 UTC (rev
2692)
@@ -79,7 +79,7 @@
void gpws_update(float spawnheight);
- void getRadioFix(localizer_t *localizers, int free_localizer, float
*vdev, float *hdev);
+ void getRadioFix(TerrainObjectManager::localizer_t *localizers, int
free_localizer, float *vdev, float *hdev);
};
Added: trunk/source/main/terrain/IHeightFinder.h
===================================================================
--- trunk/source/main/terrain/IHeightFinder.h (rev 0)
+++ trunk/source/main/terrain/IHeightFinder.h 2012-05-26 04:14:16 UTC (rev
2692)
@@ -0,0 +1,32 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2012 Pierre-Michel Ricordel
+Copyright 2007-2012 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 IHEightFinder_H__
+#define IHEightFinder_H__
+
+#include "RoRPrerequisites.h"
+
+class IHeightFinder
+{
+public:
+ virtual float getHeightAt(float x, float z) = 0;
+ virtual Ogre::Vector3 getNormalAt(float x, float y, float z, float
precision = 0.1f) = 0;
+};
+
+#endif // IHEightFinder_H__
\ No newline at end of file
Modified: trunk/source/main/terrain/TerrainObjectManager.h
===================================================================
--- trunk/source/main/terrain/TerrainObjectManager.h 2012-05-26 04:10:42 UTC
(rev 2691)
+++ trunk/source/main/terrain/TerrainObjectManager.h 2012-05-26 04:14:16 UTC
(rev 2692)
@@ -32,6 +32,13 @@
void loadObjectConfigFile(Ogre::String filename);
+ typedef struct localizer_t
+ {
+ int type;
+ Ogre::Vector3 position;
+ Ogre::Quaternion rotation;
+ } localizer_t;
+
protected:
TerrainManager *terrainManager;
@@ -58,13 +65,8 @@
Road *road;
- typedef struct localizer_t
- {
- int type;
- Ogre::Vector3 position;
- Ogre::Quaternion rotation;
- } localizer_t;
+
localizer_t localizers[64];
void loadObject(const char* name, float px, float py, float pz, float
rx, float ry, float rz, Ogre::SceneNode * bakeNode, const char* instancename,
bool enable_collisions=true, int scripthandler=-1, const char *type=0, bool
uniquifyMaterial=false);
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel