From: TimePath Date: Fri, 14 Aug 2015 09:50:48 +0000 (+1000) Subject: s/WEP_(ID)/WEP_$1.m_id/ X-Git-Tag: xonotic-v0.8.2~2062^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ca811d45f7e7b64a01657b2252cab3cfdfedd970;p=xonotic%2Fxonotic-data.pk3dir.git s/WEP_(ID)/WEP_$1.m_id/ --- diff --git a/qcsrc/Makefile b/qcsrc/Makefile index f53707e82..26797c55a 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -13,7 +13,7 @@ QCCFLAGS ?= \ -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) diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 3626c44c6..70df439ef 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -357,7 +357,7 @@ void Ent_DamageInfo(float isNew) 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); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index df8113b41..2d4bff52a 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -34,7 +34,7 @@ void Porto_Draw() 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; @@ -133,7 +133,7 @@ vector GetCurrentFov(float fov) 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()) { @@ -320,16 +320,16 @@ float TrueAimCheck() 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) @@ -338,19 +338,19 @@ float TrueAimCheck() 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; @@ -439,7 +439,7 @@ bool WantEventchase() 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)) { @@ -490,7 +490,7 @@ void UpdateHitsound() 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) @@ -837,7 +837,7 @@ void UpdateCrosshair() // 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; @@ -857,14 +857,14 @@ void UpdateCrosshair() 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; @@ -887,12 +887,12 @@ void UpdateCrosshair() // 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 + diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 986a0e10f..85a5fb0e7 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -226,7 +226,7 @@ float m_shambler(float req) 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; } diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 239f8fe9a..7b963bc9e 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -362,7 +362,7 @@ void Monster_CheckMinibossFlag () self.health += autocvar_g_monsters_miniboss_healthboost; self.effects |= EF_RED; if(!self.weapon) - self.weapon = WEP_VORTEX; + self.weapon = WEP_VORTEX.m_id; } } diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 6153d80ae..a4cdc6f67 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -1193,7 +1193,7 @@ void PM_check_vortex(void) #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)); diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index b873f8fe1..1f1efd390 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -68,7 +68,7 @@ WepSet ReadWepSet(); 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; @@ -101,7 +101,7 @@ int GetAmmoStat(.int ammotype); // 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) @@ -133,7 +133,7 @@ int GetAmmoStat(.int ammotype); // 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; // ===================== @@ -211,15 +211,14 @@ entity weapon_info[WEP_MAXCOUNT], weapon_info_first, weapon_info_last; 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; } diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index d661f4eba..7146b8386 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -126,7 +126,7 @@ vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as #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) { @@ -274,7 +274,7 @@ void W_Arc_Beam_Think(void) 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 @@ -531,7 +531,7 @@ void W_Arc_Beam_Think(void) { accuracy_add( self.owner, - WEP_ARC, + WEP_ARC.m_id, 0, rootdamage * coefficient * falloff ); @@ -542,7 +542,7 @@ void W_Arc_Beam_Think(void) self.owner, self.owner, rootdamage * coefficient * falloff, - WEP_ARC, + WEP_ARC.m_id, hitorigin, WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff ); @@ -630,7 +630,7 @@ void Arc_Smoke() } 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); @@ -731,10 +731,10 @@ bool W_Arc(int req) 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; @@ -767,7 +767,7 @@ bool W_Arc(int req) } 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; diff --git a/qcsrc/common/weapons/w_blaster.qc b/qcsrc/common/weapons/w_blaster.qc index 2d582c6c0..4576b4b2a 100644 --- a/qcsrc/common/weapons/w_blaster.qc +++ b/qcsrc/common/weapons/w_blaster.qc @@ -48,7 +48,7 @@ BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) @@ -174,7 +174,7 @@ bool W_Blaster(int request) 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), @@ -194,7 +194,7 @@ bool W_Blaster(int request) { 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; } @@ -204,7 +204,7 @@ bool W_Blaster(int request) 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), diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index 718dbed31..b5e50553a 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -64,7 +64,7 @@ CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) { @@ -392,7 +392,7 @@ void W_Crylink_Attack(void) 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); @@ -501,7 +501,7 @@ void W_Crylink_Attack2(void) 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); @@ -628,7 +628,7 @@ bool W_Crylink(int req) 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); } } @@ -654,7 +654,7 @@ bool W_Crylink(int req) 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: @@ -664,7 +664,7 @@ bool W_Crylink(int req) 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: diff --git a/qcsrc/common/weapons/w_devastator.qc b/qcsrc/common/weapons/w_devastator.qc index f6dcba033..1518426ea 100644 --- a/qcsrc/common/weapons/w_devastator.qc +++ b/qcsrc/common/weapons/w_devastator.qc @@ -62,7 +62,7 @@ DEVASTATOR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) @@ -101,12 +101,12 @@ void W_Devastator_Explode(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); } @@ -180,12 +180,12 @@ void W_Devastator_DoRemoteExplode(void) 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); } @@ -261,7 +261,7 @@ void W_Devastator_Think(void) 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) @@ -365,7 +365,7 @@ void W_Devastator_Attack(void) 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 @@ -547,7 +547,7 @@ bool W_Devastator(int req) 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) @@ -589,12 +589,12 @@ bool W_Devastator(int req) { #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)) @@ -611,13 +611,13 @@ bool W_Devastator(int req) 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 } diff --git a/qcsrc/common/weapons/w_electro.qc b/qcsrc/common/weapons/w_electro.qc index 05e696987..fa8fd26e6 100644 --- a/qcsrc/common/weapons/w_electro.qc +++ b/qcsrc/common/weapons/w_electro.qc @@ -67,7 +67,7 @@ void W_Electro_ExplodeCombo(void); #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) { @@ -131,7 +131,7 @@ void W_Electro_ExplodeCombo(void) 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 ); @@ -272,7 +272,7 @@ void W_Electro_Attack_Bolt(void) 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; @@ -371,7 +371,7 @@ void W_Electro_Attack_Orb(void) 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; @@ -512,7 +512,7 @@ bool W_Electro(int req) 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: @@ -520,12 +520,12 @@ bool W_Electro(int req) 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; } diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index 3129a0da5..32ae555e4 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -55,7 +55,7 @@ FIREBALL_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) { @@ -97,7 +97,7 @@ 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); @@ -201,7 +201,7 @@ void W_Fireball_Attack1(void) 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; @@ -328,7 +328,7 @@ void W_Fireball_Attack2(void) 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'); diff --git a/qcsrc/common/weapons/w_hagar.qc b/qcsrc/common/weapons/w_hagar.qc index 44fab91e0..172fd832b 100644 --- a/qcsrc/common/weapons/w_hagar.qc +++ b/qcsrc/common/weapons/w_hagar.qc @@ -56,7 +56,7 @@ HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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! @@ -148,7 +148,7 @@ void W_Hagar_Attack(void) 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'); @@ -192,7 +192,7 @@ void W_Hagar_Attack2(void) 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'); @@ -251,7 +251,7 @@ void W_Hagar_Attack2_Load_Release(void) 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; @@ -303,7 +303,7 @@ void W_Hagar_Attack2_Load(void) 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); @@ -473,13 +473,13 @@ bool W_Hagar(int 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: diff --git a/qcsrc/common/weapons/w_hlac.qc b/qcsrc/common/weapons/w_hlac.qc index 8c5a03526..b6b48918d 100644 --- a/qcsrc/common/weapons/w_hlac.qc +++ b/qcsrc/common/weapons/w_hlac.qc @@ -48,7 +48,7 @@ HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) { @@ -107,7 +107,7 @@ void W_HLAC_Attack(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); @@ -151,7 +151,7 @@ void W_HLAC_Attack2(void) 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); @@ -251,13 +251,13 @@ bool W_HLAC(int req) 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: diff --git a/qcsrc/common/weapons/w_hmg.qc b/qcsrc/common/weapons/w_hmg.qc index e01034442..de6df9767 100644 --- a/qcsrc/common/weapons/w_hmg.qc +++ b/qcsrc/common/weapons/w_hmg.qc @@ -41,7 +41,7 @@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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() { @@ -70,7 +70,7 @@ 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; @@ -131,7 +131,7 @@ bool W_HeavyMachineGun(int req) 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; } @@ -140,7 +140,7 @@ bool W_HeavyMachineGun(int req) 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; } diff --git a/qcsrc/common/weapons/w_hook.qc b/qcsrc/common/weapons/w_hook.qc index d833f8d17..7b08621d4 100644 --- a/qcsrc/common/weapons/w_hook.qc +++ b/qcsrc/common/weapons/w_hook.qc @@ -67,7 +67,7 @@ void spawnfunc_weapon_hook(void) remove(self); return; } - weapon_defaultspawnfunc(WEP_HOOK); + weapon_defaultspawnfunc(WEP_HOOK.m_id); } void W_Hook_ExplodeThink(void) @@ -143,7 +143,7 @@ void W_Hook_Attack2(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'); diff --git a/qcsrc/common/weapons/w_machinegun.qc b/qcsrc/common/weapons/w_machinegun.qc index 7e2cc5278..92629a0bd 100644 --- a/qcsrc/common/weapons/w_machinegun.qc +++ b/qcsrc/common/weapons/w_machinegun.qc @@ -60,10 +60,10 @@ void spawnfunc_weapon_machinegun(void) 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(); } @@ -152,7 +152,7 @@ void W_MachineGun_Attack_Frame(void) 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 @@ -188,7 +188,7 @@ void W_MachineGun_Attack_Auto(void) } 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; @@ -213,7 +213,7 @@ void W_MachineGun_Attack_Burst(void) 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); @@ -287,7 +287,7 @@ bool W_MachineGun(int req) 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); } @@ -295,7 +295,7 @@ bool W_MachineGun(int req) 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); } } @@ -322,9 +322,9 @@ bool W_MachineGun(int req) 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; } @@ -338,9 +338,9 @@ bool W_MachineGun(int req) 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; } diff --git a/qcsrc/common/weapons/w_minelayer.qc b/qcsrc/common/weapons/w_minelayer.qc index dd449e839..666e13b4c 100644 --- a/qcsrc/common/weapons/w_minelayer.qc +++ b/qcsrc/common/weapons/w_minelayer.qc @@ -57,7 +57,7 @@ void W_MineLayer_Think(void); #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) { @@ -120,14 +120,14 @@ void W_MineLayer_Explode(void) 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); } @@ -147,14 +147,14 @@ void W_MineLayer_DoRemoteExplode(void) 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); } @@ -262,7 +262,7 @@ void W_MineLayer_Think(void) } // 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(); @@ -348,7 +348,7 @@ void W_MineLayer_Attack(void) 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 @@ -549,10 +549,10 @@ bool W_MineLayer(int req) 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; diff --git a/qcsrc/common/weapons/w_mortar.qc b/qcsrc/common/weapons/w_mortar.qc index 615c30c59..cf37372db 100644 --- a/qcsrc/common/weapons/w_mortar.qc +++ b/qcsrc/common/weapons/w_mortar.qc @@ -56,7 +56,7 @@ MORTAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) @@ -242,7 +242,7 @@ void W_Mortar_Attack(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'); @@ -291,7 +291,7 @@ void W_Mortar_Attack2(void) 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'); @@ -422,13 +422,13 @@ bool W_Mortar(int req) 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: diff --git a/qcsrc/common/weapons/w_porto.qc b/qcsrc/common/weapons/w_porto.qc index f3976fc6a..40f38256f 100644 --- a/qcsrc/common/weapons/w_porto.qc +++ b/qcsrc/common/weapons/w_porto.qc @@ -41,7 +41,7 @@ PORTO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) { @@ -83,7 +83,7 @@ void W_Porto_Fail(float failhard) 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); } } diff --git a/qcsrc/common/weapons/w_rifle.qc b/qcsrc/common/weapons/w_rifle.qc index eb80215bc..fc8f60ec4 100644 --- a/qcsrc/common/weapons/w_rifle.qc +++ b/qcsrc/common/weapons/w_rifle.qc @@ -47,7 +47,7 @@ RIFLE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); } @@ -76,12 +76,12 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolid 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; @@ -215,13 +215,13 @@ bool W_Rifle(int req) 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: diff --git a/qcsrc/common/weapons/w_rpc.qc b/qcsrc/common/weapons/w_rpc.qc index f26649b8b..6e0d44007 100644 --- a/qcsrc/common/weapons/w_rpc.qc +++ b/qcsrc/common/weapons/w_rpc.qc @@ -45,7 +45,7 @@ RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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() { @@ -123,7 +123,7 @@ void W_RocketPropelledChainsaw_Attack (void) 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 @@ -193,7 +193,7 @@ bool W_RocketPropelledChainsaw(int req) 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: diff --git a/qcsrc/common/weapons/w_seeker.qc b/qcsrc/common/weapons/w_seeker.qc index f3d1ea836..a4a430982 100644 --- a/qcsrc/common/weapons/w_seeker.qc +++ b/qcsrc/common/weapons/w_seeker.qc @@ -84,7 +84,7 @@ SEEKER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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 @@ -277,9 +277,9 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target) //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); @@ -357,8 +357,8 @@ void W_Seeker_Fire_Flac(void) 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; @@ -417,7 +417,7 @@ void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Atta 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; @@ -456,7 +456,7 @@ void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Atta 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) @@ -478,7 +478,7 @@ void W_Seeker_Tag_Explode(void) { //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); } @@ -506,7 +506,7 @@ void W_Seeker_Tag_Touch(void) 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) { @@ -677,12 +677,12 @@ bool W_Seeker(int req) 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; } @@ -691,12 +691,12 @@ bool W_Seeker(int req) 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; } diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index 1c0be5503..592f200b9 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -88,10 +88,10 @@ void spawnfunc_weapon_shockwave(void) 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; @@ -179,14 +179,14 @@ void W_Shockwave_Melee_Think(void) 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( @@ -376,7 +376,7 @@ void W_Shockwave_Attack(void) 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 ); @@ -456,7 +456,7 @@ void W_Shockwave_Attack(void) self, self, final_damage, - WEP_SHOCKWAVE, + WEP_SHOCKWAVE.m_id, head.origin, final_force ); @@ -640,7 +640,7 @@ void W_Shockwave_Attack(void) self, self, final_damage, - WEP_SHOCKWAVE, + WEP_SHOCKWAVE.m_id, head.origin, final_force ); @@ -648,7 +648,7 @@ void W_Shockwave_Attack(void) 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 diff --git a/qcsrc/common/weapons/w_shotgun.qc b/qcsrc/common/weapons/w_shotgun.qc index fb03b986f..1d91689e5 100644 --- a/qcsrc/common/weapons/w_shotgun.qc +++ b/qcsrc/common/weapons/w_shotgun.qc @@ -52,7 +52,7 @@ SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) { @@ -63,7 +63,7 @@ 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)); @@ -143,11 +143,11 @@ void W_Shotgun_Melee_Think(void) //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'); @@ -304,7 +304,7 @@ float W_Shotgun(float req) 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: @@ -318,7 +318,7 @@ float W_Shotgun(float req) 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 diff --git a/qcsrc/common/weapons/w_tuba.qc b/qcsrc/common/weapons/w_tuba.qc index d8d3cf0e0..48b92137c 100644 --- a/qcsrc/common/weapons/w_tuba.qc +++ b/qcsrc/common/weapons/w_tuba.qc @@ -54,7 +54,7 @@ float W_Tuba_MarkClientOnlyFieldsAsUsed() { #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) { @@ -358,7 +358,7 @@ void W_Tuba_NoteOn(float hittype) 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) diff --git a/qcsrc/common/weapons/w_vaporizer.qc b/qcsrc/common/weapons/w_vaporizer.qc index 83ebcf0ec..e96725b1e 100644 --- a/qcsrc/common/weapons/w_vaporizer.qc +++ b/qcsrc/common/weapons/w_vaporizer.qc @@ -49,7 +49,7 @@ VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) @@ -64,7 +64,7 @@ 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); @@ -166,9 +166,9 @@ float W_Vaporizer(float req) // 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), @@ -211,7 +211,7 @@ float W_Vaporizer(float req) 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: @@ -219,7 +219,7 @@ float W_Vaporizer(float req) 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: diff --git a/qcsrc/common/weapons/w_vortex.qc b/qcsrc/common/weapons/w_vortex.qc index d29264a19..0b0dc3013 100644 --- a/qcsrc/common/weapons/w_vortex.qc +++ b/qcsrc/common/weapons/w_vortex.qc @@ -59,7 +59,7 @@ VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) { @@ -111,7 +111,7 @@ void W_Vortex_Attack(float issecondary) 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); @@ -215,7 +215,7 @@ bool W_Vortex(int req) { 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 { @@ -273,7 +273,7 @@ bool W_Vortex(int req) 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: @@ -282,7 +282,7 @@ bool W_Vortex(int req) { // 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 diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 9fa166709..fcf1c04d2 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -600,7 +600,7 @@ void havocbot_movetogoal() 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; @@ -614,7 +614,7 @@ void havocbot_movetogoal() 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); @@ -930,7 +930,7 @@ void havocbot_chooseenemy() // 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; @@ -980,7 +980,7 @@ void havocbot_chooseweapon() // ;) if(g_weaponarena_weapons == WEPSET_TUBA) { - self.switchweapon = WEP_TUBA; + self.switchweapon = WEP_TUBA.m_id; return; } @@ -989,7 +989,7 @@ void havocbot_chooseweapon() { // 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)) { diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 6d3d786ae..388650926 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -2367,7 +2367,7 @@ void PlayerPreThink (void) 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)); @@ -2463,7 +2463,7 @@ void PlayerPreThink (void) // 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) @@ -2540,7 +2540,7 @@ void PlayerPreThink (void) // 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; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index aae39ea66..850609992 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -322,7 +322,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp 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; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index c5bbfcab5..23b682310 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -107,7 +107,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) 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 } @@ -651,7 +651,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d 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)) @@ -967,8 +967,8 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in 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) @@ -1029,7 +1029,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in 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) diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 7a127edda..3fab00f0e 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -394,7 +394,7 @@ void FireGrapplingHook (void) 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) @@ -423,14 +423,14 @@ void GrapplingHookFrame() //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; @@ -492,11 +492,11 @@ void GrappleHookInit() } 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); } } diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 2354e128e..f8b29d2d4 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -516,14 +516,14 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne 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; diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 9844875b3..2fdde9883 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -158,9 +158,9 @@ void GiveBall(entity plyr, entity ball) 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; } @@ -873,7 +873,7 @@ float w_nexball_weapon(float req) } 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; @@ -936,7 +936,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) 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); @@ -982,7 +982,7 @@ MUTATOR_HOOKFUNCTION(nexball_SetStartItems) MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) { - if(self.weapon == WEP_MORTAR) + if(self.weapon == WEP_MORTAR.m_id) return true; return false; @@ -991,7 +991,7 @@ MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) MUTATOR_HOOKFUNCTION(nexball_FilterItem) { if(self.classname == "droppedweapon") - if(self.weapon == WEP_MORTAR) + if(self.weapon == WEP_MORTAR.m_id) return true; return false; diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index 170f59874..0f483abaf 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -469,7 +469,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate) 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) { @@ -493,7 +493,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate) // 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)) diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index b2d9ee269..cd2cc4a6b 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -250,7 +250,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) } 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) { @@ -262,7 +262,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) } } - 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) { @@ -319,13 +319,13 @@ MUTATOR_HOOKFUNCTION(instagib_FilterItem) 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); diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index f4267716e..a164bd1ce 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -608,28 +608,28 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, 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; @@ -929,7 +929,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink) 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) diff --git a/qcsrc/server/mutators/mutator_new_toys.qc b/qcsrc/server/mutators/mutator_new_toys.qc index d52bd09ee..78875cb70 100644 --- a/qcsrc/server/mutators/mutator_new_toys.qc +++ b/qcsrc/server/mutators/mutator_new_toys.qc @@ -87,11 +87,11 @@ float nt_IsNewToy(float w) { 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; diff --git a/qcsrc/server/mutators/mutator_nix.qc b/qcsrc/server/mutators/mutator_nix.qc index 42a490b00..aa3ff38f8 100644 --- a/qcsrc/server/mutators/mutator_nix.qc +++ b/qcsrc/server/mutators/mutator_nix.qc @@ -24,7 +24,7 @@ float NIX_CanChooseWeapon(float wpn) } 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; diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index 39b244a72..3659255ac 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -46,7 +46,7 @@ float ok_CheckWeaponCharge(entity ent, int wep) 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; @@ -148,9 +148,9 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink) 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), @@ -275,8 +275,8 @@ MUTATOR_HOOKFUNCTION(ok_StartItems) { 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; @@ -334,12 +334,12 @@ void ok_Initialize() 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) @@ -367,8 +367,8 @@ 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; diff --git a/qcsrc/server/vehicles/vehicle.qc b/qcsrc/server/vehicles/vehicle.qc index e6a0f9c0e..cf9695a94 100644 --- a/qcsrc/server/vehicles/vehicle.qc +++ b/qcsrc/server/vehicles/vehicle.qc @@ -904,19 +904,19 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, int deatht 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; diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 89c4253a1..94093438c 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -26,7 +26,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) 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) @@ -55,7 +55,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float 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; diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index d14bcfd1c..89ec52f21 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -144,7 +144,7 @@ float W_IsWeaponThrowable(float w) 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; diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 98cbb2ba8..49f6fdde7 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -25,7 +25,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m 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; @@ -273,7 +273,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f //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) diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 4f072c4c0..a2d924c95 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -476,11 +476,11 @@ float weapon_prepareattack_checkammo(float secondary) { // 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 @@ -641,7 +641,7 @@ void weapon_thinkf(float fr, float t, void() func) 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);