#ifdef SVQC // change to GAMEQC if/when we use nudgeoutofsolid in CSQC
if (checkextension("DP_QC_NUDGEOUTOFSOLID"))
{
- nudgeoutofsolid_CheckedEngineExtensions_usebuiltin();
+ nudgeoutofsolid_OrFallback = nudgeoutofsolid;
}
else
{
LOG_WARN("Engine lacks DP_QC_NUDGEOUTOFSOLID, falling back to WarpZoneLib_MoveOutOfSolid().");
// DP_QC_NUDGEOUTOFSOLID fixes many cases WarpZoneLib_MoveOutOfSolid() can't, usually in less CPU time
- nudgeoutofsolid = WarpZoneLib_MoveOutOfSolid;
+ nudgeoutofsolid_OrFallback = WarpZoneLib_MoveOutOfSolid;
}
if (!world.fullspawndata)
#ifdef GAMEQC
if (checkextension("DP_QC_FINDBOX"))
{
- findbox_CheckedEngineExtensions_usebuiltin();
- findbox_tofield_CheckedEngineExtensions_usebuiltin();
+ findbox_OrFallback = findbox;
+ findbox_tofield_OrFallback = findbox_tofield;
}
else
{
LOG_WARN("Engine lacks DP_QC_FINDBOX, performance will be suboptimal.");
- findbox = findbox_Fallback;
- findbox_tofield = findbox_tofield_Fallback;
+ findbox_OrFallback = findbox_Fallback;
+ findbox_tofield_OrFallback = findbox_tofield_Fallback;
}
#endif
#pragma once
-// TODO: when https://github.com/graphitemaster/gmqcc/issues/211 is fixed,
-// remove the _usebuiltin functions and pre-initialize the variables directly.
-// Doing so already works in FTEQCC but not in GMQCC.
-//
-// The _usebuiltin functions are declared here so that the preprocessors based
-// remapping does not impact them yet.
-
#ifdef GAMEQC
-var entity(vector mins, vector maxs, .entity tofield) findbox_tofield_CheckedEngineExtensions;
-void findbox_tofield_CheckedEngineExtensions_usebuiltin() {
- findbox_tofield_CheckedEngineExtensions = findbox_tofield;
-}
-#define findbox_tofield findbox_tofield_CheckedEngineExtensions
-var entity(vector mins, vector maxs) findbox_CheckedEngineExtensions;
-void findbox_CheckedEngineExtensions_usebuiltin() {
- findbox_CheckedEngineExtensions = findbox;
-}
-#define findbox findbox_CheckedEngineExtensions
+var entity(vector mins, vector maxs, .entity tofield) findbox_tofield_OrFallback = nil;
+var entity(vector mins, vector maxs) findbox_OrFallback = nil;
#endif
#ifdef SVQC // change to GAMEQC if/when we use nudgeoutofsolid in CSQC
-var float(entity ent) nudgeoutofsolid_CheckedEngineExtensions;
-void nudgeoutofsolid_CheckedEngineExtensions_usebuiltin() {
- nudgeoutofsolid_CheckedEngineExtensions = nudgeoutofsolid;
-}
-#define nudgeoutofsolid nudgeoutofsolid_CheckedEngineExtensions
+var float(entity ent) nudgeoutofsolid_OrFallback = nil;
#endif
void CheckEngineExtensions(void);
#include "sv_ctf.qh"
+#include <common/checkextension.qh>
#include <common/effects/all.qh>
#include <common/mapobjects/teleporters.qh>
#include <common/mapobjects/triggers.qh>
tracebox(player.origin - FLAG_DROP_OFFSET, flag.m_mins, flag.m_maxs, player.origin + FLAG_DROP_OFFSET, MOVE_NOMONSTERS, flag);
flag.solid = SOLID_TRIGGER; // before setorigin to ensure area grid linking
setorigin(flag, trace_endpos);
- if (trace_startsolid && !nudgeoutofsolid(flag)) // TODO: trace_allsolid would perform better but isn't 100% reliable yet
+ if (trace_startsolid && !nudgeoutofsolid_OrFallback(flag)) // TODO: trace_allsolid would perform better but isn't 100% reliable yet
{
// the flag's bbox doesn't fit but we can assume the player's current bbox does
tracebox(player.origin - FLAG_DROP_OFFSET, player.mins, player.maxs, player.origin + FLAG_DROP_OFFSET, MOVE_NOMONSTERS, flag);
#include "sv_keepaway.qh"
+#include <common/checkextension.qh>
#include <common/effects/all.qh>
#include <server/client.qh>
#include <server/gamelog.qh>
IL_PUSH(g_damagedbycontents, ball);
ball.effects &= ~EF_NODRAW;
setorigin(ball, player.origin + '0 0 10');
- nudgeoutofsolid(ball); // a ball has a horizontally bigger bbox than a player
+ nudgeoutofsolid_OrFallback(ball); // a ball has a horizontally bigger bbox than a player
ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
ball.owner = NULL;
navigation_dynamicgoal_set(ball, player);
#include "sv_keyhunt.qh"
+#include <common/checkextension.qh>
#include <server/command/vote.qh>
#include <server/gamelog.qh>
#include <server/damage.qh>
if(!IL_CONTAINS(g_items, key))
IL_PUSH(g_items, key);
set_movetype(key, MOVETYPE_TOSS);
- nudgeoutofsolid(key); // a key has a bigger bbox than a player
+ nudgeoutofsolid_OrFallback(key); // a key has a bigger bbox than a player
key.pain_finished = time + autocvar_g_balance_keyhunt_delay_return;
key.damageforcescale = autocvar_g_balance_keyhunt_damageforcescale;
key.takedamage = DAMAGE_YES;
#include "sv_tka.qh"
+#include <common/checkextension.qh>
#include <common/effects/all.qh>
.entity ballcarried;
ball.takedamage = DAMAGE_YES;
ball.effects &= ~EF_NODRAW;
setorigin(ball, player.origin + '0 0 10');
- nudgeoutofsolid(ball); // a ball has a horizontally bigger bbox than a player
+ nudgeoutofsolid_OrFallback(ball); // a ball has a horizontally bigger bbox than a player
ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
ball.owner = NULL;
navigation_dynamicgoal_set(ball, player);
#include "sv_monsters.qh"
+#include <common/checkextension.qh>
#include <common/constants.qh>
#include <common/deathtypes/all.qh>
#include <common/items/_mod.qh>
setorigin(this, trace_endpos);
}
- if (!nudgeoutofsolid(this))
+ if (!nudgeoutofsolid_OrFallback(this))
{
// Stuck and not fixable
Monster_Remove(this);
#include "porto.qh"
+#include <common/checkextension.qh>
+
#ifdef CSQC
STATIC_INIT(Porto)
// FIXME: item properties should be obtained from the registry
setsize(this, ITEM_D_MINS, ITEM_D_MAXS);
setorigin(this, this.origin + trace_plane_normal);
- if(nudgeoutofsolid(this))
+ if(nudgeoutofsolid_OrFallback(this))
{
this.flags = FL_ITEM;
IL_PUSH(g_items, this);
#include "common.qh"
+#include <common/checkextension.qh>
+
#if defined(CSQC)
#include <client/items/items.qh>
#elif defined(MENUQC)
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
{
- // bones_was_here: TODO: when findbox() builtin is available, use it to
+ // bones_was_here: TODO: when findbox_OrFallback() builtin is available, use it to
// optimise this into a single non-recursive function that only calls tracebox once
float f, s;
#include "items.qh"
+#include <common/checkextension.qh>
#include <common/constants.qh>
#include <common/deathtypes/all.qh>
#include <common/gamemodes/gamemode/cts/cts.qh>
}
// most loot items have a bigger horizontal size than a player
- nudgeoutofsolid(this);
+ nudgeoutofsolid_OrFallback(this);
// don't drop if in a NODROP zone (such as lava)
traceline(this.origin, this.origin, MOVE_NORMAL, this);
return;
}
- /* Prior to sv_legacy_bbox_expand 0, both droptofloor and nudgeoutofsolid were done for items
+ /* Prior to sv_legacy_bbox_expand 0, both droptofloor and nudgeoutofsolid_OrFallback were done for items
* using box '-16 -16 0' '16 16 48' (without the FL_ITEM expansion applied),
* which often resulted in bboxes partially in solids once expansion was applied.
* We don't want bboxes in solids (bad for gameplay and culling),
* but we also don't want items to land on a "skirting board" or the base of a sloping wall.
- * For initial nudgeoutofsolid and droptofloor stages we use a small box
+ * For initial nudgeoutofsolid_OrFallback and droptofloor stages we use a small box
* so they fall as far and in the same place as they traditionally would,
* then we nudge the full size box out of solid, in a direction appropriate for the plane(s).
*/
*/
if(!Q3COMPAT_COMMON && autocvar_sv_mapformat_is_quake3) // Xonotic, Nexuiz
{
- nudgeresult = nudgeoutofsolid(this);
+ nudgeresult = nudgeoutofsolid_OrFallback(this);
if (!nudgeresult)
LOG_WARNF("DropToFloor_QC at \"%v\": COULD NOT FIX badly placed entity \"%s\" before drop", this.origin, this.classname);
else if (nudgeresult > 0)
// A side effect of using a small box to drop items (and do the initial nudge) is
// the full size box can end up in collision with a sloping floor or terrain model.
- nudgeresult = nudgeoutofsolid(this);
+ nudgeresult = nudgeoutofsolid_OrFallback(this);
// No warns for successful nudge because it would spam about items on slopes/terrain.
}
else if (trace_allsolid && trace_fraction) // dropped using "proper" bbox but never left solid
{
- nudgeresult = nudgeoutofsolid(this);
+ nudgeresult = nudgeoutofsolid_OrFallback(this);
if (nudgeresult > 0)
LOG_WARNF("DropToFloor_QC at \"%v\": FIXED badly placed entity \"%s\" after drop", this.origin, this.classname);
}