new DigDig weapon with massive radius
authorterom
Tue, 09 Dec 2008 00:58:49 +0000
changeset 338 fe2b3c6fff54
parent 337 ecde18d07879
child 339 c8f45891b8d0
new DigDig weapon with massive radius
src/Projectile.cc
src/Weapon.cc
src/Weapon.hh
src/Weapons.cc
--- a/src/Projectile.cc	Tue Dec 09 00:45:41 2008 +0000
+++ b/src/Projectile.cc	Tue Dec 09 00:58:49 2008 +0000
@@ -4,7 +4,7 @@
 
    
 Projectile::Projectile (Player *player, Vector position, Vector velocity, Weapon *weapon, bool visible) :
-    PhysicsObject(player->state.world, PROJECTILE_MASS, position, velocity, PROJECTILE, weapon->getBounce()),
+    PhysicsObject(player->state.world, weapon->getMass(), position, velocity, PROJECTILE, weapon->getBounce()),
     player(player), 
     visible(visible), 
     weapon(weapon)
--- a/src/Weapon.cc	Tue Dec 09 00:45:41 2008 +0000
+++ b/src/Weapon.cc	Tue Dec 09 00:58:49 2008 +0000
@@ -1,7 +1,7 @@
 #include "Weapon.hh"
 
 Weapon::Weapon(WeaponID id, TickCount expire, float velocity, float recoil, int damage, float explosionRadius, float radius,
-        TimeMS reloadTime, std::string name, float bounce) : 
+        TimeMS reloadTime, std::string name, float bounce, float mass) : 
     id(id), 
     name(name), 
     velocity(velocity), 
@@ -12,7 +12,8 @@
     recoil(recoil), 
     expire(expire), 
     reloadTimer(0), 
-    bounce(bounce)
+    bounce(bounce),
+    mass(mass)
 {
 
 }
--- a/src/Weapon.hh	Tue Dec 09 00:45:41 2008 +0000
+++ b/src/Weapon.hh	Tue Dec 09 00:58:49 2008 +0000
@@ -77,11 +77,16 @@
      */
     float bounce;
 
+    /**
+     * Projectile mass
+     */
+    float mass;
+
 public:
     /**
      * Create a weapon with the given parameters
      */
-    Weapon (WeaponID id, TickCount expire, float velocity, float recoil, int damage, float explosionRadius, float radius, TimeMS reloadTime, std::string name, float bounce);
+    Weapon (WeaponID id, TickCount expire, float velocity, float recoil, int damage, float explosionRadius, float radius, TimeMS reloadTime, std::string name, float bounce, float mass);
     
     /**
      * Decrement the reload timer, if it's still going
@@ -105,6 +110,7 @@
     float getRadius (void) const { return radius; }
     TickCount getExpire (void) const { return expire; }
     float getBounce (void) const { return bounce; }
+    float getMass (void) const { return mass; }
 
     int getReloadTimer(void) const { return reloadTimer; }
     int getReloadTime(void) const { return reloadTime; }
--- a/src/Weapons.cc	Tue Dec 09 00:45:41 2008 +0000
+++ b/src/Weapons.cc	Tue Dec 09 00:58:49 2008 +0000
@@ -10,16 +10,18 @@
     float radius;
     TickCount reloadTime;
     float bounce;
+    float mass;
     std::string name;
 } WEAPON_PARAMS[] = {
-    /*  age     speed           recoil         damage   expRadius   radius  reloadTime      bounce  name        */
-    {   10000,  5 * 80 + 50,    0 * 5 + 10000, 1,       0 * 6 + 5,   1,      0 * 100 + 50,   0.00,   "Weapon 1"      },
-    {   10000,  4 * 80 + 50,    2 * 5 + 5,     2,       1 * 6 + 5,   2,      1 * 100 + 50,   0.00,   "Weapon 2"      },
-    {   10000,  3 * 80 + 50,    3 * 5 + 5,     3,       2 * 6 + 5,   3,      2 * 100 + 50,   0.00,   "Weapon 3"      },
-    {   10000,  2 * 80 + 50,    4 * 5 + 5,     5,       3 * 6 + 5,   4,      3 * 100 + 50,   0.00,   "Weapon 4"      },
-    {   10000,  1 * 80 + 50,    5 * 5 + 5,     8,       4 * 6 + 5,   5,      4 * 100 + 50,   0.00,   "Weapon 5"      },
-    {   1000,   600,            999000,        13,      100,         10,     1000,           1.05,   "BounceBounce"  },
-    {   0,      0,              0,             0,       0,           0,      0,              0.00,   ""              }
+    /*  age     speed           recoil         damage   expRadius   radius  reloadTime      bounce  mass    name        */
+    {   10000,  5 * 80 + 50,    0 * 5 + 10000, 1,       0 * 6 + 5,   1,      0 * 100 + 50,   0.00,  10.0,   "Weapon 1"      },
+    {   10000,  4 * 80 + 50,    2 * 5 + 5,     2,       1 * 6 + 5,   2,      1 * 100 + 50,   0.00,  10.0,   "Weapon 2"      },
+    {   10000,  3 * 80 + 50,    3 * 5 + 5,     3,       2 * 6 + 5,   3,      2 * 100 + 50,   0.00,  10.0,   "Weapon 3"      },
+    {   10000,  2 * 80 + 50,    4 * 5 + 5,     5,       3 * 6 + 5,   4,      3 * 100 + 50,   0.00,  10.0,   "Weapon 4"      },
+    {   10000,  1 * 80 + 50,    5 * 5 + 5,     8,       4 * 6 + 5,   5,      4 * 100 + 50,   0.00,  10.0,   "Weapon 5"      },
+    {   1000,   600,            999000,        13,      100,         10,     1000,           1.05,  10.0,   "BounceBounce"  },
+    {   1000,   400,            100000,        0,       250,         10,     1200,           0.00,  10.0,   "DigDig"        },
+    {   0,      0,              0,             0,       0,           0,      0,              0.00,  10.0,   ""              }
 };
 
 std::vector<Weapon*> buildWeaponsList (void) {
@@ -28,8 +30,12 @@
 
     for (WeaponParams *wp = WEAPON_PARAMS; 
          wp->age || wp->speed || wp->recoil || wp->damage || wp->explosionRadius || wp->radius || wp->bounce || wp->reloadTime; 
-         wp++, idx++) {
-        weapons.push_back(new Weapon(idx, wp->age, wp->speed, wp->recoil, wp->damage, wp->explosionRadius, wp->radius, wp->reloadTime, wp->name, wp->bounce));
+         wp++, idx++
+    ) {
+        weapons.push_back(new Weapon(idx, 
+            wp->age, wp->speed, wp->recoil, wp->damage, wp->explosionRadius, wp->radius, 
+            wp->reloadTime, wp->name, wp->bounce, wp->mass
+        ));
     }
 
     return weapons;