[Orxonox-commit 2087] r6803 - in code/branches/rocket/src: modules/weapons modules/weapons/projectiles orxonox/controllers

gnadler at orxonox.net gnadler at orxonox.net
Thu Apr 29 14:10:19 CEST 2010


Author: gnadler
Date: 2010-04-29 14:10:18 +0200 (Thu, 29 Apr 2010)
New Revision: 6803

Added:
   code/branches/rocket/src/modules/weapons/RocketController.cc
   code/branches/rocket/src/modules/weapons/RocketController.h
Removed:
   code/branches/rocket/src/orxonox/controllers/RocketController.cc
   code/branches/rocket/src/orxonox/controllers/RocketController.h
Modified:
   code/branches/rocket/src/modules/weapons/CMakeLists.txt
   code/branches/rocket/src/modules/weapons/projectiles/CMakeLists.txt
   code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc
Log:


Modified: code/branches/rocket/src/modules/weapons/CMakeLists.txt
===================================================================
--- code/branches/rocket/src/modules/weapons/CMakeLists.txt	2010-04-29 11:52:19 UTC (rev 6802)
+++ code/branches/rocket/src/modules/weapons/CMakeLists.txt	2010-04-29 12:10:18 UTC (rev 6803)
@@ -1,5 +1,6 @@
 SET_SOURCE_FILES(WEAPONS_SRC_FILES
   MuzzleFlash.cc
+  RocketController.cc
 )
 
 ADD_SUBDIRECTORY(munitions)

Added: code/branches/rocket/src/modules/weapons/RocketController.cc
===================================================================
--- code/branches/rocket/src/modules/weapons/RocketController.cc	                        (rev 0)
+++ code/branches/rocket/src/modules/weapons/RocketController.cc	2010-04-29 12:10:18 UTC (rev 6803)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program 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 this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "RocketController.h"
+#include "projectiles/SimpleRocket.h" 
+#include "util/Math.h"
+
+
+namespace orxonox
+{
+    /**
+    @brief
+        Constructor.
+    */
+    RocketController::RocketController(BaseObject* creator) : Controller(creator)
+    {
+        // Place your code here:
+        // - make sure to register the object in the factory
+        // - do any kind of initialisation
+        RegisterObject(RocketController);
+        // this checks that our creator really is a drone
+        // and saves the pointer to the drone for the controlling commands
+    }
+
+
+    /**
+    @brief
+        The controlling happens here. This method defines what the controller has to do each tick.
+    @param dt
+        The duration of the tick.
+    */
+    void RocketController::tick(float dt)
+    {
+        // Place your code here:
+        // - steering commands
+        SimpleRocket *rocket = static_cast<SimpleRocket*>(this->getControllableEntity());
+        // you can use the following commands for steering 
+        // - moveFrontBack, moveRightLeft, moveUpDown 
+        // - rotatePitch, rotateYaw, rotateRoll 
+        // - apply the to myDrone (e.g. myDrone->rotateYaw(..) ) 
+
+		rocket->rotateYaw(0.2);
+			rocket->moveFrontBack(2);
+
+    }
+
+
+
+	void setRocket(SimpleRocket* rocket, RocketController* contr) {
+			contr->setControllableEntity(dynamic_cast<ControllableEntity*> rocket);
+	}
+}

Added: code/branches/rocket/src/modules/weapons/RocketController.h
===================================================================
--- code/branches/rocket/src/modules/weapons/RocketController.h	                        (rev 0)
+++ code/branches/rocket/src/modules/weapons/RocketController.h	2010-04-29 12:10:18 UTC (rev 6803)
@@ -0,0 +1,63 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program 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 this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _RocketController_H__
+#define _RocketController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "controllers/Controller.h"
+#include "tools/interfaces/Tickable.h"
+#include "weapons/projectiles/SimpleRocket.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Controller for the Drone of the PPS tutorial.
+    @author
+        Oli Scheuss
+    */
+    class _OrxonoxExport RocketController : public Controller, public Tickable
+    {
+        public:
+            RocketController(BaseObject* creator);
+			virtual ~RocketController(){};
+			void setRocket(SimpleRocket* rocket, RocketController* contr);
+            
+            virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
+
+        protected:
+
+
+        private:
+
+    };
+}
+
+#endif /* _RocketController_H__ */

Modified: code/branches/rocket/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/branches/rocket/src/modules/weapons/projectiles/CMakeLists.txt	2010-04-29 11:52:19 UTC (rev 6802)
+++ code/branches/rocket/src/modules/weapons/projectiles/CMakeLists.txt	2010-04-29 12:10:18 UTC (rev 6803)
@@ -4,4 +4,5 @@
   Projectile.cc
   LightningGunProjectile.cc
   Rocket.cc
+  SimpleRocket.cc
 )

Modified: code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc	2010-04-29 11:52:19 UTC (rev 6802)
+++ code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc	2010-04-29 12:10:18 UTC (rev 6803)
@@ -38,7 +38,7 @@
 #include "objects/collisionshapes/ConeCollisionShape.h"
 #include "infos/PlayerInfo.h"
 #include "controllers/Controller.h"
-#include "controllers/RocketController.h"
+#include "weapons/RocketController.h"
 #include "sound/WorldSound.h"
 
 namespace orxonox
@@ -58,10 +58,13 @@
         this->bDestroy_ = false;
         this->lifetime_ = 100;
 		//this->camera_ = null;
-		RocketController* myController = new RocketController();
-		this->setController(myController));
-		myController->setControllableEntity(this);
+		RocketController* myRController = new RocketController(this);
+		this->setController(myRController);
+		myRController->setRocket(this, myRController);
+		
 		//this->getController()->setControllableEntity(this);
+		//myController->setControllableEntity(this);
+		//this->getController()->setControllableEntity(this);
         //this->controllableEntity_->setController(this->controller_);
 
         if (GameMode::isMaster())
@@ -89,7 +92,6 @@
 
             this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this)));
         }
-		this->
 
     }
 

Deleted: code/branches/rocket/src/orxonox/controllers/RocketController.cc
===================================================================
--- code/branches/rocket/src/orxonox/controllers/RocketController.cc	2010-04-29 11:52:19 UTC (rev 6802)
+++ code/branches/rocket/src/orxonox/controllers/RocketController.cc	2010-04-29 12:10:18 UTC (rev 6803)
@@ -1,74 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program 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 this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oli Scheuss
- *   Co-authors:
- *      ...
- *
- */
-
-#include "RocketController.h"
-#include "weapons/projectiles/SimpleRocket.h" //wie kann ich das hier includen? so gehts nich aber eigentlich isses eher ein Projectile als einfach ein Worldentity...
-#include "util/Math.h"
-
-
-namespace orxonox
-{
-    /**
-    @brief
-        Constructor.
-    */
-    RocketController::RocketController(BaseObject* creator) : Controller(creator)
-    {
-        // Place your code here:
-        // - make sure to register the object in the factory
-        // - do any kind of initialisation
-        RegisterObject(RocketController);
-        // this checks that our creator really is a drone
-        // and saves the pointer to the drone for the controlling commands
-    }
-
-    RocketController::~RocketController()
-    {
-    }
-
-    /**
-    @brief
-        The controlling happens here. This method defines what the controller has to do each tick.
-    @param dt
-        The duration of the tick.
-    */
-    void RocketController::tick(float dt)
-    {
-        // Place your code here:
-        // - steering commands
-        SimpleRocket* rocket = static_cast<SimpleRocket>(this->getControllableEntity());
-        // you can use the following commands for steering 
-        // - moveFrontBack, moveRightLeft, moveUpDown 
-        // - rotatePitch, rotateYaw, rotateRoll 
-        // - apply the to myDrone (e.g. myDrone->rotateYaw(..) ) 
-
-		rocket->rotateYaw(0.2);
-			rocket->moveFrontBack(2);
-
-    }
-}

Deleted: code/branches/rocket/src/orxonox/controllers/RocketController.h
===================================================================
--- code/branches/rocket/src/orxonox/controllers/RocketController.h	2010-04-29 11:52:19 UTC (rev 6802)
+++ code/branches/rocket/src/orxonox/controllers/RocketController.h	2010-04-29 12:10:18 UTC (rev 6803)
@@ -1,59 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program 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 this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oli Scheuss
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _RocketController_H__
-#define _RocketController_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "Controller.h"
-#include "tools/interfaces/Tickable.h"
-
-namespace orxonox
-{
-    /**
-    @brief
-        Controller for the Drone of the PPS tutorial.
-    @author
-        Oli Scheuss
-    */
-    class _OrxonoxExport RocketController : public Controller, public Tickable
-    {
-        public:
-            RocketController(BaseObject* creator);
-            virtual ~RocketController();
-            
-            virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
-
-        protected:
-
-        private:
-    };
-}
-
-#endif /* _RocketController_H__ */




More information about the Orxonox-commit mailing list