[Orxonox-commit 4615] r9286 - in code/branches/presentation2012merge: . data/levels src/modules/tetris src/orxonox src/orxonox/gametypes

jo at orxonox.net jo at orxonox.net
Sun Jun 10 17:13:01 CEST 2012


Author: jo
Date: 2012-06-10 17:13:00 +0200 (Sun, 10 Jun 2012)
New Revision: 9286

Added:
   code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.cc
   code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.h
   code/branches/presentation2012merge/src/modules/tetris/TetrisScore.cc
   code/branches/presentation2012merge/src/modules/tetris/TetrisScore.h
Modified:
   code/branches/presentation2012merge/
   code/branches/presentation2012merge/data/levels/presentationHS11.oxw
   code/branches/presentation2012merge/data/levels/tetris.oxw
   code/branches/presentation2012merge/src/modules/tetris/CMakeLists.txt
   code/branches/presentation2012merge/src/modules/tetris/Tetris.cc
   code/branches/presentation2012merge/src/modules/tetris/Tetris.h
   code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.cc
   code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.h
   code/branches/presentation2012merge/src/modules/tetris/TetrisPrereqs.h
   code/branches/presentation2012merge/src/modules/tetris/TetrisStone.cc
   code/branches/presentation2012merge/src/modules/tetris/TetrisStone.h
   code/branches/presentation2012merge/src/orxonox/OrxonoxPrereqs.h
   code/branches/presentation2012merge/src/orxonox/gametypes/Dynamicmatch.cc
   code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.cc
   code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.h
   code/branches/presentation2012merge/src/orxonox/gametypes/TeamGametype.cc
Log:
Merged pCuts branch.


Property changes on: code/branches/presentation2012merge
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/tetris:8100-8563
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
   + /code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/tetris:8100-8563
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890

Modified: code/branches/presentation2012merge/data/levels/presentationHS11.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/presentationHS11.oxw	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/data/levels/presentationHS11.oxw	2012-06-10 15:13:00 UTC (rev 9286)
@@ -1,3 +1,6 @@
+<!-- TODO: add in level documentation !! -->
+
+
 <LevelInfo
  name = "Presentation HS 2011"
  description = "Oxonox Proudly Presents New Features From HS 2011"
@@ -80,6 +83,8 @@
     </SimpleNotification>
 
 
+
+
 <!-- ADDING FORMATION: 5 Swallows -->
 <?lua for i=0,4,1 do
 ?>
@@ -130,12 +135,100 @@
     </SpaceShip>
 <?lua end ?>
 
+<!-- @Triggers: "hintX" <->  delayed LetsGo -->
+    <EventTrigger name="hint1" activations="1" stayactive="true" delay=4.2>
+      <events>
+        <trigger>
+          <EventListener event="LetsGo" />
+        </trigger>
+      </events>
+    </EventTrigger>
+    <EventTrigger name="hint2" activations="1" stayactive="true" delay=8.4>
+      <events>
+        <trigger>
+          <EventListener event="LetsGo" />
+        </trigger>
+      </events>
+    </EventTrigger>
+    <EventTrigger name="hint3" activations="1" stayactive="true" delay=12.6>
+      <events>
+        <trigger>
+          <EventListener event="LetsGo" />
+        </trigger>
+      </events>
+    </EventTrigger>
+    <EventTrigger name="hint4" activations="1" stayactive="true" delay=16.8>
+      <events>
+        <trigger>
+          <EventListener event="LetsGo" />
+        </trigger>
+      </events>
+    </EventTrigger>
+    <EventTrigger name="hint5" activations="1" stayactive="true" delay=21>
+      <events>
+        <trigger>
+          <EventListener event="LetsGo" />
+        </trigger>
+      </events>
+    </EventTrigger>
+    <EventTrigger name="hint6" activations="1" stayactive="true" delay=25.2>
+      <events>
+        <trigger>
+          <EventListener event="LetsGo" />
+        </trigger>
+      </events>
+    </EventTrigger>
 
 
 
+    <SimpleNotification message="Make bots follow you: Press (1)"  broadcast="true">
+        <events>
+            <trigger>
+                <EventListener event=hint1 />
+            </trigger>
+        </events>
+    </SimpleNotification>
 
+    <SimpleNotification message="Toggle group behaviour: Press (1)"  broadcast="true">
+        <events>
+            <trigger>
+                <EventListener event=hint2 />
+            </trigger>
+        </events>
+    </SimpleNotification>
 
+    <SimpleNotification message="Tell the bots to defend you: Press (2)"  broadcast="true">
+        <events>
+            <trigger>
+                <EventListener event=hint3 />
+            </trigger>
+        </events>
+    </SimpleNotification>
 
+    <SimpleNotification message="Make them attack opponents: Press (2)"  broadcast="true">
+        <events>
+            <trigger>
+                <EventListener event=hint4 />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification message="Let the bots behave normal: Press (2) "  broadcast="true">
+        <events>
+            <trigger>
+                <EventListener event=hint5 />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification message="Have a look at the console to verify this."  broadcast="true">
+        <events>
+            <trigger>
+                <EventListener event=hint6 />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
 <!-- Generate asteroid field and asteroid belt -->
 <!-- asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog) -->
     <?lua

Modified: code/branches/presentation2012merge/data/levels/tetris.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/tetris.oxw	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/data/levels/tetris.oxw	2012-06-10 15:13:00 UTC (rev 9286)
@@ -8,6 +8,7 @@
 <?lua
   include("HUDTemplates3.oxo")
   include("stats.oxo")
+  include("tetrisHUD.oxo")
   include("templates/lodInformation.oxt")
 ?>
 
@@ -15,8 +16,6 @@
   <TetrisStone>
     <camerapositions>
       <CameraPosition position="55,75,200" absolute=true />
-      <CameraPosition position="0,50,160" drag=true mouselook=true />
-      <CameraPosition position="0,50,0" pitch=-90 drag=true mouselook=true />
     </camerapositions>
   </TetrisStone>
 </Template>
@@ -24,11 +23,29 @@
 <Template name=tetrisstone>
   <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>
 </Template>
 
+
+
+<Template name=tetrisbrickcameras defaults=0>
+  <TetrisBrick>
+    <camerapositions>
+      <CameraPosition position="55,75,200" absolute=true />
+      <CameraPosition position="0,50,160" drag=true mouselook=true />
+      <CameraPosition position="0,50,0" pitch=-90 drag=true mouselook=true />
+    </camerapositions>
+  </TetrisBrick>
+</Template>
+
+<Template name=tetrisbrick>
+  <TetrisBrick camerapositiontemplate=tetrisbrickcameras>
+  </TetrisBrick>
+</Template>
+
+
 <Level
  gametype = "Tetris"
 >
@@ -41,21 +58,45 @@
    ambientlight = "0.5, 0.5, 0.5"
    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
       for i = 1, 10, 1 do
     ?>
       <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" />
     <?lua end ?>
 
-    <TetrisCenterpoint name=tetriscenter width=11 height=15 stoneSize=10 stoneTemplate=tetrisstone stoneSpeed=10 position="-55,-75,0">
+    <TetrisCenterpoint name=tetriscenter width=11 height=15 stoneSize=10 stoneTemplate=tetrisstone brickTemplate=tetrisbrick stoneSpeed=10 position="-55,-75,0">
         <attached>
             <Model position="55,-1,0" mesh="cube.mesh" scale3D="57,1,11" />
             <Model position="-1,76,0" mesh="cube.mesh" scale3D="1,76,1" />
             <Model position="111,76,0" mesh="cube.mesh" scale3D="1,76,1" />
         </attached>
+        <!--collisionShapes>
+            <BoxCollisionShape position="55,-1,0"  halfExtents="57,1,11" />
+            <BoxCollisionShape position="-1,76,0"  halfExtents="1,76,1" />
+            <BoxCollisionShape position="111,76,0" halfExtents="1,76,1" />
+        </collisionShapes-->
     </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>

Modified: code/branches/presentation2012merge/src/modules/tetris/CMakeLists.txt
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/CMakeLists.txt	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/CMakeLists.txt	2012-06-10 15:13:00 UTC (rev 9286)
@@ -2,6 +2,8 @@
   Tetris.cc
   TetrisCenterpoint.cc
   TetrisStone.cc
+  TetrisBrick.cc
+  TetrisScore.cc
 )
 
 ORXONOX_ADD_LIBRARY(tetris
@@ -9,5 +11,6 @@
   FIND_HEADER_FILES
   LINK_LIBRARIES
     orxonox
+    overlays
   SOURCE_FILES ${TETRIS_SRC_FILES}
 )

Modified: code/branches/presentation2012merge/src/modules/tetris/Tetris.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/Tetris.cc	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/Tetris.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -22,8 +22,16 @@
  *   Author:
  *      ...
  *   Co-authors:
- *      ...
+ *      Johannes Ritz
  *
+ *
+ *BUG c) destroying the old stones causes segfault -> WeakPointer as solution ?
+ *BUG d) wrong collision detection: sometimes stones "bounce off"
+ *
+ *
+ *TASK c) end the game in a nicer way
+ *TASK d) save the highscore
+ *TASK e) eye candy
  */
 
 /**
@@ -41,6 +49,7 @@
 
 #include "TetrisCenterpoint.h"
 #include "TetrisStone.h"
+#include "TetrisBrick.h"
 #include "infos/PlayerInfo.h"
 
 namespace orxonox
@@ -51,18 +60,22 @@
     /**
     @brief
         Constructor. Registers and initializes the object.
+    @ingroup Tetris
     */
     Tetris::Tetris(BaseObject* creator) : Deathmatch(creator)
     {
         RegisterObject(Tetris);
 
-        this->activeStone_ = NULL;
+        this->activeBrick_ = NULL;
 
         // Pre-set the timer, but don't start it yet.
-        this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Tetris::startStone, this)));
+        this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Tetris::startBrick, this)));
         this->starttimer_.stopTimer();
 
         this->player_ = NULL;
+        this->endGameCriteria_ = 0.0f;
+        this->setHUDTemplate("TetrisHUD");
+        this->futureBrick_ = NULL;
     }
 
     /**
@@ -81,6 +94,10 @@
     */
     void Tetris::cleanup()
     {
+        /*for(int i = 0;i < this->stones_.size(); i++) //TODO: Why isn't there any code like this
+        {                                              // compensating the 'new' statement?
+            delete this->stones_[i];
+        }//*/
 
     }
 
@@ -88,13 +105,20 @@
     {
         SUPER(Tetris, tick, dt);
 
-        if(this->activeStone_ != NULL)
+        if((this->activeBrick_ != NULL)&&(!this->hasEnded()))
         {
-            if(!this->isValidStonePosition(this->activeStone_, this->activeStone_->getPosition()))
+        	this->endGameCriteria_ += dt;
+            if(!this->isValidBrickPosition(this->activeBrick_, this->activeBrick_->getPosition()))
             {
-                this->activeStone_->setVelocity(Vector3::ZERO);
-                this->createStone();
-                this->startStone();
+                this->activeBrick_->setVelocity(Vector3::ZERO);
+                this->activeBrick_->releaseStones(this->center_);
+                //delete this->activeBrick_; //releasing the memory
+                this->findFullRows();
+                if(this->endGameCriteria_ < 0.1f) //end game if two bricks are created within a 0.1s interval.
+                    this->end();
+                this->createBrick();
+                this->startBrick();
+                this->endGameCriteria_ = 0.0f;
             }
         }
     }
@@ -122,6 +146,43 @@
         return true;
     }
 
+    /**
+    @brief
+        Check for each stone in a brick if it is moved the right way.
+    */
+    bool Tetris::isValidMove(TetrisBrick* brick, const Vector3& position, bool isRotation = false)
+    {
+        assert(brick);
+
+        for (unsigned int i = 0; i < brick->getNumberOfStones(); i++ )
+        {
+            TetrisStone* stone = brick->getStone(i);
+            Vector3 stonePosition; //the current stone's offset to position
+            if(isRotation)
+            	stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()+1);
+            else
+                stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount());
+
+            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;
+                }
+            }
+        }
+        return true;
+
+    }
+
+
+
     bool Tetris::isValidStonePosition(TetrisStone* stone, const Vector3& position)
     {
         assert(stone);
@@ -129,14 +190,21 @@
         // we use a reverse iterator because we have to check for collisions with the topmost stones first
         for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it)
         {
-            if(stone == *it)
+            if(this->activeBrick_->contains(*it))//skip the moving brick' stones
                 continue;
-
+            //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());
             const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
+            //!< Saves the position of the currentStone
 
+            //filter out cases where the falling stone is already below a steady stone
+            if(position.y < currentStonePosition.y - this->center_->getStoneSize()/2.0f)
+                continue;
             if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize()))
             {
-                this->activeStone_->setPosition(Vector3(this->activeStone_->getPosition().x, currentStonePosition.y+this->center_->getStoneSize(), this->activeStone_->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
         }
@@ -144,23 +212,61 @@
         // after we checked for collision with all stones, we also check for collision with the bottom
         if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
         {
-            stone->setPosition(Vector3(stone->getPosition().x, this->center_->getStoneSize()/2.0f, stone->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;
         }
 
         return true;
     }
+    /**
+     * @brief This function determines wether a brick touches another brick or the ground.
+     *
+     */
+    bool Tetris::isValidBrickPosition(TetrisBrick* brick, const Vector3& position)
+    {
+        assert(brick);
 
+        for (unsigned int i = 0; i < brick->getNumberOfStones(); i++ )
+        {
+            TetrisStone* stone = brick->getStone(i);
+            Vector3 stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount());
+            if(! this->isValidStonePosition(stone, position + stonePosition) )
+                return false;
+        }
+        return true;
+    }
+
     /**
     @brief
+        A Vector3 is rolled 90 * degrees * amount (anticlockwise rotation)
+    */
+    Vector3 Tetris::rotateVector(Vector3 position, unsigned int amount)
+    {
+    	int temp = 0;
+        for(unsigned int i = 0; i < amount; i++)
+        {
+            temp = position.x;
+            position.x = -position.y;
+            position.y = temp;
+        }
+        return position;
+    }
+
+    /**
+    @brief
         Starts the Tetris minigame.
     */
     void Tetris::start()
     {
         if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place.
         {
-            // Create the first stone.
-            this->createStone();
+            // Create the futureBrick_
+            this->createBrick();
+            // Create the first brick.
+            this->createBrick();
         }
         else // If no centerpoint was specified, an error is thrown and the level is exited.
         {
@@ -189,6 +295,12 @@
     */
     void Tetris::end()
     {
+        this->activeBrick_->setVelocity(Vector3::ZERO);
+        if(this->activeBrick_ != NULL)
+        {
+            this->player_->stopControl();
+        }
+
         this->cleanup();
 
         // Call end for the parent class.
@@ -224,52 +336,59 @@
         }
     }
 
-    /**
-    @brief
-        Starts the first stone.
-    */
-    void Tetris::startStone(void)
+
+
+    void Tetris::startBrick(void)
     {
         if(this->player_ == NULL)
             return;
 
         unsigned int cameraIndex = 0;
-        if(this->activeStone_ != NULL)
+        if(this->activeBrick_ != NULL)
         {
             // Get camera settings
-            cameraIndex = this->activeStone_->getCurrentCameraIndex();
+            cameraIndex = this->activeBrick_->getCurrentCameraIndex();
             this->player_->stopControl();
         }
-        
-        // Make the last stone to be created the active stone.
-        this->activeStone_ = this->stones_.back();
-        
-        this->player_->startControl(this->activeStone_);
-        this->activeStone_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f);
-        this->activeStone_->setCameraPosition(cameraIndex);
+
+        // Make the last brick to be created the active brick.
+        this->activeBrick_ = this->bricks_.back();
+
+        this->player_->startControl(this->activeBrick_);
+        this->activeBrick_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f);
+        this->activeBrick_->setCameraPosition(cameraIndex);
     }
 
-    /**
-    @brief
-        Creates a new stone.
-    */
-    void Tetris::createStone(void)
+    void Tetris::createBrick(void)             //TODO: random rotation offset between 0 and 3 (times 90°)
     {
-        // Create a new stone and add it to the list of stones.
-        TetrisStone* stone = new TetrisStone(this->center_);
-        this->stones_.push_back(stone);
-        
+        // 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.
-        stone->addTemplate(this->center_->getStoneTemplate());
-        
-        // Attach the stone to the Centerpoint and set the position of the stone to be at the top middle.
-        this->center_->attach(stone);
-        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();
-        stone->setPosition(xPos, yPos, 0.0f);
-        stone->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);
     }
 
+
     /**
     @brief
         Get the player.
@@ -281,6 +400,11 @@
         return this->player_;
     }
 
+    /*TetrisCenterpoint* Tetris::getCenterpoint(void) const
+    {
+        return this->center_;
+    }*/
+
     /**
     @brief Set the TetrisCenterpoint (the playing field).
     @param center A pointer to the TetrisCenterpoint to be set.
@@ -290,4 +414,52 @@
         this->center_ = center;
     }
 
+    /**
+    @brief Check each row if it is full. Removes all full rows. Update
+    @brief Manages score.
+    */
+    void Tetris::findFullRows()
+    {
+    	unsigned int correctPosition = 0;
+    	unsigned int stonesPerRow = 0;
+    	for (unsigned int row = 0; row < this->center_->getHeight(); row++)
+    	{
+    	    stonesPerRow = 0;
+            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());
+                if(correctPosition == row)
+                {
+                    stonesPerRow++;
+                    if(stonesPerRow == this->center_->getWidth())
+                    {
+                        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
+                        this->center_->setStoneSpeed(this->center_->getStoneSpeed()+1.0f);
+                    }
+                }
+            }
+        }
+    }
+
+    void Tetris::clearRow(unsigned int row)
+    {// clear the full row
+        for(std::vector<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        {
+            if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row)
+            	(*it)->setPosition(Vector3(-50,-50,100));
+            	//{(*it)->destroy(); this->stones_.erase(it); orxout()<< "destroy row "<<endl;}//experimental
+        }
+      // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug.
+        for(std::vector<TetrisStone*>::iterator it2 = this->stones_.begin(); it2 != this->stones_.end(); ++it2)
+        {
+            if(static_cast<unsigned int>(((*it2)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
+                (*it2)->setPosition((*it2)->getPosition()-Vector3(0,10,0));
+        }
+
+    }
+
+
 }

Modified: code/branches/presentation2012merge/src/modules/tetris/Tetris.h
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/Tetris.h	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/Tetris.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -67,26 +67,38 @@
             void setCenterpoint(TetrisCenterpoint* center);
 
             PlayerInfo* getPlayer(void) const; //!< Get the player.
+            WeakPtr<TetrisCenterpoint> getCenterpoint(void)
+                { return this->center_; }
 
             bool isValidMove(TetrisStone* stone, const Vector3& position);
+            bool isValidMove(TetrisBrick* brick, const Vector3& position, bool isRotation);
+            Vector3 rotateVector(Vector3 position, unsigned int amount);
 
         protected:
             virtual void spawnPlayersIfRequested(); //!< Spawns player.
 
+
         private:
-            void startStone(void); //!< Starts with the first stone.
-            void createStone(void);
+            void startBrick(void);
+            void createBrick(void);
             void cleanup(void); //!< Cleans up the Gametype by destroying the ball and the bats.
             bool isValidStonePosition(TetrisStone* stone, const Vector3& position);
+            bool isValidBrickPosition(TetrisBrick* brick, const Vector3& position);
+            void findFullRows(void);
+            void clearRow(unsigned int row);
+
             
             PlayerInfo* player_;
 
             WeakPtr<TetrisCenterpoint> center_; //!< The playing field.
+            std::vector<TetrisBrick*> bricks_; //!< A list of all bricks in play.
             std::vector<TetrisStone*> stones_; //!< A list of all stones in play.
             std::vector< std::vector<bool> > grid_;
-            TetrisStone* activeStone_;
+            TetrisBrick* activeBrick_;
+            TetrisBrick* futureBrick_;
             
             Timer starttimer_; //!< A timer to delay the start of the game.
+            float endGameCriteria_; //<! Works as a timer which is resetted, whenever a brick is created.
     };
 }
 

Copied: code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.cc (from rev 9284, code/branches/pCuts/src/modules/tetris/TetrisBrick.cc)
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.cc	                        (rev 0)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -0,0 +1,258 @@
+/*
+ *   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:
+ *      ...
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file TetrisBrick.cc
+    @brief Implementation of the TetrisBrick class.
+*/
+
+#include "TetrisBrick.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "TetrisCenterpoint.h"
+#include "TetrisStone.h"
+#include "Tetris.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    CreateFactory(TetrisBrick);
+
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    @ingroup Tetris
+    */
+    TetrisBrick::TetrisBrick(BaseObject* creator): ControllableEntity(creator)
+    {
+        RegisterObject(TetrisBrick);
+        this->shapeIndex_ = static_cast<unsigned int>(rnd(7.0f)); //<! random number between 0 and 7
+        this->stonesPerBrick_ = 4; //<! most tetris bricks is formed by 4 stones
+        this->delay_ = false;
+        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisBrick::enableMovement, this)));
+        this->lockRotation_ = false;
+        this->tetris_ = this->getTetris();
+        this->size_ = 10.0f; //TODO: fix this via this->tetris_->center_->getStoneSize();
+        this->rotationCount_ = 0;
+        this->createBrick(); //<! create a whole new Brick;
+    }
+
+    /**
+    @brief
+        This function partly initializes a TetrisBrick as an array of TetrisStones
+    */
+    void TetrisBrick::createBrick(void)
+    { //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';
+        if(this->shapeIndex_ == 0)
+            this->stonesPerBrick_ = 1;
+        for (unsigned int i = 0; i < this->stonesPerBrick_; i++)
+        {
+            // Create a new stone and add it to the brick.
+            TetrisStone* stone = new TetrisStone(this);
+            stone->setHealth(1.0f);
+            this->brickStones_.push_back(stone);
+            this->attach(stone);
+            this->formBrick(stone, i);
+            if(this->tetris_ != NULL)
+            {
+                stone->setGame(this->tetris_);
+                if(this->tetris_->getCenterpoint() != NULL)
+                    stone->addTemplate(this->tetris_->getCenterpoint()->getStoneTemplate());
+                else
+                	orxout()<< "tetris_->getCenterpoint == NULL in TetrisBrick.cc"<< endl;
+            }
+            else
+                orxout()<< "tetris_ == NULL in TetrisBrick.cc"<< endl;
+        }
+    }
+
+    /**
+    @brief
+        This function creates the shape of a TetrisBrick. ! Spaghetti-Code !
+    @param i
+        The stone's number.
+    @param stone
+        The TetrisStone that is placed relative to the brick's position.
+    */
+    void TetrisBrick::formBrick(TetrisStone* stone, unsigned int i)
+    {
+        if(i == 0) //setting the first stone as
+        {
+            stone->setPosition(0.0f, 0.0f, 0.0f);
+        }
+        else if(i == 1)
+        {
+            stone->setPosition(0.0f, size_, 0.0f);
+        }
+        else if(i == 2)
+        {
+            if(this->shapeIndex_ == 1 || this->shapeIndex_ == 6 || this->shapeIndex_ == 7)
+            {
+            	stone->setPosition(0.0f, 2*size_, 0.0f);
+            }
+            else if(this->shapeIndex_ == 3 || this->shapeIndex_ == 4|| this->shapeIndex_ == 5)
+            {
+            	stone->setPosition(size_, 0, 0.0f);
+            }
+            else if(this->shapeIndex_ == 2)
+            {
+            	stone->setPosition(-size_, 0, 0.0f);
+            }
+        }
+        else if(i == 3)
+        {
+            if(this->shapeIndex_ == 2 || this->shapeIndex_ == 5)
+            {
+            	stone->setPosition(size_, size_, 0.0f);
+            }
+            else if(this->shapeIndex_ == 1)
+            {
+            	stone->setPosition(0, 3*size_, 0.0f);
+            }
+            else if(this->shapeIndex_ == 3 || this->shapeIndex_ == 7)
+            {
+            	stone->setPosition(-size_, 0, 0.0f);
+            }
+            else if(this->shapeIndex_ == 4)
+            {
+            	stone->setPosition(-size_, size_, 0.0f);
+            }
+            else if(this->shapeIndex_ == 6)
+            {
+            	stone->setPosition(size_, 0, 0.0f);
+            }
+        }
+    }
+
+    bool TetrisBrick::isValidMove(const Vector3& position, bool isRotation = false)
+    {
+    	return this->tetris_->isValidMove(this,position, isRotation);
+    }
+
+    TetrisStone* TetrisBrick::getStone(unsigned int i)
+    {
+    	if(i < this->brickStones_.size())
+            return this->brickStones_[i];
+    	else return NULL;
+    }
+
+
+    Tetris* TetrisBrick::getTetris()
+    {
+        if (this->getGametype() != NULL && this->getGametype()->isA(Class(Tetris)))
+        {
+            Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype().get());
+            return tetrisGametype;
+        }
+        return NULL;
+    }
+//TODO: refactor this function; is not needed if brickstones are added to Tetris::stones_ after collision.
+    bool TetrisBrick::contains(TetrisStone* stone)
+    {
+        for(unsigned int i = 0; i < brickStones_.size(); i++)
+        {
+            if(stone == brickStones_[i])
+                return true;
+        }
+        return false;
+    }
+
+    /**
+    @brief
+        Overloaded the function to rotate the Brick.
+    @param value
+        A vector whose first component is the angle by which to rotate.
+    */
+    void TetrisBrick::moveFrontBack(const Vector2& value)
+    {
+        if(value.x < 0) //speedup on key down
+        {
+            this->setVelocity(this->getVelocity()*1.1);
+        }
+        else if(!this->lockRotation_) //rotate when key up is pressed
+        {
+        	if(!isValidMove(this->getPosition(), true)) //catch illegal rotations
+        	    return;
+            this->lockRotation_ = true; // multiple calls of this function have to be filtered out.
+            this->rotationTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&TetrisBrick::unlockRotation, this)));
+            Quaternion q(Degree(90), Vector3::UNIT_Z);
+            this->setOrientation(this->getOrientation()*q); //rotation: roll 90°
+            this->rotationCount_ = (this->rotationCount_ + 1) % 4;
+        }
+    }
+
+    /**
+    @brief
+        Overloaded the function to steer the Brick right and left
+    @param value
+        A vector whose first component is the direction in which we want to steer the Brick.
+    */
+    void TetrisBrick::moveRightLeft(const Vector2& value)
+    {
+        if(!this->delay_)
+        {
+            const Vector3& position = this->getPosition();
+            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
+            if(!this->isValidMove(newPos))
+                return;
+
+            this->setPosition(newPos);
+            this->delay_ = true;
+            this->delayTimer_.startTimer();
+        }
+    }
+
+    /**
+    @brief
+        Is called when the player changed.
+    */
+    void TetrisBrick::changedPlayer()
+    {
+        this->setVelocity(0.0f, 0.0f, 0.0f);
+    }
+
+    /**
+    @brief
+        Attaches stones to the Centerpoint.
+    */
+    void TetrisBrick::releaseStones(TetrisCenterpoint* center)
+    {
+        assert(this->tetris_);
+        for(unsigned int i = 0; i < brickStones_.size(); i++)
+        {
+            this->brickStones_[i]->detachFromParent();
+            this->brickStones_[i]->attachToParent(center);
+            this->brickStones_[i]->setPosition(this->getPosition()+this->tetris_->rotateVector(this->brickStones_[i]->getPosition(),this->rotationCount_ ));
+        }
+
+    }
+
+}

Copied: code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.h (from rev 9284, code/branches/pCuts/src/modules/tetris/TetrisBrick.h)
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.h	                        (rev 0)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -0,0 +1,107 @@
+/*
+ *   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:
+ *      ...
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file TetrisBrick.h
+    @brief Declaration of the TetrisBrick class.
+    @ingroup Tetris
+*/
+
+#ifndef _TetrisBrick_H__
+#define _TetrisBrick_H__
+
+#include "tetris/TetrisPrereqs.h"
+
+#include "worldentities/ControllableEntity.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        ContainerClass in order to create TetrisBricks by combining TetrisStones.
+    @author
+
+    @ingroup Tetris
+    */
+    class _TetrisExport TetrisBrick : public ControllableEntity
+    {
+        public:
+            TetrisBrick(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+            virtual ~TetrisBrick() {}
+
+            virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+            virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+            virtual void changedPlayer(); //!< Is called when the player changed.
+
+            bool isValidMove(const Vector3& position, bool isRotation);
+            unsigned int getNumberOfStones(void) const
+                { return this->brickStones_.size(); }
+            TetrisStone* getStone(unsigned int i);
+            bool contains(TetrisStone* stone);
+
+            void setGame(Tetris* tetris)
+                { assert(tetris); tetris_ = tetris; }
+            unsigned int getRotationCount(void)
+                { return this->rotationCount_;}
+
+            void releaseStones(TetrisCenterpoint* center);
+
+        protected:
+            void createBrick(void); //!< Create a cluster of TetrisStones
+            void formBrick(TetrisStone* stone, unsigned int i);
+            Tetris* getTetris();
+
+            unsigned int shapeIndex_; //!< My way to represent the different brick shapes.
+            unsigned int stonesPerBrick_; //!< So many stones are contained in this brick.
+            std::vector<TetrisStone*> brickStones_; //!< A list of all stones in a brick.
+
+
+            void enableMovement(void)
+                { this->delay_ = false; }
+            void unlockRotation(void)
+                { this->lockRotation_ = false; }
+
+            float getSize(void) const
+                { return this->size_; }
+
+
+            float size_; //!< The dimensions a stone has in the game world. //TODO: get stone dimensions
+            bool delay_;
+            bool lockRotation_;
+
+            unsigned int rotationCount_; //!< Stores the bricks orientation
+            Timer delayTimer_;
+            Timer rotationTimer_; ///!< This timer is used to filter out multiple rotation inputs.
+            Tetris* tetris_; //<! The Tetris class is responsible to initialize this value.
+
+    };
+}
+
+#endif /* _TetrisBrick_H__ */

Modified: code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.cc	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -29,6 +29,7 @@
 /**
     @file TetrisCenterpoint.cc
     @brief Implementation of the TetrisCenterpoint class.
+    @ingroup Tetris
 */
 
 #include "TetrisCenterpoint.h"
@@ -54,6 +55,7 @@
         this->height_ = 11;
         this->stoneSize_ = 10.0f;
         this->stoneTemplate_ = "";
+        this->brickTemplate_ = "";
         this->stoneSpeed_ = 20.0f;
         
         this->checkGametype();
@@ -68,9 +70,10 @@
         SUPER(TetrisCenterpoint, XMLPort, xmlelement, mode);
 
         XMLPortParam(TetrisCenterpoint, "width", setWidth, getWidth, xmlelement, mode); // die Breite
-        XMLPortParam(TetrisCenterpoint, "height", setHeight, setWidth, xmlelement, mode); // die Grösse
+        XMLPortParam(TetrisCenterpoint, "height", setHeight, getHeight, xmlelement, mode); // die Grösse //was sollte das mit setWidth??
         XMLPortParam(TetrisCenterpoint, "stoneSize", setStoneSize, getStoneSize, xmlelement, mode); 
         XMLPortParam(TetrisCenterpoint, "stoneTemplate", setStoneTemplate, getStoneTemplate, xmlelement, mode);
+        XMLPortParam(TetrisCenterpoint, "brickTemplate", setBrickTemplate, getBrickTemplate, xmlelement, mode);
         XMLPortParam(TetrisCenterpoint, "stoneSpeed", setStoneSpeed, getStoneSpeed, xmlelement, mode);
     }
 

Modified: code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.h
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.h	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisCenterpoint.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -44,7 +44,8 @@
 #include "worldentities/StaticEntity.h"
 
 namespace orxonox
-{
+{//idea: add 2 triggers to the centerpoint (one to determine when a box would go above the centerpoint;
+//the other to find out when the lowest row is filled totally)
     
     /**
     @brief
@@ -117,6 +118,19 @@
                 { return this->stoneTemplate_; }
             
             /**
+            @brief Set the template for the bricks.
+            @param template The template name to be applied to each brick.
+            */
+            void setBrickTemplate(const std::string& templateName)
+                { this->brickTemplate_ = templateName; }
+            /**
+            @brief Get the template for the bricks.
+            @return Returns the template name to be applied to each brick.
+            */
+            const std::string& getBrickTemplate(void) const
+                { return this->brickTemplate_; }
+
+            /**
             @brief Set the speed of the stones.
             @param speed The speed to be set.
             */
@@ -136,6 +150,7 @@
             unsigned int height_;
             float stoneSize_;
             std::string stoneTemplate_;
+            std::string brickTemplate_;
             float stoneSpeed_;
 
     };

Modified: code/branches/presentation2012merge/src/modules/tetris/TetrisPrereqs.h
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisPrereqs.h	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisPrereqs.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -67,6 +67,8 @@
     class Tetris;
     class TetrisCenterpoint;
     class TetrisStone;
+    class TetrisBrick;
+    class TetrisScore;
 }
 
 #endif /* _TetrisPrereqs_H__ */

Copied: code/branches/presentation2012merge/src/modules/tetris/TetrisScore.cc (from rev 9284, code/branches/pCuts/src/modules/tetris/TetrisScore.cc)
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisScore.cc	                        (rev 0)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisScore.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -0,0 +1,124 @@
+/*
+ *   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:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file TetrisScore.cc
+    @brief Implementation of the TetrisScore class.
+    @ingroup Tetris
+*/
+
+#include "TetrisScore.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+
+#include "infos/PlayerInfo.h"
+
+#include "Tetris.h"
+
+namespace orxonox
+{
+    CreateFactory(TetrisScore);
+
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    @ingroup Tetris
+    */
+    TetrisScore::TetrisScore(BaseObject* creator) : OverlayText(creator)
+    {
+        RegisterObject(TetrisScore);
+
+        this->owner_ = 0;
+        this->player_ = NULL;
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    TetrisScore::~TetrisScore()
+    {
+    }
+
+    /**
+    @brief
+        Method to create a TetrisScore through XML.
+    */
+    void TetrisScore::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(TetrisScore, XMLPort, xmlelement, mode);
+    }
+
+    /**
+    @brief
+        Is called each tick.
+        Creates and sets the caption to be displayed by the TetrisScore.
+    @param dt
+        The time that has elapsed since the last tick.
+    */
+    void TetrisScore::tick(float dt)
+    {
+        SUPER(TetrisScore, tick, dt);
+
+        // If the owner is set. The owner being a Tetris game.
+        if (this->owner_ != NULL)
+        {
+            std::string score("0");
+	        if(!this->owner_->hasEnded())
+            {
+                //get the player
+                player_ = this->owner_->getPlayer();
+            }
+
+            if(this->owner_->hasStarted())
+            {
+                // Save the name and score of each player as a string.
+                if (player_ != NULL)
+                    score = multi_cast<std::string>(this->owner_->getScore(player_));
+            }
+            this->setCaption(score);
+        }
+    }
+
+    /**
+    @brief
+        Is called when the owner changes.
+        Sets the owner to NULL, if it is not a pointer to a Tetris game.
+    */
+    void TetrisScore::changedOwner()
+    {
+        SUPER(TetrisScore, changedOwner);
+
+        if (this->getOwner() != NULL && this->getOwner()->getGametype())
+            this->owner_ = orxonox_cast<Tetris*>(this->getOwner()->getGametype().get());
+        else
+            this->owner_ = 0;
+    }
+}

Copied: code/branches/presentation2012merge/src/modules/tetris/TetrisScore.h (from rev 9284, code/branches/pCuts/src/modules/tetris/TetrisScore.h)
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisScore.h	                        (rev 0)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisScore.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -0,0 +1,71 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file TetrisScore.h
+    @brief Declaration of the TetrisScore class.
+    @ingroup Tetris
+*/
+
+#ifndef _TetrisScore_H__
+#define _TetrisScore_H__
+
+#include "tetris/TetrisPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        The TetrisScore class displays the score for a game of @ref orxonox::Tetris "Tetris".
+
+    @author
+        Johannes Ritz
+
+    @ingroup Tetris
+    */
+    class _TetrisExport TetrisScore : public OverlayText, public Tickable
+    {
+        public:
+            TetrisScore(BaseObject* creator);
+            virtual ~TetrisScore();
+
+            virtual void tick(float dt); //!< Creates and sets the caption to be displayed by the TetrisScore.
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void changedOwner(); //!< Is called when the owner changes.
+
+        private:
+            Tetris* owner_; //!< The Tetris game that owns this TetrisScore.
+            PlayerInfo* player_; //!< Store information about the player permanently.
+    };
+}
+#endif /* _TetrisScore_H__ */

Modified: code/branches/presentation2012merge/src/modules/tetris/TetrisStone.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisStone.cc	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisStone.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -29,6 +29,7 @@
 /**
     @file TetrisStone.cc
     @brief Implementation of the TetrisStone class.
+    @ingroup Tetris
 */
 
 #include "TetrisStone.h"
@@ -46,13 +47,15 @@
     @brief
         Constructor. Registers and initializes the object.
     */
-    TetrisStone::TetrisStone(BaseObject* creator) : ControllableEntity(creator)
+    TetrisStone::TetrisStone(BaseObject* creator) : Pawn(creator)
     {
         RegisterObject(TetrisStone);
-        
+
         this->size_ = 10.0f;
         this->delay_ = false;
         this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
+        this->lockRotation_ = false;
+
     }
 
     /**
@@ -63,10 +66,18 @@
     */
     void TetrisStone::moveFrontBack(const Vector2& value)
     {
-        if(value.x < 0)
+        if(value.x < 0) //speedup on key down
         {
             this->setVelocity(this->getVelocity()*1.1);
         }
+        else if(!this->lockRotation_) //rotate when key up is pressed
+        {
+            this->lockRotation_ = true; // multiple calls of this function have to be filtered out.
+            this->rotationTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&TetrisStone::unlockRotation, this)));
+            Quaternion q(Degree(90), Vector3::UNIT_Z);
+            this->setOrientation(this->getOrientation()*q); //rotation: roll 90°
+
+        }
     }
 
     /**

Modified: code/branches/presentation2012merge/src/modules/tetris/TetrisStone.h
===================================================================
--- code/branches/presentation2012merge/src/modules/tetris/TetrisStone.h	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/modules/tetris/TetrisStone.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -37,7 +37,7 @@
 
 #include "tetris/TetrisPrereqs.h"
 
-#include "worldentities/ControllableEntity.h"
+#include "worldentities/pawns/Pawn.h"
 #include "tools/Timer.h"
 
 namespace orxonox
@@ -50,7 +50,7 @@
 
     @ingroup Tetris
     */
-    class _TetrisExport TetrisStone : public ControllableEntity
+    class _TetrisExport TetrisStone : public Pawn
     {
         public:
             TetrisStone(BaseObject* creator); //!< Constructor. Registers and initializes the object.
@@ -80,10 +80,14 @@
         private:
             void enableMovement(void)
                 { this->delay_ = false; }
-            
+            void unlockRotation(void)
+                { this->lockRotation_ = false; }
+
             float size_; //!< The dimensions a stone has in the game world.
             bool delay_;
+            bool lockRotation_;
             Timer delayTimer_;
+            Timer rotationTimer_; ///!< This timer is used to filter out multiple rotation inputs.
 
             Tetris* tetris_;
     };

Modified: code/branches/presentation2012merge/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/presentation2012merge/src/orxonox/OrxonoxPrereqs.h	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/orxonox/OrxonoxPrereqs.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -108,6 +108,7 @@
     class TeamBaseMatch;
     class TeamDeathmatch;
     class UnderAttack;
+    class TeamGametype;
 
     // graphics
     class Backlight;

Modified: code/branches/presentation2012merge/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/branches/presentation2012merge/src/orxonox/gametypes/Dynamicmatch.cc	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/orxonox/gametypes/Dynamicmatch.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -30,18 +30,19 @@
 //killerfarbe schwarz; evtl. eigenes Raumfahrzeug;
 //Low; Codeoptimierung und Dokumentation
 
-/*
-short gaming manual:
-There are three different parties a player can belong to: victim, chaser or killer
-Every player starts as chaser. As long as there are not enough victims and killers, you can change your and other player's parties by shooting them.
-In order to win you have to earn as much points as possible:
-- as victim by escaping the chasers
-- as chaser by shooting the victim
-- as killer by killing the chasers
+/**
+ at brief
+    Short Gaming Manual:
+    There are three different parties a player can belong to: victim, chaser or killer
+    Every player starts as chaser. As long as there are not enough victims and killers, you can change your and other player's parties by shooting them.
+    In order to win you have to earn as much points as possible:
+    - as victim by escaping the chasers
+    - as chaser by shooting the victim
+    - as killer by killing the chasers
 
 
-What you shouldn't do is shooting at players of your own party. By doing so your score will decrease.
-P.S: If you don't want to be a victim: Get rid of your part by shooting a chaser.
+    What you shouldn't do is shooting at players of your own party. By doing so your score will decrease.
+    P.S: If you don't want to be a victim: Get rid of your part by shooting a chaser.
 */
 #include "Dynamicmatch.h"
 
@@ -94,7 +95,6 @@
             ColourValue(1.0f, 0.3f, 0.3f),  //chasercolour
             ColourValue(0.3f, 0.3f, 1.0f),  //piggycolour
             ColourValue(0.3f, 1.0f, 0.3f)   //killercolour  what about black: 0.0f, 0.0f, 0.0f
-
         };
         static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));
 
@@ -110,8 +110,8 @@
             return false;
         if (victim && victim->getPlayer()) //&& originator && originator->getPlayer() ??
         {
-        int target= playerParty_[victim->getPlayer()];
-        int source= playerParty_[originator->getPlayer()];
+            int target = playerParty_[victim->getPlayer()];
+            int source = playerParty_[originator->getPlayer()];
 
             //Case: Not Enough Pigs: party change (= party management)
             if (notEnoughPigs)
@@ -308,13 +308,13 @@
 
     /**
     @brief
-        Grant the piggy a boost.
+        Grant the victim a boost.
     @param spaceship
         The SpaceShip to give the boost.
     */
     void Dynamicmatch::grantPigBoost(SpaceShip* spaceship)
     {
-        // Give pig boost
+        // Give victim boost
         if (spaceship)
         {
             spaceship->addSpeedFactor(5);
@@ -373,11 +373,15 @@
         SUPER(Dynamicmatch, tick, dt);
 
         if (this->hasStarted() && !gameEnded_)
-        {   pointsPerTime =pointsPerTime + dt;
-            gameTime_ = gameTime_ - dt;
-            if (pointsPerTime > 2.0f)//hard coded!! should be changed
+        {
+orxout() << " number of chasers:  " << numberOf[chaser] << endl;
+orxout() << " number of killers:  " << numberOf[killer] << endl;
+orxout() << " number of victims:  " << numberOf[piggy] << endl;
+            pointsPerTime = pointsPerTime + dt; //increase points
+            gameTime_ = gameTime_ - dt; // decrease game time
+            if (pointsPerTime > 2.0f) //hard coded points for victim! should be changed
             {
-                pointsPerTime=0.0f;
+                pointsPerTime = 0.0f;
                 rewardPig();
             }
             if (gameTime_<= 0)
@@ -407,6 +411,9 @@
         }
     }
 
+/**
+    @brief The reward function is called every 2 seconds via the tick function and makes the victim score points.
+*/
     void Dynamicmatch::rewardPig()
     {
         for (std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden
@@ -414,7 +421,7 @@
             if (it->second==piggy)
             {
                  //Spieler mit der Pig-party frags++
-                 std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(it->first);// still not sure if right syntax
+                 std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(it->first);
                  if (it2 != this->players_.end())
                  {
                      it2->second.frags_++;

Modified: code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.cc
===================================================================
--- code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.cc	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -29,203 +29,98 @@
 #include "TeamDeathmatch.h"
 
 #include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "interfaces/TeamColourable.h"
-#include "worldentities/TeamSpawnPoint.h"
+#include "chat/ChatManager.h"
+#include "infos/PlayerInfo.h"
 #include "worldentities/pawns/Pawn.h"
 
 namespace orxonox
 {
     CreateUnloadableFactory(TeamDeathmatch);
 
-    TeamDeathmatch::TeamDeathmatch(BaseObject* creator) : Deathmatch(creator)
+    TeamDeathmatch::TeamDeathmatch(BaseObject* creator) : TeamGametype(creator)
     {
         RegisterObject(TeamDeathmatch);
+    }
 
-        this->teams_ = 2;
+    void TeamDeathmatch::start()
+    {
+        TeamGametype::start();
 
-        this->setConfigValues();
+        std::string message("The match has started!");
+        ChatManager::message(message);
     }
 
-    void TeamDeathmatch::setConfigValues()
+    void TeamDeathmatch::end()
     {
-        SetConfigValue(teams_, 2);
+        TeamGametype::end();
 
-        static ColourValue colours[] =
-        {
-            ColourValue(1.0f, 0.3f, 0.3f),
-            ColourValue(0.3f, 0.3f, 1.0f),
-            ColourValue(0.3f, 1.0f, 0.3f),
-            ColourValue(1.0f, 1.0f, 0.0f)
-        };
-        static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));
-
-        SetConfigValue(teamcolours_, defaultcolours);
+        std::string message("The match has ended.");
+        ChatManager::message(message);
     }
 
     void TeamDeathmatch::playerEntered(PlayerInfo* player)
     {
-        Deathmatch::playerEntered(player);
+        TeamGametype::playerEntered(player);
 
-        std::vector<unsigned int> playersperteam(this->teams_, 0);
-
-        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
-            if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
-                playersperteam[it->second]++;
-
-        unsigned int minplayers = static_cast<unsigned int>(-1);
-        size_t minplayersteam = 0;
-        for (size_t i = 0; i < this->teams_; ++i)
-        {
-            if (playersperteam[i] < minplayers)
-            {
-                minplayers = playersperteam[i];
-                minplayersteam = i;
-            }
-        }
-
-        this->teamnumbers_[player] = minplayersteam;
+        const std::string& message = player->getName() + " entered the game";
+        ChatManager::message(message);
     }
 
     bool TeamDeathmatch::playerLeft(PlayerInfo* player)
     {
-        bool valid_player = Deathmatch::playerLeft(player);
+        bool valid_player = TeamGametype::playerLeft(player);
 
         if (valid_player)
-            this->teamnumbers_.erase(player);
+        {
+            const std::string& message = player->getName() + " left the game";
+            ChatManager::message(message);
+        }
 
         return valid_player;
     }
-
-    bool TeamDeathmatch::allowPawnHit(Pawn* victim, Pawn* originator)
+    bool TeamDeathmatch::playerChangedName(PlayerInfo* player)
     {
-        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
-    }
+        bool valid_player = TeamGametype::playerChangedName(player);
 
-    bool TeamDeathmatch::allowPawnDamage(Pawn* victim, Pawn* originator)
-    {
-        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
-    }
+        if (valid_player)
+        {
+            const std::string& message = player->getOldName() + " changed name to " + player->getName();
+            ChatManager::message(message);
+        }
 
-    bool TeamDeathmatch::allowPawnDeath(Pawn* victim, Pawn* originator)
-    {
-        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
+        return valid_player;
     }
 
-    SpawnPoint* TeamDeathmatch::getBestSpawnPoint(PlayerInfo* player) const
+    void TeamDeathmatch::pawnKilled(Pawn* victim, Pawn* killer)
     {
-        int desiredTeamNr = -1;
-        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
-        if (it_player != this->teamnumbers_.end())
-            desiredTeamNr = it_player->second;
-
-        // Only use spawnpoints of the own team (or non-team-spawnpoints)
-        std::set<SpawnPoint*> teamSpawnPoints = this->spawnpoints_;
-        for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); )
+        if (victim && victim->getPlayer())
         {
-            if ((*it)->isA(Class(TeamSpawnPoint)))
+            std::string message;
+            if (killer)
             {
-                TeamSpawnPoint* tsp = orxonox_cast<TeamSpawnPoint*>(*it);
-                if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr)
-                {
-                    teamSpawnPoints.erase(it++);
-                    continue;
-                }
+                if (killer->getPlayer())
+                    message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
+                else
+                    message = victim->getPlayer()->getName() + " was killed";
             }
+            else
+                message = victim->getPlayer()->getName() + " died";
 
-            ++it;
+            ChatManager::message(message);
         }
 
-        SpawnPoint* fallbackSpawnPoint = NULL;
-        if (teamSpawnPoints.size() > 0)
-        {
-            unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
-            unsigned int index = 0;
-            // Get random fallback spawnpoint in case there is no active SpawnPoint.
-            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
-            {
-                if (index == randomspawn)
-                {
-                    fallbackSpawnPoint = (*it);
-                    break;
-                }
-
-                ++index;
-            }
-
-            // Remove all inactive SpawnPoints from the list.
-            for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); )
-            {
-                if(!(*it)->isActive())
-                {
-                    teamSpawnPoints.erase(it++);
-                    continue;
-                }
-
-                ++it;
-            }
-
-            randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
-            index = 0;
-            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
-            {
-                if (index == randomspawn)
-                    return (*it);
-
-                ++index;
-            }
-
-            return fallbackSpawnPoint;
-        }
-
-        return 0;
+        Gametype::pawnKilled(victim, killer);
     }
 
-    void TeamDeathmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
+    void TeamDeathmatch::playerScored(PlayerInfo* player)
     {
-        if (!player)
-            return;
+        TeamGametype::playerScored(player);
 
-        // Set the team colour
-        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
-        if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < static_cast<int>(this->teamcolours_.size()))
+        if (player)
         {
-            if (pawn)
-            {
-                pawn->setRadarObjectColour(this->teamcolours_[it_player->second]);
-
-                std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
-                for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
-                {
-                    if ((*it)->isA(Class(TeamColourable)))
-                    {
-                        TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
-                        tc->setTeamColour(this->teamcolours_[it_player->second]);
-                    }
-                }
-            }
+            const std::string& message = player->getName() + " scores!";
+            ChatManager::message(message);
         }
     }
 
-    bool TeamDeathmatch::pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2)
-    {
-        if (pawn1 && pawn2)
-        {
-            std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer());
-            std::map<PlayerInfo*, int>::const_iterator it2 = this->teamnumbers_.find(pawn2->getPlayer());
-
-            if (it1 != this->teamnumbers_.end() && it2 != this->teamnumbers_.end())
-                return (it1->second == it2->second);
-        }
-        return false;
-    }
-
-    int TeamDeathmatch::getTeam(PlayerInfo* player)
-    {
-        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
-        if (it_player != this->teamnumbers_.end())
-            return it_player->second;
-        else
-            return -1;
-    }
 }

Modified: code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.h
===================================================================
--- code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.h	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/orxonox/gametypes/TeamDeathmatch.h	2012-06-10 15:13:00 UTC (rev 9286)
@@ -30,41 +30,24 @@
 #define _TeamDeathmatch_H__
 
 #include "OrxonoxPrereqs.h"
+#include "TeamGametype.h"
 
-#include <map>
-#include <vector>
-#include "Deathmatch.h"
-
 namespace orxonox
 {
-    class _OrxonoxExport TeamDeathmatch : public Deathmatch
+    class _OrxonoxExport TeamDeathmatch : public TeamGametype
     {
         public:
             TeamDeathmatch(BaseObject* creator);
             virtual ~TeamDeathmatch() {}
 
-            void setConfigValues();
-
+            virtual void start();
+            virtual void end();
             virtual void playerEntered(PlayerInfo* player);
             virtual bool playerLeft(PlayerInfo* player);
+            virtual bool playerChangedName(PlayerInfo* player);
 
-            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
-            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
-            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
-
-            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
-
-            int getTeam(PlayerInfo* player);
-            inline const ColourValue& getTeamColour(int teamnr) const
-                { return this->teamcolours_[teamnr]; }
-
-        protected:
-            virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
-            bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2);
-
-            std::map<PlayerInfo*, int> teamnumbers_;
-            std::vector<ColourValue> teamcolours_;
-            unsigned int teams_;
+            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
+            virtual void playerScored(PlayerInfo* player);
     };
 }
 

Modified: code/branches/presentation2012merge/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/branches/presentation2012merge/src/orxonox/gametypes/TeamGametype.cc	2012-06-10 15:03:16 UTC (rev 9285)
+++ code/branches/presentation2012merge/src/orxonox/gametypes/TeamGametype.cc	2012-06-10 15:13:00 UTC (rev 9286)
@@ -88,6 +88,11 @@
         }
     }
 
+    /**
+    @brief
+        Function that determines the player's team number when entering the game for the first time.
+        Override this function for other team structures.
+    */
     void TeamGametype::findAndSetTeam(PlayerInfo* player)
     {
         if(player == NULL) return; // catch null pointers
@@ -130,7 +135,6 @@
             this->allowedInGame_.erase(player);
         }
 
-
         return valid_player;
     }
 




More information about the Orxonox-commit mailing list