]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items.qh
Merge branch 'master' into terencehill/newpanelhud
[xonotic/xonotic-data.pk3dir.git] / 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    = 0x00; // e.g: Hook, Port-o-launch, etc
6 float WEP_TYPE_SPLASH   = 0x01;
7 float WEP_TYPE_HITSCAN  = 0x02;
8 float WEP_TYPEMASK      = 0x0F;
9 float WEP_FLAG_CANCLIMB = 0x10;
10 float WEP_FLAG_NORMAL   = 0x20;
11 float WEP_FLAG_HIDDEN   = 0x40;
12
13 float   IT_UNLIMITED_WEAPON_AMMO  = 1;
14 // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
15 float   IT_UNLIMITED_SUPERWEAPONS = 2;
16 // when this bit is set, using a superweapon does not throw it away. Checkpoints can give this powerup.
17 float   IT_CTF_SHIELDED           = 4; // set for the flag shield
18 // using jetpack
19 float   IT_USING_JETPACK          = 8; // confirmation that button is pressed
20 float   IT_JETPACK                = 16; // actual item
21 float   IT_FUEL_REGEN             = 32; // fuel regeneration trigger
22 float   IT_SHELLS                               = 256;
23 float   IT_NAILS                                = 512;
24 float   IT_ROCKETS                              = 1024;
25 float   IT_CELLS                                = 2048;
26 float   IT_SUPERWEAPON                  = 4096;
27 float   IT_FUEL                                 = 128;
28 float   IT_STRENGTH                             = 8192;
29 float   IT_INVINCIBLE                   = 16384;
30 float   IT_HEALTH                               = 32768;
31 // union:
32         // for items:
33         float   IT_KEY1                                 = 131072;
34         float   IT_KEY2                                 = 262144;
35         // for players:
36         float   IT_RED_FLAG_TAKEN               = 32768;
37         float   IT_RED_FLAG_LOST                = 65536;
38         float   IT_RED_FLAG_CARRING             = 98304;
39         float   IT_BLUE_FLAG_TAKEN              = 131072;
40         float   IT_BLUE_FLAG_LOST               = 262144;
41         float   IT_BLUE_FLAG_CARRING    = 393216;
42 // end
43 float   IT_5HP                                  = 524288;
44 float   IT_25HP                                 = 1048576;
45 float   IT_ARMOR_SHARD                  = 2097152;
46 float   IT_ARMOR                                = 4194304;
47
48 float   IT_AMMO                                 = 8064; // IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_SUPERWEAPON | IT_FUEL;
49 float   IT_PICKUPMASK           = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
50 float   IT_UNLIMITED_AMMO       = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
51
52 float AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
53
54 // variables:
55 string weaponorder_byid;
56
57 // functions:
58 entity get_weaponinfo(float id);
59 string W_FixWeaponOrder(string order, float complete);
60 string W_NameWeaponOrder(string order);
61 string W_NumberWeaponOrder(string order);
62
63 // entity properties of weaponinfo:
64 .float weapon; // WEP_...
65 .float weapons; // WEPBIT_...
66 .string netname; // short name
67 .string message; // human readable name
68 .float items; // IT_...
69 .float(float) weapon_func; // w_...
70 .string mdl; // modelname without g_, v_, w_
71 .string model; // full name of g_ model
72 .float spawnflags; // WEPSPAWNFLAG_... combined
73 .float impulse; // weapon impulse
74 .float bot_pickupbasevalue; // bot weapon priority
75 .string model2; // wpn- sprite name
76
77
78
79 // dynamic weapon adding
80 float w_null(float dummy);
81 void register_weapon(float id, float(float) func, float ammotype, float i, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname);
82 void register_weapons_done();
83
84 float WEP_COUNT;
85 float WEP_FIRST = 1;
86 float WEP_LAST;
87 #define WEP_MAXCOUNT 24
88 float WEPBIT_ALL;
89 #define REGISTER_WEAPON_2(id,bit,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname) \
90         float id; \
91         float bit; \
92         float func(float); \
93         void RegisterWeapons_##id() \
94         { \
95                 WEP_LAST = (id = WEP_FIRST + WEP_COUNT); \
96                 WEPBIT_ALL |= (bit = power2of(WEP_COUNT)); \
97                 ++WEP_COUNT; \
98                 register_weapon(id,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname); \
99         } \
100         ACCUMULATE_FUNCTION(RegisterWeapons, RegisterWeapons_##id)
101 #ifdef MENUQC
102 #define REGISTER_WEAPON(id,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname) \
103         REGISTER_WEAPON_2(WEP_##id,WEPBIT_##id,w_null,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname)
104 #else
105 #define REGISTER_WEAPON(id,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname) \
106         REGISTER_WEAPON_2(WEP_##id,WEPBIT_##id,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname)
107 #endif
108
109 #include "../server/w_all.qc"
110
111 #undef REGISTER_WEAPON
112 ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done)
113
114
115 string W_FixWeaponOrder(string order, float complete);
116 string W_NumberWeaponOrder(string order);
117 string W_NameWeaponOrder(string order);
118 string W_FixWeaponOrder_BuildImpulseList(string o);
119 string W_FixWeaponOrder_AllowIncomplete(string order);
120 string W_FixWeaponOrder_ForceComplete(string order);