#ifdef REGISTER_WEAPON
-REGISTER_WEAPON(ROCKET_LAUNCHER, w_rlauncher, IT_ROCKETS, 9, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "rl", "rocketlauncher", _("Rocket Launcher"))
+REGISTER_WEAPON(ROCKET_LAUNCHER, w_rlauncher, IT_ROCKETS, 9, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "rl", "rocketlauncher", _("Rocket Launcher"))
#else
#ifdef SVQC
.float rl_release;
.float rl_detonate_later;
-// weapon load persistence, for weapons that support reloading
-.float rocketlauncher_load;
-
-void W_RocketLauncher_SetAmmoCounter()
-{
- // set clip_load to the weapon we have switched to, if the gun uses reloading
- if(!autocvar_g_balance_rocketlauncher_reload_ammo)
- self.clip_load = 0; // also keeps crosshair ammo from displaying
- else
- {
- self.clip_load = self.rocketlauncher_load;
- self.clip_size = autocvar_g_balance_rocketlauncher_reload_ammo; // for the crosshair ammo display
- }
-}
-
-void W_RocketLauncher_ReloadedAndReady()
-{
- float t;
-
- // now do the ammo transfer
- self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
- while(self.clip_load < autocvar_g_balance_rocketlauncher_reload_ammo && self.ammo_rockets) // make sure we don't add more ammo than we have
- {
- self.clip_load += 1;
- self.ammo_rockets -= 1;
- }
- self.rocketlauncher_load = self.clip_load;
-
- t = ATTACK_FINISHED(self) - autocvar_g_balance_rocketlauncher_reload_time - 1;
- ATTACK_FINISHED(self) = t;
- w_ready();
-}
-
-void W_RocketLauncher_Reload()
-{
- // return if reloading is disabled for this weapon
- if(!autocvar_g_balance_rocketlauncher_reload_ammo)
- return;
-
- if(!W_ReloadCheck(self.ammo_rockets, autocvar_g_balance_rocketlauncher_ammo))
- return;
-
- float t;
-
- sound (self, CHAN_WEAPON2, "weapons/reload.wav", VOL_BASE, ATTN_NORM);
-
- t = max(time, ATTACK_FINISHED(self)) + autocvar_g_balance_rocketlauncher_reload_time + 1;
- ATTACK_FINISHED(self) = t;
-
- weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_rocketlauncher_reload_time, W_RocketLauncher_ReloadedAndReady);
-
- self.old_clip_load = self.clip_load;
- self.clip_load = -1;
-}
-
void W_Rocket_Unregister()
{
if(self.owner && self.owner.lastrocket == self)
local entity missile;
local entity flash;
- // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- {
- if(autocvar_g_balance_rocketlauncher_reload_ammo)
- {
- self.clip_load -= autocvar_g_balance_rocketlauncher_ammo;
- self.rocketlauncher_load = self.clip_load;
- }
- else
- self.ammo_rockets -= autocvar_g_balance_rocketlauncher_ammo;
- }
+ W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_rocketlauncher_ammo, autocvar_g_balance_rocketlauncher_reload_ammo);
W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav", CHAN_WEAPON, autocvar_g_balance_rocketlauncher_damage);
pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
else if (req == WR_THINK)
{
if(autocvar_g_balance_rocketlauncher_reload_ammo && self.clip_load < autocvar_g_balance_rocketlauncher_ammo) // forced reload
- W_RocketLauncher_Reload();
+ weapon_action(self.weapon, WR_RELOAD);
else
{
if (self.BUTTON_ATCK)
precache_sound ("weapons/rocket_det.wav");
precache_sound ("weapons/rocket_fire.wav");
precache_sound ("weapons/rocket_mode.wav");
- precache_sound ("weapons/reload.wav");
+ //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
}
else if (req == WR_SETUP)
{
weapon_setup(WEP_ROCKET_LAUNCHER);
- W_RocketLauncher_SetAmmoCounter();
+ self.current_ammo = ammo_rockets;
self.rl_release = 1;
}
else if (req == WR_CHECKAMMO1)
// don't switch while guiding a missile
if (ATTACK_FINISHED(self) <= time || self.weapon != WEP_ROCKET_LAUNCHER)
{
- if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo)
- ammo_amount = FALSE;
- if(autocvar_g_balance_electro_reload_ammo && self.minelayer_load < autocvar_g_balance_rocketlauncher_ammo)
- ammo_amount = FALSE;
+ if(autocvar_g_balance_rocketlauncher_reload_ammo)
+ {
+ if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo && self.weapon_load[WEP_ROCKET_LAUNCHER] < autocvar_g_balance_rocketlauncher_ammo)
+ ammo_amount = TRUE;
+ }
+ else if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo)
+ ammo_amount = TRUE;
+ return !ammo_amount;
}
- return ammo_amount;
}
else if (req == WR_CHECKAMMO2)
return FALSE;
else if (req == WR_RESETPLAYER)
{
self.rl_release = 0;
-
- // all weapons must be fully loaded when we spawn
- self.rocketlauncher_load = autocvar_g_balance_rocketlauncher_reload_ammo;
}
else if (req == WR_RELOAD)
{
- W_RocketLauncher_Reload();
+ W_Reload(autocvar_g_balance_rocketlauncher_ammo, autocvar_g_balance_rocketlauncher_reload_ammo, autocvar_g_balance_rocketlauncher_reload_time, "weapons/reload.wav");
}
return TRUE;
};
precache_sound("weapons/rocket_impact.wav");
}
else if (req == WR_SUICIDEMESSAGE)
- w_deathtypestring = "%s exploded";
+ w_deathtypestring = _("%s exploded");
else if (req == WR_KILLMESSAGE)
{
if(w_deathtype & HITTYPE_BOUNCE) // (remote detonation)
- w_deathtypestring = "%s got too close to %s's rocket";
+ w_deathtypestring = _("%s got too close to %s's rocket");
else if(w_deathtype & HITTYPE_SPLASH)
- w_deathtypestring = "%s almost dodged %s's rocket";
+ w_deathtypestring = _("%s almost dodged %s's rocket");
else
- w_deathtypestring = "%s ate %s's rocket";
+ w_deathtypestring = _("%s ate %s's rocket");
}
return TRUE;
}