[Orxonox-commit 5344] r10007 - in code/branches/modularships/src/orxonox: . worldentities/pawns

noep at orxonox.net noep at orxonox.net
Thu Mar 27 15:49:50 CET 2014


Author: noep
Date: 2014-03-27 15:49:50 +0100 (Thu, 27 Mar 2014)
New Revision: 10007

Added:
   code/branches/modularships/src/orxonox/ShipPart.cc
   code/branches/modularships/src/orxonox/ShipPart.h
Modified:
   code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
Log:
More research done on collisionshape-entity-structure, and started cleaning up the debug-output.

Added: code/branches/modularships/src/orxonox/ShipPart.cc
===================================================================
--- code/branches/modularships/src/orxonox/ShipPart.cc	                        (rev 0)
+++ code/branches/modularships/src/orxonox/ShipPart.cc	2014-03-27 14:49:50 UTC (rev 10007)
@@ -0,0 +1,53 @@
+/*
+ *   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:
+ *      Noe Pedrazzini
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ShipPart.h"
+
+#include <algorithm>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
+
+
+namespace orxonox
+{
+    RegisterClass(ShipPart);
+
+    ShipPart::ShipPart(Context* context)
+    {
+        //RegisterObject(ShipPart);
+    }
+
+    ShipPart::~ShipPart()
+    {
+
+    }
+
+}

Added: code/branches/modularships/src/orxonox/ShipPart.h
===================================================================
--- code/branches/modularships/src/orxonox/ShipPart.h	                        (rev 0)
+++ code/branches/modularships/src/orxonox/ShipPart.h	2014-03-27 14:49:50 UTC (rev 10007)
@@ -0,0 +1,55 @@
+/*
+ *   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:
+ *      Noe Pedrazzini
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ShipPart_H__
+#define _ShipPart_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+
+
+namespace orxonox // tolua_export
+{ // tolua_export
+    class _OrxonoxExport ShipPart // tolua_export
+    { // tolua_export
+
+        public:
+            ShipPart(Context* context);
+            virtual ~ShipPart();
+
+        protected:
+
+
+        private:
+
+
+    }; // tolua_export
+} // tolua_export
+
+#endif /* _ShipPart_H__ */

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	2014-03-27 14:23:27 UTC (rev 10006)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	2014-03-27 14:49:50 UTC (rev 10007)
@@ -52,6 +52,7 @@
 #include "collisionshapes/WorldEntityCollisionShape.h"
 #include <BulletCollision/CollisionShapes/btCollisionShape.h>
 #include <BulletCollision/CollisionShapes/btCompoundShape.h>
+#include "graphics/Model.h"
 
 
 namespace orxonox
@@ -637,78 +638,31 @@
         // List all attached Objects
         orxout() << "  " << this->getRadarName() << " has the following Objects attached:" << endl;
         for (int i=0; i<10; i++)
-            orxout() << " " << i << ": " << this->getAttachedObject(i) << endl;
+        {
+            if (this->getAttachedObject(i)==NULL)
+                break;
+            orxout() << " " << i << ": " << this->getAttachedObject(i);
+            if(!orxonox_cast<Model*>(this->getAttachedObject(i)))
+                orxout() << " (SE)";
+            orxout() << endl;
+        }
 
+        if (this->health_ < 800)
+            this->detach(this->getAttachedObject(2));
+
         // print child shapes of this WECS
-        // printChildShapes(ownWECS, 2, 0);
         printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0);
 
+        int temp = entityOfCollisionShape(cs);
+        if (temp==0)
+            orxout() << this->getRadarName() << " has been hit on it's main body." << endl;
+        else
+            orxout() << this->getRadarName() << " has been hit on the attached entity no. " << temp << endl;
 
         // end
-        orxout() << "  " << this->getRadarName() << ": no matching CS found." << endl;
         return -1;
     }
 
-    void Pawn::printChildShapes(CompoundCollisionShape* cs, int indent, int subshape)
-    {
-        for (int i=0; i < cs->getNumChildShapes(); i++)
-        {
-            orxout() << "" << endl;
-        }
-        /*
-        // e.g. "  Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:"
-        printSpaces(indent);  orxout() << "Childshape " << subshape << " (CS* " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl;
-
-        // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060"
-        printSpaces(indent);  orxout() << "Childshape " << subshape << " is btCollisionShape* " << cs->getCollisionShape() << endl;
-
-        for (int i=0; i < cs->getNumChildShapes(); i++)
-        {
-            printSpaces(indent+2);  orxout() << "- " << i << " - - -" << endl;
-            printSpaces(indent+2);  orxout() << "This Shape is a ";
-            if (orxonox_cast<WorldEntityCollisionShape*>(cs->getAttachedShape(i)))
-                orxout() << "WECS ";
-            if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))
-                orxout() << "CCS ";
-            if (orxonox_cast<CollisionShape*>(cs->getAttachedShape(i)))
-                orxout() << "CS ";
-            orxout() << endl;
-
-            // For each childshape, print:
-
-            // parentID of the CollisionShape
-            printSpaces(indent+2);  orxout() << "ParentID: " << cs->getAttachedShape(i)->getObjectID() << endl;
-
-            // parentID of the CollisionShape
-            printSpaces(indent+2);  orxout() << "ParentID: " << cs->getAttachedShape(i)->getParentID() << endl;
-
-            // parent of the CollisionShape
-            printSpaces(indent+2);  orxout() << "ParentCCS*: " << cs->getAttachedShape(i)->getParent() << endl;
-
-            // pointer to the btCollisionShape
-            printSpaces(indent+2);  orxout() << "btCollisionShape*: " << cs->getAttachedShape(i)->getCollisionShape() << endl;
-
-            // pointer to the CollisionShape
-            printSpaces(indent+2);  orxout() << "CollisionShape*: " << cs->getAttachedShape(i) << endl;
-
-            if (cs->getAttachedShape(i)->getCollisionShape() != NULL)
-            {
-                // pointer to the user of the btCollisionShape
-                printSpaces(indent+2);  orxout() << "bt: getUserPointer: " << cs->getAttachedShape(i)->getCollisionShape()->getUserPointer() << endl;
-
-                //
-                printSpaces(indent+2);  orxout() << "bt: isCompound: " << cs->getAttachedShape(i)->getCollisionShape()->isCompound() << endl;
-            }
-
-            // if the childshape is a CompoundCollisionShape, print its children.
-            if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))
-            {
-                printChildShapes((CompoundCollisionShape*)(cs->getAttachedShape(i)), indent+2, i);
-            }
-
-        }*/
-    }
-
     void Pawn::printBtChildShapes(btCompoundShape* cs, int indent, int subshape)
     {
         // e.g. "  Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:"
@@ -735,6 +689,13 @@
         }
     }
 
+    int Pawn::entityOfCollisionShape(const btCollisionShape* cs)
+    {
+        btCompoundShape* ownBtCS = (btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape());
+
+        return -1;
+    }
+
     void Pawn::printSpaces(int num)
     {
         for(int i=0; i<num; i++)

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	2014-03-27 14:23:27 UTC (rev 10006)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	2014-03-27 14:49:50 UTC (rev 10007)
@@ -232,9 +232,9 @@
             unsigned int numexplosionchunks_;
 
             virtual int isMyCollisionShape(const btCollisionShape* cs);
-            void printChildShapes(CompoundCollisionShape* cs, int indent, int subshape);
             void printBtChildShapes(btCompoundShape* cs, int indent, int subshape);
             void printSpaces(int num);
+            int entityOfCollisionShape(const btCollisionShape* cs);
 
         private:
             void registerVariables();




More information about the Orxonox-commit mailing list