-#ifdef REGISTER_WEAPON
+#ifndef IMPLEMENTATION
REGISTER_WEAPON(
/* WEP_##id */ HAGAR,
/* function */ W_Hagar,
#ifdef SVQC
HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
#endif
-#else
+#endif
+#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hagar(void) { weapon_defaultspawnfunc(WEP_HAGAR); }
+void spawnfunc_weapon_hagar(void) { weapon_defaultspawnfunc(WEP_HAGAR.m_id); }
// NO bounce protection, as bounces are limited!
remove(self);
}
-void W_Hagar_Damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(self.health <= 0)
return;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
PROJECTILE_MAKETRIGGER(missile);
- missile.projectiledeathtype = WEP_HAGAR;
+ missile.projectiledeathtype = WEP_HAGAR.m_id;
setorigin(missile, w_shotorg);
setsize(missile, '0 0 0', '0 0 0');
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
PROJECTILE_MAKETRIGGER(missile);
- missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
+ missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
setorigin(missile, w_shotorg);
setsize(missile, '0 0 0', '0 0 0');
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
PROJECTILE_MAKETRIGGER(missile);
- missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
+ missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
setorigin(missile, w_shotorg);
setsize(missile, '0 0 0', '0 0 0');
missile.movetype = MOVETYPE_FLY;
loaded = self.hagar_load >= WEP_CVAR_SEC(hagar, load_max);
// this is different than WR_CHECKAMMO when it comes to reloading
- if(autocvar_g_balance_hagar_reload_ammo)
- enough_ammo = self.(weapon_load[WEP_HAGAR]) >= WEP_CVAR_SEC(hagar, ammo);
+ if(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ enough_ammo = true;
+ else if(autocvar_g_balance_hagar_reload_ammo)
+ enough_ammo = self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
else
enough_ammo = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
// we aren't checking ammo during an attack, so we must do it here
if(!(WEP_ACTION(self.weapon, WR_CHECKAMMO1) + WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
+ if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
// note: this doesn't force the switch
W_SwitchToOtherWeapon(self);
}
}
-float W_Hagar(float req)
+bool W_Hagar(int req)
{
float ammo_amount;
switch(req)
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_PRI(hagar, ammo);
- ammo_amount += self.(weapon_load[WEP_HAGAR]) >= WEP_CVAR_PRI(hagar, ammo);
+ ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
{
ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
- ammo_amount += self.(weapon_load[WEP_HAGAR]) >= WEP_CVAR_SEC(hagar, ammo);
+ ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
return ammo_amount;
}
case WR_CONFIG:
}
#endif
#ifdef CSQC
-float W_Hagar(float req)
+bool W_Hagar(int req)
{
switch(req)
{