]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Nades: rename registry globals
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 10:50:58 +0000 (21:50 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 10:50:58 +0000 (21:50 +1100)
13 files changed:
qcsrc/client/hud.qc
qcsrc/client/main.qc
qcsrc/client/progs.inc
qcsrc/client/view.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/nades.qc [deleted file]
qcsrc/common/nades.qh [deleted file]
qcsrc/common/nades/all.inc [new file with mode: 0644]
qcsrc/common/nades/all.qc [new file with mode: 0644]
qcsrc/common/nades/all.qh [new file with mode: 0644]
qcsrc/server/mutators/mutator_nades.qc
qcsrc/server/mutators/mutators_include.qc
qcsrc/server/progs.inc

index 1636b11e7d59d64842148bae48860a2f96534f12..eb577f46bf02bfba42d26d5f5579ad1c391fe9e3 100644 (file)
@@ -14,7 +14,7 @@
 #include "../common/deathtypes.qh"
 #include "../common/items/all.qc"
 #include "../common/mapinfo.qh"
 #include "../common/deathtypes.qh"
 #include "../common/items/all.qc"
 #include "../common/mapinfo.qh"
-#include "../common/nades.qh"
+#include "../common/nades/all.qh"
 
 #include "../server/mutators/gamemode_ctf.qh"
 
 
 #include "../server/mutators/gamemode_ctf.qh"
 
@@ -858,8 +858,8 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
        float bonusNades    = getstatf(STAT_NADE_BONUS);
        float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE);
        float bonusType     = getstati(STAT_NADE_BONUS_TYPE);
        float bonusNades    = getstatf(STAT_NADE_BONUS);
        float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE);
        float bonusType     = getstati(STAT_NADE_BONUS_TYPE);
-       vector nadeColor    = NADES[bonusType].m_color;
-       string nadeIcon     = NADES[bonusType].m_icon;
+       vector nadeColor    = Nades[bonusType].m_color;
+       string nadeIcon     = Nades[bonusType].m_icon;
 
        vector iconPos, textPos;
 
 
        vector iconPos, textPos;
 
index 5ed049c609619664da47f18d03451e3a9dbbadc6..e3f07b275c969a6dea7c9d6ff966f985d55f082c 100644 (file)
@@ -30,7 +30,7 @@
 #include "../common/effects/effects.qh"
 #include "../common/mapinfo.qh"
 #include "../common/monsters/all.qh"
 #include "../common/effects/effects.qh"
 #include "../common/mapinfo.qh"
 #include "../common/monsters/all.qh"
-#include "../common/nades.qh"
+#include "../common/nades/all.qh"
 #include "../common/net_notice.qh"
 #include "../common/notifications.qh"
 #include "../common/stats.qh"
 #include "../common/net_notice.qh"
 #include "../common/notifications.qh"
 #include "../common/stats.qh"
index fb5853f078b19acbe3672565db2227f6dcd00dd6..ec5c31844af9a57657c608ce25ad5efdce45e963 100644 (file)
@@ -40,7 +40,6 @@
 #include "../common/effects/effectinfo.qc"
 #include "../common/mapinfo.qc"
 #include "../common/movetypes/include.qc"
 #include "../common/effects/effectinfo.qc"
 #include "../common/mapinfo.qc"
 #include "../common/movetypes/include.qc"
-#include "../common/nades.qc"
 #include "../common/net_notice.qc"
 #include "../common/notifications.qc"
 #include "../common/physics.qc"
 #include "../common/net_notice.qc"
 #include "../common/notifications.qc"
 #include "../common/physics.qc"
@@ -56,6 +55,7 @@
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
+#include "../common/nades/all.qc"
 #include "../common/turrets/all.qc"
 #include "../common/vehicles/all.qc"
 #include "../common/weapons/all.qc"
 #include "../common/turrets/all.qc"
 #include "../common/vehicles/all.qc"
 #include "../common/weapons/all.qc"
index 60fb4b0c58fc960b6886140238859fca6bda076d..9c20747fbac1bd8c6d50de065ba6343fc57b9397 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "../common/constants.qh"
 #include "../common/mapinfo.qh"
 
 #include "../common/constants.qh"
 #include "../common/mapinfo.qh"
-#include "../common/nades.qh"
+#include "../common/nades/all.qh"
 #include "../common/stats.qh"
 #include "../common/triggers/target/music.qh"
 #include "../common/teams.qh"
 #include "../common/stats.qh"
 #include "../common/triggers/target/music.qh"
 #include "../common/teams.qh"
index 051bc40982f55c2df6185373b2c9826a81b3310c..fc08f7ffd025efabefdce1b8619100eaaf6a3b97 100644 (file)
@@ -5,7 +5,7 @@
 #include "../main.qh"
 
 #include "../../common/constants.qh"
 #include "../main.qh"
 
 #include "../../common/constants.qh"
-#include "../../common/nades.qh"
+#include "../../common/nades/all.qh"
 #include "../../common/movetypes/movetypes.qh"
 #include "../../common/util.qh"
 
 #include "../../common/movetypes/movetypes.qh"
 #include "../../common/util.qh"
 
diff --git a/qcsrc/common/nades.qc b/qcsrc/common/nades.qc
deleted file mode 100644 (file)
index a6b0000..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#if defined(CSQC)
-       #include "../dpdefs/csprogsdefs.qh"
-       #include "../client/defs.qh"
-       #include "nades.qh"
-       #include "buffs/all.qh"
-       #include "../common/movetypes/movetypes.qh"
-       #include "../client/main.qh"
-       #include "../csqcmodellib/cl_model.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
-       #include "../dpdefs/progsdefs.qh"
-    #include "constants.qh"
-    #include "../server/constants.qh"
-       #include "../common/turrets/sv_turrets.qh"
-#endif
-
-
-#ifdef CSQC
-.float ltime;
-void healer_draw()
-{SELFPARAM();
-       float dt = time - self.move_time;
-       self.move_time = time;
-       if(dt <= 0)
-               return;
-
-       self.alpha = (self.ltime - time) / self.healer_lifetime;
-       self.scale = min((1 - self.alpha)*self.healer_lifetime*4,1)*self.healer_radius;
-}
-
-void healer_setup(entity e)
-{
-       setmodel(e, MDL_NADE_HEAL);
-
-       setorigin(e, e.origin);
-
-       float model_radius = e.maxs.x;
-       vector size = '1 1 1' * e.healer_radius / 2;
-       setsize(e,-size,size);
-       e.healer_radius = e.healer_radius/model_radius*0.6;
-
-       e.draw = healer_draw;
-       e.health = 255;
-       e.movetype = MOVETYPE_NONE;
-       e.solid = SOLID_NOT;
-       e.drawmask = MASK_NORMAL;
-       e.scale = 0.01;
-       e.avelocity = e.move_avelocity = '7 0 11';
-       e.colormod = '1 0 0';
-       e.renderflags |= RF_ADDITIVE;
-}
-#endif // CSQC
-
-REGISTER_LINKED(Nade_Heal, bool isNew)
-#ifdef CSQC
-{
-       int sf = ReadByte();
-       if (sf & 1) {
-               this.origin_x = ReadCoord();
-               this.origin_y = ReadCoord();
-               this.origin_z = ReadCoord();
-               setorigin(this, this.origin);
-               this.healer_lifetime = ReadByte();
-               this.healer_radius = ReadShort();
-               this.ltime = time + ReadByte()/10.0;
-               // this.ltime = time + this.healer_lifetime;
-               healer_setup(this);
-       }
-}
-#endif
-
-#ifdef SVQC
-float healer_send(entity to, int sf)
-{
-       SELFPARAM();
-       WriteByte(MSG_ENTITY, Linked_Nade_Heal.m_id);
-       WriteByte(MSG_ENTITY, sf);
-       if (sf & 1) {
-               WriteCoord(MSG_ENTITY, this.origin.x);
-               WriteCoord(MSG_ENTITY, this.origin.y);
-               WriteCoord(MSG_ENTITY, this.origin.z);
-
-               WriteByte(MSG_ENTITY, this.healer_lifetime);
-               //WriteByte(MSG_ENTITY, this.ltime - time + 1);
-               WriteShort(MSG_ENTITY, this.healer_radius);
-               // round time delta to a 1/10th of a second
-               WriteByte(MSG_ENTITY, (this.ltime - time)*10.0+0.5);
-       }
-       return true;
-}
-#endif // SVQC
diff --git a/qcsrc/common/nades.qh b/qcsrc/common/nades.qh
deleted file mode 100644 (file)
index be9d353..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef NADES_H
-#define NADES_H
-
-#include "teams.qh"
-
-.float healer_lifetime;
-.float healer_radius;
-
-// use slots 70-100
-const int PROJECTILE_NADE = 71;
-const int PROJECTILE_NADE_BURN = 72;
-const int PROJECTILE_NADE_NAPALM = 73;
-const int PROJECTILE_NADE_NAPALM_BURN = 74;
-const int PROJECTILE_NAPALM_FOUNTAIN = 75;
-const int PROJECTILE_NADE_ICE = 76;
-const int PROJECTILE_NADE_ICE_BURN = 77;
-const int PROJECTILE_NADE_TRANSLOCATE = 78;
-const int PROJECTILE_NADE_SPAWN = 79;
-const int PROJECTILE_NADE_HEAL = 80;
-const int PROJECTILE_NADE_HEAL_BURN = 81;
-const int PROJECTILE_NADE_MONSTER = 82;
-const int PROJECTILE_NADE_MONSTER_BURN = 83;
-
-void RegisterNades();
-const int NADES_MAX = 8;
-entity NADES[NADES_MAX], NADES_first, NADES_last;
-int NADES_COUNT;
-#define REGISTER_NADE(id) REGISTER(RegisterNades, NADE_TYPE, NADES, NADES_COUNT, id, m_id, NEW(Nade))
-REGISTER_REGISTRY(RegisterNades)
-
-CLASS(Nade, Object)
-    ATTRIB(Nade, m_id, int, 0)
-    ATTRIB(Nade, m_color, vector, '0 0 0')
-    ATTRIB(Nade, m_name, string, _("Grenade"))
-    ATTRIB(Nade, m_icon, string, "nade_normal")
-    ATTRIBARRAY(Nade, m_projectile, int, 2)
-    ATTRIBARRAY(Nade, m_trail, entity, 2)
-    METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
-        returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
-    }
-ENDCLASS(Nade)
-
-REGISTER_NADE(Null);
-
-#define NADE_PROJECTILE(i, projectile, trail) do { \
-    this.m_projectile[i] = projectile; \
-    this.m_trail[i] = trail; \
-} while (0)
-
-REGISTER_NADE(NORMAL) {
-    this.m_color = '1 1 1';
-    NADE_PROJECTILE(0, PROJECTILE_NADE, EFFECT_Null);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_BURN, EFFECT_Null);
-}
-
-REGISTER_NADE(NAPALM) {
-    this.m_color = '2 0.5 0';
-    this.m_name = _("Napalm grenade");
-    this.m_icon = "nade_napalm";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, EFFECT_TR_ROCKET);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, EFFECT_SPIDERBOT_ROCKET_TRAIL);
-}
-
-REGISTER_NADE(ICE) {
-    this.m_color = '0 0.5 2';
-    this.m_name = _("Ice grenade");
-    this.m_icon = "nade_ice";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, EFFECT_TR_NEXUIZPLASMA);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, EFFECT_RACER_ROCKET_TRAIL);
-}
-
-REGISTER_NADE(TRANSLOCATE) {
-    this.m_color = '1 0 1';
-    this.m_name = _("Translocate grenade");
-    this.m_icon = "nade_translocate";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
-}
-
-REGISTER_NADE(SPAWN) {
-    this.m_color = '1 0.9 0';
-    this.m_name = _("Spawn grenade");
-    this.m_icon = "nade_spawn";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
-}
-
-REGISTER_NADE(HEAL) {
-    this.m_color = '1 0 0';
-    this.m_name = _("Heal grenade");
-    this.m_icon = "nade_heal";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, EFFECT_NADE_TRAIL_RED);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, EFFECT_NADE_TRAIL_BURN_RED);
-}
-
-REGISTER_NADE(MONSTER) {
-    this.m_color = '0.25 0.75 0';
-    this.m_name = _("Monster grenade");
-    this.m_icon = "nade_monster";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, EFFECT_NADE_TRAIL_RED);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, EFFECT_NADE_TRAIL_BURN_RED);
-}
-
-entity Nade_FromProjectile(float proj)
-{
-    FOREACH(NADES, true, LAMBDA(
-        for (int j = 0; j < 2; j++)
-        {
-            if (it.m_projectile[j] == proj) return it;
-        }
-    ));
-    return NADE_TYPE_Null;
-}
-
-entity Nade_TrailEffect(int proj, int nade_team)
-{
-    switch (proj)
-    {
-        case PROJECTILE_NADE:       return EFFECT_NADE_TRAIL(nade_team);
-        case PROJECTILE_NADE_BURN:  return EFFECT_NADE_TRAIL_BURN(nade_team);
-    }
-
-    FOREACH(NADES, true, LAMBDA(
-        for (int j = 0; j < 2; j++)
-        {
-            if (it.m_projectile[j] == proj)
-            {
-                string trail = it.m_trail[j].eent_eff_name;
-                if (trail) return it.m_trail[j];
-                break;
-            }
-        }
-    ));
-
-    return EFFECT_Null;
-}
-
-#ifdef SVQC
-float healer_send(entity to, int sf);
-#endif
-
-#endif
diff --git a/qcsrc/common/nades/all.inc b/qcsrc/common/nades/all.inc
new file mode 100644 (file)
index 0000000..90326ed
--- /dev/null
@@ -0,0 +1,58 @@
+#define NADE_PROJECTILE(i, projectile, trail) do { \
+    this.m_projectile[i] = projectile; \
+    this.m_trail[i] = trail; \
+} while (0)
+
+REGISTER_NADE(NORMAL) {
+    this.m_color = '1 1 1';
+    NADE_PROJECTILE(0, PROJECTILE_NADE, EFFECT_Null);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_BURN, EFFECT_Null);
+}
+
+REGISTER_NADE(NAPALM) {
+    this.m_color = '2 0.5 0';
+    this.m_name = _("Napalm grenade");
+    this.m_icon = "nade_napalm";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, EFFECT_TR_ROCKET);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, EFFECT_SPIDERBOT_ROCKET_TRAIL);
+}
+
+REGISTER_NADE(ICE) {
+    this.m_color = '0 0.5 2';
+    this.m_name = _("Ice grenade");
+    this.m_icon = "nade_ice";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, EFFECT_TR_NEXUIZPLASMA);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, EFFECT_RACER_ROCKET_TRAIL);
+}
+
+REGISTER_NADE(TRANSLOCATE) {
+    this.m_color = '1 0 1';
+    this.m_name = _("Translocate grenade");
+    this.m_icon = "nade_translocate";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
+}
+
+REGISTER_NADE(SPAWN) {
+    this.m_color = '1 0.9 0';
+    this.m_name = _("Spawn grenade");
+    this.m_icon = "nade_spawn";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
+}
+
+REGISTER_NADE(HEAL) {
+    this.m_color = '1 0 0';
+    this.m_name = _("Heal grenade");
+    this.m_icon = "nade_heal";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, EFFECT_NADE_TRAIL_RED);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, EFFECT_NADE_TRAIL_BURN_RED);
+}
+
+REGISTER_NADE(MONSTER) {
+    this.m_color = '0.25 0.75 0';
+    this.m_name = _("Monster grenade");
+    this.m_icon = "nade_monster";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, EFFECT_NADE_TRAIL_RED);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, EFFECT_NADE_TRAIL_BURN_RED);
+}
diff --git a/qcsrc/common/nades/all.qc b/qcsrc/common/nades/all.qc
new file mode 100644 (file)
index 0000000..86e6d27
--- /dev/null
@@ -0,0 +1,91 @@
+#if defined(CSQC)
+       #include "../../dpdefs/csprogsdefs.qh"
+       #include "../../client/defs.qh"
+       #include "all.qh"
+       #include "../buffs/all.qh"
+       #include "../movetypes/movetypes.qh"
+       #include "../../client/main.qh"
+       #include "../../csqcmodellib/cl_model.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../constants.qh"
+    #include "../../server/constants.qh"
+       #include "../turrets/sv_turrets.qh"
+#endif
+
+
+#ifdef CSQC
+.float ltime;
+void healer_draw()
+{SELFPARAM();
+       float dt = time - self.move_time;
+       self.move_time = time;
+       if(dt <= 0)
+               return;
+
+       self.alpha = (self.ltime - time) / self.healer_lifetime;
+       self.scale = min((1 - self.alpha)*self.healer_lifetime*4,1)*self.healer_radius;
+}
+
+void healer_setup(entity e)
+{
+       setmodel(e, MDL_NADE_HEAL);
+
+       setorigin(e, e.origin);
+
+       float model_radius = e.maxs.x;
+       vector size = '1 1 1' * e.healer_radius / 2;
+       setsize(e,-size,size);
+       e.healer_radius = e.healer_radius/model_radius*0.6;
+
+       e.draw = healer_draw;
+       e.health = 255;
+       e.movetype = MOVETYPE_NONE;
+       e.solid = SOLID_NOT;
+       e.drawmask = MASK_NORMAL;
+       e.scale = 0.01;
+       e.avelocity = e.move_avelocity = '7 0 11';
+       e.colormod = '1 0 0';
+       e.renderflags |= RF_ADDITIVE;
+}
+#endif // CSQC
+
+REGISTER_LINKED(Nade_Heal, bool isNew)
+#ifdef CSQC
+{
+       int sf = ReadByte();
+       if (sf & 1) {
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
+               setorigin(this, this.origin);
+               this.healer_lifetime = ReadByte();
+               this.healer_radius = ReadShort();
+               this.ltime = time + ReadByte()/10.0;
+               // this.ltime = time + this.healer_lifetime;
+               healer_setup(this);
+       }
+}
+#endif
+
+#ifdef SVQC
+float healer_send(entity to, int sf)
+{
+       SELFPARAM();
+       WriteByte(MSG_ENTITY, Linked_Nade_Heal.m_id);
+       WriteByte(MSG_ENTITY, sf);
+       if (sf & 1) {
+               WriteCoord(MSG_ENTITY, this.origin.x);
+               WriteCoord(MSG_ENTITY, this.origin.y);
+               WriteCoord(MSG_ENTITY, this.origin.z);
+
+               WriteByte(MSG_ENTITY, this.healer_lifetime);
+               //WriteByte(MSG_ENTITY, this.ltime - time + 1);
+               WriteShort(MSG_ENTITY, this.healer_radius);
+               // round time delta to a 1/10th of a second
+               WriteByte(MSG_ENTITY, (this.ltime - time)*10.0+0.5);
+       }
+       return true;
+}
+#endif // SVQC
diff --git a/qcsrc/common/nades/all.qh b/qcsrc/common/nades/all.qh
new file mode 100644 (file)
index 0000000..f5a274d
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef NADES_ALL_H
+#define NADES_ALL_H
+
+#include "../teams.qh"
+
+.float healer_lifetime;
+.float healer_radius;
+
+// use slots 70-100
+const int PROJECTILE_NADE = 71;
+const int PROJECTILE_NADE_BURN = 72;
+const int PROJECTILE_NADE_NAPALM = 73;
+const int PROJECTILE_NADE_NAPALM_BURN = 74;
+const int PROJECTILE_NAPALM_FOUNTAIN = 75;
+const int PROJECTILE_NADE_ICE = 76;
+const int PROJECTILE_NADE_ICE_BURN = 77;
+const int PROJECTILE_NADE_TRANSLOCATE = 78;
+const int PROJECTILE_NADE_SPAWN = 79;
+const int PROJECTILE_NADE_HEAL = 80;
+const int PROJECTILE_NADE_HEAL_BURN = 81;
+const int PROJECTILE_NADE_MONSTER = 82;
+const int PROJECTILE_NADE_MONSTER_BURN = 83;
+
+REGISTRY(Nades, 8)
+REGISTER_REGISTRY(RegisterNades)
+#define REGISTER_NADE(id) REGISTER(RegisterNades, NADE_TYPE, Nades, Nades_COUNT, id, m_id, NEW(Nade))
+
+CLASS(Nade, Object)
+    ATTRIB(Nade, m_id, int, 0)
+    ATTRIB(Nade, m_color, vector, '0 0 0')
+    ATTRIB(Nade, m_name, string, _("Grenade"))
+    ATTRIB(Nade, m_icon, string, "nade_normal")
+    ATTRIBARRAY(Nade, m_projectile, int, 2)
+    ATTRIBARRAY(Nade, m_trail, entity, 2)
+    METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
+        returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
+    }
+ENDCLASS(Nade)
+
+REGISTER_NADE(Null);
+
+#ifdef SVQC
+float healer_send(entity to, int sf);
+#endif
+
+entity Nade_FromProjectile(float proj)
+{
+    FOREACH(Nades, true, LAMBDA(
+        for (int j = 0; j < 2; j++)
+        {
+            if (it.m_projectile[j] == proj) return it;
+        }
+    ));
+    return NADE_TYPE_Null;
+}
+
+entity Nade_TrailEffect(int proj, int nade_team)
+{
+    switch (proj)
+    {
+        case PROJECTILE_NADE:       return EFFECT_NADE_TRAIL(nade_team);
+        case PROJECTILE_NADE_BURN:  return EFFECT_NADE_TRAIL_BURN(nade_team);
+    }
+
+    FOREACH(Nades, true, LAMBDA(
+        for (int j = 0; j < 2; j++)
+        {
+            if (it.m_projectile[j] == proj)
+            {
+                string trail = it.m_trail[j].eent_eff_name;
+                if (trail) return it.m_trail[j];
+                break;
+            }
+        }
+    ));
+
+    return EFFECT_Null;
+}
+
+#include "all.inc"
+
+#endif
index f31bff4dc4df86e33044f62ac497f18639b04018..d4cebf9d7a172597fd8be264d1834effa6316ae9 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "gamemode_keyhunt.qh"
 #include "gamemode_freezetag.qh"
 
 #include "gamemode_keyhunt.qh"
 #include "gamemode_freezetag.qh"
-#include "../../common/nades.qh"
+#include "../../common/nades/all.qh"
 #include "../../common/monsters/spawn.qh"
 #include "../../common/monsters/sv_monsters.qh"
 
 #include "../../common/monsters/spawn.qh"
 #include "../../common/monsters/sv_monsters.qh"
 
@@ -23,7 +23,7 @@ void nade_timer_think()
 
 void nade_burn_spawn(entity _nade)
 {
 
 void nade_burn_spawn(entity _nade)
 {
-       CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[true], true);
+       CSQCProjectile(_nade, true, Nades[_nade.nade_type].m_projectile[true], true);
 }
 
 void nade_spawn(entity _nade)
 }
 
 void nade_spawn(entity _nade)
@@ -42,7 +42,7 @@ void nade_spawn(entity _nade)
 
        _nade.effects |= EF_LOWPRECISION;
 
 
        _nade.effects |= EF_LOWPRECISION;
 
-       CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[false], true);
+       CSQCProjectile(_nade, true, Nades[_nade.nade_type].m_projectile[false], true);
 }
 
 void napalm_damage(float dist, float damage, float edgedamage, float burntime)
 }
 
 void napalm_damage(float dist, float damage, float edgedamage, float burntime)
@@ -477,7 +477,7 @@ void nade_boom()
        entity expef = NULL;
        bool nade_blast = true;
 
        entity expef = NULL;
        bool nade_blast = true;
 
-       switch ( NADES[self.nade_type] )
+       switch ( Nades[self.nade_type] )
        {
                case NADE_TYPE_NAPALM:
                        nade_blast = autocvar_g_nades_napalm_blast;
        {
                case NADE_TYPE_NAPALM:
                        nade_blast = autocvar_g_nades_napalm_blast;
@@ -529,7 +529,7 @@ void nade_boom()
        }
 
        if(self.takedamage)
        }
 
        if(self.takedamage)
-       switch ( NADES[self.nade_type] )
+       switch ( Nades[self.nade_type] )
        {
                case NADE_TYPE_NAPALM: nade_napalm_boom(); break;
                case NADE_TYPE_ICE: nade_ice_boom(); break;
        {
                case NADE_TYPE_NAPALM: nade_napalm_boom(); break;
                case NADE_TYPE_ICE: nade_ice_boom(); break;
@@ -772,7 +772,7 @@ float nade_customize()
        {
                //self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
                if(!self.traileffectnum)
        {
                //self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
                if(!self.traileffectnum)
-                       self.traileffectnum = _particleeffectnum(Nade_TrailEffect(NADES[self.nade_type].m_projectile[false], self.team).eent_eff_name);
+                       self.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades[self.nade_type].m_projectile[false], self.team).eent_eff_name);
                self.alpha = 1;
        }
 
                self.alpha = 1;
        }
 
@@ -810,14 +810,14 @@ void nade_prime()
                n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
        }
 
                n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
        }
 
-       n.nade_type = bound(1, n.nade_type, NADES_COUNT);
+       n.nade_type = bound(1, n.nade_type, Nades_COUNT);
 
        setmodel(n, MDL_PROJECTILE_NADE);
        //setattachment(n, self, "bip01 l hand");
        n.exteriormodeltoclient = self;
        n.customizeentityforclient = nade_customize;
 
        setmodel(n, MDL_PROJECTILE_NADE);
        //setattachment(n, self, "bip01 l hand");
        n.exteriormodeltoclient = self;
        n.customizeentityforclient = nade_customize;
-       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(NADES[n.nade_type].m_projectile[false], self.team).eent_eff_name);
-       n.colormod = NADES[n.nade_type].m_color;
+       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades[n.nade_type].m_projectile[false], self.team).eent_eff_name);
+       n.colormod = Nades[n.nade_type].m_color;
        n.realowner = self;
        n.colormap = self.colormap;
        n.glowmod = self.glowmod;
        n.realowner = self;
        n.colormap = self.colormap;
        n.glowmod = self.glowmod;
@@ -830,7 +830,7 @@ void nade_prime()
        setmodel(fn, MDL_NADE_VIEW);
        setattachment(fn, self.weaponentity, "");
        fn.realowner = fn.owner = self;
        setmodel(fn, MDL_NADE_VIEW);
        setattachment(fn, self.weaponentity, "");
        fn.realowner = fn.owner = self;
-       fn.colormod = NADES[n.nade_type].m_color;
+       fn.colormod = Nades[n.nade_type].m_color;
        fn.colormap = self.colormap;
        fn.glowmod = self.glowmod;
        fn.think = SUB_Remove;
        fn.colormap = self.colormap;
        fn.glowmod = self.glowmod;
        fn.think = SUB_Remove;
@@ -993,7 +993,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
                                self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
                        }
 
                                self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
                        }
 
-                       self.nade_type = bound(1, self.nade_type, NADES_COUNT);
+                       self.nade_type = bound(1, self.nade_type, Nades_COUNT);
 
                        if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
                                nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);
 
                        if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
                                nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);
index 8b432d3bfc08be08b9f3a78fa7b3b63b1f3eaded..8564d34c59cb2a0b06e31df6bc93a78dd84f0d69 100644 (file)
@@ -11,7 +11,7 @@
     #include "../../common/stats.qh"
     #include "../../common/teams.qh"
     #include "../../common/util.qh"
     #include "../../common/stats.qh"
     #include "../../common/teams.qh"
     #include "../../common/util.qh"
-    #include "../../common/nades.qh"
+    #include "../../common/nades/all.qh"
     #include "../../common/buffs/all.qh"
     #include "../../common/command/markup.qh"
     #include "../../common/command/rpn.qh"
     #include "../../common/buffs/all.qh"
     #include "../../common/command/markup.qh"
     #include "../../common/command/rpn.qh"
index d9dec8f6f3925a5a50fe10547b74a3eefe3d83d0..adb8cf6323d643006c4c832e44ef7886c782b374 100644 (file)
@@ -89,7 +89,6 @@
 #include "../common/minigames/minigames.qc"
 #include "../common/minigames/sv_minigames.qc"
 #include "../common/movetypes/include.qc"
 #include "../common/minigames/minigames.qc"
 #include "../common/minigames/sv_minigames.qc"
 #include "../common/movetypes/include.qc"
-#include "../common/nades.qc"
 #include "../common/net_notice.qc"
 #include "../common/notifications.qc"
 #include "../common/physics.qc"
 #include "../common/net_notice.qc"
 #include "../common/notifications.qc"
 #include "../common/physics.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
+#include "../common/nades/all.qc"
 #include "../common/turrets/all.qc"
 #include "../common/vehicles/all.qc"
 #include "../common/weapons/all.qc"
 #include "../common/turrets/all.qc"
 #include "../common/vehicles/all.qc"
 #include "../common/weapons/all.qc"