src/Weapons.cc
author terom
Sun, 07 Dec 2008 20:07:28 +0000
changeset 255 99431fdb0dc8
parent 253 747b1037d83e
child 258 833ad8d7db8b
permissions -rw-r--r--
add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
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;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
     9
    TickCount reloadTime;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    10
    std::string name;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    11
} WEAPON_PARAMS[] = {
253
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    12
    /*  age     speed        recoil   expRadius   reloadTime      name        */
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    13
    {   10000,  5 * 80 + 50, 0 * 5 + 5,   0 * 6 + 5,  0 * 100 + 50,   "Weapon 1"  },
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    14
    {   10000,  4 * 80 + 50, 2 * 5 + 5,   1 * 6 + 5,  1 * 100 + 50,   "Weapon 2"  },
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    15
    {   10000,  3 * 80 + 50, 3 * 5 + 5,   2 * 6 + 5,  2 * 100 + 50,   "Weapon 3"  },
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    16
    {   10000,  2 * 80 + 50, 4 * 5 + 5,   3 * 6 + 5,  3 * 100 + 50,   "Weapon 4"  },
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    17
    {   10000,  1 * 80 + 50, 5 * 5 + 5,   4 * 6 + 5,  4 * 100 + 50,   "Weapon 5"  },
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    18
    {   0,      0,           0,           0,          0,              ""          }
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    19
};
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    20
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    21
std::vector<Weapon*> buildWeaponsList (void) {
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    22
    std::vector<Weapon*> weapons;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    23
253
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    24
    for (WeaponParams *wp = WEAPON_PARAMS; 
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    25
         wp->age || wp->speed || wp->recoil || wp->explosionRadius || wp->reloadTime; 
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    26
         wp++) {
747b1037d83e Added recoil to weapon constructor. Recoil still not used.
saiam
parents: 237
diff changeset
    27
        weapons.push_back(new Weapon(wp->age, wp->speed, wp->recoil, wp->explosionRadius, wp->reloadTime, wp->name));
236
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    28
    }
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    29
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    30
    return weapons;
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    31
}
0048ba274152 move weapons definition out to Weapons.cc
terom
parents:
diff changeset
    32