#ifndef _BB_COMBAT_SHOTGUN_H_
#define _BB_COMBAT_SHOTGUN_H_
// Joe combat weapons
// make same pattern in both qagame and cgame

// r (right) and u (up) (r and u are sometimes switched) are the positions of the
// pellets, measured from
// the center.  They are
// random and can go from -DEFAULT_SHOTGUN_SPREAD to DEFAULT_SHOTGUN_SPREAD

// more circular pattern


// degrees measured counterclockwise from the positive x axis
// answer in pt[]
// some of the answers are -0.

// yes these funcs shouldn't be in a .h file, but it's easy to include this file in game and cgame
void ptOnCircle(float degrees, float radius, vec2_t pt) {
    float radians = degrees * (2.0 * M_PI/360.0);

    pt[0] = radius * cos (radians);
    pt[1] = radius * sin (radians);
}

// trying to make pts like in a BATTLE_SHOTGUN_COUNT/2 sided star
// called in G_Init() and CG_RegisterWeapon()
// should only be called once per map
void initPellets(vec2_t pellets[]) {
    int i;
    float degrees;

    /*
        // outside circle
        degrees = BATTLE_SHOTGUN_COUNT/4;
        for(i = 0; i < BATTLE_SHOTGUN_COUNT/2; i++)
        {
                ptOnCircle(degrees, BATTLE_SHOTGUN_SPREAD, pellets[i]);
                degrees += 360/(BATTLE_SHOTGUN_COUNT/2);
        }
     
        // inside circle
        degrees = 0;
        for(i = 6; i < BATTLE_SHOTGUN_COUNT; i++)
        {
                ptOnCircle(degrees, BATTLE_SHOTGUN_SPREAD/2., pellets[i]);
                degrees += 360/(BATTLE_SHOTGUN_COUNT/2);
        }
    */

    // 4 on outside circle, 8 on inside
    // outside circle
    degrees = 0;
    for(i = 0; i < (BATTLE_SHOTGUN_COUNT-1)/3; i++) {
        ptOnCircle(degrees, BATTLE_SHOTGUN_SPREAD, pellets[i]);
        degrees += 360/((BATTLE_SHOTGUN_COUNT-1)/3);
    }

    // inside circle
    degrees = 0;
    for(i = BATTLE_SHOTGUN_COUNT/3; i < (BATTLE_SHOTGUN_COUNT-1); i++) {
        ptOnCircle(degrees, BATTLE_SHOTGUN_SPREAD/2., pellets[i]);
        degrees += 360/((BATTLE_SHOTGUN_COUNT-1)*2/3);
    }

    // 1 in center
    ptOnCircle(0, 0, pellets[BATTLE_SHOTGUN_COUNT-1]);

} // end initPellets()

extern vec2_t pellets[BATTLE_SHOTGUN_COUNT];

#endif // _BB_COMBAT_SHOTGUN_H_







