[Orxonox-commit 4524] r9195 - in code/branches/presentation2012: . data/levels data/levels/includes data/levels/templates src/modules/pickup src/modules/pickup/items src/orxonox/worldentities/pawns

smerkli at orxonox.net smerkli at orxonox.net
Fri May 18 14:58:33 CEST 2012


Author: smerkli
Date: 2012-05-18 14:58:33 +0200 (Fri, 18 May 2012)
New Revision: 9195

Added:
   code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.cc
   code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.h
Modified:
   code/branches/presentation2012/
   code/branches/presentation2012/data/levels/includes/pickups.oxi
   code/branches/presentation2012/data/levels/pickups.oxw
   code/branches/presentation2012/data/levels/templates/pickupRepresentationTemplates.oxt
   code/branches/presentation2012/src/modules/pickup/PickupPrereqs.h
   code/branches/presentation2012/src/modules/pickup/items/CMakeLists.txt
   code/branches/presentation2012/src/modules/pickup/items/SpeedPickup.h
   code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.h
Log:
merged branch pickup2012


Property changes on: code/branches/presentation2012
___________________________________________________________________
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/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/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/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/skybox2:6559-6989
/code/branches/sound:2829-3010
/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/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/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/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/skybox2:6559-6989
/code/branches/sound:2829-3010
/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/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/presentation2012/data/levels/includes/pickups.oxi
===================================================================
--- code/branches/presentation2012/data/levels/includes/pickups.oxi	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/data/levels/includes/pickups.oxi	2012-05-18 12:58:33 UTC (rev 9195)
@@ -209,6 +209,41 @@
     </pickup>
 </PickupRepresentation>
 
+<!-- DamageBoost Pickup -->
+
+<PickupRepresentation
+    pickupName = "Small DamageBoost Pickup"
+    pickupDescription = "Multiplies the ship damage with 2."
+    spawnerTemplate = "smalldamageboostpickupRepresentation"
+    inventoryRepresentation = "SmallDamageBoost"
+>
+    <pickup>
+        <DamageBoostPickup template=smalldamageboostpickup />
+    </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+    pickupName = "Medium DamageBoost Pickup"
+    pickupDescription = "Multiplies the ship damage with 5."
+    spawnerTemplate = "mediumdamageboostpickupRepresentation"
+    inventoryRepresentation = "MediumDamageBoost"
+>
+    <pickup>
+        <DamageBoostPickup template=mediumdamageboostpickup />
+    </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+    pickupName = "Large DamageBoost Pickup"
+    pickupDescription = "Multiplies the ship damage with 7."
+    spawnerTemplate = "largedamageboostpickupRepresentation"
+    inventoryRepresentation = "LargeDamageBoost"
+>
+    <pickup>
+        <DamageBoostPickup template=largedamageboostpickup />
+    </pickup>
+</PickupRepresentation>
+
 <!-- Shrink Pickup -->
 
 <PickupRepresentation

Modified: code/branches/presentation2012/data/levels/pickups.oxw
===================================================================
--- code/branches/presentation2012/data/levels/pickups.oxw	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/data/levels/pickups.oxw	2012-05-18 12:58:33 UTC (rev 9195)
@@ -168,6 +168,27 @@
       </pickup>
     </PickupSpawner>
     
+    <!-- DamageBoost pickup -->
+    
+    <PickupSpawner position="-50,75,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
+      <pickup>
+        <DamageBoostPickup template=smalldamageboostpickup />
+      </pickup>
+    </PickupSpawner>
+    
+      <PickupSpawner position="-50,100,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
+      <pickup>
+        <DamageBoostPickup template=mediumdamageboostpickup />
+      </pickup>
+    </PickupSpawner>
+    
+      <PickupSpawner position="-50,125,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
+      <pickup>
+        <DamageBoostPickup template=largedamageboostpickup />
+      </pickup>
+    </PickupSpawner>
+    
+    
     <!-- Other pickups -->
 
     <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi -->
@@ -205,7 +226,64 @@
         <ShrinkPickup template ="hugeshrinkpickup"/>
       </pickup>
     </PickupSpawner>
+    
+    <!-- @Objects: 4 boxes (uncontrolled pawns) -->
+    <Pawn team=1 health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 4" >
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+            <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
 
+    <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 3">
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+           <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
+
+    <Pawn health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1 RVName = "Box 2">
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+           <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
+
+    <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1 RVName = "Box 1">
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+            <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+           <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
+
     <!--StaticEntity position="0,-200,0" direction="0,-1,0" collisionType=static mass=500 friction=0.01 >
       <attached>
         <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />

Modified: code/branches/presentation2012/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/branches/presentation2012/data/levels/templates/pickupRepresentationTemplates.oxt	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/data/levels/templates/pickupRepresentationTemplates.oxt	2012-05-18 12:58:33 UTC (rev 9195)
@@ -215,6 +215,84 @@
     </PickupRepresentation>
 </Template>
 
+<!-- DamageBoost pickups -->
+
+<Template name=smalldamageboostpickupRepresentation>
+    <PickupRepresentation>
+        <spawner-representation>
+            <StaticEntity>
+                <attached>
+                    <Billboard position="0,0,0" colour="0.10,0.20,0.30" material="Sphere2" scale=0.1 >
+                        <attached>
+                            <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageSmall" scale=0.7 />
+                        </attached>
+                    </Billboard>
+                </attached>
+            </StaticEntity>
+        </spawner-representation>
+    </PickupRepresentation>
+</Template>
+
+<Template name=smalldamageboostpickup>
+  <DamageBoostPickup
+    duration = 10.0
+    damageMultiplier = 2.0
+    activationType = "immediate"
+    durationType = "continuous"
+  />
+</Template>
+
+<Template name=mediumdamageboostpickupRepresentation>
+    <PickupRepresentation>
+        <spawner-representation>
+            <StaticEntity>
+                <attached>
+                    <Billboard position="0,0,0" colour="0.10,0.20,0.30" material="Sphere2" scale=0.1 >
+                        <attached>
+                            <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageMedium" scale=0.7 />
+                        </attached>
+                    </Billboard>
+                </attached>
+            </StaticEntity>
+        </spawner-representation>
+    </PickupRepresentation>
+</Template>
+
+<Template name=mediumdamageboostpickup>
+  <DamageBoostPickup
+    duration = 10.0
+    damageMultiplier = 5.0
+    activationType = "immediate"
+    durationType = "continuous"
+  />
+</Template>
+
+<Template name=largedamageboostpickupRepresentation>
+    <PickupRepresentation>
+        <spawner-representation>
+            <StaticEntity>
+                <attached>
+                    <Billboard position="0,0,0" colour="0.10,0.20,0.30" material="Sphere2" scale=0.1 >
+                        <attached>
+                            <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageLarge" scale=0.7 />
+                        </attached>
+                    </Billboard>
+                </attached>
+            </StaticEntity>
+        </spawner-representation>
+    </PickupRepresentation>
+</Template>
+
+<Template name=largedamageboostpickup>
+  <DamageBoostPickup
+    duration = 10.0
+    damageMultiplier = 7.0
+    activationType = "immediate"
+    durationType = "continuous"
+  />
+</Template>
+
+
 <!-- Speed pickups -->
 
 <Template name=smallspeedpickupRepresentation>

Modified: code/branches/presentation2012/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/branches/presentation2012/src/modules/pickup/PickupPrereqs.h	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/src/modules/pickup/PickupPrereqs.h	2012-05-18 12:58:33 UTC (rev 9195)
@@ -85,7 +85,7 @@
     class SpeedPickup;
     class ShieldPickup;
     class ShrinkPickup;
-
+    class DamageBoostPickup;
 }
 
 #endif /* _PickupPrereqs_H__ */

Modified: code/branches/presentation2012/src/modules/pickup/items/CMakeLists.txt
===================================================================
--- code/branches/presentation2012/src/modules/pickup/items/CMakeLists.txt	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/src/modules/pickup/items/CMakeLists.txt	2012-05-18 12:58:33 UTC (rev 9195)
@@ -6,4 +6,5 @@
   SpeedPickup.cc
   ShieldPickup.cc
   ShrinkPickup.cc
+  DamageBoostPickup.cc
 )

Copied: code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.cc (from rev 9189, code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc)
===================================================================
--- code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.cc	                        (rev 0)
+++ code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.cc	2012-05-18 12:58:33 UTC (rev 9195)
@@ -0,0 +1,240 @@
+/*
+ *   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:
+ *      Kevin Lengauer
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file DamageBoostPickup.cc
+    @brief Implementation of the DamageBoostPickup class.
+*/
+
+#include "DamageBoostPickup.h"
+
+#include <sstream>
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "pickup/PickupIdentifier.h"
+#include "worldentities/pawns/SpaceShip.h"
+
+namespace orxonox
+{
+    CreateFactory(DamageBoostPickup);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes the member variables.
+    */
+    DamageBoostPickup::DamageBoostPickup(BaseObject* creator) : Pickup(creator)
+    {
+        RegisterObject(DamageBoostPickup);
+
+        this->initialize();
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    DamageBoostPickup::~DamageBoostPickup()
+    {
+    }
+
+    /**
+    @brief
+        Initializes the member variables.
+    */
+    void DamageBoostPickup::initialize(void)
+    {
+    	this->duration_ = 0.0f;
+    	this->damageMultiplier_ = 1.0f; //The default damage multiplier.
+        //Defines who is allowed to pick up the pickup.
+        this->addTarget(ClassIdentifier<SpaceShip>::getIdentifier());
+    }
+
+    /**
+    @brief
+        Initializes the PickupIdentifier of this pickup.
+    */
+    void DamageBoostPickup::initializeIdentifier(void)
+    {
+        std::stringstream stream;
+        stream << this->getDuration();
+        std::string type1 = "duration";
+        std::string val1 = stream.str();
+        this->pickupIdentifier_->addParameter(type1, val1);
+
+        stream.clear();
+        stream << this->getDamageMultiplier();
+        std::string type2 = "damageMultiplier";
+        std::string val2 = stream.str();
+        this->pickupIdentifier_->addParameter(type2, val2);
+
+    }
+
+    /**
+    @brief
+        Method for creating a DamageBoostPickup object through XML.
+    */
+    void DamageBoostPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
+    {
+        SUPER(DamageBoostPickup, XMLPort, xmlelement, mode);
+
+        XMLPortParam(DamageBoostPickup, "duration", setDuration, getDuration, xmlelement, mode);
+        XMLPortParam(DamageBoostPickup, "damageMultiplier", setDamageMultiplier, getDamageMultiplier, xmlelement, mode);
+
+        this->initializeIdentifier();
+    }
+
+    // Work in Progress setDamage Function
+    void DamageBoostPickup::setDamageMultiplier(float damageMultiplier)
+    {
+        if(damageMultiplier >= 1.0f)
+        {
+            this->damageMultiplier_ = damageMultiplier;
+        }
+    }
+
+
+    /**
+    @brief
+        Is called when the pickup has transisted from used to unused or the other way around.
+    */
+    void DamageBoostPickup::changedUsed(void)
+    {
+        SUPER(DamageBoostPickup, changedUsed);
+
+        SpaceShip* ship = this->carrierToSpaceShipHelper();
+        if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.
+           	this->Pickupable::destroy();
+
+
+        // If the pickup has transited to used.
+        if(this->isUsed())
+        {
+            // If its durationType is continuous, we set a Timer to be reminded, when the time has run out.
+            if(this->isContinuous())
+            {
+                if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
+                {
+                    this->durationTimer_.unpauseTimer();
+                }
+                else
+                {
+                    this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&DamageBoostPickup::pickupTimerCallback, this)));
+                }
+            }
+
+            // Saves the old default Damage that is needed to restore the original damage
+            this->olddamageMultiplier_ = 1.0f;
+            // Sets the new Damage with the damage multiplier
+            ship->setDamageMultiplier(this->getDamageMultiplier());
+        }
+        else
+        {
+
+            // We destroy the pickup if either, the pickup has activationType immediate and durationType once or it has durationType continuous and the duration was exceeded.
+            if((!this->isContinuous() && this->isImmediate()) || (this->isContinuous() && !this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration()))
+            {
+                this->Pickupable::destroy();
+                ship->setDamageMultiplier ( this->olddamageMultiplier_);
+            }
+            // We pause the Timer if the pickup is continuous and the duration is not yet exceeded,
+            else if(this->isContinuous() && this->durationTimer_.isActive())
+            {
+                this->durationTimer_.pauseTimer();
+            }
+        }
+    }
+
+    /**
+    @brief
+        Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails.
+    @return
+        A pointer to the SpaceShip, or NULL if the conversion failed.
+    */
+    SpaceShip* DamageBoostPickup::carrierToSpaceShipHelper(void)
+    {
+        PickupCarrier* carrier = this->getCarrier();
+        SpaceShip* ship = dynamic_cast<SpaceShip*>(carrier);
+
+        if(ship == NULL)
+        {
+            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DamageBoostPickup." << endl;
+        }
+
+        return ship;
+    }
+
+    /**
+    @brief
+        Creates a duplicate of the input OrxonoxClass.
+    @param item
+        A pointer to the Orxonox class.
+    */
+    void DamageBoostPickup::clone(OrxonoxClass*& item)
+    {
+        if(item == NULL)
+            item = new DamageBoostPickup(this);
+
+        SUPER(DamageBoostPickup, clone, item);
+
+        DamageBoostPickup* pickup = dynamic_cast<DamageBoostPickup*>(item);
+        pickup->setDuration(this->getDuration());
+        pickup->setDamageMultiplier(this->getDamageMultiplier());
+        pickup->initializeIdentifier();
+    }
+
+    /**
+    @brief
+        Sets the duration for which the DamageBoostPickup stays active.
+    @param duration
+        The duration in seconds.
+    */
+    void DamageBoostPickup::setDuration(float duration)
+    {
+        if(duration >= 0.0f)
+        {
+            this->duration_ = duration;
+        }
+        else
+        {
+            orxout(internal_error, context::pickups) << "Invalid duration in DamagePickup." << endl;
+            this->duration_ = 0.0f;
+        }
+    }
+
+    /**
+    @brief
+        Helper method. Is called by the Timer as soon as it expires.
+    */
+    void DamageBoostPickup::pickupTimerCallback(void)
+    {
+        this->setUsed(false);
+    }
+
+}
+

Copied: code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.h (from rev 9189, code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h)
===================================================================
--- code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.h	                        (rev 0)
+++ code/branches/presentation2012/src/modules/pickup/items/DamageBoostPickup.h	2012-05-18 12:58:33 UTC (rev 9195)
@@ -0,0 +1,102 @@
+/*
+ *   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:
+ *      Kevin Lengauer
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file DamageBoostPickup.h
+    @brief Declaration of the DamageBoostPickup class.
+    @ingroup PickupItems
+*/
+
+#ifndef _DamageBoostPickup_H__
+#define _DamageBoostPickup_H__
+
+#include "pickup/PickupPrereqs.h"
+
+#include <string>
+
+#include "pickup/Pickup.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox {
+
+    class _PickupExport DamageBoostPickup : public Pickup, public Tickable
+    {
+        public:
+
+            DamageBoostPickup(BaseObject* creator); //!< Constructor.
+            virtual ~DamageBoostPickup(); //!< Destructor.
+
+            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a DamageBoostPickup object through XML.
+
+            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
+            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
+
+    	    /**
+            @brief Get the time the DamagePickup lasts.
+            @return Returns the time in seconds the DamagePickup lasts.
+            */
+            inline float getDuration(void) const
+                { return this->duration_; }
+
+            inline void setDuration( float duration );
+
+
+
+            /**
+             @brief set Damage multiplier
+             @param multiplier The default damage multiplier to set
+             */
+            inline float getDamageMultiplier()
+                { return this->damageMultiplier_; }
+
+
+
+
+        protected:
+            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
+            void setDamageMultiplier(float damageMultiplier); //!< Sets the DamageMultiplier according to the XML.
+
+
+        private:
+            void initialize(void); //!< Initializes the member variables.
+            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+            SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails.
+            void pickupTimerCallback(void);
+
+
+
+            float damageMultiplier_; //!< The damage boost that is transferred to the Pawn.
+            float olddamageMultiplier_; //!< Helper to remember what the actual damage of the Pawn was before we changed it.
+
+            Timer durationTimer_; //!< Timer.
+	    float duration_; //! Duration of damage boost.
+
+    };
+}
+
+#endif // _DamageBoostPickup_H__

Modified: code/branches/presentation2012/src/modules/pickup/items/SpeedPickup.h
===================================================================
--- code/branches/presentation2012/src/modules/pickup/items/SpeedPickup.h	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/src/modules/pickup/items/SpeedPickup.h	2012-05-18 12:58:33 UTC (rev 9195)
@@ -111,7 +111,7 @@
 
         private:
             void initialize(void); //!< Initializes the member variables.
-            SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceSHip, and throw an error message if the conversion fails.
+            SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails.
 
             Timer durationTimer_; //!< Timer.
 

Modified: code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.cc	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.cc	2012-05-18 12:58:33 UTC (rev 9195)
@@ -74,6 +74,9 @@
 
         this->lastHitOriginator_ = 0;
 
+        // set damage multiplier to default value 1, meaning nominal damage
+        this->damageMultiplier_ = 1;
+
         this->spawnparticleduration_ = 3.0f;
 
         this->aimPosition_ = Vector3::ZERO;
@@ -227,7 +230,14 @@
 
     void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
     {
-        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
+        //Applies multiplier given by the DamageBoost Pickup.
+    	Pawn *test = dynamic_cast<Pawn *>(originator);
+    	if( test != NULL )
+    	{
+    	  damage *= originator->getDamageMultiplier();
+    	}
+
+    	if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
         {
             if (shielddamage >= this->getShieldHealth())
             {

Modified: code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.h	2012-05-18 12:57:05 UTC (rev 9194)
+++ code/branches/presentation2012/src/orxonox/worldentities/pawns/Pawn.h	2012-05-18 12:58:33 UTC (rev 9195)
@@ -161,6 +161,13 @@
             inline unsigned int getExplosionChunks() const
                 { return this->numexplosionchunks_; }
 
+            // These are used with the Damage Boost Pickup to use the damage multiplier.
+            inline void setDamageMultiplier(float multiplier)
+                { this->damageMultiplier_ = multiplier; }
+            inline float getDamageMultiplier()
+                { return this->damageMultiplier_; }
+
+
             virtual void startLocalHumanControl();
 
             void setAimPosition( Vector3 position )
@@ -207,6 +214,9 @@
             float reloadWaitTime_;
             float reloadWaitCountdown_;
 
+            // Modifier
+            float damageMultiplier_; // Used by the Damage Boost Pickup.
+
             WeakPtr<Pawn> lastHitOriginator_;
 
             WeaponSystem* weaponSystem_;




More information about the Orxonox-commit mailing list