5 #include "../common/util-pre.qh"
6 #include "../client/sys-pre.qh"
7 #include "../dpdefs/csprogsdefs.qc"
8 #include "../client/sys-post.qh"
9 #include "../client/Defs.qc"
10 #include "../dpdefs/keycodes.qc"
11 #include "../common/constants.qh"
12 #include "../common/stats.qh"
13 #include "../warpzonelib/anglestransform.qh"
14 #include "../warpzonelib/mathlib.qh"
15 #include "../warpzonelib/common.qh"
16 #include "../warpzonelib/client.qh"
17 #include "../common/playerstats.qh"
18 #include "../common/teams.qh"
19 #include "../common/util.qh"
20 #include "../common/nades.qh"
21 #include "../common/buffs.qh"
22 #include "../common/test.qh"
23 #include "../common/counting.qh"
24 #include "../common/weapons/weapons.qh"
25 #include "../common/mapinfo.qh"
26 #include "../common/command/markup.qh"
27 #include "../common/command/rpn.qh"
28 #include "../common/command/generic.qh"
29 #include "../common/command/shared_defs.qh"
30 #include "../common/urllib.qh"
31 #include "../common/animdecide.qh"
32 #include "../client/command/cl_cmd.qh"
33 #include "../common/monsters/monsters.qh"
34 #include "../client/autocvars.qh"
35 #include "../common/notifications.qh"
36 #include "../common/deathtypes.qh"
37 #include "../client/damage.qh"
38 #include "../csqcmodellib/interpolate.qh"
39 #include "../client/teamradar.qh"
40 #include "../client/hud.qh"
41 #include "../client/scoreboard.qh"
42 #include "../client/waypointsprites.qh"
43 #include "../client/movetypes.qh"
44 #include "../client/prandom.qh"
45 #include "../client/bgmscript.qh"
46 #include "../client/noise.qh"
47 #include "../client/tturrets.qh"
48 #include "tturrets/include/turrets_early.qh"
49 #include "../client/main.qh"
50 #include "../client/vehicles/vehicles.qh"
51 #include "../common/csqcmodel_settings.qh"
52 #include "../csqcmodellib/common.qh"
53 #include "../csqcmodellib/cl_model.qh"
54 #include "../csqcmodellib/cl_player.qh"
55 #include "../client/weapons/projectile.qh"
56 #include "../client/player_skeleton.qh"
59 #include "../common/util-pre.qh"
61 #include "../dpdefs/progsdefs.qc"
62 #include "../dpdefs/dpextensions.qc"
63 #include "sys-post.qh"
64 #include "../warpzonelib/anglestransform.qh"
65 #include "../warpzonelib/mathlib.qh"
66 #include "../warpzonelib/common.qh"
67 #include "../warpzonelib/util_server.qh"
68 #include "../warpzonelib/server.qh"
69 #include "../common/constants.qh"
70 #include "../common/stats.qh"
71 #include "../common/teams.qh"
72 #include "../common/util.qh"
73 #include "../common/nades.qh"
74 #include "../common/buffs.qh"
75 #include "../common/test.qh"
76 #include "../common/counting.qh"
77 #include "../common/urllib.qh"
78 #include "../common/command/markup.qh"
79 #include "../common/command/rpn.qh"
80 #include "../common/command/generic.qh"
81 #include "../common/command/shared_defs.qh"
82 #include "../common/net_notice.qh"
83 #include "../common/animdecide.qh"
84 #include "../common/monsters/monsters.qh"
85 #include "../common/monsters/sv_monsters.qh"
86 #include "../common/monsters/spawn.qh"
87 #include "../common/weapons/config.qh"
88 #include "../common/weapons/weapons.qh"
89 #include "weapons/accuracy.qh"
90 #include "weapons/common.qh"
91 #include "weapons/csqcprojectile.qh"
92 #include "weapons/hitplot.qh"
93 #include "weapons/selection.qh"
94 #include "weapons/spawning.qh"
95 #include "weapons/throwing.qh"
96 #include "weapons/tracing.qh"
97 #include "weapons/weaponstats.qh"
98 #include "weapons/weaponsystem.qh"
102 const int IT_UNLIMITED_WEAPON_AMMO = 1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
103 const int IT_UNLIMITED_SUPERWEAPONS = 2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
104 const int IT_CTF_SHIELDED = 4; // set for the flag shield
105 const int IT_USING_JETPACK = 8; // confirmation that button is pressed
106 const int IT_JETPACK = 16; // actual item
107 const int IT_FUEL_REGEN = 32; // fuel regeneration trigger
109 const int IT_FUEL = 128;
110 const int IT_SHELLS = 256;
111 const int IT_NAILS = 512;
112 const int IT_ROCKETS = 1024;
113 const int IT_CELLS = 2048;
114 const int IT_SUPERWEAPON = 4096;
115 const int IT_STRENGTH = 8192;
116 const int IT_INVINCIBLE = 16384;
117 const int IT_HEALTH = 32768;
118 const int IT_PLASMA = 65536;
120 // shared value space (union):
122 const int IT_KEY1 = 131072;
123 const int IT_KEY2 = 262144;
125 const int IT_RED_FLAG_TAKEN = 32768;
126 const int IT_RED_FLAG_LOST = 65536;
127 const int IT_RED_FLAG_CARRYING = 98304;
128 const int IT_BLUE_FLAG_TAKEN = 131072;
129 const int IT_BLUE_FLAG_LOST = 262144;
130 const int IT_BLUE_FLAG_CARRYING = 393216;
133 const int IT_5HP = 524288;
134 const int IT_25HP = 1048576;
135 const int IT_ARMOR_SHARD = 2097152;
136 const int IT_ARMOR = 4194304;
139 const int IT_AMMO = 3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA;
140 const int IT_PICKUPMASK = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
141 const int IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
143 const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
146 const int ISF_LOCATION = 2;
147 const int ISF_MODEL = 4;
148 const int ISF_STATUS = 8;
149 const int ITS_STAYWEP = 1;
150 const int ITS_ANIMATE1 = 2;
151 const int ITS_ANIMATE2 = 4;
152 const int ITS_AVAILABLE = 8;
153 const int ITS_ALLOWFB = 16;
154 const int ITS_ALLOWSI = 32;
155 const int ITS_POWERUP = 64;
156 const int ISF_COLORMAP = 16;
157 const int ISF_DROP = 32;
158 const int ISF_ANGLES = 64;
159 const int ISF_SIZE = 128;
165 float autocvar_cl_animate_items = 1;
166 float autocvar_cl_ghost_items = 0.45;
167 vector autocvar_cl_ghost_items_color = '-1 -1 -1';
168 float autocvar_cl_fullbright_items = 0;
169 vector autocvar_cl_weapon_stay_color = '2 0.5 0.5';
170 float autocvar_cl_weapon_stay_alpha = 0.75;
171 float autocvar_cl_simple_items = 0;
172 string autocvar_cl_simpleitems_postfix = "_simple";
178 void ItemDrawSimple();
180 void ItemRead(float _IsNew);
184 float autocvar_sv_simple_items;
185 float ItemSend(entity to, float sf);
188 float have_pickup_item(void);
190 const float ITEM_RESPAWN_TICKS = 10;
192 #define ITEM_RESPAWNTIME(i) ((i).respawntime + crandom() * (i).respawntimejitter)
193 // range: respawntime - respawntimejitter .. respawntime + respawntimejitter
194 #define ITEM_RESPAWNTIME_INITIAL(i) (ITEM_RESPAWN_TICKS + random() * ((i).respawntime + (i).respawntimejitter - ITEM_RESPAWN_TICKS))
195 // range: 10 .. respawntime + respawntimejitter
197 .float max_armorvalue;
198 .float pickup_anyway;
200 void Item_Show (entity e, float mode);
202 void Item_Respawn (void);
204 void Item_RespawnCountdown (void);
205 void Item_ScheduleRespawnIn(entity e, float t);
207 void Item_ScheduleRespawn(entity e);
209 void Item_ScheduleInitialRespawn(entity e);
210 float ITEM_MODE_NONE = 0;
211 float ITEM_MODE_HEALTH = 1;
212 float ITEM_MODE_ARMOR = 2;
213 float ITEM_MODE_FUEL = 3;
214 float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode);
216 float Item_GiveTo(entity item, entity player);
218 void Item_Touch (void);
222 void Item_FindTeam();
223 // Savage: used for item garbage-collection
224 // TODO: perhaps nice special effect?
226 float ItemSend(entity to, float sf);
227 void ItemUpdate(entity item);
229 // pickup evaluation functions
230 // these functions decide how desirable an item is to the bots
232 float generic_pickupevalfunc(entity player, entity item);// {return item.bot_pickupbasevalue;} // WEAPONTODO
234 float weapon_pickupevalfunc(entity player, entity item);
236 float commodity_pickupevalfunc(entity player, entity item);
239 void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue);
242 void target_items_use (void);
244 const float OP_SET = 0;
245 const float OP_MIN = 1;
246 const float OP_MAX = 2;
247 const float OP_PLUS = 3;
248 const float OP_MINUS = 4;
250 float GiveWeapon(entity e, float wpn, float op, float val);
252 float GiveBit(entity e, .float fld, float bit, float op, float val);
254 float GiveValue(entity e, .float fld, float op, float val);
256 void GiveSound(entity e, float v0, float v1, float t, string snd_incr, string snd_decr);
258 void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime);
260 #define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = e.weapons
261 #define PREGIVE(e,f) float save_##f; save_##f = (e).f
262 #define POSTGIVE_WEAPON(e,b,snd_incr,snd_decr) GiveSound((e), !!(save_weapons & WepSet_FromWeapon(b)), !!(e.weapons & WepSet_FromWeapon(b)), 0, snd_incr, snd_decr)
263 #define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
264 #define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
265 #define POSTGIVE_VALUE_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e), save_##f, (e).f, rotfield, rottime, regenfield, regentime); GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
267 float GiveItems(entity e, float beginarg, float endarg);