[Orxonox-commit 2355] r7070 - code/branches/fps/src/orxonox/worldentities/pawns

edwind at orxonox.net edwind at orxonox.net
Tue Jun 1 14:42:25 CEST 2010


Author: edwind
Date: 2010-06-01 14:42:24 +0200 (Tue, 01 Jun 2010)
New Revision: 7070

Modified:
   code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.cc
   code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.h
Log:
by ED, cleaned up version (final...)

Modified: code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.cc
===================================================================
--- code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.cc	2010-05-31 21:18:29 UTC (rev 7069)
+++ code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.cc	2010-06-01 12:42:24 UTC (rev 7070)
@@ -50,8 +50,8 @@
 
 namespace orxonox
 {
-    const float orientationGain = 100;
-    const float jumpvalue = 300;
+    const float orientationGain_ = 100;
+    const float jumpValue_ = 300;
     CreateFactory(FpsPlayer);
 
     FpsPlayer::FpsPlayer(BaseObject* creator) : Pawn(creator)
@@ -85,10 +85,9 @@
         this->setConfigValues();
         this->registerVariables();
 
-	this->weaponNode = this->cameraPositionRootNode_;
-	//this->weaponNode = this->getScene()->getRootSceneNode()->createChildSceneNode();
-	//this->weaponNode = this->cameraPositionRootNode_->createChildSceneNode();
-        this->attachNode(this->weaponNode);
+	//this->weaponNode = this->cameraPositionRootNode_;
+	this->weaponNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
+	this->attachNode(this->weaponNode_);
     }
 
     FpsPlayer::~FpsPlayer()
@@ -112,7 +111,7 @@
         registerVariable(this->primaryThrust_,  VariableDirection::ToClient);
         registerVariable(this->auxilaryThrust_, VariableDirection::ToClient);
         registerVariable(this->rotationThrust_, VariableDirection::ToClient);
-	registerVariable(this->weaponmashname);
+	registerVariable(this->weaponMashName_);
     }
     
    
@@ -140,7 +139,7 @@
         {
             this->setOrientation(savedOrientation_);
 	    
-	    thistickboost=false;
+	    thisTickBoost_=false;
 	    
 	    float localSpeedSquared = this->localVelocity_.squaredLength();
             float localSpeed;
@@ -152,7 +151,7 @@
             this->localVelocity_.x *= localSpeed;
             this->localVelocity_.z *= localSpeed;
 	    Vector3 temp = this->getOrientation() * this->localVelocity_;
-	    if(localVelocity_.y==jumpvalue) this->setVelocity(Vector3(temp.x, temp.y + this->getVelocity().y, temp.z));
+	    if(localVelocity_.y==jumpValue_) this->setVelocity(Vector3(temp.x, temp.y + this->getVelocity().y, temp.z));
 	    else this->setVelocity(Vector3(temp.x, this->getVelocity().y, temp.z));
             this->localVelocity_.x = 0;
             this->localVelocity_.y = 0;
@@ -164,37 +163,30 @@
 		
 		Radian pitch=this->cameraPositionRootNode_->getOrientation().getPitch();
 		if( pitch<Radian(1.5707) && pitch>Radian(-1.5707) ) {
-			//this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
 			this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
 			}
 		else if(pitch<Radian(-1.5707)){
 			if(this->pitch_>0.0) {
-				//this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
 				this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
 				}
 			else if(pitch<Radian(-1.571)){
-				//this->weaponNode->pitch(-pitch+Radian(-1.570796));
 				this->cameraPositionRootNode_->pitch(-pitch+Radian(-1.570796));
 				}
 		}
 		else if(pitch>Radian(1.5707)){
 			if(this->pitch_<0.0) {
-				//this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
 				this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
 				}
 			else if(pitch>Radian(1.571)){ 
-				//this->weaponNode->pitch(-pitch+Radian(1.570796));
 				this->cameraPositionRootNode_->pitch(-pitch+Radian(1.570796));
 				}
 		}
-		//this->weaponNode->setOrientation(this->cameraPositionRootNode_->getOrientation());
+		this->weaponNode_->setOrientation(this->cameraPositionRootNode_->getOrientation());
 		
 	    }
 
             this->yaw_ = this->pitch_ = this->roll_ = 0;
 	    
-	    //Quaternion q=this->getOrientation();
-	    //if( q.y<0.99 ) this->setOrientation(q.w, q.x, 1.0, q.z);
 	    this->setAngularVelocity(0.0, 0.0, 0.0);
 	    savedOrientation_=this->getOrientation();
         }
@@ -207,13 +199,13 @@
         if (GameMode::showsGraphics())
         {
             if (this->mesh_.getEntity())
-                this->weaponNode->detachObject(this->mesh_.getEntity());
+                this->weaponNode_->detachObject(this->mesh_.getEntity());
 
             this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
 
             if (this->mesh_.getEntity())
             {
-                this->weaponNode->attachObject(this->mesh_.getEntity());
+                this->weaponNode_->attachObject(this->mesh_.getEntity());
             }
         }
     }
@@ -273,18 +265,18 @@
     
     void FpsPlayer::boost()					//acctually jump
     {
-        if(isfloor) { 
-		if(!thistickboost) this->localVelocity_.y = jumpvalue;
+        if(isFloor_) { 
+		if(!thisTickBoost_) this->localVelocity_.y = jumpValue_;
 		//this->physicalBody_->applyCentralImpulse(btVector3(0, jumpvalue, 0));
-		thistickboost=true;
-		isfloor=false;
+		thisTickBoost_=true;
+		isFloor_=false;
 	}
     }
 
     bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     {
-	if(contactPoint.m_normalWorldOnB.y() > 0.6) isfloor=true;
-	else isfloor=false;
+	if(contactPoint.m_normalWorldOnB.y() > 0.6) isFloor_=true;
+	else isFloor_=false;
 	
 	return false;
     }
@@ -298,7 +290,7 @@
 	    {
 	        weapon->getWeaponSlot()->removeWeapon();
 	        weapon->detachFromParent();
-		weapon->attachToNode(this->weaponNode);
+		weapon->attachToNode(this->weaponNode_);
 	    }
 	}
     }

Modified: code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.h
===================================================================
--- code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.h	2010-05-31 21:18:29 UTC (rev 7069)
+++ code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.h	2010-06-01 12:42:24 UTC (rev 7070)
@@ -83,7 +83,7 @@
             float primaryThrust_;
             float auxilaryThrust_;
             float rotationThrust_;
-	    std::string weaponmashname;
+	    std::string weaponMashName_;
             btVector3 localLinearAcceleration_;
             btVector3 localAngularAcceleration_;
 
@@ -98,12 +98,11 @@
             float pitch_;
             float roll_;
             Vector3 localVelocity_;
-	    bool isfloor;
-	    bool thistickboost;
+	    bool isFloor_;
+	    bool thisTickBoost_;
 	    Quaternion savedOrientation_;
-	    Ogre::SceneNode* weaponNode;
-	    Ogre::Camera* camera_;
-    };
+	    Ogre::SceneNode* weaponNode_;
+	};
 }
 
 #endif /* _FpsPlayer_H__ */




More information about the Orxonox-commit mailing list