src/Weapons.cc
author nireco
Sat, 31 Jan 2009 12:33:08 +0200
changeset 443 5d1119729f58
parent 338 fe2b3c6fff54
permissions -rw-r--r--
worm02 two pics to comment
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;
305
56799ec8d7be Weapon damage and some other stuff
ekku
parents: 298
diff changeset
     8
    int damage;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     9
    float explosionRadius;
263
8c999cf4c182 weapon projectile radiuses and fix network play (local_player == NULL, Rope releasing upon being hit
terom
parents: 258
diff changeset
    10
    float radius;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    11
    TickCount reloadTime;
279
e36f5e1a1c8d let projectiles bounce, the new BounceBounce weapon puts the Physics engine into an infinite loop
terom
parents: 275
diff changeset
    12
    float bounce;
338
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    13
    float mass;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    14
    std::string name;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    15
} WEAPON_PARAMS[] = {
338
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    16
    /*  age     speed           recoil         damage   expRadius   radius  reloadTime      bounce  mass    name        */
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    17
    {   10000,  5 * 80 + 50,    0 * 5 + 10000, 1,       0 * 6 + 5,   1,      0 * 100 + 50,   0.00,  10.0,   "Weapon 1"      },
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    18
    {   10000,  4 * 80 + 50,    2 * 5 + 5,     2,       1 * 6 + 5,   2,      1 * 100 + 50,   0.00,  10.0,   "Weapon 2"      },
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    19
    {   10000,  3 * 80 + 50,    3 * 5 + 5,     3,       2 * 6 + 5,   3,      2 * 100 + 50,   0.00,  10.0,   "Weapon 3"      },
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    20
    {   10000,  2 * 80 + 50,    4 * 5 + 5,     5,       3 * 6 + 5,   4,      3 * 100 + 50,   0.00,  10.0,   "Weapon 4"      },
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    21
    {   10000,  1 * 80 + 50,    5 * 5 + 5,     8,       4 * 6 + 5,   5,      4 * 100 + 50,   0.00,  10.0,   "Weapon 5"      },
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    22
    {   1000,   600,            999000,        13,      100,         10,     1000,           1.05,  10.0,   "BounceBounce"  },
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    23
    {   1000,   400,            100000,        0,       250,         10,     1200,           0.00,  10.0,   "DigDig"        },
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    24
    {   0,      0,              0,             0,       0,           0,      0,              0.00,  10.0,   ""              }
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    25
};
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    26
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    27
std::vector<Weapon*> buildWeaponsList (void) {
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    28
    std::vector<Weapon*> weapons;
271
bf6784a95b08 touch up weapon/projectile with comments and slight tweaking
terom
parents: 263
diff changeset
    29
    int idx = 0;
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    30
253
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    31
    for (WeaponParams *wp = WEAPON_PARAMS; 
305
56799ec8d7be Weapon damage and some other stuff
ekku
parents: 298
diff changeset
    32
         wp->age || wp->speed || wp->recoil || wp->damage || wp->explosionRadius || wp->radius || wp->bounce || wp->reloadTime; 
338
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    33
         wp++, idx++
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    34
    ) {
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    35
        weapons.push_back(new Weapon(idx, 
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    36
            wp->age, wp->speed, wp->recoil, wp->damage, wp->explosionRadius, wp->radius, 
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    37
            wp->reloadTime, wp->name, wp->bounce, wp->mass
fe2b3c6fff54 new DigDig weapon with massive radius
terom
parents: 337
diff changeset
    38
        ));
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    39
    }
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    40
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    41
    return weapons;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    42
}
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    43