]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item.qh
Merge branch 'master' into terencehill/hud_cleanups
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item.qh
1 #ifndef GAMEITEM_H
2 #define GAMEITEM_H
3
4 const int IT_UNLIMITED_WEAPON_AMMO              =       1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
5 const int IT_UNLIMITED_SUPERWEAPONS             =       2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
6 const int IT_CTF_SHIELDED                       =       4; // set for the flag shield
7 const int IT_USING_JETPACK                      =       8; // confirmation that button is pressed
8 const int IT_JETPACK                            =      16; // actual item
9 const int IT_FUEL_REGEN                         =      32; // fuel regeneration trigger
10 // where is 64... ?
11 const int IT_FUEL                                       =     128;
12 // -Wdouble-declaration
13 #define IT_SHELLS                                         256
14 // -Wdouble-declaration
15 #define IT_NAILS                                          512
16 // -Wdouble-declaration
17 #define IT_ROCKETS                                       1024
18 // -Wdouble-declaration
19 #define IT_CELLS                                         2048
20 const int IT_SUPERWEAPON                                =    4096;
21 const int IT_STRENGTH                                   =    8192;
22 const int IT_INVINCIBLE                                 =   16384;
23 const int IT_HEALTH                                     =   32768;
24 const int IT_PLASMA                                     =   65536;
25
26 // shared value space (union):
27         // for items:
28         // -Wdouble-declaration
29         #define IT_KEY1                                                 131072
30         // -Wdouble-declaration
31         #define IT_KEY2                                                 262144
32 // end
33
34 const int IT_5HP                        =  524288;
35 const int IT_25HP                       = 1048576;
36 const int IT_ARMOR_SHARD                = 2097152;
37 const int IT_ARMOR                      = 4194304;
38
39 // item masks
40 const int IT_AMMO                       =    3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA;
41 const int IT_PICKUPMASK                 =      51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
42 const int IT_UNLIMITED_AMMO             =       3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
43
44 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
45 /** If you register a new item, make sure to add it to all.inc */
46 CLASS(GameItem, Object)
47     ATTRIB(GameItem, m_id, int, 0)
48     ATTRIB(GameItem, m_name, string, string_null)
49     ATTRIB(GameItem, m_icon, string, string_null)
50     ATTRIB(GameItem, m_color, vector, '1 1 1')
51     ATTRIB(GameItem, m_waypoint, string, string_null)
52     ATTRIB(GameItem, m_waypointblink, int, 1)
53     METHOD(GameItem, display, void(entity this, void(string name, string icon) returns)) {
54         returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
55     }
56     METHOD(GameItem, show, void(entity this)) { LOG_INFO("A game item\n"); }
57     void ITEM_HANDLE(Show, entity this) { this.show(this); }
58 ENDCLASS(GameItem)
59
60 #endif