]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add items topic
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 17 Aug 2015 07:13:19 +0000 (17:13 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 17 Aug 2015 07:13:19 +0000 (17:13 +1000)
qcsrc/common/items/item.qh
qcsrc/common/items/item/ammo.qc
qcsrc/common/items/item/armor.qc
qcsrc/common/items/item/health.qc
qcsrc/common/items/item/jetpack.qc
qcsrc/common/items/item/powerup.qc
qcsrc/menu/xonotic/dialog_media_guide.qc
qcsrc/server/mutators/mutator_instagib_items.qc

index 6ecd6d7f7a49fdba67f0271a30d4259dc78e1293..a976da5caab83193f82f358c23069acff8e67e5c 100644 (file)
@@ -5,6 +5,12 @@
 /** If you register a new item, make sure to add it to all.inc */
 CLASS(GameItem, Object)
     ATTRIB(GameItem, m_id, int, 0)
+    ATTRIB(GameItem, m_name, string, string_null)
+    ATTRIB(GameItem, m_icon, string, string_null)
+    METHOD(GameItem, display, void(entity this, void(string name, string icon) returns))
+    void GameItem_display(entity this, void(string name, string icon) returns) {
+        returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
+    }
     METHOD(GameItem, show, void(entity this))
     void GameItem_show(entity this) { print("A game item\n"); }
     void ITEM_HANDLE(Show, entity this) { this.show(this); }
index 58f30fb848483ca8438593174e44e3d58592dd92..84c22cdcd24ebde82902831848671affeb66124f 100644 (file)
@@ -6,6 +6,7 @@
 REGISTER_ITEM(Bullets, Ammo) {
     this.m_model    =   "models/items/a_bullets.mdl";
     this.m_name     =   "bullets";
+    this.m_icon     =   "ammo_bullets";
 #ifdef SVQC
     this.m_botvalue =   2000;
     this.m_itemid   =   IT_NAILS;
@@ -14,6 +15,7 @@ REGISTER_ITEM(Bullets, Ammo) {
 REGISTER_ITEM(Cells, Ammo) {
     this.m_model    =   "models/items/a_cells.md3";
     this.m_name     =   "cells";
+    this.m_icon     =   "ammo_cells";
 #ifdef SVQC
     this.m_botvalue =   2000;
     this.m_itemid   =   IT_CELLS;
@@ -22,6 +24,7 @@ REGISTER_ITEM(Cells, Ammo) {
 REGISTER_ITEM(Plasma, Ammo) {
     this.m_model    =   "models/items/a_cells.md3";
     this.m_name     =   "plasma";
+    this.m_icon     =   "ammo_plasma";
 #ifdef SVQC
     this.m_botvalue =   2000;
     this.m_itemid   =   IT_PLASMA;
@@ -30,6 +33,7 @@ REGISTER_ITEM(Plasma, Ammo) {
 REGISTER_ITEM(Rockets, Ammo) {
     this.m_model    =   "models/items/a_rockets.md3";
     this.m_name     =   "rockets";
+    this.m_icon     =   "ammo_rockets";
 #ifdef SVQC
     this.m_botvalue =   3000;
     this.m_itemid   =   IT_ROCKETS;
@@ -38,6 +42,7 @@ REGISTER_ITEM(Rockets, Ammo) {
 REGISTER_ITEM(Shells, Ammo) {
     this.m_model    =   "models/items/a_shells.md3";
     this.m_name     =   "shells";
+    this.m_icon     =   "ammo_shells";
 #ifdef SVQC
     this.m_botvalue =   500;
     this.m_itemid   =   IT_SHELLS;
index 0db9d1f70e8bf0f75344125ca0268512949763f1..b587b98c9ef0412d5326f17a8a73df3926310f67 100644 (file)
@@ -7,6 +7,7 @@ REGISTER_ITEM(ArmorSmall, Armor) {
     this.m_model                =   "models/items/item_armor_small.md3";
     this.m_sound                =   "misc/armor1.wav";
     this.m_name                 =   "5 Armor";
+    this.m_icon                 =   "armor";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
     this.m_itemid               =   IT_ARMOR_SHARD;
@@ -19,6 +20,7 @@ REGISTER_ITEM(ArmorMedium, Armor) {
     this.m_model                =   "models/items/item_armor_medium.md3";
     this.m_sound                =   "misc/armor10.wav";
     this.m_name                 =   "25 Armor";
+    this.m_icon                 =   "armor";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_MID;
     this.m_itemid               =   IT_ARMOR;
@@ -31,6 +33,7 @@ REGISTER_ITEM(ArmorBig, Armor) {
     this.m_model                =   "models/items/item_armor_big.md3";
     this.m_sound                =   "misc/armor17_5.wav";
     this.m_name                 =   "50 Armor";
+    this.m_icon                 =   "armor";
 #ifdef SVQC
     this.m_botvalue             =   20000; // FIXME: higher than BOT_PICKUP_RATING_HIGH?
     this.m_itemid               =   IT_ARMOR;
@@ -43,6 +46,7 @@ REGISTER_ITEM(ArmorLarge, Armor) {
     this.m_model                =   "models/items/item_armor_large.md3";
     this.m_sound                =   "misc/armor25.wav";
     this.m_name                 =   "100 Armor";
+    this.m_icon                 =   "item_large_armor";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_HIGH;
     this.m_itemid               =   IT_ARMOR;
index 4867273a614799c8d266327edcb3bc33f7eb7a3c..dded21951f8b255c312bc74897405b7603a99848 100644 (file)
@@ -7,6 +7,7 @@ REGISTER_ITEM(HealthSmall, Health) {
     this.m_model                =   "models/items/g_h1.md3";
     this.m_sound                =   "misc/minihealth.wav";
     this.m_name                 =   "5 Health";
+    this.m_icon                 =   "health";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
     this.m_itemid               =   IT_5HP;
@@ -19,6 +20,7 @@ REGISTER_ITEM(HealthMedium, Health) {
     this.m_model                =   "models/items/g_h25.md3";
     this.m_sound                =   "misc/mediumhealth.wav";
     this.m_name                 =   "25 Health";
+    this.m_icon                 =   "health";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_MID;
     this.m_itemid               =   IT_25HP;
@@ -31,6 +33,7 @@ REGISTER_ITEM(HealthLarge, Health) {
     this.m_model                =   "models/items/g_h50.md3";
     this.m_sound                =   "misc/mediumhealth.wav";
     this.m_name                 =   "50 Health";
+    this.m_icon                 =   "health";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_MID;
     this.m_itemid               =   IT_25HP;
@@ -43,6 +46,7 @@ REGISTER_ITEM(HealthMega, Health) {
     this.m_model                =   "models/items/g_h100.md3";
     this.m_sound                =   "misc/megahealth.wav";
     this.m_name                 =   "100 Health";
+    this.m_icon                 =   "item_mega_health";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_HIGH;
     this.m_itemid               =   IT_HEALTH;
index ad4ab2d0df48bf0c95b653dd778f1c0ad882495e..fa286c93ece8ecf20c1ff149629bf491ad53742d 100644 (file)
@@ -6,6 +6,7 @@
 REGISTER_ITEM(Jetpack, Pickup) {
     this.m_model                =   "models/items/g_jetpack.md3";
     this.m_name                 =   "Jet pack";
+    this.m_icon                 =   "jetpack";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
     this.m_itemflags            =   FL_POWERUP;
@@ -19,6 +20,7 @@ REGISTER_ITEM(Jetpack, Pickup) {
 REGISTER_ITEM(JetpackFuel, Pickup) {
     this.m_model                =   "models/items/g_fuel.md3";
     this.m_name                 =   "Fuel";
+    this.m_icon                 =   "ammo_fuel";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
     this.m_itemid               =   IT_FUEL;
@@ -31,6 +33,7 @@ REGISTER_ITEM(JetpackFuel, Pickup) {
 REGISTER_ITEM(JetpackRegen, Pickup) {
     this.m_model                =   "models/items/g_fuelregen.md3";
     this.m_name                 =   "Fuel regenerator";
+    this.m_icon                 =   "fuelregen";
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
     this.m_itemflags            =   FL_POWERUP;
index 0f025aed8f5a4ab4ee0282f24343e05077922f3e..d1e017c6b8a0b6612a02515254e726eef9978768 100644 (file)
@@ -5,6 +5,7 @@ REGISTER_ITEM(Strength, Powerup) {
     this.m_model    =   "models/items/g_strength.md3";
     this.m_sound    =   "misc/powerup.wav";
     this.m_name     =   "Strength Powerup";
+    this.m_icon     =   "strength";
 #ifdef SVQC
     this.m_itemid   =   IT_STRENGTH;
 #endif
@@ -13,6 +14,7 @@ REGISTER_ITEM(Shield, Powerup) {
     this.m_model    =   "models/items/g_invincible.md3";
     this.m_sound    =   "misc/powerup_shield.wav";
     this.m_name     =   "Shield";
+    this.m_icon     =   "shield";
 #ifdef SVQC
     this.m_itemid   =   IT_INVINCIBLE;
 #endif
index d4b9354046335683945264fe280f4856a554367b..33a06ace7521ed076a11c896aaa349aceefbc19b 100644 (file)
@@ -4,6 +4,7 @@
 
 #define TOPICS(X) \
     X(NEW(GametypeSource),  _("Gametypes"), "gametype_dm") \
+    X(NEW(ItemSource),      _("Items"),     "gametype_kh") \
     X(NEW(MapSource),       _("Maps"),      "gametype_ctf") \
     if (cvar("developer")) X(NEW(DebugSource), _("Debug"), "gametype_ons") \
     /**/
@@ -82,6 +83,18 @@ CLASS(GametypeSource, DataSource)
     int GametypeSource_reload(string filter) { return MAPINFO_TYPE_COUNT; }
 ENDCLASS(GametypeSource)
 
+#include "../../common/items/all.qh"
+CLASS(ItemSource, DataSource)
+    METHOD(ItemSource, getEntry, entity(int, void(string, string)))
+    entity ItemSource_getEntry(int i, void(string, string) returns) {
+        entity e = ITEMS[i];
+        if (returns) e.display(e, returns);
+        return e;
+    }
+    METHOD(ItemSource, reload, int(string))
+    int ItemSource_reload(string filter) { return ITEM_COUNT; }
+ENDCLASS(ItemSource)
+
 CLASS(MapSource, DataSource)
     METHOD(MapSource, getEntry, entity(int, void(string, string)))
     entity MapSource_getEntry(int i, void(string, string) returns)
index cd72aee3b403d761a1834f703256c99b17ca24c9..1d806e6796e13706951be7f96311341d93a11999 100644 (file)
@@ -9,24 +9,26 @@ GETTER(float, instagib_respawntime_ammo)
 GETTER(float, instagib_respawntimejitter_ammo)
 
 REGISTER_ITEM(VaporizerCells, Ammo) {
-    this.m_model               =   "models/items/a_cells.md3";
-    this.m_sound               =   "misc/itempickup.wav";
-    this.m_name                =   "Vaporizer Ammo";
+    this.m_model                =   "models/items/a_cells.md3";
+    this.m_sound                =   "misc/itempickup.wav";
+    this.m_name                 =   "Vaporizer Ammo";
+    this.m_icon                 =   "ammo_supercells";
 #ifdef SVQC
-    this.m_botvalue            =   100;
-    this.m_itemid              =   IT_CELLS;
-    this.m_respawntime         =   GET(instagib_respawntime_ammo);
-    this.m_respawntimejitter   =   GET(instagib_respawntimejitter_ammo);
+    this.m_botvalue             =   100;
+    this.m_itemid               =   IT_CELLS;
+    this.m_respawntime          =   GET(instagib_respawntime_ammo);
+    this.m_respawntimejitter    =   GET(instagib_respawntimejitter_ammo);
 #endif
 }
 
 REGISTER_ITEM(ExtraLife, Powerup) {
-    this.m_model               =   "models/items/g_h100.md3";
-    this.m_sound               =   "misc/megahealth.wav";
-    this.m_name                =   "Extralife";
+    this.m_model                =   "models/items/g_h100.md3";
+    this.m_sound                =   "misc/megahealth.wav";
+    this.m_name                 =   "Extralife";
+    this.m_icon                 =   "item_mega_health";
 #ifdef SVQC
-    this.m_itemid              =   IT_NAILS;
-    this.m_botvalue            =   BOT_PICKUP_RATING_HIGH;
+    this.m_itemid               =   IT_NAILS;
+    this.m_botvalue             =   BOT_PICKUP_RATING_HIGH;
 #endif
 }