]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Items: Use model registry
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 27 Sep 2015 03:14:37 +0000 (13:14 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 27 Sep 2015 03:20:23 +0000 (13:20 +1000)
qcsrc/common/items/all.qc
qcsrc/common/items/all.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/pickup.qh
qcsrc/common/items/item/powerup.qc
qcsrc/server/mutators/mutator_instagib_items.qc
qcsrc/server/t_items.qc

index fc225cdb7d40ecf648da2b802ecd504fba8631cc..8a9e314020bd16f100774837050c14d3ed3019a5 100644 (file)
@@ -11,4 +11,14 @@ void Dump_Items()
     ));
 }
 
+string Item_Model(string item_mdl)
+{
+    string output = strcat("models/items/", item_mdl);
+#ifdef SVQC
+    MUTATOR_CALLHOOK(ItemModel, item_mdl, output);
+    output = item_model_output;
+#endif
+    return output;
+}
+
 #endif
index 2e33119fb089920e71c69ccf07051223dc945496..3f8c603e7ab2aabeb75c74f438a00e73bba7593b 100644 (file)
@@ -11,6 +11,10 @@ REGISTER_REGISTRY(RegisterItems)
 
 void Dump_Items();
 
+#ifndef MENUQC
+string Item_Model(string item_mdl);
+#endif
+
 #endif
 
 #include "inventory.qh"
index 2d487a7b51be6723a030f44af5e14d5997da9883..16673711eea4b463b17c76d37702148dfa72176b 100644 (file)
@@ -3,8 +3,14 @@
     #include "../../../server/t_items.qh"
 #endif
 
+#ifndef MENUQC
+MODEL(Bullets_ITEM, Item_Model("a_bullets.mdl"));
+#endif
+
 REGISTER_ITEM(Bullets, Ammo) {
-    this.m_model    =   "a_bullets.mdl";
+#ifndef MENUQC
+    this.m_model    =   MDL_Bullets_ITEM;
+#endif
     this.m_name     =   "bullets";
     this.m_icon     =   "ammo_bullets";
 #ifdef SVQC
@@ -12,8 +18,15 @@ REGISTER_ITEM(Bullets, Ammo) {
     this.m_itemid   =   IT_NAILS;
 #endif
 }
+
+#ifndef MENUQC
+MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
+#endif
+
 REGISTER_ITEM(Cells, Ammo) {
-    this.m_model    =   "a_cells.md3";
+#ifndef MENUQC
+    this.m_model    =   MDL_Cells_ITEM;
+#endif
     this.m_name     =   "cells";
     this.m_icon     =   "ammo_cells";
 #ifdef SVQC
@@ -21,8 +34,15 @@ REGISTER_ITEM(Cells, Ammo) {
     this.m_itemid   =   IT_CELLS;
 #endif
 }
+
+#ifndef MENUQC
+MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
+#endif
+
 REGISTER_ITEM(Plasma, Ammo) {
-    this.m_model    =   "a_cells.md3";
+#ifndef MENUQC
+    this.m_model    =   MDL_Plasma_ITEM;
+#endif
     this.m_name     =   "plasma";
     this.m_icon     =   "ammo_plasma";
 #ifdef SVQC
@@ -30,8 +50,15 @@ REGISTER_ITEM(Plasma, Ammo) {
     this.m_itemid   =   IT_PLASMA;
 #endif
 }
+
+#ifndef MENUQC
+MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
+#endif
+
 REGISTER_ITEM(Rockets, Ammo) {
-    this.m_model    =   "a_rockets.md3";
+#ifndef MENUQC
+    this.m_model    =   MDL_Rockets_ITEM;
+#endif
     this.m_name     =   "rockets";
     this.m_icon     =   "ammo_rockets";
 #ifdef SVQC
@@ -39,8 +66,15 @@ REGISTER_ITEM(Rockets, Ammo) {
     this.m_itemid   =   IT_ROCKETS;
 #endif
 }
+
+#ifndef MENUQC
+MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
+#endif
+
 REGISTER_ITEM(Shells, Ammo) {
-    this.m_model    =   "a_shells.md3";
+#ifndef MENUQC
+    this.m_model    =   MDL_Shells_ITEM;
+#endif
     this.m_name     =   "shells";
     this.m_icon     =   "ammo_shells";
 #ifdef SVQC
index e7965803e2115e1e2f7f631fae6680a878d2eeaa..13a774ebcec18f693120f19e7b89982d688fe788 100644 (file)
@@ -3,8 +3,14 @@
     #include "../../../server/t_items.qh"
 #endif
 
+#ifndef MENUQC
+MODEL(ArmorSmall_ITEM, Item_Model("item_armor_small.md3"));
+#endif
+
 REGISTER_ITEM(ArmorSmall, Armor) {
-    this.m_model                =   "item_armor_small.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_ArmorSmall_ITEM;
+#endif
     this.m_sound                =   "misc/armor1.wav";
     this.m_name                 =   "5 Armor";
     this.m_icon                 =   "armor";
@@ -16,8 +22,14 @@ REGISTER_ITEM(ArmorSmall, Armor) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
+#endif
+
 REGISTER_ITEM(ArmorMedium, Armor) {
-    this.m_model                =   "item_armor_medium.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_ArmorMedium_ITEM;
+#endif
     this.m_sound                =   "misc/armor10.wav";
     this.m_name                 =   "25 Armor";
     this.m_icon                 =   "armor";
@@ -29,8 +41,14 @@ REGISTER_ITEM(ArmorMedium, Armor) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(ArmorLarge_ITEM, Item_Model("item_armor_big.md3"));
+#endif
+
 REGISTER_ITEM(ArmorLarge, Armor) {
-    this.m_model                =   "item_armor_big.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_ArmorLarge_ITEM;
+#endif
     this.m_sound                =   "misc/armor17_5.wav";
     this.m_name                 =   "50 Armor";
     this.m_icon                 =   "armor";
@@ -44,8 +62,14 @@ REGISTER_ITEM(ArmorLarge, Armor) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
+#endif
+
 REGISTER_ITEM(ArmorMega, Armor) {
-    this.m_model                =   "item_armor_large.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_ArmorMega_ITEM;
+#endif
     this.m_sound                =   "misc/armor25.wav";
     this.m_name                 =   "100 Armor";
     this.m_icon                 =   "item_large_armor";
index bb9d90eb44cdb9c2af8fc1d62cb54ec8665318a8..b81bde7afc22d1b0bd2152f990d5746725e215b3 100644 (file)
@@ -3,8 +3,14 @@
     #include "../../../server/t_items.qh"
 #endif
 
+#ifndef MENUQC
+MODEL(HealthSmall_ITEM, Item_Model("g_h1.md3"));
+#endif
+
 REGISTER_ITEM(HealthSmall, Health) {
-    this.m_model                =   "g_h1.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_HealthSmall_ITEM;
+#endif
     this.m_sound                =   "misc/minihealth.wav";
     this.m_name                 =   "5 Health";
     this.m_icon                 =   "health";
@@ -16,8 +22,14 @@ REGISTER_ITEM(HealthSmall, Health) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
+#endif
+
 REGISTER_ITEM(HealthMedium, Health) {
-    this.m_model                =   "g_h25.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_HealthMedium_ITEM;
+#endif
     this.m_sound                =   "misc/mediumhealth.wav";
     this.m_name                 =   "25 Health";
     this.m_icon                 =   "health";
@@ -29,8 +41,14 @@ REGISTER_ITEM(HealthMedium, Health) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(HealthLarge_ITEM, Item_Model("g_h50.md3"));
+#endif
+
 REGISTER_ITEM(HealthLarge, Health) {
-    this.m_model                =   "g_h50.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_HealthLarge_ITEM;
+#endif
     this.m_sound                =   "misc/mediumhealth.wav";
     this.m_name                 =   "50 Health";
     this.m_icon                 =   "health";
@@ -44,8 +62,14 @@ REGISTER_ITEM(HealthLarge, Health) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
+#endif
+
 REGISTER_ITEM(HealthMega, Health) {
-    this.m_model                =   "g_h100.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_HealthMega_ITEM;
+#endif
     this.m_sound                =   "misc/megahealth.wav";
     this.m_name                 =   "100 Health";
     this.m_icon                 =   "item_mega_health";
index 3b4cfbc141c9a6b1798612f7b8ef7238162f20eb..63019aebe8bbf50800da4967ce6421144bb1d906 100644 (file)
@@ -6,8 +6,14 @@
 #include "ammo.qh"
 #include "powerup.qh"
 
+#ifndef MENUQC
+MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3"));
+#endif
+
 REGISTER_ITEM(Jetpack, Powerup) {
-    this.m_model                =   "g_jetpack.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_Jetpack_ITEM;
+#endif
     this.m_name                 =   "Jet pack";
     this.m_icon                 =   "jetpack";
     this.m_color                =   '0.5 0.5 0.5';
@@ -20,8 +26,14 @@ REGISTER_ITEM(Jetpack, Powerup) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(JetpackFuel_ITEM, Item_Model("g_fuel.md3"));
+#endif
+
 REGISTER_ITEM(JetpackFuel, Ammo) {
-    this.m_model    =   "g_fuel.md3";
+#ifndef MENUQC
+    this.m_model    =   MDL_JetpackFuel_ITEM;
+#endif
     this.m_name     =   "Fuel";
     this.m_icon     =   "ammo_fuel";
 #ifdef SVQC
@@ -30,8 +42,14 @@ REGISTER_ITEM(JetpackFuel, Ammo) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(JetpackRegen_ITEM, Item_Model("g_fuelregen.md3"));
+#endif
+
 REGISTER_ITEM(JetpackRegen, Pickup) {
-    this.m_model                =   "g_fuelregen.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_JetpackRegen_ITEM;
+#endif
     this.m_name                 =   "Fuel regenerator";
     this.m_icon                 =   "fuelregen";
     this.m_color                =   '1 0.5 0';
index 793230e359f831222ad7c309a7a7b001cbe332a0..6f60337c195a7ab7d79c43a04f5ec937e771ab67 100644 (file)
@@ -2,7 +2,9 @@
 #define PICKUP_H
 #include "../item.qh"
 CLASS(Pickup, GameItem)
-    ATTRIB(Pickup, m_model, string, string_null)
+#ifndef MENUQC
+    ATTRIB(Pickup, m_model, Model, NULL)
+#endif
     ATTRIB(Pickup, m_sound, string, "misc/itempickup.wav")
     ATTRIB(Pickup, m_name, string, string_null)
     METHOD(Pickup, show, void(entity this));
index fcfe2afb93a5a7c4b44183dfd6c654595f9c1c77..f411d748a8d5eaeb891ec8eace2d2dd76725695e 100644 (file)
@@ -4,8 +4,15 @@
 #ifndef SVQC
 .int m_itemid;
 #endif
+
+#ifndef MENUQC
+MODEL(Strength_ITEM, Item_Model("g_strength.md3"));
+#endif
+
 REGISTER_ITEM(Strength, Powerup) {
-    this.m_model            =   "g_strength.md3";
+#ifndef MENUQC
+    this.m_model            =   MDL_Strength_ITEM;
+#endif
     this.m_sound            =   "misc/powerup.wav";
     this.m_name             =   "Strength Powerup";
     this.m_icon             =   "strength";
@@ -14,8 +21,15 @@ REGISTER_ITEM(Strength, Powerup) {
     this.m_waypointblink    =   2;
     this.m_itemid           =   IT_STRENGTH;
 }
+
+#ifndef MENUQC
+MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
+#endif
+
 REGISTER_ITEM(Shield, Powerup) {
-    this.m_model            =   "g_invincible.md3";
+#ifndef MENUQC
+    this.m_model            =   MDL_Shield_ITEM;
+#endif
     this.m_sound            =   "misc/powerup_shield.wav";
     this.m_name             =   "Shield";
     this.m_icon             =   "shield";
index 8beec7db2de94177af6921f1592058842cc9d704..87abd78a2c1d1a060fef72b4efd3bf35dda49683 100644 (file)
@@ -5,8 +5,14 @@ float instagib_respawntimejitter_ammo = 0;
 GETTER(float, instagib_respawntime_ammo)
 GETTER(float, instagib_respawntimejitter_ammo)
 
+#ifndef MENUQC
+MODEL(VaporizerCells_ITEM, Item_Model("a_cells.md3"));
+#endif
+
 REGISTER_ITEM(VaporizerCells, Ammo) {
-    this.m_model                =   "a_cells.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_VaporizerCells_ITEM;
+#endif
     this.m_sound                =   "misc/itempickup.wav";
     this.m_name                 =   "Vaporizer Ammo";
     this.m_icon                 =   "ammo_supercells";
@@ -18,8 +24,14 @@ REGISTER_ITEM(VaporizerCells, Ammo) {
 #endif
 }
 
+#ifndef MENUQC
+MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3"));
+#endif
+
 REGISTER_ITEM(ExtraLife, Powerup) {
-    this.m_model                =   "g_h100.md3";
+#ifndef MENUQC
+    this.m_model                =   MDL_ExtraLife_ITEM;
+#endif
     this.m_sound                =   "misc/megahealth.wav";
     this.m_name                 =   "Extra life";
     this.m_icon                 =   "item_mega_health";
@@ -29,8 +41,14 @@ REGISTER_ITEM(ExtraLife, Powerup) {
     this.m_itemid               =   IT_NAILS;
 }
 
+#ifndef MENUQC
+MODEL(Invisibility_ITEM, Item_Model("g_strength.md3"));
+#endif
+
 REGISTER_ITEM(Invisibility, Powerup) {
-    this.m_model            =   "g_strength.md3";
+#ifndef MENUQC
+    this.m_model            =   MDL_Invisibility_ITEM;
+#endif
     this.m_sound            =   "misc/powerup.wav";
     this.m_name             =   "Invisibility";
     this.m_icon             =   "strength";
@@ -40,8 +58,14 @@ REGISTER_ITEM(Invisibility, Powerup) {
     this.m_itemid           =   IT_STRENGTH;
 }
 
+#ifndef MENUQC
+MODEL(Speed_ITEM, Item_Model("g_invincible.md3"));
+#endif
+
 REGISTER_ITEM(Speed, Powerup) {
-    this.m_model            =   "g_invincible.md3";
+#ifndef MENUQC
+    this.m_model            =   MDL_Speed_ITEM;
+#endif
     this.m_sound            =   "misc/powerup_shield.wav";
     this.m_name             =   "Speed";
     this.m_icon             =   "shield";
index 68cc43fb9f5db601ee61975ecdeb5440cd712b56..7d3e59836b9ebb80f85769d2de5a45130942d5d5 100644 (file)
@@ -1197,17 +1197,10 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        }
 }
 
-string Item_Model(string item_mdl)
-{
-       string output = strcat("models/items/", item_mdl);
-       MUTATOR_CALLHOOK(ItemModel, item_mdl, output);
-       return strzone(item_model_output);
-}
-
 void StartItemA (entity a)
 {SELFPARAM();
     self.itemdef = a;
-    StartItem(Item_Model(a.m_model), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
+    StartItem(strzone(a.m_model.model_str()), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
 }
 
 void spawnfunc_item_rockets()