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 settings for each weapon / turret
30 const int MAX_CONFIG_SETTINGS = 70;
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 void write_String_To_File(int fh, string str, bool alsoprint);
140 string get_model_datafilename(string mod, float skn, string fil); // skin -1 will return wildcard, mod string_null will also put wildcard there
141 string get_model_parameters_modelname;
142 float get_model_parameters_modelskin;
143 string get_model_parameters_name;
144 float get_model_parameters_species;
145 string get_model_parameters_sex;
146 float get_model_parameters_weight;
147 float get_model_parameters_age;
148 bool get_model_parameters_hidden;
149 string get_model_parameters_description;
150 string get_model_parameters_bone_upperbody;
151 string get_model_parameters_bone_weapon;
152 const int MAX_AIM_BONES = 4;
153 string get_model_parameters_bone_aim[MAX_AIM_BONES];
154 float get_model_parameters_bone_aimweight[MAX_AIM_BONES];
155 float get_model_parameters_fixbone;
156 string get_model_parameters_desc;
157 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
160 string translate_key(string key);
162 // x-encoding (encoding as zero length invisible string)
163 // encodes approx. 14 bits into 5 bytes of color code string
164 const float XENCODE_MAX = 21295; // 2*22*22*22-1
165 const float XENCODE_LEN = 5;
166 string xencode(float f);
167 float xdecode(string s);
170 string strtolower(string s);
173 // generic shutdown handler
177 .float skeleton_bones;
178 void Skeleton_SetBones(entity e);
179 // loops through the tags of model v using counter tagnum
180 #define FOR_EACH_TAG(v) float tagnum; Skeleton_SetBones(v); for(tagnum = 0; tagnum < v.skeleton_bones; tagnum++, gettaginfo(v, tagnum))
183 // execute-stuff-next-frame subsystem
184 void execute_next_frame();
185 void queue_to_execute_next_frame(string s);
187 USING(findNextEntityNearFunction_t, entity(entity cur, entity near, entity pass));
188 USING(isConnectedFunction_t, float(entity a, entity b, entity pass));
189 void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass);
191 // expand multiple arguments into one argument by stripping parenthesis
192 #define XPD(...) __VA_ARGS__
194 // Some common varargs functions. Lowercase as they match C.
195 #define fprintf(file, ...) fputs(file, sprintf(__VA_ARGS__))
196 #define bprintf(...) bprint(sprintf(__VA_ARGS__))
200 #define GENTLE (autocvar_cl_gentle || autocvar_cl_gentle_messages)
202 #define GENTLE autocvar_sv_gentle
204 #define normal_or_gentle(normal, gentle) ((GENTLE && (gentle != "")) ? gentle : normal)
208 vector animfixfps(entity e, vector a, vector b);
212 const int CNT_NORMAL = 1;
213 const int CNT_GAMESTART = 2;
214 const int CNT_IDLE = 3;
215 const int CNT_KILL = 4;
216 const int CNT_RESPAWN = 5;
217 const int CNT_ROUNDSTART = 6;
218 entity Announcer_PickNumber(int type, int num);
222 int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents);
223 int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents);
226 #define APPEND_TO_STRING(list,sep,add) ((list) = (((list) != "") ? strcat(list, sep, add) : (add)))
228 // Returns the correct difference between two always increasing numbers
229 #define COMPARE_INCREASING(to,from) (to < from ? from + to + 2 : to - from)
232 void attach_sameorigin(entity e, entity to, string tag);
234 void detach_sameorigin(entity e);
236 void follow_sameorigin(entity e, entity to);
238 void SetMovetypeFollow(entity ent, entity e);
240 void UnsetMovetypeFollow(entity ent);
242 float LostMovetypeFollow(entity ent);
246 string playername(string thename, int teamid, bool team_colorize);
248 float trace_hits_box_1d(float end, float thmi, float thma);
250 float trace_hits_box(vector start, vector end, vector thmi, vector thma);
252 float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
254 float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
257 float cvar_or(string cv, float v);
259 float blink_synced(float base, float range, float freq, float start_time, int start_blink);
261 float blink(float base, float range, float freq);