]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_vortex.qc
Merge branch 'master' into Mario/ctf_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_vortex.qc
index 43cbd4ef8fd17f07d14fd8bade6d507b33ab608c..374256403d88def7a6fde94d0526e3a51f3b98e8 100644 (file)
@@ -7,10 +7,12 @@ REGISTER_WEAPON(
 /* flags     */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN,
 /* rating    */ BOT_PICKUP_RATING_HIGH,
 /* color     */ '0.5 1 1',
-/* model     */ "nex",
+/* modelname */ "nex",
+/* simplemdl */ "foobar",
 /* crosshair */ "gfx/crosshairnex 0.65",
-/* netname   */ "nex",
-/* fullname  */ _("Vortex")
+/* wepimg    */ "weaponnex",
+/* refname   */ "vortex",
+/* wepname   */ _("Vortex")
 );
 
 #define VORTEX_SETTINGS(w_cvar,w_prop) VORTEX_SETTINGS_LIST(w_cvar, w_prop, VORTEX, vortex)
@@ -46,34 +48,35 @@ REGISTER_WEAPON(
        w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
        w_prop(id, sn, string, weaponreplace, weaponreplace) \
        w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride)
+       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
+       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
 
 #ifdef SVQC
 VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #else
 #ifdef SVQC
-void spawnfunc_weapon_vortex() { weapon_defaultspawnfunc(WEP_VORTEX); }
-void spawnfunc_weapon_nex() { spawnfunc_weapon_vortex(); }
+void spawnfunc_weapon_vortex(void) { weapon_defaultspawnfunc(WEP_VORTEX); }
+void spawnfunc_weapon_nex(void) { spawnfunc_weapon_vortex(); }
 
 void SendCSQCVortexBeamParticle(float charge) {
        vector v;
        v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
        WriteByte(MSG_BROADCAST, TE_CSQC_VORTEXBEAMPARTICLE);
-       WriteCoord(MSG_BROADCAST, w_shotorg_x);
-       WriteCoord(MSG_BROADCAST, w_shotorg_y);
-       WriteCoord(MSG_BROADCAST, w_shotorg_z);
-       WriteCoord(MSG_BROADCAST, v_x);
-       WriteCoord(MSG_BROADCAST, v_y);
-       WriteCoord(MSG_BROADCAST, v_z);
+       WriteCoord(MSG_BROADCAST, w_shotorg.x);
+       WriteCoord(MSG_BROADCAST, w_shotorg.y);
+       WriteCoord(MSG_BROADCAST, w_shotorg.z);
+       WriteCoord(MSG_BROADCAST, v.x);
+       WriteCoord(MSG_BROADCAST, v.y);
+       WriteCoord(MSG_BROADCAST, v.z);
        WriteByte(MSG_BROADCAST, bound(0, 255 * charge, 255));
 }
 
-void W_Vortex_Attack (float issecondary)
+void W_Vortex_Attack(float issecondary)
 {
        float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
-       
+
        mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage);
        myforce = WEP_CVAR_BOTH(vortex, !issecondary, force);
        mymindist = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_mindist);
@@ -97,17 +100,17 @@ void W_Vortex_Attack (float issecondary)
        mydmg *= charge;
        myforce *= charge;
 
-       W_SetupShot (self, TRUE, 5, "weapons/nexfire.wav", CH_WEAPON_A, mydmg);
+       W_SetupShot(self, true, 5, "weapons/nexfire.wav", CH_WEAPON_A, mydmg);
        if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound
        {
-               sound (self, CH_WEAPON_B, "weapons/nexcharge.wav", VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM);
+               sound(self, CH_WEAPON_B, "weapons/nexcharge.wav", VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM);
        }
 
        yoda = 0;
-       FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX);
+       FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX);
 
        if(yoda && flying)
-               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); 
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
 
        //beam and muzzle flash done on client
        SendCSQCVortexBeamParticle(charge);
@@ -115,7 +118,7 @@ void W_Vortex_Attack (float issecondary)
        W_DecreaseAmmo(myammo);
 }
 
-void spawnfunc_weapon_vortex (void); // defined in t_items.qc
+void spawnfunc_weapon_vortex(void); // defined in t_items.qc
 
 .float vortex_chargepool_pauseregen_finished;
 float W_Vortex(float req)
@@ -126,20 +129,20 @@ float W_Vortex(float req)
        {
                case WR_AIM:
                {
-                       if(bot_aim(1000000, 0, 1, FALSE))
-                               self.BUTTON_ATCK = TRUE;
+                       if(bot_aim(1000000, 0, 1, false))
+                               self.BUTTON_ATCK = true;
                        else
                        {
                                if(WEP_CVAR(vortex, charge))
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_THINK:
                {
                        if(WEP_CVAR(vortex, charge) && self.vortex_charge < WEP_CVAR(vortex, charge_limit))
                                self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
-                               
+
                        if(WEP_CVAR_SEC(vortex, chargepool))
                                if(self.vortex_chargepool_ammo < 1)
                                {
@@ -152,15 +155,15 @@ float W_Vortex(float req)
                                WEP_ACTION(self.weapon, WR_RELOAD);
                        else
                        {
-                               if (self.BUTTON_ATCK)
+                               if(self.BUTTON_ATCK)
                                {
-                                       if (weapon_prepareattack(0, WEP_CVAR_PRI(vortex, refire)))
+                                       if(weapon_prepareattack(0, WEP_CVAR_PRI(vortex, refire)))
                                        {
                                                W_Vortex_Attack(0);
                                                weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
                                        }
                                }
-                               if ((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) : self.BUTTON_ATCK2)
+                               if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) : self.BUTTON_ATCK2)
                                {
                                        if(WEP_CVAR(vortex, charge))
                                        {
@@ -226,7 +229,7 @@ float W_Vortex(float req)
                                        }
                                        else if(WEP_CVAR(vortex, secondary))
                                        {
-                                               if (weapon_prepareattack(0, WEP_CVAR_SEC(vortex, refire)))
+                                               if(weapon_prepareattack(0, WEP_CVAR_SEC(vortex, refire)))
                                                {
                                                        W_Vortex_Attack(1);
                                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
@@ -234,22 +237,22 @@ float W_Vortex(float req)
                                        }
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
-                       precache_model ("models/nexflash.md3");
-                       precache_model ("models/weapons/g_nex.md3");
-                       precache_model ("models/weapons/v_nex.md3");
-                       precache_model ("models/weapons/h_nex.iqm");
-                       precache_sound ("weapons/nexfire.wav");
-                       precache_sound ("weapons/nexcharge.wav");
-                       precache_sound ("weapons/nexwhoosh1.wav");
-                       precache_sound ("weapons/nexwhoosh2.wav");
-                       precache_sound ("weapons/nexwhoosh3.wav");
-                       VORTEX_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
-                       return TRUE;
+                       precache_model("models/nexflash.md3");
+                       precache_model("models/weapons/g_nex.md3");
+                       precache_model("models/weapons/v_nex.md3");
+                       precache_model("models/weapons/h_nex.iqm");
+                       precache_sound("weapons/nexfire.wav");
+                       precache_sound("weapons/nexcharge.wav");
+                       precache_sound("weapons/nexwhoosh1.wav");
+                       precache_sound("weapons/nexwhoosh2.wav");
+                       precache_sound("weapons/nexwhoosh3.wav");
+                       VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -268,18 +271,18 @@ float W_Vortex(float req)
                        }
                        else
                        {
-                               return FALSE; // zoom is not a fire mode
+                               return false; // zoom is not a fire mode
                        }
                }
                case WR_CONFIG:
                {
-                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -290,11 +293,11 @@ float W_Vortex(float req)
                        return WEAPON_VORTEX_MURDER;
                }
        }
-       return TRUE;
+       return false;
 }
 #endif
 #ifdef CSQC
-var float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
+float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
 float W_Vortex(float req)
 {
        switch(req)
@@ -306,8 +309,8 @@ float W_Vortex(float req)
                        pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -316,23 +319,23 @@ float W_Vortex(float req)
                        {
                                precache_pic("gfx/reticle_nex");
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
                        {
                                reticle_image = "gfx/reticle_nex";
-                               return TRUE;
+                               return true;
                        }
                        else
                        {
                                // no weapon specific image for this weapon
-                               return FALSE;
+                               return false;
                        }
                }
        }
-       return TRUE;
+       return false;
 }
 #endif
 #endif