-std=gmqcc \
-O3 -flno \
-Werror -fno-bail-on-werror -Wall \
- -fftepp -fftepp-predefs -Wcpp -futf8 \
+ -fftepp -fftepp-predefs -Wcpp -futf8 -frelaxed-switch \
$(QCCFLAGS_WTFS) \
$(QCCFLAGS_FEATURES) \
$(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK)
w_random = prandom();
traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world);
- if(trace_fraction < 1 && hitwep != WEP_VORTEX && hitwep != WEP_VAPORIZER)
+ if(trace_fraction < 1 && hitwep != WEP_VORTEX.m_id && hitwep != WEP_VAPORIZER.m_id)
w_backoff = trace_plane_normal;
else
w_backoff = -1 * normalize(force);
vector p, dir, ang, q, nextdir;
float portal_number, portal1_idx;
- if(activeweapon != WEP_PORTO || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL)
+ if(activeweapon != WEP_PORTO.m_id || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL)
return;
if(g_balance_porto_secondary)
return;
zoomdir = button_zoom;
if(hud == HUD_NORMAL)
- if((activeweapon == WEP_VORTEX && vortex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
+ if((activeweapon == WEP_VORTEX.m_id && vortex_scope) || (activeweapon == WEP_RIFLE.m_id && rifle_scope)) // do NOT use switchweapon here
zoomdir += button_attack2;
if(spectatee_status > 0 || isdemo())
{
switch(activeweapon) // WEAPONTODO
{
- case WEP_TUBA: // no aim
- case WEP_PORTO: // shoots from eye
- case WEP_HOOK: // no trueaim
- case WEP_MORTAR: // toss curve
+ case WEP_TUBA.m_id: // no aim
+ case WEP_PORTO.m_id: // shoots from eye
+ case WEP_HOOK.m_id: // no trueaim
+ case WEP_MORTAR.m_id: // toss curve
return SHOTTYPE_HITWORLD;
- case WEP_VORTEX:
- case WEP_VAPORIZER:
+ case WEP_VORTEX.m_id:
+ case WEP_VAPORIZER.m_id:
mv = MOVE_NORMAL;
break;
- case WEP_RIFLE:
+ case WEP_RIFLE.m_id:
ta = trueaim_rifle;
mv = MOVE_NORMAL;
if(zoomscript_caught)
return EnemyHitCheck();
}
break;
- case WEP_DEVASTATOR: // projectile has a size!
+ case WEP_DEVASTATOR.m_id: // projectile has a size!
mi = '-3 -3 -3';
ma = '3 3 3';
break;
- case WEP_FIREBALL: // projectile has a size!
+ case WEP_FIREBALL.m_id: // projectile has a size!
mi = '-16 -16 -16';
ma = '16 16 16';
break;
- case WEP_SEEKER: // projectile has a size!
+ case WEP_SEEKER.m_id: // projectile has a size!
mi = '-2 -2 -2';
ma = '2 2 2';
break;
- case WEP_ELECTRO: // projectile has a size!
+ case WEP_ELECTRO.m_id: // projectile has a size!
mi = '0 0 -3';
ma = '0 0 -3';
break;
return true;
if(spectatee_status >= 0)
{
- if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO)))
+ if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO.m_id)))
return true;
if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
{
static float hitsound_time_prev = 0;
// HACK: the only way to get the arc to sound consistent with pitch shift is to ignore cl_hitsound_antispam_time
- float arc_hack = activeweapon == WEP_ARC && autocvar_cl_hitsound >= 2;
+ float arc_hack = activeweapon == WEP_ARC.m_id && autocvar_cl_hitsound >= 2;
if (arc_hack || COMPARE_INCREASING(time, hitsound_time_prev) > autocvar_cl_hitsound_antispam_time)
{
if (autocvar_cl_hitsound && unaccounted_damage)
// handle the values
- if (autocvar_crosshair_ring && activeweapon == WEP_VORTEX && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
+ if (autocvar_crosshair_ring && activeweapon == WEP_VORTEX.m_id && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
{
if (vortex_chargepool || use_vortex_chargepool) {
use_vortex_chargepool = 1;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring_nexgun.tga";
}
- else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
+ else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER.m_id && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
{
ring_value = bound(0, getstati(STAT_LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring.tga";
}
- else if (activeweapon == WEP_HAGAR && getstati(STAT_HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
+ else if (activeweapon == WEP_HAGAR.m_id && getstati(STAT_HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
{
ring_value = bound(0, getstati(STAT_HAGAR_LOAD) / hagar_maxrockets, 1);
ring_alpha = autocvar_crosshair_ring_hagar_alpha;
// Note: This is to stop Taoki from complaining that the image doesn't match all potential balances.
// if a new image for another weapon is added, add the code (and its respective file/value) here
- if ((activeweapon == WEP_RIFLE) && (weapon_clipsize == 80))
+ if ((activeweapon == WEP_RIFLE.m_id) && (weapon_clipsize == 80))
ring_image = "gfx/crosshair_ring_rifle.tga";
else
ring_image = "gfx/crosshair_ring.tga";
}
- else if ( autocvar_crosshair_ring && autocvar_crosshair_ring_arc && arc_heat && activeweapon == WEP_ARC )
+ else if ( autocvar_crosshair_ring && autocvar_crosshair_ring_arc && arc_heat && activeweapon == WEP_ARC.m_id )
{
ring_value = arc_heat;
ring_alpha = (1-arc_heat)*autocvar_crosshair_ring_arc_cold_alpha +
self.monster_loot = spawnfunc_item_health_mega;
self.monster_attackfunc = shambler_attack;
self.frame = shambler_anim_stand;
- self.weapon = WEP_VORTEX;
+ self.weapon = WEP_VORTEX.m_id;
return true;
}
self.health += autocvar_g_monsters_miniboss_healthboost;
self.effects |= EF_RED;
if(!self.weapon)
- self.weapon = WEP_VORTEX;
+ self.weapon = WEP_VORTEX.m_id;
}
}
#ifdef SVQC
// WEAPONTODO
float xyspeed = vlen(vec2(self.velocity));
- if (self.weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+ if (self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
{
// add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
const int WEP_FIRST = 1;
#define WEP_MAXCOUNT 24 // Increase as needed. Can be up to three times as much.
int WEP_COUNT;
-int WEP_LAST;
+#define WEP_LAST (WEP_FIRST + WEP_COUNT - 1)
WepSet WEPSET_ALL;
WepSet WEPSET_SUPERWEAPONS;
// other useful macros
#define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest)
-#define WEP_AMMO(wpn) ((get_weaponinfo(WEP_##wpn)).ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
+#define WEP_AMMO(wpn) ((get_weaponinfo(WEP_##wpn.m_id)).ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
#define WEP_NAME(wpn) ((get_weaponinfo(wpn)).message)
// set initialization values for weapon settings
#define WEP_SKIP_CVAR(unuseda,unusedb,unusedc,unusedd) /* skip cvars */
-#define WEP_SET_PROP(wepid,wepname,type,prop,name) get_weaponinfo(WEP_##wepid).##prop = autocvar_g_balance_##wepname##_##name;
+#define WEP_SET_PROP(wepid,wepname,type,prop,name) get_weaponinfo(WEP_##wepid.m_id).##prop = autocvar_g_balance_##wepname##_##name;
// =====================
entity dummy_weapon_info;
#define _REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
- int WEP_##id; \
WepSet WEPSET_##id; \
- REGISTER(RegisterWeapons, WEP_, weapon_info, WEP_COUNT, id, m_id, \
+ REGISTER(RegisterWeapons, WEP, weapon_info, WEP_COUNT, id, m_id, \
NEW(Weapon, function, ammotype, impulse, flags, rating, color, modelname, simplemdl, crosshair, wepimg, refname, wepname) \
) { \
- WEP_LAST = (WEP_##id = WEP_FIRST + WEP_COUNT - 1); \
- WEPSET_ALL |= (WEPSET_##id = WepSet_FromWeapon(WEP_##id)); \
+ this.m_id++; \
+ WEPSET_ALL |= (WEPSET_##id = WepSet_FromWeapon(this.m_id)); \
if ((flags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= WEPSET_##id; \
- register_weapon(this, WEP_##id, WEPSET_##id); \
+ register_weapon(this, this.m_id, WEPSET_##id); \
}
bool w_null(int) { return false; }
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC); }
+void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC.m_id); }
float W_Arc_Beam_Send(entity to, int sf)
{
if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
entity oldself = self;
self = self.owner;
- if(!WEP_ACTION(WEP_ARC, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC, WR_CHECKAMMO2))
+ if(!WEP_ACTION(WEP_ARC.m_id, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC.m_id, WR_CHECKAMMO2))
if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
// note: this doesn't force the switch
{
accuracy_add(
self.owner,
- WEP_ARC,
+ WEP_ARC.m_id,
0,
rootdamage * coefficient * falloff
);
self.owner,
self.owner,
rootdamage * coefficient * falloff,
- WEP_ARC,
+ WEP_ARC.m_id,
hitorigin,
WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
);
}
if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
- !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC )
+ !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC.m_id )
{
self.arc_smoke_sound = 0;
sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
precache_sound("weapons/arc_loop_overheat.wav");
if(!arc_shotorigin[0])
{
- arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 1);
- arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 2);
- arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 3);
- arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 4);
+ arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
+ arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
+ arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
+ arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
}
ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
return true;
}
case WR_PICKUP:
{
- if ( !client_hasweapon(self, WEP_ARC, false, false) &&
+ if ( !client_hasweapon(self, WEP_ARC.m_id, false, false) &&
weapon_dropevent_item.arc_overheat > time )
{
self.arc_overheat = weapon_dropevent_item.arc_overheat;
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_blaster(void) { weapon_defaultspawnfunc(WEP_BLASTER); }
+void spawnfunc_weapon_blaster(void) { weapon_defaultspawnfunc(WEP_BLASTER.m_id); }
void spawnfunc_weapon_laser(void) { spawnfunc_weapon_blaster(); }
void W_Blaster_Touch(void)
if(weapon_prepareattack(0, WEP_CVAR_PRI(blaster, refire)))
{
W_Blaster_Attack(
- WEP_BLASTER,
+ WEP_BLASTER.m_id,
WEP_CVAR_PRI(blaster, shotangle),
WEP_CVAR_PRI(blaster, damage),
WEP_CVAR_PRI(blaster, edgedamage),
{
case 0: // switch to last used weapon
{
- if(self.switchweapon == WEP_BLASTER) // don't do this if already switching
+ if(self.switchweapon == WEP_BLASTER.m_id) // don't do this if already switching
W_LastWeapon();
break;
}
if(weapon_prepareattack(1, WEP_CVAR_SEC(blaster, refire)))
{
W_Blaster_Attack(
- WEP_BLASTER | HITTYPE_SECONDARY,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
WEP_CVAR_SEC(blaster, shotangle),
WEP_CVAR_SEC(blaster, damage),
WEP_CVAR_SEC(blaster, edgedamage),
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK); }
+void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
void W_Crylink_CheckLinks(entity e)
{
proj.movetype = MOVETYPE_BOUNCEMISSILE;
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_CRYLINK;
+ proj.projectiledeathtype = WEP_CRYLINK.m_id;
//proj.gravity = 0.001;
setorigin(proj, w_shotorg);
proj.movetype = MOVETYPE_BOUNCEMISSILE;
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
+ proj.projectiledeathtype = WEP_CRYLINK.m_id | HITTYPE_SECONDARY;
//proj.gravity = 0.001;
setorigin(proj, w_shotorg);
if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
// ran out of ammo!
- self.cnt = WEP_CRYLINK;
+ self.cnt = WEP_CRYLINK.m_id;
self.switchweapon = w_getbestweapon(self);
}
}
return true;
ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
- ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_PRI(crylink, ammo);
+ ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
return true;
ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
- ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_SEC(crylink, ammo);
+ ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
return ammo_amount;
}
case WR_CONFIG:
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_devastator(void) { weapon_defaultspawnfunc(WEP_DEVASTATOR); }
+void spawnfunc_weapon_devastator(void) { weapon_defaultspawnfunc(WEP_DEVASTATOR.m_id); }
void spawnfunc_weapon_rocketlauncher(void) { spawnfunc_weapon_devastator(); }
void W_Devastator_Unregister(void)
other
);
- if(self.realowner.weapon == WEP_DEVASTATOR)
+ if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
{
if(self.realowner.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
{
- self.realowner.cnt = WEP_DEVASTATOR;
+ self.realowner.cnt = WEP_DEVASTATOR.m_id;
ATTACK_FINISHED(self.realowner) = time;
self.realowner.switchweapon = w_getbestweapon(self.realowner);
}
world
);
- if(self.realowner.weapon == WEP_DEVASTATOR)
+ if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
{
if(self.realowner.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
{
- self.realowner.cnt = WEP_DEVASTATOR;
+ self.realowner.cnt = WEP_DEVASTATOR.m_id;
ATTACK_FINISHED(self.realowner) = time;
self.realowner.switchweapon = w_getbestweapon(self.realowner);
}
self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor() * frametime, velspeed);
// laser guided, or remote detonation
- if(self.realowner.weapon == WEP_DEVASTATOR)
+ if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
{
if(self == self.realowner.lastrocket)
if(!self.realowner.rl_release)
missile.movetype = MOVETYPE_FLY;
PROJECTILE_MAKETRIGGER(missile);
- missile.projectiledeathtype = WEP_DEVASTATOR;
+ missile.projectiledeathtype = WEP_DEVASTATOR.m_id;
setsize(missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
self.rl_release = 1;
if(self.BUTTON_ATCK2)
- if(self.switchweapon == WEP_DEVASTATOR)
+ if(self.switchweapon == WEP_DEVASTATOR.m_id)
{
rockfound = 0;
for(rock = world; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == self)
{
#if 0
// don't switch while guiding a missile
- if(ATTACK_FINISHED(self) <= time || self.weapon != WEP_DEVASTATOR)
+ if(ATTACK_FINISHED(self) <= time || self.weapon != WEP_DEVASTATOR.m_id)
{
ammo_amount = false;
if(WEP_CVAR(devastator, reload_ammo))
{
- if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR]) < WEP_CVAR(devastator, ammo))
+ if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
ammo_amount = true;
}
else if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
else
{
ammo_amount = self.WEP_AMMO(DEVASTATOR) >= WEP_CVAR(devastator, ammo);
- ammo_amount += self.(weapon_load[WEP_DEVASTATOR]) >= WEP_CVAR(devastator, ammo);
+ ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
printf("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.WEP_AMMO(DEVASTATOR), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
return ammo_amount;
}
#else
ammo_amount = self.WEP_AMMO(DEVASTATOR) >= WEP_CVAR(devastator, ammo);
- ammo_amount += self.(weapon_load[WEP_DEVASTATOR]) >= WEP_CVAR(devastator, ammo);
+ ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
return ammo_amount;
#endif
}
#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)
{
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
);
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.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;
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;
}
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_fireball(void) { weapon_defaultspawnfunc(WEP_FIREBALL); }
+void spawnfunc_weapon_fireball(void) { weapon_defaultspawnfunc(WEP_FIREBALL.m_id); }
void W_Fireball_Explode(void)
{
dir = normalize(e.origin + e.view_ofs - self.origin);
if(accuracy_isgooddamage(self.realowner, e))
- accuracy_add(self.realowner, WEP_FIREBALL, 0, WEP_CVAR_PRI(fireball, bfgdamage) * points);
+ accuracy_add(self.realowner, WEP_FIREBALL.m_id, 0, WEP_CVAR_PRI(fireball, bfgdamage) * points);
Damage(e, self, self.realowner, WEP_CVAR_PRI(fireball, bfgdamage) * points, self.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, e.origin + e.view_ofs, WEP_CVAR_PRI(fireball, bfgforce) * dir);
pointparticles(particleeffectnum("fireball_bfgdamage"), e.origin, -1 * dir, 1);
proj.takedamage = DAMAGE_YES;
proj.damageforcescale = WEP_CVAR_PRI(fireball, damageforcescale);
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_FIREBALL;
+ proj.projectiledeathtype = WEP_FIREBALL.m_id;
setorigin(proj, w_shotorg);
proj.movetype = MOVETYPE_FLY;
proj.bot_dodge = true;
proj.bot_dodgerating = WEP_CVAR_SEC(fireball, damage);
proj.movetype = MOVETYPE_BOUNCE;
- proj.projectiledeathtype = WEP_FIREBALL | HITTYPE_SECONDARY;
+ proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY;
proj.touch = W_Fireball_Firemine_Touch;
PROJECTILE_MAKETRIGGER(proj);
setsize(proj, '-4 -4 -4', '4 4 4');
#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!
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;
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]) >= WEP_CVAR_SEC(hagar, 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);
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 IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hlac(void) { weapon_defaultspawnfunc(WEP_HLAC); }
+void spawnfunc_weapon_hlac(void) { weapon_defaultspawnfunc(WEP_HLAC.m_id); }
void W_HLAC_Touch(void)
{
missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
missile.flags = FL_PROJECTILE;
- missile.projectiledeathtype = WEP_HLAC;
+ missile.projectiledeathtype = WEP_HLAC.m_id;
CSQCProjectile(missile, true, PROJECTILE_HLAC, true);
missile.flags = FL_PROJECTILE;
missile.missile_flags = MIF_SPLASH;
- missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
+ missile.projectiledeathtype = WEP_HLAC.m_id | HITTYPE_SECONDARY;
CSQCProjectile(missile, true, PROJECTILE_HLAC, true);
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_PRI(hlac, ammo);
- ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_PRI(hlac, ammo);
+ ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
{
ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_SEC(hlac, ammo);
- ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_SEC(hlac, ammo);
+ ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
return ammo_amount;
}
case WR_CONFIG:
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hmg() { weapon_defaultspawnfunc(WEP_HMG); }
+void spawnfunc_weapon_hmg() { weapon_defaultspawnfunc(WEP_HMG.m_id); }
void W_HeavyMachineGun_Attack_Auto()
{
}
float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * self.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
- fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG, 0);
+ fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
self.misc_bulletcounter = self.misc_bulletcounter + 1;
ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
if(autocvar_g_balance_hmg_reload_ammo)
- ammo_amount += self.(weapon_load[WEP_HMG]) >= WEP_CVAR(hmg, ammo);
+ ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
return ammo_amount;
}
ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
if(autocvar_g_balance_hmg_reload_ammo)
- ammo_amount += self.(weapon_load[WEP_HMG]) >= WEP_CVAR(hmg, ammo);
+ ammo_amount += self.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
return ammo_amount;
}
remove(self);
return;
}
- weapon_defaultspawnfunc(WEP_HOOK);
+ weapon_defaultspawnfunc(WEP_HOOK.m_id);
}
void W_Hook_ExplodeThink(void)
gren.bot_dodgerating = WEP_CVAR_SEC(hook, damage);
gren.movetype = MOVETYPE_TOSS;
PROJECTILE_MAKETRIGGER(gren);
- gren.projectiledeathtype = WEP_HOOK | HITTYPE_SECONDARY;
+ gren.projectiledeathtype = WEP_HOOK.m_id | HITTYPE_SECONDARY;
setorigin(gren, w_shotorg);
setsize(gren, '0 0 0', '0 0 0');
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
{
- weapon_defaultspawnfunc(WEP_SHOCKWAVE);
+ weapon_defaultspawnfunc(WEP_SHOCKWAVE.m_id);
return;
}
- weapon_defaultspawnfunc(WEP_MACHINEGUN);
+ weapon_defaultspawnfunc(WEP_MACHINEGUN.m_id);
}
void spawnfunc_weapon_uzi(void) { spawnfunc_weapon_machinegun(); }
return;
}
self.misc_bulletcounter = self.misc_bulletcounter + 1;
- W_MachineGun_Attack(WEP_MACHINEGUN);
+ W_MachineGun_Attack(WEP_MACHINEGUN.m_id);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
else
}
machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * self.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
- fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN, 0);
+ fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
self.misc_bulletcounter = self.misc_bulletcounter + 1;
self.punchangle_y = random() - 0.5;
}
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN, 0);
+ fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
if(weapon_prepareattack(0, 0))
{
self.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN); // sets attack_finished
+ W_MachineGun_Attack(WEP_MACHINEGUN.m_id); // sets attack_finished
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
if(weapon_prepareattack(1, 0))
{
self.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN | HITTYPE_SECONDARY); // sets attack_finished
+ W_MachineGun_Attack(WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY); // sets attack_finished
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
}
}
if(WEP_CVAR(machinegun, reload_ammo))
{
if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN]) >= WEP_CVAR(machinegun, sustained_ammo);
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, sustained_ammo);
else
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN]) >= WEP_CVAR(machinegun, first_ammo);
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
}
return ammo_amount;
}
if(WEP_CVAR(machinegun, reload_ammo))
{
if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN]) >= WEP_CVAR(machinegun, burst_ammo);
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, burst_ammo);
else
- ammo_amount += self.(weapon_load[WEP_MACHINEGUN]) >= WEP_CVAR(machinegun, first_ammo);
+ ammo_amount += self.(weapon_load[WEP_MACHINEGUN.m_id]) >= WEP_CVAR(machinegun, first_ammo);
}
return ammo_amount;
}
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_minelayer(void) { weapon_defaultspawnfunc(WEP_MINE_LAYER); }
+void spawnfunc_weapon_minelayer(void) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m_id); }
void W_MineLayer_Stick(entity to)
{
RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), world, world, WEP_CVAR(minelayer, force), self.projectiledeathtype, other);
- if(self.realowner.weapon == WEP_MINE_LAYER)
+ if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
{
entity oldself;
oldself = self;
self = self.realowner;
- if(!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
+ if(!WEP_ACTION(WEP_MINE_LAYER.m_id, WR_CHECKAMMO1))
{
- self.cnt = WEP_MINE_LAYER;
+ self.cnt = WEP_MINE_LAYER.m_id;
ATTACK_FINISHED(self) = time;
self.switchweapon = w_getbestweapon(self);
}
RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), world, world, WEP_CVAR(minelayer, remote_force), self.projectiledeathtype | HITTYPE_BOUNCE, world);
- if(self.realowner.weapon == WEP_MINE_LAYER)
+ if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
{
entity oldself;
oldself = self;
self = self.realowner;
- if(!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
+ if(!WEP_ACTION(WEP_MINE_LAYER.m_id, WR_CHECKAMMO1))
{
- self.cnt = WEP_MINE_LAYER;
+ self.cnt = WEP_MINE_LAYER.m_id;
ATTACK_FINISHED(self) = time;
self.switchweapon = w_getbestweapon(self);
}
}
// remote detonation
- if(self.realowner.weapon == WEP_MINE_LAYER)
+ if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
if(self.realowner.deadflag == DEAD_NO)
if(self.minelayer_detonate)
W_MineLayer_RemoteExplode();
mine.movetype = MOVETYPE_TOSS;
PROJECTILE_MAKETRIGGER(mine);
- mine.projectiledeathtype = WEP_MINE_LAYER;
+ mine.projectiledeathtype = WEP_MINE_LAYER.m_id;
setsize(mine, '-4 -4 -4', '4 4 4'); // give it some size so it can be shot
setorigin(mine, w_shotorg - v_forward * 4); // move it back so it hits the wall at the right point
case WR_CHECKAMMO1:
{
// don't switch while placing a mine
- if(ATTACK_FINISHED(self) <= time || self.weapon != WEP_MINE_LAYER)
+ if(ATTACK_FINISHED(self) <= time || self.weapon != WEP_MINE_LAYER.m_id)
{
ammo_amount = self.WEP_AMMO(MINE_LAYER) >= WEP_CVAR(minelayer, ammo);
- ammo_amount += self.(weapon_load[WEP_MINE_LAYER]) >= WEP_CVAR(minelayer, ammo);
+ ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
return ammo_amount;
}
return true;
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_mortar(void) { weapon_defaultspawnfunc(WEP_MORTAR); }
+void spawnfunc_weapon_mortar(void) { weapon_defaultspawnfunc(WEP_MORTAR.m_id); }
void spawnfunc_weapon_grenadelauncher(void) { spawnfunc_weapon_mortar(); }
void W_Mortar_Grenade_Explode(void)
gren.bouncefactor = WEP_CVAR(mortar, bouncefactor);
gren.bouncestop = WEP_CVAR(mortar, bouncestop);
PROJECTILE_MAKETRIGGER(gren);
- gren.projectiledeathtype = WEP_MORTAR;
+ gren.projectiledeathtype = WEP_MORTAR.m_id;
setorigin(gren, w_shotorg);
setsize(gren, '-3 -3 -3', '3 3 3');
gren.bouncefactor = WEP_CVAR(mortar, bouncefactor);
gren.bouncestop = WEP_CVAR(mortar, bouncestop);
PROJECTILE_MAKETRIGGER(gren);
- gren.projectiledeathtype = WEP_MORTAR | HITTYPE_SECONDARY;
+ gren.projectiledeathtype = WEP_MORTAR.m_id | HITTYPE_SECONDARY;
setorigin(gren, w_shotorg);
setsize(gren, '-3 -3 -3', '3 3 3');
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(MORTAR) >= WEP_CVAR_PRI(mortar, ammo);
- ammo_amount += self.(weapon_load[WEP_MORTAR]) >= WEP_CVAR_PRI(mortar, ammo);
+ ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
{
ammo_amount = self.WEP_AMMO(MORTAR) >= WEP_CVAR_SEC(mortar, ammo);
- ammo_amount += self.(weapon_load[WEP_MORTAR]) >= WEP_CVAR_SEC(mortar, ammo);
+ ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
return ammo_amount;
}
case WR_CONFIG:
#ifdef SVQC
#include "../triggers/trigger/jumppads.qh"
-void spawnfunc_weapon_porto(void) { weapon_defaultspawnfunc(WEP_PORTO); }
+void spawnfunc_weapon_porto(void) { weapon_defaultspawnfunc(WEP_PORTO.m_id); }
void W_Porto_Success(void)
{
tracetoss(self, self);
if(vlen(trace_endpos - self.realowner.origin) < 128)
{
- W_ThrowNewWeapon(self.realowner, WEP_PORTO, 0, self.origin, self.velocity);
+ W_ThrowNewWeapon(self.realowner, WEP_PORTO.m_id, 0, self.origin, self.velocity);
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
}
}
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_rifle(void) { weapon_defaultspawnfunc(WEP_RIFLE); }
+void spawnfunc_weapon_rifle(void) { weapon_defaultspawnfunc(WEP_RIFLE.m_id); }
void spawnfunc_weapon_campingrifle(void) { spawnfunc_weapon_rifle(); }
void spawnfunc_weapon_sniperrifle(void) { spawnfunc_weapon_rifle(); }
void W_Rifle_Attack(void)
{
- W_Rifle_FireBullet(WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), "weapons/campingrifle_fire.wav");
+ W_Rifle_FireBullet(WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), "weapons/campingrifle_fire.wav");
}
void W_Rifle_Attack2(void)
{
- W_Rifle_FireBullet(WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), "weapons/campingrifle_fire2.wav");
+ W_Rifle_FireBullet(WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), "weapons/campingrifle_fire2.wav");
}
.void(void) rifle_bullethail_attackfunc;
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(RIFLE) >= WEP_CVAR_PRI(rifle, ammo);
- ammo_amount += self.(weapon_load[WEP_RIFLE]) >= WEP_CVAR_PRI(rifle, ammo);
+ ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
{
ammo_amount = self.WEP_AMMO(RIFLE) >= WEP_CVAR_SEC(rifle, ammo);
- ammo_amount += self.(weapon_load[WEP_RIFLE]) >= WEP_CVAR_SEC(rifle, ammo);
+ ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
return ammo_amount;
}
case WR_CONFIG:
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_rpc() { weapon_defaultspawnfunc(WEP_RPC); }
+void spawnfunc_weapon_rpc() { weapon_defaultspawnfunc(WEP_RPC.m_id); }
void W_RocketPropelledChainsaw_Explode()
{
missile.damagedbycontents = true;
missile.movetype = MOVETYPE_FLY;
- missile.projectiledeathtype = WEP_RPC;
+ missile.projectiledeathtype = WEP_RPC.m_id;
setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
setorigin (missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(RPC) >= WEP_CVAR(rpc, ammo);
- ammo_amount += self.(weapon_load[WEP_RPC]) >= WEP_CVAR(rpc, ammo);
+ ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_seeker(void) { weapon_defaultspawnfunc(WEP_SEEKER); }
+void spawnfunc_weapon_seeker(void) { weapon_defaultspawnfunc(WEP_SEEKER.m_id); }
// ============================
// Begin: Missile functions, these are general functions to be manipulated by other code
//missile.think = W_Seeker_Missile_Animate; // csqc projectiles.
if(missile.enemy != world)
- missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
+ missile.projectiledeathtype = WEP_SEEKER.m_id | HITTYPE_SECONDARY;
else
- missile.projectiledeathtype = WEP_SEEKER;
+ missile.projectiledeathtype = WEP_SEEKER.m_id;
setorigin(missile, w_shotorg);
missile.nextthink = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
missile.solid = SOLID_BBOX;
missile.movetype = MOVETYPE_FLY;
- missile.projectiledeathtype = WEP_SEEKER;
- missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
+ missile.projectiledeathtype = WEP_SEEKER.m_id;
+ missile.projectiledeathtype = WEP_SEEKER.m_id | HITTYPE_SECONDARY;
missile.flags = FL_PROJECTILE;
missile.missile_flags = MIF_SPLASH;
entity oldself,oldenemy;
self.cnt = self.cnt - 1;
- if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.WEP_AMMO(SEEKER) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER))
+ if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.WEP_AMMO(SEEKER) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id))
{
remove(self);
return;
void W_Seeker_Tracker_Think(void)
{
// commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
- if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER)
+ if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id)
|| (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
{
if(self)
{
//if(other==self.realowner)
// return;
- Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER | HITTYPE_BOUNCE, other.species, self);
+ Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, self);
remove(self);
}
te_knightspike(org2);
self.event_damage = func_null;
- Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER | HITTYPE_BOUNCE | HITTYPE_SECONDARY, other.species, self);
+ Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, other.species, self);
if(other.takedamage == DAMAGE_AIM && other.deadflag == DEAD_NO)
{
if(WEP_CVAR(seeker, type) == 1)
{
ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, missile_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= WEP_CVAR(seeker, missile_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
}
else
{
ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, tag_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= WEP_CVAR(seeker, tag_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
}
return ammo_amount;
}
if(WEP_CVAR(seeker, type) == 1)
{
ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, tag_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= WEP_CVAR(seeker, tag_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
}
else
{
ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, flac_ammo);
- ammo_amount += self.(weapon_load[WEP_SEEKER]) >= WEP_CVAR(seeker, flac_ammo);
+ ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
}
return ammo_amount;
}
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
{
- weapon_defaultspawnfunc(WEP_MACHINEGUN);
+ weapon_defaultspawnfunc(WEP_MACHINEGUN.m_id);
return;
}
- weapon_defaultspawnfunc(WEP_SHOCKWAVE);
+ weapon_defaultspawnfunc(WEP_SHOCKWAVE.m_id);
}
const float MAX_SHOCKWAVE_HITS = 10;
self.realowner,
self.realowner,
swing_damage,
- (WEP_SHOCKWAVE | HITTYPE_SECONDARY),
+ (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY),
(self.realowner.origin + self.realowner.view_ofs),
(v_forward * WEP_CVAR(shockwave, melee_force))
);
// handle accuracy
if(accuracy_isgooddamage(self.realowner, target_victim))
- { accuracy_add(self.realowner, WEP_SHOCKWAVE, 0, swing_damage); }
+ { accuracy_add(self.realowner, WEP_SHOCKWAVE.m_id, 0, swing_damage); }
#ifdef DEBUG_SHOCKWAVE
print(sprintf(
WEP_CVAR(shockwave, blast_splash_edgedamage),
WEP_CVAR(shockwave, blast_splash_radius),
w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
- WEP_SHOCKWAVE,
+ WEP_SHOCKWAVE.m_id,
0,
self
);
self,
self,
final_damage,
- WEP_SHOCKWAVE,
+ WEP_SHOCKWAVE.m_id,
head.origin,
final_force
);
self,
self,
final_damage,
- WEP_SHOCKWAVE,
+ WEP_SHOCKWAVE.m_id,
head.origin,
final_force
);
if(accuracy_isgooddamage(self.realowner, head))
{
print("wtf\n");
- accuracy_add(self.realowner, WEP_SHOCKWAVE, 0, final_damage);
+ accuracy_add(self.realowner, WEP_SHOCKWAVE.m_id, 0, final_damage);
}
#ifdef DEBUG_SHOCKWAVE
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_shotgun(void) { weapon_defaultspawnfunc(WEP_SHOTGUN); }
+void spawnfunc_weapon_shotgun(void) { weapon_defaultspawnfunc(WEP_SHOTGUN.m_id); }
void W_Shotgun_Attack(float isprimary)
{
W_SetupShot(self, true, 5, "weapons/shotgun_fire.wav", ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN, 0);
+ fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo));
//print(strcat(self.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n"));
Damage(target_victim, self.realowner, self.realowner,
- swing_damage, WEP_SHOTGUN | HITTYPE_SECONDARY,
+ swing_damage, WEP_SHOTGUN.m_id | HITTYPE_SECONDARY,
self.realowner.origin + self.realowner.view_ofs,
v_forward * WEP_CVAR_SEC(shotgun, force));
- if(accuracy_isgooddamage(self.realowner, target_victim)) { accuracy_add(self.realowner, WEP_SHOTGUN, 0, swing_damage); }
+ if(accuracy_isgooddamage(self.realowner, target_victim)) { accuracy_add(self.realowner, WEP_SHOTGUN.m_id, 0, swing_damage); }
// draw large red flash for debugging
//te_customflash(targpos, 200, 2, '15 0 0');
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(SHOTGUN) >= WEP_CVAR_PRI(shotgun, ammo);
- ammo_amount += self.(weapon_load[WEP_SHOTGUN]) >= WEP_CVAR_PRI(shotgun, ammo);
+ ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
case 2: // secondary triple shot
{
ammo_amount = self.WEP_AMMO(SHOTGUN) >= WEP_CVAR_PRI(shotgun, ammo);
- ammo_amount += self.(weapon_load[WEP_SHOTGUN]) >= WEP_CVAR_PRI(shotgun, ammo);
+ ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
return ammo_amount;
}
default: return false; // secondary unavailable
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_tuba(void) { weapon_defaultspawnfunc(WEP_TUBA); }
+void spawnfunc_weapon_tuba(void) { weapon_defaultspawnfunc(WEP_TUBA.m_id); }
bool W_Tuba_HasPlayed(entity pl, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
{
self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(); // so it can get prolonged safely
//sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation);
- RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), world, world, WEP_CVAR(tuba, force), hittype | WEP_TUBA, world);
+ RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), world, world, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, world);
o = gettaginfo(self.exteriorweaponentity, 0);
if(time > self.tuba_smoketime)
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER); }
+void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
void W_Vaporizer_Attack(void)
yoda = 0;
damage_goodhits = 0;
- FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER);
+ FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
if(yoda && flying)
Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
// ugly instagib hack to reuse the fire mode of the laser
int oldwep = self.weapon; // we can't avoid this hack
- self.weapon = WEP_BLASTER;
+ self.weapon = WEP_BLASTER.m_id;
W_Blaster_Attack(
- WEP_BLASTER | HITTYPE_SECONDARY,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
WEP_CVAR_SEC(vaporizer, shotangle),
WEP_CVAR_SEC(vaporizer, damage),
WEP_CVAR_SEC(vaporizer, edgedamage),
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
- ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= vaporizer_ammo;
+ ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
return ammo_amount;
}
case WR_CHECKAMMO2:
if(!WEP_CVAR_SEC(vaporizer, ammo))
return true;
ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
- ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= WEP_CVAR_SEC(vaporizer, ammo);
+ ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
return ammo_amount;
}
case WR_CONFIG:
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_vortex(void) { weapon_defaultspawnfunc(WEP_VORTEX); }
+void spawnfunc_weapon_vortex(void) { weapon_defaultspawnfunc(WEP_VORTEX.m_id); }
void spawnfunc_weapon_nex(void) { spawnfunc_weapon_vortex(); }
void SendCSQCVortexBeamParticle(float charge) {
yoda = 0;
damage_goodhits = 0;
- FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX);
+ FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id);
if(yoda && flying)
Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
{
self.clip_load = max(WEP_CVAR_SEC(vortex, ammo), self.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
}
- self.(weapon_load[WEP_VORTEX]) = self.clip_load;
+ self.(weapon_load[WEP_VORTEX.m_id]) = self.clip_load;
}
else
{
case WR_CHECKAMMO1:
{
ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_PRI(vortex, ammo);
- ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX]) >= WEP_CVAR_PRI(vortex, ammo));
+ ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
return ammo_amount;
}
case WR_CHECKAMMO2:
{
// don't allow charging if we don't have enough ammo
ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_SEC(vortex, ammo);
- ammo_amount += self.(weapon_load[WEP_VORTEX]) >= WEP_CVAR_SEC(vortex, ammo);
+ ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
return ammo_amount;
}
else
else if(self.health>WEP_CVAR(devastator, damage)*0.5)
{
if(self.velocity.z < 0)
- if(client_hasweapon(self, WEP_DEVASTATOR, true, false))
+ if(client_hasweapon(self, WEP_DEVASTATOR.m_id, true, false))
{
self.movement_x = maxspeed;
return;
}
- self.switchweapon = WEP_DEVASTATOR;
+ self.switchweapon = WEP_DEVASTATOR.m_id;
self.v_angle_x = 90;
self.BUTTON_ATCK = true;
self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
// I want to do a second scan if no enemy was found or I don't have weapons
// TODO: Perform the scan when using the rifle (requires changes on the rifle code)
- if(best || self.weapons) // || self.weapon == WEP_RIFLE
+ if(best || self.weapons) // || self.weapon == WEP_RIFLE.m_id
break;
if(i)
break;
// ;)
if(g_weaponarena_weapons == WEPSET_TUBA)
{
- self.switchweapon = WEP_TUBA;
+ self.switchweapon = WEP_TUBA.m_id;
return;
}
{
// If no weapon was chosen get the first available weapon
if(self.weapon==0)
- for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER)
+ for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER.m_id)
{
if(client_hasweapon(self, i, true, false))
{
if(frametime)
{
- if(self.weapon == WEP_VORTEX && WEP_CVAR(vortex, charge))
+ if(self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge))
{
self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
self.weaponentity_glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
// WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
// It cannot be predicted by the engine!
- if((self.weapon == WEP_SHOCKWAVE || self.weapon == WEP_SHOTGUN) && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink)
+ if((self.weapon == WEP_SHOCKWAVE.m_id || self.weapon == WEP_SHOTGUN.m_id) && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink)
do_crouch = 0;
if (do_crouch)
// WEAPONTODO: Add weapon request for this
if(!zoomstate_set)
- SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_VORTEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)); // WEAPONTODO
+ SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_VORTEX.m_id) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE.m_id && WEP_CVAR(rifle, secondary) == 0)); // WEAPONTODO
float oldspectatee_status;
oldspectatee_status = self.spectatee_status;
damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0));
}
- if(DEATH_ISWEAPON(deathtype, WEP_TUBA))
+ if(DEATH_ISWEAPON(deathtype, WEP_TUBA.m_id))
{
// tuba causes blood to come out of the ears
vector ear1, ear2;
else if(!(attacker.weapons & WepSet_FromWeapon(culprit)))
culprit = attacker.weapon;
- if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator?
+ if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER.m_id) // WEAPONTODO: Shouldn't this be in a mutator?
{
// no exchange
}
RemoveGrapplingHook(targ); // STOP THAT, you parasite!
// special rule: gravity bomb does not hit team mates (other than for disconnecting the hook)
- if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA))
+ if(DEATH_ISWEAPON(deathtype, WEP_HOOK.m_id) || DEATH_ISWEAPON(deathtype, WEP_TUBA.m_id))
{
if(IS_PLAYER(targ))
if(SAME_TEAM(targ, attacker))
total_damage_to_creatures = 0;
- if(deathtype != (WEP_HOOK | HITTYPE_SECONDARY | HITTYPE_BOUNCE)) // only send gravity bomb damage once
- if(DEATH_WEAPONOF(deathtype) != WEP_TUBA) // do not send tuba damage (bandwidth hog)
+ if(deathtype != (WEP_HOOK.m_id | HITTYPE_SECONDARY | HITTYPE_BOUNCE)) // only send gravity bomb damage once
+ if(DEATH_WEAPONOF(deathtype) != WEP_TUBA.m_id) // do not send tuba damage (bandwidth hog)
{
force = inflictorvelocity;
if(vlen(force) == 0)
force = force * (finaldmg / coredamage) * forceintensity;
hitloc = nearest;
- if(deathtype & WEP_BLASTER)
+ if(deathtype & WEP_BLASTER.m_id)
force *= WEP_CVAR_BOTH(blaster, !(deathtype & HITTYPE_SECONDARY), force_zscale);
if(targ != directhitentity)
void GrapplingHookFrame()
{
- if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK)
+ if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK.m_id)
{
// offhand hook controls
if(self.BUTTON_HOOK)
//self.hook_state &= ~HOOK_RELEASING;
}
}
- else if(!g_grappling_hook && self.switchweapon != WEP_HOOK)
+ else if(!g_grappling_hook && self.switchweapon != WEP_HOOK.m_id)
{
if(self.BUTTON_HOOK && !self.hook_switchweapon)
- W_SwitchWeapon(WEP_HOOK);
+ W_SwitchWeapon(WEP_HOOK.m_id);
}
self.hook_switchweapon = self.BUTTON_HOOK;
- if(!g_grappling_hook && self.weapon != WEP_HOOK)
+ if(!g_grappling_hook && self.weapon != WEP_HOOK.m_id)
{
self.hook_state &= ~HOOK_FIRING;
self.hook_state |= HOOK_REMOVING;
}
else
{
- WEP_ACTION(WEP_HOOK, WR_INIT);
- hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 1);
- hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 2);
- hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 3);
- hook_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 4);
+ WEP_ACTION(WEP_HOOK.m_id, WR_INIT);
+ hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 1);
+ hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 2);
+ hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 3);
+ hook_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 4);
}
}
d = false;
}
else if (g_cts)
- d = (i == WEP_SHOTGUN);
+ d = (i == WEP_SHOTGUN.m_id);
else if (g_nexball)
d = 0; // weapon is set a few lines later
else
d = !(!weaponinfo.weaponstart);
if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook
- d |= (i == WEP_HOOK);
+ d |= (i == WEP_HOOK.m_id);
if(!g_cts && (weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED)) // never default mutator blocked guns
d = 0;
self.weaponentity.weapons = self.weapons;
self.weaponentity.switchweapon = self.weapon;
self.weapons = WEPSET_PORTO;
- WEP_ACTION(WEP_PORTO, WR_RESETPLAYER);
- self.switchweapon = WEP_PORTO;
- W_SwitchWeapon(WEP_PORTO);
+ WEP_ACTION(WEP_PORTO.m_id, WR_RESETPLAYER);
+ self.switchweapon = WEP_PORTO.m_id;
+ W_SwitchWeapon(WEP_PORTO.m_id);
self = ownr;
}
}
else if(req == WR_SETUP)
{
- //weapon_setup(WEP_PORTO);
+ //weapon_setup(WEP_PORTO.m_id);
}
// No need to check WR_CHECKAMMO* or WR_AIM, it should always return true
return true;
if(self.weaponentity.weapons)
{
self.weapons = self.weaponentity.weapons;
- WEP_ACTION(WEP_PORTO, WR_RESETPLAYER);
+ WEP_ACTION(WEP_PORTO.m_id, WR_RESETPLAYER);
self.switchweapon = self.weaponentity.switchweapon;
W_SwitchWeapon(self.switchweapon);
MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing)
{
- if(self.weapon == WEP_MORTAR)
+ if(self.weapon == WEP_MORTAR.m_id)
return true;
return false;
MUTATOR_HOOKFUNCTION(nexball_FilterItem)
{
if(self.classname == "droppedweapon")
- if(self.weapon == WEP_MORTAR)
+ if(self.weapon == WEP_MORTAR.m_id)
return true;
return false;
frag_target.buff_disability_time = time + autocvar_g_buffs_disability_slowtime;
if(frag_attacker.buffs & BUFF_MEDIC.m_itemid)
- if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC)
+ if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC.m_id)
if(SAME_TEAM(frag_attacker, frag_target))
if(frag_attacker != frag_target)
{
// this... is ridiculous (TODO: fix!)
if(frag_attacker.buffs & BUFF_VAMPIRE.m_itemid)
if(!frag_target.vehicle)
- if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC)
+ if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC.m_id)
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
if(frag_target.deadflag == DEAD_NO)
if(IS_PLAYER(frag_target) || (frag_target.flags & FL_MONSTER))
}
if(IS_PLAYER(frag_attacker))
- if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
+ if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id))
{
if(frag_target.armorvalue)
{
}
}
- if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
+ if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id))
{
if(frag_deathtype & HITTYPE_SECONDARY)
{
if(self.classname == "item_cells")
return true; // no normal cells?
- if(self.weapon == WEP_VAPORIZER && self.classname == "droppedweapon")
+ if(self.weapon == WEP_VAPORIZER.m_id && self.classname == "droppedweapon")
{
self.ammo_cells = autocvar_g_instagib_ammo_drop;
return false;
}
- if(self.weapon == WEP_DEVASTATOR || self.weapon == WEP_VORTEX)
+ if(self.weapon == WEP_DEVASTATOR.m_id || self.weapon == WEP_VORTEX.m_id)
{
entity e = spawn();
setorigin(e, self.origin);
if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id)
return;
- if(DEATH_ISWEAPON(deathtype, WEP_BLASTER))
+ if(DEATH_ISWEAPON(deathtype, WEP_BLASTER.m_id))
{
force *= 1.5;
damage = 0;
}
- if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) && (deathtype & HITTYPE_SECONDARY))
+ if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER.m_id) && (deathtype & HITTYPE_SECONDARY))
{
force *= 0.5; // too much
frag_damage = 0;
}
- if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
+ if(DEATH_ISWEAPON(deathtype, WEP_VORTEX.m_id) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER.m_id))
{
force *= 6;
damage = self.max_health * 0.55;
}
- if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN) || DEATH_ISWEAPON(deathtype, WEP_HMG))
+ if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN.m_id) || DEATH_ISWEAPON(deathtype, WEP_HMG.m_id))
damage = self.max_health * 0.1;
- if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO
+ if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE.m_id) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN.m_id)) // WEAPONTODO
if(deathtype & HITTYPE_SECONDARY)
{
damage = self.max_health * 0.1;
float key_pressed = self.BUTTON_HOOK;
float time_score;
- if(g_grappling_hook || client_hasweapon(self, WEP_HOOK, false, false) || (weaponsInMap & WEPSET_HOOK))
+ if(g_grappling_hook || client_hasweapon(self, WEP_HOOK.m_id, false, false) || (weaponsInMap & WEPSET_HOOK))
key_pressed = self.button16; // if hook is enabled, use an alternate key
if(self.nade)
{
switch(w)
{
- case WEP_SEEKER:
- case WEP_MINE_LAYER:
- case WEP_HLAC:
- case WEP_RIFLE:
- case WEP_SHOCKWAVE:
+ case WEP_SEEKER.m_id:
+ case WEP_MINE_LAYER.m_id:
+ case WEP_HLAC.m_id:
+ case WEP_RIFLE.m_id:
+ case WEP_SHOCKWAVE.m_id:
return true;
default:
return false;
}
else
{
- if(wpn == WEP_BLASTER && g_nix_with_blaster) // WEAPONTODO: rename to g_nix_with_blaster
+ if(wpn == WEP_BLASTER.m_id && g_nix_with_blaster) // WEAPONTODO: rename to g_nix_with_blaster
return false;
if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
return false;
MUTATOR_HOOKFUNCTION(ok_PlayerDamage_Calculate)
{
if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target))
- if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
+ if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id))
{
frag_damage = 0;
makevectors(self.v_angle);
int oldwep = self.weapon;
- self.weapon = WEP_BLASTER;
+ self.weapon = WEP_BLASTER.m_id;
W_Blaster_Attack(
- WEP_BLASTER | HITTYPE_SECONDARY,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
WEP_CVAR_SEC(vaporizer, shotangle),
WEP_CVAR_SEC(vaporizer, damage),
WEP_CVAR_SEC(vaporizer, edgedamage),
{
WepSet ok_start_items = (WEPSET_MACHINEGUN | WEPSET_VORTEX | WEPSET_SHOTGUN);
- if((get_weaponinfo(WEP_RPC)).weaponstart > 0) { ok_start_items |= WEPSET_RPC; }
- if((get_weaponinfo(WEP_HMG)).weaponstart > 0) { ok_start_items |= WEPSET_HMG; }
+ if((get_weaponinfo(WEP_RPC.m_id)).weaponstart > 0) { ok_start_items |= WEPSET_RPC; }
+ if((get_weaponinfo(WEP_HMG.m_id)).weaponstart > 0) { ok_start_items |= WEPSET_HMG; }
start_items |= IT_UNLIMITED_WEAPON_AMMO;
start_weapons = warmup_start_weapons = ok_start_items;
addstat(STAT_OK_AMMO_CHARGE, AS_FLOAT, ok_use_ammocharge);
addstat(STAT_OK_AMMO_CHARGEPOOL, AS_FLOAT, ok_ammo_charge);
- (get_weaponinfo(WEP_RPC)).spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
- (get_weaponinfo(WEP_HMG)).spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+ (get_weaponinfo(WEP_RPC.m_id)).spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+ (get_weaponinfo(WEP_HMG.m_id)).spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
- (get_weaponinfo(WEP_SHOTGUN)).mdl = "ok_shotgun";
- (get_weaponinfo(WEP_MACHINEGUN)).mdl = "ok_mg";
- (get_weaponinfo(WEP_VORTEX)).mdl = "ok_sniper";
+ (get_weaponinfo(WEP_SHOTGUN.m_id)).mdl = "ok_shotgun";
+ (get_weaponinfo(WEP_MACHINEGUN.m_id)).mdl = "ok_mg";
+ (get_weaponinfo(WEP_VORTEX.m_id)).mdl = "ok_sniper";
}
MUTATOR_DEFINITION(mutator_overkill)
MUTATOR_ONREMOVE
{
- (get_weaponinfo(WEP_RPC)).spawnflags |= WEP_FLAG_MUTATORBLOCKED;
- (get_weaponinfo(WEP_HMG)).spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+ (get_weaponinfo(WEP_RPC.m_id)).spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+ (get_weaponinfo(WEP_HMG.m_id)).spawnflags |= WEP_FLAG_MUTATORBLOCKED;
}
return false;
self.dmg_time = time;
// WEAPONTODO
- if(DEATH_ISWEAPON(deathtype, WEP_VORTEX))
+ if(DEATH_ISWEAPON(deathtype, WEP_VORTEX.m_id))
damage *= autocvar_g_vehicles_vortex_damagerate;
- if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN))
+ if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN.m_id))
damage *= autocvar_g_vehicles_machinegun_damagerate;
- if(DEATH_ISWEAPON(deathtype, WEP_RIFLE))
+ if(DEATH_ISWEAPON(deathtype, WEP_RIFLE.m_id))
damage *= autocvar_g_vehicles_rifle_damagerate;
- if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
+ if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER.m_id))
damage *= autocvar_g_vehicles_vaporizer_damagerate;
- if(DEATH_ISWEAPON(deathtype, WEP_SEEKER))
+ if(DEATH_ISWEAPON(deathtype, WEP_SEEKER.m_id))
damage *= autocvar_g_vehicles_tag_damagerate;
self.enemy = attacker;
if(time < self.hasweapon_complain_spam)
complain = 0;
- if(wpn == WEP_HOOK && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
+ if(wpn == WEP_HOOK.m_id && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
complain = 0;
if(complain)
// always allow selecting the Mine Layer if we placed mines, so that we can detonate them
entity mine;
- if(wpn == WEP_MINE_LAYER)
+ if(wpn == WEP_MINE_LAYER.m_id)
for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
f = 1;
return 0;
if (g_cts)
return 0;
- if (g_nexball && w == WEP_MORTAR)
+ if (g_nexball && w == WEP_MORTAR.m_id)
return 0;
if(w == 0)
return 0;
float oldsolid;
vector vecs, dv;
oldsolid = ent.dphitcontentsmask;
- if(ent.weapon == WEP_RIFLE)
+ if(ent.weapon == WEP_RIFLE.m_id)
ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
else
ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
//explosion = spawn();
// Find all non-hit players the beam passed close by
- if(deathtype == WEP_VAPORIZER || deathtype == WEP_VORTEX)
+ if(deathtype == WEP_VAPORIZER.m_id || deathtype == WEP_VORTEX.m_id)
{
FOR_EACH_REALCLIENT(msg_entity)
if(msg_entity != self)
{
// always keep the Mine Layer if we placed mines, so that we can detonate them
entity mine;
- if(self.weapon == WEP_MINE_LAYER)
+ if(self.weapon == WEP_MINE_LAYER.m_id)
for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
return false;
- if(self.weapon == WEP_SHOTGUN)
+ if(self.weapon == WEP_SHOTGUN.m_id)
if(!secondary && WEP_CVAR(shotgun, secondary) == 1)
return false; // no clicking, just allow
if((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
{
- if((self.weapon == WEP_SHOCKWAVE || self.weapon == WEP_SHOTGUN) && fr == WFRAME_FIRE2)
+ if((self.weapon == WEP_SHOCKWAVE.m_id || self.weapon == WEP_SHOTGUN.m_id) && fr == WFRAME_FIRE2)
animdecide_setaction(self, ANIMACTION_MELEE, restartanim);
else
animdecide_setaction(self, ANIMACTION_SHOOT, restartanim);