X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fw_minstanex.qc;h=d9e3cd15811f72a4b407ddc27e849bec4e56bd2a;hb=7c734de31c85ae5fe1028b9a0c358f1c53fa7351;hp=2abb668752d9e155a09ac0e5eab0c459ead37841;hpb=d22c6120af8d0f5e794bde4c4c68a76ad23e3445;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/w_minstanex.qc b/qcsrc/common/weapons/w_minstanex.qc index 2abb66875..d9e3cd158 100644 --- a/qcsrc/common/weapons/w_minstanex.qc +++ b/qcsrc/common/weapons/w_minstanex.qc @@ -1,19 +1,45 @@ #ifdef REGISTER_WEAPON REGISTER_WEAPON( -/* WEP_##id */ MINSTANEX, -/* function */ w_minstanex, -/* ammotype */ IT_CELLS, -/* impulse */ 7, -/* flags */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN, -/* rating */ BOT_PICKUP_RATING_HIGH, -/* model */ "minstanex", -/* shortname */ "minstanex", -/* fullname */ _("MinstaNex") +/* WEP_##id */ MINSTANEX, +/* function */ w_minstanex, +/* ammotype */ IT_CELLS, +/* impulse */ 7, +/* flags */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN, +/* rating */ BOT_PICKUP_RATING_HIGH, +/* model */ "minstanex", +/* netname */ "minstanex", +/* fullname */ _("MinstaNex") ); -#else + +#define MINSTANEX_SETTINGS(w_cvar,w_prop) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, ammo) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, animtime) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, refire) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, ammo) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, animtime) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, damage) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, delay) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, edgedamage) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, force) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, lifetime) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, radius) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, refire) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, shotangle) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, speed) \ + w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, spread) \ + w_prop(WEP_MINSTANEX, minstanex, reloading_ammo, reload_ammo) \ + w_prop(WEP_MINSTANEX, minstanex, reloading_time, reload_time) \ + w_prop(WEP_MINSTANEX, minstanex, switchdelay_raise, switchdelay_raise) \ + w_prop(WEP_MINSTANEX, minstanex, switchdelay_drop, switchdelay_drop) + #ifdef SVQC +MINSTANEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) .float minstanex_lasthit; .float jump_interval; +#endif +#else +#ifdef SVQC +void spawnfunc_weapon_minstanex (void) { weapon_defaultspawnfunc(WEP_MINSTANEX); } void W_MinstaNex_Attack (void) { @@ -75,119 +101,142 @@ void W_MinstaNex_Attack (void) break; } - W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo), autocvar_g_balance_minstanex_reload_ammo); + W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)), WEP_CVAR(minstanex, reload_ammo)); } -void spawnfunc_weapon_minstanex (void); // defined in t_items.qc - float w_minstanex(float req) { float ammo_amount; float minstanex_ammo; // now multiple WR_s use this - minstanex_ammo = ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo); + minstanex_ammo = ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)); - if (req == WR_AIM) - { - if(self.ammo_cells > 0) - self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE); - else - self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE); - } - else if (req == WR_THINK) + switch(req) { - // if the laser uses load, we also consider its ammo for reloading - if(autocvar_g_balance_minstanex_reload_ammo && autocvar_g_balance_minstanex_laser_ammo && self.clip_load < min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo)) // forced reload - weapon_action(self.weapon, WR_RELOAD); - else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload - weapon_action(self.weapon, WR_RELOAD); - else if (self.BUTTON_ATCK) + case WR_AIM: { - if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire)) - { - W_MinstaNex_Attack(); - weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready); - } + if(self.ammo_cells > 0) + self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE); + else + self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(minstanex, speed), 0, WEP_CVAR_SEC(minstanex, lifetime), FALSE); // WEAPONTODO: replace with proper minstanex cvars + + return TRUE; } - else if (self.BUTTON_ATCK2) + case WR_THINK: { - if (self.jump_interval <= time) - if (weapon_prepareattack(1, -1)) + // if the laser uses load, we also consider its ammo for reloading + if(WEP_CVAR(minstanex, reload_ammo) && WEP_CVAR_SEC(minstanex, ammo) && self.clip_load < min(minstanex_ammo, WEP_CVAR_SEC(minstanex, ammo))) // forced reload + WEP_ACTION(self.weapon, WR_RELOAD); + else if(WEP_CVAR(minstanex, reload_ammo) && self.clip_load < minstanex_ammo) // forced reload + WEP_ACTION(self.weapon, WR_RELOAD); + else if (self.BUTTON_ATCK) { - // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib) - self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor(); - - // decrease ammo for the laser? - if(autocvar_g_balance_minstanex_laser_ammo) - W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo); + if (weapon_prepareattack(0, WEP_CVAR_PRI(minstanex, refire))) + { + W_MinstaNex_Attack(); + weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(minstanex, animtime), w_ready); + } + } + else if (self.BUTTON_ATCK2) + { + if (self.jump_interval <= time) + if (weapon_prepareattack(1, -1)) + { + // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib) + self.jump_interval = time + WEP_CVAR_SEC(minstanex, refire) * W_WeaponRateFactor(); + + // decrease ammo for the laser? + if(WEP_CVAR_SEC(minstanex, ammo)) + W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(minstanex, ammo), WEP_CVAR(minstanex, reload_ammo)); - // ugly minstagib hack to reuse the fire mode of the laser - float w; - w = self.weapon; - self.weapon = WEP_LASER; - W_Laser_Shockwave(); - self.weapon = w; - - // now do normal refire - weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready); + // ugly minstagib hack to reuse the fire mode of the laser + float w; + w = self.weapon; + self.weapon = WEP_BLASTER; + W_Blaster_Attack( + WEP_CVAR_SEC(minstanex, shotangle), + WEP_CVAR_SEC(minstanex, damage), + WEP_CVAR_SEC(minstanex, edgedamage), + WEP_CVAR_SEC(minstanex, radius), + WEP_CVAR_SEC(minstanex, force), + WEP_CVAR_SEC(minstanex, speed), + WEP_CVAR_SEC(minstanex, spread), + WEP_CVAR_SEC(minstanex, delay), + WEP_CVAR_SEC(minstanex, lifetime) + ); + self.weapon = w; + + // now do normal refire + weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(minstanex, animtime), w_ready); + } } + + return TRUE; } - } - else if (req == WR_PRECACHE) - { - precache_model ("models/nexflash.md3"); - precache_model ("models/weapons/g_minstanex.md3"); - precache_model ("models/weapons/v_minstanex.md3"); - precache_model ("models/weapons/h_minstanex.iqm"); - precache_sound ("weapons/minstanexfire.wav"); - precache_sound ("weapons/nexwhoosh1.wav"); - precache_sound ("weapons/nexwhoosh2.wav"); - precache_sound ("weapons/nexwhoosh3.wav"); - //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else - W_Laser(WR_PRECACHE); - } - else if (req == WR_SETUP) - { - weapon_setup(WEP_MINSTANEX); - self.current_ammo = ammo_cells; - self.minstanex_lasthit = 0; - } - else if (req == WR_CHECKAMMO1) - { - ammo_amount = self.ammo_cells >= minstanex_ammo; - ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo; - return ammo_amount; - } - else if (req == WR_CHECKAMMO2) - { - if(!autocvar_g_balance_minstanex_laser_ammo) + case WR_INIT: + { + precache_model("models/nexflash.md3"); + precache_model("models/weapons/g_minstanex.md3"); + precache_model("models/weapons/v_minstanex.md3"); + precache_model("models/weapons/h_minstanex.iqm"); + precache_sound("weapons/minstanexfire.wav"); + precache_sound("weapons/nexwhoosh1.wav"); + precache_sound("weapons/nexwhoosh2.wav"); + precache_sound("weapons/nexwhoosh3.wav"); + //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously? + MINSTANEX_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP) return TRUE; - ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo; - ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo; - return ammo_amount; - } - else if (req == WR_RESETPLAYER) - { - self.minstanex_lasthit = 0; - } - else if (req == WR_RELOAD) - { - float used_ammo; - if(autocvar_g_balance_minstanex_laser_ammo) - used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo); - else - used_ammo = minstanex_ammo; + } + case WR_SETUP: + { + self.current_ammo = ammo_cells; + self.minstanex_lasthit = 0; + return TRUE; + } + case WR_CHECKAMMO1: + { + ammo_amount = self.ammo_cells >= minstanex_ammo; + ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo; + return ammo_amount; + } + case WR_CHECKAMMO2: + { + if(!WEP_CVAR_SEC(minstanex, ammo)) + return TRUE; + ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(minstanex, ammo); + ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= WEP_CVAR_SEC(minstanex, ammo); + return ammo_amount; + } + case WR_CONFIG: + { + MINSTANEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS) + return TRUE; + } + case WR_RESETPLAYER: + { + self.minstanex_lasthit = 0; + return TRUE; + } + case WR_RELOAD: + { + float used_ammo; + if(WEP_CVAR_SEC(minstanex, ammo)) + used_ammo = min(minstanex_ammo, WEP_CVAR_SEC(minstanex, ammo)); + else + used_ammo = minstanex_ammo; - W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav"); - } - else if (req == WR_SUICIDEMESSAGE) - { - return WEAPON_THINKING_WITH_PORTALS; - } - else if (req == WR_KILLMESSAGE) - { - return WEAPON_MINSTANEX_MURDER; + W_Reload(used_ammo, "weapons/reload.wav"); + return TRUE; + } + case WR_SUICIDEMESSAGE: + { + return WEAPON_THINKING_WITH_PORTALS; + } + case WR_KILLMESSAGE: + { + return WEAPON_MINSTANEX_MURDER; + } } return TRUE; } @@ -195,17 +244,23 @@ float w_minstanex(float req) #ifdef CSQC float w_minstanex(float req) { - if(req == WR_IMPACTEFFECT) - { - vector org2; - org2 = w_org + w_backoff * 6; - pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1); - if(!w_issilent) - sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM); - } - else if(req == WR_PRECACHE) + switch(req) { - precache_sound("weapons/neximpact.wav"); + case WR_IMPACTEFFECT: + { + vector org2; + org2 = w_org + w_backoff * 6; + 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; + } + case WR_INIT: + { + precache_sound("weapons/neximpact.wav"); + return TRUE; + } } return TRUE; }