From bf1d64ebc5c2867b079a0bfa09f448f076d6be01 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Thu, 18 May 2023 23:25:23 +1000 Subject: [PATCH] Remove legacy Quake bbox expansion: projectiles All the "zero size" projectiles now need a size so they can trigger a warpzone's touch func. Prevously DP gave most of them mins '-1 -1 -1' maxs '1 1 1' for the purpose of those tests (but not all tests). Because of that these projectiles now need a different way to avoid colliding with each other. Comparison of the `clipgroup` field is used as DP_RM_CLIPGROUP will make this more optimal for performance and is also implemented in QC here for compatibility with old DP versions. --- .gitlab-ci.yml | 2 +- .../common/gamemodes/gamemode/nexball/sv_weapon.qc | 2 +- qcsrc/common/mutators/mutator/overkill/okrpc.qc | 4 ++-- qcsrc/common/mutators/mutator/overkill/okrpc.qh | 3 +++ qcsrc/common/weapons/weapon/arc.qc | 3 ++- qcsrc/common/weapons/weapon/blaster.qc | 3 ++- qcsrc/common/weapons/weapon/crylink.qc | 6 ++++-- qcsrc/common/weapons/weapon/devastator.qc | 4 ++-- qcsrc/common/weapons/weapon/devastator.qh | 3 +++ qcsrc/common/weapons/weapon/electro.qc | 13 +++++++------ qcsrc/common/weapons/weapon/electro.qh | 5 +++++ qcsrc/common/weapons/weapon/hagar.qc | 9 ++++++--- qcsrc/common/weapons/weapon/hlac.qc | 6 ++++-- qcsrc/common/weapons/weapon/hook.qc | 3 ++- qcsrc/common/weapons/weapon/minelayer.qc | 6 +++--- qcsrc/common/weapons/weapon/minelayer.qh | 3 +++ qcsrc/common/weapons/weapon/mortar.qc | 8 ++++---- qcsrc/common/weapons/weapon/mortar.qh | 3 +++ qcsrc/common/weapons/weapon/porto.qc | 3 ++- qcsrc/common/weapons/weapon/seeker.qc | 12 ++++++------ qcsrc/common/weapons/weapon/seeker.qh | 7 +++++++ qcsrc/common/weapons/weapon/vaporizer.qc | 4 ++-- qcsrc/common/weapons/weapon/vaporizer.qh | 3 +++ qcsrc/server/hook.qc | 4 ++-- qcsrc/server/hook.qh | 2 ++ qcsrc/server/weapons/common.qh | 9 ++++++++- qcsrc/server/weapons/tracing.qh | 6 +++--- 27 files changed, 92 insertions(+), 44 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b56f2b44d..26248155f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,7 +75,7 @@ test_sv_game: - wget -nv -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints - wget -nv -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache - - EXPECT=f2226bf353b6ff3dd3c489a742ce4e6a + - EXPECT=2a66d8d70fb6aa726f8b5edf453afea3 - HASH=$(${ENGINE} +exec serverbench.cfg | tee /dev/stderr | grep '^:' diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc b/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc index d3d3a6a9d..7ed7a4d19 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_weapon.qc @@ -165,7 +165,7 @@ void W_Nexball_Attack2(Weapon thiswep, entity actor, .entity weaponentity) PROJECTILE_MAKETRIGGER(missile); //setmodel(missile, "models/elaser.mdl"); // precision set below - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); setorigin(missile, w_shotorg); W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0); diff --git a/qcsrc/common/mutators/mutator/overkill/okrpc.qc b/qcsrc/common/mutators/mutator/overkill/okrpc.qc index d84a6766a..9a3ba973f 100644 --- a/qcsrc/common/mutators/mutator/overkill/okrpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/okrpc.qc @@ -89,7 +89,7 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(actor); W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(okrpc, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(okrpc, damage), thiswep.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, RPC_MINS, RPC_MAXS, false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(okrpc, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); PROJECTILE_MAKETRIGGER(missile); @@ -107,7 +107,7 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent missile.projectiledeathtype = thiswep.m_id; missile.weaponentity_fld = weaponentity; - setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot + setsize (missile, RPC_MINS, RPC_MAXS); // 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 W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(okrpc, speed), 0); diff --git a/qcsrc/common/mutators/mutator/overkill/okrpc.qh b/qcsrc/common/mutators/mutator/overkill/okrpc.qh index 23421d2f5..ffa489f95 100644 --- a/qcsrc/common/mutators/mutator/overkill/okrpc.qh +++ b/qcsrc/common/mutators/mutator/overkill/okrpc.qh @@ -22,6 +22,9 @@ CLASS(OverkillRocketPropelledChainsaw, Weapon) /* wepname */ ATTRIB(OverkillRocketPropelledChainsaw, m_name, string, _("Overkill Rocket Propelled Chainsaw")); /* legacy */ ATTRIB(OverkillRocketPropelledChainsaw, m_deprecated_netname, string, "rpc"); +#define RPC_MINS '-4 -4 -4' // 0.8.5 used '-3 -3 -3' (before sv_legacy_bbox_expand 0) +#define RPC_MAXS '4 4 4' // 0.8.5 used '3 3 3' (before sv_legacy_bbox_expand 0) + #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ P(class, prefix, ammo, float, PRI) \ diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 43d7a03a4..5aa7bfa52 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -158,10 +158,11 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int f setthink(missile, adaptor_think2use_hittype_splash); missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime); PROJECTILE_MAKETRIGGER(missile); + missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ; missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); set_movetype(missile, MOVETYPE_BOUNCEMISSILE); W_SetupProjVelocity_PRE(missile, arc, bolt_); diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 3c134a3db..c4d6720c2 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -57,9 +57,10 @@ void W_Blaster_Attack( missile.bot_dodge = true; missile.bot_dodgerating = atk_damage; PROJECTILE_MAKETRIGGER(missile); + missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ; setorigin(missile, w_shotorg); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); float atk_speed = WEP_CVAR_BOTH(blaster, isprimary, speed); float atk_spread = WEP_CVAR_BOTH(blaster, isprimary, spread); diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index ae1eae284..074a99aba 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -341,11 +341,12 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(proj, MOVETYPE_BOUNCEMISSILE); PROJECTILE_MAKETRIGGER(proj); + proj.clipgroup = CLIPGROUP_UNHITTABLEPROJ; proj.projectiledeathtype = thiswep.m_id; //proj.gravity = 0.001; setorigin(proj, w_shotorg); - setsize(proj, '0 0 0', '0 0 0'); + setsize(proj, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); s = '0 0 0'; @@ -454,11 +455,12 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(proj, MOVETYPE_BOUNCEMISSILE); PROJECTILE_MAKETRIGGER(proj); + proj.clipgroup = CLIPGROUP_UNHITTABLEPROJ; proj.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; //proj.gravity = 0.001; setorigin(proj, w_shotorg); - setsize(proj, '0 0 0', '0 0 0'); + setsize(proj, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); if(WEP_CVAR_SEC(crylink, spreadtype) == 1) { diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 6f428dc6c..40a2e35d4 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -307,7 +307,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int { W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage), thiswep.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, ROCKET_MINS, ROCKET_MAXS, false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); entity missile = WarpZone_RefSys_SpawnSameRefSys(actor); @@ -333,7 +333,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int set_movetype(missile, MOVETYPE_FLY); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = thiswep.m_id; - setsize(missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot + setsize(missile, ROCKET_MINS, ROCKET_MAXS); // 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 W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0); diff --git a/qcsrc/common/weapons/weapon/devastator.qh b/qcsrc/common/weapons/weapon/devastator.qh index 7a10bf62a..e849f6957 100644 --- a/qcsrc/common/weapons/weapon/devastator.qh +++ b/qcsrc/common/weapons/weapon/devastator.qh @@ -20,6 +20,9 @@ CLASS(Devastator, Weapon) /* wepname */ ATTRIB(Devastator, m_name, string, _("Devastator")); /* legacy */ ATTRIB(Devastator, m_deprecated_netname, string, "rocketlauncher"); +#define ROCKET_MINS '-4 -4 -4' // 0.8.5 used '-3 -3 -3' (before sv_legacy_bbox_expand 0) +#define ROCKET_MAXS '4 4 4' // 0.8.5 used '3 3 3' (before sv_legacy_bbox_expand 0) + #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ P(class, prefix, ammo, float, NONE) \ diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 2c03871ce..fbd92f0cb 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -221,8 +221,8 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) W_SetupShot_ProjectileSize( actor, weaponentity, - '0 0 -3', - '0 0 -3', + BOLT_MINS, + BOLT_MAXS, false, 2, SND_ELECTRO_FIRE, @@ -242,6 +242,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) proj.nextthink = time; proj.ltime = time + WEP_CVAR_PRI(electro, lifetime); PROJECTILE_MAKETRIGGER(proj); + proj.clipgroup = CLIPGROUP_UNHITTABLEPROJ; proj.projectiledeathtype = thiswep.m_id; proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); @@ -251,7 +252,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) W_SetupProjVelocity_PRI(proj, electro); proj.angles = vectoangles(proj.velocity); settouch(proj, W_Electro_TouchExplode); - setsize(proj, '0 0 -3', '0 0 -3'); + setsize(proj, BOLT_MINS, BOLT_MAXS); proj.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, proj); IL_PUSH(g_bot_dodge, proj); @@ -422,8 +423,8 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) W_SetupShot_ProjectileSize( actor, weaponentity, - '-4 -4 -4', - '4 4 4', + ORB_MINS, + ORB_MAXS, false, 2, SND_ELECTRO_FIRE2, @@ -454,7 +455,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(proj, MOVETYPE_BOUNCE); W_SetupProjVelocity_UP_SEC(proj, electro); settouch(proj, W_Electro_Orb_Touch); - setsize(proj, '-4 -4 -4', '4 4 4'); + setsize(proj, ORB_MINS, ORB_MAXS); proj.takedamage = DAMAGE_YES; proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale); SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_SEC(electro, health)); diff --git a/qcsrc/common/weapons/weapon/electro.qh b/qcsrc/common/weapons/weapon/electro.qh index e4263403b..b0b3ba799 100644 --- a/qcsrc/common/weapons/weapon/electro.qh +++ b/qcsrc/common/weapons/weapon/electro.qh @@ -19,6 +19,11 @@ CLASS(Electro, Weapon) /* refname */ ATTRIB(Electro, netname, string, "electro"); /* wepname */ ATTRIB(Electro, m_name, string, _("Electro")); +#define ORB_MINS '-5 -5 -5' // 0.8.5 used '-4 -4 -4' (before sv_legacy_bbox_expand 0) +#define ORB_MAXS '5 5 5' // 0.8.5 used '4 4 4' (before sv_legacy_bbox_expand 0) +#define BOLT_MINS '-1 -1 -4' // 0.8.5 used '0 0 -3' (before sv_legacy_bbox_expand 0) +#define BOLT_MAXS '1 1 -2' // 0.8.5 used '0 0 -3' (before sv_legacy_bbox_expand 0) + #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ P(class, prefix, ammo, float, BOTH) \ diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index a8c12efcc..096f8ed8b 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -102,10 +102,11 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity) setthink(missile, adaptor_think2use_hittype_splash); missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime); PROJECTILE_MAKETRIGGER(missile); + missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ; missile.projectiledeathtype = thiswep.m_id; missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); set_movetype(missile, MOVETYPE_FLY); W_SetupProjVelocity_PRI(missile, hagar); @@ -149,10 +150,11 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) setthink(missile, adaptor_think2use_hittype_splash); missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand); PROJECTILE_MAKETRIGGER(missile); + missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ; missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); set_movetype(missile, MOVETYPE_BOUNCEMISSILE); W_SetupProjVelocity_SEC(missile, hagar); @@ -211,10 +213,11 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen setthink(missile, adaptor_think2use_hittype_splash); missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand); PROJECTILE_MAKETRIGGER(missile); + missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ; missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); set_movetype(missile, MOVETYPE_FLY); missile.missile_flags = MIF_SPLASH; diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 18dde7440..4282598a9 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -45,9 +45,10 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(missile, MOVETYPE_FLY); PROJECTILE_MAKETRIGGER(missile); + missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ; setorigin(missile, w_shotorg); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(hlac, speed), spread); //missile.angles = vectoangles(missile.velocity); // csqc @@ -90,9 +91,10 @@ void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(missile, MOVETYPE_FLY); PROJECTILE_MAKETRIGGER(missile); + missile.clipgroup = CLIPGROUP_UNHITTABLEPROJ; setorigin(missile, w_shotorg); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(hlac, speed), spread); //missile.angles = vectoangles(missile.velocity); // csqc diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 94d4ac33e..30c2233ac 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -77,10 +77,11 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) gren.bot_dodgerating = WEP_CVAR_SEC(hook, damage); set_movetype(gren, MOVETYPE_TOSS); PROJECTILE_MAKETRIGGER(gren); + gren.clipgroup = CLIPGROUP_UNHITTABLEPROJ; gren.projectiledeathtype = WEP_HOOK.m_id | HITTYPE_SECONDARY; gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); - setsize(gren, '0 0 0', '0 0 0'); + setsize(gren, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime); setthink(gren, adaptor_think2use_hittype_splash); diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index c73db2bc2..40474b874 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -20,7 +20,7 @@ void W_MineLayer_Stick(entity this, entity to) newmine.realowner = this.realowner; setorigin(newmine, this.origin); setmodel(newmine, MDL_MINELAYER_MINE); - setsize(newmine, '-4 -4 -4', '4 4 4'); + setsize(newmine, MINE_MINS, MINE_MAXS); newmine.angles = vectoangles(-trace_plane_normal); // face against the surface newmine.movedir = -trace_plane_normal; @@ -269,7 +269,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity) W_DecreaseAmmo(thiswep, actor, WEP_CVAR(minelayer, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage), thiswep.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, MINE_MINS, MINE_MAXS, false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); entity mine = WarpZone_RefSys_SpawnSameRefSys(actor); @@ -295,7 +295,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity) PROJECTILE_MAKETRIGGER(mine); mine.projectiledeathtype = thiswep.m_id; mine.weaponentity_fld = weaponentity; - setsize(mine, '-4 -4 -4', '4 4 4'); // give it some size so it can be shot + setsize(mine, MINE_MINS, MINE_MAXS); setorigin(mine, w_shotorg - v_forward * 4); // move it back so it hits the wall at the right point W_SetupProjVelocity_Basic(mine, WEP_CVAR(minelayer, speed), 0); diff --git a/qcsrc/common/weapons/weapon/minelayer.qh b/qcsrc/common/weapons/weapon/minelayer.qh index a574510f5..ce331ca6b 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qh +++ b/qcsrc/common/weapons/weapon/minelayer.qh @@ -19,6 +19,9 @@ CLASS(MineLayer, Weapon) /* refname */ ATTRIB(MineLayer, netname, string, "minelayer"); /* wepname */ ATTRIB(MineLayer, m_name, string, _("Mine Layer")); +#define MINE_MINS '-5 -5 -5' // 0.8.5 used '-4 -4 -4' (before sv_legacy_bbox_expand 0) +#define MINE_MAXS '5 5 5' // 0.8.5 used '4 4 4' (before sv_legacy_bbox_expand 0) + #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ P(class, prefix, ammo, float, NONE) \ diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 442f88265..0a543cbbe 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -151,7 +151,7 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity) { W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(mortar, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage), thiswep.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, GREN_MINS, GREN_MAXS, false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage), thiswep.m_id); w_shotdir = v_forward; // no TrueAim for grenades please W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -167,7 +167,7 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity) gren.projectiledeathtype = thiswep.m_id; gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); - setsize(gren, '-3 -3 -3', '3 3 3'); + setsize(gren, GREN_MINS, GREN_MAXS); gren.cnt = time + WEP_CVAR_PRI(mortar, lifetime); gren.nextthink = time; @@ -203,7 +203,7 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(mortar, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot_ProjectileSize(actor, weaponentity, GREN_MINS, GREN_MAXS, false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage), thiswep.m_id | HITTYPE_SECONDARY); w_shotdir = v_forward; // no TrueAim for grenades please W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -219,7 +219,7 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) gren.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); - setsize(gren, '-3 -3 -3', '3 3 3'); + setsize(gren, GREN_MINS, GREN_MAXS); gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime); setthink(gren, adaptor_think2use_hittype_splash); diff --git a/qcsrc/common/weapons/weapon/mortar.qh b/qcsrc/common/weapons/weapon/mortar.qh index 6d44e7564..ef86c5f2a 100644 --- a/qcsrc/common/weapons/weapon/mortar.qh +++ b/qcsrc/common/weapons/weapon/mortar.qh @@ -20,6 +20,9 @@ CLASS(Mortar, Weapon) /* wepname */ ATTRIB(Mortar, m_name, string, _("Mortar")); /* legacy */ ATTRIB(Mortar, m_deprecated_netname, string, "grenadelauncher"); +#define GREN_MINS '-4 -4 -4' // 0.8.5 used '-3 -3 -3' (before sv_legacy_bbox_expand 0) +#define GREN_MAXS '4 4 4' // 0.8.5 used '3 3 3' (before sv_legacy_bbox_expand 0) + #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ P(class, prefix, ammo, float, BOTH) \ diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index b681078c2..ab400856c 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -298,10 +298,11 @@ void W_Porto_Attack(Weapon thiswep, entity actor, .entity weaponentity, float ty gren.bot_dodgerating = 200; set_movetype(gren, MOVETYPE_BOUNCEMISSILE); PROJECTILE_MAKETRIGGER(gren); + gren.clipgroup = CLIPGROUP_UNHITTABLEPROJ; gren.effects = EF_RED; gren.scale = 4; setorigin(gren, w_shotorg); - setsize(gren, '0 0 0', '0 0 0'); + setsize(gren, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS); gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime); setthink(gren, W_Porto_Think); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 7abb2a43c..be6d6e13c 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -169,7 +169,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, missile_ammo), weaponentity); makevectors(actor.v_angle); - W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0, ((m_target != NULL) ? thiswep.m_id | HITTYPE_SECONDARY : thiswep.m_id)); + W_SetupShot_ProjectileSize(actor, weaponentity, MISSILE_MINS, MISSILE_MAXS, false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0, ((m_target != NULL) ? thiswep.m_id | HITTYPE_SECONDARY : thiswep.m_id)); w_shotorg += f_diff; W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -203,7 +203,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v setorigin(missile, w_shotorg); - setsize(missile, '-4 -4 -4', '4 4 4'); + setsize(missile, MISSILE_MINS, MISSILE_MAXS); set_movetype(missile, MOVETYPE_FLYMISSILE); missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); @@ -266,7 +266,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity) f_diff = '+1.25 +3.75 0'; break; } - W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot_ProjectileSize(actor, weaponentity, FLAC_MINS, FLAC_MAXS, false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage), thiswep.m_id | HITTYPE_SECONDARY); w_shotorg += f_diff; // uses hagar effects! @@ -294,7 +294,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity) //missile.scale = 0.4; // BUG: the model is too big setorigin(missile, w_shotorg); - setsize(missile, '-2 -2 -2', '2 2 2'); + setsize(missile, FLAC_MINS, FLAC_MAXS); W_SetupProjVelocity_UP_PRE(missile, seeker, flac_); CSQCProjectile(missile, true, PROJECTILE_FLAC, true); @@ -489,7 +489,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity) { W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, tag_ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count), thiswep.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY); + W_SetupShot_ProjectileSize(actor, weaponentity, TAG_MINS, TAG_MAXS, false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count), thiswep.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY); entity missile = new(seeker_tag); missile.weaponentity_fld = weaponentity; @@ -508,7 +508,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity) missile.damageforcescale = WEP_CVAR(seeker, tag_damageforcescale); setorigin(missile, w_shotorg); - setsize(missile, '-2 -2 -2', '2 2 2'); + setsize(missile, TAG_MINS, TAG_MAXS); missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); diff --git a/qcsrc/common/weapons/weapon/seeker.qh b/qcsrc/common/weapons/weapon/seeker.qh index d3024a436..81a287635 100644 --- a/qcsrc/common/weapons/weapon/seeker.qh +++ b/qcsrc/common/weapons/weapon/seeker.qh @@ -19,6 +19,13 @@ CLASS(Seeker, Weapon) /* refname */ ATTRIB(Seeker, netname, string, "seeker"); /* wepname */ ATTRIB(Seeker, m_name, string, _("T.A.G. Seeker")); +#define MISSILE_MINS '-5 -5 -5' // 0.8.5 used '-4 -4 -4' (before sv_legacy_bbox_expand 0) +#define MISSILE_MAXS '5 5 5' // 0.8.5 used '4 4 4' (before sv_legacy_bbox_expand 0) +#define TAG_MINS '-3 -3 -3' // 0.8.5 used '-2 -2 -2' (before sv_legacy_bbox_expand 0) +#define TAG_MAXS '3 3 3' // 0.8.5 used '2 2 2' (before sv_legacy_bbox_expand 0) +#define FLAC_MINS '-3 -3 -3' // 0.8.5 used '-2 -2 -2' (before sv_legacy_bbox_expand 0) +#define FLAC_MAXS '3 3 3' // 0.8.5 used '2 2 2' (before sv_legacy_bbox_expand 0) + #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ P(class, prefix, flac_ammo, float, NONE) \ diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 71bc39a7c..b29fd38f4 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -194,7 +194,7 @@ void W_RocketMinsta_Attack(entity actor, .entity weaponentity, int mode) int laser_count = max(1, autocvar_g_rm_laser_count); int total = (mode == 0) ? laser_count : 1; Sound snd = (mode == 0) ? SND_CRYLINK_FIRE : SND_ELECTRO_FIRE2; - W_SetupShot_ProjectileSize(actor, weaponentity, '0 0 -3', '0 0 -3', false, 2, snd, CH_WEAPON_A, autocvar_g_rm_laser_damage, WEP_ELECTRO.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, RM_MINS, RM_MAXS, false, 2, snd, CH_WEAPON_A, autocvar_g_rm_laser_damage, WEP_ELECTRO.m_id); // uses electro effects W_MuzzleFlash(WEP_ELECTRO, actor, weaponentity, w_shotorg, w_shotdir); @@ -230,7 +230,7 @@ void W_RocketMinsta_Attack(entity actor, .entity weaponentity, int mode) proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true); proj.angles = vectoangles(proj.velocity); settouch(proj, W_RocketMinsta_Laser_Touch); - setsize(proj, '0 0 -3', '0 0 -3'); + setsize(proj, RM_MINS, RM_MAXS); proj.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, proj); IL_PUSH(g_bot_dodge, proj); diff --git a/qcsrc/common/weapons/weapon/vaporizer.qh b/qcsrc/common/weapons/weapon/vaporizer.qh index 87249f736..b0c703809 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qh +++ b/qcsrc/common/weapons/weapon/vaporizer.qh @@ -21,6 +21,9 @@ CLASS(Vaporizer, Weapon) /* wepname */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer")); /* legacy */ ATTRIB(Vaporizer, m_deprecated_netname, string, "minstanex"); +#define RM_MINS '-1 -1 -4' // 0.8.5 used '0 0 -3' (before sv_legacy_bbox_expand 0) +#define RM_MAXS '1 1 -2' // 0.8.5 used '0 0 -3' (before sv_legacy_bbox_expand 0) + #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ P(class, prefix, ammo, float, PRI) \ diff --git a/qcsrc/server/hook.qc b/qcsrc/server/hook.qc index a50830348..5bc00c150 100644 --- a/qcsrc/server/hook.qc +++ b/qcsrc/server/hook.qc @@ -370,7 +370,7 @@ void FireGrapplingHook(entity actor, .entity weaponentity) vector vs = hook_shotorigin[s]; vector oldmovedir = actor.(weaponentity).movedir; actor.(weaponentity).movedir = vs; - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', true, 0, SND_HOOK_FIRE, CH_WEAPON_B, 0, WEP_HOOK.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, HOOK_MINS, HOOK_MAXS, true, 0, SND_HOOK_FIRE, CH_WEAPON_B, 0, WEP_HOOK.m_id); W_MuzzleFlash(WEP_HOOK, actor, weaponentity, w_shotorg, '0 0 0'); actor.(weaponentity).movedir = oldmovedir; @@ -388,7 +388,7 @@ void FireGrapplingHook(entity actor, .entity weaponentity) PROJECTILE_MAKETRIGGER(missile); //setmodel (missile, MDL_HOOK); // precision set below - setsize (missile, '-3 -3 -3', '3 3 3'); + setsize (missile, HOOK_MINS, HOOK_MAXS); setorigin(missile, w_shotorg); missile.state = 0; // not latched onto anything diff --git a/qcsrc/server/hook.qh b/qcsrc/server/hook.qh index 1b0729bd0..2af2b66d3 100644 --- a/qcsrc/server/hook.qh +++ b/qcsrc/server/hook.qh @@ -35,3 +35,5 @@ const float HOOK_WAITING_FOR_RELEASE = BIT(4); vector hook_shotorigin[4]; +#define HOOK_MINS '-4 -4 -4' // 0.8.5 used '-3 -3 -3' (before sv_legacy_bbox_expand 0) +#define HOOK_MAXS '4 4 4' // 0.8.5 used '3 3 3' (before sv_legacy_bbox_expand 0) diff --git a/qcsrc/server/weapons/common.qh b/qcsrc/server/weapons/common.qh index 779226be3..fb790b0fc 100644 --- a/qcsrc/server/weapons/common.qh +++ b/qcsrc/server/weapons/common.qh @@ -24,7 +24,14 @@ bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher .entity realowner; -#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END +// if these are too big the max possible blaster jump height is increased a little +const vector UNHITTABLEPROJ_MINS = '-0.015625 -0.015625 -0.015625'; // 0.8.5 set '0 0 0' (before sv_legacy_bbox_expand 0) +const vector UNHITTABLEPROJ_MAXS = '0.015625 0.015625 0.015625'; // 0.8.5 set '0 0 0' (before sv_legacy_bbox_expand 0) +const int CLIPGROUP_UNHITTABLEPROJ = 1; // these projectiles cannot deflect or destroy each other +// TODO: remove the following clipgroup comparison, which is included for backwards compatibility, after upgrading DP: +// in DP versions with DP_RM_CLIPGROUP, the touch func isn't called when the clipgroup is a matching non zero integer. +// see: https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1131 +#define PROJECTILE_TOUCH(e,t) if (((e).clipgroup && (e).clipgroup == (t).clipgroup) || ((e).solid == SOLID_TRIGGER && (t).solid == SOLID_TRIGGER) || WarpZone_Projectile_Touch(e,t)) return #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE // when doing this, hagar can go through clones diff --git a/qcsrc/server/weapons/tracing.qh b/qcsrc/server/weapons/tracing.qh index 94b3be212..95376b64b 100644 --- a/qcsrc/server/weapons/tracing.qh +++ b/qcsrc/server/weapons/tracing.qh @@ -29,11 +29,11 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect #define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \ W_SetupShot_Dir_ProjectileSize(ent, wepent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) #define W_SetupShot_Dir(ent, wepent, s_forward, antilag, recoil, snd, chan, maxdamage, deathtype) \ - W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype) + W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS, antilag, recoil, snd, chan, maxdamage, deathtype) #define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype) \ - W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype) + W_SetupShot_ProjectileSize(ent, wepent, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS, antilag, recoil, snd, chan, maxdamage, deathtype) #define W_SetupShot_Range(ent, wepent, antilag, recoil, snd, chan, maxdamage, range, deathtype) \ - W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range, deathtype) + W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, v_forward, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS, antilag, recoil, snd, chan, maxdamage, range, deathtype) vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute); -- 2.39.2