]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_tuba.qc
De-stringify particle effects
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_tuba.qc
index 0b70b85729fe463d832bfc0b6e8edc0e5b211efe..686c89ec3a7f6f0dae6a0fe3ed8c0761735b6555 100644 (file)
@@ -1,4 +1,4 @@
-#ifdef REGISTER_WEAPON
+#ifndef IMPLEMENTATION
 REGISTER_WEAPON(
 /* WEP_##id  */ TUBA,
 /* function  */ W_Tuba,
@@ -51,11 +51,12 @@ float W_Tuba_MarkClientOnlyFieldsAsUsed() {
 .float tuba_lastnotes_cnt; // over
 .vector tuba_lastnotes[MAX_TUBANOTES];
 #endif
-#else
+#endif
+#ifdef IMPLEMENTATION
 #ifdef SVQC
-void spawnfunc_weapon_tuba(void) { weapon_defaultspawnfunc(WEP_TUBA); }
+void spawnfunc_weapon_tuba(void) { weapon_defaultspawnfunc(WEP_TUBA.m_id); }
 
-float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo)
+bool W_Tuba_HasPlayed(entity pl, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
 {
        float i, j, mmin, mmax, nolength;
        float n = tokenize_console(melody);
@@ -182,7 +183,7 @@ void W_Tuba_NoteOff(void)
        remove(self);
 }
 
-float W_Tuba_GetNote(entity pl, float hittype)
+int W_Tuba_GetNote(entity pl, int hittype)
 {
        float movestate = 5;
        if (pl.movement.x < 0)          movestate -= 3;
@@ -190,7 +191,7 @@ float W_Tuba_GetNote(entity pl, float hittype)
        if (pl.movement.y < 0)          movestate -= 1;
        else if (pl.movement.y > 0)     movestate += 1;
 
-       float note = 0;
+       int note = 0;
        switch(movestate)
        {
        // layout: originally I wanted
@@ -250,9 +251,9 @@ float W_Tuba_GetNote(entity pl, float hittype)
        return note;
 }
 
-float W_Tuba_NoteSendEntity(entity to, float sf)
+bool W_Tuba_NoteSendEntity(entity to, int sf)
 {
-       float f;
+       int f;
 
        msg_entity = to;
        if(!sound_allowed(MSG_ONE, self.realowner))
@@ -357,17 +358,17 @@ void W_Tuba_NoteOn(float hittype)
        self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(); // so it can get prolonged safely
 
        //sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation);
-       RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), world, world, WEP_CVAR(tuba, force), hittype | WEP_TUBA, world);
+       RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), world, world, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, world);
 
        o = gettaginfo(self.exteriorweaponentity, 0);
        if(time > self.tuba_smoketime)
        {
-               pointparticles(particleeffectnum("smoke_ring"), o + v_up * 45 + v_right * -6 + v_forward * 8, v_up * 100, 1);
+               Send_Effect(EFFECT_SMOKE_RING, o + v_up * 45 + v_right * -6 + v_forward * 8, v_up * 100, 1);
                self.tuba_smoketime = time + 0.25;
        }
 }
 
-float W_Tuba(float req)
+bool W_Tuba(int req)
 {
        switch(req)
        {
@@ -416,13 +417,13 @@ float W_Tuba(float req)
                }
                case WR_INIT:
                {
-                       precache_model("models/weapons/g_tuba.md3");
-                       precache_model("models/weapons/v_tuba.md3");
-                       precache_model("models/weapons/h_tuba.iqm");
-                       precache_model("models/weapons/v_akordeon.md3");
-                       precache_model("models/weapons/h_akordeon.iqm");
-                       precache_model("models/weapons/v_kleinbottle.md3");
-                       precache_model("models/weapons/h_kleinbottle.iqm");
+                       precache_model(W_Model("g_tuba.md3"));
+                       precache_model(W_Model("v_tuba.md3"));
+                       precache_model(W_Model("h_tuba.iqm"));
+                       precache_model(W_Model("v_akordeon.md3"));
+                       precache_model(W_Model("h_akordeon.iqm"));
+                       precache_model(W_Model("v_kleinbottle.md3"));
+                       precache_model(W_Model("h_kleinbottle.iqm"));
                        TUBA_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
                        return true;
                }
@@ -453,7 +454,7 @@ float W_Tuba(float req)
                                                break;
                                }
                                W_SetupShot(self, false, 0, "", 0, 0);
-                               pointparticles(particleeffectnum("teleport"), w_shotorg, '0 0 0', 1);
+                               Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
                                self.weaponentity.state = WS_INUSE;
                                weapon_thinkf(WFRAME_RELOAD, 0.5, w_ready);
                        }
@@ -493,7 +494,7 @@ float W_Tuba(float req)
 }
 #endif
 #ifdef CSQC
-float W_Tuba(float req)
+bool W_Tuba(int req)
 {
        // nothing to do here; particles of tuba are handled differently
        // WEAPONTODO