[Orxonox-commit 7455] r12062 - in code/branches/OrxoKart_HS18: data/levels src/modules/hover src/modules/orxokart

ottka at orxonox.net ottka at orxonox.net
Wed Oct 31 10:56:46 CET 2018


Author: ottka
Date: 2018-10-31 10:56:46 +0100 (Wed, 31 Oct 2018)
New Revision: 12062

Modified:
   code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw
   code/branches/OrxoKart_HS18/src/modules/hover/Hover.cc
   code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc
   code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h
   code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc
   code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h
   code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc
   code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h
Log:
level added

Modified: code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw
===================================================================
--- code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw	2018-10-31 09:56:46 UTC (rev 12062)
@@ -25,7 +25,9 @@
 --number of tiles
 N = 11
 --scaling factor
-S = 250
+S = 150
+-- Map Matrix
+MAP = "1,0,1,01,10,10,10,10,1,101,1,0101,010,10,10,10,10,10,10,10,1010,10,0,10,10,10,10,00,1,01,0110,11,01,01,10,1,1,1,10,1,10"
 
 MAP_ORIGIN = "0,0,0"
 ?>
@@ -48,21 +50,15 @@
     <StaticEntity position="0,0,0" collisionType="static">
       <attached>
         <!-- Walls and flags (physics and design)-->
-        <!--
+        <!-- 
         <HoverOrigin
-          numCells="<?lua print(MAZE_NUM_CELLS)?>"
-          cellSize="<?lua print(MAZE_CELL_SIZE)?>"
+          numCells="<?lua print(N)?>"
+          cellSize="<?lua print(S)?>"
           cellHeight="<?lua print(MAZE_CELL_HEIGHT)?>"
         />
         -->
 
         <!-- floor design -->
-
-
-
-
-
-
         
         <Model
           position="<?lua print((N-1)*S/2)?>,0,<?lua print((N-1)*S/2)?>"

Modified: code/branches/OrxoKart_HS18/src/modules/hover/Hover.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/hover/Hover.cc	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/src/modules/hover/Hover.cc	2018-10-31 09:56:46 UTC (rev 12062)
@@ -69,8 +69,20 @@
             MazeGenerator generator(numCells);
             generator.generateMaze();
             generator.renderMaze();
+            int levelcodeArray[] = {1,1,1,1,1,1,1,1,0,0,0
+                                    ,1,0,0,0,0,0,0,1,1,1,0
+                                    ,1,0,1,1,1,1,0,0,0,1,1
+                                    ,1,1,1,0,0,1,1,0,0,0,1
+                                    ,0,0,0,0,0,0,1,0,1,1,1
+                                    ,1,1,1,1,1,1,1,0,1,0,0
+                                    ,1,0,0,0,0,0,0,0,1,0,0
+                                    ,1,0,0,0,0,0,0,0,1,0,0
+                                    ,1,1,1,1,1,0,0,0,1,1,1
+                                    ,0,0,0,0,1,0,0,0,0,0,1
+                                    ,0,0,0,0,1,1,1,1,1,1,1};
+            //int* levelcode = generator.getLevelcode();
+            int* levelcode = levelcodeArray;
 
-            int* levelcode = generator.getLevelcode();
 
             //Outer Walls
             for(int i = 0; i<numCells; i++){
@@ -86,8 +98,8 @@
                     switch(levelcode[ y * numCells + x ]){
                         case 1: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
                                 break;
-                        case 3: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
-                        case 2: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
+                        //case 3: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
+                        //case 2: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
                         default: break;
                     }
                 }   

Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc	2018-10-31 09:56:46 UTC (rev 12062)
@@ -34,7 +34,7 @@
 #include "OrxoKart.h"
 
 #include "OrxoKartOrigin.h"
-#include "OrxoKartWall.h"
+#include "OrxoKartTile.h"
 #include "core/CoreIncludes.h"
 
 namespace orxonox
@@ -49,11 +49,11 @@
         this->numberOfFlags_ = 1;
         this->firstTick_ = true;
 
-        this->setHUDTemplate("HoverHUD");
+        this->nullptr
     }
 
     void OrxoKart::tick(float dt)
-    { /*
+    { 
         SUPER(OrxoKart, tick, dt);
 
         if(this->firstTick_ && this->origin_)
@@ -67,15 +67,26 @@
             MazeGenerator generator(numCells);
             generator.generateMaze();
             generator.renderMaze();
+            int levelcodeArray[] = {1,1,1,1,1,1,1,1,0,0,0
+                                    ,1,0,0,0,0,0,0,1,1,1,0
+                                    ,1,0,1,1,1,1,0,0,0,1,1
+                                    ,1,1,1,0,0,1,1,0,0,0,1
+                                    ,0,0,0,0,0,0,1,0,1,1,1
+                                    ,1,1,1,1,1,1,1,0,1,0,0
+                                    ,1,0,0,0,0,0,0,0,1,0,0
+                                    ,1,0,0,0,0,0,0,0,1,0,0
+                                    ,1,1,1,1,1,0,0,0,1,1,1
+                                    ,0,0,0,0,1,0,0,0,0,0,1
+                                    ,0,0,0,0,1,1,1,1,1,1,1};
+            //int* levelcode = generator.getLevelcode();
+            int* levelcode = levelcodeArray;
 
-            int* levelcode = generator.getLevelcode();
-
             //Outer Walls
             for(int i = 0; i<numCells; i++){
-                (new HoverWall(origin_->getContext()))->init(0,        i+1,      cellSize, cellHeight, 1);
-                (new HoverWall(origin_->getContext()))->init(numCells, i+1,      cellSize, cellHeight, 1);
-                (new HoverWall(origin_->getContext()))->init(i+1,      0,        cellSize, cellHeight, 2);
-                (new HoverWall(origin_->getContext()))->init(i+1,      numCells, cellSize, cellHeight, 2);
+                (new OrxoKartTile(origin_->getContext()))->init(0,        i+1,      cellSize, cellHeight, 1);
+                (new OrxoKartTile(origin_->getContext()))->init(numCells, i+1,      cellSize, cellHeight, 1);
+                (new OrxoKartTile(origin_->getContext()))->init(i+1,      0,        cellSize, cellHeight, 2);
+                (new OrxoKartTile(origin_->getContext()))->init(i+1,      numCells, cellSize, cellHeight, 2);
             }
 
             //Generate inner Walls according to levelcode
@@ -82,22 +93,16 @@
             for(int y=0; y<numCells; y++){
                 for(int x=0; x<numCells; x++){
                     switch(levelcode[ y * numCells + x ]){
-                        case 1: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
+                        case 1: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
                                 break;
-                        case 3: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
-                        case 2: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
+                        case 3: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
+                        case 2: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
                         default: break;
                     }
                 }   
             }
 
-            //Generate 5 flags randomly
-            for ( int i = 0; i < 5; i++ )
-            {
-                HoverFlag* flag = new HoverFlag(origin_->getContext());
-                flag->init(rand()%numCells, rand()%numCells, cellSize);
-                flags_.push_back(flag);
-            }
+            
 
         }//firsttick end
 
@@ -109,6 +114,6 @@
             }
         }
         numberOfFlags_ = flags_.size();
-        */
+        
     }
 }

Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h	2018-10-31 09:56:46 UTC (rev 12062)
@@ -51,7 +51,7 @@
 
             virtual void tick(float dt) override;
 
-            void setOrigin(HoverOrigin* origin)
+            void setOrigin(OrxoKartOrigin* origin)
                 { this->origin_ = origin; }
 
             /*inline int getNumberOfFlags() const

Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc	2018-10-31 09:56:46 UTC (rev 12062)
@@ -52,10 +52,10 @@
 
         XMLPortParam(OrxoKartOrigin, "numCells", setNumCells, getNumCells, xmlelement, mode);
         XMLPortParam(OrxoKartOrigin, "cellSize", setCellSize, getCellSize, xmlelement, mode);
-        XMLPortParam(OrxoKartOrigin, "cellHeight", setCellHeight, getCellHeight, xmlelement, mode);
+        XMLPortParam(OrxoKartOrigin, "mapMatrix", setMapMatrix, getMapMatrix, xmlelement, mode);
     }
 
-    void HoverOrigin::checkGametype()
+    void OrxoKartOrigin::checkGametype()
     {
         if (getGametype() != nullptr && this->getGametype()->isA(Class(OrxoKart)))
         {

Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h	2018-10-31 09:56:46 UTC (rev 12062)
@@ -60,10 +60,10 @@
             inline int getCellSize() const
                 { return this->cellSize_; }
 
-            inline void setCellHeight(int cellHeight)
-                { this->cellHeight_ = cellHeight; }
-            inline int getCellHeight() const
-                { return this->cellHeight_; }
+            inline void setMapMatrix(int mapMatrix)
+                { this->mapMatrix_ = mapMatrix; }
+            inline int getMapMatrix() const
+                { return this->mapMatrix_; }
 
         private:
             void checkGametype();
@@ -70,7 +70,7 @@
        
             int numCells_;
             int cellSize_;
-            int cellHeight_;
+            int mapMatrix_;
     };
 }
 

Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc	2018-10-31 09:56:46 UTC (rev 12062)
@@ -27,11 +27,11 @@
  */
 
 /**
-    @file HoverWall.cc
-    @brief Represents one Wall piece in the Hover Game
+    @file OrxoKartTile.cc
+    @brief Represents one Wall piece in the OrxoKart Game
 */
 
-#include "HoverWall.h"
+#include "OrxoKartTile.h"
 
 #include "core/CoreIncludes.h"
 #include "graphics/Model.h"
@@ -39,11 +39,11 @@
 
 namespace orxonox
 {
-    RegisterClass(HoverWall);
+    RegisterClass(OrxoKartTile);
 
-    HoverWall::HoverWall(Context* context) : StaticEntity(context)
+    OrxoKartTile::OrxoKartTile(Context* context) : StaticEntity(context)
     {
-        RegisterObject(HoverWall);
+        RegisterObject(OrxoKartTile);
 
         this->model_ = nullptr;
         this->cs_ = nullptr;
@@ -57,7 +57,7 @@
     @brief
         Destructor.
     */
-    HoverWall::~HoverWall()
+    OrxoKartTile::~OrxoKartTile()
     {
         if (this->isInitialized())
         {
@@ -70,7 +70,7 @@
 
     /**
     @brief
-        Initializes a HoverWall
+        Initializes a OrxoKartTile
     @param x
         x-Coordinate of the Square that the Wall is attached to, 0-9, Origin is Bottom left
     @param y
@@ -82,7 +82,7 @@
     @param orientation
             Wall on the right side (1) or on top (2) of this square, 0-1        
     */
-    void HoverWall::init(int x, int y, int cellSize, int cellHeight, int orientation)
+    void OrxoKartTile::init(int x, int y, int cellSize, int cellHeight, int orientation)
     {
         int xSize_, zSize_, xPos_, zPos_;
 

Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h	2018-10-31 09:52:15 UTC (rev 12061)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h	2018-10-31 09:56:46 UTC (rev 12062)
@@ -27,15 +27,15 @@
  */
 
 /**
-    @file HoverWall.h
+    @file OrxoKartTile.h
     @brief See .cc-file for further information
-    @ingroup Hover
+    @ingroup OrxoKart
 */
 
-#ifndef _HoverWall_H__
-#define _HoverWall_H__
+#ifndef _OrxoKartTile_H__
+#define _OrxoKartTile_H__
 
-#include "HoverPrereqs.h"
+#include "OrxoKartPrereqs.h"
 #include "objects/ObjectsPrereqs.h"
 
 #include "worldentities/StaticEntity.h"
@@ -42,11 +42,11 @@
 
 namespace orxonox
 {
-    class _HoverExport HoverWall : public StaticEntity
+    class _OrxoKartExport OrxoKartTile : public StaticEntity
     {
         public:
-            HoverWall(Context* context);
-            virtual ~HoverWall();
+            OrxoKartTile(Context* context);
+            virtual ~OrxoKartTile();
 
             void init(int x, int y, int cellSize, int cellHeight, int orientation);
 
@@ -56,4 +56,4 @@
     };
 }
 
-#endif /* _HoverWall_H__ */
+#endif /* _OrxoKartTile_H__ */



More information about the Orxonox-commit mailing list