src/Weapons.cc
author terom
Mon, 08 Dec 2008 21:18:08 +0000
changeset 311 440763821484
parent 305 56799ec8d7be
child 337 ecde18d07879
permissions -rw-r--r--
make Input have its own timer, and add key-repeat handling, and fix some warnings

#include "Weapons.hh"

static struct WeaponParams {
    TickCount age;
    float speed;
    float recoil;
    int damage;
    float explosionRadius;
    float radius;
    TickCount reloadTime;
    float bounce;
    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,            50000,         13,      100,         10,     1000,           1.05,   "BounceBounce"  },
    {   0,      0,              0,             0,       0,           0,      0,              0.00,   ""              }
};

std::vector<Weapon*> buildWeaponsList (void) {
    std::vector<Weapon*> weapons;
    int idx = 0;

    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));
    }

    return weapons;
}