]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/checkextension.qc
Add engine extension check: fullspawndata
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / checkextension.qc
1 #include "checkextension.qh"
2
3 #ifdef GAMEQC
4 entity findbox_tofield_Fallback(vector mins, vector maxs, .entity tofield)
5 {
6         // 0.03125 minimum radius because findradius returns no results if radius is zero
7         // but findbox for a zero-sized box returns entities touching the specified point
8         entity chain = findradius_tofield(0.5 * (mins + maxs), max(0.03125, 0.5 * vlen(maxs - mins)), tofield);
9         entity prev = NULL;
10         for (entity e = chain; e; e = e.tofield)
11         {
12                 if (boxesoverlap(e.absmin, e.absmax, mins, maxs))
13                         prev = e;
14                 else // not in box so remove from chain
15                 {
16                         if (prev)
17                                 prev.tofield = e.tofield;
18                         else
19                                 chain = chain.tofield;
20                 }
21         }
22         return chain;
23 }
24 entity findbox_Fallback(vector mins, vector maxs)
25 {
26         return findbox_tofield_Fallback(mins, maxs, chain);
27 }
28 #endif // GAMEQC
29
30 void CheckEngineExtensions(void)
31 {
32         if (!cvar("pr_checkextension"))
33                 LOG_FATAL("Engine lacks the QC extension system.");
34
35         if (!checkextension("DP_QC_URI_GET") || !checkextension("DP_QC_URI_POST"))
36                 LOG_WARN("Engine lacks HTTP support, XonStat and map downloads are unavailable.");
37
38         if (!checkextension("DP_CRYPTO"))
39                 LOG_WARN("Engine lacks DP_CRYPTO, Player IDs (required for XonStat and CTS/CTF records) are unavailable.");
40
41 #ifdef SVQC // change to GAMEQC if/when we use nudgeoutofsolid in CSQC
42         if (!checkextension("DP_QC_NUDGEOUTOFSOLID"))
43         {
44                 LOG_WARN("Engine lacks DP_QC_NUDGEOUTOFSOLID, falling back to WarpZoneLib_MoveOutOfSolid().");
45                 // DP_QC_NUDGEOUTOFSOLID fixes many cases WarpZoneLib_MoveOutOfSolid() can't, usually in less CPU time
46                 nudgeoutofsolid = WarpZoneLib_MoveOutOfSolid;
47         }
48
49         if (!world.fullspawndata)
50                 LOG_WARN("Engine lacks entity fullspawndata, on Quake 3 maps some entities will malfunction.");
51 #endif
52
53 #ifdef GAMEQC
54         if (!checkextension("DP_QC_FINDBOX"))
55         {
56                 LOG_WARN("Engine lacks DP_QC_FINDBOX, performance will be suboptimal.");
57                 findbox = findbox_Fallback;
58                 findbox_tofield = findbox_tofield_Fallback;
59         }
60 #endif
61
62         // TODO: add proper warns/errors for other extensions we depend on
63 }