]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/t_items.qh
Merge remote-tracking branch 'origin/master' into samual/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qh
1 #define ISF_LOCATION 2
2 #define ISF_MODEL    4
3 #define ISF_STATUS   8
4     #define ITS_STAYWEP   1
5     #define ITS_ANIMATE1  2
6     #define ITS_ANIMATE2  4
7     #define ITS_AVAILABLE 8
8     #define ITS_ALLOWFB   16
9     #define ITS_ALLOWSI   32
10     #define ITS_POWERUP   64
11 #define ISF_COLORMAP 16
12 #define ISF_DROP 32
13 #define ISF_ANGLES 64
14
15 .float ItemStatus;
16
17 #ifdef CSQC
18
19 var float  autocvar_cl_animate_items = 1;
20 var float  autocvar_cl_ghost_items = 0.45;
21 var vector autocvar_cl_ghost_items_color = '-1 -1 -1';
22 var float  autocvar_cl_fullbright_items = 0;
23 var vector autocvar_cl_weapon_stay_color = '2 0.5 0.5';
24 var float  autocvar_cl_weapon_stay_alpha = 0.75;
25 var float  autocvar_cl_simple_items = 0;
26 var string autocvr_cl_simpleitems_postfix = "_simple";
27 .float  spawntime;
28 .float  gravity;
29 .vector colormod;
30 void ItemDraw();
31
32 void ItemDrawSimple();
33
34 void ItemRead(float _IsNew);
35
36 #endif
37
38 #ifdef SVQC
39 float autocvar_sv_simple_items;
40 float ItemSend(entity to, float sf);
41
42
43 float have_pickup_item(void);
44
45 #define ITEM_RESPAWN_TICKS 10
46
47 #define ITEM_RESPAWNTIME(i)         ((i).respawntime + crandom() * (i).respawntimejitter)
48         // range: respawntime - respawntimejitter .. respawntime + respawntimejitter
49 #define ITEM_RESPAWNTIME_INITIAL(i) (ITEM_RESPAWN_TICKS + random() * ((i).respawntime + (i).respawntimejitter - ITEM_RESPAWN_TICKS))
50         // range: 10 .. respawntime + respawntimejitter
51
52 string Item_CounterFieldName(float it);
53
54 .float max_armorvalue;
55 .float pickup_anyway;
56
57 void Item_Show (entity e, float mode);
58
59 void Item_Respawn (void);
60
61 void Item_RespawnCountdown (void);
62 void Item_ScheduleRespawnIn(entity e, float t);
63
64 void Item_ScheduleRespawn(entity e);
65
66 void Item_ScheduleInitialRespawn(entity e);
67 float ITEM_MODE_NONE = 0;
68 float ITEM_MODE_HEALTH = 1;
69 float ITEM_MODE_ARMOR = 2;
70 float ITEM_MODE_FUEL = 3;
71 float Item_GiveAmmoTo(entity item, entity player, .float ammofield, float ammomax, float mode);
72
73 float Item_GiveTo(entity item, entity player);
74
75 void Item_Touch (void);
76
77 void Item_Reset();
78
79 void Item_FindTeam();
80 // Savage: used for item garbage-collection
81 // TODO: perhaps nice special effect?
82 void RemoveItem(void); // WEAPONTODO
83
84 // pickup evaluation functions
85 // these functions decide how desirable an item is to the bots
86
87 float generic_pickupevalfunc(entity player, entity item);// {return item.bot_pickupbasevalue;} // WEAPONTODO
88
89 float weapon_pickupevalfunc(entity player, entity item);
90
91 float commodity_pickupevalfunc(entity player, entity item);
92
93 void Item_Damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force); // WEAPONTODO
94
95 .float is_item;
96 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);
97
98
99 void target_items_use (void);
100
101 #define OP_SET 0
102 #define OP_MIN 1
103 #define OP_MAX 2
104 #define OP_PLUS 3
105 #define OP_MINUS 4
106
107 float GiveWeapon(entity e, float wpn, float op, float val);
108
109 float GiveBit(entity e, .float fld, float bit, float op, float val);
110
111 float GiveValue(entity e, .float fld, float op, float val);
112
113 void GiveSound(entity e, float v0, float v1, float t, string snd_incr, string snd_decr);
114
115 void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime);
116
117 #define PREGIVE_WEAPONS(e) WEPSET_DECLARE_A(save_weapons); WEPSET_COPY_AE(save_weapons, e)
118 #define PREGIVE(e,f) float save_##f; save_##f = (e).f
119 #define POSTGIVE_WEAPON(e,b,snd_incr,snd_decr) GiveSound((e), WEPSET_CONTAINS_AW(save_weapons, b), WEPSET_CONTAINS_EW(e, b), 0, snd_incr, snd_decr)
120 #define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
121 #define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
122 #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)
123
124 float GiveItems(entity e, float beginarg, float endarg);
125 #endif