]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/nades.qc
Buffs: rename registry globals
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / nades.qc
index f361730ba16b29f5a9fe150e6272586e74afe0b3..a6b00002591704fa1c8ad3bf42bc52b990ca0edc 100644 (file)
@@ -2,7 +2,7 @@
        #include "../dpdefs/csprogsdefs.qh"
        #include "../client/defs.qh"
        #include "nades.qh"
-       #include "buffs.qh"
+       #include "buffs/all.qh"
        #include "../common/movetypes/movetypes.qh"
        #include "../client/main.qh"
        #include "../csqcmodellib/cl_model.qh"
 #endif
 
 
-#ifdef SVQC
-float healer_send(entity to, int sf)
-{SELFPARAM();
-       WriteByte(MSG_ENTITY, ENT_CLIENT_HEALING_ORB);
-       WriteByte(MSG_ENTITY, sf);
-
-       if(sf & 1)
-       {
-               WriteCoord(MSG_ENTITY, self.origin.x);
-               WriteCoord(MSG_ENTITY, self.origin.y);
-               WriteCoord(MSG_ENTITY, self.origin.z);
-
-               WriteByte(MSG_ENTITY, self.healer_lifetime);
-               //WriteByte(MSG_ENTITY, self.ltime - time + 1);
-               WriteShort(MSG_ENTITY, self.healer_radius);
-               // round time delta to a 1/10th of a second
-               WriteByte(MSG_ENTITY, (self.ltime - time)*10.0+0.5);
-       }
-
-       return true;
-}
-#endif // SVQC
-
 #ifdef CSQC
 .float ltime;
 void healer_draw()
@@ -49,48 +26,66 @@ void healer_draw()
 
        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()
-{SELFPARAM();
-       setmodel(self, MDL_NADE_HEAL);
-
-       setorigin(self, self.origin);
-
-       float model_radius = self.maxs.x;
-       vector size = '1 1 1' * self.healer_radius / 2;
-       setsize(self,-size,size);
-       self.healer_radius = self.healer_radius/model_radius*0.6;
-
-       self.draw = healer_draw;
-       self.health = 255;
-       self.movetype = MOVETYPE_NONE;
-       self.solid = SOLID_NOT;
-       self.drawmask = MASK_NORMAL;
-       self.scale = 0.01;
-       self.avelocity = self.move_avelocity = '7 0 11';
-       self.colormod = '1 0 0';
-       self.renderflags |= RF_ADDITIVE;
+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
 
-void ent_healer()
-{SELFPARAM();
+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
 
-       if(sf & TNSF_SETUP)
-       {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
-               setorigin(self, self.origin);
-
-               self.healer_lifetime = ReadByte();
-               self.healer_radius = ReadShort();
-               self.ltime = time + ReadByte()/10.0;
-               //self.ltime = time + self.healer_lifetime;
-
-               healer_setup();
+#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 // CSQC
+#endif // SVQC