/*****************************************************************************/
/* D2K: A Doom Source Port for the 21st Century                              */
/*                                                                           */
/* Copyright (C) 2014: See COPYRIGHT file                                    */
/*                                                                           */
/* This file is part of D2K.                                                 */
/*                                                                           */
/* D2K is free software: you can redistribute it and/or modify it under the  */
/* terms of the GNU General Public License as published by the Free Software */
/* Foundation, either version 2 of the License, or (at your option) any      */
/* later version.                                                            */
/*                                                                           */
/* D2K is distributed in the hope that it will be useful, but WITHOUT ANY    */
/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS */
/* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more    */
/* details.                                                                  */
/*                                                                           */
/* You should have received a copy of the GNU General Public License along   */
/* with D2K.  If not, see <http://www.gnu.org/licenses/>.                    */
/*                                                                           */
/*****************************************************************************/


#ifndef PL_WEAP_H__
#define PL_WEAP_H__

struct player_s;
typedef struct player_s player_t;

// The defined weapons, including a marker
// indicating user has not changed weapon.
typedef enum {
  wp_fist,
  wp_pistol,
  wp_shotgun,
  wp_chaingun,
  wp_missile,
  wp_plasma,
  wp_bfg,
  wp_chainsaw,
  wp_supershotgun,

  NUMWEAPONS,
  wp_nochange              // No pending weapon change.
} weapontype_t;

// Ammunition types defined.
typedef enum {
  am_clip,    // Pistol / chaingun ammo.
  am_shell,   // Shotgun / double barreled shotgun.
  am_cell,    // Plasma rifle, BFG.
  am_misl,    // Missile launcher.
  NUMAMMO,
  am_noammo   // Unlimited for chainsaw / fist.
} ammotype_t;

typedef enum {
  WSOP_NONE   = 0,
  WSOP_WEAPON = 1 << 0,
  WSOP_AMMO   = 1 << 1,
  WSOP_MAX    = (WSOP_AMMO * 2) - 1,
} wsop_e;

/* Weapon info: sprite frames, ammunition use. */
typedef struct {
  ammotype_t  ammo;
  int         upstate;
  int         downstate;
  int         readystate;
  int         atkstate;
  int         flashstate;

} weaponinfo_t;

extern weaponinfo_t weaponinfo[NUMWEAPONS + 2];
extern int ammopershot[NUMWEAPONS + 2];

extern int weapon_preferences[2][NUMWEAPONS + 1]; /* killough 5/2/98 */

int  PL_SwitchWeapon(player_t *player);
int  PL_WeaponPreferred(int w1, int w2);
bool PL_CheckAmmo(player_t *player);
void PL_DropWeapon(player_t *player);

#endif

/* vi: set et ts=2 sw=2: */
