From 1fc3511ac91a14861e422cd7968ae3d92922c019 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Fri, 6 Dec 2013 21:51:45 -0500 Subject: [PATCH] Working on new system which does not need macro defines inside macros --- qcsrc/common/weapons/config.qh | 46 +++++++---------- qcsrc/common/weapons/w_arc.qc | 34 ++++++------- qcsrc/common/weapons/w_crylink.qc | 2 +- qcsrc/common/weapons/w_machinegun.qc | 76 ++++++++++++++-------------- qcsrc/common/weapons/w_mortar.qc | 52 +++++++++---------- qcsrc/common/weapons/w_rifle.qc | 4 +- qcsrc/common/weapons/w_shockwave.qc | 5 +- qcsrc/common/weapons/weapons.qh | 37 ++++++-------- 8 files changed, 122 insertions(+), 134 deletions(-) diff --git a/qcsrc/common/weapons/config.qh b/qcsrc/common/weapons/config.qh index cbd90e8f3..139df90a4 100644 --- a/qcsrc/common/weapons/config.qh +++ b/qcsrc/common/weapons/config.qh @@ -18,41 +18,33 @@ string wep_config_queue[MAX_WEP_CONFIG]; fputs(wep_config_file, a); \ if(wep_config_alsoprint) { print(a); } } -#define WEP_CONFIG_WRITE_CVARS_MO_PRI(weapon,name) \ +#define WEP_CONFIG_WRITE_CVARS_MO_PRI(wepname,name) \ { WEP_CONFIG_QUEUE( \ - sprintf("set g_balance_%s_primary_%s %g\n", #weapon, #name, \ - cvar(sprintf("g_balance_%s_primary_%s", #weapon, #name)))) } + sprintf("set g_balance_%s_primary_%s %g\n", #wepname, #name, \ + cvar(sprintf("g_balance_%s_primary_%s", #wepname, #name)))) } -#define WEP_CONFIG_WRITE_CVARS_MO_SEC(weapon,name) \ +#define WEP_CONFIG_WRITE_CVARS_MO_SEC(wepname,name) \ { WEP_CONFIG_QUEUE( \ - sprintf("set g_balance_%s_secondary_%s %g\n", #weapon, #name, \ - cvar(sprintf("g_balance_%s_secondary_%s", #weapon, #name)))) } + sprintf("set g_balance_%s_secondary_%s %g\n", #wepname, #name, \ + cvar(sprintf("g_balance_%s_secondary_%s", #wepname, #name)))) } -#define WEP_CONFIG_WRITE_CVARS_MO_BOTH(weapon,name) \ +#define WEP_CONFIG_WRITE_CVARS_MO_BOTH(wepname,name) \ { WEP_CONFIG_QUEUE( \ - sprintf("set g_balance_%s_primary_%s %g\n", #weapon, #name, \ - cvar(sprintf("g_balance_%s_primary_%s", #weapon, #name)))) } \ + sprintf("set g_balance_%s_primary_%s %g\n", #wepname, #name, \ + cvar(sprintf("g_balance_%s_primary_%s", #wepname, #name)))) } \ { WEP_CONFIG_QUEUE( \ - sprintf("set g_balance_%s_secondary_%s %g\n", #weapon, #name, \ - cvar(sprintf("g_balance_%s_secondary_%s", #weapon, #name)))) } + sprintf("set g_balance_%s_secondary_%s %g\n", #wepname, #name, \ + cvar(sprintf("g_balance_%s_secondary_%s", #wepname, #name)))) } -#define WEP_CONFIG_WRITE_CVARS_MO_NONE(weapon,name) \ +#define WEP_CONFIG_WRITE_CVARS_MO_NONE(wepname,name) \ { WEP_CONFIG_QUEUE( \ - sprintf("set g_balance_%s_%s %g\n", #weapon, #name, \ - cvar(sprintf("g_balance_%s_%s", #weapon, #name)))) } + sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \ + cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) } -#define WEP_CONFIG_WRITE_CVARS(weapon,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(weapon, name) +#define WEP_CONFIG_WRITE_CVARS(wepid,wepname,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(wepname, name) // WEAPONTODO: remove prop -#define WEP_CONFIG_WRITE_PROPS(weapon,name) \ - { WEP_CONFIG_QUEUE( \ - sprintf("set g_balance_%s_%s %g\n", #weapon, #name, \ - cvar(sprintf("g_balance_%s_%s", #weapon, #name)))) } - -#define WEP_CONFIG_SETTINGS(wepsettings) /*\ - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) \ - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,name) \ - wepsettings \ - #undef WEP_ADD_CVAR \ - #undef WEP_ADD_PROP -*/ +#define WEP_CONFIG_WRITE_PROPS(wepid,wepname,unused,name) \ + { WEP_CONFIG_QUEUE( \ + sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \ + cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) } diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index a827246ae..60aecc3ff 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -11,26 +11,26 @@ REGISTER_WEAPON( /* fullname */ _("Arc") ); -#define ARC_SETTINGS(weapon) \ - WEP_ADD_CVAR(weapon, MO_BOTH, ammo) \ - WEP_ADD_CVAR(weapon, MO_PRI, animtime) \ - WEP_ADD_CVAR(weapon, MO_PRI, damage) \ - WEP_ADD_CVAR(weapon, MO_PRI, falloff_halflifedist) \ - WEP_ADD_CVAR(weapon, MO_PRI, falloff_maxdist) \ - WEP_ADD_CVAR(weapon, MO_PRI, falloff_mindist) \ - WEP_ADD_CVAR(weapon, MO_PRI, force) \ - WEP_ADD_CVAR(weapon, MO_PRI, range) \ - WEP_ADD_CVAR(weapon, MO_PRI, refire) \ - WEP_ADD_PROP(weapon, reloading_ammo, reload_ammo) \ - WEP_ADD_PROP(weapon, reloading_time, reload_time) \ - WEP_ADD_PROP(weapon, switchdelay_raise, switchdelay_raise) \ - WEP_ADD_PROP(weapon, switchdelay_drop, switchdelay_drop) +#define ARC_SETTINGS(w_cvar,w_prop) \ + w_cvar(WEP_ARC, arc, MO_BOTH, ammo) \ + w_cvar(WEP_ARC, arc, MO_PRI, animtime) \ + w_cvar(WEP_ARC, arc, MO_PRI, damage) \ + w_cvar(WEP_ARC, arc, MO_PRI, falloff_halflifedist) \ + w_cvar(WEP_ARC, arc, MO_PRI, falloff_maxdist) \ + w_cvar(WEP_ARC, arc, MO_PRI, falloff_mindist) \ + w_cvar(WEP_ARC, arc, MO_PRI, force) \ + w_cvar(WEP_ARC, arc, MO_PRI, range) \ + w_cvar(WEP_ARC, arc, MO_PRI, refire) \ + w_prop(WEP_ARC, arc, reloading_ammo, reload_ammo) \ + w_prop(WEP_ARC, arc, reloading_time, reload_time) \ + w_prop(WEP_ARC, arc, switchdelay_raise, switchdelay_raise) \ + w_prop(WEP_ARC, arc, switchdelay_drop, switchdelay_drop) #ifndef MENUQC vector arc_shotorigin[4]; #endif #ifdef SVQC -ARC_SETTINGS(arc) +ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) void ArcInit(); .vector hook_start, hook_end; // used for beam .entity arc_beam; // used for beam @@ -259,7 +259,7 @@ float w_arc(float req) } case WR_CONFIG: { - WEP_CONFIG_SETTINGS(ARC_SETTINGS(arc)) + ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS) return TRUE; } case WR_KILLMESSAGE: @@ -292,7 +292,7 @@ void ArcInit() 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); - WEP_SET_PROPS(ARC_SETTINGS(arc), WEP_ARC) + ARC_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP) } #endif #ifdef CSQC diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index 4e46f1fb2..812f3af50 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -415,7 +415,7 @@ void W_Crylink_Attack (void) //proj.glow_size = 20; proj.flags = FL_PROJECTILE; - proj.missile_flags = MIF_SPLASH; + proj.missile_flags = MIF_SPLASH; CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE); diff --git a/qcsrc/common/weapons/w_machinegun.qc b/qcsrc/common/weapons/w_machinegun.qc index 6afeb4ef2..841254c21 100644 --- a/qcsrc/common/weapons/w_machinegun.qc +++ b/qcsrc/common/weapons/w_machinegun.qc @@ -11,37 +11,37 @@ REGISTER_WEAPON( /* fullname */ _("Machine Gun") ); -#define UZI_SETTINGS(weapon) \ - WEP_ADD_CVAR(weapon, MO_NONE, speed) \ - WEP_ADD_CVAR(weapon, MO_NONE, spread_min) \ - WEP_ADD_CVAR(weapon, MO_NONE, spread_max) \ - WEP_ADD_CVAR(weapon, MO_NONE, spread_add) \ - WEP_ADD_CVAR(weapon, MO_NONE, mode) \ - WEP_ADD_CVAR(weapon, MO_NONE, bulletconstant) \ - WEP_ADD_CVAR(weapon, MO_NONE, first) \ - WEP_ADD_CVAR(weapon, MO_NONE, first_damage) \ - WEP_ADD_CVAR(weapon, MO_NONE, first_force) \ - WEP_ADD_CVAR(weapon, MO_NONE, first_refire) \ - WEP_ADD_CVAR(weapon, MO_NONE, first_spread) \ - WEP_ADD_CVAR(weapon, MO_NONE, first_ammo) \ - WEP_ADD_CVAR(weapon, MO_NONE, sustained_damage) \ - WEP_ADD_CVAR(weapon, MO_NONE, sustained_force) \ - WEP_ADD_CVAR(weapon, MO_NONE, sustained_refire) \ - WEP_ADD_CVAR(weapon, MO_NONE, sustained_spread) \ - WEP_ADD_CVAR(weapon, MO_NONE, sustained_ammo) \ - WEP_ADD_CVAR(weapon, MO_NONE, burst) \ - WEP_ADD_CVAR(weapon, MO_NONE, burst_refire) \ - WEP_ADD_CVAR(weapon, MO_NONE, burst_refire2) \ - WEP_ADD_CVAR(weapon, MO_NONE, burst_animtime) \ - WEP_ADD_CVAR(weapon, MO_NONE, burst_speed) \ - WEP_ADD_CVAR(weapon, MO_NONE, burst_ammo) \ - WEP_ADD_PROP(weapon, reloading_ammo, reload_ammo) \ - WEP_ADD_PROP(weapon, reloading_time, reload_time) \ - WEP_ADD_PROP(weapon, switchdelay_raise, switchdelay_raise) \ - WEP_ADD_PROP(weapon, switchdelay_drop, switchdelay_drop) +#define UZI_SETTINGS(w_cvar,w_prop) \ + w_cvar(WEP_UZI, uzi, MO_NONE, speed) \ + w_cvar(WEP_UZI, uzi, MO_NONE, spread_min) \ + w_cvar(WEP_UZI, uzi, MO_NONE, spread_max) \ + w_cvar(WEP_UZI, uzi, MO_NONE, spread_add) \ + w_cvar(WEP_UZI, uzi, MO_NONE, mode) \ + w_cvar(WEP_UZI, uzi, MO_NONE, bulletconstant) \ + w_cvar(WEP_UZI, uzi, MO_NONE, first) \ + w_cvar(WEP_UZI, uzi, MO_NONE, first_damage) \ + w_cvar(WEP_UZI, uzi, MO_NONE, first_force) \ + w_cvar(WEP_UZI, uzi, MO_NONE, first_refire) \ + w_cvar(WEP_UZI, uzi, MO_NONE, first_spread) \ + w_cvar(WEP_UZI, uzi, MO_NONE, first_ammo) \ + w_cvar(WEP_UZI, uzi, MO_NONE, sustained_damage) \ + w_cvar(WEP_UZI, uzi, MO_NONE, sustained_force) \ + w_cvar(WEP_UZI, uzi, MO_NONE, sustained_refire) \ + w_cvar(WEP_UZI, uzi, MO_NONE, sustained_spread) \ + w_cvar(WEP_UZI, uzi, MO_NONE, sustained_ammo) \ + w_cvar(WEP_UZI, uzi, MO_NONE, burst) \ + w_cvar(WEP_UZI, uzi, MO_NONE, burst_refire) \ + w_cvar(WEP_UZI, uzi, MO_NONE, burst_refire2) \ + w_cvar(WEP_UZI, uzi, MO_NONE, burst_animtime) \ + w_cvar(WEP_UZI, uzi, MO_NONE, burst_speed) \ + w_cvar(WEP_UZI, uzi, MO_NONE, burst_ammo) \ + w_prop(WEP_UZI, uzi, reloading_ammo, reload_ammo) \ + w_prop(WEP_UZI, uzi, reloading_time, reload_time) \ + w_prop(WEP_UZI, uzi, switchdelay_raise, switchdelay_raise) \ + w_prop(WEP_UZI, uzi, switchdelay_drop, switchdelay_drop) #ifdef SVQC -UZI_SETTINGS(uzi) +UZI_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #endif #else #ifdef SVQC @@ -95,7 +95,7 @@ void UziFlash() void W_UZI_Attack (float deathtype) { - W_SetupShot (self, autocvar_g_antilag_bullets && WEP_CVAR(uzi, speed) >= autocvar_g_antilag_bullets, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(uzi, first_damage) : WEP_CVAR(uzi, sustained_damage))); + W_SetupShot (self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(uzi, first_damage) : WEP_CVAR(uzi, sustained_damage))); if (!autocvar_g_norecoil) { self.punchangle_x = random () - 0.5; @@ -106,9 +106,9 @@ void W_UZI_Attack (float deathtype) ATTACK_FINISHED(self) = time + WEP_CVAR(uzi, first_refire) * W_WeaponRateFactor(); if (self.misc_bulletcounter == 1) - fireBallisticBullet(w_shotorg, w_shotdir, WEP_CVAR(uzi, first_spread), WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, first_damage), WEP_CVAR(uzi, first_force), deathtype, 0, 1, WEP_CVAR(uzi, bulletconstant)); + fireBallisticBullet(w_shotorg, w_shotdir, WEP_CVAR(uzi, first_spread), WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, first_damage), WEP_CVAR(uzi, first_force), deathtype, 0, WEP_CVAR(uzi, bulletconstant)); else - fireBallisticBullet(w_shotorg, w_shotdir, WEP_CVAR(uzi, sustained_spread), WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, sustained_damage), WEP_CVAR(uzi, sustained_force), deathtype, 0, 1, WEP_CVAR(uzi, bulletconstant)); + fireBallisticBullet(w_shotorg, w_shotdir, WEP_CVAR(uzi, sustained_spread), WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, sustained_damage), WEP_CVAR(uzi, sustained_force), deathtype, 0, WEP_CVAR(uzi, bulletconstant)); endFireBallisticBullet(); pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); @@ -172,7 +172,7 @@ void uzi_mode1_fire_auto() W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, sustained_ammo), autocvar_g_balance_uzi_reload_ammo); - W_SetupShot (self, autocvar_g_antilag_bullets && WEP_CVAR(uzi, speed) >= autocvar_g_antilag_bullets, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(uzi, sustained_damage)); + W_SetupShot (self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(uzi, sustained_damage)); if (!autocvar_g_norecoil) { self.punchangle_x = random () - 0.5; @@ -180,7 +180,7 @@ void uzi_mode1_fire_auto() } uzi_spread = bound(WEP_CVAR(uzi, spread_min), WEP_CVAR(uzi, spread_min) + (WEP_CVAR(uzi, spread_add) * self.misc_bulletcounter), WEP_CVAR(uzi, spread_max)); - fireBallisticBullet(w_shotorg, w_shotdir, uzi_spread, WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, sustained_damage), WEP_CVAR(uzi, sustained_force), WEP_UZI, 0, 1, WEP_CVAR(uzi, bulletconstant)); + fireBallisticBullet(w_shotorg, w_shotdir, uzi_spread, WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, sustained_damage), WEP_CVAR(uzi, sustained_force), WEP_UZI, 0, WEP_CVAR(uzi, bulletconstant)); endFireBallisticBullet(); self.misc_bulletcounter = self.misc_bulletcounter + 1; @@ -199,14 +199,14 @@ void uzi_mode1_fire_auto() void uzi_mode1_fire_burst() { - W_SetupShot (self, autocvar_g_antilag_bullets && WEP_CVAR(uzi, speed) >= autocvar_g_antilag_bullets, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(uzi, sustained_damage)); + W_SetupShot (self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(uzi, sustained_damage)); if (!autocvar_g_norecoil) { self.punchangle_x = random () - 0.5; self.punchangle_y = random () - 0.5; } - fireBallisticBullet(w_shotorg, w_shotdir, WEP_CVAR(uzi, burst_speed), WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, sustained_damage), WEP_CVAR(uzi, sustained_force), WEP_UZI, 0, 1, WEP_CVAR(uzi, bulletconstant)); + fireBallisticBullet(w_shotorg, w_shotdir, WEP_CVAR(uzi, burst_speed), WEP_CVAR(uzi, speed), 5, WEP_CVAR(uzi, sustained_damage), WEP_CVAR(uzi, sustained_force), WEP_UZI, 0, WEP_CVAR(uzi, bulletconstant)); endFireBallisticBullet(); @@ -304,7 +304,7 @@ float w_uzi(float req) precache_model ("models/weapons/v_uzi.md3"); precache_model ("models/weapons/h_uzi.iqm"); precache_sound ("weapons/uzi_fire.wav"); - WEP_SET_PROPS(UZI_SETTINGS(uzi), WEP_UZI) + UZI_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP) return TRUE; } case WR_SETUP: @@ -346,7 +346,7 @@ float w_uzi(float req) } case WR_CONFIG: { - WEP_CONFIG_SETTINGS(UZI_SETTINGS(uzi)) + UZI_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS) return TRUE; } case WR_RELOAD: diff --git a/qcsrc/common/weapons/w_mortar.qc b/qcsrc/common/weapons/w_mortar.qc index b6f156dfc..47ac04654 100644 --- a/qcsrc/common/weapons/w_mortar.qc +++ b/qcsrc/common/weapons/w_mortar.qc @@ -11,32 +11,32 @@ REGISTER_WEAPON( /* fullname */ _("Mortar") ); -#define MORTAR_SETTINGS(weapon) \ - WEP_ADD_CVAR(weapon, MO_BOTH, ammo) \ - WEP_ADD_CVAR(weapon, MO_BOTH, animtime) \ - WEP_ADD_CVAR(weapon, MO_NONE, bouncefactor) \ - WEP_ADD_CVAR(weapon, MO_NONE, bouncestop) \ - WEP_ADD_CVAR(weapon, MO_BOTH, damage) \ - WEP_ADD_CVAR(weapon, MO_BOTH, damageforcescale) \ - WEP_ADD_CVAR(weapon, MO_BOTH, edgedamage) \ - WEP_ADD_CVAR(weapon, MO_BOTH, force) \ - WEP_ADD_CVAR(weapon, MO_BOTH, health) \ - WEP_ADD_CVAR(weapon, MO_BOTH, lifetime) \ - WEP_ADD_CVAR(weapon, MO_SEC, lifetime_bounce) \ - WEP_ADD_CVAR(weapon, MO_BOTH, lifetime_stick) \ - WEP_ADD_CVAR(weapon, MO_BOTH, radius) \ - WEP_ADD_CVAR(weapon, MO_BOTH, refire) \ - WEP_ADD_CVAR(weapon, MO_PRI, remote_minbouncecnt) \ - WEP_ADD_CVAR(weapon, MO_BOTH, speed) \ - WEP_ADD_CVAR(weapon, MO_BOTH, speed_up) \ - WEP_ADD_CVAR(weapon, MO_BOTH, type) \ - WEP_ADD_PROP(weapon, reloading_ammo, reload_ammo) \ - WEP_ADD_PROP(weapon, reloading_time, reload_time) \ - WEP_ADD_PROP(weapon, switchdelay_raise, switchdelay_raise) \ - WEP_ADD_PROP(weapon, switchdelay_drop, switchdelay_drop) +#define MORTAR_SETTINGS(w_cvar,w_prop) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, ammo) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, animtime) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_NONE, bouncefactor) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_NONE, bouncestop) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, damage) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, damageforcescale) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, edgedamage) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, force) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, health) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, lifetime) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_SEC, lifetime_bounce) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, lifetime_stick) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, radius) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, refire) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_PRI, remote_minbouncecnt) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, speed) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, speed_up) \ + w_cvar(WEP_GRENADE_LAUNCHER, mortar, MO_BOTH, type) \ + w_prop(WEP_GRENADE_LAUNCHER, mortar, reloading_ammo, reload_ammo) \ + w_prop(WEP_GRENADE_LAUNCHER, mortar, reloading_time, reload_time) \ + w_prop(WEP_GRENADE_LAUNCHER, mortar, switchdelay_raise, switchdelay_raise) \ + w_prop(WEP_GRENADE_LAUNCHER, mortar, switchdelay_drop, switchdelay_drop) #ifdef SVQC -MORTAR_SETTINGS(mortar) +MORTAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) .float gl_detonate_later; .float gl_bouncecnt; #endif @@ -402,7 +402,7 @@ float w_glauncher(float req) precache_sound ("weapons/grenade_bounce6.wav"); precache_sound ("weapons/grenade_stick.wav"); precache_sound ("weapons/grenade_fire.wav"); - WEP_SET_PROPS(MORTAR_SETTINGS(mortar), WEP_GRENADE_LAUNCHER) + MORTAR_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP) return TRUE; } case WR_SETUP: @@ -424,7 +424,7 @@ float w_glauncher(float req) } case WR_CONFIG: { - WEP_CONFIG_SETTINGS(MORTAR_SETTINGS(mortar)) + MORTAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS) return TRUE; } case WR_RELOAD: diff --git a/qcsrc/common/weapons/w_rifle.qc b/qcsrc/common/weapons/w_rifle.qc index 76cf93962..9ccd9c400 100644 --- a/qcsrc/common/weapons/w_rifle.qc +++ b/qcsrc/common/weapons/w_rifle.qc @@ -49,7 +49,7 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed W_DecreaseAmmo(ammo_nails, pAmmo, autocvar_g_balance_rifle_reload_ammo); - W_SetupShot (self, autocvar_g_antilag_bullets && pSpeed >= autocvar_g_antilag_bullets, 2, pSound, CH_WEAPON_A, pDamage * pShots); + W_SetupShot (self, TRUE, 2, pSound, CH_WEAPON_A, pDamage * pShots); pointparticles(particleeffectnum("rifle_muzzleflash"), w_shotorg, w_shotdir * 2000, 1); @@ -60,7 +60,7 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed } for(i = 0; i < pShots; ++i) - fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE), 1, pBulletConstant); + fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE), pBulletConstant); endFireBallisticBullet(); if (autocvar_g_casings >= 2) diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index 9e819fce9..a38b24dad 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -54,9 +54,9 @@ void W_Shockwave_Pellets(void) W_DecreaseAmmo(ammo_shells, ammoamount, autocvar_g_balance_shockwave_reload_ammo); - W_SetupShot (self, autocvar_g_antilag_bullets && bulletspeed >= autocvar_g_antilag_bullets, 5, "weapons/shockwave_fire.wav", CH_WEAPON_A, d * bullets); + W_SetupShot (self, TRUE, 5, "weapons/shockwave_fire.wav", CH_WEAPON_A, d * bullets); for (sc = 0;sc < bullets;sc = sc + 1) - fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, f, WEP_SHOCKWAVE, 0, 1, bulletconstant); + fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, f, WEP_SHOCKWAVE, 0, bulletconstant); endFireBallisticBullet(); pointparticles(particleeffectnum("shockwave_muzzleflash"), w_shotorg, w_shotdir * 1000, autocvar_g_balance_shockwave_pellets_ammo); @@ -414,6 +414,7 @@ float W_Shockwave(float req) if(vlen(self.origin-self.enemy.origin) <= autocvar_g_balance_shockwave_secondary_melee_range) self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE); else + self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE); { if(autocvar_g_antilag_bullets) self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE); diff --git a/qcsrc/common/weapons/weapons.qh b/qcsrc/common/weapons/weapons.qh index ad80bc21b..c9deb8e8b 100644 --- a/qcsrc/common/weapons/weapons.qh +++ b/qcsrc/common/weapons/weapons.qh @@ -187,39 +187,34 @@ void register_weapons_done(); */ #define WEP_ADD_CVAR_MO_PRI(weapon,name) \ - WEP_DUPECHECK(WEP_CVAR_P_##weapon##_##name, autocvar_g_balance_##weapon##_primary_##name) + WEP_DUPECHECK(WEP_CVAR_P_##wepname##_##name, autocvar_g_balance_##wepname##_primary_##name) #define WEP_ADD_CVAR_MO_SEC(weapon,name) \ - WEP_DUPECHECK(WEP_CVAR_S_##weapon##_##name, autocvar_g_balance_##weapon##_secondary_##name) + WEP_DUPECHECK(WEP_CVAR_S_##wepname##_##name, autocvar_g_balance_##wepname##_secondary_##name) #define WEP_ADD_CVAR_MO_BOTH(weapon,name) \ - WEP_DUPECHECK(WEP_CVAR_P_##weapon##_##name, autocvar_g_balance_##weapon##_primary_##name) \ - WEP_DUPECHECK(WEP_CVAR_S_##weapon##_##name, autocvar_g_balance_##weapon##_secondary_##name) + WEP_DUPECHECK(WEP_CVAR_P_##wepname##_##name, autocvar_g_balance_##wepname##_primary_##name) \ + WEP_DUPECHECK(WEP_CVAR_S_##wepname##_##name, autocvar_g_balance_##wepname##_secondary_##name) -#define WEP_ADD_CVAR_MO_NONE(weapon,name) \ - WEP_DUPECHECK(WEP_CVAR_##weapon##_##name, autocvar_g_balance_##weapon##_##name) +#define WEP_ADD_CVAR_MO_NONE(wepname,name) \ + WEP_DUPECHECK(WEP_CVAR_##wepname##_##name, autocvar_g_balance_##wepname##_##name) -#define WEP_ADD_CVAR(weapon,mode,name) WEP_ADD_CVAR_##mode(weapon, name) +#define WEP_ADD_CVAR(wepid,wepname,mode,name) WEP_ADD_CVAR_##mode(wepname, name) -#define WEP_CVAR(weapon,name) autocvar_g_balance_##weapon##_##name -#define WEP_CVAR_PRI(weapon,name) WEP_CVAR(weapon, primary_##name) -#define WEP_CVAR_SEC(weapon,name) WEP_CVAR(weapon, secondary_##name) -#define WEP_CVAR_BOTH(weapon,mode,name) ((mode == MO_PRI) ? WEP_CVAR_PRI(weapon, name) : WEP_CVAR_SEC(weapon, name)) +#define WEP_CVAR(wepname,name) autocvar_g_balance_##wepname##_##name +#define WEP_CVAR_PRI(wepname,name) WEP_CVAR(wepname, primary_##name) +#define WEP_CVAR_SEC(wepname,name) WEP_CVAR(wepname, secondary_##name) +#define WEP_CVAR_BOTH(wepname,mode,name) ((mode == MO_PRI) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name)) -#define WEP_ADD_PROP(weapon,prop,name) \ + +#define WEP_ADD_PROP(wepid,wepname,prop,name) \ .float ##prop; \ - WEP_DUPECHECK(WEP_CVAR_##weapon##_##name, autocvar_g_balance_##weapon##_##name) + WEP_DUPECHECK(WEP_CVAR_##wepname##_##name, autocvar_g_balance_##wepname##_##name) -#define WEP_SET_PROP(wepid,weapon,prop,name) get_weaponinfo(##wepid).##prop = autocvar_g_balance_##weapon##_##name; +#define WEP_SKIPCVAR(unuseda,unusedb,unusedc,unusedd) /* skip cvars */ +#define WEP_SET_PROP(wepid,wepname,prop,name) get_weaponinfo(##wepid).##prop = autocvar_g_balance_##wepname##_##name; -/*#define WEP_SET_PROPS(wepsettings,wepid) \ - #define WEP_ADD_CVAR(weapon,mode,name) \ - #define WEP_ADD_PROP(weapon,prop,name) WEP_SET_PROP(wepid,weapon,prop,name) \ - wepsettings \ - #undef WEP_ADD_CVAR \ - #undef WEP_ADD_PROP -*/ #include "all.qh" #undef WEP_ADD_CVAR -- 2.39.2