1 /*
2  * XPilot NG, a multiplayer space war game.
3  *
4  * Copyright (C) 2005 Kristian S�derblom <kps@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 
21 #ifndef MODIFIERS_H
22 #define MODIFIERS_H
23 
24 /*
25  * Weapons modifiers.
26  */
27 
28 typedef uint16_t	modifiers_t;
29 
30 #define MODS_NUCLEAR_MAX	3	/* - N FN */
31 #define MODS_VELOCITY_MAX	3	/* - V1 V2 V3 */
32 #define MODS_MINI_MAX		3	/* - X2 X3 X4 */
33 #define MODS_SPREAD_MAX		3	/* - Z1 Z2 Z3 */
34 #define MODS_POWER_MAX		3	/* - B1 B2 B3 */
35 #define MODS_LASER_MAX		2	/* - LS LB */
36 
37 #define MODS_NUCLEAR		(1<<0)
38 #define MODS_FULLNUCLEAR	(1<<1)
39 #define MODS_LASER_STUN		(1<<0)
40 #define MODS_LASER_BLIND	(1<<1)
41 
42 typedef enum {
43     ModsNuclear,	/* 0,  MODS_NUCLEAR, MODS_NUCLEAR|MODS_FULLNUCLEAR */
44     ModsCluster,	/* 0 - MODS_CLUSTER_MAX */
45     ModsImplosion,	/* 0 - MODS_IMPLOSION_MAX */
46     ModsVelocity,	/* 0 - MODS_VELOCITY_MAX */
47     ModsMini,		/* 0 - MODS_MINI_MAX */
48     ModsSpread,		/* 0 - MODS_SPREAD_MAX */
49     ModsPower,		/* 0 - MODS_POWER_MAX */
50     ModsLaser		/* 0,  MODS_LASER_STUN, MODS_LASER_BLIND */
51 } modifier_t;
52 
Mods_clear(modifiers_t * mods)53 static inline void Mods_clear(modifiers_t *mods)
54 {
55     *mods = 0;
56 }
57 
58 void Mods_to_string(modifiers_t mods, char *dst, size_t size);
59 int Mods_set(modifiers_t *mods, modifier_t modifier, int val);
60 int Mods_get(modifiers_t mods, modifier_t modifier);
61 void Mods_filter(modifiers_t *mods);
62 
63 #endif
64