src/Weapons.cc
author nireco
Mon, 08 Dec 2008 16:01:49 +0000
changeset 288 47a5d7896aec
parent 279 e36f5e1a1c8d
child 298 0cc9d62cb204
permissions -rw-r--r--
some collisions on PhysicsWorld::tick

#include "Weapons.hh"

static struct WeaponParams {
    TickCount age;
    float speed;
    float recoil;
    float explosionRadius;
    float radius;
    TickCount reloadTime;
    float bounce;
    std::string name;
} WEAPON_PARAMS[] = {
    /*  age     speed           recoil         expRadius   radius  reloadTime      bounce  name        */
    {   10000,  5 * 80 + 50,    0 * 5 + 10000, 0 * 6 + 5,   1,      0 * 100 + 50,   0.00,   "Weapon 1"      },
    {   10000,  4 * 80 + 50,    2 * 5 + 5,     1 * 6 + 5,   2,      1 * 100 + 50,   0.00,   "Weapon 2"      },
    {   10000,  3 * 80 + 50,    3 * 5 + 5,     2 * 6 + 5,   3,      2 * 100 + 50,   0.00,   "Weapon 3"      },
    {   10000,  2 * 80 + 50,    4 * 5 + 5,     3 * 6 + 5,   4,      3 * 100 + 50,   0.00,   "Weapon 4"      },
    {   10000,  1 * 80 + 50,    5 * 5 + 5,     4 * 6 + 5,   5,      4 * 100 + 50,   0.00,   "Weapon 5"      },
    {   10000,  600,            50000,         100,         10,     1000,           1.05,   "BounceBounce"  },
    {   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->explosionRadius || wp->radius || wp->bounce || wp->reloadTime; 
         wp++, idx++) {
        weapons.push_back(new Weapon(idx, wp->age, wp->speed, wp->recoil, wp->explosionRadius, wp->radius, wp->reloadTime, wp->name, wp->bounce));
    }

    return weapons;
}