[Orxonox-commit 4513] r9184 - in code/branches/pickup2012: data/levels data/levels/includes data/levels/templates src/modules/pickup/items src/orxonox/worldentities/pawns

lkevin at orxonox.net lkevin at orxonox.net
Fri May 18 12:47:55 CEST 2012


Author: lkevin
Date: 2012-05-18 12:47:54 +0200 (Fri, 18 May 2012)
New Revision: 9184

Modified:
   code/branches/pickup2012/data/levels/includes/pickups.oxi
   code/branches/pickup2012/data/levels/pickups.oxw
   code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt
   code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc
   code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h
   code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h
Log:
Finished DamageBoost Pickup and the XML inclusions are working now.

Modified: code/branches/pickup2012/data/levels/includes/pickups.oxi
===================================================================
--- code/branches/pickup2012/data/levels/includes/pickups.oxi	2012-05-17 22:01:04 UTC (rev 9183)
+++ code/branches/pickup2012/data/levels/includes/pickups.oxi	2012-05-18 10:47:54 UTC (rev 9184)
@@ -212,15 +212,38 @@
 <!-- DamageBoost Pickup -->
 
 <PickupRepresentation
-    pickupName = "DamageBoost Pickup"
-    pickupDescription = "Multiplies the ship damage."
-    spawnerTemplate = "damageboostpickupRepresentation"
+    pickupName = "Small DamageBoost Pickup"
+    pickupDescription = "Multiplies the ship damage with 2."
+    spawnerTemplate = "smalldamageboostpickupRepresentation"
+    inventoryRepresentation = "SmallDamageBoost"
 >
     <pickup>
-        <DamageBoostPickup template=damageboostpickup />
+        <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/pickup2012/data/levels/pickups.oxw
===================================================================
--- code/branches/pickup2012/data/levels/pickups.oxw	2012-05-17 22:01:04 UTC (rev 9183)
+++ code/branches/pickup2012/data/levels/pickups.oxw	2012-05-18 10:47:54 UTC (rev 9184)
@@ -172,11 +172,23 @@
     
     <PickupSpawner position="-50,75,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
       <pickup>
-        <DamageBoostPickup template=damageboostpickup />
+        <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 -->

Modified: code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt	2012-05-17 22:01:04 UTC (rev 9183)
+++ code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt	2012-05-18 10:47:54 UTC (rev 9184)
@@ -217,14 +217,14 @@
 
 <!-- DamageBoost pickups -->
 
-<Template name=damageboostpickupRepresentation>
+<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="damage" scale=0.7 />
+                            <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageSmall" scale=0.7 />
                         </attached>
                     </Billboard>
                 </attached>
@@ -233,15 +233,66 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=damageboostpickup>
+<Template name=smalldamageboostpickup>
   <DamageBoostPickup
     duration = 10.0
-    damageMultiplier = 20.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/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc
===================================================================
--- code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc	2012-05-17 22:01:04 UTC (rev 9183)
+++ code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc	2012-05-18 10:47:54 UTC (rev 9184)
@@ -69,8 +69,8 @@
     */
     void DamageBoostPickup::initialize(void)
     {
-        this->duration_ = 0.0f;
-        this->damageMultiplier_ = 1.0f; //The default damage multiplier.
+    	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());
     }
@@ -88,7 +88,7 @@
         this->pickupIdentifier_->addParameter(type1, val1);
 
         stream.clear();
-        stream << this->damageMultiplier_;
+        stream << this->getDamageMultiplier();
         std::string type2 = "damageMultiplier";
         std::string val2 = stream.str();
         this->pickupIdentifier_->addParameter(type2, val2);
@@ -115,14 +115,13 @@
         if(damageMultiplier >= 1.0f)
         {
             this->damageMultiplier_ = damageMultiplier;
-            orxout() << "Set Damage " << damageMultiplier << endl;
         }
     }
 
 
     /**
     @brief
-        Is called when the pickup has transited from used to unused or the other way around.
+        Is called when the pickup has transisted from used to unused or the other way around.
     */
     void DamageBoostPickup::changedUsed(void)
     {
@@ -150,9 +149,9 @@
             }
 
             // Saves the old default Damage that is needed to restore the original damage
-            this->olddamageMultiplier_ = ship->getDamageMultiplier();
-            // Sets the new Damage with the damage multiplier.
-            ship->setDamageMultiplier( this->damageMultiplier_ );
+            this->olddamageMultiplier_ = 1.0f;
+            // Sets the new Damage with the damage multiplier
+            ship->setDamageMultiplier(this->getDamageMultiplier());
         }
         else
         {
@@ -205,8 +204,7 @@
 
         DamageBoostPickup* pickup = dynamic_cast<DamageBoostPickup*>(item);
         pickup->setDuration(this->getDuration());
-        
-
+        pickup->setDamageMultiplier(this->getDamageMultiplier());
         pickup->initializeIdentifier();
     }
 

Modified: code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h
===================================================================
--- code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h	2012-05-17 22:01:04 UTC (rev 9183)
+++ code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h	2012-05-18 10:47:54 UTC (rev 9184)
@@ -62,6 +62,7 @@
             */
             inline float getDuration(void) const
                 { return this->duration_; }
+
             inline void setDuration( float duration );
 
 
@@ -78,7 +79,7 @@
 
         protected:
             void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
-            void setDamageMultiplier(float damageMultiplier);
+            void setDamageMultiplier(float damageMultiplier); //!< Sets the DamageMultiplier according to the XML.
 
 
         private:

Modified: code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc	2012-05-17 22:01:04 UTC (rev 9183)
+++ code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc	2012-05-18 10:47:54 UTC (rev 9184)
@@ -230,10 +230,10 @@
 
     void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
     {
-        // apply multiplier
+        //Applies multiplier given by the DamageBoost Pickup.
     	Pawn *test = dynamic_cast<Pawn *>(originator);
     	if( test != NULL )
-    	{ orxout() << "Test " << damage << endl;
+    	{
     	  damage *= originator->getDamageMultiplier();
     	}
 

Modified: code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h	2012-05-17 22:01:04 UTC (rev 9183)
+++ code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h	2012-05-18 10:47:54 UTC (rev 9184)
@@ -161,7 +161,7 @@
             inline unsigned int getExplosionChunks() const
                 { return this->numexplosionchunks_; }
 
-            // not that beautiful yet
+            // These are used with the Damage Boost Pickup to use the damage multiplier.
             inline void setDamageMultiplier(float multiplier)
                 { this->damageMultiplier_ = multiplier; }
             inline float getDamageMultiplier()
@@ -214,8 +214,8 @@
             float reloadWaitTime_;
             float reloadWaitCountdown_;
 
-            // modifiers
-            float damageMultiplier_;
+            // Modifier
+            float damageMultiplier_; // Used by the Damage Boost Pickup.
 
             WeakPtr<Pawn> lastHitOriginator_;
 




More information about the Orxonox-commit mailing list