4 #include <server/autocvars.qh>
8 float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity); // returns the number of traces done, for benchmarking
10 void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity);
18 Returns a point at least 12 units away from walls
19 (useful for explosion animations, although the blast is performed where it really happened)
23 vector findbetterlocation (vector org, float mindist);
25 vector real_origin(entity ent);
29 // temporary array used to dump weapon and turret settings
30 const int MAX_CONFIG_SETTINGS = 256;
31 string config_queue[MAX_CONFIG_SETTINGS];
37 IntrusiveList g_saved_cvars;
38 STATIC_INIT(g_saved_cvars) { g_saved_cvars = IL_NEW(); }
40 // this returns a tempstring containing a copy of s with additional \n newlines added, it also replaces \n in the text with a real newline
41 // NOTE: s IS allowed to be a tempstring
42 string wordwrap(string s, float l);
44 void wordwrap_sprint(entity to, string s, float l);
46 void wordwrap_cb(string s, float l, void(string) callback);
49 string draw_currentSkin;
50 string draw_UseSkinFor(string pic);
53 // iterative depth-first search, with fields that go "up", "down left" and "right" in a tree
54 // for each element, funcPre is called first, then funcPre and funcPost for all its children, and funcPost last
55 void depthfirst(entity start, .entity up, .entity downleft, .entity right, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass);
57 #define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.5)
59 const int TIME_DECIMALS = 2;
60 const float TIME_FACTOR = 100;
61 #define TIME_ENCODED_TOSTRING(n) mmssss(n)
62 #define RACE_RECORD "/race100record/"
63 #define CTS_RECORD "/cts100record/"
64 #define CTF_RECORD "/ctf100record/"
65 #define TIME_ENCODE(t) TIME_TO_NTHS(t, TIME_FACTOR)
66 #define TIME_DECODE(n) ((n) / TIME_FACTOR)
69 string ScoreString(float vflags, float value);
72 vector decompressShortVector(float data);
73 float compressShortVector(vector vec);
76 float CheckWireframeBox(entity forent, vector v0, vector dvx, vector dvy, vector dvz);
79 string fixPriorityList(string pl, float from, float to, float subtract, float complete);
80 string mapPriorityList(string order, string(string) mapfunc);
81 string swapInPriorityList(string order, float i, float j);
83 float cvar_settemp(string pKey, string pValue);
84 float cvar_settemp_restore();
87 // modes: 0 = trust q3map2 (_mini images)
88 // 1 = trust tracebox (_radar images)
89 // in both modes, mapinfo's "size" overrides
94 void get_mi_min_max(float mode);
96 vector mi_picmin; // adjusted mins that map to the picture (square)
97 vector mi_picmax; // adjusted maxs that map to the picture (square)
98 vector mi_pictexcoord0; // texcoords of the image corners (after transforming, these are 2D coords too)
99 vector mi_pictexcoord1; // texcoords of the image corners (after transforming, these are 2D coords too)
100 vector mi_pictexcoord2; // texcoords of the image corners (after transforming, these are 2D coords too)
101 vector mi_pictexcoord3; // texcoords of the image corners (after transforming, these are 2D coords too)
102 void get_mi_min_max_texcoords(float mode);
105 USING(textLengthUpToWidth_widthFunction_t, float(string s, vector size));
106 USING(textLengthUpToLength_lenFunction_t, float(string s));
107 float textLengthUpToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw);
108 string textShortenToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw);
109 float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_lenFunction_t tw);
110 string textShortenToLength(string theText, float maxWidth, textLengthUpToLength_lenFunction_t tw);
112 string getWrappedLine_remaining;
113 string getWrappedLine(float w, vector size, textLengthUpToWidth_widthFunction_t tw);
114 string getWrappedLineLen(float w, textLengthUpToLength_lenFunction_t tw);
116 float isGametypeInFilter(entity gt, float tp, float ts, string pattern);
118 vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel, float spd, float newton_style);
119 vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_style, float mi, float ma);
121 float compressShotOrigin(vector v);
122 vector decompressShotOrigin(float f);
125 string rankings_reply, ladder_reply, lsmaps_reply, maplist_reply, monsterlist_reply; // cached replies
126 string records_reply[10];
130 vector healtharmor_maxdamage(float h, float a, float armorblock, int deathtype); // returns vector: maxdamage, armorideal, 1 if fully armored
131 vector healtharmor_applydamage(float a, float armorblock, int deathtype, float damage); // returns vector: take, save, 0
134 string getcurrentmod();
136 float matchacl(string acl, string str); // matches str against ACL acl (with entries +foo*, +foo, +*foo, +*foo*, and same with - for forbidding)
138 string get_model_datafilename(string mod, float skn, string fil); // skin -1 will return wildcard, mod string_null will also put wildcard there
139 string get_model_parameters_modelname;
140 float get_model_parameters_modelskin;
141 string get_model_parameters_name;
142 float get_model_parameters_species;
143 string get_model_parameters_sex;
144 float get_model_parameters_weight;
145 float get_model_parameters_age;
146 bool get_model_parameters_hidden;
147 string get_model_parameters_description;
148 string get_model_parameters_bone_upperbody;
149 string get_model_parameters_bone_weapon;
150 const int MAX_AIM_BONES = 4;
151 string get_model_parameters_bone_aim[MAX_AIM_BONES];
152 float get_model_parameters_bone_aimweight[MAX_AIM_BONES];
153 float get_model_parameters_fixbone;
154 string get_model_parameters_desc;
155 float get_model_parameters(string mod, float skn); // call with string_null to clear; skin -1 means mod is the filename of the txt file and is to be split
157 // x-encoding (encoding as zero length invisible string)
158 // encodes approx. 14 bits into 5 bytes of color code string
159 const float XENCODE_MAX = 21295; // 2*22*22*22-1
160 const float XENCODE_LEN = 5;
161 string xencode(float f);
162 float xdecode(string s);
165 string strtolower(string s);
168 // generic shutdown handler
172 .float skeleton_bones;
173 void Skeleton_SetBones(entity e);
174 // loops through the tags of model v using counter tagnum
175 #define FOR_EACH_TAG(v) float tagnum; Skeleton_SetBones(v); for(tagnum = 0; tagnum < v.skeleton_bones; tagnum++, gettaginfo(v, tagnum))
178 // execute-stuff-next-frame subsystem
179 void execute_next_frame();
180 void queue_to_execute_next_frame(string s);
182 USING(findNextEntityNearFunction_t, entity(entity cur, entity near, entity pass));
183 USING(isConnectedFunction_t, float(entity a, entity b, entity pass));
184 void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass);
186 // expand multiple arguments into one argument by stripping parenthesis
187 #define XPD(...) __VA_ARGS__
189 // Some common varargs functions. Lowercase as they match C.
190 #define fprintf(file, ...) fputs(file, sprintf(__VA_ARGS__))
191 #define bprintf(...) bprint(sprintf(__VA_ARGS__))
195 #define GENTLE (autocvar_cl_gentle || autocvar_cl_gentle_messages)
197 #define GENTLE autocvar_sv_gentle
199 #define normal_or_gentle(normal, gentle) (GENTLE ? ((gentle != "") ? gentle : normal) : normal)
203 vector animfixfps(entity e, vector a, vector b);
207 const int CNT_NORMAL = 1;
208 const int CNT_GAMESTART = 2;
209 const int CNT_IDLE = 3;
210 const int CNT_KILL = 4;
211 const int CNT_RESPAWN = 5;
212 const int CNT_ROUNDSTART = 6;
213 entity Announcer_PickNumber(int type, int num);
217 int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents);
218 int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents);
221 #define APPEND_TO_STRING(list,sep,add) ((list) = (((list) != "") ? strcat(list, sep, add) : (add)))
223 // Returns the correct difference between two always increasing numbers
224 #define COMPARE_INCREASING(to,from) (to < from ? from + to + 2 : to - from)