X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fw_minstanex.qc;h=47ed37d200d9a844ba2af50eac44926186459338;hb=b248903644a10e3a06ad01b90c2e433c4ba90163;hp=37d9b8efe7424b533d159819bf41f5e1b1772c84;hpb=394e6c70155ab9f4ed18ea95de5b04d586dddaef;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/w_minstanex.qc b/qcsrc/common/weapons/w_minstanex.qc index 37d9b8efe..47ed37d20 100644 --- a/qcsrc/common/weapons/w_minstanex.qc +++ b/qcsrc/common/weapons/w_minstanex.qc @@ -2,25 +2,48 @@ REGISTER_WEAPON( /* WEP_##id */ MINSTANEX, /* function */ w_minstanex, -/* ammotype */ IT_CELLS, +/* ammotype */ ammo_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") +/* fullname */ _("Vaporizer") ); +#define MINSTANEX_SETTINGS(w_cvar,w_prop) MINSTANEX_SETTINGS_LIST(w_cvar, w_prop, MINSTANEX, minstanex) +#define MINSTANEX_SETTINGS_LIST(w_cvar,w_prop,id,sn) \ + w_cvar(id, sn, PRI, ammo) \ + w_cvar(id, sn, PRI, animtime) \ + w_cvar(id, sn, PRI, refire) \ + w_cvar(id, sn, SEC, ammo) \ + w_cvar(id, sn, SEC, animtime) \ + w_cvar(id, sn, SEC, damage) \ + w_cvar(id, sn, SEC, delay) \ + w_cvar(id, sn, SEC, edgedamage) \ + w_cvar(id, sn, SEC, force) \ + w_cvar(id, sn, SEC, lifetime) \ + w_cvar(id, sn, SEC, radius) \ + w_cvar(id, sn, SEC, refire) \ + w_cvar(id, sn, SEC, shotangle) \ + w_cvar(id, sn, SEC, speed) \ + w_cvar(id, sn, SEC, spread) \ + w_prop(id, sn, float, reloading_ammo, reload_ammo) \ + w_prop(id, sn, float, reloading_time, reload_time) \ + w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \ + 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) + #ifdef SVQC -void spawnfunc_weapon_minstanex (void) -{ - weapon_defaultspawnfunc(WEP_MINSTANEX); -} +MINSTANEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) +.float minstanex_lasthit; +.float jump_interval; #endif #else #ifdef SVQC -.float minstanex_lasthit; -.float jump_interval; +void spawnfunc_weapon_minstanex (void) { weapon_defaultspawnfunc(WEP_MINSTANEX); } void W_MinstaNex_Attack (void) { @@ -82,7 +105,7 @@ 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(((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo))); } float w_minstanex(float req) @@ -91,32 +114,32 @@ float w_minstanex(float req) 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)); switch(req) { case WR_AIM: { - if(self.ammo_cells > 0) + if(self.AMMO_VAL(WEP_MINSTANEX) > 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); + 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; } case WR_THINK: { // 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 + 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(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced 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) { - if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire)) + if (weapon_prepareattack(0, WEP_CVAR_PRI(minstanex, refire))) { W_MinstaNex_Attack(); - weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready); + weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(minstanex, animtime), w_ready); } } else if (self.BUTTON_ATCK2) @@ -125,21 +148,31 @@ float w_minstanex(float req) 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 + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor(); + self.jump_interval = time + WEP_CVAR_SEC(minstanex, 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(WEP_CVAR_SEC(minstanex, ammo)) + W_DecreaseAmmo(WEP_CVAR_SEC(minstanex, 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 = 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, autocvar_g_balance_minstanex_laser_animtime, w_ready); + weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(minstanex, animtime), w_ready); } } @@ -147,37 +180,43 @@ float w_minstanex(float req) } 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_Laser(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; } case WR_SETUP: { - self.current_ammo = ammo_cells; + self.current_ammo = AMMO_VAL(WEP_MINSTANEX); self.minstanex_lasthit = 0; return TRUE; } case WR_CHECKAMMO1: { - ammo_amount = self.ammo_cells >= minstanex_ammo; + ammo_amount = self.AMMO_VAL(WEP_MINSTANEX) >= minstanex_ammo; ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo; return ammo_amount; } case WR_CHECKAMMO2: { - if(!autocvar_g_balance_minstanex_laser_ammo) + if(!WEP_CVAR_SEC(minstanex, ammo)) 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; + ammo_amount = self.AMMO_VAL(WEP_MINSTANEX) >= 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; @@ -186,12 +225,12 @@ float w_minstanex(float req) case WR_RELOAD: { float used_ammo; - if(autocvar_g_balance_minstanex_laser_ammo) - used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_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"); + W_Reload(used_ammo, "weapons/reload.wav"); return TRUE; } case WR_SUICIDEMESSAGE: