From 784ca5c42458924efc95ca8822a2b10d4f3c84b5 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 7 Apr 2023 03:02:46 +1000 Subject: [PATCH] Don't link pure entities to the area grid in DP master This is important for performance. --- qcsrc/lib/oo.qh | 31 ++++++++++++++++++------------- xonotic-client.cfg | 3 +++ xonotic-server.cfg | 3 +++ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 9048202fe..5960287bf 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -4,17 +4,23 @@ #include "nil.qh" #include "static.qh" -.vector origin; - +// pure entities: not linked to the area grid +// see: sv_areagrid_link_SOLID_NOT and cl_areagrid_link_SOLID_NOT .bool pure_data; -#define is_pure(e) ((e).pure_data) -/** @deprecated use new_pure or NEW(class) */ -#define make_pure(e) MACRO_BEGIN \ - (e).pure_data = true; \ -MACRO_END -#define make_impure(e) MACRO_BEGIN \ - (e).pure_data = false; \ -MACRO_END + +#ifdef GAMEQC + /** direct use is @deprecated use new_pure or NEW(class) */ + #define make_pure(e) \ + (e).pure_data = true; \ + (e).solid = SOLID_NOT; + #define is_pure(e) ((e).pure_data && (e).solid == SOLID_NOT) +#else + #define make_pure(e) \ + (e).pure_data = true; + #define is_pure(e) ((e).pure_data) +#endif // GAMEQC +#define make_impure(e) \ + (e).pure_data = false; .string classname; /** Location entity was spawned from in source */ @@ -25,7 +31,6 @@ entity _spawn(); #define SPAWN_PURE 0 #endif -// pure entities: need no .origin #if SPAWN_PURE entity spawn_pure() = #600; #else @@ -56,9 +61,9 @@ entity __spawn(string _classname, string _sourceLoc, bool pure) #define classfield(name) [[class(name)]] #define _new(class, pure) ((class) __spawn(#class, __FILE__ ":" STR(__LINE__), pure)) #endif -/** entities you care about seeing (.origin works) */ +/** entities you care about collisions with */ #define new(class) _new(class, false) -/** purely logical entities (.origin doesn't work) */ +/** purely logical entities (not linked to the area grid) */ #define new_pure(class) _new(class, true) #define spawn() __spawn("entity", __FILE__ ":" STR(__LINE__), false) diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 22792e06e..46149e2d1 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -919,3 +919,6 @@ set cl_rollkillspeed 10 // Interpreted in post-config.cfg. seta menu_forced_saved_cvars "" "These cvars will always be saved, despite engine/Xonotic cvar saving status" set menu_reverted_nonsaved_cvars "" "These cvars are currently marked as saved in the flags, but have been reverted and won't stay saved. INTERNAL USE ONLY." + +// Avoid perf problems near '0 0 0'; `set` without a description is because only current DP has this engine cvar +set cl_areagrid_link_SOLID_NOT 0 diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 82cccae0f..94532425f 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -598,3 +598,6 @@ set sv_warpzone_allow_selftarget 0 "do not touch" sv_disablenotify 1 set sv_quickmenu_file "" "filename of a custom server's quickmenu that will be selectable from the default client's quickmenu. This file must be sent in a pk3 archive and should have an unique name (e.g. quickmenu-servername.txt) to prevent overriding existing quickmenus" + +// Avoid perf problems near '0 0 0'; `set` without a description is because only current DP has this engine cvar +set sv_areagrid_link_SOLID_NOT 0 -- 2.39.2