]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_blaster.qc
Merge branch 'master' into Mario/vaporizer_damage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_blaster.qc
index 6a9d2a764ad1e8ffe7256b6688035b2133c6f8ee..8eaff86e35241899d5a760600f858b451e1c11f6 100644 (file)
@@ -1,15 +1,18 @@
 #ifdef REGISTER_WEAPON
 REGISTER_WEAPON(
-/* WEP_##id */ BLASTER,
-/* function */ W_Blaster,
-/* ammotype */ ammo_none,
-/* impulse  */ 1,
-/* flags    */ WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH,
-/* rating   */ 0,
-/* color       */ '1 0.5 0.5',
-/* model    */ "laser",
-/* netname  */ "laser",
-/* fullname */ _("Blaster")
+/* WEP_##id  */ BLASTER,
+/* function  */ W_Blaster,
+/* ammotype  */ ammo_none,
+/* impulse   */ 1,
+/* flags     */ WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH,
+/* rating    */ 0,
+/* color     */ '1 0.5 0.5',
+/* modelname */ "laser",
+/* simplemdl */ "foobar",
+/* crosshair */ "gfx/crosshairlaser 0.5",
+/* wepimg    */ "weaponlaser",
+/* refname   */ "blaster",
+/* wepname   */ _("Blaster")
 );
 
 #define BLASTER_SETTINGS(w_cvar,w_prop) BLASTER_SETTINGS_LIST(w_cvar, w_prop, BLASTER, blaster)
@@ -19,6 +22,7 @@ REGISTER_WEAPON(
        w_cvar(id, sn, BOTH, delay) \
        w_cvar(id, sn, BOTH, edgedamage) \
        w_cvar(id, sn, BOTH, force) \
+       w_cvar(id, sn, BOTH, force_zscale) \
        w_cvar(id, sn, BOTH, lifetime) \
        w_cvar(id, sn, BOTH, radius) \
        w_cvar(id, sn, BOTH, refire) \
@@ -30,7 +34,8 @@ 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
 BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
@@ -42,10 +47,10 @@ BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #else
 #ifdef SVQC
-void spawnfunc_weapon_blaster() { weapon_defaultspawnfunc(WEP_BLASTER); }
-void spawnfunc_weapon_laser() { spawnfunc_weapon_blaster(); }
+void spawnfunc_weapon_blaster(void) { weapon_defaultspawnfunc(WEP_BLASTER); }
+void spawnfunc_weapon_laser(void) { spawnfunc_weapon_blaster(); }
 
-void W_Blaster_Touch()
+void W_Blaster_Touch(void)
 {
        PROJECTILE_TOUCH;
 
@@ -63,19 +68,20 @@ void W_Blaster_Touch()
                self.projectiledeathtype,
                other
        );
-       
+
        remove(self);
 }
 
-void W_Blaster_Think()
+void W_Blaster_Think(void)
 {
        self.movetype = MOVETYPE_FLY;
        self.think = SUB_Remove;
        self.nextthink = time + self.blaster_lifetime;
-       CSQCProjectile(self, TRUE, PROJECTILE_BLASTER, TRUE);
+       CSQCProjectile(self, true, PROJECTILE_BLASTER, true);
 }
 
 void W_Blaster_Attack(
+       float atk_deathtype,
        float atk_shotangle,
        float atk_damage,
        float atk_edgedamage,
@@ -88,13 +94,13 @@ void W_Blaster_Attack(
 {
        vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
 
-       W_SetupShot_Dir(self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, atk_damage);
+       W_SetupShot_Dir(self, s_forward, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, atk_damage);
        pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        entity missile = spawn();
        missile.owner = missile.realowner = self;
        missile.classname = "blasterbolt";
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
        missile.bot_dodgerating = atk_damage;
        PROJECTILE_MAKETRIGGER(missile);
 
@@ -106,7 +112,7 @@ void W_Blaster_Attack(
 
        setorigin(missile, w_shotorg);
        setsize(missile, '0 0 0', '0 0 0');
-       
+
        W_SetupProjVelocity_Explicit(
                missile,
                w_shotdir,
@@ -115,18 +121,18 @@ void W_Blaster_Attack(
                0,
                0,
                atk_spread,
-               FALSE
+               false
        );
-       
+
        missile.angles = vectoangles(missile.velocity);
-       
+
        //missile.glow_color = 250; // 244, 250
        //missile.glow_size = 120;
 
        missile.touch = W_Blaster_Touch;
        missile.flags = FL_PROJECTILE;
        missile.missile_flags = MIF_SPLASH;
-       missile.projectiledeathtype = WEP_BLASTER; 
+       missile.projectiledeathtype = atk_deathtype;
        missile.think = W_Blaster_Think;
        missile.nextthink = time + atk_delay;
 
@@ -150,16 +156,16 @@ float W_Blaster(float request)
                        if(WEP_CVAR(blaster, secondary))
                        {
                                if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
-                                       { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), FALSE); }
+                                       { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
                                else
-                                       { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
+                                       { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
                        }
                        else
-                               { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
+                               { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
 
-                       return TRUE;
+                       return true;
                }
-               
+
                case WR_THINK:
                {
                        if(self.BUTTON_ATCK)
@@ -167,6 +173,7 @@ float W_Blaster(float request)
                                if(weapon_prepareattack(0, WEP_CVAR_PRI(blaster, refire)))
                                {
                                        W_Blaster_Attack(
+                                               WEP_BLASTER,
                                                WEP_CVAR_PRI(blaster, shotangle),
                                                WEP_CVAR_PRI(blaster, damage),
                                                WEP_CVAR_PRI(blaster, edgedamage),
@@ -196,6 +203,7 @@ float W_Blaster(float request)
                                                if(weapon_prepareattack(1, WEP_CVAR_SEC(blaster, refire)))
                                                {
                                                        W_Blaster_Attack(
+                                                               WEP_BLASTER | HITTYPE_SECONDARY,
                                                                WEP_CVAR_SEC(blaster, shotangle),
                                                                WEP_CVAR_SEC(blaster, damage),
                                                                WEP_CVAR_SEC(blaster, edgedamage),
@@ -213,49 +221,48 @@ float W_Blaster(float request)
                                        }
                                }
                        }
-                       return TRUE;
+                       return true;
                }
-               
-               case WR_INIT: 
+
+               case WR_INIT:
                {
                        precache_model("models/weapons/g_laser.md3");
                        precache_model("models/weapons/v_laser.md3");
                        precache_model("models/weapons/h_laser.iqm");
                        precache_sound("weapons/lasergun_fire.wav");
-                       BLASTER_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
-                       return TRUE;
+                       BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
-               
+
                case WR_SETUP:
                {
-                       self.current_ammo = ammo_none;
-                       return TRUE;
+                       self.ammo_field = ammo_none;
+                       return true;
                }
-               
+
                case WR_CHECKAMMO1:
                case WR_CHECKAMMO2:
                {
-                       return TRUE; // laser has infinite ammo
+                       return true; // laser has infinite ammo
                }
-               
+
                case WR_CONFIG:
                {
-                       BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
-               
+
                case WR_SUICIDEMESSAGE:
                {
-                       return WEAPON_LASER_SUICIDE;
+                       return WEAPON_BLASTER_SUICIDE;
                }
-               
+
                case WR_KILLMESSAGE:
                {
-                       return WEAPON_LASER_MURDER;
+                       return WEAPON_BLASTER_MURDER;
                }
        }
-       
-       return TRUE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -267,19 +274,23 @@ float W_Blaster(float request)
                {
                        vector org2;
                        org2 = w_org + w_backoff * 6;
-                       pointparticles(particleeffectnum("new_laser_impact"), org2, w_backoff * 1000, 1);
+                       pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
                        if(!w_issilent) { sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); }
-                       return TRUE;
+                       return true;
                }
-               
+
                case WR_INIT:
                {
                        precache_sound("weapons/laserimpact.wav");
-                       return TRUE;
+                       return true;
+               }
+               case WR_ZOOMRETICLE:
+               {
+                       // no weapon specific image for this weapon
+                       return false;
                }
        }
-       
-       return TRUE;
+       return false;
 }
 #endif
 #endif