-#ifdef REGISTER_WEAPON
+#ifndef IMPLEMENTATION
REGISTER_WEAPON(
/* WEP_##id */ ELECTRO,
/* function */ W_Electro,
/* color */ '0 0.5 1',
/* modelname */ "electro",
/* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairelectro 0.5",
+/* crosshair */ "gfx/crosshairelectro 0.6",
/* wepimg */ "weaponelectro",
/* refname */ "electro",
/* wepname */ _("Electro")
.float electro_secondarytime;
void W_Electro_ExplodeCombo(void);
#endif
-#else
+#endif
+#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_electro(void) { weapon_defaultspawnfunc(WEP_ELECTRO); }
+void spawnfunc_weapon_electro(void) { weapon_defaultspawnfunc(WEP_ELECTRO.m_id); }
void W_Electro_TriggerCombo(vector org, float rad, entity own)
{
}
}
}
-
+
// change owner to whoever caused the combo explosion
e.realowner = own;
e.takedamage = DAMAGE_NO;
e.classname = "electro_orb_chain";
-
+
// now set the next one to trigger as well
e.think = W_Electro_ExplodeCombo;
-
+
// delay combo chains, looks cooler
e.nextthink =
(
W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner);
self.event_damage = func_null;
-
+
RadiusDamage(
self,
self.realowner,
world,
world,
WEP_CVAR(electro, combo_force),
- WEP_ELECTRO | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce
+ WEP_ELECTRO.m_id | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce
world
);
self.event_damage = func_null;
self.takedamage = DAMAGE_NO;
-
+
if(self.movetype == MOVETYPE_BOUNCE)
{
RadiusDamage(
if(WEP_CVAR_PRI(electro, midaircombo_radius))
{
float found = 0;
- entity e = WarpZone_FindRadius(self.origin, WEP_CVAR_PRI(electro, midaircombo_radius), TRUE);
+ entity e = WarpZone_FindRadius(self.origin, WEP_CVAR_PRI(electro, midaircombo_radius), true);
// loop through nearby orbs and trigger them
while(e)
// now set the next one to trigger as well
e.think = W_Electro_ExplodeCombo;
-
+
// delay combo chains, looks cooler
e.nextthink =
(
self,
'0 0 -3',
'0 0 -3',
- FALSE,
+ false,
2,
"weapons/electro_fire.wav",
CH_WEAPON_A,
proj = spawn();
proj.classname = "electro_bolt";
proj.owner = proj.realowner = self;
- proj.bot_dodge = TRUE;
+ proj.bot_dodge = true;
proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage);
proj.use = W_Electro_Explode;
proj.think = W_Electro_Bolt_Think;
proj.nextthink = time;
proj.ltime = time + WEP_CVAR_PRI(electro, lifetime);
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_ELECTRO;
+ proj.projectiledeathtype = WEP_ELECTRO.m_id;
setorigin(proj, w_shotorg);
proj.movetype = MOVETYPE_FLY;
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
- CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
+ CSQCProjectile(proj, true, PROJECTILE_ELECTRO_BEAM, true);
other = proj; MUTATOR_CALLHOOK(EditProjectile);
}
}
}
-void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(self.health <= 0)
return;
self,
'0 0 -4',
'0 0 -4',
- FALSE,
+ false,
2,
"weapons/electro_fire2.wav",
CH_WEAPON_A,
proj.owner = proj.realowner = self;
proj.use = W_Electro_Explode;
proj.think = adaptor_think2use_hittype_splash;
- proj.bot_dodge = TRUE;
+ proj.bot_dodge = true;
proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage);
proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime);
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
+ proj.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_SECONDARY;
setorigin(proj, w_shotorg);
//proj.glow_size = 50;
setsize(p2, proj.mins, proj.maxs);
#endif
- CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
+ CSQCProjectile(proj, true, PROJECTILE_ELECTRO, false); // no culling, it has sound
other = proj; MUTATOR_CALLHOOK(EditProjectile);
}
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
return;
}
- // WEAPONTODO: when the player releases the button, cut down the length of refire2?
+ // WEAPONTODO: when the player releases the button, cut down the length of refire2?
w_ready();
}
.float bot_secondary_electromooth;
-float W_Electro(float req)
+bool W_Electro(int req)
{
float ammo_amount;
switch(req)
{
case WR_AIM:
{
- self.BUTTON_ATCK = self.BUTTON_ATCK2 = FALSE;
+ self.BUTTON_ATCK = self.BUTTON_ATCK2 = false;
if(vlen(self.origin-self.enemy.origin) > 1000) { self.bot_secondary_electromooth = 0; }
if(self.bot_secondary_electromooth == 0)
{
float shoot;
if(WEP_CVAR_PRI(electro, speed))
- shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), FALSE);
+ shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
else
- shoot = bot_aim(1000000, 0, 0.001, FALSE);
+ shoot = bot_aim(1000000, 0, 0.001, false);
if(shoot)
{
- self.BUTTON_ATCK = TRUE;
+ self.BUTTON_ATCK = true;
if(random() < 0.01) self.bot_secondary_electromooth = 1;
}
}
else
{
- if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), TRUE))
+ if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
{
- self.BUTTON_ATCK2 = TRUE;
+ self.BUTTON_ATCK2 = true;
if(random() < 0.03) self.bot_secondary_electromooth = 0;
}
}
-
- return TRUE;
+
+ return true;
}
case WR_THINK:
{
if(!ammo_amount)
{
WEP_ACTION(self.weapon, WR_RELOAD);
- return FALSE;
+ return false;
}
-
- return TRUE;
+
+ return true;
}
-
+
if(self.BUTTON_ATCK)
{
if(weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire)))
}
}
- return TRUE;
+ return true;
}
case WR_INIT:
{
precache_sound("weapons/electro_fire2.wav");
precache_sound("weapons/electro_impact.wav");
precache_sound("weapons/electro_impact_combo.wav");
- ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
- return TRUE;
+ ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+ return true;
}
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_PRI(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= WEP_CVAR_PRI(electro, ammo);
+ ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
{
ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+ ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
}
else
{
ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_SEC(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= WEP_CVAR_SEC(electro, ammo);
+ ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
}
return ammo_amount;
}
case WR_CONFIG:
{
- ELECTRO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
- return TRUE;
+ ELECTRO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+ return true;
}
case WR_RESETPLAYER:
{
self.electro_secondarytime = time;
- return TRUE;
+ return true;
}
case WR_RELOAD:
{
W_Reload(min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), "weapons/reload.wav");
- return TRUE;
+ return true;
}
case WR_SUICIDEMESSAGE:
{
}
}
}
- return FALSE;
+ return false;
}
#endif
#ifdef CSQC
-float W_Electro(float req)
+bool W_Electro(int req)
{
switch(req)
{
sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTEN_NORM);
}
}
-
- return TRUE;
+
+ return true;
}
case WR_INIT:
{
precache_sound("weapons/electro_impact.wav");
precache_sound("weapons/electro_impact_combo.wav");
- return TRUE;
+ return true;
}
case WR_ZOOMRETICLE:
{
// no weapon specific image for this weapon
- return FALSE;
+ return false;
}
}
- return FALSE;
+ return false;
}
#endif
#endif