Added recoil to weapon constructor. Recoil still not used.
authorsaiam
Sun, 07 Dec 2008 19:54:00 +0000
changeset 253 747b1037d83e
parent 252 25054ce94d07
child 254 0c3d58912e1b
Added recoil to weapon constructor. Recoil still not used.
src/Weapon.cc
src/Weapon.hh
src/Weapons.cc
--- a/src/Weapon.cc	Sun Dec 07 19:52:12 2008 +0000
+++ b/src/Weapon.cc	Sun Dec 07 19:54:00 2008 +0000
@@ -1,7 +1,7 @@
 #include "Weapon.hh"
 
-Weapon::Weapon(TickCount age, float velocity, float explosionRadius, int reloadTime, std::string name) : 
-    age(age), velocity(velocity), explosionRadius(explosionRadius), reloadTime(reloadTime), name(name), reloadTimer(0) 
+Weapon::Weapon(TickCount age, float velocity, float recoil, float explosionRadius, int reloadTime, std::string name) : 
+    age(age), velocity(velocity), recoil(recoil), explosionRadius(explosionRadius), reloadTime(reloadTime), name(name), reloadTimer(0) 
 {
 
 }
--- a/src/Weapon.hh	Sun Dec 07 19:52:12 2008 +0000
+++ b/src/Weapon.hh	Sun Dec 07 19:54:00 2008 +0000
@@ -24,7 +24,7 @@
     int reloadTimer;
 
 public:
-    Weapon (TickCount age, float velocity, float explosionRadius, int reloadTime, std::string name);
+    Weapon (TickCount age, float velocity, float recoil, float explosionRadius, int reloadTime, std::string name);
     
     // advance the reload timer
     void tickReload (TimeMS dt);
--- a/src/Weapons.cc	Sun Dec 07 19:52:12 2008 +0000
+++ b/src/Weapons.cc	Sun Dec 07 19:54:00 2008 +0000
@@ -4,24 +4,27 @@
 static struct WeaponParams {
     TickCount age;
     float speed;
+    float recoil;
     float explosionRadius;
     TickCount reloadTime;
     std::string name;
 } WEAPON_PARAMS[] = {
-    /*  age     speed           expRadius   reloadTime      name        */
-    {   10000,  5 * 80 + 50,    0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
-    {   10000,  4 * 80 + 50,    1 * 6 + 5,  1 * 100 + 50,   "Weapon 2"  },
-    {   10000,  3 * 80 + 50,    2 * 6 + 5,  2 * 100 + 50,   "Weapon 3"  },
-    {   10000,  2 * 80 + 50,    3 * 6 + 5,  3 * 100 + 50,   "Weapon 4"  },
-    {   10000,  1 * 80 + 50,    4 * 6 + 5,  4 * 100 + 50,   "Weapon 5"  },
-    {   0,      0,              0,          0,              ""          }
+    /*  age     speed        recoil   expRadius   reloadTime      name        */
+    {   10000,  5 * 80 + 50, 0 * 5 + 5,   0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
+    {   10000,  4 * 80 + 50, 2 * 5 + 5,   1 * 6 + 5,  1 * 100 + 50,   "Weapon 2"  },
+    {   10000,  3 * 80 + 50, 3 * 5 + 5,   2 * 6 + 5,  2 * 100 + 50,   "Weapon 3"  },
+    {   10000,  2 * 80 + 50, 4 * 5 + 5,   3 * 6 + 5,  3 * 100 + 50,   "Weapon 4"  },
+    {   10000,  1 * 80 + 50, 5 * 5 + 5,   4 * 6 + 5,  4 * 100 + 50,   "Weapon 5"  },
+    {   0,      0,           0,           0,          0,              ""          }
 };
 
 std::vector<Weapon*> buildWeaponsList (void) {
     std::vector<Weapon*> weapons;
 
-    for (WeaponParams *wp = WEAPON_PARAMS; wp->age || wp->speed || wp->explosionRadius || wp->reloadTime; wp++) {
-        weapons.push_back(new Weapon(wp->age, wp->speed, wp->explosionRadius, wp->reloadTime, wp->name));
+    for (WeaponParams *wp = WEAPON_PARAMS; 
+         wp->age || wp->speed || wp->recoil || wp->explosionRadius || wp->reloadTime; 
+         wp++) {
+        weapons.push_back(new Weapon(wp->age, wp->speed, wp->recoil, wp->explosionRadius, wp->reloadTime, wp->name));
     }
 
     return weapons;