Index: /code/branches/pCuts/data/levels/tetris.oxw
===================================================================
--- /code/branches/pCuts/data/levels/tetris.oxw	(revision 9091)
+++ /code/branches/pCuts/data/levels/tetris.oxw	(revision 9092)
@@ -9,5 +9,5 @@
   include("HUDTemplates3.oxo")
   include("stats.oxo")
-  include("pongHUD.oxo")
+  include("tetrisHUD.oxo")
   include("templates/lodInformation.oxt")
 ?>
@@ -24,5 +24,5 @@
   <TetrisStone camerapositiontemplate=tetrisstonecameras>
     <attached>
-      <Model position="0,0,0" mesh="crate.mesh" scale=1 />
+      <Model position="0,0,0" mesh="crate.mesh" scale=0.9 />
     </attached>
   </TetrisStone>
@@ -59,5 +59,13 @@
    skybox       = "Orxonox/skypanoramagen1"
   >
+<!--luke_grey_-_hypermode.ogg allgorythm-lift_up.ogg Fight1.ogg -->
+    <WorldAmbientSound
+      source="Ganymede.ogg"
+      looping="true"
+      playOnLoad="true"
+    />
+
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
 
     <?lua
@@ -80,4 +88,15 @@
     </TetrisCenterpoint>
 
+<!-- ------------ insert eye candy here  ---------------- -->
+
+<!-- asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog) -->
+<!-- DONT DARE TO TURN THE FOG ON, whithout finding a better belt position -->
+    <?lua
+    	dofile("includes/asteroidField.lua")
+    	asteroidBelt(10000, 0, 0, -40, -90, 70, 100, 200, 24000, 20000, 500, 0)
+
+    ?>
+
+
   </Scene>
 </Level>
Index: /code/branches/pCuts/src/modules/tetris/CMakeLists.txt
===================================================================
--- /code/branches/pCuts/src/modules/tetris/CMakeLists.txt	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/CMakeLists.txt	(revision 9092)
@@ -12,4 +12,5 @@
   LINK_LIBRARIES
     orxonox
+    overlays
   SOURCE_FILES ${TETRIS_SRC_FILES}
 )
Index: /code/branches/pCuts/src/modules/tetris/Tetris.cc
===================================================================
--- /code/branches/pCuts/src/modules/tetris/Tetris.cc	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/Tetris.cc	(revision 9092)
@@ -26,11 +26,8 @@
  *
  *
- *BUG b) the falling brick is set the wrong way after a (brick-brick) collision, if the falling brick was turned
  *BUG c) destroying the old stones causes segfault -> WeakPointer as solution ?
  *BUG d) wrong collision detection: sometimes stones "bounce off"
- *BUG e) multiple rows are not cleared in one round
- *
- *
- *TASK b) write a hud (show points gained; new brick)
+ *
+ *
  *TASK c) end the game in a nicer way
  *TASK d) save the highscore
@@ -64,4 +61,5 @@
     @brief
         Constructor. Registers and initializes the object.
+    @ingroup Tetris
     */
     Tetris::Tetris(BaseObject* creator) : Deathmatch(creator)
@@ -77,4 +75,6 @@
         this->player_ = NULL;
         this->endGameCriteria_ = 0.0f;
+        this->setHUDTemplate("TetrisHUD");
+        this->futureBrick_ = NULL;
     }
 
@@ -158,5 +158,5 @@
         {
             TetrisStone* stone = brick->getStone(i);
-            Vector3 stonePosition;
+            Vector3 stonePosition; //the current stone's offset to position
             if(isRotation)
             	stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()+1);
@@ -164,7 +164,16 @@
                 stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount());
 
-            if(! this->isValidMove(stone, position + stonePosition )) // wrong position??
+            if(! this->isValidMove(stone, position + stonePosition ))
             {
                 return false;
+            }
+
+            //catch illegal rotation (such that collisions with ground are not permitted)
+            if(isRotation)
+            {
+                if((position + stonePosition).y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
+                {
+                    return false;
+                }
             }
         }
@@ -193,5 +202,8 @@
             if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize()))
             {
-                this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, currentStonePosition.y+this->center_->getStoneSize(), this->activeBrick_->getPosition().z));
+                int y_offset = static_cast<int>((this->activeBrick_->getPosition().y-currentStonePosition.y+10)/10)*10 + currentStonePosition.y;
+                if(y_offset < 0) //filter out extreme cases (very rare bug)
+                	y_offset = 0;
+                this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, y_offset, this->activeBrick_->getPosition().z));
                 return false;
             }// This case applies if the stones overlap partially vertically
@@ -201,6 +213,8 @@
         if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
         {
-        	int yOffset = stone->getPosition().y;//calculate offset
-        	this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, this->center_->getStoneSize()/2.0f+yOffset, this->activeBrick_->getPosition().z));
+        	int yOffset = stone->getPosition().y + this->center_->getStoneSize()/2.0f;//calculate offset
+        	if(yOffset < 0) //catch brake-throughs
+        	    yOffset = 0;
+        	this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, yOffset, this->activeBrick_->getPosition().z));
             return false;
         }
@@ -208,5 +222,8 @@
         return true;
     }
-
+    /**
+     * @brief This function determines wether a brick touches another brick or the ground.
+     *
+     */
     bool Tetris::isValidBrickPosition(TetrisBrick* brick, const Vector3& position)
     {
@@ -247,4 +264,6 @@
         if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place.
         {
+            // Create the futureBrick_
+            this->createBrick();
             // Create the first brick.
             this->createBrick();
@@ -343,21 +362,29 @@
     void Tetris::createBrick(void)             //TODO: random rotation offset between 0 and 3 (times 90°)
     {
-        // Create a new brick and add it to the list of bricks && to the list of stones.
-        TetrisBrick* brick = new TetrisBrick(this->center_);
-        this->bricks_.push_back(brick);
-        for (unsigned int i = 0; i < brick->getNumberOfStones(); i++)
-        {
-            this->stones_.push_back(brick->getStone(i));
-        }
+        // Use the futureBrick_ as new currentBrick by setting its position and storing it in this->bricks
+        if(this->futureBrick_ != NULL)
+        {
+            for (unsigned int i = 0; i < this->futureBrick_->getNumberOfStones(); i++)
+            {
+                this->stones_.push_back(this->futureBrick_->getStone(i));
+            }
+            float xPos = (this->center_->getWidth()/2 + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
+            float yPos = (this->center_->getHeight()-0.5f)*this->center_->getStoneSize();
+            this->futureBrick_->setPosition(xPos, yPos, 0.0f);
+            this->bricks_.push_back(this->futureBrick_);
+        }
+        // create new futureBrick_
+        this->futureBrick_ = new TetrisBrick(this->center_);
+
 
         // Apply the stone template to the stone.
-        brick->addTemplate(this->center_->getBrickTemplate());
-
-        // Attach the brick to the Centerpoint and set the position of the brick to be at the top middle.
-        this->center_->attach(brick);
-        float xPos = (this->center_->getWidth()/2 + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
-        float yPos = (this->center_->getHeight()-0.5f)*this->center_->getStoneSize();
-        brick->setPosition(xPos, yPos, 0.0f);
-        brick->setGame(this);
+        this->futureBrick_->addTemplate(this->center_->getBrickTemplate());
+
+        // Attach the brick to the Centerpoint and set the position of the brick to be at the left side.
+        this->center_->attach(this->futureBrick_);
+        float xPos = (this->center_->getWidth()*1.6 + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
+        float yPos = (this->center_->getHeight()-5.1f)*this->center_->getStoneSize();
+        this->futureBrick_->setPosition(xPos, yPos, 0.0f);
+        this->futureBrick_->setGame(this);
     }
 
@@ -389,6 +416,6 @@
 
     /**
-    @brief Check each row if it is full. Remove all full rows. Let all stones above the deleted row sink down.
-    @brief Manage score.
+    @brief Check each row if it is full. Removes all full rows. Update
+    @brief Manages score.
     */
     void Tetris::findFullRows()
@@ -399,5 +426,5 @@
     	{
     	    stonesPerRow = 0;
-            for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it)
+            for(std::vector<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
             {
             	correctPosition = static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize());
@@ -408,4 +435,5 @@
                     {
                         clearRow(row);
+                        row--; //the row counter has to be decreased in order to detect multiple rows!
                         this->playerScored(this->player_);// add points
                         //increase the stone's speed
@@ -413,7 +441,5 @@
                     }
                 }
-
             }
-
         }
     }
Index: /code/branches/pCuts/src/modules/tetris/Tetris.h
===================================================================
--- /code/branches/pCuts/src/modules/tetris/Tetris.h	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/Tetris.h	(revision 9092)
@@ -96,4 +96,5 @@
             std::vector< std::vector<bool> > grid_;
             TetrisBrick* activeBrick_;
+            TetrisBrick* futureBrick_;
             
             Timer starttimer_; //!< A timer to delay the start of the game.
Index: /code/branches/pCuts/src/modules/tetris/TetrisBrick.cc
===================================================================
--- /code/branches/pCuts/src/modules/tetris/TetrisBrick.cc	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/TetrisBrick.cc	(revision 9092)
@@ -49,4 +49,5 @@
     @brief
         Constructor. Registers and initializes the object.
+    @ingroup Tetris
     */
     TetrisBrick::TetrisBrick(BaseObject* creator): ControllableEntity(creator)
@@ -71,5 +72,4 @@
     { //Index 0 : single stone, 1 : 4 in a row; 2: 4-Block right shifted; 3: 'T' 4: 4-Block left shifted;
       //Index 5 : 4-Block; 6 : 'L'; 7 : mirrored 'L';
-        orxout()<< "TetrisBrick::createBrick" << endl;
         if(this->shapeIndex_ == 0)
             this->stonesPerBrick_ = 1;
Index: /code/branches/pCuts/src/modules/tetris/TetrisCenterpoint.cc
===================================================================
--- /code/branches/pCuts/src/modules/tetris/TetrisCenterpoint.cc	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/TetrisCenterpoint.cc	(revision 9092)
@@ -30,4 +30,5 @@
     @file TetrisCenterpoint.cc
     @brief Implementation of the TetrisCenterpoint class.
+    @ingroup Tetris
 */
 
Index: /code/branches/pCuts/src/modules/tetris/TetrisScore.cc
===================================================================
--- /code/branches/pCuts/src/modules/tetris/TetrisScore.cc	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/TetrisScore.cc	(revision 9092)
@@ -30,4 +30,5 @@
     @file TetrisScore.cc
     @brief Implementation of the TetrisScore class.
+    @ingroup Tetris
 */
 
@@ -49,4 +50,5 @@
     @brief
         Constructor. Registers and initializes the object.
+    @ingroup Tetris
     */
     TetrisScore::TetrisScore(BaseObject* creator) : OverlayText(creator)
@@ -56,5 +58,4 @@
         this->owner_ = 0;
         this->player_ = NULL;
-        this->lock_ = true;
     }
 
@@ -91,9 +92,8 @@
         {
             std::string score("0");
-	        if(!this->owner_->hasEnded() && this->lock_)
+	        if(!this->owner_->hasEnded())
             {
                 //get the player
                 player_ = this->owner_->getPlayer();
-                this->lock_ = false;
             }
 
Index: /code/branches/pCuts/src/modules/tetris/TetrisScore.h
===================================================================
--- /code/branches/pCuts/src/modules/tetris/TetrisScore.h	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/TetrisScore.h	(revision 9092)
@@ -67,5 +67,4 @@
             Tetris* owner_; //!< The Tetris game that owns this TetrisScore.
             PlayerInfo* player_; //!< Store information about the player permanently.
-            bool lock_;
     };
 }
Index: /code/branches/pCuts/src/modules/tetris/TetrisStone.cc
===================================================================
--- /code/branches/pCuts/src/modules/tetris/TetrisStone.cc	(revision 9091)
+++ /code/branches/pCuts/src/modules/tetris/TetrisStone.cc	(revision 9092)
@@ -30,4 +30,5 @@
     @file TetrisStone.cc
     @brief Implementation of the TetrisStone class.
+    @ingroup Tetris
 */
 
