src/Weapons.cc
author terom
Mon, 08 Dec 2008 01:38:43 +0000
changeset 279 e36f5e1a1c8d
parent 275 fa44b905bc2e
child 298 0cc9d62cb204
permissions -rw-r--r--
let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     1
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     2
#include "Weapons.hh"
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     3
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     4
static struct WeaponParams {
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     5
    TickCount age;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     6
    float speed;
253
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
     7
    float recoil;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     8
    float explosionRadius;
263
8c999cf4c182 weapon projectile radiuses and fix network play (local_player == NULL, Rope releasing upon being hit
terom
parents: 258
diff changeset
     9
    float radius;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    10
    TickCount reloadTime;
279
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    11
    float bounce;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    12
    std::string name;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    13
} WEAPON_PARAMS[] = {
279
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    14
    /*  age     speed           recoil         expRadius   radius  reloadTime      bounce  name        */
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    15
    {   10000,  5 * 80 + 50,    0 * 5 + 10000, 0 * 6 + 5,   1,      0 * 100 + 50,   0.00,   "Weapon 1"      },
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    16
    {   10000,  4 * 80 + 50,    2 * 5 + 5,     1 * 6 + 5,   2,      1 * 100 + 50,   0.00,   "Weapon 2"      },
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    17
    {   10000,  3 * 80 + 50,    3 * 5 + 5,     2 * 6 + 5,   3,      2 * 100 + 50,   0.00,   "Weapon 3"      },
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    18
    {   10000,  2 * 80 + 50,    4 * 5 + 5,     3 * 6 + 5,   4,      3 * 100 + 50,   0.00,   "Weapon 4"      },
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    19
    {   10000,  1 * 80 + 50,    5 * 5 + 5,     4 * 6 + 5,   5,      4 * 100 + 50,   0.00,   "Weapon 5"      },
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    20
    {   10000,  600,            50000,         100,         10,     1000,           1.05,   "BounceBounce"  },
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    21
    {   0,      0,              0,             0,           0,      0,              0.00,   ""              }
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    22
};
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    23
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    24
std::vector<Weapon*> buildWeaponsList (void) {
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    25
    std::vector<Weapon*> weapons;
271
bf6784a95b08 touch up weapon/projectile with comments and slight tweaking
terom
parents: 263
diff changeset
    26
    int idx = 0;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    27
253
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    28
    for (WeaponParams *wp = WEAPON_PARAMS; 
279
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    29
         wp->age || wp->speed || wp->recoil || wp->explosionRadius || wp->radius || wp->bounce || wp->reloadTime; 
271
bf6784a95b08 touch up weapon/projectile with comments and slight tweaking
terom
parents: 263
diff changeset
    30
         wp++, idx++) {
279
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    31
        weapons.push_back(new Weapon(idx, wp->age, wp->speed, wp->recoil, wp->explosionRadius, wp->radius, wp->reloadTime, wp->name, wp->bounce));
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    32
    }
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    33
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    34
    return weapons;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    35
}
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    36