2bb10d40cd19759aac99fee57be3fd259704b036
[divverent/nexuiz.git] / data / qcsrc / common / items.qh
1 float BOT_PICKUP_RATING_LOW     = 2500;
2 float BOT_PICKUP_RATING_MID     = 5000;
3 float BOT_PICKUP_RATING_HIGH    = 10000;
4
5 float WEP_TYPE_OTHER    = 0;    // e.g: Hook, Port-o-launch, etc
6 float WEP_TYPE_SPLASH   = 1;
7 float WEP_TYPE_HITSCAN  = 2;
8
9 float   IT_UNLIMITED_WEAPON_AMMO  = 1;
10 // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
11 float   IT_UNLIMITED_SUPERWEAPONS = 2;
12 // when this bit is set, using a superweapon does not throw it away. Checkpoints can give this powerup.
13 float   IT_CTF_SHIELDED           = 4; // set for the flag shield
14 // using jetpack
15 float   IT_USING_JETPACK          = 8; // confirmation that button is pressed
16 float   IT_JETPACK                = 16; // actual item
17 float   IT_FUEL_REGEN             = 32; // fuel regeneration trigger
18 float   IT_SHELLS                               = 256;
19 float   IT_NAILS                                = 512;
20 float   IT_ROCKETS                              = 1024;
21 float   IT_CELLS                                = 2048;
22 float   IT_SUPERWEAPON                  = 4096;
23 float   IT_FUEL                                 = 128;
24 float   IT_STRENGTH                             = 8192;
25 float   IT_INVINCIBLE                   = 16384;
26 float   IT_HEALTH                               = 32768;
27 // union:
28         // for items:
29         float   IT_KEY1                                 = 131072;
30         float   IT_KEY2                                 = 262144;
31         // for players:
32         float   IT_RED_FLAG_TAKEN               = 32768;
33         float   IT_RED_FLAG_LOST                = 65536;
34         float   IT_RED_FLAG_CARRING             = 98304;
35         float   IT_BLUE_FLAG_TAKEN              = 131072;
36         float   IT_BLUE_FLAG_LOST               = 262144;
37         float   IT_BLUE_FLAG_CARRING    = 393216;
38 // end
39 float   IT_5HP                                  = 524288;
40 float   IT_25HP                                 = 1048576;
41 float   IT_ARMOR_SHARD                  = 2097152;
42 float   IT_ARMOR                                = 4194304;
43
44 float   IT_AMMO                                 = 8064; // IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_SUPERWEAPON | IT_FUEL;
45 float   IT_PICKUPMASK           = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
46 float   IT_UNLIMITED_AMMO       = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
47
48 // variables:
49 string weaponpriority_hudselector_0;
50 string weaponpriority_hudselector_1;
51
52 // functions:
53 entity get_weaponinfo(float id);
54 string W_FixWeaponOrder(string order, float complete);
55
56 #define WEPSPAWNFLAG_NORMAL 1
57 #define WEPSPAWNFLAG_CANCLIMB 2
58 #define WEPSPAWNFLAG_HIDDEN 4
59
60 // entity properties of weaponinfo:
61 .float weapon; // WEP_...
62 .float weapons; // WEPBIT_...
63 .string netname; // short name
64 .string message; // human readable name
65 .float items; // IT_...
66 .float(float) weapon_func; // w_...
67 .string mdl; // modelname without g_, v_, w_
68 .string model; // full name of g_ model
69 .float spawnflags; // WEPSPAWNFLAG_... combined
70 .float impulse; // weapon impulse
71 .float weapon_type; // see WEP_TYPE_* constants
72 .float bot_pickupbasevalue; // bot weapon priority
73 .string model2; // wpn- sprite name
74
75
76
77 // dynamic weapon adding
78 float w_null(float dummy);
79 void register_weapon(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname);
80 void register_weapons_done();
81
82 float WEP_COUNT;
83 float WEP_FIRST = 1;
84 float WEP_LAST;
85 #define WEP_MAXCOUNT 24
86 float WEPBIT_ALL;
87 #define REGISTER_WEAPON_2(id,bit,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
88         float id; \
89         float bit; \
90         float func(float); \
91         void RegisterWeapons_##id() \
92         { \
93                 WEP_LAST = (id = WEP_FIRST + WEP_COUNT); \
94                 WEPBIT_ALL |= (bit = power2of(WEP_COUNT)); \
95                 ++WEP_COUNT; \
96                 register_weapon(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname); \
97         } \
98         ACCUMULATE_FUNCTION(RegisterWeapons, RegisterWeapons_##id)
99 #ifdef SVQC
100 #define REGISTER_WEAPON(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
101         REGISTER_WEAPON_2(WEP_##id,WEPBIT_##id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
102 #else
103 #define REGISTER_WEAPON(id,func,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname) \
104         REGISTER_WEAPON_2(WEP_##id,WEPBIT_##id,w_null,ammotype,i,normalweapon,canclimb,weapontype,pickupbasevalue,modelname,shortname,wname)
105 #endif
106
107 #include "../server/w_all.qc"
108
109 #undef REGISTER_WEAPON
110 ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done)